From 4d0b762de3fb5f2a0436ee6c73cc71576c4e60bc Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 11 Mar 2014 20:33:53 -0700 Subject: [PATCH] some hacking on full scene debuggin --- .../src/octree/OctreeSendThread.cpp | 18 ++++++++++++++++-- interface/src/Application.cpp | 18 ++++++++++++++++-- interface/src/Application.h | 2 ++ libraries/octree/src/OctreeSceneStats.cpp | 3 +++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index 751583960e..7a46fa3722 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -366,8 +366,20 @@ int OctreeSendThread::packetDistributor(const SharedNodePointer& node, OctreeQue } // start tracking our stats - bool isFullScene = ((!viewFrustumChanged || !nodeData->getWantDelta()) - && nodeData->getViewFrustumJustStoppedChanging()) || nodeData->hasLodChanged(); + qDebug() << "----"; + qDebug() << "viewFrustumChanged=" << viewFrustumChanged; + qDebug() << "nodeData->getWantDelta()=" << nodeData->getWantDelta(); + qDebug() << "nodeData->getViewFrustumJustStoppedChanging()=" << nodeData->getViewFrustumJustStoppedChanging(); + qDebug() << "nodeData->hasLodChanged()=" << nodeData->hasLodChanged(); + + + bool isFullScene = ( + (!viewFrustumChanged || !nodeData->getWantDelta()) + && nodeData->getViewFrustumJustStoppedChanging() + ) + || nodeData->hasLodChanged(); + + qDebug() << "isFullScene=" << isFullScene; // If we're starting a full scene, then definitely we want to empty the nodeBag if (isFullScene) { @@ -436,6 +448,8 @@ int OctreeSendThread::packetDistributor(const SharedNodePointer& node, OctreeQue bool isFullScene = ((!viewFrustumChanged || !nodeData->getWantDelta()) && nodeData->getViewFrustumJustStoppedChanging()) || nodeData->hasLodChanged(); + qDebug() << "SECOND CALC.... isFullScene=" << isFullScene; + EncodeBitstreamParams params(INT_MAX, &nodeData->getCurrentViewFrustum(), wantColor, WANT_EXISTS_BITS, DONT_CHOP, wantDelta, lastViewFrustum, wantOcclusionCulling, coverageMap, boundaryLevelAdjust, voxelSizeScale, diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 032e849f0a..f6cdfaa509 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -141,6 +141,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _justStarted(true), _voxelImporter(NULL), _wantToKillLocalVoxels(false), + _viewFrustum(), + _lastQueriedViewFrustum(), + _lastQueriedTime(usecTimestampNow()), _audioScope(256, 200, true), _myAvatar(), _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) { loadViewFrustum(_myCamera, _viewFrustum); // Update my voxel servers with my current voxel query... - queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); - queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); + quint64 now = usecTimestampNow(); + const quint64 TOO_LONG_SINCE_LAST_QUERY = 1 * USECS_PER_SECOND; + + // if we haven't waited long enough and the frustum is similar enough, then surpress this query... + if ((now - _lastQueriedTime) > TOO_LONG_SINCE_LAST_QUERY || !_lastQueriedViewFrustum.isVerySimilar(_viewFrustum)) { + _lastQueriedTime = now; + queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); + queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); + _lastQueriedViewFrustum = _viewFrustum; + //qDebug() << ">>>>>>>>>> SENDING query..."; + } else { + //qDebug() << "suppress query..."; + } } void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 234f264447..f56bb62d9f 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -377,6 +377,8 @@ private: MetavoxelSystem _metavoxels; ViewFrustum _viewFrustum; // current state of view frustum, perspective, orientation, etc. + ViewFrustum _lastQueriedViewFrustum; /// last view frustum used to query octree servers (voxels, particles) + quint64 _lastQueriedTime; Oscilloscope _audioScope; diff --git a/libraries/octree/src/OctreeSceneStats.cpp b/libraries/octree/src/OctreeSceneStats.cpp index ad7f774377..ec073c6ce5 100644 --- a/libraries/octree/src/OctreeSceneStats.cpp +++ b/libraries/octree/src/OctreeSceneStats.cpp @@ -167,6 +167,9 @@ void OctreeSceneStats::sceneStarted(bool isFullScene, bool isMoving, OctreeEleme _totalInternal = OctreeElement::getInternalNodeCount(); _totalLeaves = OctreeElement::getLeafNodeCount(); + if (isFullScene) { + qDebug() << "OctreeSceneStats::sceneStarted()... IS FULL SCENE"; + } _isFullScene = isFullScene; _isMoving = isMoving;