#include #include #include #include #include #include using namespace osg; CollectOccludersVisitor::CollectOccludersVisitor() { // overide the default node visitor mode. setTraversalMode(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); _createDrawables = false; } CollectOccludersVisitor::~CollectOccludersVisitor() { } void CollectOccludersVisitor::reset() { CullStack::reset(); } void CollectOccludersVisitor::apply(osg::Node& node) { if (isCulled(node)) return; // push the culling mode. pushCurrentMask(); handle_cull_callbacks_and_traverse(node); // pop the culling mode. popCurrentMask(); } void CollectOccludersVisitor::apply(osg::Transform& node) { if (isCulled(node)) return; // push the culling mode. pushCurrentMask(); ref_ptr matrix = createOrReuseMatrix(getModelViewMatrix()); node.getLocalToWorldMatrix(*matrix,this); pushModelViewMatrix(matrix.get()); handle_cull_callbacks_and_traverse(node); popModelViewMatrix(); // pop the culling mode. popCurrentMask(); } void CollectOccludersVisitor::apply(osg::Projection& node) { if (isCulled(node)) return; // push the culling mode. pushCurrentMask(); ref_ptr matrix = createOrReuseMatrix(node.getMatrix()); pushProjectionMatrix(matrix.get()); handle_cull_callbacks_and_traverse(node); popProjectionMatrix(); // pop the culling mode. popCurrentMask(); } void CollectOccludersVisitor::apply(osg::Switch& node) { apply((Group&)node); } void CollectOccludersVisitor::apply(osg::LOD& node) { if (isCulled(node)) return; int eval = node.evaluate(getEyeLocal(),_LODBias); if (eval<0) return; // push the culling mode. pushCurrentMask(); //notify(INFO) << "selecting child "<