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 | _importSucceded(false), | 143 | _importSucceded(false), |
| 144 | _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard), | 144 | _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard), |
| 145 | _wantToKillLocalVoxels(false), | 145 | _wantToKillLocalVoxels(false), |
| 146 | _viewFrustum(), | ||
| 147 | _lastQueriedViewFrustum(), | ||
| 148 | _lastQueriedTime(usecTimestampNow()), | ||
| 146 | _audioScope(256, 200, true), | 149 | _audioScope(256, 200, true), |
| 147 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), | 150 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), |
| 148 | _mouseX(0), | 151 | _mouseX(0), |
| @@ -1900,8 +1903,19 @@ void Application::updateMyAvatar(float deltaTime) { · 1751 unmodified lines | |||
| 1900 | loadViewFrustum(_myCamera, _viewFrustum); | 1903 | loadViewFrustum(_myCamera, _viewFrustum); |
| 1901 | 1904 | ||
| 1902 | // Update my voxel servers with my current voxel query... | 1905 | // Update my voxel servers with my current voxel query... |
| 1903 | queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); | 1906 | quint64 now = usecTimestampNow(); |
| 1904 | queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); | 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 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { | 1921 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { |
| @@ -2750,8 +2764,8 @@ void Application::displayStats() { · 842 unmodified lines | |||
| 2750 | voxelStats.str(""); | 2764 | voxelStats.str(""); |
| 2751 | QString packetsString = locale.toString((int)voxelPacketsToProcess); | 2765 | QString packetsString = locale.toString((int)voxelPacketsToProcess); |
| 2752 | QString maxString = locale.toString((int)_recentMaxPackets); | 2766 | QString maxString = locale.toString((int)_recentMaxPackets); |
| 2753 | voxelStats << "Voxel Packets to Process: " << packetsString.toLocal8Bit().constData() | 2767 | voxelStats << "Voxel Packets to Process: " << qPrintable(packetsString) |
| 2754 | << " [Recent Max: " << maxString.toLocal8Bit().constData() << "]"; | 2768 | << " [Recent Max: " << qPrintable(maxString) << "]"; |
| 2755 | verticalOffset += STATS_PELS_PER_LINE; | 2769 | verticalOffset += STATS_PELS_PER_LINE; |
| 2756 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); | 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 | // Server Voxels | 2789 | // Server Voxels |
| 2776 | voxelStats.str(""); | 2790 | voxelStats.str(""); |
| 2777 | voxelStats << "Server voxels: " << serversTotalString.toLocal8Bit().constData(); | 2791 | voxelStats << "Server voxels: " << qPrintable(serversTotalString); |
| 2778 | verticalOffset += STATS_PELS_PER_LINE; | 2792 | verticalOffset += STATS_PELS_PER_LINE; |
| 2779 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); | 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 | voxelStats.str(""); | 2799 | voxelStats.str(""); |
| 2786 | voxelStats << | 2800 | voxelStats << |
| 2787 | "Internal: " << serversInternalString.toLocal8Bit().constData() << " " << | 2801 | "Internal: " << qPrintable(serversInternalString) << " " << |
| 2788 | "Leaves: " << serversLeavesString.toLocal8Bit().constData() << ""; | 2802 | "Leaves: " << qPrintable(serversLeavesString) << ""; |
| 2789 | verticalOffset += STATS_PELS_PER_LINE; | 2803 | verticalOffset += STATS_PELS_PER_LINE; |
| 2790 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); | 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 | // Local Voxels | 2810 | // Local Voxels |
| 2797 | voxelStats.str(""); | 2811 | voxelStats.str(""); |
| 2798 | voxelStats << "Local voxels: " << localTotalString.toLocal8Bit().constData(); | 2812 | voxelStats << "Local voxels: " << qPrintable(localTotalString); |
| 2799 | verticalOffset += STATS_PELS_PER_LINE; | 2813 | verticalOffset += STATS_PELS_PER_LINE; |
| 2800 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); | 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 | voxelStats.str(""); | 2822 | voxelStats.str(""); |
| 2809 | voxelStats << | 2823 | voxelStats << |
| 2810 | "Internal: " << localInternalString.toLocal8Bit().constData() << " " << | 2824 | "Internal: " << qPrintable(localInternalString) << " " << |
| 2811 | "Leaves: " << localLeavesString.toLocal8Bit().constData() << ""; | 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 | verticalOffset += STATS_PELS_PER_LINE; | 2835 | verticalOffset += STATS_PELS_PER_LINE; |
| 2813 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); | 2836 | drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT); |
| 2814 | } | 2837 | } |