dtTerrain::VegetationDecorator Class Reference

This class is the vegetation decorator layer. More...

#include <vegetationdecorator.h>

Inheritance diagram for dtTerrain::VegetationDecorator:

dtTerrain::TerrainDecorationLayer dtCore::Base

List of all members.

Public Types

typedef std::map
< dtCore::RefPtr
< PagedTerrainTile >,
dtCore::RefPtr< osg::Group > > 
VegetationMap
 Help minimize some typing...

Public Member Functions

 VegetationDecorator (const std::string &name="VegetationDecoratorLayer")
 Constructs a new terrain decoration layer.
virtual void OnLoadTerrainTile (PagedTerrainTile &tile)
 Calculates various LCC images and procedurally builds a list of trees and other vegetation models which are then placed about the specified terrain tile.
virtual void OnUnloadTerrainTile (PagedTerrainTile &tile)
 Removes the vegetation models from the map of currently visible tiles/vegetation.
virtual void OnTerrainTileResident (PagedTerrainTile &tile)
 Places the actual vegetation geometry on the terrain.
virtual osg::Node * GetOSGNode ()
 Gets the root scenegraph node for the vegetation.
dtCore::RefPtr< osg::Group > AddVegetation (PagedTerrainTile &tile)
 Place the vegetation into cell specified by lat-long.
bool GetVegetation (osg::Image &mCimage, int x, int y, int limit)
 Determine whether vegetation exists at coord x,y.
int GetVegType (const osg::Image *mCimage, int x, int y, float good_angle)
 Determine type/age of vegetation type (1-3; young-old).
int GetNumLooks (const osg::Image &compositeImage, const osg::Image &slopeMap, int x, int y, float good_angle, int maxlooks, float maxslope)
void SetVegetationDistance (const float distance)
 Sets the distance between vegetation objects.
void SetLCCTypes (std::vector< dtTerrain::LCCType > &lccTypes)
void SetGeospecificImage (const std::string &geoImageFilename)
void SetRandomSeed (const int &seed)
void SetMaxVegetationPerCell (int newMax)
 Sets the limit on the number of vegetation models placed per terrain tile.
LCCAnalyzerGetLCCAnalyzer ()
 Gets a reference to the LCCAnlyzer.

Protected Member Functions

dtCore::RefPtr< osg::Group > BuildVegetationForType (osg::Image &compositeImage, osg::Image &slopeMap, osg::Vec3 &cellOrigin, LCCType &type)
virtual ~VegetationDecorator ()
 Destructor.


Detailed Description

This class is the vegetation decorator layer.

It is responsible for processing the probabilities of vegetation placement based on LCC data recieved from the LCCAnalyzer.


Member Typedef Documentation

typedef std::map<dtCore::RefPtr<PagedTerrainTile>,dtCore::RefPtr<osg::Group> > dtTerrain::VegetationDecorator::VegetationMap

Help minimize some typing...


Constructor & Destructor Documentation

dtTerrain::VegetationDecorator::VegetationDecorator ( const std::string &  name = "VegetationDecoratorLayer"  ) 

Constructs a new terrain decoration layer.

dtTerrain::VegetationDecorator::~VegetationDecorator (  )  [protected, virtual]

Destructor.


Member Function Documentation

void dtTerrain::VegetationDecorator::OnLoadTerrainTile ( PagedTerrainTile tile  )  [virtual]

Calculates various LCC images and procedurally builds a list of trees and other vegetation models which are then placed about the specified terrain tile.

Implements dtTerrain::TerrainDecorationLayer.

void dtTerrain::VegetationDecorator::OnUnloadTerrainTile ( PagedTerrainTile tile  )  [virtual]

Removes the vegetation models from the map of currently visible tiles/vegetation.

Reimplemented from dtTerrain::TerrainDecorationLayer.

void dtTerrain::VegetationDecorator::OnTerrainTileResident ( PagedTerrainTile tile  )  [virtual]

Places the actual vegetation geometry on the terrain.

Note, the vegetation placement occurs here since it is dependent on querying for the height of the terrain in order to place the vegetation. The terrain height can only be queried once it has been loaded by the renderer. Performing this here ensures that the renderer has loaded this tile's data.

Reimplemented from dtTerrain::TerrainDecorationLayer.

virtual osg::Node* dtTerrain::VegetationDecorator::GetOSGNode (  )  [inline, virtual]

Gets the root scenegraph node for the vegetation.

Returns:
A group node holding the vegetation hierarchy for the current visible set of tiles.

Implements dtTerrain::TerrainDecorationLayer.

dtCore::RefPtr< osg::Group > dtTerrain::VegetationDecorator::AddVegetation ( PagedTerrainTile tile  ) 

Place the vegetation into cell specified by lat-long.

Parameters:
The terrain tile with which to place vegetation.
Returns:
A group node containing the vegetation scene for the specified tile.

bool dtTerrain::VegetationDecorator::GetVegetation ( osg::Image &  mCimage,
int  x,
int  y,
int  limit 
)

Determine whether vegetation exists at coord x,y.

Parameters:
mCimage the LCC type's combined image)
x the x coordinate to check
y the y coordinate to check
limit the probability rolled
Returns:
boolean on existence of vegetaton at x,y

int dtTerrain::VegetationDecorator::GetVegType ( const osg::Image *  mCimage,
int  x,
int  y,
float  good_angle 
)

Determine type/age of vegetation type (1-3; young-old).

Parameters:
mCimage the LCC type's combined image)
x the x coordinate to check
y the y coordinate to check
pref_angle the preferred angle of aspect in degrees for optimum growth
Returns:
the age bias of the vegetation type

int dtTerrain::VegetationDecorator::GetNumLooks ( const osg::Image &  compositeImage,
const osg::Image &  slopeMap,
int  x,
int  y,
float  good_angle,
int  maxlooks,
float  maxslope 
)

void dtTerrain::VegetationDecorator::SetVegetationDistance ( const float  distance  )  [inline]

Sets the distance between vegetation objects.

Parameters:
distance between vegetation objects

void dtTerrain::VegetationDecorator::SetLCCTypes ( std::vector< dtTerrain::LCCType > &  lccTypes  )  [inline]

void dtTerrain::VegetationDecorator::SetGeospecificImage ( const std::string &  geoImageFilename  )  [inline]

void dtTerrain::VegetationDecorator::SetRandomSeed ( const int &  seed  )  [inline]

void dtTerrain::VegetationDecorator::SetMaxVegetationPerCell ( int  newMax  )  [inline]

Sets the limit on the number of vegetation models placed per terrain tile.

Parameters:
newMax The new limit.

LCCAnalyzer& dtTerrain::VegetationDecorator::GetLCCAnalyzer (  )  [inline]

Gets a reference to the LCCAnlyzer.

Returns:
The LCCAnalyzer for this vegetation decorator.

dtCore::RefPtr< osg::Group > dtTerrain::VegetationDecorator::BuildVegetationForType ( osg::Image &  compositeImage,
osg::Image &  slopeMap,
osg::Vec3 &  cellOrigin,
LCCType type 
) [protected]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008