diff --git a/include/osg/OcclusionQueryNode b/include/osg/OcclusionQueryNode index 2b68e4ce2..c776946df 100644 --- a/include/osg/OcclusionQueryNode +++ b/include/osg/OcclusionQueryNode @@ -125,6 +125,11 @@ public: void setQueryFrameCount( unsigned int frames ) { _queryFrameCount = frames; } unsigned int getQueryFrameCount() const { return _queryFrameCount; } + // Resets the queries. The next frame will issue a new query. + // This is useful for big view changes, if it shouldn't be waited for + // '_queryFrameCount' till the frame contents change. + void resetQueries(); + // Indicate whether or not the bounding box used in the occlusion query test // should be rendered. Handy for debugging and development. // Should only be called outside of cull/draw. No thread issues. diff --git a/src/osg/OcclusionQueryNode.cpp b/src/osg/OcclusionQueryNode.cpp index 4f9a2788c..34f011fdc 100644 --- a/src/osg/OcclusionQueryNode.cpp +++ b/src/osg/OcclusionQueryNode.cpp @@ -588,6 +588,12 @@ void OcclusionQueryNode::setQueriesEnabled( bool enable ) _enabled = enable; } +void OcclusionQueryNode::resetQueries() +{ + OpenThreads::ScopedLock lock( _frameCountMutex ); + _frameCountMap.clear(); +} + // Should only be called outside of cull/draw. No thread issues. void OcclusionQueryNode::setDebugDisplay( bool debug ) {