osgUtil::CullVisitor Class Reference

Basic NodeVisitor implementation for rendering a scene. More...

Inheritance diagram for osgUtil::CullVisitor:

Inheritance graph
[legend]

List of all members.

Public Types

typedef
osg::Matrix::value_type 
value_type

Public Member Functions

 CullVisitor ()
 CullVisitor (const CullVisitor &)
 Copy constructor that does a shallow copy.
virtual CullVisitorclone () const
 Create a shallow copy of the CullVisitor, used by CullVisitor::create() to clone the prototype.
virtual void reset ()
virtual osg::Vec3 getEyePoint () const
 Get the eye point in local coordinates.
virtual osg::Vec3 getViewPoint () const
 Get the view point in local coordinates.
virtual float getDistanceToEyePoint (const osg::Vec3 &pos, bool withLODScale) const
 Get the distance from a point to the eye point, distance value in local coordinate system.
virtual float getDistanceFromEyePoint (const osg::Vec3 &pos, bool withLODScale) const
 Get the distance of a point from the eye point, distance value in the eye coordinate system.
virtual float getDistanceToViewPoint (const osg::Vec3 &pos, bool withLODScale) const
 Get the distance from a point to the view point, distance value in local coordinate system.
virtual void apply (osg::Node &)
virtual void apply (osg::Geode &node)
virtual void apply (osg::Billboard &node)
virtual void apply (osg::LightSource &node)
virtual void apply (osg::ClipNode &node)
virtual void apply (osg::TexGenNode &node)
virtual void apply (osg::Group &node)
virtual void apply (osg::Transform &node)
virtual void apply (osg::Projection &node)
virtual void apply (osg::Switch &node)
virtual void apply (osg::LOD &node)
virtual void apply (osg::ClearNode &node)
virtual void apply (osg::Camera &node)
virtual void apply (osg::OccluderNode &node)
void setClearNode (const osg::ClearNode *earthSky)
const osg::ClearNodegetClearNode () const
void pushStateSet (const osg::StateSet *ss)
 Push state set on the current state group.
void popStateSet ()
 Pop the top state set and hence associated state group.
void setStateGraph (StateGraph *rg)
StateGraphgetRootStateGraph ()
StateGraphgetCurrentStateGraph ()
void setRenderStage (RenderStage *rg)
RenderStagegetRenderStage ()
RenderBingetCurrentRenderBin ()
void setCurrentRenderBin (RenderBin *rb)
value_type getCalculatedNearPlane () const
value_type getCalculatedFarPlane () const
value_type computeNearestPointInFrustum (const osg::Matrix &matrix, const osg::Polytope::PlaneList &planes, const osg::Drawable &drawable)
bool updateCalculatedNearFar (const osg::Matrix &matrix, const osg::BoundingBox &bb)
bool updateCalculatedNearFar (const osg::Matrix &matrix, const osg::Drawable &drawable, bool isBillboard=false)
void updateCalculatedNearFar (const osg::Vec3 &pos)
void addDrawable (osg::Drawable *drawable, osg::RefMatrix *matrix)
 Add a drawable to current render graph.
void addDrawableAndDepth (osg::Drawable *drawable, osg::RefMatrix *matrix, float depth)
 Add a drawable and depth to current render graph.
void addPositionedAttribute (osg::RefMatrix *matrix, const osg::StateAttribute *attr)
 Add an attribute which is positioned relative to the modelview matrix.
void addPositionedTextureAttribute (unsigned int textureUnit, osg::RefMatrix *matrix, const osg::StateAttribute *attr)
 Add an attribute which is positioned relative to the modelview matrix.
void computeNearPlane ()
 compute near plane based on the polgon intersection of primtives in near plane candidate list of drawables.
virtual void popProjectionMatrix ()
 Re-implement CullStack's popProjectionMatrix() adding clamping of the projection matrix to the computed near and far.
virtual bool clampProjectionMatrixImplementation (osg::Matrixf &projection, double &znear, double &zfar) const
 CullVisitor's default clamping of the projection float matrix to computed near and far values.
virtual bool clampProjectionMatrixImplementation (osg::Matrixd &projection, double &znear, double &zfar) const
 CullVisitor's default clamping of the projection double matrix to computed near and far values.
bool clampProjectionMatrix (osg::Matrixf &projection, value_type &znear, value_type &zfar) const
 Clamp the projection float matrix to computed near and far values, use callback if it exists, otherwise use default CullVisitor implementation.
bool clampProjectionMatrix (osg::Matrixd &projection, value_type &znear, value_type &zfar) const
 Clamp the projection double matrix to computed near and far values, use callback if it exists, otherwise use default CullVisitor implementation.
void setState (osg::State *state)
osg::StategetState ()
const osg::StategetState () const
void setRenderInfo (osg::RenderInfo &renderInfo)
osg::RenderInfogetRenderInfo ()
const osg::RenderInfogetRenderInfo () const

Static Public Member Functions

static osg::ref_ptr
< CullVisitor > & 
prototype ()
 get the prototype singleton used by CullVisitor::create().
static CullVisitorcreate ()
 create a CullVisitor by cloning CullVisitor::prototype().

Protected Types

typedef std::vector
< osg::ref_ptr
< RenderLeaf > > 
RenderLeafList
typedef
std::multimap
< value_type,
MatrixPlanesDrawables
DistanceMatrixDrawableMap

Protected Member Functions

virtual ~CullVisitor ()
CullVisitoroperator= (const CullVisitor &)
 Prevent unwanted copy operator.
void handle_cull_callbacks_and_traverse (osg::Node &node)
void handle_cull_callbacks_and_accept (osg::Node &node, osg::Node *acceptNode)
RenderLeafcreateOrReuseRenderLeaf (osg::Drawable *drawable, osg::RefMatrix *projection, osg::RefMatrix *matrix, float depth=0.0f)

Protected Attributes

osg::ref_ptr< const
osg::ClearNode
_clearNode
osg::ref_ptr
< StateGraph
_rootStateGraph
StateGraph_currentStateGraph
osg::ref_ptr
< RenderStage
_rootRenderStage
RenderBin_currentRenderBin
value_type _computed_znear
value_type _computed_zfar
RenderLeafList _reuseRenderLeafList
unsigned int _currentReuseRenderLeafIndex
unsigned int _numberOfEncloseOverrideRenderBinDetails
osg::RenderInfo _renderInfo
DistanceMatrixDrawableMap _nearPlaneCandidateMap

Classes

struct  MatrixPlanesDrawables


Detailed Description

Basic NodeVisitor implementation for rendering a scene.

This visitor traverses the scene graph, collecting transparent and opaque osg::Drawables into a depth sorted transparent bin and a state sorted opaque bin. The opaque bin is rendered first, and then the transparent bin is rendered in order from the furthest osg::Drawable from the eye to the one nearest the eye.


Member Typedef Documentation

typedef osg::Matrix::value_type osgUtil::CullVisitor::value_type

typedef std::vector< osg::ref_ptr<RenderLeaf> > osgUtil::CullVisitor::RenderLeafList [protected]

typedef std::multimap<value_type, MatrixPlanesDrawables> osgUtil::CullVisitor::DistanceMatrixDrawableMap [protected]


Constructor & Destructor Documentation

osgUtil::CullVisitor::CullVisitor (  ) 

osgUtil::CullVisitor::CullVisitor ( const CullVisitor  ) 

Copy constructor that does a shallow copy.

virtual osgUtil::CullVisitor::~CullVisitor (  )  [protected, virtual]


Member Function Documentation

virtual CullVisitor* osgUtil::CullVisitor::clone (  )  const [inline, virtual]

Create a shallow copy of the CullVisitor, used by CullVisitor::create() to clone the prototype.

static osg::ref_ptr<CullVisitor>& osgUtil::CullVisitor::prototype (  )  [static]

get the prototype singleton used by CullVisitor::create().

static CullVisitor* osgUtil::CullVisitor::create (  )  [static]

create a CullVisitor by cloning CullVisitor::prototype().

virtual void osgUtil::CullVisitor::reset (  )  [virtual]

Reimplemented from osg::CullStack.

virtual osg::Vec3 osgUtil::CullVisitor::getEyePoint (  )  const [inline, virtual]

Get the eye point in local coordinates.

Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.

Reimplemented from osg::NodeVisitor.

virtual osg::Vec3 osgUtil::CullVisitor::getViewPoint (  )  const [inline, virtual]

Get the view point in local coordinates.

Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.

Reimplemented from osg::NodeVisitor.

virtual float osgUtil::CullVisitor::getDistanceToEyePoint ( const osg::Vec3 ,
bool   
) const [virtual]

Get the distance from a point to the eye point, distance value in local coordinate system.

Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. If the getDistanceFromEyePoint(pos) is not implemented then a default value of 0.0 is returned.

Reimplemented from osg::NodeVisitor.

virtual float osgUtil::CullVisitor::getDistanceFromEyePoint ( const osg::Vec3 ,
bool   
) const [virtual]

Get the distance of a point from the eye point, distance value in the eye coordinate system.

Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. If the getDistanceFromEyePoint(pos) is not implemented than a default value of 0.0 is returned.

Reimplemented from osg::NodeVisitor.

virtual float osgUtil::CullVisitor::getDistanceToViewPoint ( const osg::Vec3 ,
bool   
) const [virtual]

Get the distance from a point to the view point, distance value in local coordinate system.

Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. If the getDistanceToViewPoint(pos) is not implemented then a default value of 0.0 is returned.

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Geode node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Billboard node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::LightSource node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::ClipNode node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::TexGenNode node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Group node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Transform node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Projection node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Switch node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::LOD node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::ClearNode node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::Camera node  )  [virtual]

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply ( osg::OccluderNode node  )  [virtual]

Reimplemented from osg::NodeVisitor.

void osgUtil::CullVisitor::setClearNode ( const osg::ClearNode earthSky  )  [inline]

const osg::ClearNode* osgUtil::CullVisitor::getClearNode (  )  const [inline]

void osgUtil::CullVisitor::pushStateSet ( const osg::StateSet ss  )  [inline]

Push state set on the current state group.

If the state exists in a child state group of the current state group then move the current state group to that child. Otherwise, create a new state group for the state set, add it to the current state group then move the current state group pointer to the new state group.

void osgUtil::CullVisitor::popStateSet (  )  [inline]

Pop the top state set and hence associated state group.

Move the current state group to the parent of the popped state group.

void osgUtil::CullVisitor::setStateGraph ( StateGraph rg  )  [inline]

StateGraph* osgUtil::CullVisitor::getRootStateGraph (  )  [inline]

StateGraph* osgUtil::CullVisitor::getCurrentStateGraph (  )  [inline]

void osgUtil::CullVisitor::setRenderStage ( RenderStage rg  )  [inline]

RenderStage* osgUtil::CullVisitor::getRenderStage (  )  [inline]

RenderBin* osgUtil::CullVisitor::getCurrentRenderBin (  )  [inline]

void osgUtil::CullVisitor::setCurrentRenderBin ( RenderBin rb  )  [inline]

value_type osgUtil::CullVisitor::getCalculatedNearPlane (  )  const [inline]

value_type osgUtil::CullVisitor::getCalculatedFarPlane (  )  const [inline]

value_type osgUtil::CullVisitor::computeNearestPointInFrustum ( const osg::Matrix matrix,
const osg::Polytope::PlaneList planes,
const osg::Drawable drawable 
)

bool osgUtil::CullVisitor::updateCalculatedNearFar ( const osg::Matrix matrix,
const osg::BoundingBox bb 
)

bool osgUtil::CullVisitor::updateCalculatedNearFar ( const osg::Matrix matrix,
const osg::Drawable drawable,
bool  isBillboard = false 
)

void osgUtil::CullVisitor::updateCalculatedNearFar ( const osg::Vec3 pos  ) 

void osgUtil::CullVisitor::addDrawable ( osg::Drawable drawable,
osg::RefMatrix matrix 
) [inline]

Add a drawable to current render graph.

void osgUtil::CullVisitor::addDrawableAndDepth ( osg::Drawable drawable,
osg::RefMatrix matrix,
float  depth 
) [inline]

Add a drawable and depth to current render graph.

void osgUtil::CullVisitor::addPositionedAttribute ( osg::RefMatrix matrix,
const osg::StateAttribute attr 
) [inline]

Add an attribute which is positioned relative to the modelview matrix.

void osgUtil::CullVisitor::addPositionedTextureAttribute ( unsigned int  textureUnit,
osg::RefMatrix matrix,
const osg::StateAttribute attr 
) [inline]

Add an attribute which is positioned relative to the modelview matrix.

void osgUtil::CullVisitor::computeNearPlane (  ) 

compute near plane based on the polgon intersection of primtives in near plane candidate list of drawables.

Note, you have to set ComputeNearFarMode to COMPUTE_NEAR_FAR_USING_PRIMITIVES to be able to near plane candidate drawables to be recorded by the cull traversal.

virtual void osgUtil::CullVisitor::popProjectionMatrix (  )  [virtual]

Re-implement CullStack's popProjectionMatrix() adding clamping of the projection matrix to the computed near and far.

Reimplemented from osg::CullStack.

virtual bool osgUtil::CullVisitor::clampProjectionMatrixImplementation ( osg::Matrixf projection,
double &  znear,
double &  zfar 
) const [virtual]

CullVisitor's default clamping of the projection float matrix to computed near and far values.

Note, do not call this method directly, use clampProjectionMatrix(..) instead, unless you want to bypass the callback.

virtual bool osgUtil::CullVisitor::clampProjectionMatrixImplementation ( osg::Matrixd projection,
double &  znear,
double &  zfar 
) const [virtual]

CullVisitor's default clamping of the projection double matrix to computed near and far values.

Note, do not call this method directly, use clampProjectionMatrix(..) instead, unless you want to bypass the callback.

bool osgUtil::CullVisitor::clampProjectionMatrix ( osg::Matrixf projection,
value_type znear,
value_type zfar 
) const [inline]

Clamp the projection float matrix to computed near and far values, use callback if it exists, otherwise use default CullVisitor implementation.

bool osgUtil::CullVisitor::clampProjectionMatrix ( osg::Matrixd projection,
value_type znear,
value_type zfar 
) const [inline]

Clamp the projection double matrix to computed near and far values, use callback if it exists, otherwise use default CullVisitor implementation.

void osgUtil::CullVisitor::setState ( osg::State state  )  [inline]

osg::State* osgUtil::CullVisitor::getState (  )  [inline]

const osg::State* osgUtil::CullVisitor::getState (  )  const [inline]

void osgUtil::CullVisitor::setRenderInfo ( osg::RenderInfo renderInfo  )  [inline]

osg::RenderInfo& osgUtil::CullVisitor::getRenderInfo (  )  [inline]

const osg::RenderInfo& osgUtil::CullVisitor::getRenderInfo (  )  const [inline]

CullVisitor& osgUtil::CullVisitor::operator= ( const CullVisitor  )  [inline, protected]

Prevent unwanted copy operator.

void osgUtil::CullVisitor::handle_cull_callbacks_and_traverse ( osg::Node node  )  [inline, protected]

void osgUtil::CullVisitor::handle_cull_callbacks_and_accept ( osg::Node node,
osg::Node acceptNode 
) [inline, protected]

RenderLeaf * osgUtil::CullVisitor::createOrReuseRenderLeaf ( osg::Drawable drawable,
osg::RefMatrix projection,
osg::RefMatrix matrix,
float  depth = 0.0f 
) [inline, protected]


Member Data Documentation

osg::ref_ptr<const osg::ClearNode> osgUtil::CullVisitor::_clearNode [protected]

osg::ref_ptr<StateGraph> osgUtil::CullVisitor::_rootStateGraph [protected]

StateGraph* osgUtil::CullVisitor::_currentStateGraph [protected]

osg::ref_ptr<RenderStage> osgUtil::CullVisitor::_rootRenderStage [protected]

RenderBin* osgUtil::CullVisitor::_currentRenderBin [protected]

value_type osgUtil::CullVisitor::_computed_znear [protected]

value_type osgUtil::CullVisitor::_computed_zfar [protected]

RenderLeafList osgUtil::CullVisitor::_reuseRenderLeafList [protected]

unsigned int osgUtil::CullVisitor::_currentReuseRenderLeafIndex [protected]

unsigned int osgUtil::CullVisitor::_numberOfEncloseOverrideRenderBinDetails [protected]

osg::RenderInfo osgUtil::CullVisitor::_renderInfo [protected]

DistanceMatrixDrawableMap osgUtil::CullVisitor::_nearPlaneCandidateMap [protected]


The documentation for this class was generated from the following file:
Generated at Sun Oct 14 02:12:49 2007 for the OpenSceneGraph by doxygen 1.5.3.