Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -141,6 +141,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 140 unmodified lines | |||
| 141 | _justStarted(true), | 141 | _justStarted(true), |
| 142 | _voxelImporter(NULL), | 142 | _voxelImporter(NULL), |
| 143 | _wantToKillLocalVoxels(false), | 143 | _wantToKillLocalVoxels(false), |
| 144 | _viewFrustum(), | ||
| 145 | _lastQueriedViewFrustum(), | ||
| 146 | _lastQueriedTime(usecTimestampNow()), | ||
| 144 | _audioScope(256, 200, true), | 147 | _audioScope(256, 200, true), |
| 145 | _myAvatar(), | 148 | _myAvatar(), |
| 146 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), | 149 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), |
| @@ -1917,8 +1920,19 @@ void Application::updateMyAvatar(float deltaTime) { · 1770 unmodified lines | |||
| 1917 | loadViewFrustum(_myCamera, _viewFrustum); | 1920 | loadViewFrustum(_myCamera, _viewFrustum); |
| 1918 | 1921 | ||
| 1919 | // Update my voxel servers with my current voxel query... | 1922 | // Update my voxel servers with my current voxel query... |
| 1920 | queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); | 1923 | quint64 now = usecTimestampNow(); |
| 1921 | queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); | 1924 | const quint64 TOO_LONG_SINCE_LAST_QUERY = 1 * USECS_PER_SECOND; |
| 1925 | |||
| 1926 | // if we haven't waited long enough and the frustum is similar enough, then surpress this query... | ||
| 1927 | if ((now - _lastQueriedTime) > TOO_LONG_SINCE_LAST_QUERY || !_lastQueriedViewFrustum.isVerySimilar(_viewFrustum)) { | ||
| 1928 | _lastQueriedTime = now; | ||
| 1929 | queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); | ||
| 1930 | queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); | ||
| 1931 | _lastQueriedViewFrustum = _viewFrustum; | ||
| 1932 | //qDebug() << ">>>>>>>>>> SENDING query..."; | ||
| 1933 | } else { | ||
| 1934 | //qDebug() << "suppress query..."; | ||
| 1935 | } | ||
| 1922 | } | 1936 | } |
| 1923 | 1937 | ||
| 1924 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { | 1938 | void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { |