Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
vtTerrain Class Reference

#include <Terrain.h>

Inheritance diagram for vtTerrain:
CultureExtension IslandTerrain NevadaTerrain

Public Member Functions

void SetParamFile (const char *fname)
 
bool LoadParams ()
 
vtString GetParamFile ()
 
void SetParams (const TParams &Params)
 
TParamsGetParams ()
 
void SetName (const vtString &str)
 
vtString GetName ()
 
void SetLocalGrid (vtElevationGrid *pGrid, bool bPreserve)
 
void SetTin (vtTin3d *pTin)
 
vtTin3dGetTin ()
 
bool GetGeoExtentsFromMetadata ()
 
void SetBothSides (bool bFlag)
 pass true to draw the underside of the terrain as well
 
void CreateStep0 ()
 
bool CreateStep1 ()
 
bool CreateStep2 (vtTransform *pSunLight, vtLightSource *pLightSource)
 
bool CreateStep3 ()
 
bool CreateStep4 ()
 
bool CreateStep5 ()
 
vtString GetLastError ()
 
void SetProgressCallback (ProgFuncPtrType progress_callback=NULL)
 
bool ProgressCallback (int i)
 
void SetTextureColors (ColorMap *colors)
 Set the colors to be used in a derived texture. More...
 
ColorMapGetTextureColors ()
 
void SetTextureContours (float fInterval, float fSize)
 Sets the texture colors to be a set of black contour stripes. More...
 
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).
 
vtTransformLoadModel (const char *filename, bool bAllowCache=true)
 Load an external geometry file. More...
 
void addNode (osg::Node *pNode)
 Add a model (or any node) to the terrain. More...
 
void removeNode (osg::Node *pNode)
 Remove a node from the terrain's scene graph. More...
 
void PlantModel (vtTransform *model)
 Place a model on the terrain. More...
 
void PlantModelAtPoint (vtTransform *model, const DPoint2 &pos)
 Place a model on the terrain at a specific point. More...
 
bool PointIsInTerrain (const DPoint2 &p)
 Test whether a given point is within the current terrain. More...
 
void SetGlobalProjection ()
 
bool AddFence (vtFence3d *f)
 
void AddFencepoint (vtFence3d *f, const DPoint2 &epos)
 
void RedrawFence (vtFence3d *f)
 
void AddRoute (vtRoute *f)
 
void add_routepoint_earth (vtRoute *f, const DPoint2 &epos, const char *structname)
 
void RedrawRoute (vtRoute *f)
 
void SaveRoute ()
 
vtRouteGetLastRoute ()
 
vtRouteMapGetRouteMap ()
 
LayerSetGetLayers ()
 Get at the container for all the layers.
 
void RemoveLayer (vtLayer *lay, bool progress_callback(int)=NULL)
 
vtLayerLoadLayer (const char *fname)
 
bool AddPlant (const DPoint2 &pos, int iSpecies, float fSize)
 
int DeleteSelectedPlants ()
 
void SetPlantList (vtSpeciesList3d *pPlantList)
 
vtSpeciesList3dGetPlantList ()
 
vtPlantInstanceArray3dGetPlantInstances ()
 Get the plant array for this terrain. You can modify it directly.
 
bool AddNodeToVegGrid (osg::Node *pNode)
 
vtStructureLayerGetStructureLayer ()
 
void SetStructureLayer (vtStructureLayer *slay)
 
vtStructureLayerNewStructureLayer ()
 
vtStructureLayerLoadStructuresFromXML (const vtString &strFilename)
 
void CreateStructures (vtStructureArray3d *structures)
 
bool CreateStructure (vtStructureArray3d *structures, int index)
 
int DeleteSelectedStructures ()
 
void DeleteLayer (uint index)
 
bool FindClosestStructure (const DPoint2 &point, double epsilon, int &structure, double &closest, float fMaxInstRadius, float fLinearWidthBuffer)
 
bool AddNodeToStructGrid (osg::Node *pNode)
 
void RemoveNodeFromStructGrid (osg::Node *pNode)
 
vtLodGridGetStructureGrid ()
 
int DoStructurePaging ()
 
vtPagedStructureLodGridGetStructureLodGrid ()
 
float GetStructurePageOutDistance ()
 
void SetStructurePageOutDistance (float f)
 
int GetStructurePageMax ()
 
void ExtendStructure (vtStructure *s)
 
void SetStructureExtension (vtStructureExtension *se=NULL)
 
void SetAbstractLayer (vtAbstractLayer *alay)
 
vtAbstractLayerGetAbstractLayer ()
 
void RemoveFeatureGeometries (vtAbstractLayer *alay)
 
int DeleteSelectedFeatures ()
 
void SetFeatureLoader (vtFeatureLoader *loader)
 
vtTransformGetScaledFeatures ()
 
vtRoadMap3dGetRoadMap ()
 
virtual void CreateCustomCulture ()
 
void AddEngine (vtEngine *pE)
 
void ActivateEngines (bool bActive)
 
vtEngineGetEngineGroup ()
 
FPoint3 GetCenter ()
 
float GetRadius ()
 
void SetFeatureVisible (TFType ftype, bool bOn)
 
bool GetFeatureVisible (TFType ftype)
 
void SetLODDistance (TFType ftype, float fDistance)
 
float GetLODDistance (TFType ftype)
 
void SetVerticalExag (float fExag)
 
float GetVerticalExag () const
 
vtDynTerrainGeomGetDynTerrain ()
 
const vtDynTerrainGeomGetDynTerrain () const
 
vtTiledGeomGetTiledGeom ()
 
vtGroupGetTopGroup ()
 
vtGroupGetTerrainGroup ()
 
vtHeightField3dGetHeightField ()
 
vtHeightFieldGrid3dGetHeightFieldGrid3d ()
 
vtProjectionGetProjection ()
 
virtual bool FindAltitudeOnCulture (const FPoint3 &p3, float &fAltitude, bool bTrue, int iCultureFlags) const
 
int GetShadowTextureUnit ()
 
float AddSurfaceLineToMesh (vtGeomFactory *pMF, const DLine2 &line, float fOffset, bool bInterp=true, bool bCurve=false, bool bTrue=false)
 
void SetCamLocation (FMatrix4 &mat)
 
FMatrix4GetCamLocation ()
 
vtLocationSaverGetLocSaver ()
 
void Visited (bool bVisited)
 
bool IsVisited ()
 
vtAnimContainerGetAnimContainer ()
 Access the animation paths associated with this terrain.
 
void SetWaterLevel (float fElev)
 
void SetFog (bool fog)
 
bool GetFog ()
 
void SetFogColor (const RGBf &color)
 
void SetFogDistance (float fMeters)
 
void SetBgColor (const RGBf &color)
 
RGBf GetBgColor ()
 
void SetShadows (bool shadows)
 
bool GetShadows ()
 
void SetShadowOptions (const vtShadowOptions &opt)
 
void GetShadowOptions (vtShadowOptions &opt)
 
void ForceShadowUpdate ()
 
vtTime GetInitialTime ()
 
void TranslateToGMT (vtTime &time)
 
void TranslateFromGMT (vtTime &time)
 
DPoint2 GetCenterGeoLocation ()
 
vtGroupGetOverlay ()
 
void ActivateScenario (int iScenario)
 
vtElevationGridGetInitialGrid ()
 
void UpdateElevation ()
 
void RedrapeCulture (const DRECT &area)
 
void RecreateTextures (vtTransform *pSunLight, bool progress_callback(int)=NULL)
 
osg::Image * GetTextureImage ()
 
vtMultiTextureAddMultiTextureOverlay (vtImage *pImage, const DRECT &extents, int TextureMode)
 
osg::Node * GetTerrainSurfaceNode ()
 

Public Attributes

ProgFuncPtrType m_progress_callback
 
vtStructureExtensionm_pStructureExtension
 
vtContentManager3d m_Content
 
DLine2 m_Corners_geo
 

Protected Member Functions

bool CreateFromTIN ()
 
bool CreateFromGrid ()
 
bool CreateFromTiles ()
 
bool CreateFromExternal ()
 
void _CreateCulture ()
 
void _CreateVegetation ()
 
void _CreateStructures ()
 
void _CreateRoads ()
 
void _SetupVegGrid (float fLODDistance)
 
void _SetupStructGrid (float fLODDistance)
 
void _CreateAbstractLayers ()
 
void _CreateImageLayers ()
 
void _CreateTextures (const FPoint3 &light_dir, bool progress_callback(int)=NULL)
 
void _CreateDetailTexture ()
 
bool _CreateDynamicTerrain ()
 
void _CreateErrorMessage (DTErr error, vtElevationGrid *pGrid)
 
void _SetErrorMessage (const vtString &msg)
 
void CreateArtificialHorizon (float fAltitude, bool bWater, bool bHorizon, bool bCenter)
 
void _ApplyPreLight (vtHeightFieldGrid3d *pLocalGrid, vtBitmapBase *dib, const FPoint3 &light_dir, bool progress_callback(int)=NULL)
 
void _ComputeCenterLocation ()
 
void GetTerrainBounds ()
 
void EnforcePageOut ()
 
void ConnectFogShadow (bool bFog, bool bShadow)
 

Protected Attributes

vtGroupPtr m_pContainerGroup
 
vtGroupPtr m_pTerrainGroup
 
vtGroupPtr m_pUnshadowedGroup
 
vtDynTerrainGeomPtr m_pDynGeom
 
vtTransformPtr m_pDynGeomScale
 
float m_fVerticalExag
 
vtTin3dPtr m_pTin
 
vtTiledGeomPtr m_pTiledGeom
 
osg::ref_ptr
< vtExternalHeightField3d
m_pExternalHeightField
 
TParams m_Params
 
vtHeightField3dm_pHeightField
 
bool m_bPreserveInputGrid
 
FMatrix4 m_CamLocation
 
bool m_bVisited
 
vtLocationSaver m_LocSaver
 
vtAnimContainer m_AnimContainer
 
vtFogPtr m_pFog
 
vtShadowPtr m_pShadow
 
vtMovGeodePtr m_pHorizonGeom
 
vtMovGeodePtr m_pOceanGeom
 
bool m_bFog
 
RGBf m_fog_color
 
RGBf m_background_color
 
bool m_bShadows
 
vtTin3dPtr m_pWaterTin3d
 
LayerSet m_Layers
 
vtStructureLayerm_pActiveStructLayer
 
vtLodGridm_pStructGrid
 
vtPagedStructureLodGridm_pPagedStructGrid
 
int m_iPagingStructureMax
 
float m_fPagingStructureDist
 
vtMaterialArrayPtr m_pTerrMats
 
vtMaterialArrayPtr m_pDetailMats
 
vtMaterialArrayPtr m_pEphemMats
 
int m_idx_water
 
int m_idx_horizon
 
bool m_bBothSides
 
vtAbstractLayerm_pActiveAbstractLayer
 
vtTransformm_pScaledFeatures
 
vtFeatureLoaderm_pFeatureLoader
 
vtGroupm_pRoadGroup
 
vtRoadMap3dPtr m_pRoadMap
 
vtPlantInstanceArray3d m_PIA
 
vtSpeciesList3dm_pPlantList
 
vtGroupm_pVegGroup
 
vtSimpleLodGridm_pVegGrid
 
vtRouteMap m_Routes
 
ImagePtr m_pUnshadedImage
 
ImagePtr m_pSingleImage
 
auto_ptr< ColorMapm_pTextureColors
 
bool m_bTextureInitialized
 
vtTextureUnitManager m_TextureUnits
 
int m_iShadowTextureUnit
 
vtLightSourcem_pLightSource
 
FSphere m_bound_sphere
 
RGBf m_ocean_color
 
vtString m_strParamFile
 
vtEnginePtr m_pEngineGroup
 
auto_ptr< vtElevationGridm_pElevGrid
 
DPoint2 m_CenterGeoLocation
 
int m_iDifferenceFromGMT
 
vtString m_strErrorMsg
 
vtGroupm_pOverlay
 
vtProjection m_proj
 
bool m_bIsCreated
 

Detailed Description

The vtTerrain class represents a terrain, which is a part of the surface of the earth.

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.

Customizing your Terrain

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.

How it works

The terrain is implemented with a scene graph with the following structure.

Member Function Documentation

void vtTerrain::AddEngine ( vtEngine pE)

Add an engine to this terrain's group of engines. The engine will be enabled only when the terrain is visible.

void vtTerrain::addNode ( osg::Node *  pNode)

Add a model (or any node) to the terrain.

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.

See Also
AddNodeToVegGrid, AddNodeToStructGrid
bool vtTerrain::AddNodeToStructGrid ( osg::Node *  pNode)

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 vtGeode node instead.

See Also
AddNode
bool vtTerrain::AddNodeToVegGrid ( osg::Node *  pNode)

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.

See Also
AddNode
bool vtTerrain::AddPlant ( const DPoint2 pos,
int  iSpecies,
float  fSize 
)

Create a new plant instance at a given location and add it to the terrain.

Parameters
posThe 2D earth position of the new plant.
iSpeciesIndex of the species in the terrain's plant list. If you don't know the index, you can find it with vtSpeciesList::GetSpeciesIdByName or vtSpeciesList::GetSpeciesIdByCommonName.
fSizeHeight of the new plant (meters).
float vtTerrain::AddSurfaceLineToMesh ( vtGeomFactory pMF,
const DLine2 line,
float  fOffset,
bool  bInterp = true,
bool  bCurve = false,
bool  bTrue = false 
)

Create geometry on the terrain for a 2D line by draping the point onto the terrain surface.

Parameters
pMFA vtGeomFactory which will produces the mesh geometry.
lineThe 2D line to drape, in Earth coordinates.
fOffsetAn offset to elevate each point in the resulting geometry, useful for keeping it visibly above the ground.
bInterpTrue to interpolate between the vertices of the input line. This is generally desirable when the ground is much more finely spaced than the input line.
bCurveTrue to interpret the vertices of the input line as control points of a curve. The created geometry will consist of a draped line which passes through the control points.
bTrueTrue to use the true elevation of the terrain, ignoring whatever scale factor is being used to exaggerate elevation for display.
Returns
The approximate length of the resulting 3D line mesh.
Example:
DLine2 line = ...;
vtTerrain *pTerr = ...;
vtGeode *pLineGeom = new vtGeode;
pTerr->AddNode(pLineGeom);
vtGeomFactory mf(pLineGeom, osg::PrimitiveSet::LINE_STRIP, 0, 30000, 1);
float length = pTerr->AddSurfaceLineToMesh(&mf, dline, 10, true);
void vtTerrain::CreateArtificialHorizon ( float  fAltitude,
bool  bWater,
bool  bHorizon,
bool  bCenter 
)
protected

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.

Parameters
fAltitudeThe height (Y-value) of the horizontal plane.
bWaterTrue for a watery material, false for a land material
bHorizonIf true, create tiles extending from the terrain extents to the horizon.
bCenterIf true, create a tile in the center (covering the terrain extents).
void vtTerrain::CreateCustomCulture ( )
virtual

The base CreateCustomCulture does nothing; this virtual method is meant to be overridden by your terrain subclass to add its own culture.

Reimplemented in IslandTerrain, and NevadaTerrain.

bool vtTerrain::CreateStep1 ( )

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.

bool vtTerrain::CreateStep2 ( vtTransform pSunLight,
vtLightSource pLightSource 
)

Next step in terrain creation: create textures.

bool vtTerrain::CreateStep3 ( )

Next step in terrain creation: create 3D geometry for the terrain.

bool vtTerrain::CreateStep4 ( )

Next step in terrain creation: additional CLOD construction.

bool vtTerrain::CreateStep5 ( )

Next step in terrain creation: create the culture and labels.

int vtTerrain::DeleteSelectedPlants ( )

Delete all the selected plants in the terrain's plant array.

int vtTerrain::DeleteSelectedStructures ( )

Delete all the selected structures in the terrain's active structure array.

vtAbstractLayer * vtTerrain::GetAbstractLayer ( )

Get the currently active abstract layer for this terrain.

FPoint3 vtTerrain::GetCenter ( )

Return the center of the bounding sphere that encloses the terrain's dynamic geometry.

bool vtTerrain::GetGeoExtentsFromMetadata ( )

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.

vtHeightField3d * vtTerrain::GetHeightField ( )

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.

vtHeightFieldGrid3d * vtTerrain::GetHeightFieldGrid3d ( )

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.

vtTime vtTerrain::GetInitialTime ( )

Get the time at which a terrain is set to begin.

TParams & vtTerrain::GetParams ( )

Returns a direct reference to the parameters object for this terrain, so that you can get and set the parameters.

Example:
TParams &par = pTerrain->GetParams();
par.SetBoolValue(STR_SKY, false);
float vtTerrain::GetRadius ( )

Return the radius of the bounding sphere that encloses the terrain's dynamic geometry.

vtTransform* vtTerrain::GetScaledFeatures ( )
inline

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.

vtStructureLayer * vtTerrain::GetStructureLayer ( )

Get the currently active structure layer for this terrain.

osg::Image * vtTerrain::GetTextureImage ( )

Get the texture image of the ground texture, if there is one. If the texture is more complicated (e.g. tileset) then NULL is returned.

vtLayer * vtTerrain::LoadLayer ( const char *  fname)

Currently handled by this method: structure and abstract layers.

vtTransform * vtTerrain::LoadModel ( const char *  filename,
bool  bAllowCache = true 
)

Load an external geometry file.

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:

Example:
MyTerrain::CreateCustomCulture()
{
// model is in centimeters (cm)
vtTransform *pFountain = LoadModel("Culture/fountain.3ds");
pFountain->Scale(.01f);
PlantModelAtPoint(pFountain, DPoint2(217690, 4123475));
AddModel(pFountain);
}
vtStructureLayer * vtTerrain::LoadStructuresFromXML ( const vtString strFilename)

Attempt to load structures from a VTST file. If successful, the structures will be added to the Terrain's set of structure arrays.

vtStructureLayer * vtTerrain::NewStructureLayer ( )

Create a new structure array for this terrain, and return it.

void vtTerrain::PaintDib ( bool   progress_callbackint = NULL)
virtual

Override this method to customize the Dib, before it is turned into a vtImage. The default implementation colors from elevation.

Reimplemented in IslandTerrain.

void vtTerrain::PlantModel ( vtTransform model)

Place a model on the terrain.

"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.

void vtTerrain::PlantModelAtPoint ( vtTransform model,
const DPoint2 pos 
)

Place a model on the terrain at a specific point.

"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.

Parameters
modelThe model to be placed on the terrain.
posThe position (in earth coordinates) at which to place it. This position is assumed to be in the same coordinate system that the Terrain is using.

Note: this function does not add the model to the terrain's scene graph. Use AddNode for that operation.

bool vtTerrain::PointIsInTerrain ( const DPoint2 p)

Test whether a given point is within the current terrain.

Tests whether a given point (in Earth coordinates) is within the current extents of the terrain.

void vtTerrain::RecreateTextures ( vtTransform pSunLight,
bool   progress_callbackint = NULL 
)

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.

void vtTerrain::RedrapeCulture ( const DRECT area)

Drape all the culture on the terrain again, to keep them on the surface in the case when the elevation values have changed.

Parameters
areaYou can speed up this function by passing the area to re-drape in. Otherwise, simply pass an empty area, and all culture will be re-draped.
void vtTerrain::removeNode ( osg::Node *  pNode)

Remove a node from the terrain's scene graph.

Removes a node from the terrain.

See Also
RemoveNodeFromStructGrid
void vtTerrain::RemoveNodeFromStructGrid ( osg::Node *  pNode)

Removes a node from the terrain's structure LOD grid.

See Also
RemoveNode
void vtTerrain::SetAbstractLayer ( vtAbstractLayer alay)

Set the currently active abstract layer for this terrain.

void vtTerrain::SetLocalGrid ( vtElevationGrid pGrid,
bool  bPreserve 
)

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.

Parameters
pGridThe grid object which the terrain should use.
bPreserveTrue if the terrain should not delete the grid object, otherwise false.
void vtTerrain::SetParamFile ( const char *  fname)

Tells the terrain what file contains the parameters to use.

Parameters
fnameThe name of a terrain parameters file, e.g. "Simple.xml".
void vtTerrain::SetParams ( const TParams Params)

Set all of the parameters for this terrain.

Parameters
ParamsAn object which contains all the parameters for the terrain.
Note that you can set individual parameters like this:
TParams &par = pTerrain->GetParams();
par.SetBoolValue(STR_SKY, false);
void vtTerrain::SetPlantList ( vtSpeciesList3d pPlantList)

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.

void vtTerrain::SetTextureColors ( ColorMap colors)

Set the colors to be used in a derived texture.

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.

Parameters
colorsA pointer to a colormap. The terrain takes ownership of the ColorMap object so it will be deleted when the terrain is deleted.
Example:
ColorMap *colors = new ColorMap;
colors->m_bRelative = false;
colors->Add(100, RGBi(0,255,0));
colors->Add(200, RGBi(255,200,150));
pTerr->SetTextureColors(colors);
void vtTerrain::SetTextureContours ( float  fInterval,
float  fSize 
)

Sets the texture colors to be a set of black contour stripes.

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.

Example:
vtTerrain *pTerr = new vtTerrain;
pTerr->SetTextureColors(100, 4);
Parameters
fIntervalThe vertical spacing between the contours. For example, if the elevation range of your data is from 50 to 350 meters, then an fIterval of 100 will place contour bands at 100,200,300 meters.
fSizeThe vertical thickness of each contour band, generally a few meters. A band of this thickness will be centered on each contour line of the desired elevation.
void vtTerrain::SetTin ( vtTin3d pTin)

This method allows you to give the terrain a TIN to use directly instead of loading a .tin file as specified in the TParams.

void vtTerrain::TranslateFromGMT ( vtTime time)

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!)

void vtTerrain::TranslateToGMT ( vtTime time)

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!)

void vtTerrain::UpdateElevation ( )

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.


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