From Paul Martz, Introduced osg::OcclusionQueryNode with support for OpenGL occlusion query extension
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <osg/ClipNode>
|
||||
#include <osg/TexGenNode>
|
||||
#include <osg/OccluderNode>
|
||||
#include <osg/OcclusionQueryNode>
|
||||
#include <osg/Notify>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/AlphaFunc>
|
||||
@@ -1392,5 +1393,34 @@ void CullVisitor::apply(osg::OccluderNode& node)
|
||||
popOccludersCurrentMask(_nodePath);
|
||||
}
|
||||
|
||||
void CullVisitor::apply(osg::OcclusionQueryNode& node)
|
||||
{
|
||||
if (isCulled(node)) return;
|
||||
|
||||
// push the culling mode.
|
||||
pushCurrentMask();
|
||||
|
||||
// push the node's state.
|
||||
StateSet* node_state = node.getStateSet();
|
||||
if (node_state) pushStateSet(node_state);
|
||||
|
||||
|
||||
osg::Camera* camera = getRenderStage()->getCamera();
|
||||
// If previous query indicates visible, then traverse as usual.
|
||||
if (node.getPassed( camera, getDistanceToEyePoint( node.getBound()._center, false ) ))
|
||||
handle_cull_callbacks_and_traverse(node);
|
||||
|
||||
// Traverse the query subtree if OcclusionQueryNode needs to issue another query.
|
||||
node.traverseQuery( camera, *this );
|
||||
|
||||
// Traverse the debug bounding geometry, if enabled.
|
||||
node.traverseDebug( *this );
|
||||
|
||||
|
||||
// pop the node's state off the render graph stack.
|
||||
if (node_state) popStateSet();
|
||||
|
||||
// pop the culling mode.
|
||||
popCurrentMask();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user