Merge branch 'master' of github.com:worklist/hifi into ds-admin

This commit is contained in:
Stephen Birarda 2013-10-23 10:27:24 -07:00
commit f765ef4385
17 changed files with 284 additions and 158 deletions

View file

@ -35,6 +35,7 @@ pid_t* childForks = NULL;
sockaddr_in customAssignmentSocket = {};
int numForks = 0;
Assignment::Type overiddenAssignmentType = Assignment::AllTypes;
const char* assignmentPool = NULL;
int argc = 0;
char** argv = NULL;
@ -64,7 +65,7 @@ void childClient() {
sockaddr_in senderSocket = {};
// create a request assignment, accept assignments defined by the overidden type
Assignment requestAssignment(Assignment::RequestCommand, ::overiddenAssignmentType);
Assignment requestAssignment(Assignment::RequestCommand, ::overiddenAssignmentType, ::assignmentPool);
qDebug() << "Waiting for assignment -" << requestAssignment << "\n";
@ -219,6 +220,9 @@ int main(int argc, char* argv[]) {
// so set that as the ::overridenAssignmentType to be used in requests
::overiddenAssignmentType = (Assignment::Type) atoi(assignmentTypeString);
}
const char ASSIGNMENT_POOL_OPTION[] = "--pool";
::assignmentPool = getCmdOption(argc, (const char**) argv, ASSIGNMENT_POOL_OPTION);
const char* NUM_FORKS_PARAMETER = "-n";
const char* numForksString = getCmdOption(argc, (const char**)argv, NUM_FORKS_PARAMETER);

View file

@ -173,7 +173,10 @@ const char ASSIGNMENT_SCRIPT_HOST_LOCATION[] = "resources/web/assignment";
void DomainServer::civetwebUploadHandler(struct mg_connection *connection, const char *path) {
// create an assignment for this saved script, for now make it local only
Assignment *scriptAssignment = new Assignment(Assignment::CreateCommand, Assignment::AgentType, Assignment::LocalLocation);
Assignment *scriptAssignment = new Assignment(Assignment::CreateCommand,
Assignment::AgentType,
NULL,
Assignment::LocalLocation);
// check how many instances of this assignment the user wants by checking the ASSIGNMENT-INSTANCES header
const char ASSIGNMENT_INSTANCES_HTTP_HEADER[] = "ASSIGNMENT-INSTANCES";
@ -302,12 +305,8 @@ void DomainServer::prepopulateStaticAssignmentFile() {
Assignment freshStaticAssignments[MAX_STATIC_ASSIGNMENT_FILE_ASSIGNMENTS];
// pre-populate the first static assignment list with assignments for root AuM, AvM, VS
freshStaticAssignments[numFreshStaticAssignments++] = Assignment(Assignment::CreateCommand,
Assignment::AudioMixerType,
Assignment::LocalLocation);
freshStaticAssignments[numFreshStaticAssignments++] = Assignment(Assignment::CreateCommand,
Assignment::AvatarMixerType,
Assignment::LocalLocation);
freshStaticAssignments[numFreshStaticAssignments++] = Assignment(Assignment::CreateCommand, Assignment::AudioMixerType);
freshStaticAssignments[numFreshStaticAssignments++] = Assignment(Assignment::CreateCommand, Assignment::AvatarMixerType);
// Handle Domain/Voxel Server configuration command line arguments
if (_voxelServerConfig) {
@ -323,9 +322,23 @@ void DomainServer::prepopulateStaticAssignmentFile() {
qDebug("config[%d]=%s\n", i, config.toLocal8Bit().constData());
// Now, parse the config to check for a pool
const char ASSIGNMENT_CONFIG_POOL_OPTION[] = "--pool";
QString assignmentPool;
int poolIndex = config.indexOf(ASSIGNMENT_CONFIG_POOL_OPTION);
if (poolIndex >= 0) {
int spaceBeforePoolIndex = config.indexOf(' ', poolIndex);
int spaceAfterPoolIndex = config.indexOf(' ', spaceBeforePoolIndex);
assignmentPool = config.mid(spaceBeforePoolIndex + 1, spaceAfterPoolIndex);
qDebug() << "The pool for this voxel-assignment is" << assignmentPool << "\n";
}
Assignment voxelServerAssignment(Assignment::CreateCommand,
Assignment::VoxelServerType,
Assignment::LocalLocation); // use same location as we were created in.
(assignmentPool.isEmpty() ? NULL : assignmentPool.toLocal8Bit().constData()));
int payloadLength = config.length() + sizeof(char);
voxelServerAssignment.setPayload((uchar*)config.toLocal8Bit().constData(), payloadLength);
@ -333,9 +346,7 @@ void DomainServer::prepopulateStaticAssignmentFile() {
freshStaticAssignments[numFreshStaticAssignments++] = voxelServerAssignment;
}
} else {
Assignment rootVoxelServerAssignment(Assignment::CreateCommand,
Assignment::VoxelServerType,
Assignment::LocalLocation);
Assignment rootVoxelServerAssignment(Assignment::CreateCommand, Assignment::VoxelServerType);
freshStaticAssignments[numFreshStaticAssignments++] = rootVoxelServerAssignment;
}
@ -390,9 +401,14 @@ Assignment* DomainServer::deployableAssignmentForRequest(Assignment& requestAssi
std::deque<Assignment*>::iterator assignment = _assignmentQueue.begin();
while (assignment != _assignmentQueue.end()) {
bool requestIsAllTypes = requestAssignment.getType() == Assignment::AllTypes;
bool assignmentTypesMatch = (*assignment)->getType() == requestAssignment.getType();
bool nietherHasPool = !(*assignment)->hasPool() && !requestAssignment.hasPool();
bool assignmentPoolsMatch = memcmp((*assignment)->getPool(),
requestAssignment.getPool(),
MAX_ASSIGNMENT_POOL_BYTES) == 0;
if (requestAssignment.getType() == Assignment::AllTypes ||
(*assignment)->getType() == requestAssignment.getType()) {
if ((requestIsAllTypes || assignmentTypesMatch) && (nietherHasPool || assignmentPoolsMatch)) {
Assignment* deployableAssignment = *assignment;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>close</title>
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="close" sketch:type="MSLayerGroup" transform="translate(2.000000, 2.000000)">
<g id="close-button">
<circle d="M14.8148148,29.6296296 C22.9968115,29.6296296 29.6296296,22.9968115 29.6296296,14.8148148 C29.6296296,6.63281812 22.9968115,0 14.8148148,0 C6.63281812,0 0,6.63281812 0,14.8148148 C0,22.9968115 6.63281812,29.6296296 14.8148148,29.6296296 Z M14.8148148,29.6296296" id="background" fill="#FFFFFF" cx="14.8148148" cy="14.8148148" r="14.8148148"></circle>
<circle d="M15.7036966,30.8654803 C24.0773189,30.8654803 30.8654803,24.0773189 30.8654803,15.7036966 C30.8654803,7.33007426 24.0773189,0.541912889 15.7036966,0.541912889 C7.33007426,0.541912889 0.541912889,7.33007426 0.541912889,15.7036966 C0.541912889,24.0773189 7.33007426,30.8654803 15.7036966,30.8654803 Z M15.7036966,30.8654803" id="circle" stroke="#000000" stroke-width="4" cx="15.7036966" cy="15.7036966" r="15.1617837"></circle>
<path d="M7.5368995,7.83319579 L23.5562405,23.8525368" id="topdown" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
<path d="M8.14743772,23.5562661 L23.592926,8.11077784" id="botup" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -85,6 +85,12 @@ const int STARTUP_JITTER_SAMPLES = PACKET_LENGTH_SAMPLES_PER_CHANNEL / 2;
// Startup optimistically with small jitter buffer that
// will start playback on the second received audio packet.
const int MIRROR_VIEW_TOP_PADDING = 5;
const int MIRROR_VIEW_LEFT_PADDING = 10;
const int MIRROR_VIEW_WIDTH = 265;
const int MIRROR_VIEW_HEIGHT = 215;
const int MIRROR_ICON_SIZE = 16;
const int MIRROR_CLOSE_ICON_PADDING = 5;
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
fprintf(stdout, "%s", message.toLocal8Bit().constData());
@ -253,12 +259,12 @@ void Application::restoreSizeAndPosition() {
settings->beginGroup("Window");
float x = loadSetting(settings, "x", 0);
float y = loadSetting(settings, "y", 0);
int x = (int)loadSetting(settings, "x", 0);
int y = (int)loadSetting(settings, "y", 0);
_window->move(x, y);
int width = loadSetting(settings, "width", available.width());
int height = loadSetting(settings, "height", available.height());
int width = (int)loadSetting(settings, "width", available.width());
int height = (int)loadSetting(settings, "height", available.height());
_window->resize(width, height);
settings->endGroup();
@ -361,20 +367,7 @@ void Application::paintGL() {
glEnable(GL_LINE_SMOOTH);
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
_myCamera.setTightness (100.0f);
glm::vec3 targetPosition = _myAvatar.getUprightHeadPosition();
if (_myAvatar.getHead().getBlendFace().isActive()) {
// make sure we're aligned to the blend face eyes
glm::vec3 leftEyePosition, rightEyePosition;
if (_myAvatar.getHead().getBlendFace().getEyePositions(leftEyePosition, rightEyePosition, true)) {
targetPosition = (leftEyePosition + rightEyePosition) * 0.5f;
}
}
_myCamera.setTargetPosition(targetPosition);
_myCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f)));
} else if (OculusManager::isConnected()) {
if (OculusManager::isConnected()) {
_myCamera.setUpShift (0.0f);
_myCamera.setDistance (0.0f);
_myCamera.setTightness (0.0f); // Camera is directly connected to head without smoothing
@ -435,6 +428,37 @@ void Application::paintGL() {
_glowEffect.render();
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
glm::vec3 targetPosition = _myAvatar.getUprightHeadPosition();
_mirrorCamera.setDistance(0.2f);
_mirrorCamera.setTargetPosition(targetPosition);
_mirrorCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f)));
_mirrorCamera.update(1.0f/_fps);
// set the bounds of rear mirror view
glViewport(_mirrorViewRect.x(), _glWidget->height() - _mirrorViewRect.y() - _mirrorViewRect.height(), _mirrorViewRect.width(), _mirrorViewRect.height());
glScissor(_mirrorViewRect.x(), _glWidget->height() - _mirrorViewRect.y() - _mirrorViewRect.height(), _mirrorViewRect.width(), _mirrorViewRect.height());
updateProjectionMatrix(_mirrorCamera);
glEnable(GL_SCISSOR_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// render rear mirror view
glPushMatrix();
displaySide(_mirrorCamera);
glPopMatrix();
// render rear view tools if mouse is in the bounds
QPoint mousePosition = _glWidget->mapFromGlobal(QCursor::pos());
if (_mirrorViewRect.contains(mousePosition.x(), mousePosition.y())) {
displayRearMirrorTools();
}
// reset Viewport and projection matrix
glViewport(0, 0, _glWidget->width(), _glWidget->height());
glDisable(GL_SCISSOR_TEST);
updateProjectionMatrix();
}
displayOverlay();
}
@ -457,6 +481,8 @@ void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height)
void Application::resizeGL(int width, int height) {
resetCamerasOnResizeGL(_viewFrustumOffsetCamera, width, height);
resetCamerasOnResizeGL(_myCamera, width, height);
_mirrorViewRect = QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT);
glViewport(0, 0, width, height); // shouldn't this account for the menu???
@ -465,11 +491,15 @@ void Application::resizeGL(int width, int height) {
}
void Application::updateProjectionMatrix() {
updateProjectionMatrix(_myCamera);
}
void Application::updateProjectionMatrix(Camera& camera) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Tell our viewFrustum about this change, using the application camera
loadViewFrustum(_myCamera, _viewFrustum);
loadViewFrustum(camera, _viewFrustum);
float left, right, bottom, top, nearVal, farVal;
glm::vec4 nearClipPlane, farClipPlane;
@ -999,7 +1029,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
if (activeWindow() == _window) {
_mouseX = event->x();
_mouseY = event->y();
// detect drag
glm::vec3 mouseVoxelPos(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z);
if (!_justEditedVoxel && mouseVoxelPos != _lastMouseVoxelPos) {
@ -1037,6 +1067,14 @@ void Application::mousePressEvent(QMouseEvent* event) {
return;
}
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
QRect closeIconRect = QRect(MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.left(), MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.top(), MIRROR_ICON_SIZE, MIRROR_ICON_SIZE);
if (closeIconRect.contains(_mouseX, _mouseY)) {
Menu::getInstance()->triggerOption(MenuOption::Mirror);
}
}
if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) {
_pieMenu.mousePressEvent(_mouseX, _mouseY);
}
@ -1613,8 +1651,15 @@ void Application::init() {
_myAvatar.setPosition(START_LOCATION);
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
_myCamera.setModeShiftRate(1.0f);
_myAvatar.setDisplayingLookatVectors(false);
_myAvatar.setDisplayingLookatVectors(false);
_mirrorCamera.setMode(CAMERA_MODE_MIRROR);
_mirrorCamera.setAspectRatio((float)MIRROR_VIEW_WIDTH / (float)MIRROR_VIEW_HEIGHT);
_mirrorCamera.setFieldOfView(70);
_mirrorViewRect = QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT);
switchToResourcesParentIfRequired();
_closeTextureId = _glWidget->bindTexture(QImage("./resources/images/close.png"));
OculusManager::connect();
if (OculusManager::isConnected()) {
@ -1643,7 +1688,7 @@ void Application::init() {
_voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels());
_voxels.setUseVoxelShader(Menu::getInstance()->isOptionChecked(MenuOption::UseVoxelShader));
_voxels.setVoxelsAsPoints(Menu::getInstance()->isOptionChecked(MenuOption::VoxelsAsPoints));
_voxels.setUseFastVoxelPipeline(Menu::getInstance()->isOptionChecked(MenuOption::FastVoxelPipeline));
_voxels.setDisableFastVoxelPipeline(Menu::getInstance()->isOptionChecked(MenuOption::DisableFastVoxelPipeline));
_voxels.init();
@ -2080,12 +2125,7 @@ void Application::update(float deltaTime) {
}
if (!OculusManager::isConnected()) {
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
_myCamera.setMode(CAMERA_MODE_MIRROR);
_myCamera.setModeShiftRate(100.0f);
}
} else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
_myCamera.setModeShiftRate(1.0f);
@ -2098,7 +2138,7 @@ void Application::update(float deltaTime) {
}
if (Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
float xSign = Menu::getInstance()->isOptionChecked(MenuOption::Mirror) ? 1.0f : -1.0f;
float xSign = _myCamera.getMode() == CAMERA_MODE_MIRROR ? 1.0f : -1.0f;
if (_faceshift.isActive()) {
const float EYE_OFFSET_SCALE = 0.025f;
glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE;
@ -2389,7 +2429,7 @@ void Application::displayOculus(Camera& whichCamera) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, _glWidget->width(), 0, _glWidget->height());
gluOrtho2D(0, _glWidget->width(), 0, _glWidget->height());
glDisable(GL_DEPTH_TEST);
// for reference on setting these values, see SDK file Samples/OculusRoomTiny/RenderTiny_Device.cpp
@ -2466,13 +2506,6 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom
float& far, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {
_viewFrustum.computeOffAxisFrustum(left, right, bottom, top, near, far, nearClipPlane, farClipPlane);
// when mirrored, we must flip left and right
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
float tmp = left;
left = -right;
right = -tmp;
}
}
void Application::displaySide(Camera& whichCamera) {
@ -2480,7 +2513,7 @@ void Application::displaySide(Camera& whichCamera) {
// transform by eye offset
// flip x if in mirror mode (also requires reversing winding order for backface culling)
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
if (whichCamera.getMode() == CAMERA_MODE_MIRROR) {
glScalef(-1.0f, 1.0f, 1.0f);
glFrontFace(GL_CW);
@ -2601,7 +2634,7 @@ void Application::displaySide(Camera& whichCamera) {
glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR);
// indicate what we'll be adding/removing in mouse mode, if anything
if (_mouseVoxel.s != 0) {
if (_mouseVoxel.s != 0 && whichCamera.getMode() != CAMERA_MODE_MIRROR) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"Application::displaySide() ... voxels TOOLS UX...");
@ -2649,7 +2682,7 @@ void Application::displaySide(Camera& whichCamera) {
glEnable(GL_LIGHTING);
}
if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) {
if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode && whichCamera.getMode() != CAMERA_MODE_MIRROR) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"Application::displaySide() ... PASTE Preview...");
@ -2685,7 +2718,7 @@ void Application::displaySide(Camera& whichCamera) {
}
// Set lookAt to myCamera on client side if other avatars are looking at client
if (isLookingAtMyAvatar(avatar)) {
avatar->getHead().setLookAtPosition(_myCamera.getPosition());
avatar->getHead().setLookAtPosition(whichCamera.getPosition());
}
avatar->render(false, Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
avatar->setDisplayingLookatVectors(Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors));
@ -2695,10 +2728,10 @@ void Application::displaySide(Camera& whichCamera) {
}
// Render my own Avatar
if (_myCamera.getMode() == CAMERA_MODE_MIRROR && !_faceshift.isActive()) {
_myAvatar.getHead().setLookAtPosition(_myCamera.getPosition());
if (whichCamera.getMode() == CAMERA_MODE_MIRROR && !_faceshift.isActive()) {
_myAvatar.getHead().setLookAtPosition(whichCamera.getPosition());
}
_myAvatar.render(Menu::getInstance()->isOptionChecked(MenuOption::Mirror),
_myAvatar.render(whichCamera.getMode() == CAMERA_MODE_MIRROR,
Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
_myAvatar.setDisplayingLookatVectors(Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors));
@ -2710,7 +2743,7 @@ void Application::displaySide(Camera& whichCamera) {
_myAvatar.renderScreenTint(SCREEN_TINT_AFTER_AVATARS, whichCamera);
// Render the world box
if (!Menu::getInstance()->isOptionChecked(MenuOption::Mirror) && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
renderWorldBox();
}
@ -2722,7 +2755,7 @@ void Application::displaySide(Camera& whichCamera) {
}
// brad's frustum for debugging
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum)) {
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum) && whichCamera.getMode() != CAMERA_MODE_MIRROR) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"Application::displaySide() ... renderViewFrustum...");
renderViewFrustum(_viewFrustum);
@ -2803,7 +2836,6 @@ void Application::displayOverlay() {
//noiseTest(_glWidget->width(), _glWidget->height());
if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)
&& !Menu::getInstance()->isOptionChecked(MenuOption::Mirror)
&& USING_INVENSENSE_MPU9150) {
// Display small target box at center or head mouse target that can also be used to measure LOD
glColor3f(1.0, 1.0, 1.0);
@ -2955,7 +2987,7 @@ void Application::displayOverlay() {
if (_pieMenu.isDisplayed()) {
_pieMenu.render();
}
glPopMatrix();
}
@ -3782,3 +3814,42 @@ void* Application::networkReceive(void* args) {
void Application::packetSentNotification(ssize_t length) {
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(length);
}
void Application::displayRearMirrorTools() {
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(_mirrorViewRect.left(), _mirrorViewRect.right(), _mirrorViewRect.bottom(), _mirrorViewRect.top());
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, _closeTextureId);
glColor3f(1, 1, 1);
glBegin(GL_QUADS);
int lp = MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.left();
int tp = MIRROR_CLOSE_ICON_PADDING + _mirrorViewRect.top();
int lwp = MIRROR_ICON_SIZE + lp;
int twp = MIRROR_ICON_SIZE + tp;
glTexCoord2f(1, 1);
glVertex2f(lp, tp);
glTexCoord2f(0, 1);
glVertex2f(lwp, tp);
glTexCoord2f(0, 0);
glVertex2f(lwp, twp);
glTexCoord2f(1, 0);
glVertex2f(lp, twp);
glEnd();
glPopMatrix();
glDisable(GL_TEXTURE_2D);
}

View file

@ -196,6 +196,7 @@ private slots:
private:
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
void updateProjectionMatrix();
void updateProjectionMatrix(Camera& camera);
static bool sendVoxelsOperation(VoxelNode* node, void* extraData);
static void processAvatarURLsMessage(unsigned char* packetData, size_t dataBytes);
@ -240,7 +241,9 @@ private:
static void attachNewHeadToNode(Node *newNode);
static void* networkReceive(void* args); // network receive thread
void findAxisAlignment();
void findAxisAlignment();
void displayRearMirrorTools();
QMainWindow* _window;
QGLWidget* _glWidget;
@ -292,6 +295,9 @@ private:
Camera _myCamera; // My view onto the world
Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
Camera _mirrorCamera; // Cammera for mirror view
QRect _mirrorViewRect;
GLuint _closeTextureId;
Environment _environment;

View file

@ -840,9 +840,9 @@ bool Audio::eventuallyAnalyzePing() {
return true;
}
void Audio::renderToolIcon(int screenHeigh) {
void Audio::renderToolIcon(int screenHeight) {
_iconBounds = QRect(ICON_LEFT, screenHeigh - BOTTOM_PADDING, ICON_SIZE, ICON_SIZE);
_iconBounds = QRect(ICON_LEFT, screenHeight - BOTTOM_PADDING, ICON_SIZE, ICON_SIZE);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, _micTextureId);

View file

@ -23,7 +23,7 @@ const float CAMERA_THIRD_PERSON_MODE_DISTANCE = 1.5f;
const float CAMERA_THIRD_PERSON_MODE_TIGHTNESS = 8.0f;
const float CAMERA_MIRROR_MODE_UP_SHIFT = 0.0f;
const float CAMERA_MIRROR_MODE_DISTANCE = 0.3f;
const float CAMERA_MIRROR_MODE_DISTANCE = 0.17f;
const float CAMERA_MIRROR_MODE_TIGHTNESS = 100.0f;

View file

@ -287,12 +287,12 @@ Menu::Menu() :
false, this, SLOT(setNewVoxelCullingMode(bool)));
addDisabledActionAndSeparator(cullingOptionsMenu, "Individual Option Settings");
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::FastVoxelPipeline, 0,
false, appInstance->getVoxels(), SLOT(setUseFastVoxelPipeline(bool)));
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::DontRemoveOutOfView);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::HideOutOfView);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::UseDeltaFrustumInHide);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::ConstantCulling);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::DisableFastVoxelPipeline, 0,
false, appInstance->getVoxels(), SLOT(setDisableFastVoxelPipeline(bool)));
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::RemoveOutOfView);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::DisableHideOutOfView);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::UseFullFrustumInHide);
addCheckableActionToQMenuAndActionHash(cullingOptionsMenu, MenuOption::DisableConstantCulling);
QMenu* avatarOptionsMenu = developerMenu->addMenu("Avatar Options");
@ -1114,10 +1114,10 @@ void Menu::setNewVoxelCullingMode(bool newMode) {
/// This will switch on or off several different individual settings options all at once based on choosing with Old or New
/// voxel culling mode.
void Menu::setVoxelCullingMode(bool oldMode) {
const QString menus[] = { MenuOption::FastVoxelPipeline, MenuOption::DontRemoveOutOfView, MenuOption::HideOutOfView,
MenuOption::UseDeltaFrustumInHide, MenuOption::ConstantCulling};
bool oldModeValue[] = { false, false, false, false, false };
bool newModeValue[] = { true, true, true, true, true };
const QString menus[] = { MenuOption::DisableFastVoxelPipeline, MenuOption::RemoveOutOfView, MenuOption::DisableHideOutOfView,
MenuOption::UseFullFrustumInHide, MenuOption::DisableConstantCulling};
bool oldModeValue[] = { true, true, true, true, true };
bool newModeValue[] = { false, false, false, false, false };
for (int i = 0; i < sizeof(menus) / sizeof(menus[0]); i++) {
bool desiredValue = oldMode ? oldModeValue[i] : newModeValue[i];

View file

@ -134,7 +134,6 @@ namespace MenuOption {
const QString Bandwidth = "Bandwidth Display";
const QString BandwidthDetails = "Bandwidth Details";
const QString Collisions = "Collisions";
const QString ConstantCulling = "Constant Culling";
const QString CopyVoxels = "Copy";
const QString CoverageMap = "Render Coverage Map";
const QString CoverageMapV2 = "Render Coverage Map V2";
@ -144,10 +143,11 @@ namespace MenuOption {
const QString DeleteVoxels = "Delete";
const QString DestructiveAddVoxel = "Create Voxel is Destructive";
const QString DeltaSending = "Delta Sending";
const QString DisableConstantCulling = "Disable Constant Culling";
const QString DisableFastVoxelPipeline = "Disable Fast Voxel Pipeline";
const QString DisplayFrustum = "Display Frustum";
const QString DontRenderVoxels = "Don't call _voxels.render()";
const QString DontCallOpenGLForVoxels = "Don't call glDrawElements()/glDrawRangeElementsEXT() for Voxels";
const QString DontRemoveOutOfView = "Don't Remove Out of View Voxels";
const QString EchoAudio = "Echo Audio";
const QString ExportVoxels = "Export Voxels";
const QString HeadMouse = "Head Mouse";
@ -160,7 +160,6 @@ namespace MenuOption {
const QString FalseColorOccludedV2 = "FALSE Color Occluded V2 Voxels";
const QString FalseColorOutOfView = "FALSE Color Voxel Out of View";
const QString FalseColorRandomly = "FALSE Color Voxels Randomly";
const QString FastVoxelPipeline = "Fast Voxel Pipeline";
const QString FirstPerson = "First Person";
const QString FrameTimer = "Show Timer";
const QString FrustumRenderMode = "Render Mode";
@ -168,7 +167,7 @@ namespace MenuOption {
const QString GlowMode = "Cycle Glow Mode";
const QString GoToDomain = "Go To Domain...";
const QString GoToLocation = "Go To Location...";
const QString HideOutOfView = "Hide Out of View Voxels";
const QString DisableHideOutOfView = "Disable Hide Out of View Voxels";
const QString GoToUser = "Go To User...";
const QString ImportVoxels = "Import Voxels";
const QString ImportVoxelsClipboard = "Import Voxels to Clipboard";
@ -197,6 +196,7 @@ namespace MenuOption {
const QString PipelineWarnings = "Show Render Pipeline Warnings";
const QString Preferences = "Preferences...";
const QString RandomizeVoxelColors = "Randomize Voxel TRUE Colors";
const QString RemoveOutOfView = "Remove Out of View Voxels";
const QString ResetAvatarSize = "Reset Avatar Size";
const QString ResetSwatchColors = "Reset Swatch Colors";
const QString RunTimingTests = "Run Timing Tests";
@ -216,7 +216,7 @@ namespace MenuOption {
const QString TreeStats = "Calculate Tree Stats";
const QString TransmitterDrive = "Transmitter Drive";
const QString Quit = "Quit";
const QString UseDeltaFrustumInHide = "Use Delta View Frustums when Culling";
const QString UseFullFrustumInHide = "Use Full View Frustums when Culling";
const QString UseVoxelShader = "Use Voxel Shader";
const QString VoxelsAsPoints = "Draw Voxels as Points";
const QString Voxels = "Voxels";

View file

@ -123,9 +123,10 @@ void VoxelSystem::voxelDeleted(VoxelNode* node) {
}
}
void VoxelSystem::setUseFastVoxelPipeline(bool useFastVoxelPipeline) {
_useFastVoxelPipeline = useFastVoxelPipeline;
printf("setUseFastVoxelPipeline() _useFastVoxelPipeline=%s\n", debug::valueOf(_useFastVoxelPipeline));
void VoxelSystem::setDisableFastVoxelPipeline(bool disableFastVoxelPipeline) {
_useFastVoxelPipeline = !disableFastVoxelPipeline;
printf("setDisableFastVoxelPipeline() disableFastVoxelPipeline=%s _useFastVoxelPipeline=%s\n",
debug::valueOf(disableFastVoxelPipeline), debug::valueOf(_useFastVoxelPipeline));
setupNewVoxelsForDrawing();
}
@ -744,7 +745,7 @@ void VoxelSystem::checkForCulling() {
uint64_t start = usecTimestampNow();
uint64_t sinceLastViewCulling = (start - _lastViewCulling) / 1000;
bool constantCulling = Menu::getInstance()->isOptionChecked(MenuOption::ConstantCulling);
bool constantCulling = !Menu::getInstance()->isOptionChecked(MenuOption::DisableConstantCulling);
// If the view frustum is no longer changing, but has changed, since last time, then remove nodes that are out of view
if (constantCulling || (
@ -757,10 +758,10 @@ void VoxelSystem::checkForCulling() {
// When we call removeOutOfView() voxels, we don't actually remove the voxels from the VBOs, but we do remove
// them from tree, this makes our tree caclulations faster, but doesn't require us to fully rebuild the VBOs (which
// can be expensive).
if (Menu::getInstance()->isOptionChecked(MenuOption::HideOutOfView)) {
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableHideOutOfView)) {
hideOutOfView();
}
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontRemoveOutOfView)) {
if (Menu::getInstance()->isOptionChecked(MenuOption::RemoveOutOfView)) {
removeOutOfView();
}
@ -1810,7 +1811,7 @@ void VoxelSystem::hideOutOfView() {
bool showDebugDetails = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showDebugDetails, "hideOutOfView()", showDebugDetails);
bool widenFrustum = true;
bool wantDeltaFrustums = Menu::getInstance()->isOptionChecked(MenuOption::UseDeltaFrustumInHide);
bool wantDeltaFrustums = !Menu::getInstance()->isOptionChecked(MenuOption::UseFullFrustumInHide);
hideOutOfViewArgs args(this, this->_tree, _culledOnce, widenFrustum, wantDeltaFrustums);
const bool wantViewFrustumDebugging = false; // change to true for additional debugging

View file

@ -141,7 +141,7 @@ public slots:
void cancelImport();
void setUseFastVoxelPipeline(bool useFastVoxelPipeline);
void setDisableFastVoxelPipeline(bool disableFastVoxelPipeline);
void setUseVoxelShader(bool useVoxelShader);
void setVoxelsAsPoints(bool voxelsAsPoints);
@ -193,7 +193,6 @@ private:
static bool forceRedrawEntireTreeOperation(VoxelNode* node, void* extraData);
static bool clearAllNodesBufferIndexOperation(VoxelNode* node, void* extraData);
static bool hideOutOfViewOperation(VoxelNode* node, void* extraData);
static bool hideOutOfViewUnrollOperation(VoxelNode* node, void* extraData);
static bool hideAllSubTreeOperation(VoxelNode* node, void* extraData);
static bool showAllSubTreeOperation(VoxelNode* node, void* extraData);
static bool showAllLocalVoxelsOperation(VoxelNode* node, void* extraData);

View file

@ -597,7 +597,7 @@ float MyAvatar::getBallRenderAlpha(int ball, bool lookingInMirror) const {
void MyAvatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) {
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_FIRST_PERSON) {
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_FIRST_PERSON && !lookingInMirror) {
// Dont display body, only the hand
_hand.render(lookingInMirror);

View file

@ -41,10 +41,10 @@ Assignment::Assignment() :
_payload(),
_numPayloadBytes(0)
{
setPool(NULL);
}
Assignment::Assignment(Assignment::Command command, Assignment::Type type, Assignment::Location location) :
Assignment::Assignment(Assignment::Command command, Assignment::Type type, const char* pool, Assignment::Location location) :
_command(command),
_type(type),
_location(location),
@ -56,40 +56,8 @@ Assignment::Assignment(Assignment::Command command, Assignment::Type type, Assig
// this is a newly created assignment, generate a random UUID
_uuid = QUuid::createUuid();
}
}
Assignment::Assignment(const Assignment& otherAssignment) {
_uuid = otherAssignment._uuid;
_command = otherAssignment._command;
_type = otherAssignment._type;
_location = otherAssignment._location;
_numberOfInstances = otherAssignment._numberOfInstances;
setPayload(otherAssignment._payload, otherAssignment._numPayloadBytes);
}
Assignment& Assignment::operator=(const Assignment& rhsAssignment) {
Assignment temp(rhsAssignment);
swap(temp);
return *this;
}
void Assignment::swap(Assignment& otherAssignment) {
using std::swap;
swap(_uuid, otherAssignment._uuid);
swap(_command, otherAssignment._command);
swap(_type, otherAssignment._type);
swap(_location, otherAssignment._location);
swap(_numberOfInstances, otherAssignment._numberOfInstances);
for (int i = 0; i < MAX_PAYLOAD_BYTES; i++) {
swap(_payload[i], otherAssignment._payload[i]);
}
swap(_numPayloadBytes, otherAssignment._numPayloadBytes);
setPool(pool);
}
Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) :
@ -97,7 +65,7 @@ Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) :
_numberOfInstances(1),
_payload(),
_numPayloadBytes(0)
{
{
int numBytesRead = 0;
if (dataBuffer[0] == PACKET_TYPE_REQUEST_ASSIGNMENT) {
@ -118,12 +86,61 @@ Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) :
_uuid = QUuid::fromRfc4122(QByteArray((const char*) dataBuffer + numBytesRead, NUM_BYTES_RFC4122_UUID));
numBytesRead += NUM_BYTES_RFC4122_UUID;
}
if (dataBuffer[numBytesRead] != '\0') {
// read the pool from the data buffer
setPool((const char*) dataBuffer + numBytesRead);
} else {
// skip past the null pool and null out our pool
setPool(NULL);
numBytesRead++;
}
if (numBytes > numBytesRead) {
setPayload(dataBuffer + numBytesRead, numBytes - numBytesRead);
}
}
Assignment::Assignment(const Assignment& otherAssignment) {
_uuid = otherAssignment._uuid;
_command = otherAssignment._command;
_type = otherAssignment._type;
_location = otherAssignment._location;
setPool(otherAssignment._pool);
_numberOfInstances = otherAssignment._numberOfInstances;
setPayload(otherAssignment._payload, otherAssignment._numPayloadBytes);
}
Assignment& Assignment::operator=(const Assignment& rhsAssignment) {
Assignment temp(rhsAssignment);
swap(temp);
return *this;
}
void Assignment::swap(Assignment& otherAssignment) {
using std::swap;
swap(_uuid, otherAssignment._uuid);
swap(_command, otherAssignment._command);
swap(_type, otherAssignment._type);
swap(_location, otherAssignment._location);
for (int i = 0; i < sizeof(_pool); i++) {
swap(_pool[i], otherAssignment._pool[i]);
}
swap(_numberOfInstances, otherAssignment._numberOfInstances);
for (int i = 0; i < MAX_PAYLOAD_BYTES; i++) {
swap(_payload[i], otherAssignment._payload[i]);
}
swap(_numPayloadBytes, otherAssignment._numPayloadBytes);
}
void Assignment::setPayload(const uchar* payload, int numBytes) {
if (numBytes > MAX_PAYLOAD_BYTES) {
@ -140,6 +157,14 @@ void Assignment::setPayload(const uchar* payload, int numBytes) {
memcpy(_payload, payload, _numPayloadBytes);
}
void Assignment::setPool(const char* pool) {
memset(_pool, '\0', sizeof(_pool));
if (pool) {
strcpy(_pool, pool);
}
}
const char* Assignment::getTypeName() const {
switch (_type) {
case Assignment::AudioMixerType:
@ -167,6 +192,16 @@ int Assignment::packToBuffer(unsigned char* buffer) {
numPackedBytes += NUM_BYTES_RFC4122_UUID;
}
if (_pool) {
// pack the pool for this assignment, it exists
int numBytesNullTerminatedPool = strlen(_pool) + sizeof('\0');
memcpy(buffer + numPackedBytes, _pool, numBytesNullTerminatedPool);
numPackedBytes += numBytesNullTerminatedPool;
} else {
// otherwise pack the null character
buffer[numPackedBytes++] = '\0';
}
if (_numPayloadBytes) {
memcpy(buffer + numPackedBytes, _payload, _numPayloadBytes);
numPackedBytes += _numPayloadBytes;

View file

@ -16,6 +16,7 @@
#include "NodeList.h"
const int MAX_PAYLOAD_BYTES = 1024;
const int MAX_ASSIGNMENT_POOL_BYTES = 64 + sizeof('\0');
/// Holds information used for request, creation, and deployment of assignments
class Assignment : public NodeData {
@ -46,6 +47,7 @@ public:
Assignment();
Assignment(Assignment::Command command,
Assignment::Type type,
const char* pool = NULL,
Assignment::Location location = Assignment::LocalLocation);
Assignment(const Assignment& otherAssignment);
Assignment& operator=(const Assignment &rhsAssignment);
@ -69,6 +71,10 @@ public:
int getNumPayloadBytes() const { return _numPayloadBytes; }
void setPayload(const uchar *payload, int numBytes);
void setPool(const char* pool);
const char* getPool() const { return _pool; }
bool hasPool() const { return (bool) strlen(_pool); }
int getNumberOfInstances() const { return _numberOfInstances; }
void setNumberOfInstances(int numberOfInstances) { _numberOfInstances = numberOfInstances; }
void decrementNumberOfInstances() { --_numberOfInstances; }
@ -94,6 +100,7 @@ protected:
QUuid _uuid; /// the 16 byte UUID for this assignment
Assignment::Command _command; /// the command for this assignment (Create, Deploy, Request)
Assignment::Type _type; /// the type of the assignment, defines what the assignee will do
char _pool[MAX_ASSIGNMENT_POOL_BYTES]; /// the destination pool for this assignment
Assignment::Location _location; /// the location of the assignment, allows a domain to preferentially use local ACs
int _numberOfInstances; /// the number of instances of this assignment
uchar _payload[MAX_PAYLOAD_BYTES]; /// an optional payload attached to this assignment, a maximum for 1024 bytes will be packed

View file

@ -51,32 +51,6 @@ void attachVoxelNodeDataToNode(Node* newNode) {
VoxelServer* VoxelServer::_theInstance = NULL;
VoxelServer::VoxelServer(Assignment::Command command, Assignment::Location location) :
Assignment(command, Assignment::VoxelServerType, location),
_serverTree(true) {
_argc = 0;
_argv = NULL;
_packetsPerClientPerInterval = 10;
_wantVoxelPersist = true;
_wantLocalDomain = false;
_debugVoxelSending = false;
_shouldShowAnimationDebug = false;
_displayVoxelStats = false;
_debugVoxelReceiving = false;
_sendEnvironments = true;
_sendMinimalEnvironment = false;
_dumpVoxelsOnMove = false;
_jurisdiction = NULL;
_jurisdictionSender = NULL;
_voxelServerPacketProcessor = NULL;
_voxelPersistThread = NULL;
_parsedArgV = NULL;
_theInstance = this;
}
VoxelServer::VoxelServer(const unsigned char* dataBuffer, int numBytes) : Assignment(dataBuffer, numBytes),
_serverTree(true) {
_argc = 0;

View file

@ -26,10 +26,7 @@
/// Handles assignments of type VoxelServer - sending voxels to various clients.
class VoxelServer : public Assignment {
public:
VoxelServer(Assignment::Command command,
Assignment::Location location = Assignment::GlobalLocation);
public:
VoxelServer(const unsigned char* dataBuffer, int numBytes);
~VoxelServer();