My Project
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends | List of all members
ParaTerrain::Terrain Class Reference

This class represents a single, contiguous chunk of terrain and is the primary public interface to Demeter. More...

#include <Terrain.h>

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

Classes

struct  DestroyStaticObject_
 this is a dummy object that to ensure static objects are destroyed properly More...
 

Public Member Functions

 Terrain ()
 Constructs a (mostly) empty terrain suitable for use by an ElevationLoader.
 
 Terrain (const float *pElevations, int elevWidth, int elevHeight, const uint8 *pTextureImage, int textureWidth, int textureHeight, const uint8 *pDetailTextureImage, int detailWidth, int detailHeight, float vertexSpacing, float elevationScale, int maxNumTriangles, float offsetX=0.0f, float offsetY=0.0f)
 Constructs a new terrain from raw elevation and image data in memory buffers. More...
 
 Terrain (int widthVertices, int heightVertices, float vertexSpacing, int maxNumTriangles)
 By using this constructor, you are specifying the layout of all of the vertices in the Terrain's mesh. More...
 
 Terrain (int maxNumTriangles, float offsetX, float offsetY)
 Constructs a (mostly) empty terrain suitable for use by an ElevationLoader. More...
 
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...
 
virtual bool InvokeEditor (int nFieldID, const string &sParameters)
 Invoke an (external) editor for a given field. More...
 
 ATTRIBUTE_METHOD1 (Terrain, IsModified_s, bool *)
 
 ATTRIBUTE_METHOD1 (Terrain, SetModified_s, bool)
 
 ATTRIBUTE_METHOD1 (Terrain, IsEmpty_s, bool *)
 
 ATTRIBUTE_METHOD1 (Terrain, GetSize_s, float *)
 
 ATTRIBUTE_METHOD1 (Terrain, GetOnloadScript_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, GetTerrainElevFile_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, GetTerrainConfigFile_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, GetTerrainBaseTextureFile_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, SetTerrainBaseTextureFile_s, const char *)
 
 ATTRIBUTE_METHOD1 (Terrain, GetTerrainCommonTextureFile_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, SetTerrainCommonTextureFile_s, const char *)
 
 ATTRIBUTE_METHOD1 (Terrain, GetNumOfRegions_s, int *)
 
 ATTRIBUTE_METHOD1 (Terrain, GetCurrentRegionIndex_s, int *)
 
 ATTRIBUTE_METHOD1 (Terrain, SetCurrentRegionIndex_s, int)
 
 ATTRIBUTE_METHOD1 (Terrain, GetCurrentRegionName_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, SetCurrentRegionName_s, const char *)
 
 ATTRIBUTE_METHOD1 (Terrain, GetCurrentRegionFilepath_s, const char **)
 
 ATTRIBUTE_METHOD1 (Terrain, SetCurrentRegionFilepath_s, const char *)
 
void Cleanup ()
 clean up all
 
bool IsModified ()
 whether the terrain geometry, texture has been modified. More...
 
bool IsModified (DWORD dwModifiedBits)
 return true if any part specified in dwModifiedBits has been modified. More...
 
void SetModified (bool bIsModified, DWORD dwModifiedBits)
 Turn on/off the specified flag indicating whether the terrain has been modified or not. More...
 
bool IsEmpty ()
 whether the terrain is a fake terrain without vertices. More...
 
void SetModified (bool bIsModified)
 set the terrain modified to true for all parts of the terrain. More...
 
void InitDeviceObjects ()
 this function currently does nothing
 
void DeleteDeviceObjects ()
 must call this function when device is lost.
 
void InvalidateDeviceObjects ()
 must call this function when device is invalid.
 
int Tessellate ()
 Breaks the Terrain down into triangles strips. More...
 
void RepairCracks ()
 repair cracks during tessellation. More...
 
void RebuildRenderBuffer ()
 Rebuild the rendering buffer from triangle strips and fans generated from Tessellate() and RepairCracks(). More...
 
void Render ()
 Render the terrain from Render Buffer. More...
 
string GetRenderReport ()
 get the rendering report string for debugging purposes
 
void SetDetailThreshold (float threshold)
 Sets the "detail threshold", which controls how much Demeter simplifies the terrain. More...
 
float GetDetailThreshold () const
 Returns the "detail threshold.".
 
void SetMaximumVisibleBlockSize (int stride)
 Sets the maximum size of blocks that can be simplified when the terrain is tessellated. More...
 
int GetMaximumVisibleBlockSize ()
 
int GetWidthVertices () const
 Returns the width of the terrain in vertices (this is the count of vertices along the world's x-axis.)
 
int GetHeightVertices () const
 Returns the height of the terrain in vertices (this is the count of vertices along the world's y-axis.)
 
float GetWidth () const
 Returns the width of the terrain in world units (this is the length of the terrain along the world's x-axis.)
 
float GetHeight () const
 Returns the height of the terrain in world units (this is the length of the terrain along the world's y-axis.)
 
float GetVertexSpacing () const
 Returns the number of real units between vertices in the terrain's mesh.
 
float GetElevation (float x, float y) const
 Returns the elevation (z-coordinate) in real units of the specified point on the terrain. More...
 
float GetElevationW (float x, float y) const
 Returns the elevation (z-coordinate) in real units of the specified point on the terrain. More...
 
DWORD GetRegionValue (const string &sLayerName, float x, float y)
 get value of a given terrain region layer More...
 
DWORD GetRegionValueW (const string &sLayerName, float x, float y)
 get value of a given terrain region layer More...
 
float GetElevation (int index) const
 Returns the elevation (z-coordinate) in real units of the specified terrain vertex. More...
 
void GetNormal (float x, float y, float &normalX, float &normalY, float &normalZ) const
 Returns the surface normal of the terrain at the specified point. More...
 
void GetNormalW (float x, float y, float &normalX, float &normalY, float &normalZ) const
 Returns the surface normal of the terrain at the specified point. More...
 
float GetMaxElevation () const
 Returns the elevation (z-coordinate) in real units of the highest point on the terrain.
 
int GetVertex (float x, float y) const
 Returns the index of the vertex closest to the specified point. More...
 
int GetVertexW (float x, float y) const
 Returns the index of the vertex closest to the specified point. More...
 
float GetVertexElevation (int index) const
 Returns the elevation (z-coordinate) in real units of the specified vertex on the terrain. More...
 
void SetVertexElevation (int index, float newElevation, bool recalculate_geometry=true)
 Sets the elevation (z-coordinate) in real units of the specified vertex on the terrain. More...
 
void SetVertexElevation (float x, float y, float newElevation)
 Sets the elevation (z-coordinate) in real units of the nearest vertex to the specified point. More...
 
void SetHole (float x, float y, bool bIsHold)
 set a new terrain hole at the specified location. More...
 
void SetHoleLocal (float x, float y, bool bIsHold)
 set a new terrain hole at the specified local location. More...
 
void UpdateHoles ()
 call this function after you have set new holes in the terrain.
 
void SetHoleScale (int nHoleScale)
 this value can only be a power of 2, such as 2, 4, 8, etc. More...
 
bool IsHole (float x, float y)
 Whether the terrain contains a hole at the specified location. More...
 
bool IsHoleW (float x, float y)
 Whether the terrain contains a hole at the specified location. More...
 
void CreateHoleMap (BYTE *pHoleData=NULL, int nLength=0)
 create hole map from terrain hole map. More...
 
void RecalcGeometry (int index1, int index2)
 Recalculates bounding box for the quad spanning from vertex 1 to vertex 2. More...
 
void RecalcGeometry ()
 recalculate the entire terrain. More...
 
void RecalcNormal (float x, float y)
 Recalculates the normal vector of the vertex closes to the specified point. More...
 
void RecalcNormal (int vertexIndex)
 Recalculates the normal vector of the specified vertex. More...
 
void SetAllElevations (const float *pElevations, int elevWidth, int elevHeight, float fTerrainSize, float elevationScale=1.0f)
 Replaces all of the Terrain's vertices with a new set of vertices. More...
 
int GetNumberOfVertices () const
 Returns the total number of vertices in the terrain's mesh.
 
float GetTextureTileWidth () const
 Returns the width (in vertices) of the terrain's texture cells. See the TextureCell class.
 
float GetTextureTileHeight () const
 Returns the height (in vertices) of the terrain's texture cells. See the TextureCell class.
 
int GetNumberOfTextureTilesWidth () const
 Returns the number of texture cells along the terrain's x-axis. See the TextureCell class.
 
int GetNumberOfTextureTilesHeight () const
 Returns the number of texture cells along the terrain's y-axis. See the TextureCell class.
 
bool SetTexture (const uint8 *pTextureImage, int width, int height)
 Applies the specified graphics image as a texture to the terrain. More...
 
bool SetBaseTexture (const string &filename, int numTextureCellsX=8, int numTextureCellsY=8)
 Set the base texture to texture cells. More...
 
bool SetCommonTexture (const uint8 *pImage, int width, int height)
 Uses the specified graphics image to apply a "common" texture to the entire surface of the terrain. More...
 
void SetCommonTexture (const char *fileName)
 Uses the specified Texture to apply a "common" texture to the entire surface of the terrain. More...
 
void SetCommonTexture (Texture *pTexture)
 A common texture is repeated across the entire terrain and is blended with the terrain's overall texture (if blending is supported by the user's hardware.) This is used to provide a texture to give the ground some definition when the camera is close to the ground, but is an inferior to alternative to the use of specific DetailTexture instances. More...
 
TextureGetCommonTexture () const
 Returns the Texture object representing the common texture that has been applied to the Terrain, if any.
 
int ModelViewMatrixChanged ()
 Notifies Demeter that OpenGL's modelview matrix has been modified, allowing Demeter to tessellate the terrain based on the new modelview matrix. More...
 
int CuboidInFrustum (const CShapeBox &cuboid) const
 Indicates whether or not the specified cuboid is inside of the viewing frustum (as defined at the previous call to ModelViewMatrixChanged().) More...
 
bool CuboidInFogRadius (const CShapeBox &cuboid) const
 return true if the cuboid intersect with the Fog End radius More...
 
Plane::Side GetCuboidFogSide (const CShapeBox &cuboid) const
 return which side the cuboid is on
 
void BoxToRenderCoordinate (CShapeBox &cuboid) const
 convert the box to render coordinate system
 
float GetBoxToEyeMatrics (const CShapeBox &cuboid) const
 get a length matrics from the box to the current eye position. More...
 
float IntersectRayW (float startX, float startY, float startZ, float dirX, float dirY, float dirZ, float &intersectX, float &intersectY, float &intersectZ, float fMaxDistance=INFINITY)
 Casts a ray from the specified point, in the specified direction, and calculates the ray's point of intersection with the terrain. More...
 
float IntersectRay (float startX, float startY, float startZ, float dirX, float dirY, float dirZ, float &intersectX, float &intersectY, float &intersectZ, float fMaxDistance=INFINITY)
 Casts a ray from the specified point, in the specified direction, and calculates the ray's point of intersection with the terrain. More...
 
float IntersectRay (float startX, float startY, float startZ, float dirX, float dirY, float dirZ, float &intersectX, float &intersectY, float &intersectZ, int &textureCellX, int &textureCellY, float &texU, float &texV, float fMaxDistance=INFINITY)
 An overload of IntersectRay that also provides information about the texture coordinates of the intersected point in addition the position of the point. More...
 
bool Pick (int screenX, int screenY, float &pickedX, float &pickedY, float &pickedZ) const
 Quickly find the 3D point on the terrain where a given point on the screen is (for example, for mouse picking.) More...
 
bool Pick (int screenX, int screenY, float &pickedX, float &pickedY, float &pickedZ, int &textureCellX, int &textureCellY, float &texU, float &texV) const
 Quickly find the 3D point on the terrain where a given point on the screen is (for example, for mouse picking.) More...
 
void GetTextureCoordinates (float x, float y, int &textureCellX, int &textureCellY, float &texU, float &texV) const
 Returns the texture coordinates of a given point on the terrain in world coordinates. More...
 
void Paint (ParaEngine::TextureEntity *detailTexture, float brushRadius, float brushIntensity, float maxIntensity, bool erase, float x, float y)
 Paints a "splat" of the specified shared texture at the specified position on the terrain in world coordinates. More...
 
void Paint (int detailTextureIndex, float brushRadius, float brushIntensity, float maxIntensity, bool erase, float x, float y)
 
bool IsMultiTextureSupported () const
 Indicates whether or not OpenGL multitexture extensions are available from the OpenGL driver that this terrain instance is currently rendering against (as determined at the time the terrain instance was first constructed.)
 
void SetLatticePosition (int x, int y)
 Sets this Terrain object's location within a lattice of Terrains that are being managed by a TerrainLattice object. More...
 
void GetLatticePosition (int &x, int &y)
 Gets this Terrain object's location within a lattice of Terrains that are being managed by a TerrainLattice object. More...
 
void SetTextureFactory (TextureFactory *pFactory)
 Installs an application-provided TextureFactory, disabling the default one supplied by Demeter. More...
 
TextureCellGetTextureCell (int index)
 Gets the TextureCell at the specified position within this Terrain's grid of cells. More...
 
TextureCellGetTextureCellW (float x, float y)
 Get the texture cell by world coordinate position.
 
TextureCellGetTextureCell (int textureCellX, int textureCellY)
 Gets the TextureCell at the specified position within this Terrain's grid of cells. More...
 
void Write (char *szFilename)
 Writes a binary "surface" file for fine-grained detail textures. More...
 
void Read (char *szFilename)
 Reads a binary "surface" file for fine-grained detail textures. More...
 
TextureSetGetTextureSet ()
 Gets the TextureSet that represents this Terrain object's pool of shared Textures.
 
void SetTextureSet (TextureSet *pTextureSet)
 Sets the TextureSet that represents this Terrain object's pool of shared Textures. More...
 
void SetTextureCell (int index, TextureCell *pCell)
 Installs a new TextureCell at the specified position within this Terrain's grid of TextureCells. More...
 
void WriteRawTextures (const char *szTerrainName)
 Write all of this Terrain's textures to raw binary files. More...
 
void WriteRawElevations (const char *szFilename)
 Write all of this Terrain's vertices to a raw binary file. More...
 
void AllocateTextureCells (int numTextureCellsX, int numTextureCellsY)
 Sets the size of this Terrain's grid of TextureCell objects. More...
 
void GenerateTexture (int widthTexels, int heightTexels, const char *szGeneratorName)
 
void GenerateTexture (int widthTexels, int heightTexels, TextureGenerator *pGenerator)
 
int GetBaseTextureWidth ()
 Returns the width of the overall terrain texture in pixels.
 
int GetBaseTextureHeight ()
 Returns the height of the overall terrain texture in pixels.
 
void ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
uint8 * GetMaskBits (int textureCellX, int textureCellY, int detailIndex, int &maskWidth, int &maskHeight)
 Gets the raw bits of the alpha mask of the specified detail texture within the specified TextureCell.
 
void ReloadMask (int textureCellX, int textureCellY, int detailIndex)
 Unbinds and rebinds the alpha mask of the specified TextureCell so that changes to the mask become visible when rendering.
 
void LoadMaskFromDisk (bool bForceReload=false)
 load the terrain mask file from disk once again. More...
 
int NormalizeMask (int textureCellX, int textureCellY, int detailIndex, bool bReload=true)
 normalize the given texture mask layer, so that the alpha of the specified layer is unchanged and the sum of all alpha values of all mask layers at all pixels in the cell is 1. More...
 
void SetOffset (float x, float y)
 Set this Terrain object's origin. More...
 
float GetOffsetX () const
 Gets this Terrain object's origin. More...
 
float GetOffsetY () const
 Gets this Terrain object's origin. More...
 
void DigCrater (float centerX, float centerY, float radius, int textureId=-1)
 
void GetVertices (float centerX, float centerY, float radius, std::vector< TerrainVertex > &vertices)
 
const string & GetOnloadScript ()
 get the on load script which created all objects on this terrain. More...
 
const string & GetTerrainElevFile ()
 get the terrain elevation file
 
const string & GetTerrainConfigFile ()
 get the terrain elevation file
 
const string & GetTerrainBaseTextureFile ()
 get the terrain base texture file
 
void SetTerrainBaseTextureFile (const string &str)
 
const string & GetTerrainCommonTextureFile ()
 get the terrain common texture file
 
void SetTerrainCommonTextureFile (const string &str)
 
CShapeBox GetBoundingBoxW ()
 Get the bounding box from the last tessellation result. More...
 
void GetBoundingBoxes (vector< CShapeAABB > &boxes, const Matrix4 *modelView, const CShapeFrustum &frustum, int nMaxBoxesNum=1024, int nSmallestBoxStride=4)
 Get the bounding boxes for a given view frustum. More...
 
DetailTextureGetDefaultBaseLayerMask ()
 get the default base layer mask. More...
 
CTerrainRegionsGetRegions ()
 get the regions defined in this terrain. More...
 
CTerrainRegionsCreateGetRegions ()
 create region object if not created before. More...
 
int GetNumOfRegions ()
 get number terrain regions
 
void SetCurrentRegionIndex (int nRegion)
 set terrain region index, so that we can later call GetCurrentRegionName() and GetCurrentRegionFilepath(), to access region properties.
 
int GetCurrentRegionIndex ()
 Get terrain region index, so that we can later call GetCurrentRegionName() and GetCurrentRegionFilepath(), to access region properties. More...
 
void SetCurrentRegionName (const string &name)
 set the currently selected region name. More...
 
const string & GetCurrentRegionName ()
 get the currently selected region name. More...
 
void SetCurrentRegionFilepath (const string &filename)
 set the current region file path. More...
 
const string & GetCurrentRegionFilepath ()
 get the current region file path. More...
 
int GetTextureIDbyPoint (float x, float y, float &tileX, float &tileY)
 get texture ID by point. More...
 
void GetLowResTexCord (int nIndex, float &u, float &v)
 load detailed (high-res) textures, which is usually a large collection of files More...
 
void GetHighResTexCord (int nIndex, float &u, float &v)
 Get the high-res texture coordinate at a specified vertex index.
 
void GetTexCord (int nIndex, float &lowU, float &lowV, float &detailU, float &detailV)
 get both low resolution and detailed texture coordinates
 
void SetHighResTextureRadius (float radius)
 set the radius in world coordinates, within eye position of which high-res textures will be used if possible.
 
float GetHighResTextureRadius ()
 Gets the radius setting as set in a call to SetHighResTextureRadius().
 
void SetDetailTextureRepeats (float repeats)
 Specifies how many times detail textures are repeated within their parent textures. Higher values will make the detail textures smaller.
 
float GetDetailTextureRepeats ()
 Gets the repeats setting as set in a call to SetDetailTextureRepeats().
 
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 GetMaskFile (string &sMaskFile, const string &sConfigFile)
 compute mask file from the terrain config file. More...
 
bool SaveConfig (const string &filePath)
 save terrain configurations to file. More...
 
bool SaveElevation (const string &filePath)
 save terrain height map to file. More...
 
bool SaveDetailTexture (const string &filePath)
 save detail texture to texture mask file. More...
 
bool LoadFromConfigFile (const char *sFileName, float fSize=0, const char *relativePath=NULL)
 Load from Configuration file. More...
 
void OnLoad ()
 this function is automatically called after the terrain has been loaded. More...
 
bool SaveToFile (const char *filename=NULL)
 Save Terrain to file according to the modified bits. More...
 
bool ReadMaskFile (CParaFile &fileMask)
 read mask file
 
void ResizeTextureMaskWidth (int nWidth)
 resize all texture mask width More...
 
void SetSharedIB (ParaIndexBuffer ib)
 
void SwitchLodStyle (bool useGeoMipmap, ParaIndexBuffer pSharedIndices, GeoMipmapIndicesGroup *geoMipmapIndicesGroup)
 
void SetSharedIndexInfoGroup (GeoMipmapIndicesGroup *geoMipmapIndicesGroup)
 
void BuildGeoMipmapBuffer ()
 
void RenderGeoMipmap ()
 
void TessellateGeoMipmap ()
 
void BuildGeoMipmapBlocks ()
 
void SetBlockLod (int indexX, int indexY, int level, GeoMipmapChunkType chunkType)
 
bool IsWalkable (float x, float y) const
 
bool IsWalkableW (float x, float y) const
 
void SetTerrainInfoData (const uint32 *pInfoData, int width)
 
void SetVertexInfo (int idx, uint32 data, uint32 bitMask, uint32 bitOffset)
 
uint32 GetVertexInfo (int idx, uint32 bitMask, uint8 bitOffset)
 
void RefreshTerrainInfo ()
 
bool IsWalkable (float x, float y, Vector3 &oNormal) const
 
void SetVisibleDataMask (uint32 mask, uint8 bitOffset)
 
void SetEditorMode (bool enable)
 
- Public Member Functions inherited from ParaEngine::IAttributeFields
virtual int GetChildAttributeColumnCount ()
 we support multi-dimensional child object. More...
 
virtual int GetChildAttributeObjectCount (int nColumnIndex=0)
 get the number of child objects (row count) in the given column. More...
 
virtual IAttributeFieldsGetChildAttributeObject (int nRowIndex, int nColumnIndex=0)
 
virtual IAttributeFieldsGetChildAttributeObject (const std::string &sName)
 get attribute by child object. 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 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 void RegisterTextureGenerator (std::string name, TextureGenerator *pGenerator)
 
static void RegisterDefaultGenerators ()
 
static void StaticInitUV (int nWidthVertices, int nNumberOfTextureTiles, int nDetailTextureRepeats)
 init static UV coordinate constants, so that we need not calculate at runtime
 
- 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

ParaTerrain::CDetailTextureFactorym_pDetailedTextureFactory
 for high-res texture of terrain surfaces
 
bool m_useGeoMipmap
 

Static Public Attributes

static Vector2s_LowResTexCords = NULL
 array of low resolution texture coordinates. More...
 
static Vector2s_HighResTexCords = NULL
 array of high resolution texture coordinates. More...
 

Protected Member Functions

bool GenerateTerrainNormal (bool bForceRegenerate=false)
 generate terrain normal for rendering with light on. More...
 
- Protected Member Functions inherited from ParaEngine::IAttributeFields
virtual CAttributeClassCreateAttributeClass ()
 initialize fields
 
virtual CDynamicAttributesSetGetDynamicAttributes (bool bCreateIfNotExist=false)
 

Friends

class Triangle
 
class TriangleStrip
 
class TerrainBlock
 
class TriangleFan
 
class TerrainLattice
 
class TerrainBuffer
 
class Loader
 
class TextureSet
 

Additional Inherited Members

- 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
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Detailed Description

This class represents a single, contiguous chunk of terrain and is the primary public interface to Demeter.

Most applications will create a single instance of this class to represent the terrain in the application, but multiple instances can be used to stitch together a very large world comprised of multiple terrains using the TerrainLattice class. The simplest way to use this class to make a new instance using the constructor that takes no parameters and then use an ElevationLoader and a TextureLoader to give it vertices and textures. Alternatively, you can use the constructor that takes arrays of floats and bytes if you wish to load your own elevation and texture data.

Constructor & Destructor Documentation

§ Terrain() [1/3]

Terrain::Terrain ( const float *  pElevations,
int  elevWidth,
int  elevHeight,
const uint8 *  pTextureImage,
int  textureWidth,
int  textureHeight,
const uint8 *  pDetailTextureImage,
int  detailWidth,
int  detailHeight,
float  vertexSpacing,
float  elevationScale,
int  maxNumTriangles,
float  offsetX = 0.0f,
float  offsetY = 0.0f 
)

Constructs a new terrain from raw elevation and image data in memory buffers.

By using this constructor, you are specifying the layout of all of the vertices in the Terrain's mesh. These vertices are always a rectangular grid of 3D points at regularly spaced intervals. You are also specifying what the overall terrain texture looks like.

Parameters
pElevationsAn array of floating point values representing the elevation (z value) of each vertex in the terrain's mesh. The size of this array must be equal to elevWidth * elevHeight
elevWidthThe number of vertices along the x-axis (width) of the grid of vertices in pElevations.
elevHeightThe number of vertices along the y-axis (height) of the grid of vertices in pElevations.
pTextureImageAn array of byte values representing the texture image that will be draped across the entire surface of the Terrain (this is the "overall" texture.) The array must contain 3 bytes per pixel - the red, green, and blue color values of the pixel respectively. It is assumed that the array does not contain any extra padding per image row. Therefore, if your image is 1024x1024 pixels, then this array should be 9,437,184 bytes in size. You can pass NULL for this parameter to build a Terrain with no texture.
textureWidthThe width of the texture image in pixels.
textureHeightThe height of the texture image in pixels.
pDetailTextureImageThis is similar to the pTextureImage parameter, but instead of describing the overall terrain texture, this buffer buffer describes the "common" texture. See Terrain::SetCommonTexture() for details. You can pass NULL for this parameter to build a Terrain with no common texture.
detailWidthThe width of the detail texture image in pixels.
detailHeightThe height of the detail texture image in pixels.
vertexSpacingThe distance, in world modeling units, between vertices in the Terrain's mesh. This distance is constant in both the horizontal and vertical directions. For example, if your pass in an array of 1024x1024 vertices for the pElevations and elevWidth and elevHeight parameters, and pass a value of 10.0 for the vertexSpacing parameter, then the resulting Terrain will be 10240 x 10240 world units in size.
elevationScaleA scaling factor that is applied to all of the values in the pElevations array. Most applications will pass a 1.0 for this value since presumably pElevations was built by the application.
maxNumTrianglesThe maximum number of triangles that the Terrain is allowed to tessellate to when rendering. This number should be relatively high and is chosen based on what you know about the geometry of your terrain. For example, if your terrain is typical then a value of 40000 works well, but if you know your Terrain contains numerous canyons and sharp cliffs that will tessellate to lots of triangles, you might need to raise this value to something on the order of 60000. The higher this number, the more memory the Terrain will use for tessellation.
offsetXHorizontal translation of this Terrain in world units. See Terrain::SetOffserX().
offsetYVertical translation of this Terrain in world units. See Terrain::SetOffserY().

§ Terrain() [2/3]

Terrain::Terrain ( int  widthVertices,
int  heightVertices,
float  vertexSpacing,
int  maxNumTriangles 
)

By using this constructor, you are specifying the layout of all of the vertices in the Terrain's mesh.

This version of the constructor creates a Terrain that is a flat plane with elevations of zero at all vertices. Otherwise, it is identical to the constructor that takes pElevations.

Parameters
widthVerticesThe number of vertices along the x-axis (width) of the grid of vertices in the mesh.
heightVerticesThe number of vertices along the y-axis (height) of the grid of vertices in the mesh.
vertexSpacingThe distance, in world modeling units, between vertices in the Terrain's mesh. This distance is constant in both the horizontal and vertical directions. For example, if your pass in an array of 1024x1024 vertices for the pElevations and elevWidth and elevHeight parameters, and pass a value of 10.0 for the vertexSpacing parameter, then the resulting Terrain will be 10240 x 10240 world units in size.
maxNumTrianglesThe maximum number of triangles that the Terrain is allowed to tessellate to when rendering. This number should be relatively high and is chosen based on what you know about the geometry of your terrain. For example, if your terrain is typical then a value of 40000 works well, but if you know your Terrain contains numerous canyons and sharp cliffs that will tessellate to lots of triangles, you might need to raise this value to something on the order of 60000. The higher this number, the more memory the Terrain will use for tessellation.

§ Terrain() [3/3]

Terrain::Terrain ( int  maxNumTriangles,
float  offsetX,
float  offsetY 
)

Constructs a (mostly) empty terrain suitable for use by an ElevationLoader.

Parameters
maxNumTrianglesThe maximum number of triangles that the Terrain is allowed to tessellate to when rendering. This number should be relatively high and is chosen based on what you know about the geometry of your terrain. For example, if your terrain is typical then a value of 40000 works well, but if you know your Terrain contains numerous canyons and sharp cliffs that will tessellate to lots of triangles, you might need to raise this value to something on the order of 60000. The higher this number, the more memory the Terrain will use for tessellation.
offsetXHorizontal translation of this Terrain in world units. See Terrain::SetOffserX().
offsetYVertical translation of this Terrain in world units. See Terrain::SetOffserY().

Member Function Documentation

§ AllocateTextureCells()

void Terrain::AllocateTextureCells ( int  numTextureCellsX,
int  numTextureCellsY 
)

Sets the size of this Terrain's grid of TextureCell objects.

You must specify a number of cells such that the following equation evalues to integral values for tw and tv, otherwise your Terrain will show seams between textures:

vx = number of terrain mesh vertices x
vy = number of terrain mesh vertices y
nx = numTextureCellsX
ny = numTextureCellsY
vs = terrain's vertex spacing
tw = width of a TextureCell in vertices
th = height of a TextureCell in vertices
tw = ((vx + nx - 1) / nx - 1) / vs
th = ((vy + ny - 1) / ny - 1) / vs
See the TextureCell class for details.
Parameters
numTextureCellsXThe number of cells in the X direction of this Terrain's grid of TextureCells.
numTextureCellsYThe number of cells in the Y direction of this Terrain's grid of TextureCells.

§ CreateGetRegions()

CTerrainRegions * Terrain::CreateGetRegions ( )

create region object if not created before.

§ CreateHoleMap()

void Terrain::CreateHoleMap ( BYTE *  pHoleData = NULL,
int  nLength = 0 
)

create hole map from terrain hole map.

Parameters
pHoleDataif this value is NULL, a blank hole map without any holes will be created. Otherwise, it is interpreted as an array of X*X BYTE values. If the BYTE value is 1, it is interpreted as a hole, otherwise it is false.

§ CuboidInFogRadius()

bool Terrain::CuboidInFogRadius ( const CShapeBox cuboid) const

return true if the cuboid intersect with the Fog End radius

Parameters
cuboidmake sure this is in local terrain coordinate system.

§ CuboidInFrustum()

int Terrain::CuboidInFrustum ( const CShapeBox cuboid) const

Indicates whether or not the specified cuboid is inside of the viewing frustum (as defined at the previous call to ModelViewMatrixChanged().)

Please notice that the original Demeter terrain has the height info saved in z axis, yet, in ParaEngine, it is in y axis.

Parameters
cuboid: The box to test. make sure this is in local terrain coordinate system.
Returns
: 2 requires more testing(meaning either intersecting) 1 is fast accept(meaning the box is fully inside the frustum) 0 is fast reject,

So we secretly exchanged z,y during culling with the camera.

set whether we will use 8 points of the cuboid for frustum test or else using standard AABB test

Note
: there are no performance difference.

if true, we will treat the far plane as a spherical plane when doing occlusion testing

§ GenerateTerrainNormal()

bool Terrain::GenerateTerrainNormal ( bool  bForceRegenerate = false)
protected

generate terrain normal for rendering with light on.

This function will only generate normal when the m_pNormal is NULL.

Parameters
bForceRegeneratetrue to regenerate any way.
Returns

§ GenerateTexture() [1/2]

void Terrain::GenerateTexture ( int  widthTexels,
int  heightTexels,
const char *  szGeneratorName 
)
Deprecated:
Formerly used by TerrainLattice for procedural textures.

§ GenerateTexture() [2/2]

void Terrain::GenerateTexture ( int  widthTexels,
int  heightTexels,
TextureGenerator pGenerator 
)
Deprecated:
Formerly used by TerrainLattice for procedural textures.

§ GetAttributeClassID()

virtual int ParaTerrain::Terrain::GetAttributeClassID ( )
inlinevirtual

attribute class ID should be identical, unless one knows how overriding rules work.

Reimplemented from ParaEngine::IAttributeFields.

§ GetBoundingBoxes()

void Terrain::GetBoundingBoxes ( vector< CShapeAABB > &  boxes,
const Matrix4 modelView,
const 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.

breadth first transversing the quad tree

§ GetBoundingBoxW()

CShapeBox Terrain::GetBoundingBoxW ( )

Get the bounding box from the last tessellation result.

The returned box is always in world coordinate.

§ GetBoxToEyeMatrics()

float Terrain::GetBoxToEyeMatrics ( const CShapeBox cuboid) const

get a length matrics from the box to the current eye position.

LiXizhi 2009.2.15: http://www.gamasutra.com/features/20000228/ulrich_02.htm This one just determines whether to tesselate according to camera-quad distance, instead of using screen space metrics. bc[x,y,z] == coordinates of box center ex[x,y,z] == extent of box from the center (i.e. 1/2 the box dimensions) L1 = max(abs(bcx - viewx) - exx, abs(bcy - viewy) - exy, abs(bcz - viewz) - exz) enabled = maxerror * Threshold < L1

§ GetCurrentRegionFilepath()

const string & Terrain::GetCurrentRegionFilepath ( )

get the current region file path.

§ GetCurrentRegionIndex()

int Terrain::GetCurrentRegionIndex ( )

Get terrain region index, so that we can later call GetCurrentRegionName() and GetCurrentRegionFilepath(), to access region properties.

-1 if nothing is selected.

§ GetCurrentRegionName()

const string & Terrain::GetCurrentRegionName ( )

get the currently selected region name.

§ GetDefaultBaseLayerMask()

DetailTexture * Terrain::GetDefaultBaseLayerMask ( )

get the default base layer mask.

All bits are 0xFF.

§ GetElevation() [1/2]

float Terrain::GetElevation ( float  x,
float  y 
) const

Returns the elevation (z-coordinate) in real units of the specified point on the terrain.

if the specified point is inside a hole, we will return (-INFINITY)

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

§ GetElevation() [2/2]

float Terrain::GetElevation ( int  index) const

Returns the elevation (z-coordinate) in real units of the specified terrain vertex.

Parameters
indexThe index of the vertex in the Terrain's mesh to get the elevation of.

§ GetElevationW()

float Terrain::GetElevationW ( float  x,
float  y 
) const

Returns the elevation (z-coordinate) in real units of the specified point on the terrain.

if the specified point is inside a hole, we will return (-INFINITY)

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.

§ GetLatticePosition()

void Terrain::GetLatticePosition ( int &  x,
int &  y 
)

Gets this Terrain object's location within a lattice of Terrains that are being managed by a TerrainLattice object.

Parameters
xFilled with the position within a TerrainLattice object's grid of Terrains that this object fills.
yFilled with the position within a TerrainLattice object's grid of Terrains that this object fills.

§ GetLowestVisibleHeight()

float Terrain::GetLowestVisibleHeight ( )

Get the height of the lowest visible terrain point.

This may be used to render the ocean

§ GetLowResTexCord()

void ParaTerrain::Terrain::GetLowResTexCord ( int  nIndex,
float &  u,
float &  v 
)
inline

load detailed (high-res) textures, which is usually a large collection of files

Get the low-res texture coordinate at a specified vertex index

§ GetMaskFile()

void Terrain::GetMaskFile ( string &  sMaskFile,
const string &  sConfigFile 
)

compute mask file from the terrain config file.

the fold of terrain configure file + folder with terrain config file name+".mask" e.g. if the terrain configure file is "sample/config/sample_0_0.config.txt" then the mask files will be saved to "sample/config/sample_0_0.mask"

§ GetNormal()

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

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

Parameters
xThe x location of the point on the Terrain's surface in local units.
yThe y location of the point on the Terrain's surface in local 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

§ GetNormalW()

void Terrain::GetNormalW ( float  x,
float  y,
float &  normalX,
float &  normalY,
float &  normalZ 
) const

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

§ GetOffsetX()

float Terrain::GetOffsetX ( ) const

Gets this Terrain object's origin.

This is used by the TerrainLattice class when a grid of Terrains is being managed, but can also be used as a simple way to apply translation to a Terrain.

§ GetOffsetY()

float Terrain::GetOffsetY ( ) const

Gets this Terrain object's origin.

This is used by the TerrainLattice class when a grid of Terrains is being managed, but can also be used as a simple way to apply translation to a Terrain.

§ GetOnloadScript()

const string & Terrain::GetOnloadScript ( )

get the on load script which created all objects on this terrain.

§ GetRegions()

CTerrainRegions * Terrain::GetRegions ( )

get the regions defined in this terrain.

May return NULL if no regions defined.

§ GetRegionValue()

DWORD Terrain::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 local units.
yThe y location of the point on the Terrain's surface in local units.

§ GetRegionValueW()

DWORD Terrain::GetRegionValueW ( 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.

§ GetTextureCell() [1/2]

TextureCell * Terrain::GetTextureCell ( int  index)

Gets the TextureCell at the specified position within this Terrain's grid of cells.

Parameters
indexThe index of the TextureCell within this Terrain's grid of TextureCells.

§ GetTextureCell() [2/2]

TextureCell * Terrain::GetTextureCell ( int  textureCellX,
int  textureCellY 
)

Gets the TextureCell at the specified position within this Terrain's grid of cells.

Parameters
textureCellXThe x position of the TextureCell within this Terrain's grid of TextureCells.
textureCellYThe y position of the TextureCell within this Terrain's grid of TextureCells.

§ GetTextureCoordinates()

void Terrain::GetTextureCoordinates ( float  x,
float  y,
int &  textureCellX,
int &  textureCellY,
float &  texU,
float &  texV 
) const

Returns the texture coordinates of a given point on the terrain in world coordinates.

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.
textureCellXFilled with the X position of the intersected TextureCell object in the Terrain's grid of TextureCells.
textureCellYFilled with the Y position of the intersected TextureCell object in the Terrain's grid of TextureCells.
texUFilled with the coordinate within the TextureCell where the intersection point is (range from 0.0 to 1.0.)
texVFilled with the coordinate within the TextureCell where the intersection point is (range from 0.0 to 1.0.)

§ GetTextureIDbyPoint()

int Terrain::GetTextureIDbyPoint ( float  x,
float  y,
float &  tileX,
float &  tileY 
)

get texture ID by point.

texture ID is the index of low-res textures in range [0, 8*8)

Parameters
xin local coordinate
yin local coordinate @ return: the texture ID returned. may be negative

§ GetVertex()

int Terrain::GetVertex ( float  x,
float  y 
) const

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

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

§ GetVertexElevation()

float Terrain::GetVertexElevation ( int  index) const

Returns the elevation (z-coordinate) in real units of the specified vertex on the terrain.

Parameters
indexThe index of the vertex in the Terrain's mesh to get the elevation of.

§ GetVertexW()

int Terrain::GetVertexW ( float  x,
float  y 
) const

Returns the index 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.

§ InstallFields()

int Terrain::InstallFields ( CAttributeClass pClass,
bool  bOverride 
)
virtual

this class should be implemented if one wants to add new attribute.

This function is always called internally.

Reimplemented from ParaEngine::IAttributeFields.

§ IntersectRay() [1/2]

float Terrain::IntersectRay ( float  startX,
float  startY,
float  startZ,
float  dirX,
float  dirY,
float  dirZ,
float &  intersectX,
float &  intersectY,
float &  intersectZ,
float  fMaxDistance = INFINITY 
)

Casts a ray from the specified point, in the specified direction, and calculates the ray's point of intersection with the terrain.

This method makes use of the terrain's quad tree to optimize the ray-tracing. if the ray intersect with holes in the terrain, a negative value will be returned as well. IMPORTANT: it is assumed that the ray is specified in local coordinate system

Returns
The distance from the starting point to the intersection. A negative value is returned if the ray misses the Terrain.
Parameters
startXThe starting point of the ray.
startYThe starting point of the ray.
startZThe starting point of the ray.
dirXThe direction of the ray - this vector should be normalized.
dirYThe direction of the ray - this vector should be normalized.
dirZThe direction of the ray - this vector should be normalized.
intersectXFilled with the intersection point of this ray with the Terrain surface.
intersectYFilled with the intersection point of this ray with the Terrain surface.
intersectZFilled with the intersection point of this ray with the Terrain surface.

if the ray intersect with holes in the terrain, a negative value will be returned.

§ IntersectRay() [2/2]

float Terrain::IntersectRay ( float  startX,
float  startY,
float  startZ,
float  dirX,
float  dirY,
float  dirZ,
float &  intersectX,
float &  intersectY,
float &  intersectZ,
int &  textureCellX,
int &  textureCellY,
float &  texU,
float &  texV,
float  fMaxDistance = INFINITY 
)

An overload of IntersectRay that also provides information about the texture coordinates of the intersected point in addition the position of the point.

if the ray intersect with holes in the terrain, a negative value will be returned as well. IMPORTANT: it is assumed that the ray is specified in local coordinate system

Returns
The distance from the starting point to the intersection. A negative value is returned if the ray misses the Terrain.
Parameters
startXThe starting point of the ray.
startYThe starting point of the ray.
startZThe starting point of the ray.
dirXThe direction of the ray - this vector should be normalized.
dirYThe direction of the ray - this vector should be normalized.
dirZThe direction of the ray - this vector should be normalized.
intersectXFilled with the intersection point of this ray with the Terrain surface.
intersectYFilled with the intersection point of this ray with the Terrain surface.
intersectZFilled with the intersection point of this ray with the Terrain surface.
textureCellXFilled with the X position of the intersected TextureCell object in the Terrain's grid of TextureCells.
textureCellYFilled with the Y position of the intersected TextureCell object in the Terrain's grid of TextureCells.
texUFilled with the coordinate within the TextureCell where the intersection point is (range from 0.0 to 1.0.)
texVFilled with the coordinate within the TextureCell where the intersection point is (range from 0.0 to 1.0.)

§ IntersectRayW()

float Terrain::IntersectRayW ( float  startX,
float  startY,
float  startZ,
float  dirX,
float  dirY,
float  dirZ,
float &  intersectX,
float &  intersectY,
float &  intersectZ,
float  fMaxDistance = INFINITY 
)

Casts a ray from the specified point, in the specified direction, and calculates the ray's point of intersection with the terrain.

This method makes use of the terrain's quad tree to optimize the ray-tracing. if the ray intersect with holes in the terrain, a negative value will be returned as well. IMPORTANT: it is assumed that the ray is specified in world coordinate system

Returns
The distance from the starting point to the intersection. A negative value is returned if the ray misses the Terrain.
Parameters
startXThe starting point of the ray.
startYThe starting point of the ray.
startZThe starting point of the ray.
dirXThe direction of the ray - this vector should be normalized.
dirYThe direction of the ray - this vector should be normalized.
dirZThe direction of the ray - this vector should be normalized.
intersectXFilled with the intersection point of this ray with the Terrain surface.
intersectYFilled with the intersection point of this ray with the Terrain surface.
intersectZFilled with the intersection point of this ray with the Terrain surface.

§ InvokeEditor()

bool Terrain::InvokeEditor ( int  nFieldID,
const string &  sParameters 
)
virtual

Invoke an (external) editor for a given field.

This is usually for NPL script field

Parameters
nFieldID: field ID
sParameters: the parameter passed to the editor
Returns
true if editor is invoked, false if failed or field has no editor.

§ IsEmpty()

bool Terrain::IsEmpty ( )

whether the terrain is a fake terrain without vertices.

§ IsHole()

bool Terrain::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 local units.
yThe y location of the point on the Terrain's surface in local units.
Returns
: true if the position specified by (x,y) is inside a terrain hole

§ IsHoleW()

bool Terrain::IsHoleW ( 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() [1/2]

bool Terrain::IsModified ( )
virtual

whether the terrain geometry, texture has been modified.

If any of them has been modified, this function will return true.

Reimplemented from ParaEngine::IAttributeFields.

§ IsModified() [2/2]

bool Terrain::IsModified ( DWORD  dwModifiedBits)

return true if any part specified in dwModifiedBits has been modified.

see TERRAIN_MODIFIED_BITS.

Parameters
dwModifiedBitsthis is any combination of TERRAIN_MODIFIED_BITS.

§ LoadFromConfigFile()

bool Terrain::LoadFromConfigFile ( const char *  sFileName,
float  fSize = 0,
const char *  relativePath = NULL 
)

Load from Configuration file.

Modified bits are cleared. Please note that the on_load script is not called. one must manually call OnLoad() to load scene objects in this terrain.

Parameters
fSizeif fSize is not 0, it will override the size read from the configuration file
relativePathif sFileName is not found, it will try appending relativePath before sFileName. relativePath is trimmed to the last slash character. i.e. "terrain/abc.txt" and "terrain/" are the same relative path.
Returns
: return true if succeeded

add terrain holes

add all detail textures used in this terrain tile

get regions layers

§ LoadMaskFromDisk()

void Terrain::LoadMaskFromDisk ( bool  bForceReload = false)

load the terrain mask file from disk once again.

This function only works when terrain is not editable. otherwise there is no need to load mask file manually here. This function is called when device is lost.

Parameters
bForceReloadif true, it will reload mask file from disk.

read mask data from file:

§ ModelViewMatrixChanged()

int Terrain::ModelViewMatrixChanged ( )

Notifies Demeter that OpenGL's modelview matrix has been modified, allowing Demeter to tessellate the terrain based on the new modelview matrix.

It is IMPERATIVE that his method be called every time the modelview matrix is changed, even if this is in every single rendering cycle of the application. Based on the current viewing parameters, the terrain will be broken down into a visually optimum set of triangles that can be rendered.

§ NormalizeMask()

int Terrain::NormalizeMask ( int  textureCellX,
int  textureCellY,
int  detailIndex,
bool  bReload = true 
)

normalize the given texture mask layer, so that the alpha of the specified layer is unchanged and the sum of all alpha values of all mask layers at all pixels in the cell is 1.

it is good practice to keep every pixel mask normalized, so that we do not get overly lighted terrain surface.

Parameters
detailIndexif this is -1, the base layer is used
bReloadif true, it will reload all mask layers
Returns
: the number of layers affected.

§ OnLoad()

void Terrain::OnLoad ( )

this function is automatically called after the terrain has been loaded.

it usually does the following things in the given order:

  • call the terrain tile's on load script;
  • load all NPC from database in this terrain tile. Please note that the on load script might in turn create new terrain objects.

§ Paint()

void Terrain::Paint ( ParaEngine::TextureEntity detailTexture,
float  brushRadius,
float  brushIntensity,
float  maxIntensity,
bool  erase,
float  x,
float  y 
)

Paints a "splat" of the specified shared texture at the specified position on the terrain in world coordinates.

See the TextureSet class for details on how to get a detailTextureIndex for painting.

Parameters
detailTextureThe shared index of a Texture object that is part of this Terrain object's TextureSet.
brushRadiusThe width of the brush to paint with in DetailTexture layer pixels. There are typically 256 of these pixels across a TextureCell.
brushIntensityThe intensity with which to paint, ranging from 0.0 to 1.0. This determines how opaque the painted "splat" will be.
maxIntensityThe maximum intensity of the painted splat, ranging from 0.0 to 1.0, accounting for mixing with a splat that may already reside on the surface.
eraseSpecifies whether to add the splat to the surface or remove existing splat texels already on the surface (pass false to paint and pass true to erase existing splats)
xThe x location of the point to paint on the Terrain's surface in world units.
yThe y location of the point to paint on the Terrain's surface in world units.

§ Pick() [1/2]

bool Terrain::Pick ( int  screenX,
int  screenY,
float &  pickedX,
float &  pickedY,
float &  pickedZ 
) const

Quickly find the 3D point on the terrain where a given point on the screen is (for example, for mouse picking.)

This is cheaper and faster than using the ray tracing methods, but far less accurate. The accuracy of this method depends upon the z-buffer depth and the screen resolution.

Parameters
screenXThe X position of the pixel on the screen that was "clicked"
screenYthe Y position of the pixel on the screen that was "clicked" - you will often to invert this value since the OpenGL screen Y-axis runs opposite that of most window systems. For example, you may need to pass Settings::GetInstance()->GetScreenHeight() - mouseY instead of just passing mouseY.
pickedXFilled with the picked point on Terrain surface.
pickedYFilled with the picked point on Terrain surface.
pickedZFilled with the picked point on Terrain surface.
Returns
Returns false is the picked point is not on the Terrain.

§ Pick() [2/2]

bool Terrain::Pick ( int  screenX,
int  screenY,
float &  pickedX,
float &  pickedY,
float &  pickedZ,
int &  textureCellX,
int &  textureCellY,
float &  texU,
float &  texV 
) const

Quickly find the 3D point on the terrain where a given point on the screen is (for example, for mouse picking.)

This is cheaper and faster than using the ray tracing methods, but far less accurate. The accuracy of this method depends upon the z-buffer depth and the screen resolution.

Parameters
screenXThe X position of the pixel on the screen that was "clicked"
screenYthe Y position of the pixel on the screen that was "clicked" - you will often to invert this value since the OpenGL screen Y-axis runs opposite that of most window systems. For example, you may need to pass Settings::GetInstance()->GetScreenHeight() - mouseY instead of just passing mouseY.
pickedXFilled with the picked point on Terrain surface.
pickedYFilled with the picked point on Terrain surface.
pickedZFilled with the picked point on Terrain surface.
textureCellXFilled with the X position of the intersected TextureCell object in the Terrain's grid of TextureCells.
textureCellYFilled with the Y position of the intersected TextureCell object in the Terrain's grid of TextureCells.
texUFilled with the coordinate within the TextureCell where the intersection point is (range from 0.0 to 1.0.)
texVFilled with the coordinate within the TextureCell where the intersection point is (range from 0.0 to 1.0.)
Returns
Returns false is the picked point is not on the Terrain.

§ Read()

void ParaTerrain::Terrain::Read ( char *  szFilename)

Reads a binary "surface" file for fine-grained detail textures.

NOTE: the format of this file will be changed soon.

Deprecated:
This file format has been replaced by the Demeter Texture Editor XML format.
Parameters
szFilenameA filename to read from. The media path will be prepended to this file. See Settings::SetMediaPath().

§ RebuildRenderBuffer()

void Terrain::RebuildRenderBuffer ( )

Rebuild the rendering buffer from triangle strips and fans generated from Tessellate() and RepairCracks().

See also
Tessellate()
RepairCracks()

§ RecalcGeometry() [1/2]

void Terrain::RecalcGeometry ( int  index1,
int  index2 
)

Recalculates bounding box for the quad spanning from vertex 1 to vertex 2.

Parameters
index1The index of the top-left vertex
index2The index of the bottom-right vertex

§ RecalcGeometry() [2/2]

void Terrain::RecalcGeometry ( )

recalculate the entire terrain.

It is actually fast.

§ RecalcNormal() [1/2]

void Terrain::RecalcNormal ( float  x,
float  y 
)

Recalculates the normal vector of the vertex closes 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.

§ RecalcNormal() [2/2]

void Terrain::RecalcNormal ( int  vertexIndex)

Recalculates the normal vector of the specified vertex.

Parameters
vertexIndexThe index of the vertex in the Terrain's mesh.

§ ref()

void ParaTerrain::Terrain::ref ( ) const
inline

Increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method is provided for use of Demeter with the Open Scene Graph.

§ RegisterDefaultGenerators()

void Terrain::RegisterDefaultGenerators ( )
static
Deprecated:
Formerly used by TerrainLattice for procedural textures.

§ RegisterTextureGenerator()

void Terrain::RegisterTextureGenerator ( std::string  name,
TextureGenerator pGenerator 
)
static
Deprecated:
Formerly used by TerrainLattice for procedural textures.

§ Render()

void Terrain::Render ( void  )

Render the terrain from Render Buffer.

Applications should always call ModelViewMatrixChanged() at least once prior to calling Render(), so that Demeter will have a chance to tessellate the terrain.

See also
RebuildRenderBuffer()

draw nothing if there is nothing to draw

render the terrain by texture groups

for each texture group, we will use multi-texture stage to render blended textures at the same time

render the terrain by texture groups

for each texture group, we will use multi-texture stage to render blended textures at the same time

three groups at a time. ( alpha0 + detail1 ) + ( alpha3 + detail4 ) + ( alpha5 + detail6 )

§ RepairCracks()

void Terrain::RepairCracks ( )

repair cracks during tessellation.

the triangle strips built from Tessellate() will has cracks between neighboring triangles of different size. in these cases, the bigger triangle strips are replaced with triangle fans, so that there will be no cracks. Here "cracks" means that the surface is not a continuous surface.

See also
Tessellate()

§ ResizeTextureMaskWidth()

void Terrain::ResizeTextureMaskWidth ( int  nWidth)

resize all texture mask width

export all alpha mask data to disk with the name:

§ SaveConfig()

bool Terrain::SaveConfig ( const string &  filePath)

save terrain configurations to file.

this function will save file regardless of the modified bits; it will not clear the modified bits either.

Parameters
filePathif this is "", the current config file name will be used.

get regions layers

§ SaveDetailTexture()

bool Terrain::SaveDetailTexture ( const string &  filePath)

save detail texture to texture mask file.

this function will save file regardless of the modified bits; it will not clear the modified bits either.

Parameters
filePathif this is "", the current mask file name will be used.

export all alpha mask data to disk with the name:

§ SaveElevation()

bool Terrain::SaveElevation ( const string &  filePath)

save terrain height map to file.

this function will save file regardless of the modified bits; it will not clear the modified bits either.

Parameters
filePathif this is "", the current elevation file name will be used.

§ SaveToFile()

bool Terrain::SaveToFile ( const char *  filename = NULL)

Save Terrain to file according to the modified bits.

Parameters
filenamefile name of the terrain config file. All related files, such as elevation file and alpha mask files will be saved in the save directory of the terrain config file.If this is NULL, the load config file will be used. and will be overridden.
fSizeif fSize is not 0, it will override the size of this terrain tile by the value supplied.
relativePathif sFileName is not found, it will try appending relativePath before sFileName. relativePath is trimmed to the last slash character. i.e. "terrain/abc.txt" and "terrain/" are the same relative path.
Returns
: return true if succeeded

§ SetAllElevations()

void Terrain::SetAllElevations ( const float *  pElevations,
int  elevWidth,
int  elevHeight,
float  fTerrainSize,
float  elevationScale = 1.0f 
)

Replaces all of the Terrain's vertices with a new set of vertices.

Parameters
pElevationsAn array of floating point values representing the elevation (z value) of each vertex in the terrain's mesh. The size of this array must be equal to elevWidth * elevHeight
elevWidthThe number of vertices along the x-axis (width) of the grid of vertices in pElevations.
elevHeightThe number of vertices along the y-axis (height) of the grid of vertices in pElevations.
fTerrainSizesize of this terrain of 1024x1024 vertices for the pElevations and elevWidth and elevHeight parameters, and pass a value of 10.0 for the vertexSpacing parameter, then the resulting Terrain will be 10240 x 10240 world units in size.
elevationScaleA scaling factor that is applied to all of the values in the pElevations array. Most applications will pass a 1.0 for this value since presumably pElevations was built by the application.

this will repair imprecisions due to the floating calculations

§ SetBaseTexture()

bool Terrain::SetBaseTexture ( const string &  filename,
int  numTextureCellsX = 8,
int  numTextureCellsY = 8 
)

Set the base texture to texture cells.

The base texture will be chopped according to the texture cell configuration. e.g. if the texture cell is 8x8, then the base texture is chopped to 64 small textures and set to each texture cell.

Parameters
numTextureCellsXThe number of cells in the X direction of this Terrain's grid of TextureCells.
numTextureCellsYThe number of cells in the Y direction of this Terrain's grid of TextureCells.

§ SetCommonTexture() [1/3]

bool Terrain::SetCommonTexture ( const uint8 *  pImage,
int  width,
int  height 
)

Uses the specified graphics image to apply a "common" texture to the entire surface of the terrain.

A common texture is repeated across the entire terrain and is blended with the terrain's overall texture (if blending is supported by the user's hardware.) This is used to provide a texture to give the ground some definition when the camera is close to the ground, but is an inferior to alternative to the use of specific DetailTexture instances.

Parameters
pImageAn array of byte values representing the texture image that will be draped across the entire surface of the Terrain (this is the "overall" texture.) The array must contain 3 bytes per pixel - the red, green, and blue color values of the pixel respectively. It is assumed that the array does not contain any extra padding per image row. Therefore, if your image is 1024x1024 pixels, then this array should be 9,437,184 bytes in size. You can pass NULL for this parameter to build a Terrain with no texture.
widthThe width of the texture image in pixels.
heightThe height of the texture image in pixels.

§ SetCommonTexture() [2/3]

void Terrain::SetCommonTexture ( const char *  fileName)

Uses the specified Texture to apply a "common" texture to the entire surface of the terrain.

A common texture is repeated across the entire terrain and is blended with the terrain's overall texture (if blending is supported by the user's hardware.) This is used to provide a texture to give the ground some definition when the camera is close to the ground, but is an inferior to alternative to the use of specific DetailTexture instances.

§ SetCommonTexture() [3/3]

void Terrain::SetCommonTexture ( Texture pTexture)

A common texture is repeated across the entire terrain and is blended with the terrain's overall texture (if blending is supported by the user's hardware.) This is used to provide a texture to give the ground some definition when the camera is close to the ground, but is an inferior to alternative to the use of specific DetailTexture instances.

Parameters
pTextureA Texture object to use as the common texture.

§ SetCurrentRegionFilepath()

void Terrain::SetCurrentRegionFilepath ( const string &  filename)

set the current region file path.

§ SetCurrentRegionName()

void Terrain::SetCurrentRegionName ( const string &  name)

set the currently selected region name.

The current region Index is changed to the current selected one or -1 if invalid. please note that: this does not create the region layer

§ SetDetailThreshold()

void Terrain::SetDetailThreshold ( float  threshold)

Sets the "detail threshold", which controls how much Demeter simplifies the terrain.

Higher thresholds will increase performance but make the terrain look worse, while lower thresholds will reduce performance and increase visual quality. Extremely high thresholds can cause significant visual artifacts.

Parameters
thresholdAn error metric, measured in screen pixels. Any terrain blocks smaller than this threshold will be simplified. Currently this is a squared value.i.e. If it is 7 pixels, then the value should be 49.

§ SetHole()

void Terrain::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();

§ SetHoleLocal()

void Terrain::SetHoleLocal ( float  x,
float  y,
bool  bIsHold 
)

set a new terrain hole at the specified local 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
xx component of the hole. it is relative to this terrain tile, not to the global world.
yx component of the hole. it is relative to this terrain tile, not to the global world.
See also
SetHole();

create a concrete hole map.

§ SetHoleScale()

void Terrain::SetHoleScale ( int  nHoleScale)

this value can only be a power of 2, such as 2, 4, 8, etc.

default value is 2 or 4. it denotes how many successive vertex in the height map represent a hole the larger the value is the larger the hole vertex is.

§ SetLatticePosition()

void Terrain::SetLatticePosition ( int  x,
int  y 
)

Sets this Terrain object's location within a lattice of Terrains that are being managed by a TerrainLattice object.

Parameters
xThe position within a TerrainLattice object's grid of Terrains that this object will fill.
yThe position within a TerrainLattice object's grid of Terrains that this object will fill.

§ SetLowestVisibleHeight()

void Terrain::SetLowestVisibleHeight ( float  fHeight)

Set the height of the lowest visible terrain point.

This may be used to render the ocean

§ SetMaximumVisibleBlockSize()

void Terrain::SetMaximumVisibleBlockSize ( int  stride)

Sets the maximum size of blocks that can be simplified when the terrain is tessellated.

This setting can be used by applications that allow much of the terrain to be visible from above, such as flight simulators, to prevent oversimplification of terrain in the distance. Setting this value too low will adversely affect performance.

Parameters
strideSpecifies the number of vertices along one edge of the block (blocks are always square.)

§ SetModified() [1/2]

void Terrain::SetModified ( bool  bIsModified,
DWORD  dwModifiedBits 
)

Turn on/off the specified flag indicating whether the terrain has been modified or not.

Parameters
bIsModifiedtrue to turn on the bits specified in dwModifiedBits, false otherwise.
dwModifiedBitsthis is any combination of TERRAIN_MODIFIED_BITS.

§ SetModified() [2/2]

void Terrain::SetModified ( bool  bIsModified)
virtual

set the terrain modified to true for all parts of the terrain.

Reimplemented from ParaEngine::IAttributeFields.

§ SetOffset()

void Terrain::SetOffset ( float  x,
float  y 
)

Set this Terrain object's origin.

This is used by the TerrainLattice class when a grid of Terrains is being managed, but can also be used as a simple way to apply translation to a Terrain.

§ SetTexture()

bool Terrain::SetTexture ( const uint8 *  pTextureImage,
int  width,
int  height 
)

Applies the specified graphics image as a texture to the terrain.

This is done by breaking the specified image up into smaller textures of 256x256 called TextureCells and mapping these contiguously onto the terrain's surface. Textures are automatically applied by TextureLoaders and by the byte array constructors, so use of this method is entirely optional.

Parameters
pTextureImageAn array of byte values representing the texture image that will be draped across the entire surface of the Terrain (this is the "overall" texture.) The array must contain 3 bytes per pixel - the red, green, and blue color values of the pixel respectively. It is assumed that the array does not contain any extra padding per image row. Therefore, if your image is 1024x1024 pixels, then this array should be 9,437,184 bytes in size. You can pass NULL for this parameter to build a Terrain with no texture.
widthThe width of the texture image in pixels.
heightThe height of the texture image in pixels.

§ SetTextureCell()

void Terrain::SetTextureCell ( int  index,
TextureCell pCell 
)

Installs a new TextureCell at the specified position within this Terrain's grid of TextureCells.

Parameters
indexThe index of the TextureCell within this Terrain's grid of TextureCells.
pCellThe new TextureCell to install, presumably one that was created by your application.

§ SetTextureFactory()

void Terrain::SetTextureFactory ( TextureFactory pFactory)

Installs an application-provided TextureFactory, disabling the default one supplied by Demeter.

This allows applications to manage textures for themselves.

Parameters
pFactoryA pointer to your TextureFactory object that will serve textures to this instance of Terrain.

§ SetTextureSet()

void Terrain::SetTextureSet ( TextureSet pTextureSet)

Sets the TextureSet that represents this Terrain object's pool of shared Textures.

replacing the default one that was created automatically.

Parameters
pTextureSetThe new TextureSet, presumably one that was created by your application.

§ SetVertexElevation() [1/2]

void Terrain::SetVertexElevation ( int  index,
float  newElevation,
bool  recalculate_geometry = true 
)

Sets the elevation (z-coordinate) in real units of the specified vertex on the terrain.

Parameters
indexThe index of the vertex in the Terrain's mesh to set the elevation of.
newElevationThe new z-value (elevation) of the vertex to be set.
recalculate_geometrySpecified whether or not terrain block bounding boxes should be updated as a result of this vertex changed. You would pass false here only when you are sequentially setting many vertices, in which case you would pass true only on the last vertex changed (this prevents redundant recalculation for each vertex changed.)

§ SetVertexElevation() [2/2]

void Terrain::SetVertexElevation ( float  x,
float  y,
float  newElevation 
)

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 local units.
yThe y location of the point on the Terrain's surface in local units.
newElevationThe new z-value (elevation) of the vertex to be set.

§ Tessellate()

int Terrain::Tessellate ( )

Breaks the Terrain down into triangles strips.

Based on the current viewing parameters, this method breaks the terrain down into a visually optimum set of triangles that can be rendered. Normally, an application will never call this method directly, but will instead call the method ModelViewMatrixChanged() to allow Demeter to take care of this automatically.

set the render offset for this terrain.

§ TessellateGeoMipmap()

void Terrain::TessellateGeoMipmap ( )

set the render offset for this terrain.

§ unref()

void ParaTerrain::Terrain::unref ( ) const
inline

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted. This method is provided for use of Demeter with the Open Scene Graph.

§ Write()

void ParaTerrain::Terrain::Write ( char *  szFilename)

Writes a binary "surface" file for fine-grained detail textures.

Deprecated:
This file format has been replaced by the Demeter Texture Editor XML format.
Parameters
szFilenameA filename to write to. The media path will be prepended to this file. See Settings::SetMediaPath().

§ WriteRawElevations()

void ParaTerrain::Terrain::WriteRawElevations ( const char *  szFilename)

Write all of this Terrain's vertices to a raw binary file.

Parameters
szFilenameA filename to write to. The media path will be prepended to this file. See Settings::SetMediaPath().

§ WriteRawTextures()

void ParaTerrain::Terrain::WriteRawTextures ( const char *  szTerrainName)

Write all of this Terrain's textures to raw binary files.

Parameters
szTerrainNameA filename to write to. The media path will be prepended to this file. See Settings::SetMediaPath().

Member Data Documentation

§ s_HighResTexCords

Vector2 * Terrain::s_HighResTexCords = NULL
static

array of high resolution texture coordinates.

array size is m_WidthVertices*m_WidthVertices

§ s_LowResTexCords

Vector2 * Terrain::s_LowResTexCords = NULL
static

array of low resolution texture coordinates.

array size is m_WidthVertices*m_WidthVertices


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