Disable LOD when rendering to the shadow map.
Produce few NaNs at start
This commit is contained in:
parent
29462005b7
commit
b95fb48a16
@ -20,6 +20,7 @@
|
||||
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/LOD>
|
||||
|
||||
#include "EffectCullVisitor.hxx"
|
||||
|
||||
@ -34,14 +35,23 @@ namespace simgear
|
||||
|
||||
using osgUtil::CullVisitor;
|
||||
|
||||
EffectCullVisitor::EffectCullVisitor(bool collectLights) :
|
||||
EffectCullVisitor::EffectCullVisitor() :
|
||||
_ignoreLOD(false),
|
||||
_collectLights(false)
|
||||
{
|
||||
}
|
||||
|
||||
EffectCullVisitor::EffectCullVisitor(bool ignoreLOD, bool collectLights) :
|
||||
_ignoreLOD(ignoreLOD),
|
||||
_collectLights(collectLights)
|
||||
{
|
||||
}
|
||||
|
||||
EffectCullVisitor::EffectCullVisitor(const EffectCullVisitor& rhs) :
|
||||
osg::Referenced(rhs),
|
||||
CullVisitor(rhs)
|
||||
CullVisitor(rhs),
|
||||
_ignoreLOD(rhs._ignoreLOD),
|
||||
_collectLights(rhs._collectLights)
|
||||
{
|
||||
}
|
||||
|
||||
@ -50,6 +60,30 @@ CullVisitor* EffectCullVisitor::clone() const
|
||||
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))
|
||||
|
@ -33,10 +33,12 @@ class EffectGeode;
|
||||
class EffectCullVisitor : public osgUtil::CullVisitor
|
||||
{
|
||||
public:
|
||||
EffectCullVisitor(bool collectLights = false);
|
||||
EffectCullVisitor();
|
||||
EffectCullVisitor(bool ignoreLOD, 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();
|
||||
|
||||
@ -47,6 +49,7 @@ public:
|
||||
private:
|
||||
std::map<int,osg::ref_ptr<osg::Texture2D> > _bufferList;
|
||||
std::vector<osg::ref_ptr<EffectGeode> > _lightList;
|
||||
bool _ignoreLOD;
|
||||
bool _collectLights;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user