Basic NodeVisitor implementation for rendering a scene.
Inheritance:
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::Group& node)
-
virtual void apply(osg::Transform& node)
-
virtual void apply(osg::Switch& node)
-
virtual void apply(osg::LOD& node)
-
virtual void apply(osg::EarthSky& node)
-
virtual void apply(osg::Impostor& node)
-
void setCamera(const osg::Camera& camera)
-
const osg::Camera* getCamera() const
-
void setEarthSky(const osg::EarthSky* earthSky)
-
const osg::EarthSky* getEarthSky() const
-
void setLODBias(const float bias)
-
const float getLODBias() 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 setTransparencySortMode(TransparencySortMode tsm)
-
void setCullingMode(CullViewState::CullingMode mode)
- Sets the current CullingMode
-
CullViewState::CullingMode getCullingMode() const
- Returns the current CullingMode
-
void setViewport(osg::Viewport* viewport)
- Set the viewport.
-
const osg::Viewport* getViewport() const
- Get the const viewport.
-
osg::Viewport* getViewport()
- Get the viewport.
-
inline void pushCullViewState()
-
void pushCullViewState(osg::Matrix* matrix)
-
void pushCullViewState(osg::Matrix* matrix, osg::Matrix* inverse)
-
void popCullViewState()
-
inline void pushStateSet(const osg::StateSet* ss)
- Push state set on the current state group.
-
inline void popStateSet()
- Pop the top state set and hence associated state group.
-
void setRenderGraph(RenderGraph* rg)
-
RenderGraph* getRenderGraph()
-
void setRenderStage(RenderStage* rg)
-
RenderStage* getRenderStage()
-
const float getCalculatedNearPlane() const
-
const float getCalculatedFarPlane() const
-
void setDetailedCulling(bool detailed)
- sets the flag for detailed culling
-
const bool getDetailedCulling() const
- gets the status of detailed culling
-
void calcClippingDirections() const
- calculates unit directions of vectors that are intersections of cameras' clipping planes
Public Members
-
enum TransparencySortMode
Protected Fields
-
mutable osg::Vec3 _LeftUp
- unit vector of direction along intersection of cameras left and top clipping planes in "global" coordinates
-
mutable osg::Vec3 _RightUp
- unit vector of direction along intersection of cameras right and top clipping planes in "global" coordinates
-
mutable osg::Vec3 _LeftDown
- unit vector of direction along intersection of cameras left and down clipping planes in "global" coordinates
-
mutable osg::Vec3 _RightDown
- unit vector of direction along intersection of cameras right and down clipping planes in "global" coordinates
-
bool _detailedCulling
-
osg::ref_ptr<CullViewState> _tvs
-
osg::ref_ptr<CullViewState> _cvs
-
osg::ref_ptr<RenderGraph> _rootRenderGraph
-
RenderGraph* _currentRenderGraph
-
osg::ref_ptr<RenderStage> _rootRenderStage
-
RenderBin* _currentRenderBin
-
std::vector<CullViewState::CullingMode> _cullingModeStack
-
float _LODBias
-
float _calculated_znear
-
float _calculated_zfar
-
osg::ref_ptr<const osg::Camera> _camera
-
osg::ref_ptr<const osg::EarthSky> _earthSky
-
TransparencySortMode _tsm
-
osg::ref_ptr<osg::Viewport> _viewport
-
bool _impostorActive
-
bool _depthSortImpostorSprites
-
float _impostorPixelErrorThreshold
-
int _numFramesToKeepImpostorSprites
-
unsigned int _currentReuseMatrixIndex
-
unsigned int _currentReuseRenderLeafIndex
-
osg::ref_ptr<osg::ImpostorSpriteManager> _impostorSpriteManager
Protected Methods
-
CullVisitor(const CullVisitor&)
- prevent unwanted copy construction
-
CullVisitor& operator = (const CullVisitor&)
- prevent unwanted copy operator
-
inline osg::Matrix* getCurrentMatrix()
-
inline osg::Matrix* getInverseCurrentMatrix()
-
inline const osg::Vec3& getEyeLocal() const
-
inline const osg::Vec3& getUpLocal() const
-
inline const osg::Vec3& getCenterLocal() const
-
inline const osg::Vec3& getLookVectorLocal() const
-
inline bool isCulled(const osg::BoundingSphere& sp, CullViewState::CullingMode& mode) const
-
inline const bool isCulled(const osg::BoundingBox& bb, const CullViewState::CullingMode mode) const
-
void updateCalculatedNearFar(const osg::BoundingBox& bb)
-
void updateCalculatedNearFar(const osg::Vec3& pos)
-
void updateCalculatedNearFar(osg::Drawable* pDrawable)
- updates near and far clipping values for case of detailed culling
-
double calculateZNear(const osg::Vec3& position, const osg::Vec3& eye, const osg::Vec3& look)
- calculates near for "global" vertex in scene
-
inline void addDrawable(osg::Drawable* drawable, osg::Matrix* matrix)
- Add a drawable to current render graph
-
inline void addDrawableAndDepth(osg::Drawable* drawable, osg::Matrix* matrix, const float depth)
- Add a drawable and depth to current render graph
-
inline void addLight(osg::Light* light, osg::Matrix* matrix)
- Add a light to current render graph
-
osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node)
- create an impostor sprite by setting up a pre-rendering stage to generate the impostor texture.
-
inline osg::Matrix* createOrReuseMatrix()
-
inline RenderLeaf* createOrReuseRenderLeaf(osg::Drawable* drawable, osg::Matrix* matrix, float depth=0.0f)
Protected Members
-
typedef std::vector< osg::ref_ptr<CullViewState> > CullViewStateStack CullViewStateStack _viewStateStack
-
typedef std::vector< osg::ref_ptr<osg::Matrix> > MatrixList MatrixList _reuseMatrixList
-
typedef std::vector< osg::ref_ptr<RenderLeaf> > RenderLeafList RenderLeafList _reuseRenderLeafList
Documentation
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.
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::Group& node)
virtual void apply(osg::Transform& node)
virtual void apply(osg::Switch& node)
virtual void apply(osg::LOD& node)
virtual void apply(osg::EarthSky& node)
virtual void apply(osg::Impostor& node)
void setCamera(const osg::Camera& camera)
const osg::Camera* getCamera() const
void setEarthSky(const osg::EarthSky* earthSky)
const osg::EarthSky* getEarthSky() const
void setLODBias(const float bias)
const float getLODBias() const
void setImpostorsActive(const bool active)
- 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.
const bool getImpostorsActive() const
- Get whether impostors are active or not.
void setImpostorPixelErrorThreshold(const float numPixels)
- Set the impostor error threshold.
Used in calculation of whether impostors remain valid.
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
enum TransparencySortMode
LOOK_VECTOR_DISTANCE
OBJECT_EYE_POINT_DISTANCE
void setTransparencySortMode(TransparencySortMode tsm)
void setCullingMode(CullViewState::CullingMode mode)
- Sets the current CullingMode
CullViewState::CullingMode getCullingMode() const
- Returns the current CullingMode
void setViewport(osg::Viewport* viewport)
- Set the viewport.
Used to enable the CullVisitor can make decision
such as based on viewport dimensions.
const osg::Viewport* getViewport() const
- Get the const viewport.
osg::Viewport* getViewport()
- Get the viewport.
inline void pushCullViewState()
void pushCullViewState(osg::Matrix* matrix)
void pushCullViewState(osg::Matrix* matrix, osg::Matrix* inverse)
void popCullViewState()
inline void pushStateSet(const osg::StateSet* ss)
- 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.
inline void popStateSet()
- Pop the top state set and hence associated state group.
Move the current state group to the parent of the popped
state group.
void setRenderGraph(RenderGraph* rg)
RenderGraph* getRenderGraph()
void setRenderStage(RenderStage* rg)
RenderStage* getRenderStage()
const float getCalculatedNearPlane() const
const float getCalculatedFarPlane() const
void setDetailedCulling(bool detailed)
- sets the flag for detailed culling
const bool getDetailedCulling() const
- gets the status of detailed culling
void calcClippingDirections() const
- calculates unit directions of vectors that are intersections of cameras' clipping planes
CullVisitor(const CullVisitor&)
- prevent unwanted copy construction
CullVisitor& operator = (const CullVisitor&)
- prevent unwanted copy operator
inline osg::Matrix* getCurrentMatrix()
inline osg::Matrix* getInverseCurrentMatrix()
inline const osg::Vec3& getEyeLocal() const
inline const osg::Vec3& getUpLocal() const
inline const osg::Vec3& getCenterLocal() const
inline const osg::Vec3& getLookVectorLocal() const
inline bool isCulled(const osg::BoundingSphere& sp, CullViewState::CullingMode& mode) const
inline const bool isCulled(const osg::BoundingBox& bb, const CullViewState::CullingMode mode) const
void updateCalculatedNearFar(const osg::BoundingBox& bb)
void updateCalculatedNearFar(const osg::Vec3& pos)
void updateCalculatedNearFar(osg::Drawable* pDrawable)
- updates near and far clipping values for case of detailed culling
double calculateZNear(const osg::Vec3& position, const osg::Vec3& eye, const osg::Vec3& look)
- calculates near for "global" vertex in scene
mutable osg::Vec3 _LeftUp
- unit vector of direction along intersection of cameras left and top clipping planes in "global" coordinates
mutable osg::Vec3 _RightUp
- unit vector of direction along intersection of cameras right and top clipping planes in "global" coordinates
mutable osg::Vec3 _LeftDown
- unit vector of direction along intersection of cameras left and down clipping planes in "global" coordinates
mutable osg::Vec3 _RightDown
- unit vector of direction along intersection of cameras right and down clipping planes in "global" coordinates
inline void addDrawable(osg::Drawable* drawable, osg::Matrix* matrix)
- Add a drawable to current render graph
inline void addDrawableAndDepth(osg::Drawable* drawable, osg::Matrix* matrix, const float depth)
- Add a drawable and depth to current render graph
inline void addLight(osg::Light* light, osg::Matrix* matrix)
- Add a light to current render graph
osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node)
- create an impostor sprite by setting up a pre-rendering stage
to generate the impostor texture.
bool _detailedCulling
typedef std::vector< osg::ref_ptr<CullViewState> > CullViewStateStack CullViewStateStack _viewStateStack
osg::ref_ptr<CullViewState> _tvs
osg::ref_ptr<CullViewState> _cvs
osg::ref_ptr<RenderGraph> _rootRenderGraph
RenderGraph* _currentRenderGraph
osg::ref_ptr<RenderStage> _rootRenderStage
RenderBin* _currentRenderBin
std::vector<CullViewState::CullingMode> _cullingModeStack
float _LODBias
float _calculated_znear
float _calculated_zfar
osg::ref_ptr<const osg::Camera> _camera
osg::ref_ptr<const osg::EarthSky> _earthSky
TransparencySortMode _tsm
osg::ref_ptr<osg::Viewport> _viewport
bool _impostorActive
bool _depthSortImpostorSprites
float _impostorPixelErrorThreshold
int _numFramesToKeepImpostorSprites
typedef std::vector< osg::ref_ptr<osg::Matrix> > MatrixList MatrixList _reuseMatrixList
unsigned int _currentReuseMatrixIndex
inline osg::Matrix* createOrReuseMatrix()
typedef std::vector< osg::ref_ptr<RenderLeaf> > RenderLeafList RenderLeafList _reuseRenderLeafList
unsigned int _currentReuseRenderLeafIndex
inline RenderLeaf* createOrReuseRenderLeaf(osg::Drawable* drawable, osg::Matrix* matrix, float depth=0.0f)
osg::ref_ptr<osg::ImpostorSpriteManager> _impostorSpriteManager
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.