History

Merge remote-tracking branch 'upstream/master' into cleanup

Stephen Birarda committed 12 years ago

Commit 3277cb42 parents 3d14fba 44f92fb110 files · +3978 −1222Browse files

Showing the changes to interface/src/Application.cpp (1 of 110 files). Show all

Unified · Split

interface/src/Application.cpp+99−191
@@ -132,8 +132,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 131 unmodified lines
132132 _lookatIndicatorScale(1.0f),
133133 _perfStatsOn(false),
134134 _chatEntryOn(false),
135− _oculusProgram(0),
136− _oculusDistortionScale(1.25),
137135 #ifndef _WIN32
138136 _audio(&_audioScope, STARTUP_JITTER_SAMPLES),
139137 #endif
@@ -248,7 +246,6 @@ Application::~Application() { · 108 unmodified lines
248246 VoxelNode::removeDeleteHook(&_voxels); // we don't need to do this processing on shutdown
249247 delete Menu::getInstance();
250248
251− delete _oculusProgram;
252249 delete _settings;
253250 delete _followMode;
254251 delete _glWidget;
@@ -425,7 +422,7 @@ void Application::paintGL() { · 170 unmodified lines
425422 }
426423
427424 if (OculusManager::isConnected()) {
428− displayOculus(whichCamera);
425+ OculusManager::display(whichCamera);
429426
430427 } else {
431428 _glowEffect.prepare();
@@ -516,14 +513,11 @@ void Application::paintGL() { · 84 unmodified lines
516513 }
517514
518515 void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) {
519− float aspectRatio = ((float)width/(float)height); // based on screen resize
520−
521516 if (OculusManager::isConnected()) {
522− // more magic numbers; see Oculus SDK docs, p. 32
523− camera.setAspectRatio(aspectRatio *= 0.5);
524− camera.setFieldOfView(2 * atan((0.0468 * _oculusDistortionScale) / 0.041) * (180 / PIf));
517+ OculusManager::configureCamera(camera, width, height);
518+
525519 } else {
526− camera.setAspectRatio(aspectRatio);
520+ camera.setAspectRatio((float)width / height);
527521 camera.setFieldOfView(Menu::getInstance()->getFieldOfView());
528522 }
529523 }
@@ -682,9 +676,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 152 unmodified lines
682676 break;
683677
684678 case Qt::Key_C:
685− if (isShifted) {
686− Menu::getInstance()->triggerOption(MenuOption::OcclusionCulling);
687− } else if (_nudgeStarted) {
679+ if (_nudgeStarted) {
688680 _nudgeGuidePosition.y -= _mouseVoxel.s;
689681 } else {
690682 _myAvatar.setDriveKeys(DOWN, 1);
@@ -1472,7 +1464,6 @@ void Application::checkBandwidthMeterClick() { · 781 unmodified lines
14721464 void Application::setFullscreen(bool fullscreen) {
14731465 _window->setWindowState(fullscreen ? (_window->windowState() | Qt::WindowFullScreen) :
14741466 (_window->windowState() & ~Qt::WindowFullScreen));
1475− updateCursor();
14761467 }
14771468
14781469 void Application::setRenderVoxels(bool voxelRender) {
@@ -1486,6 +1477,54 @@ void Application::doKillLocalVoxels() { · 7 unmodified lines
14861477 _wantToKillLocalVoxels = true;
14871478 }
14881479
1480+void Application::removeVoxel(glm::vec3 position,
1481+ float scale) {
1482+ VoxelDetail voxel;
1483+ voxel.x = position.x / TREE_SCALE;
1484+ voxel.y = position.y / TREE_SCALE;
1485+ voxel.z = position.z / TREE_SCALE;
1486+ voxel.s = scale / TREE_SCALE;
1487+ _voxelEditSender.sendVoxelEditMessage(PACKET_TYPE_ERASE_VOXEL, voxel);
1488+
1489+ // delete it locally to see the effect immediately (and in case no voxel server is present)
1490+ _voxels.deleteVoxelAt(voxel.x, voxel.y, voxel.z, voxel.s);
1491+}
1492+
1493+void Application::makeVoxel(glm::vec3 position,
1494+ float scale,
1495+ unsigned char red,
1496+ unsigned char green,
1497+ unsigned char blue,
1498+ bool isDestructive) {
1499+ VoxelDetail voxel;
1500+ voxel.x = position.x / TREE_SCALE;
1501+ voxel.y = position.y / TREE_SCALE;
1502+ voxel.z = position.z / TREE_SCALE;
1503+ voxel.s = scale / TREE_SCALE;
1504+ voxel.red = red;
1505+ voxel.green = green;
1506+ voxel.blue = blue;
1507+ PACKET_TYPE message = isDestructive ? PACKET_TYPE_SET_VOXEL_DESTRUCTIVE : PACKET_TYPE_SET_VOXEL;
1508+ _voxelEditSender.sendVoxelEditMessage(message, voxel);
1509+
1510+ // create the voxel locally so it appears immediately
1511+
1512+ _voxels.createVoxel(voxel.x, voxel.y, voxel.z, voxel.s,
1513+ voxel.red, voxel.green, voxel.blue,
1514+ isDestructive);
1515+
1516+ // Implement voxel fade effect
1517+ VoxelFade fade(VoxelFade::FADE_OUT, 1.0f, 1.0f, 1.0f);
1518+ const float VOXEL_BOUNDS_ADJUST = 0.01f;
1519+ float slightlyBigger = voxel.s * VOXEL_BOUNDS_ADJUST;
1520+ fade.voxelDetails.x = voxel.x - slightlyBigger;
1521+ fade.voxelDetails.y = voxel.y - slightlyBigger;
1522+ fade.voxelDetails.z = voxel.z - slightlyBigger;
1523+ fade.voxelDetails.s = voxel.s + slightlyBigger + slightlyBigger;
1524+ _voxelFades.push_back(fade);
1525+
1526+}
1527+
14891528 const glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail _mouseVoxel) {
14901529 return glm::vec3((_mouseVoxel.x + _mouseVoxel.s / 2.f) * TREE_SCALE,
14911530 (_mouseVoxel.y + _mouseVoxel.s / 2.f) * TREE_SCALE,
@@ -1523,7 +1562,6 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { · 31 unmodified lines
15231562 SendVoxelsOperationArgs* args = (SendVoxelsOperationArgs*)extraData;
15241563 if (node->isColored()) {
15251564 const unsigned char* nodeOctalCode = node->getOctalCode();
1526−
15271565 unsigned char* codeColorBuffer = NULL;
15281566 int codeLength = 0;
15291567 int bytesInCode = 0;
@@ -1544,10 +1582,9 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { · 14 unmodified lines
15441582 }
15451583
15461584 // copy the colors over
1547− codeColorBuffer[bytesInCode + RED_INDEX ] = node->getColor()[RED_INDEX ];
1585+ codeColorBuffer[bytesInCode + RED_INDEX] = node->getColor()[RED_INDEX];
15481586 codeColorBuffer[bytesInCode + GREEN_INDEX] = node->getColor()[GREEN_INDEX];
1549− codeColorBuffer[bytesInCode + BLUE_INDEX ] = node->getColor()[BLUE_INDEX ];
1550−
1587+ codeColorBuffer[bytesInCode + BLUE_INDEX] = node->getColor()[BLUE_INDEX];
15511588 getInstance()->_voxelEditSender.queueVoxelEditMessage(PACKET_TYPE_SET_VOXEL_DESTRUCTIVE,
15521589 codeColorBuffer, codeAndColorLength);
15531590
@@ -1611,7 +1648,6 @@ void Application::pasteVoxelsToOctalCode(const unsigned char* octalCodeDestinati · 57 unmodified lines
16111648 // the server as an set voxel message, this will also rebase the voxels to the new location
16121649 SendVoxelsOperationArgs args;
16131650 args.newBaseOctCode = octalCodeDestination;
1614−
16151651 _sharedVoxelSystem.getTree()->recurseTreeWithOperation(sendVoxelsOperation, &args);
16161652
16171653 if (_sharedVoxelSystem.getTree() != &_clipboard) {
@@ -1770,7 +1806,7 @@ void Application::init() { · 152 unmodified lines
17701806 _voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels());
17711807 _voxels.setUseVoxelShader(Menu::getInstance()->isOptionChecked(MenuOption::UseVoxelShader));
17721808 _voxels.setVoxelsAsPoints(Menu::getInstance()->isOptionChecked(MenuOption::VoxelsAsPoints));
1773− _voxels.setDisableFastVoxelPipeline(Menu::getInstance()->isOptionChecked(MenuOption::DisableFastVoxelPipeline));
1809+ _voxels.setDisableFastVoxelPipeline(false);
17741810 _voxels.init();
17751811
17761812
@@ -2223,11 +2259,11 @@ void Application::updateLeap(float deltaTime) { · 446 unmodified lines
22232259 LeapManager::nextFrame();
22242260 }
22252261
2226−void Application::updateSixense() {
2262+void Application::updateSixense(float deltaTime) {
22272263 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
22282264 PerformanceWarning warn(showWarnings, "Application::updateSixense()");
22292265
2230− _sixenseManager.update();
2266+ _sixenseManager.update(deltaTime);
22312267 }
22322268
22332269 void Application::updateSerialDevices(float deltaTime) {
@@ -2437,7 +2473,7 @@ void Application::update(float deltaTime) { · 203 unmodified lines
24372473 updateMouseVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // UI/UX related to voxels
24382474 updateHandAndTouch(deltaTime); // Update state for touch sensors
24392475 updateLeap(deltaTime); // Leap finger-sensing device
2440− updateSixense(); // Razer Hydra controllers
2476+ updateSixense(deltaTime); // Razer Hydra controllers
24412477 updateSerialDevices(deltaTime); // Read serial port interface devices
24422478 updateAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
24432479 updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
@@ -2577,10 +2613,11 @@ void Application::queryVoxels() { · 133 unmodified lines
25772613 bool wantExtraDebugging = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging);
25782614
25792615 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
2580− _voxelQuery.setWantLowResMoving(Menu::getInstance()->isOptionChecked(MenuOption::LowRes));
2581− _voxelQuery.setWantColor(Menu::getInstance()->isOptionChecked(MenuOption::SendVoxelColors));
2582− _voxelQuery.setWantDelta(Menu::getInstance()->isOptionChecked(MenuOption::DeltaSending));
2583− _voxelQuery.setWantOcclusionCulling(Menu::getInstance()->isOptionChecked(MenuOption::OcclusionCulling));
2616+ _voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes));
2617+ _voxelQuery.setWantColor(!Menu::getInstance()->isOptionChecked(MenuOption::DisableColorVoxels));
2618+ _voxelQuery.setWantDelta(!Menu::getInstance()->isOptionChecked(MenuOption::DisableDeltaSending));
2619+ _voxelQuery.setWantOcclusionCulling(Menu::getInstance()->isOptionChecked(MenuOption::EnableOcclusionCulling));
2620+ _voxelQuery.setWantCompression(Menu::getInstance()->isOptionChecked(MenuOption::EnableVoxelPacketCompression));
25842621
25852622 _voxelQuery.setCameraPosition(_viewFrustum.getPosition());
25862623 _voxelQuery.setCameraOrientation(_viewFrustum.getOrientation());
@@ -2642,15 +2679,16 @@ void Application::queryVoxels() { · 55 unmodified lines
26422679 int perServerPPS = 0;
26432680 const int SMALL_BUDGET = 10;
26442681 int perUnknownServer = SMALL_BUDGET;
2682+ int totalPPS = Menu::getInstance()->getMaxVoxelPacketsPerSecond();
26452683
26462684 // determine PPS based on number of servers
26472685 if (inViewServers >= 1) {
26482686 // set our preferred PPS to be exactly evenly divided among all of the voxel servers... and allocate 1 PPS
26492687 // for each unknown jurisdiction server
2650− perServerPPS = (DEFAULT_MAX_VOXEL_PPS / inViewServers) - (unknownJurisdictionServers * perUnknownServer);
2688+ perServerPPS = (totalPPS / inViewServers) - (unknownJurisdictionServers * perUnknownServer);
26512689 } else {
26522690 if (unknownJurisdictionServers > 0) {
2653− perUnknownServer = (DEFAULT_MAX_VOXEL_PPS / unknownJurisdictionServers);
2691+ perUnknownServer = (totalPPS / unknownJurisdictionServers);
26542692 }
26552693 }
26562694
@@ -2857,146 +2895,7 @@ void Application::updateShadowMap() { · 200 unmodified lines
28572895
28582896 glViewport(0, 0, _glWidget->width(), _glWidget->height());
28592897 }
2860−
2861−// this shader is an adaptation (HLSL -> GLSL, removed conditional) of the one in the Oculus sample
2862−// code (Samples/OculusRoomTiny/RenderTiny_D3D1X_Device.cpp), which is under the Apache license
2863−// (http://www.apache.org/licenses/LICENSE-2.0)
2864−static const char* DISTORTION_FRAGMENT_SHADER =
2865− "#version 120\n"
2866− "uniform sampler2D texture;"
2867− "uniform vec2 lensCenter;"
2868− "uniform vec2 screenCenter;"
2869− "uniform vec2 scale;"
2870− "uniform vec2 scaleIn;"
2871− "uniform vec4 hmdWarpParam;"
2872− "vec2 hmdWarp(vec2 in01) {"
2873− " vec2 theta = (in01 - lensCenter) * scaleIn;"
2874− " float rSq = theta.x * theta.x + theta.y * theta.y;"
2875− " vec2 theta1 = theta * (hmdWarpParam.x + hmdWarpParam.y * rSq + "
2876− " hmdWarpParam.z * rSq * rSq + hmdWarpParam.w * rSq * rSq * rSq);"
2877− " return lensCenter + scale * theta1;"
2878− "}"
2879− "void main(void) {"
2880− " vec2 tc = hmdWarp(gl_TexCoord[0].st);"
2881− " vec2 below = step(screenCenter.st + vec2(-0.25, -0.5), tc.st);"
2882− " vec2 above = vec2(1.0, 1.0) - step(screenCenter.st + vec2(0.25, 0.5), tc.st);"
2883− " gl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), texture2D(texture, tc), "
2884− " above.s * above.t * below.s * below.t);"
2885− "}";
2886−
2887−void Application::displayOculus(Camera& whichCamera) {
2888− _glowEffect.prepare();
2889−
2890− // magic numbers ahoy! in order to avoid pulling in the Oculus utility library that calculates
2891− // the rendering parameters from the hardware stats, i just folded their calculations into
2892− // constants using the stats for the current-model hardware as contained in the SDK file
2893− // LibOVR/Src/Util/Util_Render_Stereo.cpp
2894−
2895− // eye
2896−
2897− // render the left eye view to the left side of the screen
2898− glMatrixMode(GL_PROJECTION);
2899− glPushMatrix();
2900− glLoadIdentity();
2901− glTranslatef(0.151976, 0, 0); // +h, see Oculus SDK docs p. 26
2902− gluPerspective(whichCamera.getFieldOfView(), whichCamera.getAspectRatio(),
2903− whichCamera.getNearClip(), whichCamera.getFarClip());
2904−
2905− glViewport(0, 0, _glWidget->width() / 2, _glWidget->height());
2906− glMatrixMode(GL_MODELVIEW);
2907− glPushMatrix();
2908− glLoadIdentity();
2909− glTranslatef(0.032, 0, 0); // dip/2, see p. 27
2910−
2911− displaySide(whichCamera);
2912−
2913− // and the right eye to the right side
2914− glMatrixMode(GL_PROJECTION);
2915− glLoadIdentity();
2916− glTranslatef(-0.151976, 0, 0); // -h
2917− gluPerspective(whichCamera.getFieldOfView(), whichCamera.getAspectRatio(),
2918− whichCamera.getNearClip(), whichCamera.getFarClip());
2919−
2920− glViewport(_glWidget->width() / 2, 0, _glWidget->width() / 2, _glWidget->height());
2921− glMatrixMode(GL_MODELVIEW);
2922− glLoadIdentity();
2923− glTranslatef(-0.032, 0, 0);
2924−
2925− displaySide(whichCamera);
2926−
2927− glPopMatrix();
2928−
2929− // restore our normal viewport
2930− glViewport(0, 0, _glWidget->width(), _glWidget->height());
2931−
2932− QOpenGLFramebufferObject* fbo = _glowEffect.render(true);
2933− glBindTexture(GL_TEXTURE_2D, fbo->texture());
2934−
2935− if (_oculusProgram == 0) {
2936− _oculusProgram = new ProgramObject();
2937− _oculusProgram->addShaderFromSourceCode(QGLShader::Fragment, DISTORTION_FRAGMENT_SHADER);
2938− _oculusProgram->link();
2939−
2940− _textureLocation = _oculusProgram->uniformLocation("texture");
2941− _lensCenterLocation = _oculusProgram->uniformLocation("lensCenter");
2942− _screenCenterLocation = _oculusProgram->uniformLocation("screenCenter");
2943− _scaleLocation = _oculusProgram->uniformLocation("scale");
2944− _scaleInLocation = _oculusProgram->uniformLocation("scaleIn");
2945− _hmdWarpParamLocation = _oculusProgram->uniformLocation("hmdWarpParam");
2946− }
29472898
2948− glMatrixMode(GL_PROJECTION);
2949− glLoadIdentity();
2950− gluOrtho2D(0, _glWidget->width(), 0, _glWidget->height());
2951− glDisable(GL_DEPTH_TEST);
2952−
2953− // for reference on setting these values, see SDK file Samples/OculusRoomTiny/RenderTiny_Device.cpp
2954−
2955− float scaleFactor = 1.0 / _oculusDistortionScale;
2956− float aspectRatio = (_glWidget->width() * 0.5) / _glWidget->height();
2957−
2958− glDisable(GL_BLEND);
2959− _oculusProgram->bind();
2960− _oculusProgram->setUniformValue(_textureLocation, 0);
2961− _oculusProgram->setUniformValue(_lensCenterLocation, 0.287994, 0.5); // see SDK docs, p. 29
2962− _oculusProgram->setUniformValue(_screenCenterLocation, 0.25, 0.5);
2963− _oculusProgram->setUniformValue(_scaleLocation, 0.25 * scaleFactor, 0.5 * scaleFactor * aspectRatio);
2964− _oculusProgram->setUniformValue(_scaleInLocation, 4, 2 / aspectRatio);
2965− _oculusProgram->setUniformValue(_hmdWarpParamLocation, 1.0, 0.22, 0.24, 0);
2966−
2967− glColor3f(1, 0, 1);
2968− glBegin(GL_QUADS);
2969− glTexCoord2f(0, 0);
2970− glVertex2f(0, 0);
2971− glTexCoord2f(0.5, 0);
2972− glVertex2f(_glWidget->width()/2, 0);
2973− glTexCoord2f(0.5, 1);
2974− glVertex2f(_glWidget->width() / 2, _glWidget->height());
2975− glTexCoord2f(0, 1);
2976− glVertex2f(0, _glWidget->height());
2977− glEnd();
2978−
2979− _oculusProgram->setUniformValue(_lensCenterLocation, 0.787994, 0.5);
2980− _oculusProgram->setUniformValue(_screenCenterLocation, 0.75, 0.5);
2981−
2982− glBegin(GL_QUADS);
2983− glTexCoord2f(0.5, 0);
2984− glVertex2f(_glWidget->width() / 2, 0);
2985− glTexCoord2f(1, 0);
2986− glVertex2f(_glWidget->width(), 0);
2987− glTexCoord2f(1, 1);
2988− glVertex2f(_glWidget->width(), _glWidget->height());
2989− glTexCoord2f(0.5, 1);
2990− glVertex2f(_glWidget->width() / 2, _glWidget->height());
2991− glEnd();
2992−
2993− glEnable(GL_BLEND);
2994− glBindTexture(GL_TEXTURE_2D, 0);
2995− _oculusProgram->release();
2996−
2997− glPopMatrix();
2998−}
2999−
30002899 const GLfloat WHITE_SPECULAR_COLOR[] = { 1.0f, 1.0f, 1.0f, 1.0f };
30012900 const GLfloat NO_SPECULAR_COLOR[] = { 0.0f, 0.0f, 0.0f, 1.0f };
30022901
@@ -3019,18 +2918,6 @@ void Application::setupWorldLight() { · 16 unmodified lines
30192918 glMateriali(GL_FRONT, GL_SHININESS, 96);
30202919 }
30212920
3022−void Application::loadTranslatedViewMatrix(const glm::vec3& translation) {
3023− glLoadMatrixf((const GLfloat*)&_untranslatedViewMatrix);
3024− glTranslatef(translation.x + _viewMatrixTranslation.x, translation.y + _viewMatrixTranslation.y,
3025− translation.z + _viewMatrixTranslation.z);
3026−}
3027−
3028−void Application::computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& near,
3029− float& far, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {
3030−
3031− _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, near, far, nearClipPlane, farClipPlane);
3032−}
3033−
30342921 void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
30352922 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()");
30362923 // transform by eye offset
@@ -3274,6 +3161,18 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 237 unmodified lines
32743161 }
32753162 }
32763163
3164+void Application::loadTranslatedViewMatrix(const glm::vec3& translation) {
3165+ glLoadMatrixf((const GLfloat*)&_untranslatedViewMatrix);
3166+ glTranslatef(translation.x + _viewMatrixTranslation.x, translation.y + _viewMatrixTranslation.y,
3167+ translation.z + _viewMatrixTranslation.z);
3168+}
3169+
3170+void Application::computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& near,
3171+ float& far, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {
3172+
3173+ _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, near, far, nearClipPlane, farClipPlane);
3174+}
3175+
32773176 void Application::displayOverlay() {
32783177 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displayOverlay()");
32793178
@@ -3608,7 +3507,7 @@ void Application::displayStats() { · 328 unmodified lines
36083507 // Voxel Rendering
36093508 voxelStats.str("");
36103509 voxelStats.precision(4);
3611− voxelStats << "Voxel Rendering Slots" <<
3510+ voxelStats << "Voxel Rendering Slots " <<
36123511 "Max: " << _voxels.getMaxVoxels() / 1000.f << "K " <<
36133512 "Drawn: " << _voxels.getVoxelsWritten() / 1000.f << "K " <<
36143513 "Abandoned: " << _voxels.getAbandonedVoxels() / 1000.f << "K ";
@@ -3847,7 +3746,7 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 232 unmodified lines
38473746 if (!avatar->isInitialized()) {
38483747 avatar->init();
38493748 }
3850− avatar->render(false, Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
3749+ avatar->render(false);
38513750 avatar->setDisplayingLookatVectors(Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors));
38523751 }
38533752
@@ -3857,12 +3756,12 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 3 unmodified lines
38573756 // render avatar fades
38583757 Glower glower;
38593758 for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
3860− (*fade)->render(false, Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
3759+ (*fade)->render(false);
38613760 }
38623761 }
38633762
38643763 // Render my own Avatar
3865− _myAvatar.render(forceRenderHead, Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
3764+ _myAvatar.render(forceRenderHead);
38663765 _myAvatar.setDisplayingLookatVectors(Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors));
38673766
38683767 if (Menu::getInstance()->isOptionChecked(MenuOption::LookAtIndicator) && _lookatTargetAvatar) {
@@ -4129,6 +4028,7 @@ void Application::resetSensors() { · 260 unmodified lines
41294028 _webcam.reset();
41304029 _faceshift.reset();
41314030 LeapManager::reset();
4031+ OculusManager::reset();
41324032 QCursor::setPos(_headMouseX, _headMouseY);
41334033 _myAvatar.reset();
41344034 _myTransmitter.resetLevels();
@@ -4157,11 +4057,6 @@ void Application::setMenuShortcutsEnabled(bool enabled) { · 22 unmodified lines
41574057 setShortcutsEnabled(_window->menuBar(), enabled);
41584058 }
41594059
4160−void Application::updateCursor() {
4161− _glWidget->setCursor(OculusManager::isConnected() && _window->windowState().testFlag(Qt::WindowFullScreen) ?
4162− Qt::BlankCursor : Qt::ArrowCursor);
4163−}
4164−
41654060 void Application::attachNewHeadToNode(Node* newNode) {
41664061 if (newNode->getLinkedData() == NULL) {
41674062 newNode->setLinkedData(new Avatar(newNode));
@@ -4326,13 +4221,26 @@ void* Application::networkReceive(void* args) { · 158 unmodified lines
43264221 app->_audio.addReceivedAudioToBuffer(app->_incomingPacket, bytesReceived);
43274222 break;
43284223 case PACKET_TYPE_VOXEL_DATA:
4329− case PACKET_TYPE_VOXEL_DATA_MONOCHROME:
4330− case PACKET_TYPE_Z_COMMAND:
43314224 case PACKET_TYPE_ERASE_VOXEL:
43324225 case PACKET_TYPE_VOXEL_STATS:
43334226 case PACKET_TYPE_ENVIRONMENT_DATA: {
43344227 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
43354228 "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()");
4229+
4230+ bool wantExtraDebugging = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging);
4231+ if (wantExtraDebugging && app->_incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) {
4232+ int numBytesPacketHeader = numBytesForPacketHeader(app->_incomingPacket);
4233+ unsigned char* dataAt = app->_incomingPacket + numBytesPacketHeader;
4234+ dataAt += sizeof(VOXEL_PACKET_FLAGS);
4235+ VOXEL_PACKET_SEQUENCE sequence = (*(VOXEL_PACKET_SEQUENCE*)dataAt);
4236+ dataAt += sizeof(VOXEL_PACKET_SEQUENCE);
4237+ VOXEL_PACKET_SENT_TIME sentAt = (*(VOXEL_PACKET_SENT_TIME*)dataAt);
4238+ dataAt += sizeof(VOXEL_PACKET_SENT_TIME);
4239+ VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow();
4240+ int flightTime = arrivedAt - sentAt;
4241+
4242+ printf("got PACKET_TYPE_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime);
4243+ }
43364244
43374245 // add this packet to our list of voxel packets and process them on the voxel processing
43384246 app->_voxelProcessor.queueReceivedPacket(senderSockAddr, app->_incomingPacket, bytesReceived);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t