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

#include <W3DShroud.h>

Public Member Functions

 W3DShroud (void)
 
 ~W3DShroud (void)
 
void render (CameraClass *cam)
 render the current shroud state as seen from camera
 
void init (WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSizeY)
 
void reset (void)
 Called on map reset.
 
TextureClassgetShroudTexture (void)
 
void ReleaseResources (void)
 release resources that can't survive D3D device reset.
 
Bool ReAcquireResources (void)
 allocate resources that can't survive D3D device reset.
 
void fillShroudData (W3DShroudLevel level)
 sets the state of the current shroud to some constant value
 
Int getNumShroudCellsY (void)
 
Int getNumShroudCellsX (void)
 
Real getCellWidth (void)
 world-space width (x) of each shroud cell.
 
Real getCellHeight (void)
 world-space height (y)of each shroud cell.
 
Int getTextureWidth (void)
 internal use by the shader system.
 
Int getTextureHeight (void)
 
W3DShroudLevel getShroudLevel (Int x, Int y)
 
void setShroudLevel (Int x, Int y, W3DShroudLevel, Bool textureOnly=FALSE)
 
void setShroudFilter (Bool enable)
 turns on bilinear filtering of shroud cells.
 
void setBorderShroudLevel (W3DShroudLevel level)
 color that will appear in unused border terrain.
 
Real getDrawOriginX (void)
 returns ws origin of first pixel in shroud texture.
 
Real getDrawOriginY (void)
 returns ws origin of first pixel in shroud texture.
 

Protected Member Functions

void interpolateFogLevels (RECT *rect)
 fade current fog levels to actual logic side levels.
 
void fillBorderShroudData (W3DShroudLevel level, SurfaceClass *pDestSurface)
 fill the destination texture with a known value
 

Protected Attributes

Int m_numCellsX
 number of cells covering entire map
 
Int m_numCellsY
 number of cells covering entire map
 
Int m_numMaxVisibleCellsX
 maximum number of shroud cells that can be visible
 
Int m_numMaxVisibleCellsY
 maximum number of shroud cells that can be visible
 
Real m_cellWidth
 spacing between adjacent cells
 
Real m_cellHeight
 spacing between adjacent cells
 
Bytem_shroudData
 holds amount of shroud per cell.
 
IDirect3DSurface8 * m_pSrcTexture
 stores sysmem copy of visible shroud.
 
void * m_srcTextureData
 pointer to shroud data
 
UnsignedInt m_srcTexturePitch
 width (in bytes) of shroud data buffer.
 
TextureClassm_pDstTexture
 stores vidmem copy of visible shroud.
 
Int m_dstTextureWidth
 dimensions of m_pDstTexture
 
Int m_dstTextureHeight
 dimensions of m_pDstTexture
 
TextureFilterClass::FilterType m_shroudFilter
 
Real m_drawOriginX
 
Real m_drawOriginY
 
Bool m_drawFogOfWar
 switch to draw alternate fog style instead of solid black
 
Bool m_clearDstTexture
 flag indicating we must clear video memory destination texture
 
W3DShroudLevel m_boderShroudLevel
 color used to clear the shroud border
 
W3DShroudLevelm_finalFogData
 copy of logical shroud in an easier to access array.
 
W3DShroudLevelm_currentFogData
 copy of intermediate logical shroud while it's interpolated.
 

Detailed Description

Terrain shroud rendering class

Definition at line 78 of file W3DShroud.h.

Constructor & Destructor Documentation

◆ W3DShroud()

W3DShroud::W3DShroud ( void )

Definition at line 76 of file W3DShroud.cpp.

◆ ~W3DShroud()

W3DShroud::~W3DShroud ( void )

Definition at line 97 of file W3DShroud.cpp.

Member Function Documentation

◆ fillBorderShroudData()

void W3DShroud::fillBorderShroudData ( W3DShroudLevel level,
SurfaceClass * pDestSurface )
protected

fill the destination texture with a known value

Definition at line 418 of file W3DShroud.cpp.

◆ fillShroudData()

void W3DShroud::fillShroudData ( W3DShroudLevel level)

sets the state of the current shroud to some constant value

Quickly sets the shroud level of entire map to a single value.

Definition at line 354 of file W3DShroud.cpp.

◆ getCellHeight()

Real W3DShroud::getCellHeight ( void )
inline

world-space height (y)of each shroud cell.

Definition at line 95 of file W3DShroud.h.

◆ getCellWidth()

Real W3DShroud::getCellWidth ( void )
inline

world-space width (x) of each shroud cell.

Definition at line 94 of file W3DShroud.h.

◆ getDrawOriginX()

Real W3DShroud::getDrawOriginX ( void )
inline

returns ws origin of first pixel in shroud texture.

Definition at line 102 of file W3DShroud.h.

◆ getDrawOriginY()

Real W3DShroud::getDrawOriginY ( void )
inline

returns ws origin of first pixel in shroud texture.

Definition at line 103 of file W3DShroud.h.

◆ getNumShroudCellsX()

Int W3DShroud::getNumShroudCellsX ( void )
inline

Definition at line 93 of file W3DShroud.h.

◆ getNumShroudCellsY()

Int W3DShroud::getNumShroudCellsY ( void )
inline

Definition at line 92 of file W3DShroud.h.

◆ getShroudLevel()

W3DShroudLevel W3DShroud::getShroudLevel ( Int x,
Int y )

Definition at line 265 of file W3DShroud.cpp.

◆ getShroudTexture()

TextureClass * W3DShroud::getShroudTexture ( void )
inline

Definition at line 88 of file W3DShroud.h.

◆ getTextureHeight()

Int W3DShroud::getTextureHeight ( void )
inline

Definition at line 97 of file W3DShroud.h.

◆ getTextureWidth()

Int W3DShroud::getTextureWidth ( void )
inline

internal use by the shader system.

Definition at line 96 of file W3DShroud.h.

◆ init()

void W3DShroud::init ( WorldHeightMap * pMap,
Real worldCellSizeX,
Real worldCellSizeY )

Called to initialize a new shroud for a new map. Should be done after the map is loaded into the terrain object. worldCellSize is the world-space dimensions of each shroud cell. The system will generate enough cells to cover the full map.

Todo
: Check if size has changed - probably never

Definition at line 115 of file W3DShroud.cpp.

◆ interpolateFogLevels()

void W3DShroud::interpolateFogLevels ( RECT * rect)
protected

fade current fog levels to actual logic side levels.

Definition at line 729 of file W3DShroud.cpp.

◆ ReAcquireResources()

Bool W3DShroud::ReAcquireResources ( void )

allocate resources that can't survive D3D device reset.

Restore resources that are lost on D3D device reset.

Definition at line 232 of file W3DShroud.cpp.

◆ ReleaseResources()

void W3DShroud::ReleaseResources ( void )

release resources that can't survive D3D device reset.

Release any resources that can't survive a D3D device reset.

Definition at line 225 of file W3DShroud.cpp.

◆ render()

void W3DShroud::render ( CameraClass * cam)

render the current shroud state as seen from camera

Updates video memory surface with currently visible shroud data

Definition at line 526 of file W3DShroud.cpp.

◆ reset()

void W3DShroud::reset ( void )

Called on map reset.

Definition at line 208 of file W3DShroud.cpp.

◆ setBorderShroudLevel()

void W3DShroud::setBorderShroudLevel ( W3DShroudLevel level)

color that will appear in unused border terrain.

Set the shroud color within the border area of the map

Definition at line 509 of file W3DShroud.cpp.

◆ setShroudFilter()

void W3DShroud::setShroudFilter ( Bool enable)

turns on bilinear filtering of shroud cells.

Definition at line 777 of file W3DShroud.cpp.

◆ setShroudLevel()

void W3DShroud::setShroudLevel ( Int x,
Int y,
W3DShroudLevel level,
Bool textureOnly = FALSE )

Definition at line 286 of file W3DShroud.cpp.

Member Data Documentation

◆ m_boderShroudLevel

W3DShroudLevel W3DShroud::m_boderShroudLevel
protected

color used to clear the shroud border

Definition at line 124 of file W3DShroud.h.

◆ m_cellHeight

Real W3DShroud::m_cellHeight
protected

spacing between adjacent cells

Definition at line 111 of file W3DShroud.h.

◆ m_cellWidth

Real W3DShroud::m_cellWidth
protected

spacing between adjacent cells

Definition at line 110 of file W3DShroud.h.

◆ m_clearDstTexture

Bool W3DShroud::m_clearDstTexture
protected

flag indicating we must clear video memory destination texture

Definition at line 123 of file W3DShroud.h.

◆ m_currentFogData

W3DShroudLevel* W3DShroud::m_currentFogData
protected

copy of intermediate logical shroud while it's interpolated.

Definition at line 126 of file W3DShroud.h.

◆ m_drawFogOfWar

Bool W3DShroud::m_drawFogOfWar
protected

switch to draw alternate fog style instead of solid black

Definition at line 122 of file W3DShroud.h.

◆ m_drawOriginX

Real W3DShroud::m_drawOriginX
protected

Definition at line 120 of file W3DShroud.h.

◆ m_drawOriginY

Real W3DShroud::m_drawOriginY
protected

Definition at line 121 of file W3DShroud.h.

◆ m_dstTextureHeight

Int W3DShroud::m_dstTextureHeight
protected

dimensions of m_pDstTexture

Definition at line 118 of file W3DShroud.h.

◆ m_dstTextureWidth

Int W3DShroud::m_dstTextureWidth
protected

dimensions of m_pDstTexture

Definition at line 117 of file W3DShroud.h.

◆ m_finalFogData

W3DShroudLevel* W3DShroud::m_finalFogData
protected

copy of logical shroud in an easier to access array.

Definition at line 125 of file W3DShroud.h.

◆ m_numCellsX

Int W3DShroud::m_numCellsX
protected

number of cells covering entire map

Definition at line 106 of file W3DShroud.h.

◆ m_numCellsY

Int W3DShroud::m_numCellsY
protected

number of cells covering entire map

Definition at line 107 of file W3DShroud.h.

◆ m_numMaxVisibleCellsX

Int W3DShroud::m_numMaxVisibleCellsX
protected

maximum number of shroud cells that can be visible

Definition at line 108 of file W3DShroud.h.

◆ m_numMaxVisibleCellsY

Int W3DShroud::m_numMaxVisibleCellsY
protected

maximum number of shroud cells that can be visible

Definition at line 109 of file W3DShroud.h.

◆ m_pDstTexture

TextureClass* W3DShroud::m_pDstTexture
protected

stores vidmem copy of visible shroud.

Definition at line 116 of file W3DShroud.h.

◆ m_pSrcTexture

IDirect3DSurface8* W3DShroud::m_pSrcTexture
protected

stores sysmem copy of visible shroud.

Definition at line 113 of file W3DShroud.h.

◆ m_shroudData

Byte* W3DShroud::m_shroudData
protected

holds amount of shroud per cell.

Definition at line 112 of file W3DShroud.h.

◆ m_shroudFilter

TextureFilterClass::FilterType W3DShroud::m_shroudFilter
protected

Definition at line 119 of file W3DShroud.h.

◆ m_srcTextureData

void* W3DShroud::m_srcTextureData
protected

pointer to shroud data

Definition at line 114 of file W3DShroud.h.

◆ m_srcTexturePitch

UnsignedInt W3DShroud::m_srcTexturePitch
protected

width (in bytes) of shroud data buffer.

Definition at line 115 of file W3DShroud.h.


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