History

Merge branch 'master' of https://github.com/highfidelity/hifi into editVoxels

Atlante45 committed 12 years ago

Commit 424afaa2 parents 728a5f6 5ab97d028 files · +361 −181Browse files

Showing the changes to interface/src/Application.cpp (1 of 28 files). Show all

Unified · Split

interface/src/Application.cpp+33−10
@@ -143,6 +143,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 142 unmodified lines
143143 _importSucceded(false),
144144 _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard),
145145 _wantToKillLocalVoxels(false),
146+ _viewFrustum(),
147+ _lastQueriedViewFrustum(),
148+ _lastQueriedTime(usecTimestampNow()),
146149 _audioScope(256, 200, true),
147150 _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
148151 _mouseX(0),
@@ -1900,8 +1903,19 @@ void Application::updateMyAvatar(float deltaTime) { · 1751 unmodified lines
19001903 loadViewFrustum(_myCamera, _viewFrustum);
19011904
19021905 // 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+ }
19051919 }
19061920
19071921 void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
@@ -2750,8 +2764,8 @@ void Application::displayStats() { · 842 unmodified lines
27502764 voxelStats.str("");
27512765 QString packetsString = locale.toString((int)voxelPacketsToProcess);
27522766 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) << "]";
27552769 verticalOffset += STATS_PELS_PER_LINE;
27562770 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27572771 }
@@ -2774,7 +2788,7 @@ void Application::displayStats() { · 16 unmodified lines
27742788
27752789 // Server Voxels
27762790 voxelStats.str("");
2777− voxelStats << "Server voxels: " << serversTotalString.toLocal8Bit().constData();
2791+ voxelStats << "Server voxels: " << qPrintable(serversTotalString);
27782792 verticalOffset += STATS_PELS_PER_LINE;
27792793 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27802794
@@ -2784,8 +2798,8 @@ void Application::displayStats() { · 3 unmodified lines
27842798
27852799 voxelStats.str("");
27862800 voxelStats <<
2787− "Internal: " << serversInternalString.toLocal8Bit().constData() << " " <<
2788− "Leaves: " << serversLeavesString.toLocal8Bit().constData() << "";
2801+ "Internal: " << qPrintable(serversInternalString) << " " <<
2802+ "Leaves: " << qPrintable(serversLeavesString) << "";
27892803 verticalOffset += STATS_PELS_PER_LINE;
27902804 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
27912805 }
@@ -2795,7 +2809,7 @@ void Application::displayStats() { · 3 unmodified lines
27952809
27962810 // Local Voxels
27972811 voxelStats.str("");
2798− voxelStats << "Local voxels: " << localTotalString.toLocal8Bit().constData();
2812+ voxelStats << "Local voxels: " << qPrintable(localTotalString);
27992813 verticalOffset += STATS_PELS_PER_LINE;
28002814 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28012815
@@ -2807,8 +2821,17 @@ void Application::displayStats() { · 5 unmodified lines
28072821
28082822 voxelStats.str("");
28092823 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());
28122835 verticalOffset += STATS_PELS_PER_LINE;
28132836 drawText(horizontalOffset, verticalOffset, 0.10f, 0.f, 2.f, (char*)voxelStats.str().c_str(), WHITE_TEXT);
28142837 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t