VR-Forces 4.0.4 Class Documentation
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtSpeedTreeDrawable Class Reference

DtSpeedTreeDrawable draws a SpeedTree forest. More...

Inheritance diagram for makVrv::DtSpeedTreeDrawable:
Inheritance graph
[legend]

List of all members.

Classes

struct  TreeInstanceRecord
 A small struct containing the requisite attributes of a tree instance. More...

Public Types

typedef std::vector
< TreeInstanceRecord
TreeInstanceRecordVector

Public Member Functions

 DtSpeedTreeDrawable (DtDe &de, DtSpeedTreeForest *forestModel, const std::string &speedTreeDataPathRoot, int randomSeed)
 CTOR which takes the path to the speed tree data directory containing forests and shaders.
 DtSpeedTreeDrawable (const DtSpeedTreeDrawable &orig, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.
virtual osg::Object * cloneType () const
virtual osg::Object * clone (const osg::CopyOp &copyop) const
virtual bool isSameKindAs (const osg::Object *obj) const
virtual const char * libraryName () const
virtual const char * className () const
virtual ~DtSpeedTreeDrawable ()
 DTOR.
virtual void setProfile (int profile)
 Set the tree profile (1-4). Fastest to Nicest looking.
virtual void drawImplementation (osg::RenderInfo &) const
 The drawImplementation method is where the OSG wraps up the drawing of OpenGL primitives.
virtual void setTreesHaveChanged (bool bFlag)
 Set this to true and during drawImplementation() this will rebuild the forest.
virtual bool treesHaveChanged () const
 True if trees have been changed and forest needs to be rebuilt.
virtual osg::BoundingBox computeBound () const
 Compute the bounding box of the drawbable.
virtual void setTreeClippingPlane (float fFar)
 Set the distance that trees are clipped.
virtual void setTreeLodDistances (float fNear, float fFar)
 Set the distances for tree LOD's.
virtual DtSpeedTreeForestforest ()
 forest accessor.
virtual void releaseGLObjects (osg::State *state=0) const
 If State is non-zero, this function releases OpenGL objects for the specified graphics context.

Protected Types

typedef std::map< unsigned int,
DtSpeedTreeProfile * > 
ContextSpecificForestMap

Protected Member Functions

void rebuildForest (DtSpeedTreeProfile *profile)
 Rebuild a TreeInstanceRecordVector and call populateForest() with it.
DtSpeedTreeProfilegetCurrentProfile (unsigned int contextId) const
void setCurrentProfile (unsigned int contextId, DtSpeedTreeProfile *profile)
void flushGLObjects (unsigned int contextID) const
void createProfile (unsigned int contextId)
void populateForest (DtSpeedTreeProfile *profile, const TreeInstanceRecordVector &recordVector)
bool addTree (const TreeInstanceRecord &record)

Protected Attributes

DtDemyDe
bool myTreesHaveChanged
DtSpeedTreeForestmyForestModel
ContextSpecificForestMap myCurrentProfile
bool myProfileHasChanged
int myProfileId
int myRandomSeed
float myFarPlane
float myNearLod
float myFarLod

Friends

class DtSpeedTreeProfile

Detailed Description

DtSpeedTreeDrawable draws a SpeedTree forest.


Member Typedef Documentation

typedef std::map<unsigned int, DtSpeedTreeProfile*> makVrv::DtSpeedTreeDrawable::ContextSpecificForestMap [protected]

Constructor & Destructor Documentation

makVrv::DtSpeedTreeDrawable::DtSpeedTreeDrawable ( DtDe de,
DtSpeedTreeForest forestModel,
const std::string &  speedTreeDataPathRoot,
int  randomSeed 
)

CTOR which takes the path to the speed tree data directory containing forests and shaders.

makVrv::DtSpeedTreeDrawable::DtSpeedTreeDrawable ( const DtSpeedTreeDrawable orig,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

Copy constructor using CopyOp to manage deep vs shallow copy.

DTOR.


Member Function Documentation

virtual osg::Object* makVrv::DtSpeedTreeDrawable::cloneType ( ) const [inline, virtual]
virtual osg::Object* makVrv::DtSpeedTreeDrawable::clone ( const osg::CopyOp &  copyop) const [inline, virtual]
virtual bool makVrv::DtSpeedTreeDrawable::isSameKindAs ( const osg::Object *  obj) const [inline, virtual]
virtual const char* makVrv::DtSpeedTreeDrawable::libraryName ( ) const [inline, virtual]
virtual const char* makVrv::DtSpeedTreeDrawable::className ( ) const [inline, virtual]
virtual void makVrv::DtSpeedTreeDrawable::setProfile ( int  profile) [virtual]

Set the tree profile (1-4). Fastest to Nicest looking.

virtual void makVrv::DtSpeedTreeDrawable::drawImplementation ( osg::RenderInfo &  ) const [virtual]

The drawImplementation method is where the OSG wraps up the drawing of OpenGL primitives.

virtual void makVrv::DtSpeedTreeDrawable::setTreesHaveChanged ( bool  bFlag) [virtual]

Set this to true and during drawImplementation() this will rebuild the forest.

True if trees have been changed and forest needs to be rebuilt.

virtual osg::BoundingBox makVrv::DtSpeedTreeDrawable::computeBound ( ) const [virtual]

Compute the bounding box of the drawbable.

This is so that the scene graph knows where this objects is, for both positioning the camera at start up, and most importantly for culling.

virtual void makVrv::DtSpeedTreeDrawable::setTreeClippingPlane ( float  fFar) [virtual]

Set the distance that trees are clipped.

Since trees are expensive, they have their own clipping distances.

virtual void makVrv::DtSpeedTreeDrawable::setTreeLodDistances ( float  fNear,
float  fFar 
) [virtual]

Set the distances for tree LOD's.

the near LOD plane. fFar is set using world units, determine solely by the application.

forest accessor.

virtual void makVrv::DtSpeedTreeDrawable::releaseGLObjects ( osg::State *  state = 0) const [virtual]

If State is non-zero, this function releases OpenGL objects for the specified graphics context.

Otherwise, releases OpenGL objects for all graphics contexts.

Rebuild a TreeInstanceRecordVector and call populateForest() with it.

Called by drawImplementation() when myTreesHaveChanged.

DtSpeedTreeProfile* makVrv::DtSpeedTreeDrawable::getCurrentProfile ( unsigned int  contextId) const [protected]
void makVrv::DtSpeedTreeDrawable::setCurrentProfile ( unsigned int  contextId,
DtSpeedTreeProfile profile 
) [protected]
void makVrv::DtSpeedTreeDrawable::flushGLObjects ( unsigned int  contextID) const [protected]
void makVrv::DtSpeedTreeDrawable::createProfile ( unsigned int  contextId) [protected]
void makVrv::DtSpeedTreeDrawable::populateForest ( DtSpeedTreeProfile profile,
const TreeInstanceRecordVector recordVector 
) [protected]

Friends And Related Function Documentation

friend class DtSpeedTreeProfile [friend]

Member Data Documentation


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)