From 1868717520fa25d8cac195b047ed3305671dc5e8 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Wed, 3 Jul 2013 11:10:40 -0700 Subject: [PATCH 01/13] Improve gyro look to smoothly follow the head and not move for small movements --- interface/src/Application.cpp | 23 +++++++----------- interface/src/Avatar.cpp | 12 ++++------ interface/src/Avatar.h | 2 +- interface/src/Head.cpp | 44 +++++++++++++++++++++++++++++++---- interface/src/Head.h | 9 ++++++- 5 files changed, 62 insertions(+), 28 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4eb2f8e25a..4669730e4b 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -362,9 +362,7 @@ void Application::paintGL() { glEnable(GL_LINE_SMOOTH); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - float headCameraScale = (_serialHeadSensor.isActive() || _webcam.isActive()) ? _headCameraPitchYawScale : 1.0f; - + if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { _myCamera.setTightness (100.0f); _myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition()); @@ -380,11 +378,11 @@ void Application::paintGL() { } else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { _myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay _myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition()); - _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation(headCameraScale)); + _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation()); } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { _myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition()); - _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation(headCameraScale)); + _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation()); } // Update camera position @@ -1451,7 +1449,7 @@ void Application::initMenu() { (_echoAudioMode = optionsMenu->addAction("Echo Audio"))->setCheckable(true); optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true); - (_gyroLook = optionsMenu->addAction("Gyro Look"))->setCheckable(true); + (_gyroLook = optionsMenu->addAction("Smooth Gyro Look"))->setCheckable(true); _gyroLook->setChecked(false); (_mouseLook = optionsMenu->addAction("Mouse Look"))->setCheckable(true); _mouseLook->setChecked(true); @@ -1903,18 +1901,13 @@ void Application::update(float deltaTime) { void Application::updateAvatar(float deltaTime) { // Update my avatar's head position from gyros and/or webcam - _myAvatar.updateHeadFromGyrosAndOrWebcam(); + _myAvatar.updateHeadFromGyrosAndOrWebcam(_gyroLook->isChecked(), + glm::vec3(_headCameraPitchYawScale, + _headCameraPitchYawScale, + _headCameraPitchYawScale) ); if (_serialHeadSensor.isActive()) { - // Update avatar head translation - if (_gyroLook->isChecked()) { - glm::vec3 headPosition = _serialHeadSensor.getEstimatedPosition(); - const float HEAD_OFFSET_SCALING = 3.f; - headPosition *= HEAD_OFFSET_SCALING; - _myCamera.setEyeOffsetPosition(headPosition); - } - // Grab latest readings from the gyros float measuredPitchRate = _serialHeadSensor.getLastPitchRate(); float measuredYawRate = _serialHeadSensor.getLastYawRate(); diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 97e0f71c5a..2598e7531e 100755 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -285,10 +285,7 @@ void Avatar::reset() { } // Update avatar head rotation with sensor data -void Avatar::updateHeadFromGyrosAndOrWebcam() { - const float AMPLIFY_PITCH = 2.f; - const float AMPLIFY_YAW = 2.f; - const float AMPLIFY_ROLL = 2.f; +void Avatar::updateHeadFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyAngle) { SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); Webcam* webcam = Application::getInstance()->getWebcam(); @@ -306,9 +303,10 @@ void Avatar::updateHeadFromGyrosAndOrWebcam() { } else { return; } - _head.setPitch(estimatedRotation.x * AMPLIFY_PITCH); - _head.setYaw(estimatedRotation.y * AMPLIFY_YAW); - _head.setRoll(estimatedRotation.z * AMPLIFY_ROLL); + _head.setPitch(estimatedRotation.x * amplifyAngle.x); + _head.setYaw(estimatedRotation.y * amplifyAngle.y); + _head.setRoll(estimatedRotation.z * amplifyAngle.z); + _head.setCameraFollowsHead(gyroLook); // Update torso lean distance based on accelerometer data const float TORSO_LENGTH = 0.5f; diff --git a/interface/src/Avatar.h b/interface/src/Avatar.h index 86c333dad4..6351d37a74 100755 --- a/interface/src/Avatar.h +++ b/interface/src/Avatar.h @@ -87,7 +87,7 @@ public: void reset(); void simulate(float deltaTime, Transmitter* transmitter); void updateThrust(float deltaTime, Transmitter * transmitter); - void updateHeadFromGyrosAndOrWebcam(); + void updateHeadFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyAngles); void updateFromMouse(int mouseX, int mouseY, int screenWidth, int screenHeight); void updateFromTouch(float touchAvgDistX, float touchAvgDistY); void addBodyYaw(float y) {_bodyYaw += y;}; diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 44eddeeb93..75c62ce87e 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -77,7 +77,12 @@ Head::Head(Avatar* owningAvatar) : _rightEyeBlink(0.0f), _leftEyeBlinkVelocity(0.0f), _rightEyeBlinkVelocity(0.0f), - _timeWithoutTalking(0.0f) + _timeWithoutTalking(0.0f), + _cameraPitch(_pitch), + _cameraYaw(_yaw), + _isCameraMoving(false), + _cameraFollowsHead(false), + _cameraFollowHeadRate(0.0f) { if (USING_PHYSICAL_MOHAWK) { resetHairPhysics(); @@ -213,6 +218,37 @@ void Head::simulate(float deltaTime, bool isMine) { updateHairPhysics(deltaTime); } + // Update camera pitch and yaw independently from motion of head (for gyro-based interface) + if (isMine && _cameraFollowsHead) { + // If we are using gyros and using gyroLook, have the camera follow head but with a null region + // to create stable rendering view with small head movements. + const float CAMERA_FOLLOW_HEAD_RATE_START = 0.05f; + const float CAMERA_FOLLOW_HEAD_RATE_MAX = 0.25f; + const float CAMERA_FOLLOW_HEAD_RATE_RAMP_RATE = 1.5f; + const float CAMERA_STOP_TOLERANCE_DEGREES = 0.25f; + const float CAMERA_START_TOLERANCE_DEGREES = 15.0f; + float cameraHeadAngleDifference = glm::length(glm::vec2(_pitch - _cameraPitch, _yaw - _cameraYaw)); + if (_isCameraMoving) { + _cameraFollowHeadRate = glm::clamp(_cameraFollowHeadRate * CAMERA_FOLLOW_HEAD_RATE_RAMP_RATE, + 0.f, + CAMERA_FOLLOW_HEAD_RATE_MAX); + + _cameraPitch += (_pitch - _cameraPitch) * _cameraFollowHeadRate; + _cameraYaw += (_yaw - _cameraYaw) * _cameraFollowHeadRate; + if (cameraHeadAngleDifference < CAMERA_STOP_TOLERANCE_DEGREES) { + _isCameraMoving = false; + } + } else { + if (cameraHeadAngleDifference > CAMERA_START_TOLERANCE_DEGREES) { + _isCameraMoving = true; + _cameraFollowHeadRate = CAMERA_FOLLOW_HEAD_RATE_START; + } + } + } else { + // Camera always locked to head + _cameraPitch = _pitch; + _cameraYaw = _yaw; + } } void Head::calculateGeometry() { @@ -358,10 +394,10 @@ glm::quat Head::getOrientation() const { glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll))); } -glm::quat Head::getCameraOrientation (float pitchYawScale) const { +glm::quat Head::getCameraOrientation () const { Avatar* owningAvatar = static_cast(_owningAvatar); - return owningAvatar->getWorldAlignedOrientation() * glm::quat(glm::radians(glm::vec3( - _pitch * pitchYawScale, _yaw * pitchYawScale, 0.0f))); + return owningAvatar->getWorldAlignedOrientation() + * glm::quat(glm::radians(glm::vec3(_cameraPitch, _cameraYaw, 0.0f))); } void Head::renderHeadSphere() { diff --git a/interface/src/Head.h b/interface/src/Head.h index 85976d33d8..8564cd94b0 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -48,8 +48,10 @@ public: void setReturnToCenter (bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; } void setRenderLookatVectors(bool onOff ) { _renderLookatVectors = onOff; } + void setCameraFollowsHead(bool b) { _cameraFollowsHead = b; } + glm::quat getOrientation() const; - glm::quat getCameraOrientation (float pitchYawScale) const; + glm::quat getCameraOrientation () const; glm::vec3 getPosition() const { return _position; } glm::vec3 getRightDirection() const { return getOrientation() * IDENTITY_RIGHT; } @@ -112,6 +114,11 @@ private: float _leftEyeBlinkVelocity; float _rightEyeBlinkVelocity; float _timeWithoutTalking; + float _cameraPitch; // Used to position the camera differently from the head + float _cameraYaw; + bool _isCameraMoving; + bool _cameraFollowsHead; + float _cameraFollowHeadRate; static ProgramObject* _irisProgram; static GLuint _irisTextureID; From 7880c74304c5737cd8fd5aad5d0fa9ce5a8f3618 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Wed, 3 Jul 2013 11:17:06 -0700 Subject: [PATCH 02/13] smooth gyro look on by default if not in settings --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index af3e3501df..94a2962d74 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1452,7 +1452,7 @@ void Application::initMenu() { optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true); (_gyroLook = optionsMenu->addAction("Smooth Gyro Look"))->setCheckable(true); - _gyroLook->setChecked(false); + _gyroLook->setChecked(true); (_mouseLook = optionsMenu->addAction("Mouse Look"))->setCheckable(true); _mouseLook->setChecked(true); (_touchLook = optionsMenu->addAction("Touch Look"))->setCheckable(true); From acef2bc669e92b374835374418479602d8dcb108 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Wed, 3 Jul 2013 11:37:38 -0700 Subject: [PATCH 03/13] Fixed two-finger touch delay, and all other hidden event-pile-up. Added a processEvents() call in the idle, because otherwise calling idle updates starves the event handlers. --- interface/src/Application.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 17f4ee421e..ba9f25726a 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -946,6 +946,11 @@ void Application::idle() { // Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran if (diffclock(&_lastTimeIdle, &check) > IDLE_SIMULATE_MSECS) { + // We call processEvents() here because the idle timer takes priority over + // event handling in Qt, so when the framerate gets low events will pile up + // unless we handle them here. + processEvents(); + update(1.0f / _fps); _glWidget->updateGL(); From e8ee041f20ebb7062951d4fe3a0fdf70563e903d Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Wed, 3 Jul 2013 11:46:53 -0700 Subject: [PATCH 04/13] Virtual method warning removal. Warning was "Delete called on HifiLeapListener that has virtual functions but non-virtual destructor" --- interface/src/LeapManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/LeapManager.cpp b/interface/src/LeapManager.cpp index 2c5dc5c183..416abd31f5 100755 --- a/interface/src/LeapManager.cpp +++ b/interface/src/LeapManager.cpp @@ -17,6 +17,10 @@ HifiLeapListener* LeapManager::_listener = NULL; class HifiLeapListener : public Leap::Listener { public: + HifiLeapListener() { + } + virtual ~HifiLeapListener() { + } Leap::Frame lastFrame; std::vector fingerTips; std::vector fingerRoots; From 485c603d4fe8dbd0bedc8ac2dec717cece2e7076 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 3 Jul 2013 12:42:34 -0700 Subject: [PATCH 05/13] added some timing debugging, and bail early if voxel server is slow --- voxel-server/src/VoxelAgentData.cpp | 3 ++- voxel-server/src/VoxelAgentData.h | 5 ++++ voxel-server/src/main.cpp | 38 +++++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/voxel-server/src/VoxelAgentData.cpp b/voxel-server/src/VoxelAgentData.cpp index 289b1161e6..98990011da 100644 --- a/voxel-server/src/VoxelAgentData.cpp +++ b/voxel-server/src/VoxelAgentData.cpp @@ -16,7 +16,8 @@ VoxelAgentData::VoxelAgentData(Agent* owningAgent) : _viewSent(false), _voxelPacketAvailableBytes(MAX_VOXEL_PACKET_SIZE), _maxSearchLevel(1), - _maxLevelReachedInLastSearch(1) + _maxLevelReachedInLastSearch(1), + _lastTimeBagEmpty(0) { _voxelPacket = new unsigned char[MAX_VOXEL_PACKET_SIZE]; _voxelPacketAt = _voxelPacket; diff --git a/voxel-server/src/VoxelAgentData.h b/voxel-server/src/VoxelAgentData.h index 6606530b94..e26b85151c 100644 --- a/voxel-server/src/VoxelAgentData.h +++ b/voxel-server/src/VoxelAgentData.h @@ -50,6 +50,10 @@ public: bool getViewSent() const { return _viewSent; }; void setViewSent(bool viewSent) { _viewSent = viewSent; } + long long getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }; + void setLastTimeBagEmpty(long long now) { _lastTimeBagEmpty = now; }; + + private: VoxelAgentData(const VoxelAgentData &); VoxelAgentData& operator= (const VoxelAgentData&); @@ -63,6 +67,7 @@ private: int _maxLevelReachedInLastSearch; ViewFrustum _currentViewFrustum; ViewFrustum _lastKnownViewFrustum; + long long _lastTimeBagEmpty; }; diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index a73a8dd09a..e21f46f6ca 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -46,6 +46,7 @@ const float MAX_CUBE = 0.05f; const int VOXEL_SEND_INTERVAL_USECS = 100 * 1000; int PACKETS_PER_CLIENT_PER_INTERVAL = 30; +const int SENDING_TIME_TO_SPARE = 20 * 1000; // usec of sending interval to spare for calculating voxels const int MAX_VOXEL_TREE_DEPTH_LEVELS = 4; @@ -263,6 +264,23 @@ void deepestLevelVoxelDistributor(AgentList* agentList, // If the current view frustum has changed OR we have nothing to send, then search against // the current view frustum for things to send. if (viewFrustumChanged || agentData->nodeBag.isEmpty()) { + if (::debugVoxelSending) { + printf("(viewFrustumChanged=%s || agentData->nodeBag.isEmpty() =%s)...\n", + debug::valueOf(viewFrustumChanged),debug::valueOf(agentData->nodeBag.isEmpty())); + long long now = usecTimestampNow(); + if (agentData->getLastTimeBagEmpty() > 0) { + float elapsedSceneSend = (now - agentData->getLastTimeBagEmpty()) / 1000000.0f; + printf(" elapsed time to send scene = %f seconds\n", elapsedSceneSend); + } + agentData->setLastTimeBagEmpty(now); + } + + // if our view has changed, we need to reset these things... + if (viewFrustumChanged) { + agentData->nodeBag.deleteAll(); + agentData->map.erase(); + } + // For now, we're going to disable the "search for colored nodes" because that strategy doesn't work when we support // deletion of nodes. Instead if we just start at the root we get the correct behavior we want. We are keeping this @@ -310,6 +328,22 @@ void deepestLevelVoxelDistributor(AgentList* agentList, bool shouldSendEnvironments = shouldDo(ENVIRONMENT_SEND_INTERVAL_USECS, VOXEL_SEND_INTERVAL_USECS); while (packetsSentThisInterval < PACKETS_PER_CLIENT_PER_INTERVAL - (shouldSendEnvironments ? 1 : 0)) { + + // Check to see if we're taking too long, and if so bail early... + long long now = usecTimestampNow(); + long elapsedUsec = (now - start); + long elapsedUsecPerPacket = (truePacketsSent == 0) ? 0 : (elapsedUsec / truePacketsSent); + long usecRemaining = (VOXEL_SEND_INTERVAL_USECS - elapsedUsec); + + if (elapsedUsecPerPacket + SENDING_TIME_TO_SPARE > usecRemaining) { + if (::debugVoxelSending) { + printf("packetLoop() usecRemaining=%ld bailing early took %ld usecs to generate %d bytes in %d packets (%ld usec avg), %d nodes still to send\n", + usecRemaining, elapsedUsec, trueBytesSent, truePacketsSent, elapsedUsecPerPacket, + agentData->nodeBag.count()); + } + break; + } + if (!agentData->nodeBag.isEmpty()) { VoxelNode* subTree = agentData->nodeBag.extract(); @@ -322,7 +356,7 @@ void deepestLevelVoxelDistributor(AgentList* agentList, bytesWritten = serverTree.encodeTreeBitstream(subTree, &tempOutputBuffer[0], MAX_VOXEL_PACKET_SIZE - 1, agentData->nodeBag, params); - + if (agentData->getAvailable() >= bytesWritten) { agentData->writeToPacket(&tempOutputBuffer[0], bytesWritten); } else { @@ -379,7 +413,7 @@ void deepestLevelVoxelDistributor(AgentList* agentList, if (agentData->nodeBag.isEmpty()) { agentData->updateLastKnownViewFrustum(); agentData->setViewSent(true); - agentData->map.erase(); + agentData->map.erase(); // It would be nice if we could save this, and only reset it when the view frustum changes } From 331351765e2ac9b6d4559ea4802e9c17a4af57c5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 3 Jul 2013 12:51:26 -0700 Subject: [PATCH 06/13] remove fvversioncomparator from headers passed to qt4 --- interface/external/fervor/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/external/fervor/CMakeLists.txt b/interface/external/fervor/CMakeLists.txt index 9afeb6f4ec..f257bb4431 100644 --- a/interface/external/fervor/CMakeLists.txt +++ b/interface/external/fervor/CMakeLists.txt @@ -6,6 +6,11 @@ add_definitions(-DFV_GUI) file(GLOB FERVOR_SOURCES *.cpp) file(GLOB FERVOR_HEADERS *.h) + +LIST(GET FERVOR_HEADERS 1 FIRST_HEADER) +GET_FILENAME_COMPONENT(HEADER_PATH ${FIRST_HEADER} PATH) +list(REMOVE_ITEM FERVOR_HEADERS ${HEADER_PATH}/fvversioncomparator.h) + file(GLOB FERVOR_UI *.ui) qt4_wrap_ui(FERVOR_WRAPPED_UI ${FERVOR_UI}) From 3388fccc86b791f3bf195468771a68255c842303 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Wed, 3 Jul 2013 13:09:55 -0700 Subject: [PATCH 07/13] Fixes per code review --- interface/src/Application.cpp | 2 +- interface/src/Head.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e6b86b4896..56469938ff 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1914,7 +1914,7 @@ void Application::updateAvatar(float deltaTime) { _myAvatar.updateHeadFromGyrosAndOrWebcam(_gyroLook->isChecked(), glm::vec3(_headCameraPitchYawScale, _headCameraPitchYawScale, - _headCameraPitchYawScale) ); + _headCameraPitchYawScale)); if (_serialHeadSensor.isActive()) { diff --git a/interface/src/Head.h b/interface/src/Head.h index 8564cd94b0..e8bcfb5277 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -48,7 +48,7 @@ public: void setReturnToCenter (bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; } void setRenderLookatVectors(bool onOff ) { _renderLookatVectors = onOff; } - void setCameraFollowsHead(bool b) { _cameraFollowsHead = b; } + void setCameraFollowsHead(bool cameraFollowsHead) { _cameraFollowsHead = cameraFollowsHead; } glm::quat getOrientation() const; glm::quat getCameraOrientation () const; From fe46a3f0c9247c83d7f7a2100715fa76bbe8b362 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Wed, 3 Jul 2013 13:11:26 -0700 Subject: [PATCH 08/13] [trivial] small bracket fix per request in https://github.com/worklist/hifi/pull/618/files --- interface/src/LeapManager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/interface/src/LeapManager.cpp b/interface/src/LeapManager.cpp index 416abd31f5..b3d7737969 100755 --- a/interface/src/LeapManager.cpp +++ b/interface/src/LeapManager.cpp @@ -17,10 +17,9 @@ HifiLeapListener* LeapManager::_listener = NULL; class HifiLeapListener : public Leap::Listener { public: - HifiLeapListener() { - } - virtual ~HifiLeapListener() { - } + HifiLeapListener() {} + virtual ~HifiLeapListener() {} + Leap::Frame lastFrame; std::vector fingerTips; std::vector fingerRoots; From 0e689426746e3089840a06ed69fa75980b830c5f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 3 Jul 2013 14:27:07 -0700 Subject: [PATCH 09/13] comment out processEvents to remove event receipt bug --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 56469938ff..d01de5fd8d 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -947,7 +947,7 @@ void Application::idle() { // We call processEvents() here because the idle timer takes priority over // event handling in Qt, so when the framerate gets low events will pile up // unless we handle them here. - processEvents(); +// processEvents(); update(1.0f / _fps); From e85e49ef3b129fe9caf129a5cb112db61bcd7e08 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 3 Jul 2013 14:31:28 -0700 Subject: [PATCH 10/13] add a comment to disable of processEvents --- interface/src/Application.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d01de5fd8d..53bafe3c9c 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -947,7 +947,11 @@ void Application::idle() { // We call processEvents() here because the idle timer takes priority over // event handling in Qt, so when the framerate gets low events will pile up // unless we handle them here. -// processEvents(); + + // NOTE - this is commented out for now - causing event processing issues reported by Philip and Ryan + // birarda - July 3rdg + + // processEvents(); update(1.0f / _fps); From 2fffb15d947b7f71f61f8bf3f07ce5b27fa77637 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 3 Jul 2013 14:43:01 -0700 Subject: [PATCH 11/13] CR feedback --- voxel-server/src/VoxelAgentData.h | 4 ++-- voxel-server/src/main.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/voxel-server/src/VoxelAgentData.h b/voxel-server/src/VoxelAgentData.h index e26b85151c..f7e04329a0 100644 --- a/voxel-server/src/VoxelAgentData.h +++ b/voxel-server/src/VoxelAgentData.h @@ -50,8 +50,8 @@ public: bool getViewSent() const { return _viewSent; }; void setViewSent(bool viewSent) { _viewSent = viewSent; } - long long getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }; - void setLastTimeBagEmpty(long long now) { _lastTimeBagEmpty = now; }; + long long getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }; + void setLastTimeBagEmpty(long long lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; }; private: diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index e21f46f6ca..ca7240b03c 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -266,7 +266,7 @@ void deepestLevelVoxelDistributor(AgentList* agentList, if (viewFrustumChanged || agentData->nodeBag.isEmpty()) { if (::debugVoxelSending) { printf("(viewFrustumChanged=%s || agentData->nodeBag.isEmpty() =%s)...\n", - debug::valueOf(viewFrustumChanged),debug::valueOf(agentData->nodeBag.isEmpty())); + debug::valueOf(viewFrustumChanged), debug::valueOf(agentData->nodeBag.isEmpty())); long long now = usecTimestampNow(); if (agentData->getLastTimeBagEmpty() > 0) { float elapsedSceneSend = (now - agentData->getLastTimeBagEmpty()) / 1000000.0f; From 430c70875dad64d76cf03f3635548642891e966d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 3 Jul 2013 14:40:59 -0700 Subject: [PATCH 12/13] tweaks to debug messages (cherry picked from commit 873144ded360112d26c77f6426905f6ac3b27658) --- voxel-server/src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index ca7240b03c..af7f321d5e 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -270,7 +270,13 @@ void deepestLevelVoxelDistributor(AgentList* agentList, long long now = usecTimestampNow(); if (agentData->getLastTimeBagEmpty() > 0) { float elapsedSceneSend = (now - agentData->getLastTimeBagEmpty()) / 1000000.0f; - printf(" elapsed time to send scene = %f seconds\n", elapsedSceneSend); + + if (viewFrustumChanged) { + printf("viewFrustumChanged resetting after elapsed time to send scene = %f seconds", elapsedSceneSend); + } else { + printf("elapsed time to send scene = %f seconds", elapsedSceneSend); + } + printf(" [occlusionCulling: %s]\n", debug::valueOf(agentData->getWantOcclusionCulling())); } agentData->setLastTimeBagEmpty(now); } From 8a4dc8446b77af22ef3c2c489d9d300fcf89fef1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 3 Jul 2013 15:05:51 -0700 Subject: [PATCH 13/13] what is July 3rdg --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 53bafe3c9c..088dd03e03 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -949,7 +949,7 @@ void Application::idle() { // unless we handle them here. // NOTE - this is commented out for now - causing event processing issues reported by Philip and Ryan - // birarda - July 3rdg + // birarda - July 3rd // processEvents();