Showing the changes to interface/src/Application.cpp (1 of 151 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) { |
| @@ -1785,7 +1791,28 @@ void Application::renderFollowIndicator() { · 526 unmodified lines | ||
| 1785 | 1791 | } |
| 1786 | 1792 | } |
| 1787 | 1793 | |
| 1794 | +void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { | |
| 1795 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1796 | + PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); | |
| 1797 | + NodeList* nodeList = NodeList::getInstance(); | |
| 1798 | + | |
| 1799 | + for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 1800 | + node->lock(); | |
| 1801 | + if (node->getLinkedData() != NULL) { | |
| 1802 | + Avatar *avatar = (Avatar *)node->getLinkedData(); | |
| 1803 | + if (!avatar->isInitialized()) { | |
| 1804 | + avatar->init(); | |
| 1805 | + } | |
| 1806 | + avatar->simulate(deltaTime, NULL); | |
| 1807 | + avatar->setMouseRay(mouseRayOrigin, mouseRayDirection); | |
| 1808 | + } | |
| 1809 | + node->unlock(); | |
| 1810 | + } | |
| 1811 | +} | |
| 1812 | + | |
| 1788 | 1813 | void Application::update(float deltaTime) { |
| 1814 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1815 | + PerformanceWarning warn(showWarnings, "Application::update()"); | |
| 1789 | 1816 | |
| 1790 | 1817 | // Use Transmitter Hand to move hand if connected, else use mouse |
| 1791 | 1818 | if (_myTransmitter.isConnected()) { |
| @@ -1886,6 +1913,8 @@ void Application::update(float deltaTime) { · 94 unmodified lines | ||
| 1886 | 1913 | (fabs(_myAvatar.getVelocity().x) + |
| 1887 | 1914 | fabs(_myAvatar.getVelocity().y) + |
| 1888 | 1915 | fabs(_myAvatar.getVelocity().z)) / 3 < MAX_AVATAR_EDIT_VELOCITY) { |
| 1916 | + PerformanceWarning warn(showWarnings, "Application::update()... findRayIntersection()"); | |
| 1917 | + | |
| 1889 | 1918 | if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) { |
| 1890 | 1919 | if (distance < MAX_VOXEL_EDIT_DISTANCE) { |
| 1891 | 1920 | // find the nearest voxel with the desired scale |
| @@ -1993,22 +2022,11 @@ void Application::update(float deltaTime) { · 101 unmodified lines | ||
| 1993 | 2022 | _voxelProcessor.threadRoutine(); |
| 1994 | 2023 | _voxelEditSender.threadRoutine(); |
| 1995 | 2024 | } |
| 2025 | + | |
| 1996 | 2026 | |
| 1997 | 2027 | //loop through all the other avatars and simulate them... |
| 1998 | − NodeList* nodeList = NodeList::getInstance(); | |
| 1999 | − for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 2000 | − node->lock(); | |
| 2001 | − if (node->getLinkedData() != NULL) { | |
| 2002 | − Avatar *avatar = (Avatar *)node->getLinkedData(); | |
| 2003 | − if (!avatar->isInitialized()) { | |
| 2004 | − avatar->init(); | |
| 2005 | − } | |
| 2006 | − avatar->simulate(deltaTime, NULL); | |
| 2007 | − avatar->setMouseRay(mouseRayOrigin, mouseRayDirection); | |
| 2008 | − } | |
| 2009 | − node->unlock(); | |
| 2010 | − } | |
| 2011 | − | |
| 2028 | + updateAvatars(deltaTime, mouseRayOrigin, mouseRayDirection); | |
| 2029 | + | |
| 2012 | 2030 | // Simulate myself |
| 2013 | 2031 | if (Menu::getInstance()->isOptionChecked(MenuOption::Gravity)) { |
| 2014 | 2032 | _myAvatar.setGravity(_environment.getGravity(_myAvatar.getPosition())); |
| @@ -2043,6 +2061,7 @@ void Application::update(float deltaTime) { · 28 unmodified lines | ||
| 2043 | 2061 | if (_voxels.findRayIntersection(_transmitterPickStart, direction, detail, distance, face)) { |
| 2044 | 2062 | minDistance = min(minDistance, distance); |
| 2045 | 2063 | } |
| 2064 | + NodeList* nodeList = NodeList::getInstance(); | |
| 2046 | 2065 | for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 2047 | 2066 | node->lock(); |
| 2048 | 2067 | if (node->getLinkedData() != NULL) { |
| @@ -2136,6 +2155,8 @@ void Application::update(float deltaTime) { · 87 unmodified lines | ||
| 2136 | 2155 | } |
| 2137 | 2156 | |
| 2138 | 2157 | void Application::updateAvatar(float deltaTime) { |
| 2158 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2159 | + PerformanceWarning warn(showWarnings, "Application::updateAvatar()"); | |
| 2139 | 2160 | |
| 2140 | 2161 | // rotate body yaw for yaw received from multitouch |
| 2141 | 2162 | _myAvatar.setOrientation(_myAvatar.getOrientation() |
| @@ -2992,51 +3013,54 @@ void Application::displayStats() { · 850 unmodified lines | ||
| 2992 | 3013 | std::stringstream voxelStats; |
| 2993 | 3014 | voxelStats.precision(4); |
| 2994 | 3015 | voxelStats << "Voxels Rendered: " << _voxels.getVoxelsRendered() / 1000.f << "K " << |
| 3016 | + "Written: " << _voxels.getVoxelsWritten()/1000.f << "K " << | |
| 2995 | 3017 | "Updated: " << _voxels.getVoxelsUpdated()/1000.f << "K " << |
| 2996 | 3018 | "Max: " << _voxels.getMaxVoxels()/1000.f << "K "; |
| 2997 | 3019 | statsVerticalOffset += PELS_PER_LINE; |
| 2998 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3020 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 2999 | 3021 | |
| 3000 | 3022 | voxelStats.str(""); |
| 3001 | 3023 | voxelStats << |
| 3002 | − "Voxels Memory Nodes: " << VoxelNode::getVoxelMemoryUsage() / 1000000.f << "MB " | |
| 3003 | − "Octcodes: " << VoxelNode::getOctcodeMemoryUsage() / 1000000.f << "MB " | |
| 3024 | + "Voxels Memory Nodes: " << VoxelNode::getTotalMemoryUsage() / 1000000.f << "MB " | |
| 3004 | 3025 | "Geometry RAM: " << _voxels.getVoxelMemoryUsageRAM() / 1000000.f << "MB " << |
| 3005 | 3026 | "VBO: " << _voxels.getVoxelMemoryUsageVBO() / 1000000.f << "MB "; |
| 3006 | 3027 | if (_voxels.hasVoxelMemoryUsageGPU()) { |
| 3007 | 3028 | voxelStats << "GPU: " << _voxels.getVoxelMemoryUsageGPU() / 1000000.f << "MB "; |
| 3008 | 3029 | } |
| 3030 | + statsVerticalOffset += PELS_PER_LINE; | |
| 3031 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3009 | 3032 | |
| 3010 | − // Some debugging for memory usage of VoxelNodes | |
| 3011 | − //voxelStats << "VoxelNode size: " << sizeof(VoxelNode) << " bytes "; | |
| 3012 | − //voxelStats << "AABox size: " << sizeof(AABox) << " bytes "; | |
| 3013 | − | |
| 3033 | + voxelStats.str(""); | |
| 3034 | + voxelStats << | |
| 3035 | + "Local Voxels Total: " << VoxelNode::getNodeCount() << ", " << | |
| 3036 | + "Internal: " << VoxelNode::getInternalNodeCount() << " , " << | |
| 3037 | + "Leaves: " << VoxelNode::getLeafNodeCount() << ""; | |
| 3014 | 3038 | statsVerticalOffset += PELS_PER_LINE; |
| 3015 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3039 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3016 | 3040 | |
| 3017 | 3041 | voxelStats.str(""); |
| 3018 | 3042 | char* voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_VOXELS); |
| 3019 | 3043 | voxelStats << "Voxels Sent from Server: " << voxelDetails; |
| 3020 | 3044 | statsVerticalOffset += PELS_PER_LINE; |
| 3021 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3045 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3022 | 3046 | |
| 3023 | 3047 | voxelStats.str(""); |
| 3024 | 3048 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ELAPSED); |
| 3025 | 3049 | voxelStats << "Scene Send Time from Server: " << voxelDetails; |
| 3026 | 3050 | statsVerticalOffset += PELS_PER_LINE; |
| 3027 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3051 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3028 | 3052 | |
| 3029 | 3053 | voxelStats.str(""); |
| 3030 | 3054 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ENCODE); |
| 3031 | 3055 | voxelStats << "Encode Time on Server: " << voxelDetails; |
| 3032 | 3056 | statsVerticalOffset += PELS_PER_LINE; |
| 3033 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3057 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3034 | 3058 | |
| 3035 | 3059 | voxelStats.str(""); |
| 3036 | 3060 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_MODE); |
| 3037 | 3061 | voxelStats << "Sending Mode: " << voxelDetails; |
| 3038 | 3062 | statsVerticalOffset += PELS_PER_LINE; |
| 3039 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | |
| 3063 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3040 | 3064 | |
| 3041 | 3065 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); |
| 3042 | 3066 | char avatarMixerStats[200]; |
| @@ -3051,7 +3075,7 @@ void Application::displayStats() { · 8 unmodified lines | ||
| 3051 | 3075 | statsVerticalOffset += PELS_PER_LINE; |
| 3052 | 3076 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, avatarMixerStats); |
| 3053 | 3077 | statsVerticalOffset += PELS_PER_LINE; |
| 3054 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)LeapManager::statusString().c_str()); | |
| 3078 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)LeapManager::statusString().c_str()); | |
| 3055 | 3079 | |
| 3056 | 3080 | if (_perfStatsOn) { |
| 3057 | 3081 | // Get the PerfStats group details. We need to allocate and array of char* long enough to hold 1+groups |
| @@ -3237,7 +3261,6 @@ void Application::renderCoverageMapsRecursively(CoverageMap* map) { · 179 unmodified lines | ||
| 3237 | 3261 | |
| 3238 | 3262 | |
| 3239 | 3263 | |
| 3240 | −///////////////////////////////////////////////////////////////////////////////////// | |
| 3241 | 3264 | // renderViewFrustum() |
| 3242 | 3265 | // |
| 3243 | 3266 | // Description: this will render the view frustum bounds for EITHER the head |
| @@ -3319,7 +3342,7 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { · 75 unmodified lines | ||
| 3319 | 3342 | || Menu::getInstance()->getFrustumDrawMode() == FRUSTUM_DRAW_MODE_PLANES |
| 3320 | 3343 | || Menu::getInstance()->getFrustumDrawMode() == FRUSTUM_DRAW_MODE_FAR_PLANE) { |
| 3321 | 3344 | // viewFrustum.getFar plane - bottom edge |
| 3322 | − glColor3f(0,1,0); // GREEN!!! | |
| 3345 | + glColor3f(0,1,0); | |
| 3323 | 3346 | glVertex3f(viewFrustum.getFarBottomLeft().x, viewFrustum.getFarBottomLeft().y, viewFrustum.getFarBottomLeft().z); |
| 3324 | 3347 | glVertex3f(viewFrustum.getFarBottomRight().x, viewFrustum.getFarBottomRight().y, viewFrustum.getFarBottomRight().z); |
| 3325 | 3348 | |
| @@ -3687,6 +3710,9 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 361 unmodified lines | ||
| 3687 | 3710 | |
| 3688 | 3711 | // Receive packets from other nodes/servers and decide what to do with them! |
| 3689 | 3712 | void* Application::networkReceive(void* args) { |
| 3713 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3714 | + "Application::networkReceive()"); | |
| 3715 | + | |
| 3690 | 3716 | sockaddr senderAddress; |
| 3691 | 3717 | ssize_t bytesReceived; |
| 3692 | 3718 | |
| @@ -3714,6 +3740,9 @@ void* Application::networkReceive(void* args) { · 21 unmodified lines | ||
| 3714 | 3740 | case PACKET_TYPE_ERASE_VOXEL: |
| 3715 | 3741 | case PACKET_TYPE_VOXEL_STATS: |
| 3716 | 3742 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 3743 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3744 | + "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); | |
| 3745 | + | |
| 3717 | 3746 | // add this packet to our list of voxel packets and process them on the voxel processing |
| 3718 | 3747 | app->_voxelProcessor.queueReceivedPacket(senderAddress, app->_incomingPacket, bytesReceived); |
| 3719 | 3748 | break; |