#include <vegetationdecorator.h>

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. | |
| LCCAnalyzer & | GetLCCAnalyzer () |
| 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. | |
It is responsible for processing the probabilities of vegetation placement based on LCC data recieved from the LCCAnalyzer.
| typedef std::map<dtCore::RefPtr<PagedTerrainTile>,dtCore::RefPtr<osg::Group> > dtTerrain::VegetationDecorator::VegetationMap |
Help minimize some typing...
| dtTerrain::VegetationDecorator::VegetationDecorator | ( | const std::string & | name = "VegetationDecoratorLayer" |
) |
Constructs a new terrain decoration layer.
| dtTerrain::VegetationDecorator::~VegetationDecorator | ( | ) | [protected, virtual] |
Destructor.
| 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.
Implements dtTerrain::TerrainDecorationLayer.
| dtCore::RefPtr< osg::Group > dtTerrain::VegetationDecorator::AddVegetation | ( | PagedTerrainTile & | tile | ) |
Place the vegetation into cell specified by lat-long.
| The | terrain tile with which to place vegetation. |
| bool dtTerrain::VegetationDecorator::GetVegetation | ( | osg::Image & | mCimage, | |
| int | x, | |||
| int | y, | |||
| int | limit | |||
| ) |
Determine whether vegetation exists at coord x,y.
| mCimage | the LCC type's combined image) | |
| x | the x coordinate to check | |
| y | the y coordinate to check | |
| limit | the probability rolled |
| 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).
| 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 |
| 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.
| 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.
| newMax | The new limit. |
| LCCAnalyzer& dtTerrain::VegetationDecorator::GetLCCAnalyzer | ( | ) | [inline] |
| dtCore::RefPtr< osg::Group > dtTerrain::VegetationDecorator::BuildVegetationForType | ( | osg::Image & | compositeImage, | |
| osg::Image & | slopeMap, | |||
| osg::Vec3 & | cellOrigin, | |||
| LCCType & | type | |||
| ) | [protected] |