Showing the changes to interface/src/Application.cpp (1 of 28 files). Show all
Unified · Split
| @@ -143,6 +143,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 142 unmodified lines | ||
| 143 | 143 | _importSucceded(false), |
| 144 | 144 | _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard), |
| 145 | 145 | _wantToKillLocalVoxels(false), |
| 146 | + _viewFrustum(), | |
| 147 | + _lastQueriedViewFrustum(), | |
| 148 | + _lastQueriedTime(usecTimestampNow()), | |
| 146 | 149 | _audioScope(256, 200, true), |
| 147 | 150 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), |
| 148 | 151 | _mouseX(0), |
| @@ -1900,8 +1903,19 @@ void Application::updateMyAvatar(float deltaTime) { · 1751 unmodified lines | ||
| 1900 | 1903 | loadViewFrustum(_myCamera, _viewFrustum); |
| 1901 | 1904 | |
| 1902 | 1905 | // Update my voxel servers with my current voxel query... |
| 1903 | − queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); | |
| 1904 | − queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); | |
| 1906 | + quint64 now = usecTimestampNow(); | |
| 1907 | + quint64 sinceLastQuery = now - _lastQueriedTime; | |
| 1908 | + const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND; | |
| 1909 | + bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY; | |
| 1910 | + bool viewIsDifferentEnough = !_lastQueriedViewFrustum.isVerySimilar(_viewFrustum); | |
| 1911 | + | |
| 1912 | + // if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it | |
| 1913 | + if (queryIsDue || viewIsDifferentEnough) { | |
| 1914 | + _lastQueriedTime = now; | |
| 1915 | + queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); | |
| 1916 | + queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); | |
| 1917 | + _lastQueriedViewFrustum = _viewFrustum; | |
| 1918 | + } | |
| 1905 | 1919 | } |
| 1906 | 1920 | |
| 1907 | 1921 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { |
| @@ -2750,8 +2764,8 @@ void Application::displayStats() { · 842 unmodified lines | ||
| 2750 | 2764 | voxelStats.str(""); |
| 2751 | 2765 | QString packetsString = locale.toString((int)voxelPacketsToProcess); |
| 2752 | 2766 | QString maxString = locale.toString((int)_recentMaxPackets); |
| 2753 | − voxelStats << "Voxel Packets to Process: " << packetsString.toLocal8Bit().constData() | |
| 2754 | − << " [Recent Max: " << maxString.toLocal8Bit().constData() << "]"; | |
| 2767 | + voxelStats << "Voxel Packets to Process: " << qPrintable(packetsString) | |
| 2768 | + << " [Recent Max: " << qPrintable(maxString) << "]"; | |
| 2755 | 2769 | verticalOffset += STATS_PELS_PER_LINE; |
| 2756 | 2770 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); |
| 2757 | 2771 | } |
| @@ -2774,7 +2788,7 @@ void Application::displayStats() { · 16 unmodified lines | ||
| 2774 | 2788 | |
| 2775 | 2789 | // Server Voxels |
| 2776 | 2790 | voxelStats.str(""); |
| 2777 | − voxelStats << "Server voxels: " << serversTotalString.toLocal8Bit().constData(); | |
| 2791 | + voxelStats << "Server voxels: " << qPrintable(serversTotalString); | |
| 2778 | 2792 | verticalOffset += STATS_PELS_PER_LINE; |
| 2779 | 2793 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); |
| 2780 | 2794 | |
| @@ -2784,8 +2798,8 @@ void Application::displayStats() { · 3 unmodified lines | ||
| 2784 | 2798 | |
| 2785 | 2799 | voxelStats.str(""); |
| 2786 | 2800 | voxelStats << |
| 2787 | − "Internal: " << serversInternalString.toLocal8Bit().constData() << " " << | |
| 2788 | − "Leaves: " << serversLeavesString.toLocal8Bit().constData() << ""; | |
| 2801 | + "Internal: " << qPrintable(serversInternalString) << " " << | |
| 2802 | + "Leaves: " << qPrintable(serversLeavesString) << ""; | |
| 2789 | 2803 | verticalOffset += STATS_PELS_PER_LINE; |
| 2790 | 2804 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); |
| 2791 | 2805 | } |
| @@ -2795,7 +2809,7 @@ void Application::displayStats() { · 3 unmodified lines | ||
| 2795 | 2809 | |
| 2796 | 2810 | // Local Voxels |
| 2797 | 2811 | voxelStats.str(""); |
| 2798 | − voxelStats << "Local voxels: " << localTotalString.toLocal8Bit().constData(); | |
| 2812 | + voxelStats << "Local voxels: " << qPrintable(localTotalString); | |
| 2799 | 2813 | verticalOffset += STATS_PELS_PER_LINE; |
| 2800 | 2814 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); |
| 2801 | 2815 | |
| @@ -2807,8 +2821,17 @@ void Application::displayStats() { · 5 unmodified lines | ||
| 2807 | 2821 | |
| 2808 | 2822 | voxelStats.str(""); |
| 2809 | 2823 | voxelStats << |
| 2810 | − "Internal: " << localInternalString.toLocal8Bit().constData() << " " << | |
| 2811 | − "Leaves: " << localLeavesString.toLocal8Bit().constData() << ""; | |
| 2824 | + "Internal: " << qPrintable(localInternalString) << " " << | |
| 2825 | + "Leaves: " << qPrintable(localLeavesString) << ""; | |
| 2826 | + verticalOffset += STATS_PELS_PER_LINE; | |
| 2827 | + drawText(horizontalOffset, verticalOffset, 0.10f, 0, 2, (char*)voxelStats.str().c_str(), WHITE_TEXT); | |
| 2828 | + } | |
| 2829 | + | |
| 2830 | + // LOD Details | |
| 2831 | + if (_statsExpanded) { | |
| 2832 | + voxelStats.str(""); | |
| 2833 | + QString displayLODDetails = Menu::getInstance()->getLODFeedbackText(); | |
| 2834 | + voxelStats << "LOD: You can see " << qPrintable(displayLODDetails.trimmed()); | |
| 2812 | 2835 | verticalOffset += STATS_PELS_PER_LINE; |
| 2813 | 2836 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); |
| 2814 | 2837 | } |