osg::RenderAction Class Reference
[Action]

RenderAction class. More...

#include <OSGRenderAction.h>

Inheritance diagram for osg::RenderAction:

osg::RenderActionBase osg::DrawActionBase osg::Action

List of all members.

Public Types

typedef std::map< Material
*, DrawTreeNode * > 
MaterialMap
typedef std::pair< LightChunk
*, Matrix
LightStore
typedef std::pair
< SClipPlaneChunk *, Matrix
ClipPlaneStore
enum  ResultE { Continue, Skip, Quit }
typedef ArgsCollector< Action * > FunctorArgs
typedef TypedFunctor2Base
< ResultE, CPtrRefCallArg
< CNodePtr >, FunctorArgs
Functor

Public Member Functions

virtual ~RenderAction (void)
 Destructor.
virtual Action::ResultE start (void)
virtual Action::ResultE stop (ResultE res)
void push_matrix (const Matrix &matrix)
void pop_matrix (void)
const Matrixtop_matrix (void)
void dropGeometry (Geometry *pGeo)
void dropFunctor (Material::DrawFunctor &func, Material *mat)
void dropLight (Light *pLight)
void undropLight (Light *pLight)
void dropLightEnv (LightEnv *pLightEnv)
void undropLightEnv (LightEnv *pLightEnv)
void dropClipPlane (ClipPlane *pClipPlane)
void undropClipPlane (ClipPlane *pClipPlane)
void setStateSorting (bool s)
bool getStateSorting (void)
std::vector< Light * > getActiveLights (void)
UInt32 getActiveLightsMask (void)
UInt32 getActiveLightsCount (void)
const std::vector< UInt32 > & getLightEnvsLightsState (void)
StategetCurrentState (void)
void setSortTrans (bool bVal)
bool getSortTrans (void) const
void setZWriteTrans (bool bVal)
bool getZWriteTrans (void) const
void setLocalLights (bool bVal)
bool getLocalLights (void) const
void setCorrectTwoSidedLighting (bool bVal)
bool getCorrectTwoSidedLighting (void) const
void setOcclusionCulling (bool bVal)
bool getOcclusionCulling (void) const
void setOcclusionCullingMode (Int32 mode)
Int32 getOcclusionCullingMode (void) const
void setOcclusionCullingPixels (UInt32 pixels)
UInt32 getOcclusionCullingPixels (void) const
void setOcclusionCullingThreshold (UInt32 threshold)
UInt32 getOcclusionCullingThreshold (void) const
void setSmallFeatureCulling (bool bVal)
bool getSmallFeatureCulling (void) const
void setSmallFeaturePixels (Real32 pixels)
Real32 getSmallFeaturePixels (void) const
void setSmallFeatureThreshold (UInt32 threshold)
UInt32 getSmallFeatureThreshold (void) const
void setUseGLFinish (bool s)
bool getUseGLFinish (void) const
bool isSmallFeature (const NodePtr &node)
bool isOccluded (DrawTreeNode *pRoot)
void deleteOcclusionQueriesPool (void)
GLuint getOcclusionQuery (void)
GLuint getOcclusionQuery (NodePtr node)
void setOcclusionQuery (NodePtr node, GLuint occlusionQuery)
void resetOcclusionQueryIndex (void)
void setOcclusionMask (NodePtr node, UInt8 mask)
bool hasGeometryChild (NodePtr node)
void drawOcclusionBB (const Pnt3f &bbmin, const Pnt3f &bbmax)
void drawMultiFrameOcclusionBB (DrawTreeNode *pRoot)
void drawHierarchicalMultiFrameOcclusionBB (const Matrix &view, NodePtr node)
bool isVisible (Node *node)
bool pushVisibility (void)
 enter a new level for visibility Return false if node is not visible, true
void popVisibility (void)
 void (OSG_APIENTRY *_glGenQueriesARB)(GLsizei
GLuintvoid (OSG_APIENTRY *_glDeleteQueriesARB)(GLsizei
GLuint *GLuintvoid (OSG_APIENTRY *_glBeginQueryARB)(GLenum
 void (OSG_APIENTRY *_glEndQueryARB)(GLenum)
 void (OSG_APIENTRY *_glGetQueryObjectuivARB)(GLuint
ViewportgetViewport (void) const
void setViewport (Viewport *viewport)
CameragetCamera (void) const
void setCamera (Camera *cam)
const MatrixgetCameraToWorld (void)
BackgroundgetBackground (void) const
void setBackground (Background *background)
WindowgetWindow (void) const
void setWindow (Window *window)
StatCollectorgetStatistics (void)
void setStatistics (StatCollector *stat)
bool hasOwnStat (void)
bool getFrustumCulling (void) const
void setFrustumCulling (bool val=true)
bool getVolumeDrawing (void) const
void setVolumeDrawing (bool val=false)
bool getAutoFrustum (void) const
void setAutoFrustum (bool val=true)
const FrustumVolumegetFrustum (void) const
void setFrustum (FrustumVolume &frust)
UInt32 selectVisibles (void)
MaterialgetMaterial (void) const
NodePtr getMaterialNode (void) const
void setMaterial (Material *pMaterial, NodePtr node)
void registerEnterFunction (const FieldContainerType &type, const Functor &func)
void registerLeaveFunction (const FieldContainerType &type, const Functor &func)
virtual ResultE apply (std::vector< NodePtr >::iterator begin, std::vector< NodePtr >::iterator end)
virtual ResultE apply (NodePtr node)
NodePtr getActNode (void)
UInt32 getNNodes (void) const
const NodePtr getNode (int index)
void addNode (NodePtr node)
void useNodeList (void)
UInt32 getTravMask (void) const
void setTravMask (UInt32 val)
bool operator< (const Action &other)
 assignment
bool operator== (const Action &other)
 equal
bool operator!= (const Action &other)
 unequal

Static Public Member Functions

static RenderActioncreate (void)
 create a new DrawAction by cloning the prototype
static void setPrototype (RenderAction *pPrototype)
 prototype access after setting the prototype all new DrawActions are clones of it
static RenderActiongetPrototype (void)
static void registerEnterDefault (const FieldContainerType &type, const Action::Functor &func)
 Default registration. static, so it can be called during static init.
static void registerLeaveDefault (const FieldContainerType &type, const Action::Functor &func)
static const char * getClassname (void)
static void setPrototype (Action *proto)

Public Attributes

GLuint *GLuintGLuint
 GLenum

Static Public Attributes

static StatElemDesc< StatTimeElemstatDrawTime
static StatElemDesc< StatIntElemstatNMaterials
static StatElemDesc< StatIntElemstatNMatrices
static StatElemDesc< StatIntElemstatNLights
static StatElemDesc< StatIntElemstatNGeometries
static StatElemDesc< StatIntElemstatNTransGeometries
static StatElemDesc
< StatIntOnceElem
statNTextures
static StatElemDesc
< StatIntOnceElem
statNTexBytes
static StatElemDesc
< StatStringElem
statNOcclusionMode
static StatElemDesc< StatIntElemstatNOcclusionTests
static StatElemDesc< StatIntElemstatNOcclusionCulled
static const Int32 OcclusionStopAndWait = 1
static const Int32 OcclusionMultiFrame = 2
static const Int32 OcclusionHierarchicalMultiFrame = 6
static StatElemDesc< StatTimeElemstatTravTime
static StatElemDesc< StatIntElemstatCullTestedNodes
static StatElemDesc< StatIntElemstatCulledNodes

Protected Types

typedef RenderActionBase Inherited
typedef std::map< Int32,
DrawTreeNode * > 
SortKeyMap
typedef std::map< Real32,
DrawTreeNode * > 
TransSortMap
typedef std::map< Int32,
TransSortMap
TransSortKeyMap
typedef std::map< Real32,
DrawTreeNode * > 
OCMap

Protected Member Functions

 RenderAction (void)
 Constructor.
 RenderAction (const RenderAction &source)
 Copy-Constructor.
void operator= (const RenderAction &source)
virtual std::vector< Functor > * getDefaultEnterFunctors (void)
 assignment
virtual std::vector< Functor > * getDefaultLeaveFunctors (void)
void dump (DrawTreeNode *pRoot, UInt32 uiIndent)
void updateShader (State *state)
virtual void draw (DrawTreeNode *pRoot)
void updateTopMatrix (void)
 Constructor.
void activateLocalLights (DrawTreeNode *pRoot)
void activateLocalClipPlanes (DrawTreeNode *pRoot)
void getMaterialStates (Material *mat, std::vector< State * > &states)
ResultE callEnter (NodePtr node)
ResultE callLeave (NodePtr node)
ResultE recurse (NodePtr node)
ResultE callNewList (void)
void setActNode (NodePtr node)

Static Protected Member Functions

static ResultE _defaultEnterFunction (CNodePtr &node, Action *action)
static ResultE _defaultLeaveFunction (CNodePtr &node, Action *action)

Protected Attributes

DrawTreeNodeFactory_pNodeFactory
UInt32 _uiMatrixId
MatrixStore _currMatrix
Matrix _camInverse
std::vector< MatrixStore_vMatrixStack
MaterialMap _mMatMap
SortKeyMap _pMatRoots
TransSortKeyMap _pTransMatRoots
DrawTreeNode_pNoStateSortRoot
DrawTreeNode_pNoStateSortTransRoot
OCMap _ocRoot
UInt32 _uiActiveMatrix
State_pActiveState
UInt32 _uiNumMaterialChanges
UInt32 _uiNumMatrixChanges
UInt32 _uiNumLightChanges
UInt32 _uiNumGeometries
UInt32 _uiNumTransGeometries
UInt32 _uiNumOcclusionTests
UInt32 _uiNumOcclusionCulled
bool _bSortTrans
bool _bZWriteTrans
bool _bLocalLights
bool _bCorrectTwoSidedLighting
bool _bOcclusionCulling
Int32 _occlusionCullingMode
UInt32 _occlusionCullingPixels
UInt32 _occlusionCullingThreshold
UInt32 _currentOcclusionQueryIndex
std::vector< NodePtr_occluded_nodes
std::set< UInt32_hier_occlusions
UInt32 _occ_bb_dl
bool _bSmallFeatureCulling
Real32 _smallFeaturesPixels
UInt32 _smallFeaturesThreshold
Matrix _worldToScreenMatrix
bool _useGLFinish
std::vector< LightStore_vLights
std::vector< Light * > _lightsMap
UInt32 _lightsState
UInt32 _activeLightsState
UInt32 _activeLightsCount
UInt32 _activeLightsMask
std::vector< std::vector
< UInt32 > > 
_lightsTable
std::vector< UInt32_lightsPath
std::vector< UInt32_lightEnvsLightsState
std::vector< ClipPlaneStore_vClipPlanes
std::vector< ClipPlane * > _clipPlanesMap
UInt32 _clipPlanesState
UInt32 _activeClipPlanesState
UInt32 _activeClipPlanesCount
UInt32 _activeClipPlanesMask
std::vector< std::vector
< UInt32 > > 
_clipPlanesTable
std::vector< UInt32_clipPlanesPath
bool _stateSorting
std::vector
< FrustumVolume::PlaneSet
_visibilityStack
GLuint _occlusionQuery
std::vector< GLuint_occlusionQueriesPool
std::map< UInt32, GLuint_occlusionQueries
Int32 _cgChunkId
Int32 _cgfxChunkId
Int32 _shlChunkId
Camera_camera
Background_background
Window_window
Viewport_viewport
StatCollector_statistics
bool _ownStat
Material_pMaterial
NodePtr _pMaterialNode
bool _frustumCulling
bool _volumeDrawing
bool _autoFrustum
FrustumVolume _frustum
Matrix _mCameraToWorld
std::vector< Functor_enterFunctors
std::vector< Functor_leaveFunctors

Static Protected Attributes

static RenderAction_pPrototype = NULL
 the prototype which is copied to create new actions
static std::vector< Functor > * _vDefaultEnterFunctors = NULL
 Default functors for instantiation.
static std::vector< Functor > * _vDefaultLeaveFunctors = NULL
static UInt32 _arbOcclusionQuery
static UInt32 _funcGenQueriesARB = Window::invalidFunctionID
static UInt32 _funcDeleteQueriesARB = Window::invalidFunctionID
static UInt32 _funcBeginQueryARB = Window::invalidFunctionID
static UInt32 _funcEndQueryARB = Window::invalidFunctionID
static UInt32 _funcGetQueryObjectuivARB = Window::invalidFunctionID

Static Private Attributes

static char cvsid [] = "@(#)$Id: $"

Friends

class ShadowViewport

Classes

struct  MatrixStore


Detailed Description

The render action class.

Definition at line 90 of file OSGRenderAction.h.


Member Typedef Documentation

Definition at line 102 of file OSGRenderAction.h.

Definition at line 103 of file OSGRenderAction.h.

Definition at line 104 of file OSGRenderAction.h.

Reimplemented from osg::RenderActionBase.

Definition at line 254 of file OSGRenderAction.h.

typedef std::map<Int32, DrawTreeNode *> osg::RenderAction::SortKeyMap [protected]

Definition at line 297 of file OSGRenderAction.h.

typedef std::map<Real32, DrawTreeNode *> osg::RenderAction::TransSortMap [protected]

Definition at line 300 of file OSGRenderAction.h.

typedef std::map<Int32, TransSortMap> osg::RenderAction::TransSortKeyMap [protected]

Definition at line 301 of file OSGRenderAction.h.

typedef std::map<Real32, DrawTreeNode *> osg::RenderAction::OCMap [protected]

Definition at line 307 of file OSGRenderAction.h.

Definition at line 95 of file OSGAction.h.

Definition at line 99 of file OSGAction.h.


Member Enumeration Documentation

enum osg::Action::ResultE [inherited]

Enumerator:
Continue 
Skip 
Quit 

Definition at line 87 of file OSGAction.h.

00088     {   
00089         Continue,   // continue with my children
00090         Skip,       // skip my children
00091         // really needed? Cancel, // skip my brothers, go one step up
00092         Quit        // forget it, you're done
00093     };


Constructor & Destructor Documentation

RenderAction::~RenderAction ( void   )  [virtual]

Definition at line 488 of file OSGRenderAction.cpp.

References _occ_bb_dl, _occlusionQuery, _pNodeFactory, and deleteOcclusionQueriesPool().

00489 {
00490     delete _pNodeFactory;
00491 
00492     if(_occ_bb_dl != 0)
00493         glDeleteLists(_occ_bb_dl, 1);
00494 
00495     if(_occlusionQuery != 0)
00496         _glDeleteQueriesARB(1, &_occlusionQuery);
00497     deleteOcclusionQueriesPool();
00498 }

RenderAction::RenderAction ( void   )  [protected]

Definition at line 245 of file OSGRenderAction.cpp.

References _arbOcclusionQuery, _cgChunkId, _cgfxChunkId, osg::Action::_enterFunctors, _funcBeginQueryARB, _funcDeleteQueriesARB, _funcEndQueryARB, _funcGenQueriesARB, _funcGetQueryObjectuivARB, osg::Action::_leaveFunctors, _pNodeFactory, _shlChunkId, _vDefaultEnterFunctors, _vDefaultLeaveFunctors, osg::AttachmentPtr::dcast(), osg::NullFC, OSG_DLSYM_UNDERSCORE, osg::Window::registerExtension(), osg::Window::registerFunction(), osg::subRefCP(), and osg::FieldContainerFactory::the().

Referenced by create().

00245                                :
00246      Inherited           (),
00247     _pNodeFactory        (NULL),
00248 
00249     _uiMatrixId          (0),
00250     _currMatrix          (),
00251     _vMatrixStack        (),
00252 
00253     _mMatMap             (),
00254 
00255     _pMatRoots           (),
00256     _pTransMatRoots      (),
00257     _pNoStateSortRoot    (NULL),
00258     _pNoStateSortTransRoot(NULL),
00259 
00260     _ocRoot              (),
00261     _uiActiveMatrix      (0),
00262     _pActiveState        (NULL),
00263 
00264     _uiNumMaterialChanges(0),
00265     _uiNumMatrixChanges  (0),
00266     _uiNumLightChanges   (0),
00267     _uiNumGeometries     (0),
00268     _uiNumOcclusionTests (0),
00269     _uiNumOcclusionCulled(0),
00270     _uiNumTransGeometries(0),
00271 
00272     _bSortTrans               (true),
00273     _bZWriteTrans             (false),
00274     _bLocalLights             (false),
00275     _bCorrectTwoSidedLighting (false),
00276     _bOcclusionCulling        (false),
00277     _occlusionCullingMode     (OcclusionStopAndWait),
00278     _occlusionCullingPixels   (0),
00279     _occlusionCullingThreshold(64),
00280     _currentOcclusionQueryIndex(0),
00281     _occluded_nodes            (),
00282     _hier_occlusions           (),
00283     _occ_bb_dl                 (0),
00284 
00285     _bSmallFeatureCulling   (false),
00286     _smallFeaturesPixels    (10.0f),
00287     _smallFeaturesThreshold (32),
00288     _worldToScreenMatrix    (),
00289 
00290     _useGLFinish            (true),
00291 
00292     _vLights(),
00293     _lightsMap(),
00294     _lightsState(0),
00295     _activeLightsState(0),
00296     _activeLightsCount(0),
00297     _activeLightsMask(0),
00298 
00299     _lightsTable(),
00300     _lightsPath(),
00301     _lightEnvsLightsState(),
00302 
00303 
00304     _vClipPlanes(),
00305     _clipPlanesMap(),
00306     _clipPlanesState(0),
00307     _activeClipPlanesState(0),
00308     _activeClipPlanesCount(0),
00309     _activeClipPlanesMask(0),
00310 
00311     _clipPlanesTable(),
00312     _clipPlanesPath(),
00313 
00314 
00315     _stateSorting(true),
00316     _visibilityStack(),
00317 
00318     _occlusionQuery         (0),
00319     _occlusionQueriesPool   (),
00320     _occlusionQueries       (),
00321 
00322     _glGenQueriesARB        (NULL),
00323     _glDeleteQueriesARB     (NULL),
00324     _glBeginQueryARB        (NULL),
00325     _glEndQueryARB          (NULL),
00326     _glGetQueryObjectuivARB (NULL),
00327 
00328     _cgChunkId(-1),
00329     _cgfxChunkId(-1),
00330     _shlChunkId(-1)
00331 {
00332     if(_vDefaultEnterFunctors != NULL)
00333         _enterFunctors = *_vDefaultEnterFunctors;
00334 
00335     if(_vDefaultLeaveFunctors != NULL)
00336         _leaveFunctors = *_vDefaultLeaveFunctors;
00337 
00338     _pNodeFactory = new DrawTreeNodeFactory;
00339 
00340     _arbOcclusionQuery          = Window::registerExtension("GL_ARB_occlusion_query");
00341     _funcGenQueriesARB          = Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGenQueriesARB", _arbOcclusionQuery);
00342     _funcDeleteQueriesARB       = Window::registerFunction (OSG_DLSYM_UNDERSCORE"glDeleteQueriesARB", _arbOcclusionQuery);
00343     _funcBeginQueryARB          = Window::registerFunction (OSG_DLSYM_UNDERSCORE"glBeginQueryARB", _arbOcclusionQuery);
00344     _funcEndQueryARB            = Window::registerFunction (OSG_DLSYM_UNDERSCORE"glEndQueryARB", _arbOcclusionQuery);
00345     _funcGetQueryObjectuivARB   = Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetQueryObjectuivARB", _arbOcclusionQuery);
00346 
00347     // we can't include OSGCGChunk here because it is in Contrib ...
00348     StateChunkPtr cgChunk = StateChunkPtr::dcast(FieldContainerFactory::the()->createFieldContainer("CGChunk"));
00349     if(cgChunk != NullFC)
00350     {
00351         _cgChunkId = cgChunk->getClass()->getId();
00352         subRefCP(cgChunk);
00353     }
00354 
00355     // we can't include OSGCGFXChunk here because it is in Contrib ...
00356     StateChunkPtr cgfxChunk = StateChunkPtr::dcast(FieldContainerFactory::the()->createFieldContainer("CGFXChunk"));
00357     if(cgfxChunk != NullFC)
00358     {
00359         _cgfxChunkId = cgfxChunk->getClass()->getId();
00360         subRefCP(cgfxChunk);
00361     }
00362 
00363     StateChunkPtr shlChunk = StateChunkPtr::dcast(FieldContainerFactory::the()->createFieldContainer("SHLChunk"));
00364     if(shlChunk != NullFC)
00365     {
00366         _shlChunkId = shlChunk->getClass()->getId();
00367         subRefCP(shlChunk);
00368     }
00369 }

RenderAction::RenderAction ( const RenderAction source  )  [protected]

Definition at line 375 of file OSGRenderAction.cpp.

References _pNodeFactory.

00375                                                      :
00376      Inherited           (source),
00377     _pNodeFactory        (NULL),
00378 
00379     _uiMatrixId          (source._uiMatrixId),
00380     _currMatrix          (source._currMatrix),
00381     _vMatrixStack        (source._vMatrixStack),
00382 
00383     _mMatMap             (source._mMatMap),
00384 
00385     _pMatRoots           (source._pMatRoots),
00386     _pTransMatRoots      (source._pTransMatRoots),
00387     _pNoStateSortRoot    (source._pNoStateSortRoot),
00388     _pNoStateSortTransRoot(source._pNoStateSortTransRoot),
00389 
00390     _ocRoot              (source._ocRoot),
00391 
00392     _uiActiveMatrix      (source._uiActiveMatrix),
00393     _pActiveState        (source._pActiveState),
00394 
00395     _uiNumMaterialChanges(source._uiNumMaterialChanges),
00396     _uiNumMatrixChanges  (source._uiNumMatrixChanges),
00397     _uiNumLightChanges   (source._uiNumLightChanges),
00398     _uiNumGeometries     (source._uiNumGeometries),
00399     _uiNumOcclusionTests (source._uiNumOcclusionTests),
00400     _uiNumOcclusionCulled(source._uiNumOcclusionCulled),
00401     _uiNumTransGeometries(source._uiNumTransGeometries),
00402 
00403     _bSortTrans               (source._bSortTrans),
00404     _bZWriteTrans             (source._bZWriteTrans),
00405     _bLocalLights             (source._bLocalLights),
00406     _bCorrectTwoSidedLighting (source._bCorrectTwoSidedLighting),
00407     _bOcclusionCulling        (source._bOcclusionCulling),
00408     _occlusionCullingMode     (source._occlusionCullingMode),
00409     _occlusionCullingPixels   (source._occlusionCullingPixels),
00410     _occlusionCullingThreshold(source._occlusionCullingThreshold),
00411     _currentOcclusionQueryIndex(source._currentOcclusionQueryIndex),
00412     _occluded_nodes            (source._occluded_nodes),
00413     _hier_occlusions           (source._hier_occlusions),
00414     _occ_bb_dl                 (source._occ_bb_dl),
00415 
00416     _bSmallFeatureCulling   (source._bSmallFeatureCulling),
00417     _smallFeaturesPixels    (source._smallFeaturesPixels),
00418     _smallFeaturesThreshold (source._smallFeaturesThreshold),
00419     _worldToScreenMatrix    (source._worldToScreenMatrix),
00420 
00421     _useGLFinish            (source._useGLFinish),
00422 
00423     _vLights             (source._vLights),
00424     _lightsMap           (source._lightsMap),
00425     _lightsState         (source._lightsState),
00426     _activeLightsState   (source._activeLightsState),
00427     _activeLightsCount   (source._activeLightsCount),
00428     _activeLightsMask    (source._activeLightsMask),
00429 
00430     _lightsTable         (source._lightsTable),
00431     _lightsPath          (source._lightsPath),
00432     _lightEnvsLightsState(source._lightEnvsLightsState),
00433 
00434 
00435     _vClipPlanes            (source._vClipPlanes),
00436     _clipPlanesMap          (source._clipPlanesMap),
00437     _clipPlanesState        (source._clipPlanesState),
00438     _activeClipPlanesState  (source._activeClipPlanesState),
00439     _activeClipPlanesCount  (source._activeClipPlanesCount),
00440     _activeClipPlanesMask   (source._activeClipPlanesMask),
00441 
00442     _clipPlanesTable        (source._clipPlanesTable),
00443     _clipPlanesPath         (source._clipPlanesPath),
00444 
00445     _stateSorting        (source._stateSorting),
00446     _visibilityStack     (source._visibilityStack),
00447 
00448     _occlusionQuery         (source._occlusionQuery),
00449     _occlusionQueriesPool   (source._occlusionQueriesPool),
00450     _occlusionQueries       (source._occlusionQueries),
00451     
00452     _glGenQueriesARB        (source._glGenQueriesARB),
00453     _glDeleteQueriesARB     (source._glDeleteQueriesARB),
00454     _glBeginQueryARB        (source._glBeginQueryARB),
00455     _glEndQueryARB          (source._glEndQueryARB),
00456     _glGetQueryObjectuivARB (source._glGetQueryObjectuivARB),
00457 
00458     _cgfxChunkId(source._cgfxChunkId),
00459     _cgChunkId(source._cgChunkId),
00460     _shlChunkId(source._shlChunkId)
00461 {
00462     _pNodeFactory = new DrawTreeNodeFactory;
00463 }


Member Function Documentation

RenderAction * RenderAction::create ( void   )  [static]

Reimplemented from osg::Action.

Definition at line 468 of file OSGRenderAction.cpp.

References _pPrototype, and RenderAction().

Referenced by osg::SimpleSceneManager::initialize().

00469 {
00470     RenderAction *returnValue;
00471     
00472     if(_pPrototype)
00473     {
00474         returnValue = new RenderAction(*_pPrototype);
00475     }
00476     else
00477     {
00478         returnValue = new RenderAction();
00479     }
00480 
00481     return returnValue;
00482 }

void RenderAction::setPrototype ( RenderAction pPrototype  )  [static]

Definition at line 211 of file OSGRenderAction.cpp.

References _pPrototype.

00212 {
00213     _pPrototype = pPrototype;
00214 }

RenderAction * RenderAction::getPrototype ( void   )  [static]

Reimplemented from osg::Action.

Definition at line 216 of file OSGRenderAction.cpp.

References _pPrototype.

00217 {
00218     return _pPrototype;
00219 }

void RenderAction::registerEnterDefault ( const FieldContainerType type,
const Action::Functor func 
) [static]

void RenderAction::registerLeaveDefault ( const FieldContainerType type,
const Action::Functor func 
) [static]

Action::ResultE RenderAction::start ( void   )  [virtual]

Reimplemented from osg::DrawActionBase.

Definition at line 2299 of file OSGRenderAction.cpp.

References _activeClipPlanesCount, _activeClipPlanesMask, _activeClipPlanesState, _activeLightsCount, _activeLightsMask, _activeLightsState, _arbOcclusionQuery, osg::DrawActionBase::_background, _bSmallFeatureCulling, osg::DrawActionBase::_camera, _camInverse, _clipPlanesMap, _clipPlanesPath, _clipPlanesState, _clipPlanesTable, _currMatrix, _funcBeginQueryARB, _funcDeleteQueriesARB, _funcEndQueryARB, _funcGenQueriesARB, _funcGetQueryObjectuivARB, osg::DrawTreeNode::_iCreateCount, osg::DrawTreeNode::_iDeleteCount, _lightEnvsLightsState, _lightsMap, _lightsPath, _lightsState, _lightsTable, _mMatMap, _ocRoot, _pActiveState, _pMatRoots, _pNodeFactory, _pNoStateSortRoot, _pNoStateSortTransRoot, _pTransMatRoots, _stateSorting, _uiActiveMatrix, _uiMatrixId, _uiNumGeometries, _uiNumLightChanges, _uiNumMaterialChanges, _uiNumMatrixChanges, _uiNumOcclusionCulled, _uiNumOcclusionTests, _uiNumTransGeometries, _vClipPlanes, osg::DrawActionBase::_viewport, _visibilityStack, _vLights, osg::DrawActionBase::_window, _worldToScreenMatrix, osg::Background::clear(), osg::Action::Continue, osg::RenderAction::MatrixStore::first, osg::DrawTreeNodeFactory::freeAll(), osg::Window::getFunction(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::DrawActionBase::getStatistics(), osg::Camera::getViewing(), osg::Camera::getWorldToScreen(), GLenum, glErr, GLsizei, GLuint, osg::Window::hasExtension(), osg::TransformationMatrix< ValueTypeT >::invertFrom(), OSG_APIENTRY, osg::FrustumVolume::P_NONE, osg::StatCollector::reset(), osg::Window::resizeGL(), osg::RenderAction::MatrixStore::second, osg::TransformationMatrix< ValueTypeT >::setIdentity(), osg::Camera::setupProjection(), start, updateTopMatrix(), and void().

02300 {
02301     glErr("RenderAction: precheck");
02302     
02303     Inherited::start();
02304 
02305     if(_window != NULL)
02306     {
02307         _window->resizeGL();
02308     }
02309 
02310     if(_glGenQueriesARB == NULL &&
02311        _window->hasExtension(_arbOcclusionQuery))
02312     {
02313         _glGenQueriesARB          = (void (OSG_APIENTRY*)(GLsizei, GLuint *)) _window->getFunction(_funcGenQueriesARB);
02314         _glDeleteQueriesARB       = (void (OSG_APIENTRY*)(GLsizei, GLuint *)) _window->getFunction(_funcDeleteQueriesARB);
02315         _glBeginQueryARB          = (void (OSG_APIENTRY*)(GLenum, GLuint)) _window->getFunction(_funcBeginQueryARB);
02316         _glEndQueryARB            = (void (OSG_APIENTRY*)(GLenum)) _window->getFunction(_funcEndQueryARB);
02317         _glGetQueryObjectuivARB   = (void (OSG_APIENTRY*)(GLuint, GLenum, GLuint*)) _window->getFunction(_funcGetQueryObjectuivARB);
02318     }
02319 
02320     _uiMatrixId = 1;
02321 
02322     _currMatrix.first = 1;
02323     _currMatrix.second.setIdentity();
02324 
02325     _visibilityStack.clear();
02326     _visibilityStack.push_back(FrustumVolume::P_NONE);
02327     
02328     bool full = false;
02329     
02330     if(_viewport != NULL)
02331     {
02332         if(_camera != NULL)
02333         {
02334             if(_bSmallFeatureCulling)
02335                 _camera->getWorldToScreen(_worldToScreenMatrix, *_viewport);
02336 
02337             _camera->setupProjection(this, *_viewport);
02338 
02339             // set the viewing
02340             
02341             _camera->getViewing(_currMatrix.second, 
02342                                 _viewport->getPixelWidth (),
02343                                 _viewport->getPixelHeight());
02344 
02345             _camInverse.invertFrom(_currMatrix.second);
02346             
02347             glMatrixMode(GL_MODELVIEW);
02348         }
02349 
02350         if(_background != NULL)
02351         {
02352             _background->clear(this, _viewport);
02353         }
02354     }
02355     
02356     updateTopMatrix();
02357 
02358     _mMatMap.clear();
02359 
02360     _pNodeFactory->freeAll();
02361 
02362     /*
02363     if(_pRoot != NULL)
02364     {
02365         fprintf(stderr, "CDN %d DDN %d ODN %d ",
02366                 DrawTreeNode::_iCreateCount,
02367                 DrawTreeNode::_iDeleteCount,
02368                 DrawTreeNode::_iCreateCount - DrawTreeNode::_iDeleteCount);
02369     }
02370     */
02371 
02372     DrawTreeNode::_iCreateCount = 0;
02373     DrawTreeNode::_iDeleteCount = 0;
02374 
02375     _pMatRoots.clear();
02376     _pTransMatRoots.clear();
02377     _pNoStateSortRoot = NULL;
02378     _pNoStateSortTransRoot = NULL;
02379 
02380     _ocRoot.clear();
02381 
02382     _pActiveState   = NULL;
02383 
02384     _uiActiveMatrix = 0;
02385 
02386     _uiNumMaterialChanges = 0;
02387     _uiNumMatrixChanges   = 0;
02388     _uiNumLightChanges    = 0;
02389     _uiNumGeometries      = 0;
02390     _uiNumTransGeometries = 0;
02391     _uiNumOcclusionTests  = 0;
02392     _uiNumOcclusionCulled  = 0;
02393 
02394     getStatistics()->reset();
02395 
02396     _vLights.clear();
02397     _lightsMap.clear();
02398     _lightsState       = 0;
02399     _activeLightsState = 0;
02400     _activeLightsCount = 0;
02401     _activeLightsMask  = 0;
02402 
02403     // for debugging
02404 #if 0
02405     for(UInt32 i=0;i<_lightsTable.size();++i)
02406     {
02407         printf("Lights table: %u : ", i);
02408         for(UInt32 j=0;j<_lightsTable[i].size();++j)
02409         {
02410             printf("%u,", _lightsTable[i][j]);
02411         }
02412         printf("\n");
02413     }
02414 #endif
02415     // -------------
02416 
02417     _lightsTable.clear();
02418     _lightsPath.clear();
02419     _lightEnvsLightsState.clear();
02420 
02421 
02422     _vClipPlanes.clear();
02423     _clipPlanesMap.clear();
02424     _clipPlanesState       = 0;
02425     _activeClipPlanesState = 0;
02426     _activeClipPlanesCount = 0;
02427     _activeClipPlanesMask  = 0;
02428 
02429     _clipPlanesTable.clear();
02430     _clipPlanesPath.clear();
02431 
02432     _stateSorting = true;
02433 
02434     return Action::Continue;
02435 }

Action::ResultE RenderAction::stop ( ResultE  res  )  [virtual]

Reimplemented from osg::DrawActionBase.

Definition at line 2437 of file OSGRenderAction.cpp.

References _activeClipPlanesCount, _activeLightsCount, _activeLightsMask, _bLocalLights, _bOcclusionCulling, _bZWriteTrans, osg::DrawActionBase::_camera, _hier_occlusions, _occluded_nodes, _occlusionCullingMode, _occlusionCullingPixels, _occlusionQueries, _ocRoot, osg::DrawActionBase::_ownStat, _pActiveState, _pMatRoots, _pNoStateSortRoot, _pNoStateSortTransRoot, _pTransMatRoots, _uiActiveMatrix, _uiNumGeometries, _uiNumLightChanges, _uiNumMaterialChanges, _uiNumMatrixChanges, _uiNumOcclusionCulled, _uiNumOcclusionTests, _uiNumTransGeometries, _useGLFinish, osg::DrawActionBase::_viewport, _vLights, osg::AttachmentContainerPtr::dcast(), osg::NodePtr::dcast(), osg::State::deactivate(), draw(), drawHierarchicalMultiFrameOcclusionBB(), drawMultiFrameOcclusionBB(), osg::NodePtr::getCore(), osg::StatCollector::getElem(), osg::FieldContainerPtrBase::getFieldContainerId(), getOcclusionQuery(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::DrawActionBase::getStatistics(), osg::StatTimeElem::getTime(), osg::Color4< ValueTypeT >::getValuesRGBA(), osg::Camera::getViewing(), GL_QUERY_RESULT_ARB, GLuint, hasGeometryChild(), osg::NullFC, OcclusionHierarchicalMultiFrame, OcclusionMultiFrame, OcclusionStopAndWait, resetOcclusionQueryIndex(), osg::ViewportBase::setDrawTime(), setOcclusionMask(), statDrawTime, statNGeometries, statNLights, statNMaterials, statNMatrices, statNOcclusionCulled, statNOcclusionMode, statNOcclusionTests, statNTransGeometries, osg::DrawActionBase::stop(), osg::StatTimeElem::stop(), and osg::FieldContainerFactory::the().

02438 {
02439     getStatistics()->getElem(statDrawTime)->start();
02440     
02441     UInt32 i;
02442 
02443 //    dump(_pMatRoot, 0);
02444 //    dump(_pTransMatRoot, 0);
02445 
02446     //    _pNodeFactory->printStat();    
02447 
02448     if(!_bLocalLights)
02449     {
02450         _activeLightsMask = 0;
02451         for(i = 0; i < _vLights.size(); i++)
02452         {
02453             _activeLightsMask |= (1 << i);
02454             glLoadMatrixf(_vLights[i].second.getValues());
02455             _vLights[i].first->activate(this, i);
02456             ++_uiNumLightChanges;
02457         }
02458     }
02459     else
02460     {
02461         // reset all lights.
02462         const Color4f black(0.0f, 0.0f, 0.0f, 1.0f);
02463         for(i = 0;i < 8;++i)
02464         {
02465             glLightfv(GL_LIGHT0 + i, GL_DIFFUSE,
02466                       black.getValuesRGBA());
02467             glDisable(GL_LIGHT0 + i);
02468         }
02469     }
02470 
02471     // disable all clipping planes.
02472     for(i = 0;i < 6;++i)
02473         glDisable(GL_CLIP_PLANE0 + i);
02474 
02475     glDepthMask(GL_TRUE);
02476 
02477     if(_pNoStateSortRoot != NULL)
02478     {
02479         draw(_pNoStateSortRoot);
02480     }
02481 
02482     if(_bOcclusionCulling && (_occlusionCullingMode & OcclusionStopAndWait) && !_ocRoot.empty())
02483     {
02484         OCMap::reverse_iterator it = _ocRoot.rbegin();
02485         // draw the front most object without occlusion query.
02486         _bOcclusionCulling = false;
02487             draw((*it++).second);
02488         _bOcclusionCulling = true;
02489 
02490         while(it != _ocRoot.rend())
02491             draw((*it++).second);
02492     }
02493 
02494     if(_pNoStateSortTransRoot != NULL)
02495     {
02496         draw(_pNoStateSortTransRoot);
02497     }
02498 
02499     // for multi frame occlusion culling we disable zwrite transparency.
02500     bool bZWriteTrans = _bZWriteTrans;
02501     if(_bOcclusionCulling && (_occlusionCullingMode & OcclusionMultiFrame))
02502         _bZWriteTrans = false;
02503 
02504     SortKeyMap::iterator matRootsIt = _pMatRoots.begin();
02505     TransSortKeyMap::iterator transMatRootsIt = _pTransMatRoots.begin();
02506 
02507     while(matRootsIt != _pMatRoots.end() ||
02508           transMatRootsIt != _pTransMatRoots.end())
02509     {
02510         bool matRootsValid = (matRootsIt != _pMatRoots.end());
02511         bool transMatRootsValid = (transMatRootsIt != _pTransMatRoots.end());
02512 
02513         Int32 matSortKey = matRootsValid ? (*matRootsIt).first : 0;
02514         Int32 transSortKey = transMatRootsValid ? (*transMatRootsIt).first : 0;
02515 
02516         if(matRootsValid)
02517         {
02518             if(transMatRootsValid)
02519             {
02520                 if(matSortKey <= transSortKey)
02521                 {
02522                     //printf("draw opaque %d\n", matSortKey);
02523                     draw((*matRootsIt).second->getFirstChild());
02524                     ++matRootsIt;
02525                 }
02526             }
02527             else
02528             {
02529                 //printf("draw opaque %d\n", matSortKey);
02530                 draw((*matRootsIt).second->getFirstChild());
02531                 ++matRootsIt;
02532             }
02533         }
02534 
02535         if(transMatRootsValid)
02536         {
02537             if(matRootsValid)
02538             {
02539                 if(transSortKey <= matSortKey)
02540                 {
02541                     if(!_bZWriteTrans)
02542                         glDepthMask(GL_FALSE);
02543         
02544                     TransSortMap &ts = (*transMatRootsIt).second;
02545                     for(TransSortMap::iterator it = ts.begin();it != ts.end();++it)
02546                         draw((*it).second);
02547                     //printf("draw transparent %d\n", transSortKey);
02548         
02549                     if(!_bZWriteTrans)
02550                         glDepthMask(GL_TRUE);
02551                     ++transMatRootsIt;
02552                 }
02553             }
02554             else
02555             {
02556                 if(!_bZWriteTrans)
02557                     glDepthMask(GL_FALSE);
02558     
02559                 TransSortMap &ts = (*transMatRootsIt).second;
02560                 for(TransSortMap::iterator it = ts.begin();it != ts.end();++it)
02561                     draw((*it).second);
02562                 //printf("draw transparent %d\n", transSortKey);
02563     
02564                 if(!_bZWriteTrans)
02565                     glDepthMask(GL_TRUE);
02566                 ++transMatRootsIt;
02567             }
02568         }
02569     }
02570 
02571     if(_pActiveState != NULL)
02572     {
02573         State *state = _pActiveState;
02574         // without this the deactivate would be called in
02575         // the next changeFrom call.
02576         _pActiveState = NULL;
02577 
02578         state->deactivate(this);
02579     }
02580 
02581     if(!_bLocalLights)
02582     {
02583         for(i = 0; i < _vLights.size(); ++i)
02584         {
02585             _vLights[i].first->deactivate(this, i);
02586             ++_uiNumLightChanges;
02587         }
02588     }
02589     else
02590     {
02591         const Color4f black(0.0f, 0.0f, 0.0f, 1.0f);
02592         for(i = 0;i < _activeLightsCount;++i)
02593         {
02594             glLightfv(GL_LIGHT0 + i, GL_DIFFUSE,
02595                       black.getValuesRGBA());
02596             glDisable(GL_LIGHT0 + i);
02597         }
02598     }
02599 
02600     for(i = 0;i < _activeClipPlanesCount;++i)
02601         glDisable(GL_CLIP_PLANE0 + i);
02602 
02603     if(_bOcclusionCulling && (_occlusionCullingMode & OcclusionMultiFrame))
02604     {
02605         if(_occlusionCullingMode == OcclusionHierarchicalMultiFrame)
02606         {
02607             // check the hierarchical occlusion queries.
02608             std::vector<UInt32> remove;
02609             for(std::set<UInt32>::iterator it=_hier_occlusions.begin();
02610                 it!=_hier_occlusions.end();++it)
02611             {
02612                 NodePtr node = NodePtr::dcast(FieldContainerFactory::the()->getContainer(*it));
02613                 if(node != NullFC)
02614                 {
02615                     GLuint occlusionQuery = getOcclusionQuery(node);
02616                     if(occlusionQuery == 0)
02617                     {
02618                         setOcclusionMask(node, 0);
02619                         remove.push_back(*it);
02620                         continue;
02621                     }
02622     
02623                     GLuint pixels = 0;
02624                     _glGetQueryObjectuivARB(occlusionQuery, GL_QUERY_RESULT_ARB, &pixels);
02625                     ++_uiNumOcclusionTests;
02626                     //printf("hier occ test: '%s' %d pixels\n", OSG::getName(node), pixels);
02627 
02628                     if(pixels > _occlusionCullingPixels)
02629                     {
02630                         // 0 means not occluded.
02631                         setOcclusionMask(node, 0);
02632                         remove.push_back(*it);
02633                         continue;
02634                     }
02635                     else
02636                     {
02637                         // 2 means occluded leaf, 1 means occluded node.
02638                         node->setOcclusionMask(1);
02639                         // remove all child nodes.
02640                         for(UInt32 i=0;i<node->getNChildren();++i)
02641                             remove.push_back(node->getChild(i).getFieldContainerId());
02642                         _occluded_nodes.push_back(node);
02643                         ++_uiNumOcclusionCulled;
02644                         continue;
02645                     }
02646                 }
02647                 else
02648                 {
02649                     remove.push_back(*it);
02650                 }
02651             }
02652 
02653             // remove invalid, not occluded or occluded child nodes.
02654             for(UInt32 i=0;i<remove.size();++i)
02655                 _hier_occlusions.erase(remove[i]);
02656     
02657             // check the occluded nodes.
02658             for(std::vector<NodePtr>::iterator it=_occluded_nodes.begin();
02659                 it!=_occluded_nodes.end();++it)
02660             {
02661                 NodePtr occluded = (*it);
02662                 NodePtr parent = occluded->getParent();
02663                 if(parent != NullFC)
02664                 {
02665                     bool all_children_occluded = true;
02666 
02667                     // if the parent is a switch node just check the active child!
02668                     bool check_all_childs = false;
02669                     SwitchPtr sw = SwitchPtr::dcast(parent->getCore());
02670                     if(sw != NullFC)
02671                     {
02672                         Int32 choice = sw->getChoice();
02673                         if(choice == -2) // all visible
02674                             check_all_childs = true;
02675                         else if(choice >= 0) // one child visible
02676                         {
02677                             // look for not occluded nodes.
02678                             NodePtr child = parent->getChild(choice);
02679                             if(child != NullFC && child->getOcclusionMask() == 0)
02680                             {
02681                                 // ignore nodes without a geometry child.
02682                                 if(!hasGeometryChild(child))
02683                                     child->setOcclusionMask(1);
02684                                 else
02685                                     all_children_occluded = false;
02686                             }
02687                         }
02688                         // -1 no children visible we do nothing.
02689                     }
02690                     else
02691                     {
02692                         check_all_childs = true;
02693                     }
02694 
02695                     if(check_all_childs)
02696                     {
02697                         for(UInt32 i=0;i<parent->getNChildren();++i)
02698                         {
02699                             // ignore not visible nodes!
02700                             if(!parent->getChild(i)->getActive())
02701                                 continue;
02702     
02703                             // look for not occluded nodes.
02704                             NodePtr child = parent->getChild(i);
02705                             if(child->getOcclusionMask() == 0)
02706                             {
02707                                 // ignore nodes without a geometry child.
02708                                 if(!hasGeometryChild(child))
02709                                 {
02710                                     child->setOcclusionMask(1);
02711                                 }
02712                                 else
02713                                 {
02714                                     all_children_occluded = false;
02715                                     //printf("hier occ not all childs occluded: '%s' '%s'\n", OSG::getName(parent), OSG::getName(parent->getChild(i)));
02716                                     break;
02717                                 }
02718                             }
02719                         }
02720                     }
02721 
02722                     if(all_children_occluded)
02723                     {
02724                         _hier_occlusions.insert(parent.getFieldContainerId());
02725                     }
02726                     else
02727                     {
02728                         parent->setOcclusionMask(0);
02729                     }
02730                 }
02731             }
02732             _occluded_nodes.clear();
02733         } // hierarchical multi frame bounding boxes.
02734 
02735         // restore old value.
02736         _bZWriteTrans = bZWriteTrans;
02737 
02738         _uiActiveMatrix = 0;
02739 
02740         // draw occlusion bounding boxes.
02741         // we check the occlusion results in the next frame!
02742         // -------
02743         glDepthMask(GL_FALSE);
02744         glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
02745 
02746         resetOcclusionQueryIndex();
02747         _occlusionQueries.clear();
02748 
02749         // now draw the bounding boxes of all opaque objects.
02750         matRootsIt = _pMatRoots.begin();
02751         while(matRootsIt != _pMatRoots.end())
02752             drawMultiFrameOcclusionBB((*matRootsIt++).second->getFirstChild());
02753 
02754         // now draw the bounding boxes of all transparent objects.
02755         transMatRootsIt = _pTransMatRoots.begin();
02756         while(transMatRootsIt != _pTransMatRoots.end())
02757         {
02758             TransSortMap &ts = (*transMatRootsIt++).second;
02759             for(TransSortMap::iterator tsit = ts.begin();tsit != ts.end();++tsit)
02760                 drawMultiFrameOcclusionBB((*tsit).second);
02761         }
02762 
02763         if(_occlusionCullingMode == OcclusionHierarchicalMultiFrame)
02764         {
02765             // render hierarchical multi frame bounding boxes.
02766             Matrix view;
02767             if(_camera != NULL)
02768             {
02769                 _camera->getViewing(view, 
02770                                     _viewport->getPixelWidth (),
02771                                     _viewport->getPixelHeight());
02772             }
02773     
02774             for(std::set<UInt32>::iterator it=_hier_occlusions.begin();
02775                 it!=_hier_occlusions.end();++it)
02776             {
02777                 NodePtr node = NodePtr::dcast(FieldContainerFactory::the()->getContainer(*it));
02778                 if(node != NullFC)
02779                     drawHierarchicalMultiFrameOcclusionBB(view, node);
02780             }
02781         }
02782 
02783         glDepthMask(GL_TRUE);
02784         glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
02785 
02786         glFlush();
02787     }
02788 
02789     glDepthMask(GL_TRUE);
02790 
02791     if(_useGLFinish)
02792         glFinish();
02793 
02794     StatTimeElem* elemDraw = getStatistics()->getElem(statDrawTime);
02795     elemDraw->stop();
02796 
02797     _viewport->setDrawTime((Real32)elemDraw->getTime());
02798     if(!_ownStat)
02799     {
02800         getStatistics()->getElem(statNMaterials      )->set(
02801             _uiNumMaterialChanges);
02802         getStatistics()->getElem(statNMatrices       )->set(
02803             _uiNumMatrixChanges);
02804         getStatistics()->getElem(statNLights       )->set(
02805             _uiNumLightChanges);
02806         getStatistics()->getElem(statNGeometries     )->set(
02807             _uiNumGeometries);
02808         getStatistics()->getElem(statNTransGeometries)->set(
02809             _uiNumTransGeometries);
02810         getStatistics()->getElem(statNOcclusionTests )->set(
02811             _uiNumOcclusionTests);
02812         getStatistics()->getElem(statNOcclusionCulled )->set(
02813             _uiNumOcclusionCulled);
02814 
02815         if(_bOcclusionCulling)
02816         {
02817             if(_occlusionCullingMode == OcclusionStopAndWait)
02818             {
02819                 getStatistics()->getElem(statNOcclusionMode)->set(
02820                 "Stop And Wait");
02821             }
02822             else if(_occlusionCullingMode == OcclusionMultiFrame)
02823             {
02824                 getStatistics()->getElem(statNOcclusionMode)->set(
02825                 "Multi Frame");
02826             }
02827             else if(_occlusionCullingMode == OcclusionHierarchicalMultiFrame)
02828             {
02829                 getStatistics()->getElem(statNOcclusionMode)->set(
02830                 "Hier. Multi Frame");
02831             }
02832         }
02833         else
02834         {
02835             getStatistics()->getElem(statNOcclusionMode)->set(
02836                 "Off");
02837         }
02838     }
02839 
02840 
02841 //    FINFO (("Material %d Matrix %d Light %d Geometry %d Transparent %d\r",
02842 //            _uiNumMaterialChanges,
02843 //            _uiNumMatrixChanges,
02844 //            _uiNumLightChanges,
02845 //            _uiNumGeometries,
02846 //            _uiNumTransGeometries));
02847 
02848     Inherited::stop(res);
02849     return res;
02850 }

void RenderAction::push_matrix ( const Matrix matrix  ) 

Definition at line 2852 of file OSGRenderAction.cpp.

References _currMatrix, _uiMatrixId, _vMatrixStack, osg::RenderAction::MatrixStore::first, osg::TransformationMatrix< ValueTypeT >::mult(), osg::RenderAction::MatrixStore::second, and updateTopMatrix().

Referenced by osg::Transform::renderEnter(), osg::ScreenGroup::renderEnter(), osg::InverseTransform::renderEnter(), and osg::Billboard::renderEnter().

02853 {
02854     _vMatrixStack.push_back(_currMatrix);
02855     
02856 #ifdef PRINT_MAT
02857     fprintf(stderr, "pushed %d\n", _currMatrix.first);
02858 
02859     for(int i = 0; i < 4; i++)
02860     {
02861         fprintf(stderr, "% 5.2f % 5.2f % 5.2f % 5.2f\n",
02862                 _currMatrix.second[i][0],
02863                 _currMatrix.second[i][1],
02864                 _currMatrix.second[i][2],
02865                 _currMatrix.second[i][3]);
02866     }
02867 #endif
02868 
02869     _currMatrix.first = ++_uiMatrixId;
02870     _currMatrix.second.mult(matrix);
02871     updateTopMatrix();
02872     
02873 #ifdef PRINT_MAT
02874     fprintf(stderr, "current %d\n", _currMatrix.first);
02875 
02876     for(int i = 0; i < 4; i++)
02877     {
02878         fprintf(stderr, "% 5.2f % 5.2f % 5.2f % 5.2f\n",
02879                 _currMatrix.second[i][0],
02880                 _currMatrix.second[i][1],
02881                 _currMatrix.second[i][2],
02882                 _currMatrix.second[i][3]);
02883     }
02884 #endif
02885 }

void RenderAction::pop_matrix ( void   ) 

Definition at line 2887 of file OSGRenderAction.cpp.

References _currMatrix, _vMatrixStack, osg::RenderAction::MatrixStore::first, and osg::RenderAction::MatrixStore::second.

Referenced by osg::Transform::renderLeave(), osg::ScreenGroup::renderLeave(), osg::InverseTransform::renderLeave(), and osg::Billboard::renderLeave().

02888 {
02889 #ifdef PRINT_MAT
02890     fprintf(stderr, "pop %d\n", _currMatrix.first);
02891 
02892     for(int i = 0; i < 4; i++)
02893     {
02894         fprintf(stderr, "% 5.2f % 5.2f % 5.2f % 5.2f\n",
02895                 _currMatrix.second[i][0],
02896                 _currMatrix.second[i][1],
02897                 _currMatrix.second[i][2],
02898                 _currMatrix.second[i][3]);
02899     }
02900 #endif
02901 
02902     _currMatrix  = _vMatrixStack.back();
02903 
02904     _vMatrixStack.pop_back();
02905 
02906 #ifdef PRINT_MAT
02907     fprintf(stderr, "current %d\n", _currMatrix.first);
02908 
02909     for(int i = 0; i < 4; i++)
02910     {
02911         fprintf(stderr, "% 5.2f % 5.2f % 5.2f % 5.2f\n",
02912                 _currMatrix.second[i][0],
02913                 _currMatrix.second[i][1],
02914                 _currMatrix.second[i][2],
02915                 _currMatrix.second[i][3]);
02916     }
02917 #endif
02918 }

const Matrix & osg::RenderAction::top_matrix ( void   )  [inline]

void RenderAction::dropGeometry ( Geometry pGeo  ) 

Definition at line 554 of file OSGRenderAction.cpp.

References _bSortTrans, _clipPlanesState, _currMatrix, _lightsState, _mMatMap, _pMatRoots, _pNodeFactory, _pNoStateSortRoot, _pNoStateSortTransRoot, _pTransMatRoots, _stateSorting, _uiNumTransGeometries, osg::DrawTreeNode::addChild(), osg::DrawTreeNodeFactory::create(), osg::Action::getActNode(), osg::AttachmentContainerPtr::getCPtr(), osg::MaterialDrawableBase::getMaterial(), osg::DrawActionBase::getMaterial(), getMaterialStates(), osg::Material::getRealSortKey(), osg::DrawTreeNode::getScalar(), osg::Material::isMultiPass(), osg::Material::isTransparent(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::Material::NoStateSorting, osg::NullFC, osg::Material::rebuildState(), osg::RenderAction::MatrixStore::second, osg::DrawTreeNode::setClipPlanesState(), osg::DrawTreeNode::setGeometry(), osg::DrawTreeNode::setLastMultiPass(), osg::DrawTreeNode::setLightsState(), osg::DrawTreeNode::setMatrixStore(), osg::DrawTreeNode::setMultiPass(), osg::DrawTreeNode::setNode(), osg::DrawTreeNode::setNoStateSorting(), osg::DrawTreeNode::setScalar(), and osg::DrawTreeNode::setState().

00555 {
00556     Material *pMat;
00557     State    *pState;
00558 
00559     if(pGeo == NULL)
00560     {
00561         return;
00562     }
00563 
00564     if(getMaterial() != NULL)
00565     {
00566         pMat = getMaterial();
00567     }
00568     else if(pGeo->getMaterial() != NullFC)
00569     {
00570         pMat = pGeo->getMaterial().getCPtr();
00571     }
00572     else
00573     {
00574         return;
00575     }
00576 
00577     std::vector<State *> states;
00578     getMaterialStates(pMat, states);
00579 
00580     UInt32 mpMatPasses = states.size();
00581     bool isMultiPass = (mpMatPasses > 1) || pMat->isMultiPass();
00582 
00583     Int32 sortKey = pMat->getRealSortKey();
00584 
00585     if(!_stateSorting ||
00586        (sortKey == Material::NoStateSorting && 
00587         (!_bSortTrans || !pMat->isTransparent())))
00588     {
00589         for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
00590         {
00591             pState = states[mpi];
00592 
00593             DrawTreeNode *pNewElem = _pNodeFactory->create();
00594     
00595             pNewElem->setNode       (getActNode());
00596             pNewElem->setGeometry   (pGeo);
00597             pNewElem->setMatrixStore(_currMatrix);
00598             pNewElem->setLightsState(_lightsState);
00599             pNewElem->setClipPlanesState(_clipPlanesState);
00600             pNewElem->setState(pState);
00601             if(sortKey == Material::NoStateSorting)
00602                 pNewElem->setNoStateSorting();
00603         
00604             if(isMultiPass)
00605             {
00606                 if(mpi == mpMatPasses-1)
00607                     pNewElem->setLastMultiPass();
00608                 else
00609                     pNewElem->setMultiPass();
00610             }
00611 
00612             if(!pMat->isTransparent())
00613             {
00614                 if(_pNoStateSortRoot == NULL)
00615                     _pNoStateSortRoot = pNewElem;
00616                 else
00617                     _pNoStateSortRoot->addChild(pNewElem);
00618             }
00619             else
00620             {
00621                 if(_pNoStateSortTransRoot == NULL)
00622                     _pNoStateSortTransRoot = pNewElem;
00623                 else
00624                     _pNoStateSortTransRoot->addChild(pNewElem);
00625             }
00626         }
00627         return;
00628     }
00629 
00630     MaterialMap::iterator it        = _mMatMap.find(pMat);
00631 
00632 #if 0
00633     pMat->rebuildState();
00634 #endif
00635 
00636     if(sortKey == Material::NoStateSorting)
00637         sortKey = 0;
00638 
00639     DrawTreeNode *pLastMultiPass = NULL;
00640 
00641     for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
00642     {
00643         pState = states[mpi];
00644 
00645         if(_bSortTrans && pMat->isTransparent())
00646         {
00647             DrawTreeNode *pNewElem = _pNodeFactory->create();
00648             Pnt3f         objPos;
00649             getActNode()->getVolume().getCenter(objPos);
00650 
00651             _currMatrix.second.mult(objPos);
00652 
00653             pNewElem->setNode       (getActNode());
00654                 
00655             pNewElem->setGeometry   (pGeo);
00656             pNewElem->setMatrixStore(_currMatrix);
00657                 
00658             pNewElem->setState      (pState);
00659             pNewElem->setScalar     (objPos[2]);
00660             pNewElem->setLightsState(_lightsState);
00661             pNewElem->setClipPlanesState(_clipPlanesState);
00662 
00663             if(isMultiPass)
00664             {
00665                 if(mpi == mpMatPasses-1)
00666                     pNewElem->setLastMultiPass();
00667                 else
00668                     pNewElem->setMultiPass();
00669             }
00670 
00671             if(_pTransMatRoots.find(sortKey) == _pTransMatRoots.end())
00672             {
00673                 TransSortMap ts;
00674                 _pTransMatRoots.insert(std::make_pair(sortKey, ts));
00675             }
00676 
00677             TransSortMap &ts = _pTransMatRoots[sortKey];
00678             TransSortMap::iterator it = ts.find(pNewElem->getScalar());
00679             if(it == ts.end())
00680                 ts.insert(std::make_pair(pNewElem->getScalar(), pNewElem));
00681             else
00682                 (*it).second->addChild(pNewElem);
00683 
00684             _uiNumTransGeometries++;
00685         }
00686         else
00687         {
00688             DrawTreeNode *pNewElem = _pNodeFactory->create();
00689      
00690             if(it == _mMatMap.end())
00691             {
00692                 DrawTreeNode *pNewMatElem = _pNodeFactory->create();
00693     
00694                 //_mMatMap[pMat].push_back(pNewMatElem);
00695                 _mMatMap[pMat] = pNewMatElem;
00696                 
00697                 pNewElem->setNode       (getActNode());
00698                 pNewElem->setGeometry   (pGeo);
00699                 pNewElem->setMatrixStore(_currMatrix);
00700                 pNewElem->setLightsState(_lightsState);
00701                 pNewElem->setClipPlanesState(_clipPlanesState);
00702     
00703                 if(isMultiPass)
00704                 {
00705                     // for multipass we have a different state in all draw node
00706                     // children.
00707                     pNewElem->setState(pState);
00708 
00709                     if(mpi == mpMatPasses-1)
00710                         pNewElem->setLastMultiPass();
00711                     else
00712                         pNewElem->setMultiPass();
00713                 }
00714                 else
00715                 {
00716                     // for non multipass materials there is only one state
00717                     // for all draw node children.
00718                     pNewMatElem->setState(pState);
00719                 }
00720 
00721                 pNewMatElem->addChild(pNewElem);
00722                 pNewMatElem->setNode(getActNode());
00723                 pNewMatElem->setLightsState(_lightsState);
00724                 pNewMatElem->setClipPlanesState(_clipPlanesState);
00725 
00726                 if(_pMatRoots.find(sortKey) == _pMatRoots.end())
00727                     _pMatRoots.insert(std::make_pair(sortKey, _pNodeFactory->create()));
00728 
00729                 _pMatRoots[sortKey]->addChild(pNewMatElem);
00730             }
00731             else
00732             {
00733                 pNewElem->setNode       (getActNode());
00734                 pNewElem->setGeometry   (pGeo);
00735                 pNewElem->setMatrixStore(_currMatrix);
00736                 pNewElem->setLightsState(_lightsState);
00737                 pNewElem->setClipPlanesState(_clipPlanesState);
00738     
00739                 if(isMultiPass)
00740                 {
00741                     pNewElem->setState(pState);
00742 
00743                     if(mpi == mpMatPasses-1)
00744                         pNewElem->setLastMultiPass();
00745                     else
00746                         pNewElem->setMultiPass();
00747                 }
00748 
00749                 it->second->addChild(pNewElem);
00750             }
00751         }
00752     } // multipass
00753 }

void RenderAction::dropFunctor ( Material::DrawFunctor func,
Material mat 
)

Definition at line 755 of file OSGRenderAction.cpp.

References _bOcclusionCulling, _bSortTrans, _clipPlanesState, _currMatrix, _lightsState, _mMatMap, _occlusionCullingMode, _ocRoot, _pMatRoots, _pNodeFactory, _pNoStateSortRoot, _pNoStateSortTransRoot, _pTransMatRoots, _stateSorting, _uiNumTransGeometries, osg::DrawTreeNode::addChild(), osg::DrawTreeNodeFactory::create(), osg::Action::getActNode(), osg::DrawTreeNode::getBrother(), osg::DrawActionBase::getMaterial(), getMaterialStates(), osg::Volume::getMax(), osg::Material::getRealSortKey(), osg::DrawTreeNode::getScalar(), osg::Material::isMultiPass(), osg::Material::isTransparent(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::Material::NoStateSorting, OcclusionStopAndWait, osg::Material::rebuildState(), osg::RenderAction::MatrixStore::second, osg::DrawTreeNode::setClipPlanesState(), osg::DrawTreeNode::setFunctor(), osg::DrawTreeNode::setLastMultiPass(), osg::DrawTreeNode::setLightsState(), osg::DrawTreeNode::setMatrixStore(), osg::DrawTreeNode::setMultiPass(), osg::DrawTreeNode::setNode(), osg::DrawTreeNode::setNoStateSorting(), osg::DrawTreeNode::setScalar(), osg::DrawTreeNode::setState(), and osg::DynamicVolume::transform().

Referenced by VolumeDrawWrapper::drop(), osg::DVRVolume::render(), and osg::MaterialDrawable::renderActionHandler().

00756 {
00757     Material *pMat;
00758     State    *pState;
00759 
00760     if(getMaterial() != NULL)
00761     {
00762         pMat = getMaterial();
00763     }
00764     else if(mat != NULL)
00765     {
00766         pMat = mat;
00767     }
00768     else
00769     {
00770         return;
00771     }
00772 
00773     std::vector<State *> states;
00774     getMaterialStates(pMat, states);
00775 
00776     UInt32 mpMatPasses = states.size();
00777     bool isMultiPass = (mpMatPasses > 1) || pMat->isMultiPass();
00778 
00779     Int32 sortKey = pMat->getRealSortKey();
00780 
00781     if(_bOcclusionCulling && (_occlusionCullingMode & OcclusionStopAndWait) && _stateSorting)
00782     {
00783         DrawTreeNode *pLastMultiPass = NULL;
00784         for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
00785         {
00786             pState = states[mpi];
00787 
00788             DrawTreeNode *pNewElem = _pNodeFactory->create();
00789 
00790             pNewElem->setNode       (getActNode());
00791             pNewElem->setFunctor    (func);
00792             pNewElem->setMatrixStore(_currMatrix);
00793             pNewElem->setLightsState(_lightsState);
00794             pNewElem->setClipPlanesState(_clipPlanesState);
00795             pNewElem->setState      (pState);
00796             if(sortKey == Material::NoStateSorting)
00797                 pNewElem->setNoStateSorting();
00798 
00799             if(isMultiPass)
00800             {
00801                 if(mpi == mpMatPasses-1)
00802                     pNewElem->setLastMultiPass();
00803                 else
00804                     pNewElem->setMultiPass();
00805             }
00806 
00807             if(!pMat->isTransparent())
00808             {
00809                 if(sortKey == 0)
00810                 {
00811                     Pnt3f objPos;
00812                     //const Volume &vol = getActNode()->getVolume();
00813                     //vol.getCenter(objPos);
00814                     //_currMatrix.second.mult(objPos);
00815 
00816                     // we don't want the center we use the front most
00817                     // z value for the sorting.
00818                     DynamicVolume vol = getActNode()->getVolume();
00819                     vol.transform(_currMatrix.second);
00820                     objPos = vol.getMax();
00821 
00822                     pNewElem->setScalar(objPos[2]);
00823 
00824                     OCMap::iterator it = _ocRoot.find(pNewElem->getScalar());
00825                     if(it == _ocRoot.end())
00826                         _ocRoot.insert(std::make_pair(pNewElem->getScalar(), pNewElem));
00827                     else
00828                         (*it).second->addChild(pNewElem);
00829                 }
00830                 else
00831                 {
00832                     if(_pMatRoots.find(sortKey) == _pMatRoots.end())
00833                         _pMatRoots.insert(std::make_pair(sortKey, _pNodeFactory->create()));
00834 
00835                     _pMatRoots[sortKey]->addChild(pNewElem);
00836                 }
00837             }
00838             else
00839             {
00840                 if(_bSortTrans)
00841                 {
00842                     Pnt3f objPos;
00843                     getActNode()->getVolume().getCenter(objPos);
00844                     _currMatrix.second.mult(objPos);
00845                     pNewElem->setScalar(objPos[2]);
00846 
00847                     if(isMultiPass)
00848                     {
00849                         if(mpi == mpMatPasses-1)
00850                             pNewElem->setLastMultiPass();
00851                         else
00852                             pNewElem->setMultiPass();
00853                     }
00854         
00855                     if(_pTransMatRoots.find(sortKey) == _pTransMatRoots.end())
00856                     {
00857                         TransSortMap ts;
00858                         _pTransMatRoots.insert(std::make_pair(sortKey, ts));
00859                     }
00860         
00861                     TransSortMap &ts = _pTransMatRoots[sortKey];
00862                     TransSortMap::iterator it = ts.find(pNewElem->getScalar());
00863                     if(it == ts.end())
00864                         ts.insert(std::make_pair(pNewElem->getScalar(), pNewElem));
00865                     else
00866                         (*it).second->addChild(pNewElem);
00867 
00868                     _uiNumTransGeometries++;
00869                 }
00870                 else
00871                 {
00872                     if(_pNoStateSortTransRoot == NULL)
00873                         _pNoStateSortTransRoot = pNewElem;
00874                     else
00875                         _pNoStateSortTransRoot->addChild(pNewElem);
00876                 }
00877             }
00878         }
00879         return;
00880     }
00881 
00882     if(!_stateSorting ||
00883        (sortKey == Material::NoStateSorting && 
00884         (!_bSortTrans || !pMat->isTransparent())))
00885     {
00886         for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
00887         {
00888             pState = states[mpi];
00889 
00890             DrawTreeNode *pNewElem = _pNodeFactory->create();
00891 
00892             pNewElem->setNode       (getActNode());
00893             pNewElem->setFunctor    (func);
00894             pNewElem->setMatrixStore(_currMatrix);
00895             pNewElem->setLightsState(_lightsState);
00896             pNewElem->setClipPlanesState(_clipPlanesState);
00897             pNewElem->setState(pState);
00898             if(sortKey == Material::NoStateSorting)
00899                 pNewElem->setNoStateSorting();
00900 
00901             if(isMultiPass)
00902             {
00903                 if(mpi == mpMatPasses-1)
00904                     pNewElem->setLastMultiPass();
00905                 else
00906                     pNewElem->setMultiPass();
00907             }
00908 
00909             if(!pMat->isTransparent())
00910             {
00911                 if(_pNoStateSortRoot == NULL)
00912                     _pNoStateSortRoot = pNewElem;
00913                 else
00914                     _pNoStateSortRoot->addChild(pNewElem);
00915             }
00916             else
00917             {
00918                 if(_pNoStateSortTransRoot == NULL)
00919                     _pNoStateSortTransRoot = pNewElem;
00920                 else
00921                     _pNoStateSortTransRoot->addChild(pNewElem);
00922             }
00923         }
00924 
00925         return;
00926     }
00927 
00928     MaterialMap::iterator it        = _mMatMap.find(pMat);
00929 
00930 #if 0
00931     pMat->rebuildState();
00932 #endif
00933 
00934     if(sortKey == Material::NoStateSorting)
00935         sortKey = 0;
00936 
00937     DrawTreeNode *pLastMultiPass = NULL;
00938 
00939     if(_bSortTrans && pMat->isTransparent())
00940     {
00941         for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
00942         {
00943             pState = states[mpi];
00944 
00945             DrawTreeNode *pNewElem = _pNodeFactory->create();
00946             Pnt3f         objPos;
00947             getActNode()->getVolume().getCenter(objPos);
00948 
00949             _currMatrix.second.mult(objPos);
00950 
00951             pNewElem->setNode       (getActNode());
00952                 
00953             pNewElem->setFunctor    (func);
00954             pNewElem->setMatrixStore(_currMatrix);
00955                 
00956             pNewElem->setState      (pState);
00957             pNewElem->setScalar     (objPos[2]);
00958             pNewElem->setLightsState(_lightsState);
00959             pNewElem->setClipPlanesState(_clipPlanesState);
00960 
00961             if(isMultiPass)
00962             {
00963                 if(mpi == mpMatPasses-1)
00964                     pNewElem->setLastMultiPass();
00965                 else
00966                     pNewElem->setMultiPass();
00967             }
00968 
00969             if(_pTransMatRoots.find(sortKey) == _pTransMatRoots.end())
00970             {
00971                 TransSortMap ts;
00972                 _pTransMatRoots.insert(std::make_pair(sortKey, ts));
00973             }
00974 
00975             TransSortMap &ts = _pTransMatRoots[sortKey];
00976             TransSortMap::iterator it = ts.find(pNewElem->getScalar());
00977             if(it == ts.end())
00978                 ts.insert(std::make_pair(pNewElem->getScalar(), pNewElem));
00979             else
00980                 (*it).second->addChild(pNewElem);
00981 
00982             _uiNumTransGeometries++;
00983         }
00984     }
00985     else
00986     {
00987         if(it == _mMatMap.end())
00988         {
00989             DrawTreeNode *pNewMatElem = _pNodeFactory->create();
00990             _mMatMap[pMat] = pNewMatElem;
00991 
00992             if(!isMultiPass)
00993             {
00994                 pState = states[0];
00995                 // for non multipass materials there is only one state
00996                 // for all draw node children.
00997                 pNewMatElem->setState(pState);
00998                 pNewMatElem->setNode(getActNode());
00999                 pNewMatElem->setLightsState(_lightsState);
01000                 pNewMatElem->setClipPlanesState(_clipPlanesState);
01001 
01002                 DrawTreeNode *pNewElem = _pNodeFactory->create();
01003                 pNewElem->setNode       (getActNode());
01004                 pNewElem->setFunctor    (func);
01005                 pNewElem->setMatrixStore(_currMatrix);
01006                 pNewElem->setLightsState(_lightsState);
01007                 pNewElem->setClipPlanesState(_clipPlanesState);
01008 
01009                 pNewMatElem->addChild(pNewElem);
01010 
01011                 if(_pMatRoots.find(sortKey) == _pMatRoots.end())
01012                     _pMatRoots.insert(std::make_pair(sortKey, _pNodeFactory->create()));
01013 
01014                 _pMatRoots[sortKey]->addChild(pNewMatElem);
01015             }
01016             else
01017             {
01018                 pNewMatElem->setNode(getActNode());
01019                 pNewMatElem->setLightsState(_lightsState);
01020                 pNewMatElem->setClipPlanesState(_clipPlanesState);
01021 
01022                 for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
01023                 {
01024                     pState = states[mpi];
01025 
01026                     DrawTreeNode *pNewPassElem = _pNodeFactory->create();
01027                     pNewPassElem->setState(pState);
01028                     pNewPassElem->setNode(getActNode());
01029                     pNewPassElem->setLightsState(_lightsState);
01030                     pNewPassElem->setClipPlanesState(_clipPlanesState);
01031                     pNewMatElem->addChild(pNewPassElem);
01032 
01033                     DrawTreeNode *pNewElem = _pNodeFactory->create();
01034                     pNewElem->setNode       (getActNode());
01035                     pNewElem->setFunctor    (func);
01036                     pNewElem->setMatrixStore(_currMatrix);
01037                     pNewElem->setLightsState(_lightsState);
01038                     pNewElem->setClipPlanesState(_clipPlanesState);
01039 
01040                     if(isMultiPass)
01041                     {
01042                         if(mpi == mpMatPasses-1)
01043                             pNewElem->setLastMultiPass();
01044                         else
01045                             pNewElem->setMultiPass();
01046                     }
01047 
01048                     pNewPassElem->addChild(pNewElem);
01049                 }
01050 
01051                 if(_pMatRoots.find(sortKey) == _pMatRoots.end())
01052                     _pMatRoots.insert(std::make_pair(sortKey, _pNodeFactory->create()));
01053 
01054                 _pMatRoots[sortKey]->addChild(pNewMatElem);
01055             }
01056         }
01057         else
01058         {
01059             if(!isMultiPass)
01060             {
01061                 DrawTreeNode *pNewElem = _pNodeFactory->create();
01062                 pNewElem->setNode       (getActNode());
01063                 pNewElem->setFunctor    (func);
01064                 pNewElem->setMatrixStore(_currMatrix);
01065                 pNewElem->setLightsState(_lightsState);
01066                 pNewElem->setClipPlanesState(_clipPlanesState);
01067                 it->second->addChild(pNewElem);
01068             }
01069             else
01070             {
01071                 // for two passes it looks like this.
01072                 //      root
01073                 //     /    \
01074                 //  state1  state2
01075                 //   / \ \    / \ \
01076                 //  n1 n2 nx n1 n2 nx
01077 
01078                 DrawTreeNode *pNewPassElem = it->second->getFirstChild();
01079                 for(UInt32 mpi=0;mpi<mpMatPasses;++mpi)
01080                 {
01081                     DrawTreeNode *pNewElem = _pNodeFactory->create();
01082                     pNewElem->setNode       (getActNode());
01083                     pNewElem->setFunctor    (func);
01084                     pNewElem->setMatrixStore(_currMatrix);
01085                     pNewElem->setLightsState(_lightsState);
01086                     pNewElem->setClipPlanesState(_clipPlanesState);
01087 
01088                     if(isMultiPass)
01089                     {
01090                         if(mpi == mpMatPasses-1)
01091                             pNewElem->setLastMultiPass();
01092                         else
01093                             pNewElem->setMultiPass();
01094                     }
01095 
01096                     pNewPassElem->addChild(pNewElem);
01097                     pNewPassElem = pNewPassElem->getBrother();
01098                 }
01099             }
01100         }
01101     }
01102 }

void RenderAction::dropLight ( Light pLight  ) 

Definition at line 1104 of file OSGRenderAction.cpp.

References _bLocalLights, _camInverse, _currMatrix, _lightsMap, _lightsPath, _lightsState, _lightsTable, _vLights, osg::LightBase::getBeacon(), osg::Light::getChunk(), osg::AttachmentPtr::getCPtr(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::Light::makeChunk(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::NullFC, osg::RenderAction::MatrixStore::second, SINFO, and SWARNING.

Referenced by osg::Light::renderEnter().

01105 {
01106     if(pLight == NULL)
01107         return;
01108 
01109     LightStore oStore;
01110 
01111     pLight->makeChunk();
01112 
01113     oStore.first  =  pLight->getChunk().getCPtr();
01114 //    oStore.second = _currMatrix.second;
01115 
01116     Matrix fromworld,tobeacon;
01117     
01118 //        getActNode()->getToWorld(fromworld);
01119 
01120 //    fromworld = top_matrix();
01121 
01122     NodePtr beacon = pLight->getBeacon();
01123 
01124     if(beacon == NullFC)
01125     {
01126         SINFO << "draw: no beacon set!" << std::endl;
01127 
01128         oStore.second = _currMatrix.second;
01129     }
01130     else
01131     {
01132         fromworld = _camInverse;
01133         fromworld.invert();
01134 
01135         beacon->getToWorld(tobeacon);
01136 
01137 //        tobeacon.mult(fromworld);
01138         
01139         fromworld.mult(tobeacon);
01140 
01141         oStore.second = fromworld;
01142     }
01143 
01144     if(!_bLocalLights && _vLights.size() >= 8)
01145     {
01146         SWARNING << "RenderAction::dropLight: maximum light source limit is " <<  8
01147                  << " skipping light sources!" << std::endl;
01148     }
01149 
01150     _vLights.push_back(oStore);
01151     _lightsMap.push_back(pLight);
01152 
01153     if(_bLocalLights)
01154     {
01155         // light id's are in the range from 1 - N
01156         UInt32 lightState = _vLights.size();
01157         _lightsPath.push_back(lightState);
01158         // add current lights path to the lights table.
01159         _lightsTable.push_back(_lightsPath);
01160         _lightsState = lightState;
01161     }
01162 }

void RenderAction::undropLight ( Light pLight  ) 

Definition at line 1164 of file OSGRenderAction.cpp.

References _bLocalLights, _lightEnvsLightsState, _lightsPath, and _lightsState.

Referenced by osg::Light::renderLeave().

01165 {
01166     if(pLight == NULL)
01167         return;
01168 
01169     if(!_bLocalLights)
01170         return;
01171 
01172     if(_lightEnvsLightsState.empty())
01173     {
01174         _lightsPath.pop_back();
01175         if(!_lightsPath.empty())
01176             _lightsState = _lightsPath.back();
01177         else
01178             _lightsState = 0;
01179     }
01180 }

void RenderAction::dropLightEnv ( LightEnv pLightEnv  ) 

Definition at line 1182 of file OSGRenderAction.cpp.

References _bLocalLights, _lightEnvsLightsState, and _lightsState.

Referenced by osg::LightEnv::renderEnter().

01183 {
01184     if(pLightEnv == NULL)
01185         return;
01186 
01187     if(!_bLocalLights)
01188         return;
01189 
01190     _lightEnvsLightsState.push_back(_lightsState);
01191 }

void RenderAction::undropLightEnv ( LightEnv pLightEnv  ) 

Definition at line 1193 of file OSGRenderAction.cpp.

References _bLocalLights, _lightEnvsLightsState, _lightsPath, _lightsState, and _lightsTable.

Referenced by osg::LightEnv::renderLeave().

01194 {
01195     if(pLightEnv == NULL)
01196         return;
01197 
01198     if(!_bLocalLights)
01199         return;
01200 
01201     _lightsState = _lightEnvsLightsState.back();
01202     if(_lightsState > 0)
01203         _lightsPath = _lightsTable[_lightsState - 1];
01204     else
01205         _lightsPath.clear();
01206     _lightEnvsLightsState.pop_back();
01207 }

void RenderAction::dropClipPlane ( ClipPlane pClipPlane  ) 

Definition at line 1233 of file OSGRenderAction.cpp.

References _camInverse, _clipPlanesMap, _clipPlanesPath, _clipPlanesState, _clipPlanesTable, _currMatrix, _vClipPlanes, osg::ClipPlaneBase::getBeacon(), osg::ClipPlane::getChunk(), osg::AttachmentPtr::getCPtr(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::ClipPlane::makeChunk(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::NullFC, osg::RenderAction::MatrixStore::second, and SINFO.

Referenced by osg::ClipPlane::renderEnter().

01234 {
01235     if(pClipPlane == NULL)
01236         return;
01237 
01238     ClipPlaneStore oStore;
01239 
01240     pClipPlane->makeChunk();
01241 
01242     oStore.first  =  pClipPlane->getChunk().getCPtr();
01243 //    oStore.second = _currMatrix.second;
01244 
01245     Matrix fromworld,tobeacon;
01246     
01247 //        getActNode()->getToWorld(fromworld);
01248 
01249 //    fromworld = top_matrix();
01250 
01251     NodePtr beacon = pClipPlane->getBeacon();
01252 
01253     if(beacon == NullFC)
01254     {
01255         SINFO << "draw: no beacon set!" << std::endl;
01256 
01257         oStore.second = _currMatrix.second;
01258     }
01259     else
01260     {
01261         fromworld = _camInverse;
01262         fromworld.invert();
01263 
01264         beacon->getToWorld(tobeacon);
01265 
01266 //        tobeacon.mult(fromworld);
01267         
01268         fromworld.mult(tobeacon);
01269 
01270         oStore.second = fromworld;
01271     }
01272 
01273     _vClipPlanes.push_back(oStore);
01274     _clipPlanesMap.push_back(pClipPlane);
01275 
01276     // clip plane id's are in the range from 1 - N
01277     UInt32 clipPlaneState = _vClipPlanes.size();
01278     _clipPlanesPath.push_back(clipPlaneState);
01279     // add current clip planes path to the lights table.
01280     _clipPlanesTable.push_back(_clipPlanesPath);
01281     _clipPlanesState = clipPlaneState;
01282 }

void RenderAction::undropClipPlane ( ClipPlane pClipPlane  ) 

Definition at line 1284 of file OSGRenderAction.cpp.

References _clipPlanesPath, and _clipPlanesState.

Referenced by osg::ClipPlane::renderLeave().

01285 {
01286     if(pClipPlane == NULL)
01287         return;
01288 
01289     _clipPlanesPath.pop_back();
01290     if(!_clipPlanesPath.empty())
01291         _clipPlanesState = _clipPlanesPath.back();
01292     else
01293         _clipPlanesState = 0;
01294 }

void osg::RenderAction::setStateSorting ( bool  s  )  [inline]

Definition at line 123 of file OSGRenderAction.inl.

References _stateSorting.

Referenced by osg::StateSortingGroup::renderEnter(), and osg::StateSortingGroup::renderLeave().

00124 {
00125     _stateSorting = s;
00126 }

bool osg::RenderAction::getStateSorting ( void   )  [inline]

Definition at line 129 of file OSGRenderAction.inl.

References _stateSorting.

Referenced by osg::StateSortingGroup::renderEnter().

00130 {
00131     return _stateSorting;
00132 }

std::vector< Light * > RenderAction::getActiveLights ( void   ) 

Definition at line 1209 of file OSGRenderAction.cpp.

References _activeLightsState, _bLocalLights, _lightsMap, and _lightsTable.

01210 {
01211     std::vector<Light *> lights;
01212     if(_bLocalLights)
01213     {
01214         if(_activeLightsState > 0)
01215         {
01216             const std::vector<UInt32> &light_ids = _lightsTable[_activeLightsState - 1];
01217         
01218             for(UInt32 i=0;i<light_ids.size();++i)
01219             {
01220                 UInt32 light_id = light_ids[i];
01221                 if(light_id > 0 && light_id <= _lightsMap.size())
01222                     lights.push_back(_lightsMap[light_id - 1]);
01223             }
01224         }
01225     }
01226     else
01227     {
01228         return _lightsMap;
01229     }
01230     return lights;
01231 }

UInt32 osg::RenderAction::getActiveLightsMask ( void   )  [inline]

UInt32 osg::RenderAction::getActiveLightsCount ( void   )  [inline]

Definition at line 141 of file OSGRenderAction.inl.

References _activeLightsCount.

00142 {
00143     return _activeLightsCount;
00144 }

const std::vector< UInt32 > & osg::RenderAction::getLightEnvsLightsState ( void   )  [inline]

Definition at line 147 of file OSGRenderAction.inl.

References _lightEnvsLightsState.

Referenced by osg::Light::renderEnter().

00148 {
00149     return _lightEnvsLightsState;
00150 }

State * osg::RenderAction::getCurrentState ( void   )  [inline]

Definition at line 152 of file OSGRenderAction.inl.

References _pActiveState.

00153 {
00154     return _pActiveState;
00155 }

void RenderAction::setSortTrans ( bool  bVal  ) 

Definition at line 2168 of file OSGRenderAction.cpp.

References _bSortTrans.

Referenced by osg::RenderOptions::activateOptions().

02169 {
02170     _bSortTrans = bVal;
02171 }

bool RenderAction::getSortTrans ( void   )  const

Definition at line 2173 of file OSGRenderAction.cpp.

References _bSortTrans.

02174 {
02175     return _bSortTrans;
02176 }

void RenderAction::setZWriteTrans ( bool  bVal  ) 

Definition at line 2178 of file OSGRenderAction.cpp.

References _bZWriteTrans.

Referenced by osg::RenderOptions::activateOptions(), and osg::FBOViewport::render().

02179 {
02180     _bZWriteTrans = bVal;
02181 }

bool RenderAction::getZWriteTrans ( void   )  const

Definition at line 2183 of file OSGRenderAction.cpp.

References _bZWriteTrans.

Referenced by osg::FBOViewport::render().

02184 {
02185     return _bZWriteTrans;
02186 }

void RenderAction::setLocalLights ( bool  bVal  ) 

Definition at line 2188 of file OSGRenderAction.cpp.

References _bLocalLights.

Referenced by osg::RenderOptions::activateOptions().

02189 {
02190     _bLocalLights = bVal;
02191 }

bool RenderAction::getLocalLights ( void   )  const

Definition at line 2193 of file OSGRenderAction.cpp.

References _bLocalLights.

Referenced by osg::Light::renderEnter().

02194 {
02195     return _bLocalLights;
02196 }

void RenderAction::setCorrectTwoSidedLighting ( bool  bVal  ) 

Definition at line 2198 of file OSGRenderAction.cpp.

References _bCorrectTwoSidedLighting.

Referenced by osg::RenderOptions::activateOptions().

02199 {
02200     _bCorrectTwoSidedLighting = bVal;
02201 }

bool RenderAction::getCorrectTwoSidedLighting ( void   )  const

Definition at line 2203 of file OSGRenderAction.cpp.

References _bCorrectTwoSidedLighting.

02204 {
02205     return _bCorrectTwoSidedLighting;
02206 }

void RenderAction::setOcclusionCulling ( bool  bVal  ) 

Definition at line 2208 of file OSGRenderAction.cpp.

References _bOcclusionCulling, and deleteOcclusionQueriesPool().

Referenced by osg::RenderOptions::activateOptions().

02209 {
02210     if(_bOcclusionCulling == bVal)
02211         return;
02212 
02213     deleteOcclusionQueriesPool();
02214     _bOcclusionCulling = bVal;
02215 }

bool RenderAction::getOcclusionCulling ( void   )  const

Definition at line 2217 of file OSGRenderAction.cpp.

References _bOcclusionCulling.

02218 {
02219     return _bOcclusionCulling;
02220 }

void RenderAction::setOcclusionCullingMode ( Int32  mode  ) 

Definition at line 2222 of file OSGRenderAction.cpp.

References _occlusionCullingMode, and deleteOcclusionQueriesPool().

Referenced by osg::RenderOptions::activateOptions().

02223 {
02224     if(_occlusionCullingMode == mode)
02225         return;
02226 
02227     deleteOcclusionQueriesPool();
02228     _occlusionCullingMode = mode;
02229 }

Int32 RenderAction::getOcclusionCullingMode ( void   )  const

Definition at line 2231 of file OSGRenderAction.cpp.

References _occlusionCullingMode.

02232 {
02233     return _occlusionCullingMode;
02234 }

void RenderAction::setOcclusionCullingPixels ( UInt32  pixels  ) 

Definition at line 2236 of file OSGRenderAction.cpp.

References _occlusionCullingPixels.

Referenced by osg::RenderOptions::activateOptions().

02237 {
02238     _occlusionCullingPixels = pixels;
02239 }

UInt32 RenderAction::getOcclusionCullingPixels ( void   )  const

Definition at line 2241 of file OSGRenderAction.cpp.

References _occlusionCullingPixels.

02242 {
02243     return _occlusionCullingPixels;
02244 }

void RenderAction::setOcclusionCullingThreshold ( UInt32  threshold  ) 

Definition at line 2276 of file OSGRenderAction.cpp.

References _occlusionCullingThreshold.

02277 {
02278     _occlusionCullingThreshold = threshold;
02279 }

UInt32 RenderAction::getOcclusionCullingThreshold ( void   )  const

Definition at line 2281 of file OSGRenderAction.cpp.

References _occlusionCullingThreshold.

02282 {
02283     return _occlusionCullingThreshold;
02284 }

void RenderAction::setSmallFeatureCulling ( bool  bVal  ) 

Definition at line 2246 of file OSGRenderAction.cpp.

References _bSmallFeatureCulling.

Referenced by osg::RenderOptions::activateOptions().

02247 {
02248     _bSmallFeatureCulling = bVal;
02249 }

bool RenderAction::getSmallFeatureCulling ( void   )  const

Definition at line 2251 of file OSGRenderAction.cpp.

References _bSmallFeatureCulling.

02252 {
02253     return _bSmallFeatureCulling;
02254 }

void RenderAction::setSmallFeaturePixels ( Real32  pixels  ) 

Definition at line 2256 of file OSGRenderAction.cpp.

References _smallFeaturesPixels.

Referenced by osg::RenderOptions::activateOptions().

02257 {
02258     _smallFeaturesPixels = pixels;
02259 }

Real32 RenderAction::getSmallFeaturePixels ( void   )  const

Definition at line 2261 of file OSGRenderAction.cpp.

References _smallFeaturesPixels.

02262 {
02263     return _smallFeaturesPixels;
02264 }

void RenderAction::setSmallFeatureThreshold ( UInt32  threshold  ) 

Definition at line 2266 of file OSGRenderAction.cpp.

References _smallFeaturesThreshold.

Referenced by osg::RenderOptions::activateOptions().

02267 {
02268     _smallFeaturesThreshold = threshold;
02269 }

UInt32 RenderAction::getSmallFeatureThreshold ( void   )  const

Definition at line 2271 of file OSGRenderAction.cpp.

References _smallFeaturesThreshold.

02272 {
02273     return _smallFeaturesThreshold;
02274 }

void RenderAction::setUseGLFinish ( bool  s  ) 

Definition at line 2286 of file OSGRenderAction.cpp.

References _useGLFinish.

02287 {
02288     _useGLFinish = s;
02289 }

bool RenderAction::getUseGLFinish ( void   )  const

Definition at line 2291 of file OSGRenderAction.cpp.

References _useGLFinish.

02292 {
02293     return _useGLFinish;
02294 }

bool RenderAction::isSmallFeature ( const NodePtr node  ) 

Definition at line 1546 of file OSGRenderAction.cpp.

References _bSmallFeatureCulling, _smallFeaturesPixels, osg::DrawActionBase::_viewport, _worldToScreenMatrix, osg::DynamicVolume::getBounds(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::Inf, osg::TransformationMatrix< ValueTypeT >::multFullMatrixPnt(), osg::NegInf, osg::NullFC, p, top_matrix(), and osg::DynamicVolume::transform().

Referenced by isOccluded().

01547 {
01548     if(node == NullFC)
01549         return true;
01550 
01551     if(!_bSmallFeatureCulling)
01552         return false;
01553 
01554     //node->updateVolume();
01555     DynamicVolume vol = node->getVolume();
01556     vol.transform(top_matrix());
01557 
01558     Pnt3f p[8];
01559     vol.getBounds(p[0], p[4]);
01560     
01561     p[1].setValues(p[0][0], p[4][1], p[0][2]);
01562     p[2].setValues(p[4][0], p[4][1], p[0][2]);
01563     p[3].setValues(p[4][0], p[0][1], p[0][2]);
01564     
01565     p[5].setValues(p[4][0], p[0][1], p[4][2]);
01566     p[6].setValues(p[0][0], p[0][1], p[4][2]);
01567     p[7].setValues(p[0][0], p[4][1], p[4][2]);
01568 
01569     for(int i=0;i<8;++i)
01570         _worldToScreenMatrix.multFullMatrixPnt(p[i]);
01571 
01572     Pnt2f min(OSG::Inf, OSG::Inf);
01573     Pnt2f max(OSG::NegInf, OSG::NegInf);
01574 
01575     for(int i=0;i<8;++i)
01576     {
01577         if(p[i][0] < min[0])
01578             min[0] = p[i][0];
01579     
01580         if(p[i][1] < min[1])
01581             min[1] = p[i][1];
01582     
01583         if(p[i][0] > max[0])
01584             max[0] = p[i][0];
01585     
01586         if(p[i][1] > max[1])
01587             max[1] = p[i][1];
01588     }
01589 
01590     //for(int i=0;i<8;++i)
01591     //    printf("p%d: %f %f\n", i, p[i][0], p[i][1]);
01592 
01593     Real32 w = ((max[0] - min[0]) / 2.0f) * Real32(_viewport->getPixelWidth());
01594     Real32 h = ((max[1] - min[1]) / 2.0f) * Real32(_viewport->getPixelHeight());
01595     Real32 f = w * h;
01596 
01597     //printf("%f %f pixels: %f x %f = %f\n", max[0] - min[0], max[1] - min[1], w, h, f);
01598 
01599     if(f <= _smallFeaturesPixels)
01600         return true;
01601 
01602     return false;
01603 }

bool RenderAction::isOccluded ( DrawTreeNode pRoot  ) 

Definition at line 1605 of file OSGRenderAction.cpp.

References _bOcclusionCulling, _bSmallFeatureCulling, _occluded_nodes, _occlusionCullingMode, _occlusionCullingPixels, _occlusionCullingThreshold, _occlusionQuery, _smallFeaturesThreshold, _uiNumOcclusionCulled, _uiNumOcclusionTests, osg::AttachmentContainerPtr::dcast(), drawOcclusionBB(), osg::DynamicVolume::getBounds(), osg::NodePtr::getCore(), osg::StatCollector::getElem(), osg::DrawTreeNode::getNode(), getOcclusionQuery(), osg::DrawActionBase::getStatistics(), GL_QUERY_RESULT_ARB, GL_SAMPLES_PASSED_ARB, GLuint, osg::DrawTreeNode::hasFunctor(), isSmallFeature(), osg::NullFC, OcclusionHierarchicalMultiFrame, OcclusionMultiFrame, OcclusionStopAndWait, and osg::DrawActionBase::statCulledNodes.

Referenced by draw().

01606 {
01607     // Skip draw tree nodes without a functor!
01608     if(!pRoot->hasFunctor())
01609         return false;
01610 
01611     // skip occlusion test for small sized geometries
01612     UInt32 pos_size = 0;
01613     if((_bOcclusionCulling || _bSmallFeatureCulling) &&
01614         pRoot->getNode()->getCore() != NullFC)
01615     {
01616         GeometryPtr geo = GeometryPtr::dcast(pRoot->getNode()->getCore());
01617         if(geo != NullFC)
01618         {
01619             if(geo->getPositions() != NullFC)
01620                 pos_size = geo->getPositions()->getSize();
01621         }
01622     }
01623 
01624     bool foundSmallFeature = false;
01625     if(_bSmallFeatureCulling && pos_size > _smallFeaturesThreshold)
01626     {    
01627         foundSmallFeature = isSmallFeature(pRoot->getNode());
01628         if(foundSmallFeature)
01629         {
01630             getStatistics()->getElem(statCulledNodes)->inc();
01631             return true;
01632         }
01633     }
01634 
01635     if(!foundSmallFeature)
01636     {
01637         if(_bOcclusionCulling && _glGenQueriesARB != NULL &&
01638            ((pos_size > _occlusionCullingThreshold) ||
01639             (_occlusionCullingMode == OcclusionHierarchicalMultiFrame)))
01640         {
01641             if(_occlusionCullingMode & OcclusionMultiFrame)
01642             {
01643                 // ok we use a "multi frame" algorithm, which renders
01644                 // the whole scene first and keeps the depth buffer. For each object
01645                 // a bounding box is drawn with an occlusion query.
01646                 // The results are fetched in the next frame, if the box was visible
01647                 // the corresponding object is drawn.
01648                 
01649                 GLuint occlusionQuery = getOcclusionQuery(pRoot->getNode());
01650                 if(occlusionQuery == 0)
01651                     return false;
01652 
01653                 GLuint pixels = 0;
01654                 _glGetQueryObjectuivARB(occlusionQuery, GL_QUERY_RESULT_ARB, &pixels);
01655                 ++_uiNumOcclusionTests;
01656                 //printf("geo occ test: '%s' %d pixels\n", OSG::getName(pRoot->getNode()), pixels);
01657 
01658                 if(pixels > _occlusionCullingPixels)
01659                 {
01660                     // 0 means not occluded.
01661                     pRoot->getNode()->setOcclusionMask(0);
01662                     return false;
01663                 }
01664                 else
01665                 {
01666                     // 2 means occluded leaf, 1 means occluded node.
01667                     pRoot->getNode()->setOcclusionMask(2);
01668                     _occluded_nodes.push_back(pRoot->getNode());
01669                     getStatistics()->getElem(statCulledNodes)->inc();
01670                     ++_uiNumOcclusionCulled;
01671                     return true;
01672                 }
01673             }
01674             else if(_occlusionCullingMode & OcclusionStopAndWait)
01675             {
01676                 // ok we use a simple "stop an wait" algorithm, which renders
01677                 // the scene in front to back order. For each object (except for the
01678                 // front most object) a bounding box is drawn with an occlusion query.
01679                 // The result is fetched immediately afterwards and if the box was visible
01680                 // the corresponding object is drawn.
01681 
01682                 //getStatistics()->getElem(statCullTestedNodes)->inc();
01683                 glDepthMask(GL_FALSE);
01684                 glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
01685                 
01686                 if(_occlusionQuery == 0)
01687                     _glGenQueriesARB(1, &_occlusionQuery);
01688 
01689                 const DynamicVolume& vol = pRoot->getNode()->getVolume();
01690                 Pnt3f min,max;
01691                 vol.getBounds(min, max);
01692 
01693                 _glBeginQueryARB(GL_SAMPLES_PASSED_ARB, _occlusionQuery);
01694                 drawOcclusionBB(min, max);
01695                 _glEndQueryARB(GL_SAMPLES_PASSED_ARB);
01696 
01697                 glDepthMask(GL_TRUE);
01698                 glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
01699 
01700                 GLuint pixels = 0;
01701                 _glGetQueryObjectuivARB(_occlusionQuery, GL_QUERY_RESULT_ARB, &pixels);
01702                 ++_uiNumOcclusionTests;
01703 
01704                 if(pixels > _occlusionCullingPixels)
01705                 {
01706                     return false;
01707                 }
01708                 else
01709                 {
01710                     getStatistics()->getElem(statCulledNodes)->inc();
01711                     ++_uiNumOcclusionCulled;
01712                     return true;
01713                 }
01714             }
01715         }
01716     }
01717 
01718     return false;
01719 }

void RenderAction::deleteOcclusionQueriesPool ( void   ) 

Definition at line 1721 of file OSGRenderAction.cpp.

References _hier_occlusions, _occluded_nodes, _occlusionQueries, _occlusionQueriesPool, osg::NodePtr::dcast(), osg::ViewportBase::getRoot(), osg::DrawActionBase::getViewport(), GLuint, osg::NullFC, setOcclusionMask(), and osg::FieldContainerFactory::the().

Referenced by setOcclusionCulling(), setOcclusionCullingMode(), and ~RenderAction().

01722 {
01723     for(std::vector<GLuint>::iterator occIt = _occlusionQueriesPool.begin();
01724         occIt != _occlusionQueriesPool.end();++occIt)
01725     {
01726         GLuint occlusionQuery = (*occIt);
01727         _glDeleteQueriesARB(1, &occlusionQuery);
01728     }
01729     _occlusionQueriesPool.clear();
01730 
01731     for(std::map<UInt32, GLuint>::iterator it=_occlusionQueries.begin();
01732         it!=_occlusionQueries.end();++it)
01733     {
01734         NodePtr node = NodePtr::dcast(FieldContainerFactory::the()->getContainer((*it).first));
01735         if(node != NullFC)
01736             setOcclusionMask(node, 0);
01737     }
01738     _occlusionQueries.clear();
01739     _occluded_nodes.clear();
01740 
01741     for(std::set<UInt32>::iterator it=_hier_occlusions.begin();
01742         it!=_hier_occlusions.end();++it)
01743     {
01744         NodePtr node = NodePtr::dcast(FieldContainerFactory::the()->getContainer(*it));
01745         if(node != NullFC)
01746             setOcclusionMask(node, 0);
01747     }
01748     _hier_occlusions.clear();
01749 
01750 #if 0
01751     // reset all occlusion masks.
01752     Viewport *vp = getViewport();
01753     if(vp != NULL)
01754     {
01755         NodePtr root = vp->getRoot();
01756         setOcclusionMask(root, 0);
01757     }
01758 #endif
01759 }

GLuint RenderAction::getOcclusionQuery ( void   ) 

Definition at line 1794 of file OSGRenderAction.cpp.

References _currentOcclusionQueryIndex, _occlusionQueriesPool, and GLuint.

Referenced by drawHierarchicalMultiFrameOcclusionBB(), drawMultiFrameOcclusionBB(), isOccluded(), and stop().

01795 {
01796     GLuint occlusionQuery = 0;
01797     if(_currentOcclusionQueryIndex >= _occlusionQueriesPool.size())
01798     {
01799         // ok we re-use already created occlusion query objects.
01800         _glGenQueriesARB(1, &occlusionQuery);
01801         _occlusionQueriesPool.push_back(occlusionQuery);
01802     }
01803     else
01804     {
01805         occlusionQuery = _occlusionQueriesPool[_currentOcclusionQueryIndex];
01806     }
01807 
01808     ++_currentOcclusionQueryIndex;
01809 
01810     return occlusionQuery;
01811 }

GLuint RenderAction::getOcclusionQuery ( NodePtr  node  ) 

Definition at line 1813 of file OSGRenderAction.cpp.

References _occlusionQueries, osg::FieldContainerPtrBase::getFieldContainerId(), and osg::NullFC.

01814 {
01815     if(node == NullFC)
01816         return 0;
01817 
01818     std::map<UInt32, GLuint>::iterator it = _occlusionQueries.find(node.getFieldContainerId());
01819 
01820     if(it != _occlusionQueries.end())
01821         return (*it).second;
01822 
01823     return 0;
01824 }

void RenderAction::setOcclusionQuery ( NodePtr  node,
GLuint  occlusionQuery 
)

Definition at line 1826 of file OSGRenderAction.cpp.

References _occlusionQueries, osg::FieldContainerPtrBase::getFieldContainerId(), and osg::NullFC.

Referenced by drawHierarchicalMultiFrameOcclusionBB(), and drawMultiFrameOcclusionBB().

01827 {
01828     if(node == NullFC)
01829         return;
01830 
01831     _occlusionQueries.insert(std::make_pair(node.getFieldContainerId(), occlusionQuery));
01832 }

void RenderAction::resetOcclusionQueryIndex ( void   ) 

Definition at line 1761 of file OSGRenderAction.cpp.

References _currentOcclusionQueryIndex.

Referenced by stop().

01762 {
01763     _currentOcclusionQueryIndex = 0;
01764 }

void RenderAction::setOcclusionMask ( NodePtr  node,
UInt8  mask 
)

Definition at line 1766 of file OSGRenderAction.cpp.

References osg::NullFC.

Referenced by deleteOcclusionQueriesPool(), and stop().

01767 {
01768     if(node == NullFC)
01769         return;
01770 
01771     node->setOcclusionMask(mask);
01772 
01773     for(UInt32 i=0;i<node->getNChildren();++i)
01774         setOcclusionMask(node->getChild(i), mask);
01775 }

bool RenderAction::hasGeometryChild ( NodePtr  node  ) 

Definition at line 1777 of file OSGRenderAction.cpp.

References osg::AttachmentContainerPtr::dcast(), osg::NodePtr::getCore(), and osg::NullFC.

Referenced by stop().

01778 {
01779     if(node == NullFC)
01780         return false;
01781 
01782     if(GeometryPtr::dcast(node->getCore()) != NullFC)
01783         return true;
01784 
01785     for(UInt32 i=0;i<node->getNChildren();++i)
01786     {
01787         if(hasGeometryChild(node->getChild(i)))
01788             return true;
01789     }
01790 
01791     return false;
01792 }

void RenderAction::drawOcclusionBB ( const Pnt3f bbmin,
const Pnt3f bbmax 
)

Definition at line 1834 of file OSGRenderAction.cpp.

References _occ_bb_dl.

Referenced by drawHierarchicalMultiFrameOcclusionBB(), drawMultiFrameOcclusionBB(), and isOccluded().

01835 {
01836 #if 1
01837 
01838 #if 0
01839     glBegin(GL_TRIANGLE_STRIP);
01840     glVertex3f( bbmin[0], bbmin[1], bbmax[2]); // 0
01841     glVertex3f( bbmax[0], bbmin[1], bbmax[2]); // 1
01842     glVertex3f( bbmin[0], bbmax[1], bbmax[2]); // 2
01843     glVertex3f( bbmax[0], bbmax[1], bbmax[2]); // 3
01844     glVertex3f( bbmin[0], bbmax[1], bbmin[2]); // 4
01845     glVertex3f( bbmax[0], bbmax[1], bbmin[2]); // 5
01846     glVertex3f( bbmin[0], bbmin[1], bbmin[2]); // 6
01847     glVertex3f( bbmax[0], bbmin[1], bbmin[2]); // 7
01848     glEnd();
01849 
01850     glBegin(GL_TRIANGLE_STRIP);
01851     glVertex3f( bbmax[0], bbmax[1], bbmin[2]); // 5
01852     glVertex3f( bbmax[0], bbmax[1], bbmax[2]); // 3
01853     glVertex3f( bbmax[0], bbmin[1], bbmin[2]); // 7
01854     glVertex3f( bbmax[0], bbmin[1], bbmax[2]); // 1
01855     glVertex3f( bbmin[0], bbmin[1], bbmin[2]); // 6
01856     glVertex3f( bbmin[0], bbmin[1], bbmax[2]); // 0
01857     glVertex3f( bbmin[0], bbmax[1], bbmin[2]); // 4
01858     glVertex3f( bbmin[0], bbmax[1], bbmax[2]); // 2
01859     glEnd();
01860 
01861 #else
01862 
01863     // not sure if this is faster but it reduces the amount of
01864     // gl commands.
01865     const GLubyte indices[16] = { 0,1,2,3,4,5,6,7,  5,3,7,1,6,0,4,2 };
01866     Real32 vertices[24];
01867     vertices[0]  = bbmin[0]; vertices[1]  = bbmin[1]; vertices[2]  = bbmax[2];
01868     vertices[3]  = bbmax[0]; vertices[4]  = bbmin[1]; vertices[5]  = bbmax[2];
01869     vertices[6]  = bbmin[0]; vertices[7]  = bbmax[1]; vertices[8]  = bbmax[2];
01870     vertices[9]  = bbmax[0]; vertices[10] = bbmax[1]; vertices[11] = bbmax[2];
01871     vertices[12] = bbmin[0]; vertices[13] = bbmax[1]; vertices[14] = bbmin[2];
01872     vertices[15] = bbmax[0]; vertices[16] = bbmax[1]; vertices[17] = bbmin[2];
01873     vertices[18] = bbmin[0]; vertices[19] = bbmin[1]; vertices[20] = bbmin[2];
01874     vertices[21] = bbmax[0]; vertices[22] = bbmin[1]; vertices[23] = bbmin[2];
01875 
01876     glVertexPointer(3, GL_FLOAT, 0, &vertices[0]);
01877     glEnableClientState(GL_VERTEX_ARRAY);
01878     glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_BYTE, &indices[0]);
01879     glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_BYTE, &indices[8]);
01880     glDisableClientState(GL_VERTEX_ARRAY);
01881 
01882 #endif
01883 
01884 #else
01885 
01886     if(_occ_bb_dl == 0)
01887     {
01888         // we create a display list for rendering the occlusion
01889         // bounding box.
01890         // is this faster ??? need to check it amz.
01891         Pnt3f min(-0.5f, -0.5f, -0.5f);
01892         Pnt3f max(0.5f, 0.5f, 0.5f);
01893         _occ_bb_dl = glGenLists(1);
01894 
01895         const GLubyte indices[16] = { 0,1,2,3,4,5,6,7,  5,3,7,1,6,0,4,2 };
01896         Real32 vertices[24];
01897         vertices[0]  = min[0]; vertices[1]  = min[1]; vertices[2]  = max[2];
01898         vertices[3]  = max[0]; vertices[4]  = min[1]; vertices[5]  = max[2];
01899         vertices[6]  = min[0]; vertices[7]  = max[1]; vertices[8]  = max[2];
01900         vertices[9]  = max[0]; vertices[10] = max[1]; vertices[11] = max[2];
01901         vertices[12] = min[0]; vertices[13] = max[1]; vertices[14] = min[2];
01902         vertices[15] = max[0]; vertices[16] = max[1]; vertices[17] = min[2];
01903         vertices[18] = min[0]; vertices[19] = min[1]; vertices[20] = min[2];
01904         vertices[21] = max[0]; vertices[22] = min[1]; vertices[23] = min[2];
01905 
01906         glNewList(_occ_bb_dl, GL_COMPILE);
01907             glVertexPointer(3, GL_FLOAT, 0, &vertices[0]);
01908             glEnableClientState(GL_VERTEX_ARRAY);
01909             glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_BYTE, &indices[0]);
01910             glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_BYTE, &indices[8]);
01911             glDisableClientState(GL_VERTEX_ARRAY);
01912         glEndList();
01913     }
01914 
01915     Vec3f s = bbmax - bbmin;
01916     Vec3f t = bbmin + bbmax;
01917     t *= 0.5f;
01918     glPushMatrix();
01919         glTranslatef(t[0], t[1], t[2]);
01920         glScalef(s[0], s[1], s[2]);
01921         glCallList(_occ_bb_dl);
01922     glPopMatrix();
01923 
01924 #endif
01925 }

void RenderAction::drawMultiFrameOcclusionBB ( DrawTreeNode pRoot  ) 

Definition at line 1927 of file OSGRenderAction.cpp.

References _currMatrix, _occlusionCullingMode, _occlusionCullingThreshold, _uiActiveMatrix, _uiNumMatrixChanges, osg::AttachmentContainerPtr::dcast(), drawOcclusionBB(), osg::RenderAction::MatrixStore::first, osg::DrawTreeNode::getBrother(), osg::NodePtr::getCore(), osg::DrawTreeNode::getFirstChild(), osg::DrawTreeNode::getMatrixStore(), osg::Volume::getMax(), osg::DrawTreeNode::getNode(), getOcclusionQuery(), osg::TransformationMatrix< ValueTypeT >::getValues(), GL_SAMPLES_PASSED_ARB, GLuint, osg::DrawTreeNode::hasFunctor(), osg::NullFC, OcclusionHierarchicalMultiFrame, osg::RenderAction::MatrixStore::second, setOcclusionQuery(), and osg::DynamicVolume::transform().

Referenced by stop().

01928 {
01929     while(pRoot != NULL)
01930     {
01931         if(pRoot->hasFunctor())
01932         {
01933             UInt32 pos_size = 0;
01934             GeometryPtr geo = GeometryPtr::dcast(pRoot->getNode()->getCore());
01935             if(geo != NullFC)
01936             {
01937                 if(geo->getPositions() != NullFC)
01938                     pos_size = geo->getPositions()->getSize();
01939             }
01940         
01941             if(_glGenQueriesARB != NULL && ((pos_size > _occlusionCullingThreshold) ||
01942                (_occlusionCullingMode == OcclusionHierarchicalMultiFrame)))
01943             {
01944                 DynamicVolume vol = pRoot->getNode()->getVolume();
01945                 vol.transform(pRoot->getMatrixStore().second);
01946                 // ignore objects behind the camera.
01947                 if(vol.getMax()[2] < 0.0f)
01948                 {
01949                     UInt32 uiNextMatrix = pRoot->getMatrixStore().first;
01950                     if(uiNextMatrix != 0 && uiNextMatrix != _uiActiveMatrix)
01951                     {
01952                         glLoadMatrixf(pRoot->getMatrixStore().second.getValues());
01953         
01954                         _uiActiveMatrix = uiNextMatrix;
01955                         _uiNumMatrixChanges++;
01956                         _currMatrix.second = pRoot->getMatrixStore().second;
01957                     }
01958 
01959                     Pnt3f min,max;
01960                     pRoot->getNode()->getVolume().getBounds(min, max);
01961     
01962                     GLuint occlusionQuery = getOcclusionQuery();
01963 
01964                     _glBeginQueryARB(GL_SAMPLES_PASSED_ARB, occlusionQuery);
01965                     drawOcclusionBB(min, max);
01966                     _glEndQueryARB(GL_SAMPLES_PASSED_ARB);
01967 
01968                     // we use the node because the geometry core could be shared!
01969                     setOcclusionQuery(pRoot->getNode(), occlusionQuery);
01970                 }
01971                 else
01972                 {
01973                     setOcclusionQuery(pRoot->getNode(), 0);
01974                 }
01975             }
01976         }
01977 
01978         if(pRoot->getFirstChild() != NULL)
01979         {
01980             drawMultiFrameOcclusionBB(pRoot->getFirstChild());
01981         }
01982 
01983         pRoot = pRoot->getBrother();
01984     }
01985 }

void RenderAction::drawHierarchicalMultiFrameOcclusionBB ( const Matrix view,
NodePtr  node 
)

Definition at line 1987 of file OSGRenderAction.cpp.

References drawOcclusionBB(), osg::Volume::getMax(), getOcclusionQuery(), osg::TransformationMatrix< ValueTypeT >::getValues(), GL_SAMPLES_PASSED_ARB, GLuint, osg::TransformationMatrix< ValueTypeT >::mult(), osg::NullFC, setOcclusionQuery(), and osg::DynamicVolume::transform().

Referenced by stop().

01989 {
01990     if(node == NullFC || _glGenQueriesARB == NULL)
01991         return;
01992 
01993     DynamicVolume vol = node->getVolume();
01994     Matrix m = view;
01995     if(node->getParent() != NullFC)
01996         m.mult(node->getParent()->getToWorld());
01997     vol.transform(m);
01998     // ignore objects behind the camera.
01999     if(vol.getMax()[2] < 0.0f)
02000     {
02001         glLoadMatrixf(m.getValues());
02002         Pnt3f min,max;
02003         node->getVolume().getBounds(min, max);
02004 
02005         GLuint occlusionQuery = getOcclusionQuery();
02006 
02007         _glBeginQueryARB(GL_SAMPLES_PASSED_ARB, occlusionQuery);
02008         drawOcclusionBB(min, max);
02009         _glEndQueryARB(GL_SAMPLES_PASSED_ARB);
02010 
02011         // we use the node because the geometry core could be shared!
02012         setOcclusionQuery(node, occlusionQuery);
02013     }
02014     else
02015     {
02016         setOcclusionQuery(node, 0);
02017     }
02018 }

bool RenderAction::isVisible ( Node node  )  [virtual]

Implements osg::DrawActionBase.

Definition at line 1296 of file OSGRenderAction.cpp.

References osg::DrawActionBase::_frustum, _lightEnvsLightsState, osg::StatCollector::getElem(), osg::DrawActionBase::getFrustumCulling(), osg::DrawActionBase::getStatistics(), osg::Node::getVolume(), osg::FrustumVolume::intersect(), osg::DrawActionBase::statCulledNodes, osg::DrawActionBase::statCullTestedNodes, top_matrix(), osg::DynamicVolume::transform(), and osg::Node::updateVolume().

01297 {
01298     if ( getFrustumCulling() == false )
01299         return true;
01300 
01301     // HACK but light sources beneath a LightEnv node can also
01302     // light it's brothers or parents.
01303     if(!_lightEnvsLightsState.empty())
01304         return true;
01305 
01306     getStatistics()->getElem(statCullTestedNodes)->inc();
01307     
01308     DynamicVolume vol;
01309 
01310 //    node->getWorldVolume( vol );
01311 
01312     node->updateVolume();
01313     vol = node->getVolume();
01314 
01315     vol.transform(top_matrix());
01316 
01317     if ( _frustum.intersect( vol ) )
01318     {
01319 // fprintf(stderr,"%p: node 0x%p vis\n", Thread::getCurrent(), node);
01320         return true;
01321     }
01322     
01323     getStatistics()->getElem(statCulledNodes)->inc();
01324 
01325 // fprintf(stderr,"%p: node 0x%p invis\n", Thread::getCurrent(), node);
01326 // _frustum.dump();
01327     return false;
01328 }

bool RenderAction::pushVisibility ( void   ) 

Definition at line 1333 of file OSGRenderAction.cpp.

References osg::DrawActionBase::_frustum, _lightEnvsLightsState, _visibilityStack, osg::dropVolume(), osg::Action::getActNode(), osg::StatCollector::getElem(), osg::DrawActionBase::getFrustumCulling(), osg::DrawActionBase::getStatistics(), osg::DrawActionBase::getVolumeDrawing(), osg::intersect(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::FrustumVolume::P_ALL, osg::Color3< ValueTypeT >::setValuesRGB(), osg::DrawActionBase::statCulledNodes, osg::DrawActionBase::statCullTestedNodes, top_matrix(), osg::FrustumVolume::transform(), osg::DynamicVolume::transform(), and osg::Action::useNodeList().

Referenced by osg::Transform::renderEnter(), osg::Light::renderEnter(), osg::Group::renderEnter(), and osg::ClipPlane::renderEnter().

01334 {
01335     if(getFrustumCulling() == false)
01336         return true;
01337 
01338     // HACK but light sources beneath a LightEnv node can also
01339     // light it's brothers or parents.
01340     if(!_lightEnvsLightsState.empty())
01341         return true;
01342 
01343     FrustumVolume::PlaneSet inplanes = _visibilityStack.back();
01344 
01345     if(inplanes == FrustumVolume::P_ALL)
01346     {
01347         _visibilityStack.push_back(inplanes);
01348         return true;
01349     }
01350 
01351     Color3f col;
01352     bool result = true;
01353     
01354     NodePtr node = getActNode();
01355     
01356     DynamicVolume vol = node->getVolume(true);
01357     FrustumVolume frustum = _frustum;
01358 
01359 #if 1
01360     vol.transform(top_matrix());
01361 #else   
01362     // not quite working 
01363     Matrix m = top_matrix();
01364     m.invert();
01365     
01366     frustum.transform(m);
01367 #endif
01368 
01369     getStatistics()->getElem(statCullTestedNodes)->inc();
01370     
01371     if ( !intersect( frustum, vol, inplanes ) )
01372     {
01373         result = false;
01374         col.setValuesRGB(1,0,0);
01375         getStatistics()->getElem(statCulledNodes)->inc();
01376         useNodeList(); // ignore all children
01377     }
01378     else
01379     {
01380         if(inplanes == FrustumVolume::P_ALL)
01381         {
01382             col.setValuesRGB(0,1,0);
01383         }
01384         else
01385         {
01386             col.setValuesRGB(0,0,1);
01387         }
01388     }
01389 
01390     if(getVolumeDrawing())
01391     {
01392         dropVolume(this, node, col);
01393     }
01394 
01395     _visibilityStack.push_back(inplanes);
01396     return result;
01397 }

void RenderAction::popVisibility ( void   ) 

Definition at line 1399 of file OSGRenderAction.cpp.

References _lightEnvsLightsState, _visibilityStack, osg::DrawActionBase::getFrustumCulling(), and SWARNING.

Referenced by osg::Light::renderEnter(), osg::Group::renderEnter(), osg::ClipPlane::renderEnter(), osg::Transform::renderLeave(), osg::Light::renderLeave(), osg::Group::renderLeave(), and osg::ClipPlane::renderLeave().

01400 {
01401     if(getFrustumCulling() == false)
01402         return;
01403 
01404     if(!_lightEnvsLightsState.empty())
01405         return;
01406 
01407     if(!_visibilityStack.empty())
01408         _visibilityStack.pop_back();
01409     else
01410         SWARNING << "RenderAction::popVisibility: visibility stack is empty looks"
01411                     "like a pushVisibility and popVisibility mismatch!" << std::endl;
01412 }

osg::RenderAction::void ( OSG_APIENTRY *  _glGenQueriesARB  ) 

Referenced by start().

GLuint* osg::RenderAction::void ( OSG_APIENTRY *  _glDeleteQueriesARB  ) 

GLuint* GLuint* osg::RenderAction::void ( OSG_APIENTRY *  _glBeginQueryARB  ) 

osg::RenderAction::void ( OSG_APIENTRY *  _glEndQueryARB  ) 

osg::RenderAction::void ( OSG_APIENTRY *  _glGetQueryObjectuivARB  ) 

void osg::RenderAction::operator= ( const RenderAction source  )  [protected]

std::vector< RenderAction::Functor > * RenderAction::getDefaultEnterFunctors ( void   )  [protected, virtual]

Implements osg::DrawActionBase.

Definition at line 2933 of file OSGRenderAction.cpp.

References _vDefaultEnterFunctors.

02934 {
02935     return _vDefaultEnterFunctors;
02936 }

std::vector< RenderAction::Functor > * RenderAction::getDefaultLeaveFunctors ( void   )  [protected, virtual]

Implements osg::DrawActionBase.

Definition at line 2938 of file OSGRenderAction.cpp.

References _vDefaultLeaveFunctors.

02939 {
02940     return _vDefaultLeaveFunctors;
02941 }

void RenderAction::dump ( DrawTreeNode pRoot,
UInt32  uiIndent 
) [protected]

Definition at line 1417 of file OSGRenderAction.cpp.

References osg::RenderAction::MatrixStore::first, osg::DrawTreeNode::getBrother(), osg::DrawTreeNode::getFirstChild(), osg::DrawTreeNode::getGeometry(), osg::DrawTreeNode::getMatrixStore(), osg::DrawTreeNode::getNode(), osg::DrawTreeNode::getState(), osg::indentLog(), and PWARNING.

01418 {
01419     if(pRoot == NULL)
01420     {
01421         return;
01422     }
01423 
01424     indentLog(uiIndent, PWARNING);
01425 
01426     PWARNING << "Node : "   << pRoot                         << " | " 
01427              << "Geo : "    << pRoot->getGeometry()          << " | "
01428              << "State : "  << pRoot->getState()             << " | "
01429              << "Node : "   << pRoot->getNode()              << " | "
01430              << "Matrix : " << pRoot->getMatrixStore().first << std::endl;
01431 
01432     indentLog(uiIndent, PWARNING);
01433     PWARNING << "{" << std::endl;
01434 
01435     if(pRoot->getFirstChild() != NULL)
01436     {
01437         dump(pRoot->getFirstChild(), uiIndent + 4);
01438     }
01439 
01440     indentLog(uiIndent, PWARNING);
01441     PWARNING << "}" << std::endl;
01442 
01443     if(pRoot->getBrother() != NULL)
01444     {
01445         dump(pRoot->getBrother(), uiIndent);
01446     }
01447 }

void RenderAction::updateShader ( State state  )  [protected]

Definition at line 2022 of file OSGRenderAction.cpp.

References _cgChunkId, _cgfxChunkId, _shlChunkId, and osg::State::getChunk().

Referenced by draw().

02023 {
02024     if(state == NULL)
02025         return;
02026 
02027     if(_cgChunkId != -1)
02028     {
02029         StateChunkPtr cgChunk = state->getChunk(_cgChunkId);
02030         if(cgChunk != NULL)
02031             cgChunk->update(this);
02032     }
02033 
02034     if(_cgfxChunkId != -1)
02035     {
02036         StateChunkPtr cgfxChunk = state->getChunk(_cgfxChunkId);
02037         if(cgfxChunk != NULL)
02038             cgfxChunk->update(this);
02039     }
02040 
02041     StateChunkPtr shlChunk = state->getChunk(_shlChunkId);
02042     if(shlChunk != NULL)
02043         shlChunk->update(this);
02044 }

void RenderAction::draw ( DrawTreeNode pRoot  )  [protected, virtual]

Definition at line 2046 of file OSGRenderAction.cpp.

References _activeLightsState, _bCorrectTwoSidedLighting, _bLocalLights, _cgfxChunkId, _currMatrix, _pActiveState, _uiActiveMatrix, _uiNumGeometries, _uiNumMaterialChanges, _uiNumMatrixChanges, osg::State::activate(), activateLocalClipPlanes(), activateLocalLights(), osg::TypedFunctor1Base< RetT, CallArgT, SizeTraitsT >::call(), osg::State::changeFrom(), osg::State::deactivate(), osg::Geometry::drawPrimitives(), osg::RenderAction::MatrixStore::first, osg::DrawTreeNode::getBrother(), osg::State::getChunk(), osg::DrawTreeNode::getFirstChild(), osg::DrawTreeNode::getFunctor(), osg::DrawTreeNode::getGeometry(), osg::DrawTreeNode::getLightsState(), osg::DrawTreeNode::getMatrixStore(), osg::DrawTreeNode::getNode(), osg::DrawTreeNode::getState(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::DrawTreeNode::hasFunctor(), osg::DrawTreeNode::isLastMultiPass(), osg::DrawTreeNode::isNoStateSorting(), isOccluded(), osg::RenderAction::MatrixStore::second, osg::Action::setActNode(), updateShader(), and updateTopMatrix().

Referenced by stop().

02047 {
02048     while(pRoot != NULL)
02049     {
02050         UInt32 uiNextMatrix = pRoot->getMatrixStore().first;
02051 
02052         if(uiNextMatrix != 0 && uiNextMatrix != _uiActiveMatrix)
02053         {
02054             glLoadMatrixf(pRoot->getMatrixStore().second.getValues());
02055 
02056             _uiActiveMatrix = uiNextMatrix;
02057 
02058             _uiNumMatrixChanges++;
02059 
02060             _currMatrix.second = pRoot->getMatrixStore().second;
02061             updateTopMatrix();
02062 
02063             // Negative scaled matrices in conjunction with double sided lighting
02064             // gives wrong render results cause the lighting itselfs gets inverted.
02065             // This corrects this behavior.
02066             if(_bCorrectTwoSidedLighting)
02067             {
02068                 const Matrix &m = _currMatrix.second;
02069                 // test for a "flipped" matrix
02070                 // glFrontFace can give conflicts with the polygon chunk ...
02071                 if(m[0].cross(m[1]).dot(m[2]) < 0.0)
02072                     glFrontFace(GL_CW);
02073                 else
02074                     glFrontFace(GL_CCW);
02075             }
02076             
02077     #ifdef PRINT_MAT
02078             fprintf(stderr, "pushed to gl %d\n", _uiActiveMatrix);
02079 
02080             for(int i = 0; i < 4; i++)
02081             {
02082                 fprintf(stderr, "% 5.2f % 5.2f % 5.2f % 5.2f\n",
02083                         pRoot->getMatrixStore().second[i][0],
02084                         pRoot->getMatrixStore().second[i][1],
02085                         pRoot->getMatrixStore().second[i][2],
02086                         pRoot->getMatrixStore().second[i][3]);
02087             }
02088     #endif
02089         }
02090 
02091         setActNode(pRoot->getNode());
02092 
02093         if(!isOccluded(pRoot))
02094         {
02095             if(_bLocalLights && _activeLightsState != pRoot->getLightsState())
02096                 activateLocalLights(pRoot);
02097 
02098             activateLocalClipPlanes(pRoot);
02099 
02100             State *pNewState = pRoot->getState();
02101     
02102             if(pNewState != NULL)
02103             {
02104                 if(_pActiveState != NULL)
02105                 {
02106                     // we need this cgfx test because for multipass cgfx materials
02107                     // the state doesn't change.
02108                     if(pNewState != _pActiveState ||
02109                        (_cgfxChunkId != -1 && pNewState->getChunk(_cgfxChunkId) != NULL) ||
02110                        pRoot->isNoStateSorting())
02111                     {
02112                         State *previous_state = _pActiveState;
02113                         _pActiveState = pNewState;
02114                         pNewState->changeFrom(this, previous_state);
02115                         _uiNumMaterialChanges++;
02116                     }
02117                     else
02118                     {
02119                         // even if the state didn't change we need to update
02120                         // the shaders to provide the right world matrix.
02121                         updateShader(pNewState);
02122                     }
02123                 }
02124                 else
02125                 {
02126                     _pActiveState = pRoot->getState();
02127                     _pActiveState->activate(this);
02128                     _uiNumMaterialChanges++;
02129                 }
02130             }
02131             else
02132             {
02133                 updateShader(_pActiveState);
02134             }
02135     
02136             if(pRoot->getGeometry() != NULL)
02137             {
02138                 pRoot->getGeometry()->drawPrimitives(this);
02139                 _uiNumGeometries++;
02140             }
02141             else if(pRoot->hasFunctor())
02142             {
02143                 pRoot->getFunctor().call(this);
02144                 _uiNumGeometries++;
02145             }
02146     
02147             if(pNewState != NULL && pRoot->isLastMultiPass()) // last pass
02148             {
02149                 // without this the deactivate would be called in the next
02150                 // changeFrom call, but before the deactivate the activate from
02151                 // the new state is called this conflicts with the cgfx chunk!
02152                 _pActiveState = NULL; // force a activate
02153     
02154                 pNewState->deactivate(this);
02155                 _uiNumMaterialChanges++;
02156             }
02157         }
02158 
02159         if(pRoot->getFirstChild() != NULL)
02160         {
02161             draw(pRoot->getFirstChild());
02162         }
02163 
02164         pRoot = pRoot->getBrother();
02165     }
02166 }

void osg::RenderAction::updateTopMatrix ( void   )  [inline, protected]

void RenderAction::activateLocalLights ( DrawTreeNode pRoot  )  [protected]

Definition at line 1449 of file OSGRenderAction.cpp.

References _activeLightsCount, _activeLightsMask, _activeLightsState, _lightsTable, _uiNumLightChanges, _vLights, osg::DrawTreeNode::getLightsState(), osg::Color4< ValueTypeT >::getValuesRGBA(), and SWARNING.

Referenced by draw().

01450 {
01451     //printf("lightsState: %u %u\n", _activeLightsState, pRoot->getLightsState());
01452     if(_activeLightsState == pRoot->getLightsState())
01453         return;
01454 
01455     UInt32 light_id = 0;
01456     if(pRoot->getLightsState() > 0)
01457     {
01458         _activeLightsMask = 0;
01459         const std::vector<UInt32> &lights = _lightsTable[pRoot->getLightsState() - 1];
01460 
01461         //printf("activate lights: %u : ", pRoot->getLightsState() - 1);
01462         for(UInt32 i=0;i<lights.size();++i)
01463         {
01464             UInt32 light_index = lights[i] - 1;
01465             glPushMatrix();
01466             glLoadMatrixf(_vLights[light_index].second.getValues());
01467             _activeLightsMask |= (1 << light_id);
01468             //printf("%u,", light_id);
01469             _vLights[light_index].first->activate(this, light_id++);
01470             glPopMatrix();
01471             ++_uiNumLightChanges;
01472         }
01473         //printf("\n");
01474     }
01475 
01476     if(light_id > 8)
01477     {
01478         SWARNING << "RenderAction::activateLocalLights: maximum light source limit is " <<  8
01479                  << std::endl;
01480     }
01481 
01482     //printf("deactivate lights: ");
01483     const Color4f black(0.0f, 0.0f, 0.0f, 1.0f);
01484     for(UInt32 i = light_id;i < _activeLightsCount;++i)
01485     {
01486         //printf("%u,", i);
01487         _activeLightsMask &= ~(1 << i);
01488         // reset diffuse color to black that's quite usefull for shaders.
01489         glLightfv(GL_LIGHT0 + i, GL_DIFFUSE,
01490                   black.getValuesRGBA());
01491         glDisable(GL_LIGHT0 + i);
01492         ++_uiNumLightChanges;
01493     }
01494     //printf("\n");
01495 
01496     _activeLightsState = pRoot->getLightsState();
01497     _activeLightsCount = light_id;
01498 }

void RenderAction::activateLocalClipPlanes ( DrawTreeNode pRoot  )  [protected]

Definition at line 1500 of file OSGRenderAction.cpp.

References _activeClipPlanesCount, _activeClipPlanesMask, _activeClipPlanesState, _clipPlanesTable, _vClipPlanes, osg::DrawTreeNode::getClipPlanesState(), and SWARNING.

Referenced by draw().

01501 {
01502     //printf("clipPlanesState: %u %u\n", _activeClipPlanesState, pRoot->getClipPlanesState());
01503     if(_activeClipPlanesState == pRoot->getClipPlanesState())
01504         return;
01505 
01506     UInt32 clipPlane_id = 0;
01507     if(pRoot->getClipPlanesState() > 0)
01508     {
01509         _activeClipPlanesMask = 0;
01510         const std::vector<UInt32> &clipPlanes = _clipPlanesTable[pRoot->getClipPlanesState() - 1];
01511 
01512         //printf("activate clipPlanes: %u : ", pRoot->getClipPlanesState() - 1);
01513         for(UInt32 i=0;i<clipPlanes.size();++i)
01514         {
01515             UInt32 clipPlane_index = clipPlanes[i] - 1;
01516             glPushMatrix();
01517             glLoadMatrixf(_vClipPlanes[clipPlane_index].second.getValues());
01518             _activeClipPlanesMask |= (1 << clipPlane_id);
01519             //printf("%u,", clipPlane_id);
01520             _vClipPlanes[clipPlane_index].first->activate(this, clipPlane_id++);
01521             glPopMatrix();
01522         }
01523         //printf("\n");
01524     }
01525 
01526     if(clipPlane_id > 6)
01527     {
01528         SWARNING << "RenderAction::activateLocalClipPlanes: maximum clipping planes limit is " <<  6
01529                  << std::endl;
01530     }
01531 
01532     //printf("deactivate clipPlanes: ");
01533     const Color4f black(0.0f, 0.0f, 0.0f, 1.0f);
01534     for(UInt32 i = clipPlane_id;i < _activeClipPlanesCount;++i)
01535     {
01536         //printf("%u,", i);
01537         _activeClipPlanesMask &= ~(1 << i);
01538         glDisable(GL_CLIP_PLANE0 + i);
01539     }
01540     //printf("\n");
01541 
01542     _activeClipPlanesState = pRoot->getClipPlanesState();
01543     _activeClipPlanesCount = clipPlane_id;
01544 }

void RenderAction::getMaterialStates ( Material mat,
std::vector< State * > &  states 
) [protected]

Definition at line 504 of file OSGRenderAction.cpp.

References osg::AttachmentContainerPtr::getCPtr(), osg::FieldContainerPtr::getCPtr(), osg::SwitchMaterial::getCurrentMaterial(), osg::MultiPassMaterialBase::getMaterials(), osg::Material::getNPasses(), osg::MultiPassMaterial::getNPasses(), osg::MultiPassMaterial::getState(), osg::Material::getState(), and osg::Material::isMultiPass().

Referenced by dropFunctor(), and dropGeometry().

00505 {
00506     if(!mat->isMultiPass())
00507     {
00508         states.push_back(mat->getState().getCPtr());
00509     }
00510     else
00511     {
00512         // HACK need to find a nicer solution.
00513         MultiPassMaterial *mmat = dynamic_cast<MultiPassMaterial *>(mat);
00514         if(mmat != NULL)
00515         {
00516             // first check for a real multipass material.
00517             UInt32 passes = mmat->getMaterials().getSize();
00518             if(passes > 0)
00519             {
00520                 for(UInt32 i=0;i<passes;++i)
00521                 {
00522                     getMaterialStates(mmat->getMaterials(i).getCPtr(), states);
00523                 }
00524             }
00525             else
00526             {
00527                 // could be a derived multipass material like CGFXMaterial which overrides
00528                 // only some virtual methods.
00529                 passes = mmat->getNPasses();
00530                 for(UInt32 i=0;i<passes;++i)
00531                     states.push_back(mmat->getState(i).getCPtr());
00532             }
00533         }
00534         else
00535         {
00536             SwitchMaterial *swmat = dynamic_cast<SwitchMaterial *>(mat);
00537             if(swmat != NULL)
00538             {
00539                 getMaterialStates(swmat->getCurrentMaterial().getCPtr(), states);
00540             }
00541             else
00542             {
00543                 UInt32 passes = mat->getNPasses();
00544                 for(UInt32 i=0;i<passes;++i)
00545                     states.push_back(mat->getState(i).getCPtr());
00546             }
00547         }
00548     }
00549 }

Viewport * osg::DrawActionBase::getViewport ( void   )  const [inline, inherited]

void DrawActionBase::setViewport ( Viewport viewport  )  [inherited]

Definition at line 274 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_viewport.

Referenced by osg::Viewport::draw(), osg::Viewport::render(), and osg::FBOViewport::render().

00275 {
00276     _viewport = viewport;
00277 }

Camera * osg::DrawActionBase::getCamera ( void   )  const [inline, inherited]

void DrawActionBase::setCamera ( Camera cam  )  [inherited]

Definition at line 279 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_camera.

Referenced by osg::Viewport::draw(), osg::Viewport::render(), and osg::FBOViewport::render().

00280 {
00281     _camera = cam;
00282 }

const Matrix & osg::DrawActionBase::getCameraToWorld ( void   )  [inline, inherited]

Background * osg::DrawActionBase::getBackground ( void   )  const [inline, inherited]

Definition at line 107 of file OSGDrawActionBase.inl.

References osg::DrawActionBase::_background.

00108 {
00109     return _background;
00110 }

void DrawActionBase::setBackground ( Background background  )  [inherited]

Definition at line 284 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_background.

Referenced by osg::Viewport::draw(), osg::Viewport::render(), and osg::FBOViewport::render().

00285 {
00286     _background = background;
00287 }

Window * osg::DrawActionBase::getWindow ( void   )  const [inline, inherited]

Definition at line 113 of file OSGDrawActionBase.inl.

References osg::DrawActionBase::_window.

Referenced by osg::TextureTransformChunk::activate(), osg::TextureChunk::activate(), osg::TexGenChunk::activate(), osg::SHLParameterChunk::activate(), osg::SHLChunk::activate(), osg::RegisterCombinersChunk::activate(), osg::ProgramChunk::activate(), osg::PointChunk::activate(), osg::DVRSimpleLUTShader::activate(), osg::CubeTextureChunk::activate(), osg::BlendChunk::activate(), osg::DVRIsoShader::activate_NVRegisterCombinerShading(), osg::DVRSimpleLUTShader::brickActivate(), osg::TextureTransformChunk::changeFrom(), osg::TextureChunk::changeFrom(), osg::TexGenChunk::changeFrom(), osg::SHLParameterChunk::changeFrom(), osg::SHLChunk::changeFrom(), osg::ProgramChunk::changeFrom(), osg::PointChunk::changeFrom(), osg::CubeTextureChunk::changeFrom(), osg::BlendChunk::changeFrom(), osg::TextureGrabBackground::clear(), osg::TextureTransformChunk::deactivate(), osg::TextureChunk::deactivate(), osg::TexGenChunk::deactivate(), osg::SHLChunk::deactivate(), osg::ProgramChunk::deactivate(), osg::PointChunk::deactivate(), osg::DVRSimpleLUTShader::deactivate(), osg::CubeTextureChunk::deactivate(), osg::BlendChunk::deactivate(), osg::TextureGrabForeground::draw(), drawShaderStrips< posTrait, secPosTrait, colTrait, texTrait, sizeTrait, normalTrait >::draw(), drawShaderQuads< posTrait, secPosTrait, colTrait, texTrait, sizeTrait, normalTrait >::draw(), osg::DVRVolume::draw(), drawShaderStrips< posTrait, secPosTrait, colTrait, texTrait, sizeTrait, normalTrait >::drawIndexed(), drawShaderQuads< posTrait, secPosTrait, colTrait, texTrait, sizeTrait, normalTrait >::drawIndexed(), osg::Surface::drawPrimitives(), osg::Slices::drawPrimitives(), osg::Geometry::drawPrimitives(), osg::DVRMtexLUTShader::initCombiners(), osg::DVRIsoShader::initCombiners_Diffuse2Combiners(), osg::DVRIsoShader::initCombiners_DiffuseMultiCombiners(), osg::DVRIsoShader::initCombiners_IsoSurfaceDiffuse(), osg::DVRIsoShader::initCombiners_IsoSurfaceSpecular(), osg::DVRIsoShader::initCombiners_Specular2Combiners(), osg::DVRIsoShader::initCombiners_SpecularMultiCombiners(), osg::DVRSimpleLUTShader::initialize(), osg::DVRMtexLUTShader::initialize(), osg::DVRVolume::initializeClipObjects(), osg::DVRSimpleLUTShader::isModeSupported(), osg::DVRIsoShader::isModeSupported(), osg::BrickSet::reloadBrickTextures(), osg::FBOViewport::render(), osg::DVRMtexLUTShader::renderSlice(), osg::DVRIsoShader::renderSlice_NVRegisterCombinerShading(), osg::DVRSimpleLUTShader::setupAlphaCorrectionRegisterCombiners(), osg::DVRIsoShader::setupCombinerParametersDiffuse(), osg::DVRIsoShader::setupCombinerParametersSpecular(), osg::SHLChunk::update(), osg::SHLChunk::updateActiveLightsMask(), osg::SHLChunk::updateCameraOrientation(), osg::SHLChunk::updateCameraPosition(), osg::SHLChunk::updateClusterId(), osg::SHLChunk::updateInvViewMatrix(), osg::SHLChunk::updateInvWorldMatrix(), osg::SHLChunk::updateLight0Active(), osg::SHLChunk::updateLight1Active(), osg::SHLChunk::updateLight2Active(), osg::SHLChunk::updateLight3Active(), osg::SHLChunk::updateLight4Active(), osg::SHLChunk::updateLight5Active(), osg::SHLChunk::updateLight6Active(), osg::SHLChunk::updateLight7Active(), osg::SHLChunk::updateOSGParameters(), osg::SHLChunk::updateStereoLeftEye(), osg::SHLChunk::updateTransInvWorldMatrix(), osg::SHLChunk::updateViewMatrix(), and osg::SHLChunk::updateWorldMatrix().

00114 {
00115     return _window;
00116 }

void DrawActionBase::setWindow ( Window window  )  [inherited]

StatCollector * osg::DrawActionBase::getStatistics ( void   )  [inline, inherited]

void DrawActionBase::setStatistics ( StatCollector stat  )  [inherited]

Definition at line 294 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_ownStat, and osg::DrawActionBase::_statistics.

Referenced by osg::SimpleSceneManager::setStatistics().

00295 {
00296 #if 0 // Altered for last frame time
00297     _statistics = statistics;
00298     _ownStat = false;
00299 #else
00300     if (_ownStat) {
00301        delete _statistics;
00302     }
00303     _statistics = statistics;
00304     _ownStat = false;
00305 #endif
00306 }

bool osg::DrawActionBase::hasOwnStat ( void   )  [inline, inherited]

Definition at line 160 of file OSGDrawActionBase.inl.

References osg::DrawActionBase::_ownStat.

00161 {
00162     return _ownStat;
00163 }

bool osg::DrawActionBase::getFrustumCulling ( void   )  const [inline, inherited]

void DrawActionBase::setFrustumCulling ( bool  val = true  )  [inherited]

Definition at line 312 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_frustumCulling.

Referenced by osg::RenderOptions::activateOptions().

00313 {
00314     _frustumCulling = frustumCulling;
00315 }

bool osg::DrawActionBase::getVolumeDrawing ( void   )  const [inline, inherited]

void DrawActionBase::setVolumeDrawing ( bool  val = false  )  [inherited]

Definition at line 328 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_volumeDrawing.

00329 {
00330     _volumeDrawing = volumeDrawing;
00331 }

bool osg::DrawActionBase::getAutoFrustum ( void   )  const [inline, inherited]

Definition at line 137 of file OSGDrawActionBase.inl.

References osg::DrawActionBase::_autoFrustum.

Referenced by osg::DrawActionBase::start().

00138 {
00139     return _autoFrustum;
00140 }

void DrawActionBase::setAutoFrustum ( bool  val = true  )  [inherited]

Definition at line 320 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_autoFrustum.

00321 {
00322     _autoFrustum = autoFrustum;
00323 }

const FrustumVolume & osg::DrawActionBase::getFrustum ( void   )  const [inline, inherited]

Definition at line 143 of file OSGDrawActionBase.inl.

References osg::DrawActionBase::_frustum.

00144 {
00145     return _frustum;
00146 }

void DrawActionBase::setFrustum ( FrustumVolume frust  )  [inherited]

Definition at line 335 of file OSGDrawActionBase.cpp.

References osg::DrawActionBase::_frustum.

00336 {
00337     _frustum = frustum;
00338 }

UInt32 DrawActionBase::selectVisibles ( void   )  [inherited]

Definition at line 341 of file OSGDrawActionBase.cpp.

References osg::Action::addNode(), osg::dropVolume(), osg::getCPtr(), osg::DrawActionBase::getFrustumCulling(), osg::Action::getNNodes(), osg::Action::getNode(), osg::DrawActionBase::getVolumeDrawing(), osg::DrawActionBase::isVisible(), osg::Color3< ValueTypeT >::setValuesRGB(), and osg::Action::useNodeList().

Referenced by osg::Switch::draw(), osg::Transform::drawEnter(), osg::MaterialGroup::drawEnter(), osg::Light::drawEnter(), osg::Inline::drawEnter(), osg::Group::drawEnter(), osg::Light::renderEnter(), osg::Group::renderEnter(), and osg::ClipPlane::renderEnter().

00342 {
00343     if(getFrustumCulling() == false)
00344         return getNNodes();
00345 
00346     useNodeList();
00347 
00348     Color3f col;
00349     
00350     UInt32 count = 0;
00351     for ( UInt32 i = 0; i < getNNodes(); i++ )
00352     {
00353         if ( isVisible( getNode(i).getCPtr() ) )
00354         {
00355             col.setValuesRGB(0,1,0);
00356             addNode( getNode(i) );
00357             ++count;
00358         }
00359         else
00360             col.setValuesRGB(1,0,0);
00361         
00362         if(getVolumeDrawing())
00363         {
00364             dropVolume(this, getNode(i), col);
00365         }
00366     }
00367 
00368     return count;
00369 }

Material * osg::DrawActionBase::getMaterial ( void   )  const [inline, inherited]

NodePtr osg::DrawActionBase::getMaterialNode ( void   )  const [inline, inherited]

Definition at line 172 of file OSGDrawActionBase.inl.

References osg::DrawActionBase::_pMaterialNode.

Referenced by osg::MaterialGroup::drawLeave(), and osg::MaterialGroup::renderLeave().

00173 {
00174     return _pMaterialNode;
00175 }

void DrawActionBase::setMaterial ( Material pMaterial,
NodePtr  node 
) [inherited]

static const char* osg::Action::getClassname ( void   )  [inline, static, inherited]

Reimplemented in osg::DrawAction, osg::IntersectAction, and osg::VRMLWriteAction.

Definition at line 109 of file OSGAction.h.

00109 { return "Action"; }

void Action::setPrototype ( Action proto  )  [static, inherited]

Definition at line 119 of file OSGAction.cpp.

References osg::Action::_prototype.

00120 {
00121     _prototype = proto;
00122 }

void Action::registerEnterFunction ( const FieldContainerType type,
const Functor func 
) [inherited]

Definition at line 201 of file OSGAction.cpp.

References osg::Action::_defaultEnterFunction(), osg::Action::_enterFunctors, osg::TypeBase::getId(), and osg::osgTypedFunctionFunctor2CPtrRef().

00203 {
00204     while ( type.getId() >= _enterFunctors.size() )
00205     {
00206         _enterFunctors.push_back(
00207             osgTypedFunctionFunctor2CPtrRef<
00208                 ResultE, 
00209                 CNodePtr,
00210                 Action *                   >(&Action::_defaultEnterFunction));
00211     }
00212     
00213     _enterFunctors[ type.getId() ] = func;
00214 }

void Action::registerLeaveFunction ( const FieldContainerType type,
const Functor func 
) [inherited]

Definition at line 216 of file OSGAction.cpp.

References osg::Action::_defaultLeaveFunction(), osg::Action::_leaveFunctors, osg::TypeBase::getId(), and osg::osgTypedFunctionFunctor2CPtrRef().

00218 {
00219     while ( type.getId() >= _leaveFunctors.size() )
00220     {
00221         _leaveFunctors.push_back(
00222             osgTypedFunctionFunctor2CPtrRef<
00223                 ResultE, 
00224                 CNodePtr,
00225                 Action *                   >(&Action::_defaultLeaveFunction));
00226     }
00227     
00228     _leaveFunctors[ type.getId() ] = func;
00229 }

Action::ResultE Action::apply ( std::vector< NodePtr >::iterator  begin,
std::vector< NodePtr >::iterator  end 
) [virtual, inherited]

Reimplemented in osg::VRMLWriteAction.

Definition at line 235 of file OSGAction.cpp.

References osg::Action::callStart(), osg::Action::callStop(), osg::Action::Continue, osg::NullFC, osg::Action::Quit, osg::Action::recurse(), and SWARNING.

Referenced by osg::VRMLWriteAction::apply(), osg::Action::apply(), osg::Navigator::buttonRelease(), osg::Viewport::draw(), osg::WalkNavigator::forward(), osg::Navigator::getIntersectionPoint(), osg::Viewport::render(), osg::FBOViewport::render(), osg::WalkNavigator::right(), and osg::VRMLWriteAction::write().

00237 {
00238     Action::ResultE res = Continue;
00239     
00240     // call the start function and its' returns
00241     if ( ( res = callStart() ) != Continue )
00242         return res;     
00243     
00244     // call the given nodes
00245     
00246     for ( ; begin != end; begin ++ )
00247     {
00248         if ( *begin == NullFC )
00249         {
00250             SWARNING << "apply: encountered NullNode!" << std::endl;
00251             return Quit;            
00252         }
00253         else
00254         {
00255             res = recurse( *begin );
00256             
00257             if ( res != Continue )
00258                 break;
00259         }
00260     }
00261         
00262     // call the stop function and its' returns
00263     res = callStop( res );  
00264     
00265     return res;
00266 }

Action::ResultE Action::apply ( NodePtr  node  )  [virtual, inherited]

Reimplemented in osg::VRMLWriteAction.

Definition at line 268 of file OSGAction.cpp.

References osg::Action::apply(), osg::NullFC, osg::Action::Quit, and SWARNING.

00269 {
00270     if(node == NullFC)
00271     {
00272         SWARNING << "apply: node is Null!" << std::endl;
00273         return Quit;            
00274     }
00275 
00276     std::vector<NodePtr> nodeList;
00277 
00278     nodeList.push_back(node);
00279 
00280     return apply(nodeList.begin(), nodeList.end());
00281 }

NodePtr osg::Action::getActNode ( void   )  [inline, inherited]

UInt32 osg::Action::getNNodes ( void   )  const [inline, inherited]

Definition at line 92 of file OSGAction.inl.

References osg::Action::_actList, and osg::Action::_actNode.

Referenced by osg::Switch::draw(), osg::DistanceLOD::draw(), osg::Switch::intersect(), and osg::DrawActionBase::selectVisibles().

00093 {
00094     if ( ! _actList )
00095     {
00096         return _actNode->getNChildren();
00097     }
00098     else
00099     {
00100         return (*_actList).size();
00101     }
00102 }

const NodePtr osg::Action::getNode ( int  index  )  [inline, inherited]

Definition at line 67 of file OSGAction.inl.

References osg::Action::_actList, and osg::Action::_actNode.

Referenced by osg::Switch::draw(), osg::DistanceLOD::draw(), osg::Switch::intersect(), and osg::DrawActionBase::selectVisibles().

00068 {
00069     if ( ! _actList )
00070     {
00071         return _actNode->getChild( index );
00072     }
00073     else
00074     {
00075         return (*_actList)[ index ];
00076     }
00077 }

void osg::Action::addNode ( NodePtr  node  )  [inline, inherited]

Definition at line 80 of file OSGAction.inl.

References osg::Action::_newList.

Referenced by osg::Switch::draw(), osg::ProxyGroup::draw(), osg::DistanceLOD::draw(), osg::Switch::intersect(), and osg::DrawActionBase::selectVisibles().

00081 {
00082     _newList.push_back( node );
00083 }

void osg::Action::useNodeList ( void   )  [inline, inherited]

UInt32 osg::Action::getTravMask ( void   )  const [inline, inherited]

Definition at line 106 of file OSGAction.inl.

References osg::Action::_travMask.

Referenced by osg::Action::recurse().

00107 {
00108     return _travMask;
00109 }

void osg::Action::setTravMask ( UInt32  val  )  [inline, inherited]

Definition at line 112 of file OSGAction.inl.

References osg::Action::_travMask.

Referenced by osg::Viewport::draw(), osg::Viewport::render(), and osg::FBOViewport::render().

00113 {
00114     _travMask = val;
00115 }

bool Action::operator< ( const Action other  )  [inherited]

Definition at line 458 of file OSGAction.cpp.

00459 {
00460     return this < &other;
00461 }

bool Action::operator== ( const Action other  )  [inherited]

Definition at line 466 of file OSGAction.cpp.

00467 {
00468     return false;
00469 }

bool Action::operator!= ( const Action other  )  [inherited]

Definition at line 474 of file OSGAction.cpp.

00475 {
00476     return ! (*this == other);
00477 }

Action::ResultE osg::Action::callEnter ( NodePtr  node  )  [inline, protected, inherited]

Definition at line 124 of file OSGAction.inl.

References osg::Action::_defaultEnterFunction(), osg::Action::_enterFunctors, osg::NodePtr::getCore(), osg::Action::getDefaultEnterFunctors(), osg::TypeBase::getId(), and osg::NodeCore::getType().

Referenced by osg::Action::recurse().

00125 {
00126     ResultE result;
00127 
00128     UInt32 uiFunctorIndex = node->getCore()->getType().getId();
00129     CNodePtr cnode(node);
00130 
00131     if ( uiFunctorIndex < _enterFunctors.size() )
00132         result = _enterFunctors[uiFunctorIndex].call(cnode,this);
00133     else if (  getDefaultEnterFunctors() &&
00134                 uiFunctorIndex < getDefaultEnterFunctors()->size() )
00135     {
00136         // field container registered method after this action was instantiated
00137         // copy the new functors from default vector
00138         std::vector<Functor> *defaultEnter = getDefaultEnterFunctors();
00139 
00140         while ( defaultEnter->size() > _enterFunctors.size() )
00141         {
00142             _enterFunctors.push_back( (*defaultEnter)[_enterFunctors.size()] );
00143         }
00144         result = _enterFunctors[uiFunctorIndex].call(cnode,this);
00145     }
00146     else // unknown field container
00147         result = _defaultEnterFunction(cnode,this);
00148 
00149     return result;
00150 }

Action::ResultE osg::Action::callLeave ( NodePtr  node  )  [inline, protected, inherited]

Definition at line 153 of file OSGAction.inl.

References osg::Action::_defaultLeaveFunction(), osg::Action::_leaveFunctors, osg::NodePtr::getCore(), osg::Action::getDefaultLeaveFunctors(), osg::TypeBase::getId(), and osg::NodeCore::getType().

Referenced by osg::Action::recurse().

00154 {
00155     ResultE result;
00156 
00157     UInt32 uiFunctorIndex = node->getCore()->getType().getId();
00158     CNodePtr cnode(node);
00159 
00160     if ( uiFunctorIndex < _leaveFunctors.size() )
00161         result = _leaveFunctors[uiFunctorIndex].call(cnode,this);
00162     else if (   getDefaultLeaveFunctors() &&
00163                 uiFunctorIndex < getDefaultLeaveFunctors()->size() )
00164     {
00165         // field container registered method after this action was instantiated
00166         // copy the new functors from default vector
00167         std::vector<Functor> *defaultLeave = getDefaultLeaveFunctors();
00168 
00169         while ( defaultLeave->size() > _leaveFunctors.size() )
00170         {
00171             _leaveFunctors.push_back( (*defaultLeave)[_leaveFunctors.size()] );
00172         }
00173         result = _leaveFunctors[uiFunctorIndex].call(cnode,this);
00174     }
00175     else // unknown field container
00176         result = _defaultLeaveFunction(cnode,this);
00177 
00178     return result;
00179 }

Action::ResultE Action::recurse ( NodePtr  node  )  [protected, inherited]

Definition at line 288 of file OSGAction.cpp.

References osg::Action::_actList, osg::Action::_actNode, osg::Action::_newList, osg::Action::_useNewList, osg::Action::callEnter(), osg::Action::callLeave(), osg::Action::callNewList(), osg::Action::Continue, osg::NodePtr::getCore(), osg::Action::getTravMask(), osg::NullFC, osg::Action::Quit, osg::Action::Skip, and SWARNING.

Referenced by osg::Action::apply(), and osg::Action::callNewList().

00289 {
00290     if ( node == NullFC )
00291         return Continue;
00292 
00293     if((node->getTravMask() & getTravMask()) == 0)
00294         return Continue;
00295 
00296     if(node->getOcclusionMask() & 1)
00297         return Continue;
00298 
00299     NodeCorePtr core = node->getCore();
00300     
00301     if ( core == NullFC )
00302     {
00303         SWARNING << "recurse: core is Null,  don't know what to do!" 
00304                  << std::endl;
00305         return Quit;                    
00306     }
00307     
00308     Action::ResultE result;
00309     
00310     _actList = NULL;
00311     _actNode = node;
00312     _newList.clear();
00313     _useNewList = false;
00314     
00315     result = callEnter( node );
00316 
00317     if ( result != Continue )
00318     {
00319         if ( result == Skip )
00320             return Continue;
00321     
00322         return result;
00323     }
00324     
00325     if ( ! _newList.empty() )
00326     {
00327         result = callNewList();
00328     }
00329     else if ( ! _useNewList ) // new list is empty, but not used?
00330     {
00331         std::vector<NodePtr>::iterator it;
00332 
00333         for ( it = node->getMFChildren()->begin(); it != node->getMFChildren()->end(); it ++ )
00334         {
00335             result = recurse( *it );
00336             
00337             if ( result != Continue )
00338                 break;
00339         }
00340     }   
00341 
00342     _actNode = node;
00343     if ( result == Continue )
00344         result = callLeave( node );
00345     else
00346         callLeave( node );
00347 
00348     if ( result == Skip )
00349         return Continue;
00350         
00351     return result;
00352 }

Action::ResultE Action::callNewList ( void   )  [protected, inherited]

Definition at line 355 of file OSGAction.cpp.

References osg::Action::_actList, osg::Action::_newList, osg::Action::Continue, and osg::Action::recurse().

Referenced by osg::Action::callStart(), osg::Action::callStop(), and osg::Action::recurse().

00356 {
00357     Action::ResultE result = Continue;
00358 
00359     // need to make a copy, because the one in the action is cleared
00360 
00361     std::vector<NodePtr> nodeList;
00362     nodeList.swap(_newList);
00363 
00364     std::vector<NodePtr>::iterator it;
00365 
00366     _actList = &nodeList;
00367 
00368     for(it = nodeList.begin(); it != nodeList.end(); ++it)
00369     {
00370         result = recurse(*it);
00371 
00372         if(result != Continue)
00373             break;
00374     }
00375     
00376     return result;
00377 }

Action::ResultE Action::_defaultEnterFunction ( CNodePtr node,
Action action 
) [static, protected, inherited]

Action::ResultE Action::_defaultLeaveFunction ( CNodePtr node,
Action action 
) [static, protected, inherited]

void osg::Action::setActNode ( NodePtr  node  )  [inline, protected, inherited]

Definition at line 61 of file OSGAction.inl.

References osg::Action::_actNode.

Referenced by draw().

00062 {
00063     _actNode = node;
00064 }


Friends And Related Function Documentation

friend class ShadowViewport [friend]

Definition at line 424 of file OSGRenderAction.h.


Member Data Documentation

Definition at line 110 of file OSGRenderAction.h.

Referenced by stop().

Definition at line 111 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 112 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 113 of file OSGRenderAction.h.

Referenced by stop().

Definition at line 114 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 115 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 118 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 119 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 120 of file OSGRenderAction.h.

Referenced by osg::SimpleSceneManager::initialize(), and stop().

Definition at line 122 of file OSGRenderAction.h.

Referenced by dropFunctor(), isOccluded(), and stop().

Definition at line 123 of file OSGRenderAction.h.

Referenced by isOccluded(), and stop().

Definition at line 124 of file OSGRenderAction.h.

Referenced by drawMultiFrameOcclusionBB(), isOccluded(), and stop().

Definition at line 254 of file OSGRenderAction.h.

Referenced by start().

RenderAction * RenderAction::_pPrototype = NULL [static, protected]

Definition at line 272 of file OSGRenderAction.h.

Referenced by create(), getPrototype(), and setPrototype().

std::vector< Action::Functor > * RenderAction::_vDefaultEnterFunctors = NULL [static, protected]

Definition at line 274 of file OSGRenderAction.h.

Referenced by getDefaultEnterFunctors(), registerEnterDefault(), and RenderAction().

std::vector< Action::Functor > * RenderAction::_vDefaultLeaveFunctors = NULL [static, protected]

Definition at line 275 of file OSGRenderAction.h.

Referenced by getDefaultLeaveFunctors(), registerLeaveDefault(), and RenderAction().

Definition at line 285 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), RenderAction(), start(), and ~RenderAction().

Definition at line 287 of file OSGRenderAction.h.

Referenced by push_matrix(), and start().

Definition at line 290 of file OSGRenderAction.h.

Referenced by dropClipPlane(), dropLight(), start(), and updateTopMatrix().

Definition at line 292 of file OSGRenderAction.h.

Referenced by pop_matrix(), and push_matrix().

Definition at line 294 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), and start().

Definition at line 298 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), start(), and stop().

Definition at line 302 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), start(), and stop().

Definition at line 304 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), start(), and stop().

Definition at line 305 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), start(), and stop().

Definition at line 308 of file OSGRenderAction.h.

Referenced by dropFunctor(), start(), and stop().

Definition at line 310 of file OSGRenderAction.h.

Referenced by draw(), drawMultiFrameOcclusionBB(), start(), and stop().

Definition at line 311 of file OSGRenderAction.h.

Referenced by draw(), getCurrentState(), start(), and stop().

Definition at line 313 of file OSGRenderAction.h.

Referenced by draw(), start(), and stop().

Definition at line 314 of file OSGRenderAction.h.

Referenced by draw(), drawMultiFrameOcclusionBB(), start(), and stop().

Definition at line 315 of file OSGRenderAction.h.

Referenced by activateLocalLights(), start(), and stop().

Definition at line 316 of file OSGRenderAction.h.

Referenced by draw(), start(), and stop().

Definition at line 317 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), start(), and stop().

Definition at line 318 of file OSGRenderAction.h.

Referenced by isOccluded(), start(), and stop().

Definition at line 319 of file OSGRenderAction.h.

Referenced by isOccluded(), start(), and stop().

Definition at line 321 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), getSortTrans(), and setSortTrans().

Definition at line 322 of file OSGRenderAction.h.

Referenced by getZWriteTrans(), setZWriteTrans(), and stop().

Definition at line 324 of file OSGRenderAction.h.

Referenced by draw(), getCorrectTwoSidedLighting(), and setCorrectTwoSidedLighting().

Definition at line 329 of file OSGRenderAction.h.

Referenced by getOcclusionQuery(), and resetOcclusionQueryIndex().

std::vector<NodePtr> osg::RenderAction::_occluded_nodes [protected]

Definition at line 330 of file OSGRenderAction.h.

Referenced by deleteOcclusionQueriesPool(), isOccluded(), and stop().

Definition at line 331 of file OSGRenderAction.h.

Referenced by deleteOcclusionQueriesPool(), and stop().

Definition at line 332 of file OSGRenderAction.h.

Referenced by drawOcclusionBB(), and ~RenderAction().

Definition at line 335 of file OSGRenderAction.h.

Referenced by getSmallFeaturePixels(), isSmallFeature(), and setSmallFeaturePixels().

Definition at line 337 of file OSGRenderAction.h.

Referenced by isSmallFeature(), and start().

Definition at line 338 of file OSGRenderAction.h.

Referenced by getUseGLFinish(), setUseGLFinish(), and stop().

std::vector<LightStore> osg::RenderAction::_vLights [protected]

Definition at line 340 of file OSGRenderAction.h.

Referenced by activateLocalLights(), dropLight(), start(), and stop().

std::vector<Light *> osg::RenderAction::_lightsMap [protected]

Definition at line 341 of file OSGRenderAction.h.

Referenced by dropLight(), getActiveLights(), and start().

Definition at line 343 of file OSGRenderAction.h.

Referenced by activateLocalLights(), draw(), getActiveLights(), and start().

Definition at line 344 of file OSGRenderAction.h.

Referenced by activateLocalLights(), getActiveLightsCount(), start(), and stop().

Definition at line 345 of file OSGRenderAction.h.

Referenced by activateLocalLights(), getActiveLightsMask(), start(), and stop().

std::vector<std::vector<UInt32> > osg::RenderAction::_lightsTable [protected]

std::vector<UInt32> osg::RenderAction::_lightsPath [protected]

Definition at line 348 of file OSGRenderAction.h.

Referenced by dropLight(), start(), undropLight(), and undropLightEnv().

Definition at line 352 of file OSGRenderAction.h.

Referenced by activateLocalClipPlanes(), dropClipPlane(), and start().

std::vector<ClipPlane *> osg::RenderAction::_clipPlanesMap [protected]

Definition at line 353 of file OSGRenderAction.h.

Referenced by dropClipPlane(), and start().

Definition at line 354 of file OSGRenderAction.h.

Referenced by dropClipPlane(), dropFunctor(), dropGeometry(), start(), and undropClipPlane().

Definition at line 355 of file OSGRenderAction.h.

Referenced by activateLocalClipPlanes(), and start().

Definition at line 356 of file OSGRenderAction.h.

Referenced by activateLocalClipPlanes(), start(), and stop().

Definition at line 357 of file OSGRenderAction.h.

Referenced by activateLocalClipPlanes(), and start().

std::vector<std::vector<UInt32> > osg::RenderAction::_clipPlanesTable [protected]

Definition at line 359 of file OSGRenderAction.h.

Referenced by activateLocalClipPlanes(), dropClipPlane(), and start().

std::vector<UInt32> osg::RenderAction::_clipPlanesPath [protected]

Definition at line 360 of file OSGRenderAction.h.

Referenced by dropClipPlane(), start(), and undropClipPlane().

Definition at line 362 of file OSGRenderAction.h.

Referenced by dropFunctor(), dropGeometry(), getStateSorting(), setStateSorting(), and start().

Definition at line 364 of file OSGRenderAction.h.

Referenced by popVisibility(), pushVisibility(), and start().

Definition at line 366 of file OSGRenderAction.h.

Referenced by isOccluded(), and ~RenderAction().

Definition at line 367 of file OSGRenderAction.h.

Referenced by deleteOcclusionQueriesPool(), and getOcclusionQuery().

Definition at line 370 of file OSGRenderAction.h.

Referenced by RenderAction(), and updateShader().

Definition at line 371 of file OSGRenderAction.h.

Referenced by draw(), RenderAction(), and updateShader().

Definition at line 372 of file OSGRenderAction.h.

Referenced by RenderAction(), and updateShader().

Definition at line 374 of file OSGRenderAction.h.

Referenced by RenderAction(), and start().

UInt32 RenderAction::_funcGenQueriesARB = Window::invalidFunctionID [static, protected]

Definition at line 375 of file OSGRenderAction.h.

Referenced by RenderAction(), and start().

UInt32 RenderAction::_funcDeleteQueriesARB = Window::invalidFunctionID [static, protected]

Definition at line 376 of file OSGRenderAction.h.

Referenced by RenderAction(), and start().

UInt32 RenderAction::_funcBeginQueryARB = Window::invalidFunctionID [static, protected]

Definition at line 377 of file OSGRenderAction.h.

Referenced by RenderAction(), and start().

UInt32 RenderAction::_funcEndQueryARB = Window::invalidFunctionID [static, protected]

Definition at line 378 of file OSGRenderAction.h.

Referenced by RenderAction(), and start().

UInt32 RenderAction::_funcGetQueryObjectuivARB = Window::invalidFunctionID [static, protected]

Definition at line 379 of file OSGRenderAction.h.

Referenced by RenderAction(), and start().

char RenderAction::cvsid = "@(#)$Id: $" [static, private]

Reimplemented from osg::DrawActionBase.

Definition at line 434 of file OSGRenderAction.h.

Camera* osg::DrawActionBase::_camera [protected, inherited]

Window* osg::DrawActionBase::_window [protected, inherited]

Viewport* osg::DrawActionBase::_viewport [protected, inherited]

bool osg::DrawActionBase::_ownStat [protected, inherited]

Material* osg::DrawActionBase::_pMaterial [protected, inherited]

bool osg::DrawActionBase::_frustumCulling [protected, inherited]

bool osg::DrawActionBase::_volumeDrawing [protected, inherited]

bool osg::DrawActionBase::_autoFrustum [protected, inherited]

std::vector<Functor> osg::Action::_enterFunctors [protected, inherited]

std::vector<Functor> osg::Action::_leaveFunctors [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:04:03 2008 for OpenSG by  doxygen 1.5.5