#include <osg/StateSet>
#include <osg/Texture2D>
-#include <osg/LOD>
#include "EffectCullVisitor.hxx"
using osgUtil::CullVisitor;
-EffectCullVisitor::EffectCullVisitor() :
- _ignoreLOD(false),
- _collectLights(false)
-{
-}
-
-EffectCullVisitor::EffectCullVisitor(bool ignoreLOD, bool collectLights) :
- _ignoreLOD(ignoreLOD),
+EffectCullVisitor::EffectCullVisitor(bool collectLights) :
_collectLights(collectLights)
{
}
EffectCullVisitor::EffectCullVisitor(const EffectCullVisitor& rhs) :
osg::Referenced(rhs),
- CullVisitor(rhs),
- _ignoreLOD(rhs._ignoreLOD),
- _collectLights(rhs._collectLights)
+ CullVisitor(rhs)
{
}
return new EffectCullVisitor(*this);
}
-void EffectCullVisitor::apply(osg::LOD& node)
-{
- if (_ignoreLOD) {
- if (isCulled(node)) return;
-
- // push the culling mode.
- pushCurrentMask();
-
- // push the node's state.
- osg::StateSet* node_state = node.getStateSet();
- if (node_state) pushStateSet(node_state);
-
- if (_traversalMode==TRAVERSE_PARENTS) node.osg::Group::ascend(*this);
- else if (_traversalMode!=TRAVERSE_NONE) node.osg::Group::traverse(*this);
- // pop the node's state off the render graph stack.
- if (node_state) popStateSet();
-
- // pop the culling mode.
- popCurrentMask();
- }
- else
- CullVisitor::apply(node);
-}
-
void EffectCullVisitor::apply(osg::Geode& node)
{
if (isCulled(node))
class EffectCullVisitor : public osgUtil::CullVisitor
{
public:
- EffectCullVisitor();
- EffectCullVisitor(bool ignoreLOD, bool collectLights = false);
+ EffectCullVisitor(bool collectLights = false);
EffectCullVisitor(const EffectCullVisitor&);
virtual osgUtil::CullVisitor* clone() const;
using osgUtil::CullVisitor::apply;
- virtual void apply(osg::LOD& node);
virtual void apply(osg::Geode& node);
virtual void reset();
private:
std::map<int,osg::ref_ptr<osg::Texture2D> > _bufferList;
std::vector<osg::ref_ptr<EffectGeode> > _lightList;
- bool _ignoreLOD;
bool _collectLights;
};
}