VR-Forces 4.1 Class Documentation
List of all members | 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]

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

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.

virtual makVrv::DtSpeedTreeDrawable::~DtSpeedTreeDrawable ( )
virtual

DTOR.

Member Function Documentation

virtual osg::Object* makVrv::DtSpeedTreeDrawable::cloneType ( ) const
inlinevirtual
virtual osg::Object* makVrv::DtSpeedTreeDrawable::clone ( const osg::CopyOp &  copyop) const
inlinevirtual
virtual bool makVrv::DtSpeedTreeDrawable::isSameKindAs ( const osg::Object *  obj) const
inlinevirtual
virtual const char* makVrv::DtSpeedTreeDrawable::libraryName ( ) const
inlinevirtual
virtual const char* makVrv::DtSpeedTreeDrawable::className ( ) const
inlinevirtual
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.

virtual bool makVrv::DtSpeedTreeDrawable::treesHaveChanged ( ) const
virtual

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.

virtual DtSpeedTreeForest* makVrv::DtSpeedTreeDrawable::forest ( )
virtual

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.

void makVrv::DtSpeedTreeDrawable::rebuildForest ( DtSpeedTreeProfile profile)
protected

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
bool makVrv::DtSpeedTreeDrawable::addTree ( const TreeInstanceRecord record)
protected

Friends And Related Function Documentation

friend class DtSpeedTreeProfile
friend

Member Data Documentation

DtDe& makVrv::DtSpeedTreeDrawable::myDe
protected
bool makVrv::DtSpeedTreeDrawable::myTreesHaveChanged
protected
DtSpeedTreeForest* makVrv::DtSpeedTreeDrawable::myForestModel
protected
ContextSpecificForestMap makVrv::DtSpeedTreeDrawable::myCurrentProfile
mutableprotected
bool makVrv::DtSpeedTreeDrawable::myProfileHasChanged
protected
int makVrv::DtSpeedTreeDrawable::myProfileId
protected
int makVrv::DtSpeedTreeDrawable::myRandomSeed
protected
float makVrv::DtSpeedTreeDrawable::myFarPlane
protected
float makVrv::DtSpeedTreeDrawable::myNearLod
protected
float makVrv::DtSpeedTreeDrawable::myFarLod
protected

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

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)