14#ifndef OSGUTIL_CULLVISITOR
15#define OSGUTIL_CULLVISITOR 1
137 _currentStateGraph = _currentStateGraph->find_or_insert(ss);
142 if (useRenderBinDetails)
144 _renderBinStack.push_back(_currentRenderBin);
153 ++_numberOfEncloseOverrideRenderBinDetails;
166 --_numberOfEncloseOverrideRenderBinDetails;
172 if (useRenderBinDetails)
174 if (_renderBinStack.empty())
176 _currentRenderBin = _currentRenderBin->getStage();
180 _currentRenderBin = _renderBinStack.back();
181 _renderBinStack.pop_back();
184 _currentStateGraph = _currentStateGraph->_parent;
189 _rootStateGraph = rg;
190 _currentStateGraph = rg;
195 return _rootStateGraph.get();
200 return _currentStateGraph;
205 _rootRenderStage = rg;
206 _currentRenderBin = rg;
211 return _rootRenderStage.get();
216 return _currentRenderBin->
getStage();
221 return getCurrentRenderStage()->getCamera();
226 return _currentRenderBin;
231 _currentRenderBin = rb;
286 if (_clampProjectionMatrixCallback.valid()) result = _clampProjectionMatrixCallback->clampProjectionMatrixImplementation(projection, zn, zf);
287 else result = clampProjectionMatrixImplementation(projection, zn, zf);
307 if (_clampProjectionMatrixCallback.valid()) result = _clampProjectionMatrixCallback->clampProjectionMatrixImplementation(projection, zn, zf);
308 else result = clampProjectionMatrixImplementation(projection, zn, zf);
339 if (callback) callback->
run(&node,
this);
346 if (callback) callback->
run(&node,
this);
347 else acceptNode->
accept(*
this);
384 _drawable = drawable;
385 if (!_planes.empty()) _planes.clear();
390 for(osg::Polytope::PlaneList::const_iterator itr=frustum.
getPlaneList().begin();
394 if (result_mask&selector_mask) _planes.push_back(*itr);
400 _matrix(mpd._matrix),
401 _drawable(mpd._drawable),
402 _planes(mpd._planes) {}
Definition CullVisitor:49
virtual void apply(osg::Camera &node)
void setStateGraph(StateGraph *rg)
Definition CullVisitor:187
RenderLeaf * createOrReuseRenderLeaf(osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *matrix, float depth=0.0f)
Definition CullVisitor:463
unsigned int _traversalOrderNumber
Definition CullVisitor:360
Identifier * getIdentifier()
Definition CullVisitor:99
osg::Camera * getCurrentCamera()
Definition CullVisitor:219
virtual void apply(osg::Projection &node)
RenderStage * getCurrentRenderStage()
Definition CullVisitor:214
value_type getCalculatedFarPlane() const
Definition CullVisitor:238
virtual void apply(osg::ClearNode &node)
virtual void apply(osg::Geode &node)
bool updateCalculatedNearFar(const osg::Matrix &matrix, const osg::Drawable &drawable, bool isBillboard=false)
value_type _computed_zfar
Definition CullVisitor:358
static CullVisitor * create()
value_type getCalculatedNearPlane() const
Definition CullVisitor:235
DistanceMatrixDrawableMap _nearPlaneCandidateMap
Definition CullVisitor:418
virtual const osgUtil::CullVisitor * asCullVisitor() const
Definition CullVisitor:68
osg::ref_ptr< StateGraph > _rootStateGraph
Definition CullVisitor:350
virtual bool clampProjectionMatrixImplementation(osg::Matrixf &projection, double &znear, double &zfar) const
virtual void apply(osg::ClipNode &node)
void addDrawable(osg::Drawable *drawable, osg::RefMatrix *matrix)
Definition CullVisitor:424
void setState(osg::State *state)
Definition CullVisitor:321
virtual void apply(osg::LightSource &node)
virtual void apply(osg::LOD &node)
unsigned int _numberOfEncloseOverrideRenderBinDetails
Definition CullVisitor:369
virtual void apply(osg::TexGenNode &node)
void setCalculatedNearPlane(value_type value)
Definition CullVisitor:234
static osg::ref_ptr< CullVisitor > & prototype()
const osg::RenderInfo & getRenderInfo() const
Definition CullVisitor:327
void handle_cull_callbacks_and_traverse(osg::Node &node)
Definition CullVisitor:336
void setRenderInfo(osg::RenderInfo &renderInfo)
Definition CullVisitor:325
osg::RenderInfo _renderInfo
Definition CullVisitor:371
const osg::State * getState() const
Definition CullVisitor:323
virtual void apply(osg::Transform &node)
void setIdentifier(Identifier *identifier)
Definition CullVisitor:98
const Identifier * getIdentifier() const
Definition CullVisitor:100
StateGraph * getCurrentStateGraph()
Definition CullVisitor:198
RenderLeafList _reuseRenderLeafList
Definition CullVisitor:364
void pushStateSet(const osg::StateSet *ss)
Definition CullVisitor:135
StateGraph * _currentStateGraph
Definition CullVisitor:351
virtual osg::CullStack * asCullStack()
Definition CullVisitor:72
value_type computeNearestPointInFrustum(const osg::Matrix &matrix, const osg::Polytope::PlaneList &planes, const osg::Drawable &drawable)
RenderStage * getRenderStage()
Definition CullVisitor:209
RenderBin * _currentRenderBin
Definition CullVisitor:354
StateGraph * getRootStateGraph()
Definition CullVisitor:193
void addDrawableAndDepth(osg::Drawable *drawable, osg::RefMatrix *matrix, float depth)
Definition CullVisitor:438
bool clampProjectionMatrix(osg::Matrixf &projection, value_type &znear, value_type &zfar) const
Definition CullVisitor:281
virtual osg::Vec3 getViewPoint() const
Definition CullVisitor:103
virtual void apply(osg::Drawable &drawable)
virtual void apply(osg::Billboard &node)
void setCurrentRenderBin(RenderBin *rb)
Definition CullVisitor:229
bool clampProjectionMatrix(osg::Matrixd &projection, value_type &znear, value_type &zfar) const
Definition CullVisitor:301
virtual void apply(osg::Group &node)
bool updateCalculatedNearFar(const osg::Matrix &matrix, const osg::BoundingBox &bb)
void updateCalculatedNearFar(const osg::Vec3 &pos)
virtual void apply(osg::OccluderNode &node)
virtual float getDistanceToEyePoint(const osg::Vec3 &pos, bool withLODScale) const
void setRenderStage(RenderStage *rg)
Definition CullVisitor:203
virtual bool clampProjectionMatrixImplementation(osg::Matrixd &projection, double &znear, double &zfar) const
virtual float getDistanceToViewPoint(const osg::Vec3 &pos, bool withLODScale) const
osg::State * getState()
Definition CullVisitor:322
virtual void apply(osg::OcclusionQueryNode &node)
virtual const osg::CullStack * asCullStack() const
Definition CullVisitor:76
osg::Matrix::value_type value_type
Definition CullVisitor:52
void popStateSet()
Definition CullVisitor:161
virtual osg::Vec3 getEyePoint() const
Definition CullVisitor:102
void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix *matrix, const osg::StateAttribute *attr)
Definition CullVisitor:458
value_type computeFurthestPointInFrustum(const osg::Matrix &matrix, const osg::Polytope::PlaneList &planes, const osg::Drawable &drawable)
unsigned int _currentReuseRenderLeafIndex
Definition CullVisitor:365
RenderBin * getCurrentRenderBin()
Definition CullVisitor:224
void handle_cull_callbacks_and_accept(osg::Node &node, osg::Node *acceptNode)
Definition CullVisitor:343
void addPositionedAttribute(osg::RefMatrix *matrix, const osg::StateAttribute *attr)
Definition CullVisitor:452
virtual CullVisitor * clone() const
Definition CullVisitor:82
CullVisitor(const CullVisitor &)
Copy constructor that does a shallow copy.
std::vector< osg::ref_ptr< RenderLeaf > > RenderLeafList
Definition CullVisitor:363
osg::ref_ptr< RenderStage > _rootRenderStage
Definition CullVisitor:353
virtual void popProjectionMatrix()
value_type _computed_znear
Definition CullVisitor:357
std::vector< RenderBin * > _renderBinStack
Definition CullVisitor:355
void setCalculatedFarPlane(value_type value)
Definition CullVisitor:237
DistanceMatrixDrawableMap _farPlaneCandidateMap
Definition CullVisitor:419
osg::ref_ptr< Identifier > _identifier
Definition CullVisitor:421
std::multimap< value_type, MatrixPlanesDrawables > DistanceMatrixDrawableMap
Definition CullVisitor:417
virtual void apply(osg::Node &)
META_NodeVisitor(osgUtil, CullVisitor) virtual osgUtil
Definition CullVisitor:60
virtual float getDistanceFromEyePoint(const osg::Vec3 &pos, bool withLODScale) const
virtual void apply(osg::Switch &node)
osg::RenderInfo & getRenderInfo()
Definition CullVisitor:326
RenderStage * getStage()
Definition RenderBin:87
void addStateGraph(StateGraph *rg)
Definition RenderBin:104
void set(osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *modelview, float depth=0.0f, unsigned int traversalOrderNumber=0)
Definition RenderLeaf:51
Definition RenderStage:38
virtual void addPositionedAttribute(osg::RefMatrix *matrix, const osg::StateAttribute *attr)
Definition RenderStage:210
virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix *matrix, const osg::StateAttribute *attr)
Definition RenderStage:215
bool leaves_empty() const
Definition StateGraph:122
void addLeaf(RenderLeaf *leaf)
Definition StateGraph:229
Definition BoundingBox:34
virtual bool run(osg::Object *object, osg::Object *data)
Definition Callback:80
MatrixStack _projectionStack
Definition CullStack:194
Definition LightSource:25
double value_type
Definition Matrixd:30
Definition NodeVisitor:82
Callback * getCullCallback()
Definition Node:293
virtual void accept(NodeVisitor &nv)
virtual Object * clone(const CopyOp &) const =0
Definition OccluderNode:27
Definition OcclusionQueryNode:110
ClippingMask getResultMask() const
Definition Polytope:178
PlaneList & getPlaneList()
Definition Polytope:150
unsigned int ClippingMask
Definition Polytope:30
std::vector< Plane > PlaneList
Definition Polytope:31
int referenceCount() const
Definition Referenced:97
Definition StateAttribute:77
bool getNestRenderBins() const
Definition StateSet:442
const std::string & getBinName() const
Definition StateSet:430
@ PROTECTED_RENDERBIN_DETAILS
Definition StateSet:401
@ OVERRIDE_RENDERBIN_DETAILS
Definition StateSet:400
bool useRenderBinDetails() const
Definition StateSet:412
int getBinNumber() const
Definition StateSet:424
RenderBinMode getRenderBinMode() const
Definition StateSet:418
T & back()
Definition fast_back_stack:54
T * get() const
Definition ref_ptr:117
Shader generator framework.
Definition NodeVisitor:25
@ INFO
Definition Notify:35
std::ostream & notify(void)
Definition Notify:80
#define OSGUTIL_EXPORT
Definition osgUtil/Export:40
Definition CullVisitor:93
virtual ~Identifier()
Definition CullVisitor:95
Identifier()
Definition CullVisitor:94
Definition CullVisitor:375
void set(const osg::Matrix &matrix, const osg::Drawable *drawable, const osg::Polytope &frustum)
Definition CullVisitor:381
osg::Polytope::PlaneList _planes
Definition CullVisitor:414
MatrixPlanesDrawables()
Definition CullVisitor:376
osg::Matrix _matrix
Definition CullVisitor:412
const osg::Drawable * _drawable
Definition CullVisitor:413
MatrixPlanesDrawables(const MatrixPlanesDrawables &mpd)
Definition CullVisitor:399