It is generally described by a set of parameters such as elevation, vegetation, and time of day. These terrain parameters are contained in the class TParams.
To create a new terrain, first construct a vtTerrain and set its parameters with SetParams() or SetParamFile(). You can also set many properties of the terrain directly, which is useful if you want to set them from memory instead of from disk. These include:
You can then build the terrain using the CreateStep methods, or add it to a vtTerrainScene and use vtTerrainScene::BuildTerrain.
To extend your terrain beyond what is possible with the terrain parameters, you can create a subclass of vtTerrain and implement the method CreateCustomCulture(). Here you can create anything you like, and add it to the terrain. Generally you should add your nodes with AddNode(), or AddNodeToStructGrid() if it is a structure that should be culled in the distance. You can also add your nodes with GetScaledFeatures()->AddChild(), if they are 'flat' like GIS features or contour lines, which should be scaled up/down with the vertical exaggeration of the terrain.
Public Member Functions | |
| void | SetParamFile (const char *fname) |
| void | SetParams (const TParams &Params) |
| TParams & | GetParams () |
| void | SetLocalGrid (vtElevationGrid *pGrid, bool bPreserve) |
| void | SetTin (vtTin3d *pTin) |
| bool | GetGeoExtentsFromMetadata () |
| void | SetBothSides (bool bFlag) |
| pass true to draw the underside of the terrain as well | |
| bool | CreateStep1 () |
| bool | CreateStep2 (vtTransform *pSunLight) |
| bool | CreateStep3 () |
| bool | CreateStep4 () |
| bool | CreateStep5 () |
| void | SetTextureColors (ColorMap *colors) |
| Set the colors to be used in a derived texture. | |
| void | SetTextureContours (float fInterval, float fSize) |
| Sets the texture colors to be a set of black contour stripes. | |
| virtual void | PaintDib (bool progress_callback(int)=NULL) |
| bool | IsCreated () |
| Return true if the terrain has been created. | |
| void | Enable (bool bVisible) |
| Set the enabled state of the terrain (whether it is shown or not). | |
| vtTransform * | LoadModel (const char *filename, bool bAllowCache=true) |
| Load an external geometry file. | |
| void | AddNode (vtNode *pNode) |
| Add a model (or any node) to the terrain. | |
| void | RemoveNode (vtNode *pNode) |
| Remove a node from the terrain's scene graph. | |
| void | PlantModel (vtTransform *model) |
| Place a model on the terrain. | |
| void | PlantModelAtPoint (vtTransform *model, const DPoint2 &pos) |
| Place a model on the terrain at a specific point. | |
| bool | PointIsInTerrain (const DPoint2 &p) |
| Test whether a given point is within the current terrain. | |
| vtLayer * | LoadLayer (const char *fname) |
| bool | AddPlant (const DPoint2 &pos, int iSpecies, float fSize) |
| int | DeleteSelectedPlants () |
| void | SetPlantList (vtSpeciesList3d *pPlantList) |
| vtPlantInstanceArray3d & | GetPlantInstances () |
| Get the plant array for this terrain. You can modify it directly. | |
| bool | AddNodeToVegGrid (vtTransform *pTrans) |
| vtStructureLayer * | GetStructureLayer () |
| vtStructureLayer * | NewStructureLayer () |
| vtStructureLayer * | LoadStructuresFromXML (const vtString &strFilename) |
| int | DeleteSelectedStructures () |
| bool | AddNodeToStructGrid (vtTransform *pTrans) |
| bool | AddNodeToStructGrid (vtGeom *pGeom) |
| void | RemoveNodeFromStructGrid (vtNode *pNode) |
| vtAbstractLayer * | GetAbstractLayer () |
| vtTransform * | GetScaledFeatures () |
| virtual void | CreateCustomCulture () |
| void | AddEngine (vtEngine *pE) |
| FPoint3 | GetCenter () |
| float | GetRadius () |
| vtHeightField3d * | GetHeightField () |
| vtHeightFieldGrid3d * | GetHeightFieldGrid3d () |
| float | AddSurfaceLineToMesh (vtMeshFactory *pMF, const DLine2 &line, float fOffset, bool bInterp=true, bool bCurve=false, bool bTrue=false) |
| vtAnimContainer * | GetAnimContainer () |
| Access the animation paths associated with this terrain. | |
| vtTime | GetInitialTime () |
| void | TranslateToGMT (vtTime &time) |
| void | TranslateFromGMT (vtTime &time) |
| void | UpdateElevation () |
| void | RedrapeCulture (const DRECT &area) |
| void | RecreateTextures (vtTransform *pSunLight, bool progress_callback(int)=NULL) |
| vtImage * | GetTextureImage () |
Protected Member Functions | |
| void | CreateArtificialHorizon (float fAltitude, bool bWater, bool bHorizon, bool bCenter, float fTransparency) |
|
|
Add an engine to this terrain's group of engines. The engine will be enabled only when the terrain is visible. |
|
|
Adds a node to the terrain. The node will be added directly to this specific terrain, so it will be hidden whenever the terrain is not active.
|
|
|
Adds a node to the terrain. The node will be added to the Structure LOD Grid of the terrain, so it will be culled when it is far from the viewer. This is usually desirable when the models are complicated or there are lot of them. There is another form of this method which takes a vtTransform node instead.
|
|
|
Adds a node to the terrain. The node will be added to the Structure LOD Grid of the terrain, so it will be culled when it is far from the viewer. This is usually desirable when the models are complicated or there are lot of them. There is another form of this method which takes a vtGeom node instead.
|
|
|
Adds a node to the terrain. The node will be added to the Vegetation LOD Grid of the terrain, so it will be culled when it is far from the viewer. This method is used by the terrain vegetation methods, and you can also use it directly if you have your own vegetation nodes to add.
|
|
||||||||||||||||
|
Create a new plant instance at a given location and add it to the terrain.
|
|
||||||||||||||||||||||||||||
|
Create geometry on the terrain for a 2D line by draping the point onto the terrain surface.
|
|
||||||||||||||||||||||||
|
Create a horizontal plane at sea level. If the terrain has a large body of water on 1 or more sides, this method is useful for extending the water to the horizon by creating additional ocean plane geometry.
|
|
|
The base CreateCustomCulture does nothing; this virtual method is meant to be overridden by your terrain subclass to add its own culture. |
|
|
First step in terrain creation: load elevation. You can use these methods to build a terrain step by step, or simply use the method vtTerrainScene::BuildTerrain, which calls them all. |
|
|
Next step in terrain creation: create textures. |
|
|
Next step in terrain creation: create 3D geometry for the terrain. |
|
|
Next step in terrain creation: additional CLOD construction. |
|
|
Next step in terrain creation: create the culture and labels. |
|
|
Delete all the selected plants in the terrain's plant array. |
|
|
Delete all the selected structures in the terrain's active structure array. |
|
|
Get the currently active abstract layer for this terrain. |
|
|
Return the center of the bounding sphere that encloses the terrain's dynamic geometry. |
|
|
For this terrain, look at its elevation source, and determine the extents of that data, in geographic coords. This is done without actually doing a full load of the data, to quickly describe the terrain's location on the earth. |
|
|
Return the heightfield for this terrain. It may be a grid, or a TIN. If you know that your data is a grid, you can use GetHeightFieldGrid3d() to get that specifically. |
|
|
Return the heightfield grid for this terrain. During the construction of the terain, this may be a source vtElevationGrid. Later, at runtime, it is likely to be one of the dynamic geometry (CLOD) grids. |
|
|
Get the time at which a terrain is set to begin. |
|
|
Returns a direct reference to the parameters object for this terrain, so that you can get and set the parameters.
|
|
|
Return the radius of the bounding sphere that encloses the terrain's dynamic geometry. |
|
|
You should add your nodes to this terrain's scaled features if they are 'flat' like GIS features or contour lines, which should be scaled up/down with the vertical exaggeration of the terrain. |
|
|
Get the currently active structure layer for this terrain. |
|
|
Get the image (vtImage) of the ground texture, if there is one. If the texture is more complicated (multi or tiled) then NULL is returned. |
|
|
Currently handled by this method: structure and abstract layers. |
|
||||||||||||
|
Loads an external 3D model as a movable node. The file will be looked for on the Terrain's data path, and wrapped with a vtTransform so that it can be moved. To add the model to the Terrain's scene graph, use AddModel or AddModelToLodGrid. To plant the model on the terrain, use PlantModel or PlantModelAtPoint. You should also make sure that your model is displayed at the correct scale. If the units are of the model are not meters, you should scale the correct factor so that it matches the units of the Terrain:
|
|
|
Attempt to load structures from a VTST file. If successful, the structures will be added to the Terrain's set of structure arrays. |
|
|
Create a new structure array for this terrain, and return it. |
|
|
Override this method to customize the Dib, before it is turned into a vtImage. The default implementation colors from elevation. |
|
|
"Plants" a model on the ground. This is done by moving the model directly up or down such that its local origin is at the height of the terrain. Note: this function does not add the model to the terrain's scene graph. Use AddNode for that operation. |
|
||||||||||||
|
"Plants" a model on the ground. This is done by moving the node to the indicated earth coordinate, then moving it directly up or down such that its local origin is at the height of the terrain.
|
|
|
Tests whether a given point (in Earth coordinates) is within the current extents of the terrain. |
|
||||||||||||
|
Re-create the ground texture. This is useful if you ahve changed the time of day, and want to see the lighting/shading of the terrain updated. |
|
|
Drape all the culture on the terrain again, to keep them on the surface in the case when the elevation values have changed.
|
|
|
Removes a node from the terrain.
|
|
|
Removes a node from the terrain's structure LOD grid.
|
|
||||||||||||
|
This method allows you to give the terrain a grid to use directly instead of loading the BT file specified in the TParams. You must allocate this grid dynamically with 'new', since vtTerrain will 'delete' it after using it during initialization. If you don't want the memory to be deleted, pass 'true' for bPreserve.
|
|
|
Tells the terrain what file contains the parameters to use.
|
|
|
Set all of the parameters for this terrain.
|
|
|
Set the list of plant species that this terrain should use. Using this method allows a set of species to be shared between many terrains. |
|
|
Set the array of colors to be used when automatically generating the terrain texture from the elevation values. This is the color map which is used for automatic generation of texture from elevation, when the terrain is built normally with the "Derived" texture option. The colors brackets go from the lowest elevation value to the highest.
|
|
||||||||||||
|
This method sets the terrain's color map to a series of white and black bands which indicate elevation contour lines. This is the color map which is used for automatic generation of texture from elevation, when the terrain is built normally with the "Derived" texture option. You can use this function either before the terrain is built, or afterwards if you intend to re-build the textures.
|
|
|
This method allows you to give the terrain a TIN to use directly instead of loading a .tin file as specified in the TParams. |
|
|
Given a time value, convert it to the LT (local time) of the center of this terrain from GMT. Local time is defined precisely by longitude, e.g. at noon local time, the sun is exactly halfway across the sky. Note that this is different that the "standard time" of a given place, which involves finding out what time zone is in effect (complicated!) |
|
|
Given a time value, convert it from the LT (local time) of the center of this terrain to GMT. Local time is defined precisely by longitude, e.g. at noon local time, the sun is exactly halfway across the sky. Note that this is different that the "standard time" of a given place, which involves finding out what time zone is in effect (complicated!) |
|
|
If you have told vtTerrain to preserve a copy of the original elevation grid in memory, you can modify that grid, then call this method to update the CLOD surface. This can take up a few seconds, depending on the size of your grid. |
1.4.5