Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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

enum  ComputeNearFarMode { DO_NOT_COMPUTE_NEAR_FAR = 0, COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES, COMPUTE_NEAR_FAR_USING_PRIMITIVES }
enum  TransparencySortMode { LOOK_VECTOR_DISTANCE, OBJECT_EYE_POINT_DISTANCE }

Public Methods

 CullVisitor ()
virtual ~CullVisitor ()
virtual CullVisitor * cloneType () const
virtual void reset ()
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::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::OccluderNode &node)
virtual void apply (osg::Impostor &node)
void setClearNode (const osg::ClearNode *earthSky)
const osg::ClearNodegetClearNode () const
void setImpostorsActive (const bool active)
 Switch the creation of Impostors on or off.

const bool getImpostorsActive () const
 Get whether impostors are active or not.

void setImpostorPixelErrorThreshold (const float numPixels)
 Set the impostor error threshold.

const float getImpostorPixelErrorThreshold () const
 Get the impostor error threshold.

void setDepthSortImpostorSprites (const bool doDepthSort)
 Set whether ImpsotorSprite's should be placed in a depth sorted bin for rendering.

const bool setDepthSortImpostorSprites () const
 Get whether ImpsotorSprite's are depth sorted bin for rendering.

void setNumberOfFrameToKeepImpostorSprites (const int numFrames)
 Set the number of frames that an ImpsotorSprite's is kept whilst not being beyond, before being recycled.

const int getNumberOfFrameToKeepImpostorSprites () const
 Get the number of frames that an ImpsotorSprite's is kept whilst not being beyond, before being recycled.

void setComputeNearFarMode (ComputeNearFarMode cnfm)
ComputeNearFarMode getComputeNearFarMode () const
void setTransparencySortMode (TransparencySortMode tsm)
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 setRenderGraph (RenderGraph *rg)
RenderGraphgetRootRenderGraph ()
RenderGraphgetCurrentRenderGraph ()
void setRenderStage (RenderStage *rg)
RenderStagegetRenderStage ()
RenderBingetCurrentRenderBin ()
void setCurrentRenderBin (RenderBin *rb)
const float getCalculatedNearPlane () const
const float getCalculatedFarPlane () const
void updateCalculatedNearFar (const osg::Matrix &matrix, const osg::Drawable &drawable)
void updateCalculatedNearFar (const osg::Matrix &matrix, const osg::BoundingBox &bb)
void updateCalculatedNearFar (const osg::Vec3 &pos)
void addDrawable (osg::Drawable *drawable, osg::Matrix *matrix)
 Add a drawable to current render graph.

void addDrawableAndDepth (osg::Drawable *drawable, osg::Matrix *matrix, const float depth)
 Add a drawable and depth to current render graph.

void addPositionedAttribute (osg::Matrix *matrix, const osg::StateAttribute *attr)
 Add an attribute which is positioned related to the modelview matrix.

void popProjectionMatrix ()
 reimplement CullStack's popProjectionMatrix() adding clamping of the projection matrix to the computed near and far.

void setState (osg::State *state)
osg::StategetState ()
const osg::StategetState () const

Protected Types

typedef std::vector< osg::ref_ptr<
RenderLeaf > > 
RenderLeafList

Protected Methods

 CullVisitor (const CullVisitor &)
 prevent unwanted copy construction.

CullVisitor & operator= (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)
osg::ImpostorSpritecreateImpostorSprite (osg::Impostor &node)
 create an impostor sprite by setting up a pre-rendering stage to generate the impostor texture.

RenderLeafcreateOrReuseRenderLeaf (osg::Drawable *drawable, osg::Matrix *projection, osg::Matrix *matrix, float depth=0.0f)

Protected Attributes

osg::ref_ptr< RenderGraph_rootRenderGraph
RenderGraph_currentRenderGraph
osg::ref_ptr< RenderStage_rootRenderStage
RenderBin_currentRenderBin
ComputeNearFarMode _computeNearFar
float _computed_znear
float _computed_zfar
osg::ref_ptr< const osg::ClearNode_clearNode
TransparencySortMode _tsm
bool _impostorActive
bool _depthSortImpostorSprites
float _impostorPixelErrorThreshold
int _numFramesToKeepImpostorSprites
RenderLeafList _reuseRenderLeafList
unsigned int _currentReuseRenderLeafIndex
osg::ref_ptr< osg::ImpostorSpriteManager_impostorSpriteManager
osg::ref_ptr< osg::State_state

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 in rendered in order from the furthest osg::Drawable from the eye to the one nearest the eye.


Member Typedef Documentation

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


Member Enumeration Documentation

enum osgUtil::CullVisitor::ComputeNearFarMode
 

Enumeration values:
DO_NOT_COMPUTE_NEAR_FAR 
COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES 
COMPUTE_NEAR_FAR_USING_PRIMITIVES 

enum osgUtil::CullVisitor::TransparencySortMode
 

Enumeration values:
LOOK_VECTOR_DISTANCE 
OBJECT_EYE_POINT_DISTANCE 


Constructor & Destructor Documentation

osgUtil::CullVisitor::CullVisitor  
 

virtual osgUtil::CullVisitor::~CullVisitor   [virtual]
 

osgUtil::CullVisitor::CullVisitor const CullVisitor &    [inline, protected]
 

prevent unwanted copy construction.


Member Function Documentation

void osgUtil::CullVisitor::addDrawable osg::Drawable   drawable,
osg::Matrix   matrix
[inline]
 

Add a drawable to current render graph.

void osgUtil::CullVisitor::addDrawableAndDepth osg::Drawable   drawable,
osg::Matrix   matrix,
const float    depth
[inline]
 

Add a drawable and depth to current render graph.

void osgUtil::CullVisitor::addPositionedAttribute osg::Matrix   matrix,
const osg::StateAttribute   attr
[inline]
 

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

virtual void osgUtil::CullVisitor::apply osg::Impostor   node [virtual]
 

Reimplemented from osg::NodeVisitor.

virtual void osgUtil::CullVisitor::apply osg::OccluderNode   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::LOD   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::Projection   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::Group   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::LightSource   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::Geode   node [virtual]
 

Reimplemented from osg::NodeVisitor.

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

Reimplemented from osg::NodeVisitor.

virtual CullVisitor* osgUtil::CullVisitor::cloneType   const [inline, virtual]
 

osg::ImpostorSprite* osgUtil::CullVisitor::createImpostorSprite osg::Impostor   node [protected]
 

create an impostor sprite by setting up a pre-rendering stage to generate the impostor texture.

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

const float osgUtil::CullVisitor::getCalculatedFarPlane   const [inline]
 

const float osgUtil::CullVisitor::getCalculatedNearPlane   const [inline]
 

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

ComputeNearFarMode osgUtil::CullVisitor::getComputeNearFarMode   const [inline]
 

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

RenderGraph* osgUtil::CullVisitor::getCurrentRenderGraph   [inline]
 

const float osgUtil::CullVisitor::getImpostorPixelErrorThreshold   const [inline]
 

Get the impostor error threshold.

const bool osgUtil::CullVisitor::getImpostorsActive   const [inline]
 

Get whether impostors are active or not.

const int osgUtil::CullVisitor::getNumberOfFrameToKeepImpostorSprites   const [inline]
 

Get the number of frames that an ImpsotorSprite's is kept whilst not being beyond, before being recycled.

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

RenderGraph* osgUtil::CullVisitor::getRootRenderGraph   [inline]
 

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

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

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

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

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

prevent unwanted copy operator.

void osgUtil::CullVisitor::popProjectionMatrix  
 

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

Reimplemented from osg::CullStack.

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::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.

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

Reimplemented from osg::CullStack.

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

void osgUtil::CullVisitor::setComputeNearFarMode ComputeNearFarMode    cnfm [inline]
 

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

const bool osgUtil::CullVisitor::setDepthSortImpostorSprites   const [inline]
 

Get whether ImpsotorSprite's are depth sorted bin for rendering.

void osgUtil::CullVisitor::setDepthSortImpostorSprites const bool    doDepthSort [inline]
 

Set whether ImpsotorSprite's should be placed in a depth sorted bin for rendering.

void osgUtil::CullVisitor::setImpostorPixelErrorThreshold const float    numPixels [inline]
 

Set the impostor error threshold.

Used in calculation of whether impostors remain valid.

void osgUtil::CullVisitor::setImpostorsActive const bool    active [inline]
 

Switch the creation of Impostors on or off.

Setting active to false forces the CullVisitor to use the Impostor LOD children for rendering. Setting active to true forces the CullVisitor to create the appropriate pre-rendering stages which render to the ImpostorSprite's texture.

void osgUtil::CullVisitor::setNumberOfFrameToKeepImpostorSprites const int    numFrames [inline]
 

Set the number of frames that an ImpsotorSprite's is kept whilst not being beyond, before being recycled.

void osgUtil::CullVisitor::setRenderGraph RenderGraph   rg [inline]
 

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

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

void osgUtil::CullVisitor::setTransparencySortMode TransparencySortMode    tsm [inline]
 

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

void osgUtil::CullVisitor::updateCalculatedNearFar const osg::Matrix   matrix,
const osg::BoundingBox   bb
 

void osgUtil::CullVisitor::updateCalculatedNearFar const osg::Matrix   matrix,
const osg::Drawable   drawable
[inline]
 


Member Data Documentation

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

float osgUtil::CullVisitor::_computed_zfar [protected]
 

float osgUtil::CullVisitor::_computed_znear [protected]
 

ComputeNearFarMode osgUtil::CullVisitor::_computeNearFar [protected]
 

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

RenderGraph* osgUtil::CullVisitor::_currentRenderGraph [protected]
 

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

bool osgUtil::CullVisitor::_depthSortImpostorSprites [protected]
 

bool osgUtil::CullVisitor::_impostorActive [protected]
 

float osgUtil::CullVisitor::_impostorPixelErrorThreshold [protected]
 

osg::ref_ptr<osg::ImpostorSpriteManager> osgUtil::CullVisitor::_impostorSpriteManager [protected]
 

int osgUtil::CullVisitor::_numFramesToKeepImpostorSprites [protected]
 

RenderLeafList osgUtil::CullVisitor::_reuseRenderLeafList [protected]
 

osg::ref_ptr<RenderGraph> osgUtil::CullVisitor::_rootRenderGraph [protected]
 

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

osg::ref_ptr<osg::State> osgUtil::CullVisitor::_state [protected]
 

TransparencySortMode osgUtil::CullVisitor::_tsm [protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:57 2002 for the Open Scene Graph by doxygen 1.2.16.