Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
HeightMapRenderObjClass Class Reference

Custom render object that draws the heightmap and handles intersection tests. More...

#include <HeightMap.h>

Inherits BaseHeightMapRenderObjClass.

Inherited by WBHeightMap.

Public Member Functions

 HeightMapRenderObjClass (void)
 
virtual ~HeightMapRenderObjClass (void)
 
virtual void ReleaseResources (void)
 Release all dx8 resources so the device can be reset.
 
virtual void ReAcquireResources (void)
 Reacquire all resources after device reset.
 
virtual void Render (RenderInfoClass &rinfo)
 
virtual void On_Frame_Update (void)
 
virtual int initHeightData (Int width, Int height, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator, Bool updateExtraPassTiles=TRUE)
 allocate resources needed to render heightmap
 
virtual Int freeMapResources (void)
 free resources used to render heightmap
 
virtual void updateCenter (CameraClass *camera, RefRenderObjListIterator *pLightsIterator)
 
void renderExtraBlendTiles (void)
 render 3-way blend tiles that have blend of 3 textures.
 
virtual void staticLightingChanged (void)
 
virtual void adjustTerrainLOD (Int adj)
 
virtual void reset (void)
 
virtual void doPartialUpdate (const IRegion2D &partialRange, WorldHeightMap *htMap, RefRenderObjListIterator *pLightsIterator)
 
virtual void oversizeTerrain (Int tilesToOversize)
 
virtual int updateBlock (Int x0, Int y0, Int x1, Int y1, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator)
 
- Public Member Functions inherited from BaseHeightMapRenderObjClass
 BaseHeightMapRenderObjClass (void)
 
virtual ~BaseHeightMapRenderObjClass (void)
 
virtual RenderObjClassClone (void) const
 
virtual int Class_ID (void) const
 
virtual bool Cast_Ray (RayCollisionTestClass &raytest)
 
virtual void Get_Obj_Space_Bounding_Sphere (SphereClass &sphere) const
 
virtual void Get_Obj_Space_Bounding_Box (AABoxClass &aabox) const
 
virtual void Notify_Added (SceneClass *scene)
 
void redirectToHeightmap (WorldHeightMap *pMap)
 
UnsignedByte getClipHeight (Int x, Int y) const
 
void setTextureLOD (Int lod)
 Update the macro texture (pass 3).
 
void updateMacroTexture (AsciiString textureName)
 
void doTextures (Bool flag)
 
void doTheLight (VERTEX_FORMAT *vb, Vector3 *light, Vector3 *normal, RefRenderObjListIterator *pLightsIterator, UnsignedByte alpha)
 Update the diffuse value from static light info for one vertex.
 
void addScorch (Vector3 location, Real radius, Scorches type)
 
void addTree (DrawableID id, Coord3D location, Real scale, Real angle, Real randomScaleAmount, const W3DTreeDrawModuleData *data)
 
void removeAllTrees (void)
 
void removeTree (DrawableID id)
 
Bool updateTreePosition (DrawableID id, Coord3D location, Real angle)
 
void renderTrees (CameraClass *camera)
 renders the tree buffer.
 
void addProp (Int id, Coord3D location, Real angle, Real scale, const AsciiString &modelName)
 
void removeProp (Int id)
 
void removeAllProps (void)
 
void unitMoved (Object *unit)
 
void notifyShroudChanged (void)
 
void removeTreesAndPropsForConstruction (const Coord3D *pos, const GeometryInfo &geom, Real angle)
 
void addTerrainBib (Vector3 corners[4], ObjectID id, Bool highlight)
 Add a bib at location.
 
void addTerrainBibDrawable (Vector3 corners[4], DrawableID id, Bool highlight)
 
void removeTerrainBib (ObjectID id)
 Remove a bib.
 
void removeTerrainBibDrawable (DrawableID id)
 
void removeAllTerrainBibs (void)
 Removes all bibs.
 
void removeTerrainBibHighlighting (void)
 Remove all highlighting.
 
W3DShroudgetShroud ()
 
void updateShorelineTiles (Int minX, Int minY, Int maxX, Int maxY, WorldHeightMap *pMap)
 figure out which tiles on this map cross water plane
 
void updateShorelineTile (Int X, Int Y, Int Border, WorldHeightMap *pMap)
 figure out which tiles on this map cross water plane
 
void recordShoreLineSortInfos (void)
 
void updateViewImpassableAreas (Bool partial=FALSE, Int minX=0, Int maxX=0, Int minY=0, Int maxY=0)
 
void clearAllScorches (void)
 
void setTimeOfDay (TimeOfDay tod)
 
void loadRoadsAndBridges (W3DTerrainLogic *pTerrainLogic, Bool saveGame)
 Load the roads from the map objects.
 
void worldBuilderUpdateBridgeTowers (W3DAssetManager *assetManager, SimpleSceneClass *scene)
 for the editor updating of bridge tower visuals
 
Int getStaticDiffuse (Int x, Int y)
 Gets the diffuse terrain lighting value for a point on the mesh.
 
Int getNumShoreLineTiles (Bool visible)
 
void setShoreLineDetail (void)
 update shoreline tiles in case the feature was toggled by user.
 
Bool getMaximumVisibleBox (const FrustumClass &frustum, AABoxClass *box, Bool ignoreMaxHeight)
 3d extent of visible terrain.
 
Real getHeightMapHeight (Real x, Real y, Coord3D *normal) const
 return height and normal at given point
 
Bool isCliffCell (Real x, Real y)
 return height and normal at given point
 
Real getMinHeight (void) const
 return minimum height of entire terrain
 
Real getMaxHeight (void) const
 return maximum height of entire terrain
 
Real getMaxCellHeight (Real x, Real y) const
 returns maximum height of the 4 cell corners.
 
WorldHeightMapgetMap (void)
 returns object holding the heightmap samples - need this for fast access.
 
Bool isClearLineOfSight (const Coord3D &pos, const Coord3D &posOther) const
 
Bool getShowImpassableAreas (void)
 
void setShowImpassableAreas (Bool show)
 
Bool showAsVisibleCliff (Int xIndex, Int yIndex) const
 
Bool evaluateAsVisibleCliff (Int xIndex, Int yIndex, Real valuesGreaterThanRad)
 
Real getViewImpassableAreaSlope (void) const
 
void setViewImpassableAreaSlope (Real viewSlope)
 
Bool doesNeedFullUpdate (void)
 
- Public Member Functions inherited from RenderObjClass
 RenderObjClass (void)
 
 RenderObjClass (const RenderObjClass &src)
 
RenderObjClassoperator= (const RenderObjClass &)
 
virtual ~RenderObjClass (void)
 
virtual const char * Get_Name (void) const
 
virtual void Set_Name (const char *name)
 
virtual const char * Get_Base_Model_Name (void) const
 
virtual void Set_Base_Model_Name (const char *name)
 
virtual int Get_Num_Polys (void) const
 
virtual void Special_Render (SpecialRenderInfoClass &rinfo)
 
virtual void Restart (void)
 
virtual void Add (SceneClass *scene)
 
virtual void Remove (void)
 
virtual SceneClassGet_Scene (void)
 
virtual SceneClassPeek_Scene (void)
 
virtual void Set_Container (RenderObjClass *con)
 
virtual void Validate_Transform (void) const
 
RenderObjClassGet_Container (void) const
 
virtual void Set_Transform (const Matrix3D &m)
 
virtual void Set_Position (const Vector3 &v)
 
const Matrix3DGet_Transform (void) const
 
const Matrix3DGet_Transform (bool &is_transform_identity) const
 
const Matrix3DGet_Transform_No_Validity_Check (void) const
 
const Matrix3DGet_Transform_No_Validity_Check (bool &is_transform_identity) const
 
bool Is_Transform_Identity () const
 
bool Is_Transform_Identity_No_Validity_Check () const
 
Vector3 Get_Position (void) const
 
virtual void Notify_Removed (SceneClass *scene)
 
virtual int Get_Num_Sub_Objects (void) const
 
virtual RenderObjClassGet_Sub_Object (int index) const
 
virtual int Add_Sub_Object (RenderObjClass *subobj)
 
virtual int Remove_Sub_Object (RenderObjClass *robj)
 
virtual RenderObjClassGet_Sub_Object_By_Name (const char *name, int *index=NULL) const
 
virtual int Get_Num_Sub_Objects_On_Bone (int boneindex) const
 
virtual RenderObjClassGet_Sub_Object_On_Bone (int index, int boneindex) const
 
virtual int Get_Sub_Object_Bone_Index (RenderObjClass *subobj) const
 
virtual int Get_Sub_Object_Bone_Index (int LodIndex, int ModelIndex) const
 
virtual int Add_Sub_Object_To_Bone (RenderObjClass *subobj, int bone_index)
 
virtual int Add_Sub_Object_To_Bone (RenderObjClass *subobj, const char *bname)
 
virtual int Remove_Sub_Objects_From_Bone (int boneindex)
 
virtual int Remove_Sub_Objects_From_Bone (const char *bname)
 
virtual void Update_Sub_Object_Transforms (void)
 
virtual void Set_Animation (void)
 
virtual void Set_Animation (HAnimClass *motion, float frame, int anim_mode=ANIM_MODE_MANUAL)
 
virtual void Set_Animation (HAnimClass *motion0, float frame0, HAnimClass *motion1, float frame1, float percentage)
 
virtual void Set_Animation (HAnimComboClass *anim_combo)
 
virtual HAnimClassPeek_Animation (void)
 
virtual int Get_Num_Bones (void)
 
virtual const char * Get_Bone_Name (int bone_index)
 
virtual int Get_Bone_Index (const char *bonename)
 
virtual const Matrix3DGet_Bone_Transform (const char *bonename)
 
virtual const Matrix3DGet_Bone_Transform (int boneindex)
 
virtual void Capture_Bone (int bindex)
 
virtual void Release_Bone (int bindex)
 
virtual bool Is_Bone_Captured (int bindex) const
 
virtual void Control_Bone (int bindex, const Matrix3D &objtm, bool world_space_translation=false)
 
virtual const HTreeClassGet_HTree (void) const
 
virtual bool Cast_AABox (AABoxCollisionTestClass &boxtest)
 
virtual bool Cast_OBBox (OBBoxCollisionTestClass &boxtest)
 
virtual bool Intersect_AABox (AABoxIntersectionTestClass &boxtest)
 
virtual bool Intersect_OBBox (OBBoxIntersectionTestClass &boxtest)
 
virtual bool Intersect (IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
 
virtual bool Intersect_Sphere (IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
 
virtual bool Intersect_Sphere_Quick (IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
 
virtual const SphereClassGet_Bounding_Sphere (void) const
 
virtual const AABoxClassGet_Bounding_Box (void) const
 
virtual void Update_Obj_Space_Bounding_Volumes (void)
 
virtual void Prepare_LOD (CameraClass &camera)
 
virtual void Recalculate_Static_LOD_Factors (void)
 
virtual void Increment_LOD (void)
 
virtual void Decrement_LOD (void)
 
virtual float Get_Cost (void) const
 
virtual float Get_Value (void) const
 
virtual float Get_Post_Increment_Value (void) const
 
virtual void Set_LOD_Level (int lod)
 
virtual int Get_LOD_Level (void) const
 
virtual int Get_LOD_Count (void) const
 
virtual void Set_LOD_Bias (float bias)
 
virtual int Calculate_Cost_Value_Arrays (float screen_area, float *values, float *costs) const
 
virtual RenderObjClassGet_Current_LOD (void)
 
virtual bool Build_Dependency_List (DynamicVectorClass< StringClass > &file_list, bool recursive=true)
 
virtual bool Build_Texture_List (DynamicVectorClass< StringClass > &texture_file_list, bool recursive=true)
 
virtual void Create_Decal (DecalGeneratorClass *generator)
 
virtual void Delete_Decal (uint32 decal_id)
 
virtual MaterialInfoClassGet_Material_Info (void)
 
virtual void Set_User_Data (void *value, bool recursive=false)
 
virtual void * Get_User_Data ()
 
virtual int Get_Num_Snap_Points (void)
 
virtual void Get_Snap_Point (int index, Vector3 *set)
 
virtual float Get_Screen_Size (CameraClass &camera)
 
virtual void Scale (float scale)
 
virtual void Scale (float scalex, float scaley, float scalez)
 
virtual void Set_ObjectScale (float scale)
 
const float Get_ObjectScale (void) const
 
void Set_ObjectColor (unsigned int color)
 
const unsigned int Get_ObjectColor (void) const
 
virtual int Get_Sort_Level (void) const
 
virtual void Set_Sort_Level (int level)
 
virtual int Is_Really_Visible (void)
 
virtual int Is_Not_Hidden_At_All (void)
 
virtual int Is_Visible (void) const
 
virtual void Set_Visible (int onoff)
 
virtual int Is_Hidden (void) const
 
virtual void Set_Hidden (int onoff)
 
virtual int Is_Animation_Hidden (void) const
 
virtual void Set_Animation_Hidden (int onoff)
 
virtual int Is_Force_Visible (void) const
 
virtual void Set_Force_Visible (int onoff)
 
virtual int Is_Translucent (void) const
 
virtual void Set_Translucent (int onoff)
 
virtual int Is_Alpha (void) const
 
virtual void Set_Alpha (int onoff)
 
virtual int Is_Additive (void) const
 
virtual void Set_Additive (int onoff)
 
virtual int Get_Collision_Type (void) const
 
virtual void Set_Collision_Type (int type)
 
virtual bool Is_Complete (void)
 
virtual bool Is_In_Scene (void)
 
virtual float Get_Native_Screen_Size (void) const
 
virtual void Set_Native_Screen_Size (float screensize)
 
void Set_Sub_Objects_Match_LOD (int onoff)
 
int Is_Sub_Objects_Match_LOD_Enabled (void)
 
void Set_Sub_Object_Transforms_Dirty (bool onoff)
 
bool Are_Sub_Object_Transforms_Dirty (void)
 
void Set_Ignore_LOD_Cost (bool onoff)
 
bool Is_Ignoring_LOD_Cost (void)
 
void Set_Is_Self_Shadowed ()
 
void Unset_Is_Self_Shadowed ()
 
int Is_Self_Shadowed () const
 
virtual const PersistFactoryClassGet_Factory (void) const
 
virtual bool Save (ChunkSaveClass &csave)
 
virtual bool Load (ChunkLoadClass &cload)
 
RenderHookClassGet_Render_Hook (void)
 
void Set_Render_Hook (RenderHookClass *hook)
 
- Public Member Functions inherited from RefCountClass
 RefCountClass (void)
 
 RefCountClass (const RefCountClass &)
 
void Add_Ref (void) const
 
WWINLINE void Release_Ref (void) const
 
int Num_Refs (void) const
 
virtual void Delete_This (void)
 
- Public Member Functions inherited from PostLoadableClass
 PostLoadableClass (void)
 
virtual ~PostLoadableClass (void)
 
virtual void On_Post_Load (void)
 
bool Is_Post_Load_Registered (void)
 
void Set_Post_Load_Registered (bool onoff)
 
- Public Member Functions inherited from MultiListObjectClass
 MultiListObjectClass (void)
 
virtual ~MultiListObjectClass (void)
 
MultiListNodeClassGet_List_Node () const
 
void Set_List_Node (MultiListNodeClass *node)
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Protected Member Functions

UnsignedInt doTheDynamicLight (VERTEX_FORMAT *vb, VERTEX_FORMAT *vbMirror, Vector3 *light, Vector3 *normal, W3DDynamicLight *pLights[], Int numLights)
 
Int getXWithOrigin (Int x)
 
Int getYWithOrigin (Int x)
 
Int updateVBForLight (DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights)
 update vertex diffuse color for dynamic lights inside given rectangle
 
Int updateVBForLightOptimized (DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights)
 
Int updateVB (DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator)
 update vertex buffer vertices inside given rectangle
 
void initDestAlphaLUT (void)
 upate vertex buffers associated with the given rectangle
 
void renderTerrainPass (CameraClass *pCamera)
 renders additional terrain pass.
 
Int getNumExtraBlendTiles (Bool visible)
 
void freeIndexVertexBuffers (void)
 
- Protected Member Functions inherited from BaseHeightMapRenderObjClass
virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess (void)
 
void updateScorches (void)
 Update m_vertexScorch and m_indexScorch so all scorches will be drawn.
 
void allocateScorchBuffers (void)
 allocate static buffers for drawing scorch marks.
 
void freeScorchBuffers (void)
 frees up scorch buffers.
 
void drawScorches (void)
 Draws the scorch mark polygons in m_vertexScorch.
 
void initDestAlphaLUT (void)
 initialize water depth LUT stored in m_destAlphaTexture
 
void renderShoreLines (CameraClass *pCamera)
 re-render parts of terrain that need custom blending into water edge
 
void renderShoreLinesSorted (CameraClass *pCamera)
 optimized version for game usage.
 
- Protected Member Functions inherited from RenderObjClass
virtual void Add_Dependencies_To_List (DynamicVectorClass< StringClass > &file_list, bool textures_only=false)
 
virtual void Update_Cached_Bounding_Volumes (void) const
 
virtual void Update_Sub_Object_Bits (void)
 
bool Bounding_Volumes_Valid (void) const
 
void Invalidate_Cached_Bounding_Volumes (void) const
 
void Validate_Cached_Bounding_Volumes (void) const
 
- Protected Member Functions inherited from RefCountClass
virtual ~RefCountClass (void)
 

Protected Attributes

Intm_extraBlendTilePositions
 array holding x,y tile positions of all extra blend tiles. (used for 3 textures per tile).
 
Int m_numExtraBlendTiles
 number of blend tiles in m_extraBlendTilePositions.
 
Int m_numVisibleExtraBlendTiles
 number rendered last frame.
 
Int m_extraBlendTilePositionsSize
 
DX8VertexBufferClass ** m_vertexBufferTiles
 collection of smaller vertex buffers that make up 1 heightmap
 
char ** m_vertexBufferBackup
 In memory copy of the vertex buffer data for quick update of dynamic lighting.
 
Int m_originX
 Origin point in the grid. Slides around.
 
Int m_originY
 Origin point in the grid. Slides around.
 
DX8IndexBufferClassm_indexBuffer
 indices defining triangles in a VB tile.
 
Int m_numVBTilesX
 dimensions of array containing all the vertex buffers
 
Int m_numVBTilesY
 dimensions of array containing all the vertex buffers
 
Int m_numVertexBufferTiles
 number of vertex buffers needed to store this heightmap
 
Int m_numBlockColumnsInLastVB
 a VB tile may be partially filled, this indicates how many 2x2 vertex blocks are filled.
 
Int m_numBlockRowsInLastVB
 a VB tile may be partially filled, this indicates how many 2x2 vertex blocks are filled.
 
- Protected Attributes inherited from BaseHeightMapRenderObjClass
Int m_x
 dimensions of heightmap
 
Int m_y
 dimensions of heightmap
 
DX8VertexBufferClassm_vertexScorch
 Scorch vertex buffer.
 
DX8IndexBufferClassm_indexScorch
 indices defining a triangles for the scorch drawing.
 
TextureClassm_scorchTexture
 Scorch mark texture.
 
Int m_curNumScorchVertices
 number of vertices used in m_vertexScorch.
 
Int m_curNumScorchIndices
 number of indices used in m_indexScorch.
 
TScorch m_scorches [MAX_SCORCH_MARKS]
 
Int m_numScorches
 
Int m_scorchesInBuffer
 how many are in the buffers. If less than numScorches, we need to update
 
Real m_curImpassableSlope
 
WorldHeightMapm_map
 
Bool m_useDepthFade
 fade terrain lighting under water
 
Bool m_updating
 
Vector3 m_depthFade
 depth based fall off values for r,g,b
 
Bool m_disableTextures
 
Bool m_needFullUpdate
 True if lighting changed, and we need to update all instead of what moved.
 
Bool m_doXNextTime
 True if we updated y scroll, and need to do x scroll next frame.
 
Real m_minHeight
 minimum value of height samples in heightmap
 
Real m_maxHeight
 maximum value of height samples in heightmap
 
Bool m_showImpassableAreas
 If true, shade impassable areas.
 
std::vector< boolm_showAsVisibleCliff
 
ShaderClass m_shaderClass
 shader or rendering state for heightmap
 
VertexMaterialClassm_vertexMaterialClass
 vertex shader (lighting) for terrain
 
TextureClassm_stageZeroTexture
 primary texture
 
TextureClassm_stageOneTexture
 transparent edging texture
 
CloudMapTerrainTextureClassm_stageTwoTexture
 Cloud map texture.
 
TextureClassm_stageThreeTexture
 light/noise map texture
 
AsciiString m_macroTextureName
 Name for stage 3 texture.
 
TextureClassm_destAlphaTexture
 Texture holding destination alpha LUT for water depth.
 
W3DTreeBufferm_treeBuffer
 Class for drawing trees and other alpha objects.
 
W3DPropBufferm_propBuffer
 Class for drawing trees and other alpha objects.
 
W3DBibBufferm_bibBuffer
 Class for drawing trees and other alpha objects.
 
W3DWaypointBufferm_waypointBuffer
 Draws waypoints.
 
W3DRoadBufferm_roadBuffer
 Class for drawing roads.
 
W3DBridgeBufferm_bridgeBuffer
 
W3DShroudm_shroud
 Class for drawing the shroud over terrain.
 
shoreLineTileInfom_shoreLineTilePositions
 array holding x,y tile positions of all shoreline terrain.
 
Int m_numShoreLineTiles
 number of tiles in m_shoreLineTilePositions.
 
Int m_numVisibleShoreLineTiles
 number of visible tiles.
 
Int m_shoreLineTilePositionsSize
 total size of array including unused memory.
 
Real m_currentMinWaterOpacity
 current value inside the gradient lookup texture.
 
shoreLineTileSortInfom_shoreLineSortInfos
 
Int m_shoreLineSortInfosSize
 
Int m_shoreLineSortInfosXMajor
 
Int m_shoreLineTileSortMaxCoordinate
 keep track of coordinate range along axis used for m_shoreLineSortInfos
 
Int m_shoreLineTileSortMinCoordinate
 
- Protected Attributes inherited from RenderObjClass
unsigned long Bits
 
Matrix3D Transform
 
float ObjectScale
 
unsigned int ObjectColor
 
SphereClass CachedBoundingSphere
 
AABoxClass CachedBoundingBox
 
float NativeScreenSize
 
bool IsTransformIdentity
 
SceneClassScene
 
RenderObjClassContainer
 
void * User_Data
 
RenderHookClassRenderHook
 

Additional Inherited Members

- Public Types inherited from RenderObjClass
enum  { USER_DATA_MATERIAL_OVERRIDE = 0x01234567 }
 
enum  {
  CLASSID_UNKNOWN = 0xFFFFFFFF , CLASSID_MESH = 0 , CLASSID_HMODEL , CLASSID_DISTLOD ,
  CLASSID_PREDLODGROUP , CLASSID_TILEMAP , CLASSID_IMAGE3D , CLASSID_LINE3D ,
  CLASSID_BITMAP2D , CLASSID_CAMERA , CLASSID_DYNAMESH , CLASSID_DYNASCREENMESH ,
  CLASSID_TEXTDRAW , CLASSID_FOG , CLASSID_LAYERFOG , CLASSID_LIGHT ,
  CLASSID_PARTICLEEMITTER , CLASSID_PARTICLEBUFFER , CLASSID_SCREENPOINTGROUP , CLASSID_VIEWPOINTGROUP ,
  CLASSID_WORLDPOINTGROUP , CLASSID_TEXT2D , CLASSID_TEXT3D , CLASSID_NULL ,
  CLASSID_COLLECTION , CLASSID_FLARE , CLASSID_HLOD , CLASSID_AABOX ,
  CLASSID_OBBOX , CLASSID_SEGLINE , CLASSID_SPHERE , CLASSID_RING ,
  CLASSID_BOUNDFOG , CLASSID_DAZZLE , CLASSID_SOUND , CLASSID_SEGLINETRAIL ,
  CLASSID_LAND , CLASSID_SHDMESH , CLASSID_LAST = 0x0000FFFF
}
 
enum  AnimMode {
  ANIM_MODE_MANUAL = 0 , ANIM_MODE_LOOP , ANIM_MODE_ONCE , ANIM_MODE_LOOP_PINGPONG ,
  ANIM_MODE_LOOP_BACKWARDS , ANIM_MODE_ONCE_BACKWARDS
}
 
- Static Public Member Functions inherited from RefCountClass
static int Total_Refs (void)
 
static RefCountClassAdd_Active_Ref (RefCountClass *obj)
 
static RefCountClassSet_Ref_Owner (RefCountClass *obj, char *file, int line)
 
static void Remove_Active_Ref (RefCountClass *obj)
 
static bool Validate_Active_Ref (RefCountClass *obj)
 
- Public Attributes inherited from RefCountClass
RefCountNodeClass ActiveRefNode
 
ActiveRefStruct ActiveRefInfo
 
- Static Public Attributes inherited from RenderObjClass
static const float AT_MIN_LOD = FLT_MAX
 
static const float AT_MAX_LOD = -1.0f
 
- Static Public Attributes inherited from RefCountClass
static RefCountListClass ActiveRefList
 
- Protected Types inherited from BaseHeightMapRenderObjClass
enum  {
  MAX_SCORCH_VERTEX =8194 , MAX_SCORCH_INDEX =6*8194 , MAX_SCORCH_MARKS =500 , SCORCH_MARKS_IN_TEXTURE =9 ,
  SCORCH_PER_ROW = 3
}
 
- Protected Types inherited from RenderObjClass
enum  {
  COLL_TYPE_MASK = 0x000000FF , IS_VISIBLE = 0x00000100 , IS_NOT_HIDDEN = 0x00000200 , IS_NOT_ANIMATION_HIDDEN = 0x00000400 ,
  IS_FORCE_VISIBLE = 0x00000800 , BOUNDING_VOLUMES_VALID = 0x00002000 , IS_TRANSLUCENT = 0x00004000 , IGNORE_LOD_COST = 0x00008000 ,
  SUBOBJS_MATCH_LOD = 0x00010000 , SUBOBJ_TRANSFORMS_DIRTY = 0x00020000 , IS_ALPHA = 0x00040000 , IS_ADDITIVE = 0x00100000 ,
  IS_SELF_SHADOWED = 0x00080000 , IS_CHEATER = 0x00100000 , IS_REALLY_VISIBLE = IS_VISIBLE | IS_NOT_HIDDEN | IS_NOT_ANIMATION_HIDDEN , IS_NOT_HIDDEN_AT_ALL = IS_NOT_HIDDEN | IS_NOT_ANIMATION_HIDDEN ,
  DEFAULT_BITS = COLL_TYPE_ALL | IS_NOT_HIDDEN | IS_NOT_ANIMATION_HIDDEN
}
 

Detailed Description

Custom render object that draws the heightmap and handles intersection tests.

Custom W3D render object that's used to process the terrain. It handles virtually everything to do with the terrain, including: drawing, lighting, scorchmarks and intersection tests.

Definition at line 60 of file HeightMap.h.

Constructor & Destructor Documentation

◆ HeightMapRenderObjClass()

HeightMapRenderObjClass::HeightMapRenderObjClass ( void )

Constructor. Mostly nulls out the member variables.

Definition at line 1093 of file HeightMap.cpp.

◆ ~HeightMapRenderObjClass()

HeightMapRenderObjClass::~HeightMapRenderObjClass ( void )
virtual

Destructor. Releases w3d assets.

Definition at line 1079 of file HeightMap.cpp.

Member Function Documentation

◆ adjustTerrainLOD()

void HeightMapRenderObjClass::adjustTerrainLOD ( Int adj)
virtual

Adjust the terrain Level Of Detail. If adj > 0 , increases LOD 1 step, if adj < 0 decreases it one step, if adj==0, then just sets up for the current LOD

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1119 of file HeightMap.cpp.

◆ doPartialUpdate()

void HeightMapRenderObjClass::doPartialUpdate ( const IRegion2D & partialRange,
WorldHeightMap * htMap,
RefRenderObjListIterator * pLightsIterator )
virtual

Updates a partial block of vertices from [x0,y0 to x1,y1] The coordinates in partialRange are map cell coordinates, relative to the entire map. The vertex coordinates and texture coordinates, as well as static lighting are updated.

Implements BaseHeightMapRenderObjClass.

Definition at line 926 of file HeightMap.cpp.

◆ doTheDynamicLight()

UnsignedInt HeightMapRenderObjClass::doTheDynamicLight ( VERTEX_FORMAT * vb,
VERTEX_FORMAT * vbMirror,
Vector3 * light,
Vector3 * normal,
W3DDynamicLight * pLights[],
Int numLights )
protected

Calculates the diffuse lighting as affected by dynamic lighting.

Definition at line 175 of file HeightMap.cpp.

◆ freeIndexVertexBuffers()

void HeightMapRenderObjClass::freeIndexVertexBuffers ( void )
protected

Frees the w3d resources used to draw the terrain.

Definition at line 137 of file HeightMap.cpp.

◆ freeMapResources()

Int HeightMapRenderObjClass::freeMapResources ( void )
virtual

free resources used to render heightmap

Frees the w3d resources used to draw the terrain.

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 161 of file HeightMap.cpp.

◆ getNumExtraBlendTiles()

Int HeightMapRenderObjClass::getNumExtraBlendTiles ( Bool visible)
inlineprotectedvirtual

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 124 of file HeightMap.h.

◆ getXWithOrigin()

Int HeightMapRenderObjClass::getXWithOrigin ( Int x)
protected

Gets the x index that corresponds to the data. For example, if the columns are shifted by 3, index 3 is actually the first row of polygons, or 0. Yes it is confusing, but it makes sliding the map 10x faster.

Definition at line 270 of file HeightMap.cpp.

◆ getYWithOrigin()

Int HeightMapRenderObjClass::getYWithOrigin ( Int y)
protected

Gets the y index that corresponds to the data. For example, if the rows are shifted by 3, index 3 is actually the first row of polygons, or 0. Yes it is confusing, but it makes sliding the map 10x faster.

Definition at line 291 of file HeightMap.cpp.

◆ initDestAlphaLUT()

void HeightMapRenderObjClass::initDestAlphaLUT ( void )
protected

upate vertex buffers associated with the given rectangle

initialize water depth LUT stored in m_destAlphaTexture

◆ initHeightData()

Int HeightMapRenderObjClass::initHeightData ( Int x,
Int y,
WorldHeightMap * pMap,
RefRenderObjListIterator * pLightsIterator,
Bool updateExtraPassTiles = TRUE )
virtual

allocate resources needed to render heightmap

Allocate a heightmap of x by y vertices and fill with initial height values. Also allocates all rendering resources such as vertex buffers, index buffers, shaders, and materials.

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1267 of file HeightMap.cpp.

◆ On_Frame_Update()

void HeightMapRenderObjClass::On_Frame_Update ( void )
virtual

Updates the diffuse color values in the vertices as affected by the dynamic lights.

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1403 of file HeightMap.cpp.

◆ oversizeTerrain()

void HeightMapRenderObjClass::oversizeTerrain ( Int tilesToOversize)
virtual

Sets the terrain oversize amount.

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1223 of file HeightMap.cpp.

◆ ReAcquireResources()

void HeightMapRenderObjClass::ReAcquireResources ( void )
virtual

Reacquire all resources after device reset.

Reallocates all W3D assets after a reset..

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1203 of file HeightMap.cpp.

◆ ReleaseResources()

void HeightMapRenderObjClass::ReleaseResources ( void )
virtual

Release all dx8 resources so the device can be reset.

Releases all w3d assets, to prepare for Reset device call.

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1193 of file HeightMap.cpp.

◆ Render()

void HeightMapRenderObjClass::Render ( RenderInfoClass & rinfo)
virtual

Renders (draws) the terrain.

Implements BaseHeightMapRenderObjClass.

Reimplemented in WBHeightMap.

Definition at line 1915 of file HeightMap.cpp.

◆ renderExtraBlendTiles()

void HeightMapRenderObjClass::renderExtraBlendTiles ( void )

render 3-way blend tiles that have blend of 3 textures.

Renders an additoinal terrain pass including only those tiles which have more than 2 textures blended together. Used primarily for corner cases where 3 different textures meet.

Definition at line 2248 of file HeightMap.cpp.

◆ renderTerrainPass()

void HeightMapRenderObjClass::renderTerrainPass ( CameraClass * pCamera)
protected

renders additional terrain pass.

Performs additional terrain rendering pass, blending in the black shroud texture.

Definition at line 2200 of file HeightMap.cpp.

◆ reset()

void HeightMapRenderObjClass::reset ( void )
virtual

Updates the macro noise/lightmap texture (pass 3)

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1213 of file HeightMap.cpp.

◆ staticLightingChanged()

void HeightMapRenderObjClass::staticLightingChanged ( void )
virtual

Notification that all lighting needs to be recalculated.

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1589 of file HeightMap.cpp.

◆ updateBlock()

Int HeightMapRenderObjClass::updateBlock ( Int x0,
Int y0,
Int x1,
Int y1,
WorldHeightMap * pMap,
RefRenderObjListIterator * pLightsIterator )
virtual

Updates a block of vertices from [x0,y0 to x1,y1] The vertex coordinates and texture coordinates, as well as static lighting are updated.

Implements BaseHeightMapRenderObjClass.

Definition at line 1018 of file HeightMap.cpp.

◆ updateCenter()

void HeightMapRenderObjClass::updateCenter ( CameraClass * camera,
RefRenderObjListIterator * pLightsIterator )
virtual

Updates the positioning of the drawn portion of the height map in the heightmap. As the view slides around, this determines what is the actually rendered portion of the terrain. Only a 96x96 section is rendered at any time, even though maps can be up to 1024x1024. This function determines which subset is rendered.

<

Todo
find out why values go out of range

Reimplemented from BaseHeightMapRenderObjClass.

Definition at line 1687 of file HeightMap.cpp.

◆ updateVB()

Int HeightMapRenderObjClass::updateVB ( DX8VertexBufferClass * pVB,
char * data,
Int x0,
Int y0,
Int x1,
Int y1,
Int originX,
Int originY,
WorldHeightMap * pMap,
RefRenderObjListIterator * pLightsIterator )
protected

update vertex buffer vertices inside given rectangle

Update a rectangular block of the given Vertex Buffer. data is expected to be an array same dimensions as current heightmap mapped into this VB.

Definition at line 313 of file HeightMap.cpp.

◆ updateVBForLight()

Int HeightMapRenderObjClass::updateVBForLight ( DX8VertexBufferClass * pVB,
char * data,
Int x0,
Int y0,
Int x1,
Int y1,
Int originX,
Int originY,
W3DDynamicLight * pLights[],
Int numLights )
protected

update vertex diffuse color for dynamic lights inside given rectangle

Update the dynamic lighting values only in a rectangular block of the given Vertex Buffer. The vertex locations and texture coords are unchanged.

Definition at line 572 of file HeightMap.cpp.

◆ updateVBForLightOptimized()

Int HeightMapRenderObjClass::updateVBForLightOptimized ( DX8VertexBufferClass * pVB,
char * data,
Int x0,
Int y0,
Int x1,
Int y1,
Int originX,
Int originY,
W3DDynamicLight * pLights[],
Int numLights )
protected

Definition at line 724 of file HeightMap.cpp.

Member Data Documentation

◆ m_extraBlendTilePositions

Int* HeightMapRenderObjClass::m_extraBlendTilePositions
protected

array holding x,y tile positions of all extra blend tiles. (used for 3 textures per tile).

Definition at line 97 of file HeightMap.h.

◆ m_extraBlendTilePositionsSize

Int HeightMapRenderObjClass::m_extraBlendTilePositionsSize
protected

Definition at line 100 of file HeightMap.h.

◆ m_indexBuffer

DX8IndexBufferClass* HeightMapRenderObjClass::m_indexBuffer
protected

indices defining triangles in a VB tile.

Definition at line 105 of file HeightMap.h.

◆ m_numBlockColumnsInLastVB

Int HeightMapRenderObjClass::m_numBlockColumnsInLastVB
protected

a VB tile may be partially filled, this indicates how many 2x2 vertex blocks are filled.

Definition at line 109 of file HeightMap.h.

◆ m_numBlockRowsInLastVB

Int HeightMapRenderObjClass::m_numBlockRowsInLastVB
protected

a VB tile may be partially filled, this indicates how many 2x2 vertex blocks are filled.

Definition at line 110 of file HeightMap.h.

◆ m_numExtraBlendTiles

Int HeightMapRenderObjClass::m_numExtraBlendTiles
protected

number of blend tiles in m_extraBlendTilePositions.

Definition at line 98 of file HeightMap.h.

◆ m_numVBTilesX

Int HeightMapRenderObjClass::m_numVBTilesX
protected

dimensions of array containing all the vertex buffers

Definition at line 106 of file HeightMap.h.

◆ m_numVBTilesY

Int HeightMapRenderObjClass::m_numVBTilesY
protected

dimensions of array containing all the vertex buffers

Definition at line 107 of file HeightMap.h.

◆ m_numVertexBufferTiles

Int HeightMapRenderObjClass::m_numVertexBufferTiles
protected

number of vertex buffers needed to store this heightmap

Definition at line 108 of file HeightMap.h.

◆ m_numVisibleExtraBlendTiles

Int HeightMapRenderObjClass::m_numVisibleExtraBlendTiles
protected

number rendered last frame.

Definition at line 99 of file HeightMap.h.

◆ m_originX

Int HeightMapRenderObjClass::m_originX
protected

Origin point in the grid. Slides around.

Definition at line 103 of file HeightMap.h.

◆ m_originY

Int HeightMapRenderObjClass::m_originY
protected

Origin point in the grid. Slides around.

Definition at line 104 of file HeightMap.h.

◆ m_vertexBufferBackup

char** HeightMapRenderObjClass::m_vertexBufferBackup
protected

In memory copy of the vertex buffer data for quick update of dynamic lighting.

Definition at line 102 of file HeightMap.h.

◆ m_vertexBufferTiles

DX8VertexBufferClass** HeightMapRenderObjClass::m_vertexBufferTiles
protected

collection of smaller vertex buffers that make up 1 heightmap

Definition at line 101 of file HeightMap.h.


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