Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -356,8 +356,9 @@ void Application::initializeGL() { · 355 unmodified lines | ||
| 356 | 356 | |
| 357 | 357 | void Application::paintGL() { |
| 358 | 358 | PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings)); |
| 359 | − PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::paintGL()"); | |
| 360 | − | |
| 359 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 360 | + PerformanceWarning warn(showWarnings, "Application::paintGL()"); | |
| 361 | + | |
| 361 | 362 | glEnable(GL_LINE_SMOOTH); |
| 362 | 363 | |
| 363 | 364 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| @@ -545,6 +546,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 181 unmodified lines | ||
| 545 | 546 | } |
| 546 | 547 | |
| 547 | 548 | bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); |
| 549 | + bool isMeta = event->modifiers().testFlag(Qt::ControlModifier); | |
| 548 | 550 | switch (event->key()) { |
| 549 | 551 | case Qt::Key_Shift: |
| 550 | 552 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode)) { |
| @@ -619,8 +621,10 @@ void Application::keyPressEvent(QKeyEvent* event) { · 68 unmodified lines | ||
| 619 | 621 | break; |
| 620 | 622 | |
| 621 | 623 | case Qt::Key_S: |
| 622 | − if (isShifted) { | |
| 624 | + if (isShifted && !isMeta) { | |
| 623 | 625 | _voxels.collectStatsForTreesAndVBOs(); |
| 626 | + } else if (isShifted && isMeta) { | |
| 627 | + Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings); | |
| 624 | 628 | } else if (_nudgeStarted) { |
| 625 | 629 | if (_lookingAlongX) { |
| 626 | 630 | if (_lookingAwayFromOrigin) { |
| @@ -1238,6 +1242,8 @@ static glm::vec3 getFaceVector(BoxFace face) { · 611 unmodified lines | ||
| 1238 | 1242 | } |
| 1239 | 1243 | |
| 1240 | 1244 | void Application::idle() { |
| 1245 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1246 | + PerformanceWarning warn(showWarnings, "Application::idle()"); | |
| 1241 | 1247 | |
| 1242 | 1248 | timeval check; |
| 1243 | 1249 | gettimeofday(&check, NULL); |
| @@ -1252,7 +1258,7 @@ void Application::idle() { · 8 unmodified lines | ||
| 1252 | 1258 | _glWidget->updateGL(); |
| 1253 | 1259 | _lastTimeUpdated = check; |
| 1254 | 1260 | _idleLoopStdev.addValue(timeSinceLastUpdate); |
| 1255 | − | |
| 1261 | + | |
| 1256 | 1262 | // Record standard deviation and reset counter if needed |
| 1257 | 1263 | const int STDEV_SAMPLES = 500; |
| 1258 | 1264 | if (_idleLoopStdev.getSamples() > STDEV_SAMPLES) { |
| @@ -1783,7 +1789,28 @@ void Application::renderFollowIndicator() { · 524 unmodified lines | ||
| 1783 | 1789 | } |
| 1784 | 1790 | } |
| 1785 | 1791 | |
| 1792 | +void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { | |
| 1793 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1794 | + PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); | |
| 1795 | + NodeList* nodeList = NodeList::getInstance(); | |
| 1796 | + | |
| 1797 | + for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 1798 | + node->lock(); | |
| 1799 | + if (node->getLinkedData() != NULL) { | |
| 1800 | + Avatar *avatar = (Avatar *)node->getLinkedData(); | |
| 1801 | + if (!avatar->isInitialized()) { | |
| 1802 | + avatar->init(); | |
| 1803 | + } | |
| 1804 | + avatar->simulate(deltaTime, NULL); | |
| 1805 | + avatar->setMouseRay(mouseRayOrigin, mouseRayDirection); | |
| 1806 | + } | |
| 1807 | + node->unlock(); | |
| 1808 | + } | |
| 1809 | +} | |
| 1810 | + | |
| 1786 | 1811 | void Application::update(float deltaTime) { |
| 1812 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1813 | + PerformanceWarning warn(showWarnings, "Application::update()"); | |
| 1787 | 1814 | |
| 1788 | 1815 | // Use Transmitter Hand to move hand if connected, else use mouse |
| 1789 | 1816 | if (_myTransmitter.isConnected()) { |
| @@ -1884,6 +1911,8 @@ void Application::update(float deltaTime) { · 94 unmodified lines | ||
| 1884 | 1911 | (fabs(_myAvatar.getVelocity().x) + |
| 1885 | 1912 | fabs(_myAvatar.getVelocity().y) + |
| 1886 | 1913 | fabs(_myAvatar.getVelocity().z)) / 3 < MAX_AVATAR_EDIT_VELOCITY) { |
| 1914 | + PerformanceWarning warn(showWarnings, "Application::update()... findRayIntersection()"); | |
| 1915 | + | |
| 1887 | 1916 | if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) { |
| 1888 | 1917 | if (distance < MAX_VOXEL_EDIT_DISTANCE) { |
| 1889 | 1918 | // find the nearest voxel with the desired scale |
| @@ -1991,22 +2020,11 @@ void Application::update(float deltaTime) { · 101 unmodified lines | ||
| 1991 | 2020 | _voxelProcessor.threadRoutine(); |
| 1992 | 2021 | _voxelEditSender.threadRoutine(); |
| 1993 | 2022 | } |
| 2023 | + | |
| 1994 | 2024 | |
| 1995 | 2025 | //loop through all the other avatars and simulate them... |
| 1996 | − NodeList* nodeList = NodeList::getInstance(); | |
| 1997 | − for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 1998 | − node->lock(); | |
| 1999 | − if (node->getLinkedData() != NULL) { | |
| 2000 | − Avatar *avatar = (Avatar *)node->getLinkedData(); | |
| 2001 | − if (!avatar->isInitialized()) { | |
| 2002 | − avatar->init(); | |
| 2003 | − } | |
| 2004 | − avatar->simulate(deltaTime, NULL); | |
| 2005 | − avatar->setMouseRay(mouseRayOrigin, mouseRayDirection); | |
| 2006 | − } | |
| 2007 | − node->unlock(); | |
| 2008 | − } | |
| 2009 | − | |
| 2026 | + updateAvatars(deltaTime, mouseRayOrigin, mouseRayDirection); | |
| 2027 | + | |
| 2010 | 2028 | // Simulate myself |
| 2011 | 2029 | if (Menu::getInstance()->isOptionChecked(MenuOption::Gravity)) { |
| 2012 | 2030 | _myAvatar.setGravity(_environment.getGravity(_myAvatar.getPosition())); |
| @@ -2041,6 +2059,7 @@ void Application::update(float deltaTime) { · 28 unmodified lines | ||
| 2041 | 2059 | if (_voxels.findRayIntersection(_transmitterPickStart, direction, detail, distance, face)) { |
| 2042 | 2060 | minDistance = min(minDistance, distance); |
| 2043 | 2061 | } |
| 2062 | + NodeList* nodeList = NodeList::getInstance(); | |
| 2044 | 2063 | for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 2045 | 2064 | node->lock(); |
| 2046 | 2065 | if (node->getLinkedData() != NULL) { |
| @@ -2134,6 +2153,8 @@ void Application::update(float deltaTime) { · 87 unmodified lines | ||
| 2134 | 2153 | } |
| 2135 | 2154 | |
| 2136 | 2155 | void Application::updateAvatar(float deltaTime) { |
| 2156 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2157 | + PerformanceWarning warn(showWarnings, "Application::updateAvatar()"); | |
| 2137 | 2158 | |
| 2138 | 2159 | // rotate body yaw for yaw received from multitouch |
| 2139 | 2160 | _myAvatar.setOrientation(_myAvatar.getOrientation() |
| @@ -2990,10 +3011,11 @@ void Application::displayStats() { · 850 unmodified lines | ||
| 2990 | 3011 | std::stringstream voxelStats; |
| 2991 | 3012 | voxelStats.precision(4); |
| 2992 | 3013 | voxelStats << "Voxels Rendered: " << _voxels.getVoxelsRendered() / 1000.f << "K " << |
| 3014 | + "Written: " << _voxels.getVoxelsWritten()/1000.f << "K " << | |
| 2993 | 3015 | "Updated: " << _voxels.getVoxelsUpdated()/1000.f << "K " << |
| 2994 | 3016 | "Max: " << _voxels.getMaxVoxels()/1000.f << "K "; |
| 2995 | 3017 | statsVerticalOffset += PELS_PER_LINE; |
| 2996 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3018 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 2997 | 3019 | |
| 2998 | 3020 | voxelStats.str(""); |
| 2999 | 3021 | voxelStats << |
| @@ -3003,37 +3025,40 @@ void Application::displayStats() { · 3 unmodified lines | ||
| 3003 | 3025 | if (_voxels.hasVoxelMemoryUsageGPU()) { |
| 3004 | 3026 | voxelStats << "GPU: " << _voxels.getVoxelMemoryUsageGPU() / 1000000.f << "MB "; |
| 3005 | 3027 | } |
| 3028 | + statsVerticalOffset += PELS_PER_LINE; | |
| 3029 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3006 | 3030 | |
| 3007 | − // Some debugging for memory usage of VoxelNodes | |
| 3008 | − //voxelStats << "VoxelNode size: " << sizeof(VoxelNode) << " bytes "; | |
| 3009 | − //voxelStats << "AABox size: " << sizeof(AABox) << " bytes "; | |
| 3010 | − | |
| 3031 | + voxelStats.str(""); | |
| 3032 | + voxelStats << | |
| 3033 | + "Local Voxels Total: " << VoxelNode::getNodeCount() << ", " << | |
| 3034 | + "Internal: " << VoxelNode::getInternalNodeCount() << " , " << | |
| 3035 | + "Leaves: " << VoxelNode::getLeafNodeCount() << ""; | |
| 3011 | 3036 | statsVerticalOffset += PELS_PER_LINE; |
| 3012 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3037 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3013 | 3038 | |
| 3014 | 3039 | voxelStats.str(""); |
| 3015 | 3040 | char* voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_VOXELS); |
| 3016 | 3041 | voxelStats << "Voxels Sent from Server: " << voxelDetails; |
| 3017 | 3042 | statsVerticalOffset += PELS_PER_LINE; |
| 3018 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3043 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3019 | 3044 | |
| 3020 | 3045 | voxelStats.str(""); |
| 3021 | 3046 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ELAPSED); |
| 3022 | 3047 | voxelStats << "Scene Send Time from Server: " << voxelDetails; |
| 3023 | 3048 | statsVerticalOffset += PELS_PER_LINE; |
| 3024 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3049 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3025 | 3050 | |
| 3026 | 3051 | voxelStats.str(""); |
| 3027 | 3052 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ENCODE); |
| 3028 | 3053 | voxelStats << "Encode Time on Server: " << voxelDetails; |
| 3029 | 3054 | statsVerticalOffset += PELS_PER_LINE; |
| 3030 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3055 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3031 | 3056 | |
| 3032 | 3057 | voxelStats.str(""); |
| 3033 | 3058 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_MODE); |
| 3034 | 3059 | voxelStats << "Sending Mode: " << voxelDetails; |
| 3035 | 3060 | statsVerticalOffset += PELS_PER_LINE; |
| 3036 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3061 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3037 | 3062 | |
| 3038 | 3063 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); |
| 3039 | 3064 | char avatarMixerStats[200]; |
| @@ -3048,7 +3073,7 @@ void Application::displayStats() { · 8 unmodified lines | ||
| 3048 | 3073 | statsVerticalOffset += PELS_PER_LINE; |
| 3049 | 3074 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, avatarMixerStats); |
| 3050 | 3075 | statsVerticalOffset += PELS_PER_LINE; |
| 3051 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)LeapManager::statusString().c_str()); | |
| 3076 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)LeapManager::statusString().c_str()); | |
| 3052 | 3077 | |
| 3053 | 3078 | if (_perfStatsOn) { |
| 3054 | 3079 | // Get the PerfStats group details. We need to allocate and array of char* long enough to hold 1+groups |
| @@ -3234,7 +3259,6 @@ void Application::renderCoverageMapsRecursively(CoverageMap* map) { · 179 unmodified lines | ||
| 3234 | 3259 | |
| 3235 | 3260 | |
| 3236 | 3261 | |
| 3237 | −///////////////////////////////////////////////////////////////////////////////////// | |
| 3238 | 3262 | // renderViewFrustum() |
| 3239 | 3263 | // |
| 3240 | 3264 | // Description: this will render the view frustum bounds for EITHER the head |
| @@ -3316,7 +3340,7 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { · 75 unmodified lines | ||
| 3316 | 3340 | || Menu::getInstance()->getFrustumDrawMode() == FRUSTUM_DRAW_MODE_PLANES |
| 3317 | 3341 | || Menu::getInstance()->getFrustumDrawMode() == FRUSTUM_DRAW_MODE_FAR_PLANE) { |
| 3318 | 3342 | // viewFrustum.getFar plane - bottom edge |
| 3319 | − glColor3f(0,1,0); // GREEN!!! | |
| 3343 | + glColor3f(0,1,0); | |
| 3320 | 3344 | glVertex3f(viewFrustum.getFarBottomLeft().x, viewFrustum.getFarBottomLeft().y, viewFrustum.getFarBottomLeft().z); |
| 3321 | 3345 | glVertex3f(viewFrustum.getFarBottomRight().x, viewFrustum.getFarBottomRight().y, viewFrustum.getFarBottomRight().z); |
| 3322 | 3346 | |
| @@ -3684,6 +3708,9 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 361 unmodified lines | ||
| 3684 | 3708 | |
| 3685 | 3709 | // Receive packets from other nodes/servers and decide what to do with them! |
| 3686 | 3710 | void* Application::networkReceive(void* args) { |
| 3711 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3712 | + "Application::networkReceive()"); | |
| 3713 | + | |
| 3687 | 3714 | sockaddr senderAddress; |
| 3688 | 3715 | ssize_t bytesReceived; |
| 3689 | 3716 | |
| @@ -3711,6 +3738,9 @@ void* Application::networkReceive(void* args) { · 21 unmodified lines | ||
| 3711 | 3738 | case PACKET_TYPE_ERASE_VOXEL: |
| 3712 | 3739 | case PACKET_TYPE_VOXEL_STATS: |
| 3713 | 3740 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 3741 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3742 | + "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); | |
| 3743 | + | |
| 3714 | 3744 | // add this packet to our list of voxel packets and process them on the voxel processing |
| 3715 | 3745 | app->_voxelProcessor.queueReceivedPacket(senderAddress, app->_incomingPacket, bytesReceived); |
| 3716 | 3746 | break; |