4 #include "IAttributeFields.h" 5 #include "IObjectScriptingInterface.h" 20 class CDynamicTerrainLoader;
62 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsModified_s,
bool*) {*p1 = cls->IsModified();
return S_OK;}
64 ATTRIBUTE_METHOD1(
CGlobalTerrain, TerrainRenderingEnabled_s,
bool*) {*p1 = cls->TerrainRenderingEnabled();
return S_OK;}
65 ATTRIBUTE_METHOD1(
CGlobalTerrain, EnableTerrainRendering_s,
bool) {cls->EnableTerrainRendering(p1);
return S_OK;}
67 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsTerrainEngineEnabled_s,
bool*) { *p1 = cls->IsTerrainEngineEnabled();
return S_OK; }
68 ATTRIBUTE_METHOD1(
CGlobalTerrain, EnableTerrainEngine_s,
bool) { cls->EnableTerrainEngine(p1);
return S_OK; }
70 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsVerbose_s,
bool*) {*p1 = cls->IsVerbose();
return S_OK;}
71 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetVerbose_s,
bool) {cls->SetVerbose(p1);
return S_OK;}
73 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsEditor_s,
bool*) {*p1 = cls->IsEditor();
return S_OK;}
74 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetEditor_s,
bool) {cls->SetEditor(p1);
return S_OK;}
76 ATTRIBUTE_METHOD1(
CGlobalTerrain, GetTessellateMethod_s,
int*) {*p1 = cls->GetTessellateMethod();
return S_OK;}
77 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetTessellateMethod_s,
int) {cls->SetTessellateMethod(p1);
return S_OK;}
79 ATTRIBUTE_METHOD1(
CGlobalTerrain, UseNormals_s,
bool*) {*p1 = cls->UseNormals();
return S_OK;}
80 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetUseNormals_s,
bool) {cls->SetUseNormals(p1);
return S_OK;}
82 ATTRIBUTE_METHOD1(
CGlobalTerrain, GetTextureMaskWidth_s,
int*) {*p1 = cls->GetTextureMaskWidth();
return S_OK;}
83 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetTextureMaskWidth_s,
int) {cls->SetTextureMaskWidth(p1);
return S_OK;}
85 ATTRIBUTE_METHOD1(
CGlobalTerrain, GetDefaultHeight_s,
float*) { *p1 = cls->GetDefaultHeight();
return S_OK; }
86 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetDefaultHeight_s,
float) { cls->SetDefaultHeight(p1);
return S_OK; }
88 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsGeoMipmapTerrain_s,
bool*) {*p1 =cls->IsGeoMipmapTerrain();
return S_OK;}
89 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetGeoMipmapTerrain_s,
bool) {cls->SetGeoMipmapTerrain(p1);
return S_OK;}
91 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsEditorMode_s,
bool*) {*p1 =cls->IsEditorMode();
return S_OK;}
92 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetEditorMode_s,
bool) {cls->SetEditorMode(p1);
return S_OK;}
94 ATTRIBUTE_METHOD1(
CGlobalTerrain, IsSlopeCollision_s,
bool*) {*p1 =cls->IsSlopeCollision();
return S_OK;}
95 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetSlopeCollision_s,
bool) {cls->SetSlopeCollision(p1);
return S_OK;}
97 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetBlockSelectionTexture_s,
const char*) {cls->SetBlockSelectionTexture(p1);
return S_OK;}
98 ATTRIBUTE_METHOD1(
CGlobalTerrain, SetBlockDamageTexture_s,
const char*) {cls->SetBlockDamageTexture(p1);
return S_OK;}
110 void SetVerbose(
bool bEnable);
142 void RestoreDeviceObjects();
179 void Update(
bool bForceUpdate=
false);
227 float IntersectRay(
float startX,
float startY,
float startZ,
float dirX,
float dirY,
float dirZ,
float &intersectX,
float &intersectY,
float &intersectZ,
float fMaxDistance = 999999999.0f);
235 void GetNormal(
float x,
float y,
float &normalX,
float &normalY,
float &normalZ);
252 float fTerrainSize,
float fElevscale,
int bSwapvertical,
253 const char* sMainTextureFile,
const char* sCommonTextureFile,
254 int nMaxBlockSize,
float fDetailThreshold);
290 void Flatten (
float x,
float y,
float radius,
int flatten_op,
float elevation,
float factor);
302 void DigCircleFlat(
float x,
float y,
float radius,
float fFlatPercentage=0.7f,
float factor=0.5f);
318 void GaussianHill (
float x,
float y,
float radius,
float hscale,
float standard_deviation=0.1f,
float smooth_factor=0.5f);
326 void Spherical (
float x,
float y,
float radius,
float offset);
339 void RadialScale (
float x,
float y,
float scale_factor,
float min_dist,
float max_dist,
float smooth_factor=0.5f,
int frequency=1);
355 void Roughen_Smooth (
float x,
float y,
float radius,
bool roughen=
false,
bool big_grid=
false,
float factor=0.5f);
363 void Ramp(
float x1,
float y1,
float x2,
float y2,
float radius,
float borderpercentage=0.5f,
float factor=1.0f);
374 void AddHeightField(
float x,
float y,
const char* filename,
int nSmoothPixels=7);
395 void MergeHeightField(
float x,
float y,
const char* filename,
int mergeOperation=0,
float weight1=1.0,
float weight2=1.0,
int nSmoothPixels=7);
409 bool IsHole(
float x,
float y);
418 void SetHole(
float x,
float y,
bool bIsHold);
444 void SetContentModified(
float x,
float y,
bool bIsModified =
true, DWORD dwModifiedBits=16);
465 void EnableTerrainEngine(
bool val);
591 int GetTextureMaskWidth();
593 void SwitheTerrainLodStyle(
bool useGeoMipmap);
597 void SetDefaultHeight(
float val);
602 void ModelViewMatrixChanged();
605 float m_fDefaultHeight;
615 bool m_bRenderTerrain;
617 bool m_bEnableTerrainEngine;
623 bool m_bEnablePathEncoding;
627 bool m_enableSlopeCollision;
629 bool m_isSlopeMeshVisible;
630 bool m_isWaypointRegionVisible;
633 Vector3 m_vTerrainRenderOffset;
636 static const float g_fTerrainInvisibleHeight;
638 const Vector3& GetMatTerrainEye()
const;
639 const Vector3& GetTerrainRenderOffset()
const;
644 void SetGeoMipmapTerrain(
bool enable);
646 bool IsGeoMipmapTerrain()
648 return m_useGeoMipmap;
651 void SetEditorMode(
bool enable);
655 return m_isEditorMode;
658 void SetSlopeCollision(
bool enable)
660 m_enableSlopeCollision = enable;
663 bool IsSlopeCollision()
665 return m_enableSlopeCollision;
668 void SetSlopeMeshVisible(
bool);
670 bool IsSlopeMeshVisible()
672 return m_isSlopeMeshVisible;
675 void SetWaypointRegionVisible(
bool enable);
677 bool IsWaypointRegionVisible()
679 return m_isWaypointRegionVisible;
682 void PaintTerrainData(
float x,
float y,
float radius,
unsigned int data,
unsigned int dataMask,
unsigned int bitOffset);
684 uint32 GetTerrainData(
float x,
float y,uint32 dataMask,uint8 bitOffset);
686 void SetVisibleDataMask(uint32 mask,uint8 bitOffset);
688 bool IsWalkable(
float x,
float y,
Vector3& oNormal)
const;
Definition: DynamicTerrainLoader.h:10
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
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.
Definition: GlobalTerrain.cpp:794
void SetVertexElevation(float x, float y, float fHeight)
Set elevation at the nearest vertex to the specified point.
Definition: GlobalTerrain.cpp:558
bool SetHeightmapOf(float fCenterX, float fCenterY, float fSize, TTerrain *pIn)
set the height map of a given square region in the global terrain.
Definition: GlobalTerrain.cpp:1066
bool ReplaceTexture(float x, float y, int nIndex, TextureEntity *TextureAsset)
replace the texture at the given index.
Definition: GlobalTerrain.cpp:395
Definition: SceneObject.h:15
void SetContentModified(float x, float y, bool bIsModified=true, DWORD dwModifiedBits=16)
set the content of the terrain modified.
Definition: GlobalTerrain.cpp:981
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: GlobalTerrain.cpp:1215
temp height field terrain data used by terrain filters.
Definition: TTerrain.h:16
Terrain * GetTerrainAtPoint(float x, float y)
get the terrain at point no matter it is single or latticed.
Definition: GlobalTerrain.cpp:297
void SetTessellateMethod(int method)
This setting determines which algorithm Demeter uses to simplify terrain blocks.
Definition: GlobalTerrain.cpp:1134
DWORD GetRegionValue(const string &sLayerName, float x, float y)
get value of a given terrain region layer
Definition: GlobalTerrain.cpp:526
int GetMaxTileCacheSize()
set how many terrain tile(including height fields, etc) are cached in memory.
Definition: GlobalTerrain.cpp:1086
void SetBlockSelectionTexture(const char *textureName)
used to render selection texture.
Definition: GlobalTerrain.cpp:1311
void SetCameraPosition(float x, float y)
Set the camera position, so that terrain tiles around it are automatically loaded.
Definition: GlobalTerrain.cpp:152
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: GlobalTerrain.h:46
different physics engine has different winding order.
Definition: EventBinding.h:32
void SetTextureMaskWidth(int nWidth)
get the default texture mask file resolution.
Definition: GlobalTerrain.cpp:1169
void SetHole(float x, float y, bool bIsHold)
set a new terrain hole at the specified location.
Definition: GlobalTerrain.cpp:208
bool IsEditor()
brief Indicates whether or not SetEditor(true) has been called.
Definition: GlobalTerrain.cpp:1129
string GetTerrainElevFile(float x, float y)
get the height map file name for the terrain tile that contains the point (x,y)
Definition: GlobalTerrain.cpp:436
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 ...
Definition: GlobalTerrain.cpp:750
void InvalidateDeviceObjects()
must call this function when device is invalid.
Definition: GlobalTerrain.cpp:665
IAttributeFields * GetAttributeObjectAt(float x, float y)
get the attribute object associated with the terrain tile that contains the given point...
Definition: GlobalTerrain.cpp:1022
virtual int GetChildAttributeColumnCount()
we support multi-dimensional child object.
Definition: GlobalTerrain.cpp:1356
float IntersectRay(float startX, float startY, float startZ, float dirX, float dirY, float dirZ, float &intersectX, float &intersectY, float &intersectZ, float fMaxDistance=999999999.0f)
This method makes use of the terrain's quad tree to optimize the ray-tracing.
Definition: GlobalTerrain.cpp:588
this is the interface class for managing global terrain used in ParaEngine.
Definition: GlobalTerrain.h:36
bool UseNormals()
Indicates whether or not normals are on as set by calling SetUseNormals().
Definition: GlobalTerrain.cpp:1164
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: GlobalTerrain.h:50
float GetVertexElevation(float x, float y)
Returns the height of the vertex closest to the specified point.
Definition: GlobalTerrain.cpp:573
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).
Definition: GlobalTerrain.cpp:884
float GetDefaultHeight() const
the default terrain height, normally it is 0
Definition: GlobalTerrain.cpp:1144
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
void EnableLighting(bool bEnable)
Enable both global and local lighting.
Definition: GlobalTerrain.cpp:1017
bool GetEnablePathEncoding()
get whether we will encode terrain related files.
Definition: GlobalTerrain.h:584
void GetTexturesInCell(float x, float y, std::vector< int > &indices)
get all texture indices in the cell specified by point(x,y) GetTextureCount() returns all textures us...
Definition: GlobalTerrain.cpp:311
int GetTessellateMethod()
Gets the current tessellation heuristic method.
Definition: GlobalTerrain.cpp:1139
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.
Definition: GlobalTerrain.cpp:243
bool IsHole(float x, float y)
Whether the terrain contains a hole at the specified location.
Definition: GlobalTerrain.cpp:191
void SetEnablePathEncoding(bool bEnable)
set whether we will encode terrain related files.
Definition: GlobalTerrain.h:578
float GetElevation(float x, float y)
Automatically rebuild the terrain buffer and the render the terrain.
Definition: GlobalTerrain.cpp:541
void SetBlockDamageTexture(const char *textureName)
used to render damaged texture.
Definition: GlobalTerrain.cpp:1304
void SetMaxTileCacheSize(int nNum)
Get how many terrain tile(including height fields, etc) are cached in memory.
Definition: GlobalTerrain.cpp:1102
bool TerrainRenderingEnabled()
true if terrain is rendered.
Definition: GlobalTerrain.cpp:118
TextureEntity * GetTexture(float x, float y, int nIndex)
get the terrain detailed texture by index.
Definition: GlobalTerrain.cpp:363
void Render()
Render last scene assuming that the camera has not moved.
Definition: GlobalTerrain.cpp:502
int GetTextureCount(float x, float y)
get the total number of textures in the texture set of the terrain tile specified by a world position...
Definition: GlobalTerrain.cpp:350
Settings * GetSettings()
get the settings object to set and get terrain global parameters.
Definition: GlobalTerrain.cpp:55
void Cleanup()
clean up the global terrain
Definition: GlobalTerrain.cpp:49
void GetNormal(float x, float y, float &normalX, float &normalY, float &normalZ)
Returns the surface normal of the terrain at the specified point.
Definition: GlobalTerrain.cpp:685
void InitDeviceObjects()
this function currently does nothing
Definition: GlobalTerrain.cpp:632
void AddHeightField(float x, float y, const char *filename, int nSmoothPixels=7)
Add rectangular height field from file to the current terrain.
Definition: GlobalTerrain.cpp:907
float GetVertexSpacing() const
Returns the number of real units between vertices in the terrain's mesh.
Definition: GlobalTerrain.cpp:279
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
void Spherical(float x, float y, float radius, float offset)
offset in a spherical region
Definition: GlobalTerrain.cpp:772
bool GetHeightmapOf(float fCenterX, float fCenterY, float fSize, TTerrain *pOut)
get the height map of a given square region in the global terrain.
Definition: GlobalTerrain.cpp:1043
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: GlobalTerrain.cpp:1351
void Update(bool bForceUpdate=false)
should be called when the camera moves to re-tessellate the terrain and rebuild the terrain buffer...
Definition: GlobalTerrain.cpp:477
bool IsVerbose()
Specifies whether or not Demeter should output diagnostic information at runtime. ...
Definition: GlobalTerrain.cpp:1114
void Paint(ParaEngine::TextureEntity *detailTexture, float brushRadius, float brushIntensity, float maxIntensity, bool erase, float x, float y)
paint on the specified location of the global terrain.
Definition: GlobalTerrain.cpp:703
void SaveTerrain(bool bHeightMap, bool bTextures)
save modified terrain to disk.
Definition: GlobalTerrain.cpp:937
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: GlobalTerrain.h:48
The Settings class is simply a manager of global variables. It provides a single place to set and ret...
Definition: Settings.h:10
float GetLowestVisibleHeight()
Get the height of the lowest visible terrain point.
Definition: GlobalTerrain.cpp:734
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
void SetEditor(bool isEditor)
This makes memory usage much higher but makes dynamically editing the terrain easier for applications...
Definition: GlobalTerrain.cpp:1124
void EnableTerrainRendering(bool bEnable)
specify whether to whether terrain.
Definition: GlobalTerrain.cpp:123
bool RemoveTextureInCell(float x, float y, int nIndex)
remove the given texture in the cell specified by the point(x,y).
Definition: GlobalTerrain.cpp:328
bool IsModified()
return true, if the terrain is modified and should be saved.
Definition: GlobalTerrain.cpp:960
void SetUseNormals(bool bUseNormals)
Turning this option on will make Demeter use more memory and will slow rendering slightly on most har...
Definition: GlobalTerrain.cpp:1154
virtual IAttributeFields * GetChildAttributeObject(const std::string &sName)
get attribute by child object.
Definition: GlobalTerrain.cpp:1328
Definition: IObjectScriptingInterface.h:6
void UpdateHoles(float x, float y)
Update all holes in the terrain tile that contains the input point.
Definition: GlobalTerrain.cpp:175
void DeleteDeviceObjects()
must call this function when device is lost.
Definition: GlobalTerrain.cpp:652
This class represents a single, contiguous chunk of terrain and is the primary public interface to De...
Definition: Terrain.h:386
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.
Definition: GlobalTerrain.cpp:861
bool IsTerrainEngineEnabled() const
enable/disable global real world terrain engine.
Definition: GlobalTerrain.cpp:108
void GetBoundingBox(ParaEngine::CShapeBox *BBox)
Get the bounding box from the last tessellation result.
Definition: GlobalTerrain.cpp:224
string GetOnloadScript(float x, float y)
get the on load script which created all objects on this terrain tile which contains the point x...
Definition: GlobalTerrain.cpp:456
Manages a network of Terrain objects arranged in a grid pattern to model extremely large worlds that ...
Definition: TerrainLattice.h:57
void SetAllLoadedModified(bool bIsModified=true, DWORD dwModifiedBits=16)
set all loaded terrain tile content modified.
Definition: GlobalTerrain.cpp:1001
a general view frustum class.
Definition: ShapeFrustum.h:9
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].
Definition: GlobalTerrain.cpp:836
void CreateSingleTerrain(const char *sHeightmapfile, float fTerrainSize, float fElevscale, int bSwapvertical, const char *sMainTextureFile, const char *sCommonTextureFile, int nMaxBlockSize, float fDetailThreshold)
Create and set the single tile based global terrain from height map and texture files.
Definition: GlobalTerrain.cpp:127
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.
Definition: GlobalTerrain.cpp:922
void SnapPointToVertexGrid(float x, float y, float *vertex_x, float *vertex_y)
snap any 2D point on the height map to a vertex position on the height map.
Definition: GlobalTerrain.cpp:262
a min max box.
Definition: ShapeAABB.h:190
void CreateTerrain(const char *sConfigFileName)
create a terrain from a configuration file.
Definition: GlobalTerrain.cpp:59