My Project
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ParaTerrain::TerrainLattice Class Reference

Manages a network of Terrain objects arranged in a grid pattern to model extremely large worlds that couldn't be handled by a single Terrain object. More...

#include <TerrainLattice.h>

Inheritance diagram for ParaTerrain::TerrainLattice:
ParaEngine::IAttributeFields ParaEngine::IObject ParaEngine::CRefCounted

Public Types

typedef map< int, TerrainTileCacheItemTerrainTileCacheMap_type
 
- Public Types inherited from ParaEngine::IAttributeFields
typedef ParaEngine::weak_ptr< IObject, IAttributeFieldsWeakPtr_type
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 

Public Member Functions

 TerrainLattice (TerrainLatticeLoader *pLoader, bool useGeoMipmap=false)
 
 ATTRIBUTE_DEFINE_CLASS (TerrainLattice)
 
virtual IAttributeFieldsGetChildAttributeObject (const std::string &sName)
 get attribute by child object. More...
 
virtual int GetChildAttributeObjectCount (int nColumnIndex=0)
 get the number of child objects (row count) in the given column. More...
 
virtual int GetChildAttributeColumnCount ()
 we support multi-dimensional child object. More...
 
virtual IAttributeFieldsGetChildAttributeObject (int nRowIndex, int nColumnIndex=0)
 
void Load (char *szBaseName, int maxNumTriangles, int maxBlockSize, float commonRepeats)
 
void SetTileSize (float fTileSize)
 
TerrainGetTerrain (int positionX, int positionY)
 Get the terrain at the tile location. More...
 
TerrainGetTerrainAtPoint (float x, float y)
 
void SetCameraPosition (float x, float y, float z)
 
void ModelViewMatrixChanged ()
 
void Render ()
 
float GetElevation (float x, float y)
 
DWORD GetRegionValue (const string &sLayerName, float x, float y)
 get value of a given terrain region layer More...
 
void GetNormal (float x, float y, float &normalX, float &normalY, float &normalZ)
 Returns the surface normal of the terrain at the specified point. More...
 
float IntersectRay (float startX, float startY, float startZ, float dirX, float dirY, float dirZ, float &intersectX, float &intersectY, float &intersectZ, float fMaxDistance=INFINITY)
 
void SetLowestVisibleHeight (float fHeight)
 Set the height of the lowest visible terrain point. More...
 
float GetLowestVisibleHeight ()
 Get the height of the lowest visible terrain point. More...
 
void Paint (ParaEngine::TextureEntity *detailTexture, float brushRadius, float brushIntensity, float maxIntensity, bool erase, float x, float y)
 paint detailed texture on the terrain surface
 
void Flatten (float x, float y, float radius, int flatten_op, float elevation, float factor)
 Flatten the terrain both up and down to the specified elevation, using using the tightness parameter to determine how much the altered points are allowed to deviate from the specified elevation. More...
 
void DigCircleFlat (float x, float y, float radius, float fFlatPercentage=0.7f, float factor=0.5f)
 flatten a land centered at x,y, with a specified radius. More...
 
void GaussianHill (float x, float y, float radius, float hscale, float standard_deviation=0.1f, float smooth_factor=0.5f)
 
void Spherical (float x, float y, float radius, float offset)
 offset in a spherical region More...
 
void RadialScale (float x, float y, float scale_factor, float min_dist, float max_dist, float smooth_factor=0.5f, int frequency=1)
 Note: terrain data should be in normalized space with height in the range [0,1]. More...
 
void Roughen_Smooth (float x, float y, float radius, bool roughen=false, bool big_grid=false, float factor=0.5f)
 square filter for sharpening and smoothing. More...
 
void AddHeightField (float x, float y, const char *filename, int nSmoothPixels=7)
 Add rectangular height field from file to the current terrain. More...
 
void MergeHeightField (float x, float y, const char *filename, int mergeOperation=0, float weight1=1.0, float weight2=1.0, int nSmoothPixels=7)
 merge a rectangular height field from file to the current terrain. More...
 
void Ramp (float x1, float y1, float x2, float y2, float radius, float borderpercentage=0.5f, float factor=1.0f)
 create a ramp (inclined slope) from (x1,y1) to (x2,y2). More...
 
void UpdateHoles (float x, float y)
 Update all holes in the terrain tile that contains the input point. More...
 
bool IsHole (float x, float y)
 Whether the terrain contains a hole at the specified location. More...
 
void SetHole (float x, float y, bool bIsHold)
 set a new terrain hole at the specified location. More...
 
void InitDeviceObjects ()
 
void DeleteDeviceObjects ()
 
void InvalidateDeviceObjects ()
 
float GetVertexElevation (float x, float y)
 Returns the height of the vertex closest to the specified point. More...
 
void SetVertexElevation (float x, float y, float newElevation, bool recalculate_geometry=true)
 Sets the elevation (z-coordinate) in real units of the nearest vertex to the specified point. More...
 
float GetVertexSpacing () const
 
bool SnapPointToVertexGrid (float &x, float &y)
 snap the input point position to the nearest vertex gird point. More...
 
int GetMaxTileCacheSize ()
 set how many terrain tile(including height fields, etc) are cached in memory. More...
 
void SetMaxTileCacheSize (int nNum)
 Get how many terrain tile(including height fields, etc) are cached in memory. More...
 
void ResizeTextureMaskWidth (int nWidth)
 resize all texture mask width
 
void SetGlobalConfigModified (bool bEnable=true)
 mark the global config as modified, so that when saving the world, the config file will be saved to disk. More...
 
const CShapeBoxGetBoundingBox () const
 Get the bounding box from the last tessellation result. More...
 
void GetBoundingBoxes (vector< ParaEngine::CShapeAABB > &boxes, const Matrix4 *modelView, const ParaEngine::CShapeFrustum &frustum, int nMaxBoxesNum=1024, int nSmallestBoxStride=4)
 Get the bounding boxes for a given view frustum. More...
 
void SetAllLoadedModified (bool bIsModified=true, DWORD dwModifiedBits=16)
 set all loaded terrain tile content modified. More...
 
void SaveTerrain (bool bHeightMap, bool bTextures)
 save modified terrain to disk. More...
 
bool IsModified ()
 return true, if the terrain is modified and should be saved. More...
 
void SwitchLodStyle (bool useGeoMipmap)
 
bool IsWalkable (float x, float y, Vector3 &oNormal)
 
void SetTerrainInfo (float x, float y, float radius, uint32 data, uint32 bitMask, uint32 bitOffset)
 
uint32 GetTerrainInfo (float x, float y, uint32 bitMask, uint32 bitOffset)
 
void SetEditorMode (bool enable)
 
void SetVisibleDataMask (uint32 mask, uint8 bitOffset)
 
- Public Member Functions inherited from ParaEngine::IAttributeFields
virtual int GetAttributeClassID ()
 attribute class ID should be identical, unless one knows how overriding rules work. More...
 
virtual const char * GetAttributeClassName ()
 a static string, describing the attribute class object's name
 
virtual const char * GetAttributeClassDescription ()
 a static string, describing the attribute class object
 
virtual int InstallFields (CAttributeClass *pClass, bool bOverride)
 this class should be implemented if one wants to add new attribute. More...
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetName_s, const char **)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetName_s, const char *)
 
 ATTRIBUTE_METHOD (IAttributeFields, PrintObject_s)
 
 ATTRIBUTE_METHOD (IAttributeFields, AddRef_s)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetRefCount_s, int *)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetTime_s, int)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetTime_s, int *)
 
 ATTRIBUTE_METHOD (IAttributeFields, Release_s)
 
virtual const std::string & GetIdentifier ()
 
virtual void SetIdentifier (const std::string &sID)
 
virtual void SetModified (bool bModified)
 set whether any field has been modified. More...
 
virtual bool ValidateFields ()
 validate all fields and return true if validation passed. More...
 
virtual string GetValidationMessage ()
 get the recent validation message due to the most recent call to ValidateFields()
 
virtual bool ResetField (int nFieldID)
 Reset the field to its initial or default value. More...
 
virtual bool InvokeEditor (int nFieldID, const std::string &sParameters)
 Invoke an (external) editor for a given field. More...
 
virtual bool AddChildAttributeObject (IAttributeFields *pChild, int nRowIndex=-1, int nColumnIndex=0)
 add child object. More...
 
virtual void * QueryObjectByName (const std::string &sObjectType)
 convert to object of a given type. More...
 
virtual void * QueryObject (int nObjectType)
 convert to object of a given type. More...
 
virtual int GetTime ()
 get the current local time in case it is animated in milli seconds frames. More...
 
virtual void SetTime (int nTime)
 
virtual CDynamicAttributeFieldGetDynamicField (const std::string &sName)
 Get a dynamic field with a given name. More...
 
virtual CDynamicAttributeFieldGetDynamicField (int nIndex)
 Get a dynamic field with a given index. More...
 
virtual const char * GetDynamicFieldNameByIndex (int nIndex)
 get field name by index
 
virtual int GetDynamicFieldCount ()
 how many dynamic field this object currently have. More...
 
virtual int SetDynamicField (const std::string &sName, const CVariable &value)
 set a dynamic field with a given name. More...
 
virtual int AddDynamicField (const std::string &sName, ATTRIBUTE_FIELDTYPE dwType)
 add dynamic field and return field index
 
virtual void RemoveAllDynamicFields ()
 remove all dynamic fields
 
virtual int SaveDynamicFieldsToString (std::string &output)
 save only text dynamic fields to fieldname = value text strings. More...
 
virtual int LoadDynamicFieldsFromString (const std::string &input)
 load only text dynamic fields from string More...
 
CAttributeClassGetAttributeClass ()
 get the main attribute class object. More...
 
void PrintObject ()
 print the content of this object to a text file at temp/doc/[ClassName].txt. More...
 
- Public Member Functions inherited from ParaEngine::IObject
virtual void Clone (IObject *obj) const
 Clone the object's contains to a pointer. More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
virtual const ITypeGetType () const
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 

Static Public Member Functions

static int GetTileIDFromXY (int X, int Y)
 get the tile ID which is the key in m_pCachedTerrains, from lattice coordinate
 
static bool GetXYFromTileID (int nTileID, int *X, int *Y)
 get lattice coordinates, from the tile ID which is the key in m_pCachedTerrains More...
 
- Static Public Member Functions inherited from ParaEngine::IAttributeFields
static HRESULT GetAttributeClassID_s (IAttributeFields *cls, int *p1)
 
static HRESULT GetAttributeClassName_s (IAttributeFields *cls, const char **p1)
 
static bool OpenWithDefaultEditor (const char *sFilename, bool bWaitOnReturn=false)
 Open a given file with the default registered editor in the game engine. More...
 

Public Attributes

bool m_useGeoMipmap
 

Additional Inherited Members

- Protected Member Functions inherited from ParaEngine::IAttributeFields
virtual CAttributeClassCreateAttributeClass ()
 initialize fields
 
virtual CDynamicAttributesSetGetDynamicAttributes (bool bCreateIfNotExist=false)
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Detailed Description

Manages a network of Terrain objects arranged in a grid pattern to model extremely large worlds that couldn't be handled by a single Terrain object.

TerrainLattice manages the seams between Terrain objects so that, even during dynamic tessellation, there are no visible cracks between neighboring Terrain objects in the lattice.

Warning
This class is temporarily disabled for the current release, but will be available again soon.

Member Function Documentation

§ AddHeightField()

void TerrainLattice::AddHeightField ( float  x,
float  y,
const char *  filename,
int  nSmoothPixels = 7 
)

Add rectangular height field from file to the current terrain.

This is just a shortcut for MergeHeightField()

Parameters
xcenter of the rect in world unit
ycenter of the rect in world unit
filename: the raw elevation or gray scale image file that contains the height field.
nSmoothPixelsthe number of pixels to smooth from the edge of the height field. if this is 0, the original height field will be loaded unmodified. if it is greater than 0, the loaded height field will be smoothed for nSmoothPixels from the edge, where the edge is always 0.

§ DigCircleFlat()

void TerrainLattice::DigCircleFlat ( float  x,
float  y,
float  radius,
float  fFlatPercentage = 0.7f,
float  factor = 0.5f 
)

flatten a land centered at x,y, with a specified radius.

Algorithm: (1) flatten a circle with radius same as fFlatPercentage*radius (2) smooth the entire region twice.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit
fFlatPercentagevalue is between [0,1]. fFlatPercentage*radius is the actual radius that got flattened.
factorvalue is between [0,1]. 1 means fully transformed; 0 means nothing is changed

§ Flatten()

void ParaTerrain::TerrainLattice::Flatten ( float  x,
float  y,
float  radius,
int  flatten_op,
float  elevation,
float  factor 
)

Flatten the terrain both up and down to the specified elevation, using using the tightness parameter to determine how much the altered points are allowed to deviate from the specified elevation.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit
flatten_openum FlattenOperation{ Fill_Op=0, //Flatten the terrain up to the specified elevation ShaveTop_Op=1, //Flatten the terrain down to the specified elevation Flatten_Op=2, //Flatten the terrain up and down to the specified elevation };
elevationthe desired height
factorvalue is between [0,1]. 1 means fully transformed; 0 means nothing is changed

§ GetBoundingBox()

const CShapeBox & TerrainLattice::GetBoundingBox ( ) const

Get the bounding box from the last tessellation result.

The returned box is always in world coordinate.

§ GetBoundingBoxes()

void TerrainLattice::GetBoundingBoxes ( vector< ParaEngine::CShapeAABB > &  boxes,
const Matrix4 modelView,
const ParaEngine::CShapeFrustum frustum,
int  nMaxBoxesNum = 1024,
int  nSmallestBoxStride = 4 
)

Get the bounding boxes for a given view frustum.

The returned boxes are always in world coordinate with render origin applied and transform by modelView

Parameters
boxes[in|out]
modelViewif not null, all returned boxes will be transformed by it, before testing with the frustum
frustumthe view frustum to test against.
nMaxBoxesNummaximum number of boxes returned. Since it internally uses a breadth first traversal of the terrain quad tree, larger boxes will return when there are more boxes in the frustum than nMaxBoxesNum
nSmallestBoxStridewhat is the stride size of the smallest boxes returned.

§ GetChildAttributeColumnCount()

int ParaTerrain::TerrainLattice::GetChildAttributeColumnCount ( )
virtual

we support multi-dimensional child object.

by default objects have only one column.

Reimplemented from ParaEngine::IAttributeFields.

§ GetChildAttributeObject()

IAttributeFields * ParaTerrain::TerrainLattice::GetChildAttributeObject ( const std::string &  sName)
virtual

get attribute by child object.

used to iterate across the attribute field hierarchy.

Reimplemented from ParaEngine::IAttributeFields.

§ GetChildAttributeObjectCount()

int ParaTerrain::TerrainLattice::GetChildAttributeObjectCount ( int  nColumnIndex = 0)
virtual

get the number of child objects (row count) in the given column.

please note different columns can have different row count.

Reimplemented from ParaEngine::IAttributeFields.

§ GetLowestVisibleHeight()

float TerrainLattice::GetLowestVisibleHeight ( )

Get the height of the lowest visible terrain point.

This may be used to render the ocean

§ GetMaxTileCacheSize()

int TerrainLattice::GetMaxTileCacheSize ( )

set how many terrain tile(including height fields, etc) are cached in memory.

The actual cached tile number may be smaller or larger than this value, since we ensure that a tile that is very recently used is never removed from cache. the default value is 18. The smallest value is 18, the largest value is 4000

§ GetNormal()

void TerrainLattice::GetNormal ( float  x,
float  y,
float &  normalX,
float &  normalY,
float &  normalZ 
)

Returns the surface normal of the terrain at the specified point.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
normalXGets filled with the surface normal x component
normalYGets filled with the surface normal y component
normalZGets filled with the surface normal z component

§ GetRegionValue()

DWORD TerrainLattice::GetRegionValue ( const string &  sLayerName,
float  x,
float  y 
)

get value of a given terrain region layer

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.

§ GetTerrain()

Terrain * TerrainLattice::GetTerrain ( int  positionX,
int  positionY 
)

Get the terrain at the tile location.

And load the terrain if it has been cached

§ GetVertexElevation()

float TerrainLattice::GetVertexElevation ( float  x,
float  y 
)

Returns the height of the vertex closest to the specified point.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.

§ GetVertexSpacing()

float TerrainLattice::GetVertexSpacing ( ) const
Returns

§ GetXYFromTileID()

bool TerrainLattice::GetXYFromTileID ( int  nTileID,
int *  X,
int *  Y 
)
static

get lattice coordinates, from the tile ID which is the key in m_pCachedTerrains

Returns
: true if ID is valid.

§ IsHole()

bool ParaTerrain::TerrainLattice::IsHole ( float  x,
float  y 
)

Whether the terrain contains a hole at the specified location.

Currently, we allow user to load a low resolution hole maps at the beginning of terrain creation.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
Returns
: true if the position specified by (x,y) is inside a terrain hole

§ IsModified()

bool TerrainLattice::IsModified ( )
virtual

return true, if the terrain is modified and should be saved.

Reimplemented from ParaEngine::IAttributeFields.

§ MergeHeightField()

void TerrainLattice::MergeHeightField ( float  x,
float  y,
const char *  filename,
int  mergeOperation = 0,
float  weight1 = 1.0,
float  weight2 = 1.0,
int  nSmoothPixels = 7 
)

merge a rectangular height field from file to the current terrain.

Parameters
xcenter of the rect in world unit
ycenter of the rect in world unit
filename: the raw elevation or gray scale image file that contains the height field.
MergeOperation{ Addition=0, Subtract=1, Multiplication=2, Division=3, Minimum=4, Maximum=5, };
weight1the destination merging weight
weight2the source file merging weight
nSmoothPixelsthe number of pixels to smooth from the edge of the height field. if this is 0, the original height field will be loaded unmodified. if it is greater than 0, the loaded height field will be smoothed for nSmoothPixels from the edge, where the edge is always 0.

§ ModelViewMatrixChanged()

void TerrainLattice::ModelViewMatrixChanged ( )

tessellation according to the new view matrix

Update neighbor, in case the shorelines are not uniformly tessellated.

repair cracks and rebuild render buffer

tessellation according to the new view matrix

§ RadialScale()

void TerrainLattice::RadialScale ( float  x,
float  y,
float  scale_factor,
float  min_dist,
float  max_dist,
float  smooth_factor = 0.5f,
int  frequency = 1 
)

Note: terrain data should be in normalized space with height in the range [0,1].

Picks a point and scales the surrounding terrain in a circular manner. Can be used to make all sorts of circular shapes. Still needs some work. radial_scale: pick a point (center_x, center_y) and scale the points where distance is mindist<=distance<=maxdist linearly. The formula we'll use for a nice sloping smoothing factor is (-cos(x*3)/2)+0.5.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
scale_factorheight of the scaled portion in world unit. This value can be negative.

§ Ramp()

void ParaTerrain::TerrainLattice::Ramp ( float  x1,
float  y1,
float  x2,
float  y2,
float  radius,
float  borderpercentage = 0.5f,
float  factor = 1.0f 
)

create a ramp (inclined slope) from (x1,y1) to (x2,y2).

The ramp's half width is radius. this is usually used to created a slope path connecting a high land with a low land.

Parameters
radiusThe ramp's half width
borderpercentageborderpercentage*radius is how long the ramp boarder is to linearly interpolate with the original terrain. specify 0 for sharp ramp border.
factorin range[0,1]. it is the smoothness to merge with other border heights.Specify 1.0 for a complete merge

§ Render()

void TerrainLattice::Render ( void  )

generate terrain rendering report to console

§ Roughen_Smooth()

void TerrainLattice::Roughen_Smooth ( float  x,
float  y,
float  radius,
bool  roughen = false,
bool  big_grid = false,
float  factor = 0.5f 
)

square filter for sharpening and smoothing.

Use neighbour-averaging to roughen or smooth the height field. The factor determines how much of the computed roughening is actually applied to the height field. In it's default invocation, the 4 directly neighboring squares are used to calculate the roughening. If you select big sampling grid, all 8 neighboring cells will be used.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit
roughentrue for sharpening, false for smoothing.
big_gridtrue for 8 neighboring cells, false for 4.
factorvalue is between [0,1]. 1 means fully transformed; 0 means nothing is changed

§ SaveTerrain()

void TerrainLattice::SaveTerrain ( bool  bHeightMap,
bool  bTextures 
)

save modified terrain to disk.

Parameters
bHeightMaptrue to save height map
bTexturestrue to save textures: alpha maps, etc

§ SetAllLoadedModified()

void TerrainLattice::SetAllLoadedModified ( bool  bIsModified = true,
DWORD  dwModifiedBits = 16 
)

set all loaded terrain tile content modified.

§ SetCameraPosition()

void TerrainLattice::SetCameraPosition ( float  x,
float  y,
float  z 
)

ensure that the 9 tiles near the eye position are always active.And increase their hit count

garbage collect other terrain tiles; while frame move all active tiles

use 0x3fffffff, instead of 0xffffffff prevents the current frame used terrain to be deleted.

§ SetGlobalConfigModified()

void ParaTerrain::TerrainLattice::SetGlobalConfigModified ( bool  bEnable = true)

mark the global config as modified, so that when saving the world, the config file will be saved to disk.

§ SetHole()

void ParaTerrain::TerrainLattice::SetHole ( float  x,
float  y,
bool  bIsHold 
)

set a new terrain hole at the specified location.

Currently, we will allow user to dynamically dig holes in terrain. After calling this function, the user must manually Call UpdateHoles() to inform that the holes in the terrain has been updated.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
See also
UpdateHoles();

§ SetLowestVisibleHeight()

void TerrainLattice::SetLowestVisibleHeight ( float  fHeight)

Set the height of the lowest visible terrain point.

This may be used to render the ocean

§ SetMaxTileCacheSize()

void TerrainLattice::SetMaxTileCacheSize ( int  nNum)

Get how many terrain tile(including height fields, etc) are cached in memory.

The actual cached tile number may be smaller or larger than this value, since we ensure that a tile that is very recently used is never removed from cache. the default value is 18. The smallest value is 18, the largest value is 4000

§ SetVertexElevation()

void TerrainLattice::SetVertexElevation ( float  x,
float  y,
float  newElevation,
bool  recalculate_geometry = true 
)

Sets the elevation (z-coordinate) in real units of the nearest vertex to the specified point.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
newElevationThe new z-value (elevation) of the vertex to be set.

§ SnapPointToVertexGrid()

bool TerrainLattice::SnapPointToVertexGrid ( float &  x,
float &  y 
)

snap the input point position to the nearest vertex gird point.

Parameters
x[in|out]
y[in|out]
Returns
: return true if the terrain vertex exists, otherwise return false.

§ Spherical()

void ParaTerrain::TerrainLattice::Spherical ( float  x,
float  y,
float  radius,
float  offset 
)

offset in a spherical region

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit

§ UpdateHoles()

void ParaTerrain::TerrainLattice::UpdateHoles ( float  x,
float  y 
)

Update all holes in the terrain tile that contains the input point.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.

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