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

#include <W3DVolumetricShadow.h>

Inherits Shadow.

Public Member Functions

 W3DVolumetricShadow (void)
 
 ~W3DVolumetricShadow (void)
 
- Public Member Functions inherited from Shadow
 Shadow (void)
 if this is set, then no render will occur, even if enableShadowRender() is enabled. Used by Shroud.
 
void enableShadowInvisible (Bool isEnabled)
 
void enableShadowRender (Bool isEnabled)
 
Bool isRenderEnabled (void)
 
Bool isInvisibleEnabled (void)
 
void setOpacity (Int value)
 adjust opacity of decal/shadow
 
void setColor (Color value)
 adjust ARGB color of decal/shadow
 
void setAngle (Real angle)
 adjust orientation around z-axis
 
void setPosition (Real x, Real y, Real z)
 
void setSize (Real sizeX, Real sizeY)
 

Protected Member Functions

virtual void release (void)
 release shadow from manager
 
void SetGeometry (W3DShadowGeometry *geometry)
 
void setShadowLengthScale (Real value)
 
void updateOptimalExtrusionPadding (void)
 for immobile objects, figure out the length of extrusion needed to hit ground - expensive!
 
void setOptimalExtrusionPadding (Real value)
 
const W3DShadowGeometrygetGeometry (void)
 
void setRenderObject (RenderObjClass *robj)
 
void setRenderObjExtent (Real extent)
 
void Update ()
 
void updateVolumes (Real zoffset)
 update shadow volumes of all meshes in this model
 
void updateMeshVolume (Int meshIndex, Int lightIndex, const Matrix3D *meshXform, const AABoxClass &meshBox, float floorZ)
 update shadow volume of this mesh.
 
void RenderVolume (Int meshIndex, Int lightIndex)
 
void RenderMeshVolume (Int meshIndex, Int lightIndex, const Matrix3D *meshXform)
 render single mesh which could belong to a larger hierarchy (optimized for static meshes).
 
void RenderDynamicMeshVolume (Int meshIndex, Int lightIndex, const Matrix3D *meshXform)
 render single mesh which could belong to a larger hierarchy (optimized for animated meshes).
 
void RenderMeshVolumeBounds (Int meshIndex, Int lightIndex, const Matrix3D *meshXform)
 render bounding volume around shadow volume - for debug use.
 
void setLightPosHistory (Int lightIndex, Int meshIndex, Vector3 &pos)
 updates the last position of light
 
void buildSilhouette (Int meshIndex, Vector3 *lightPosWorld)
 for the shadow manager list
 
void addSilhouetteEdge (Int meshIndex, PolyNeighbor *visible, PolyNeighbor *hidden)
 
void addNeighborlessEdges (Int meshIndex, PolyNeighbor *us)
 
void addSilhouetteIndices (Int meshIndex, Short edgeStart, Short edgeEnd)
 
Bool allocateSilhouette (Int meshIndex, Int numVertices)
 
void deleteSilhouette (Int meshIndex)
 
void resetSilhouette (Int meshIndex)
 
void constructVolume (Vector3 *lightPos, Real shadowExtrudeDistance, Int volumeIndex, Int meshIndex)
 
void constructVolumeVB (Vector3 *lightPosObject, Real shadowExtrudeDistance, Int volumeIndex, Int meshIndex)
 
Bool allocateShadowVolume (Int volumeIndex, Int meshIndex)
 
void deleteShadowVolume (Int volumeIndex)
 
void resetShadowVolume (Int volumeIndex, Int meshIndex)
 

Protected Attributes

W3DVolumetricShadowm_next
 
W3DShadowGeometrym_geometry
 
RenderObjClassm_robj
 render object belonging to model casting shadow
 
Real m_shadowLengthScale
 scale factor used to reduce/clamp shadow length
 
Real m_robjExtent
 maximum possible horizontal reach of shadow from center of object.
 
Real m_extraExtrusionPadding
 amount to extrude shadow beyond where it would normally stop (ground level below object).
 
Geometrym_shadowVolume [MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
 
W3DBufferManager::W3DVertexBufferSlotm_shadowVolumeVB [MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
 
W3DBufferManager::W3DIndexBufferSlotm_shadowVolumeIB [MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
 
W3DVolumetricShadowRenderTask m_shadowVolumeRenderTask [MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
 
Int m_shadowVolumeCount [MAX_SHADOW_CASTER_MESHES]
 
Vector3 m_lightPosHistory [MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
 
Matrix4x4 m_objectXformHistory [MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
 
Shortm_silhouetteIndex [MAX_SHADOW_CASTER_MESHES]
 
Short m_numSilhouetteIndices [MAX_SHADOW_CASTER_MESHES]
 
Short m_maxSilhouetteEntries [MAX_SHADOW_CASTER_MESHES]
 
Int m_numIndicesPerMesh [MAX_SHADOW_CASTER_MESHES]
 silhouette indices from each mesh.
 
- Protected Attributes inherited from Shadow
Bool m_isEnabled
 
Bool m_isInvisibleEnabled
 toggle to turn rendering of this shadow on/off.
 
UnsignedInt m_opacity
 if set, overrides and causes no rendering.
 
UnsignedInt m_color
 color in ARGB format. (Alpha is ignored).
 
ShadowType m_type
 
Int m_diffuse
 type of projection
 
Real m_x
 diffuse color used to tint/fade shadow.
 
Real m_y
 
Real m_z
 
Real m_oowDecalSizeX
 world position of shadow center when not bound to robj/drawable.
 
Real m_oowDecalSizeY
 1/(world space extent of texture in x direction)
 
Real m_decalSizeX
 1/(world space extent of texture in y direction)
 
Real m_decalSizeY
 1/(world space extent of texture in x direction)
 
Real m_localAngle
 1/(world space extent of texture in y direction)
 

Static Protected Attributes

static Geometry m_tempShadowVolume
 

Friends

class W3DVolumetricShadowManager
 

Detailed Description

Definition at line 93 of file W3DVolumetricShadow.h.

Constructor & Destructor Documentation

◆ W3DVolumetricShadow()

W3DVolumetricShadow::W3DVolumetricShadow ( void )

Definition at line 1698 of file W3DVolumetricShadow.cpp.

◆ ~W3DVolumetricShadow()

W3DVolumetricShadow::~W3DVolumetricShadow ( void )

Definition at line 1737 of file W3DVolumetricShadow.cpp.

Member Function Documentation

◆ addNeighborlessEdges()

void W3DVolumetricShadow::addNeighborlessEdges ( Int meshIndex,
PolyNeighbor * us )
protected

Definition at line 2348 of file W3DVolumetricShadow.cpp.

◆ addSilhouetteEdge()

void W3DVolumetricShadow::addSilhouetteEdge ( Int meshIndex,
PolyNeighbor * visible,
PolyNeighbor * hidden )
protected

Definition at line 2262 of file W3DVolumetricShadow.cpp.

◆ addSilhouetteIndices()

void W3DVolumetricShadow::addSilhouetteIndices ( Int meshIndex,
Short edgeStart,
Short edgeEnd )
protected

Definition at line 2415 of file W3DVolumetricShadow.cpp.

◆ allocateShadowVolume()

Bool W3DVolumetricShadow::allocateShadowVolume ( Int volumeIndex,
Int meshIndex )
protected

Definition at line 3170 of file W3DVolumetricShadow.cpp.

◆ allocateSilhouette()

Bool W3DVolumetricShadow::allocateSilhouette ( Int meshIndex,
Int numVertices )
protected
Todo
: HACK, HACK... Should be 2!

Definition at line 3328 of file W3DVolumetricShadow.cpp.

◆ buildSilhouette()

void W3DVolumetricShadow::buildSilhouette ( Int meshIndex,
Vector3 * lightPosWorld )
protected

for the shadow manager list

Definition at line 2433 of file W3DVolumetricShadow.cpp.

◆ constructVolume()

void W3DVolumetricShadow::constructVolume ( Vector3 * lightPos,
Real shadowExtrudeDistance,
Int volumeIndex,
Int meshIndex )
protected

Definition at line 2612 of file W3DVolumetricShadow.cpp.

◆ constructVolumeVB()

void W3DVolumetricShadow::constructVolumeVB ( Vector3 * lightPosObject,
Real shadowExtrudeDistance,
Int volumeIndex,
Int meshIndex )
protected

Definition at line 2849 of file W3DVolumetricShadow.cpp.

◆ deleteShadowVolume()

void W3DVolumetricShadow::deleteShadowVolume ( Int volumeIndex)
protected

Definition at line 3255 of file W3DVolumetricShadow.cpp.

◆ deleteSilhouette()

void W3DVolumetricShadow::deleteSilhouette ( Int meshIndex)
protected

Definition at line 3361 of file W3DVolumetricShadow.cpp.

◆ getGeometry()

const W3DShadowGeometry * W3DVolumetricShadow::getGeometry ( void )
inlineprotected

Definition at line 120 of file W3DVolumetricShadow.h.

◆ release()

virtual void W3DVolumetricShadow::release ( void )
inlineprotectedvirtual

release shadow from manager

Implements Shadow.

Definition at line 109 of file W3DVolumetricShadow.h.

◆ RenderDynamicMeshVolume()

void W3DVolumetricShadow::RenderDynamicMeshVolume ( Int meshIndex,
Int lightIndex,
const Matrix3D * meshXform )
protected

render single mesh which could belong to a larger hierarchy (optimized for animated meshes).

Definition at line 1435 of file W3DVolumetricShadow.cpp.

◆ RenderMeshVolume()

void W3DVolumetricShadow::RenderMeshVolume ( Int meshIndex,
Int lightIndex,
const Matrix3D * meshXform )
protected

render single mesh which could belong to a larger hierarchy (optimized for static meshes).

Todo
: W3D always does transpose on all of matrix sets. Slow??? Better to hack view matrix.

Definition at line 1375 of file W3DVolumetricShadow.cpp.

◆ RenderMeshVolumeBounds()

void W3DVolumetricShadow::RenderMeshVolumeBounds ( Int meshIndex,
Int lightIndex,
const Matrix3D * meshXform )
protected

render bounding volume around shadow volume - for debug use.

Debug function to draw bounding boxes around shadow volumes

Definition at line 1547 of file W3DVolumetricShadow.cpp.

◆ RenderVolume()

void W3DVolumetricShadow::RenderVolume ( Int meshIndex,
Int lightIndex )
protected

renders a specifc volume from the model hierarchy

Definition at line 1351 of file W3DVolumetricShadow.cpp.

◆ resetShadowVolume()

void W3DVolumetricShadow::resetShadowVolume ( Int volumeIndex,
Int meshIndex )
protected

Definition at line 3291 of file W3DVolumetricShadow.cpp.

◆ resetSilhouette()

void W3DVolumetricShadow::resetSilhouette ( Int meshIndex)
protected

Definition at line 3375 of file W3DVolumetricShadow.cpp.

◆ SetGeometry()

void W3DVolumetricShadow::SetGeometry ( W3DShadowGeometry * geometry)
protected

Definition at line 1765 of file W3DVolumetricShadow.cpp.

◆ setLightPosHistory()

void W3DVolumetricShadow::setLightPosHistory ( Int lightIndex,
Int meshIndex,
Vector3 & pos )
inlineprotected

updates the last position of light

Definition at line 138 of file W3DVolumetricShadow.h.

◆ setOptimalExtrusionPadding()

void W3DVolumetricShadow::setOptimalExtrusionPadding ( Real value)
inlineprotected

Definition at line 119 of file W3DVolumetricShadow.h.

◆ setRenderObject()

void W3DVolumetricShadow::setRenderObject ( RenderObjClass * robj)
inlineprotected

Definition at line 122 of file W3DVolumetricShadow.h.

◆ setRenderObjExtent()

void W3DVolumetricShadow::setRenderObjExtent ( Real extent)
inlineprotected

Definition at line 123 of file W3DVolumetricShadow.h.

◆ setShadowLengthScale()

void W3DVolumetricShadow::setShadowLengthScale ( Real value)
inlineprotected

Definition at line 117 of file W3DVolumetricShadow.h.

◆ Update()

void W3DVolumetricShadow::Update ( )
protected

Called once per frame for each object, when necessary it will reconstruct the shadow volume for this shadow from the silhouette of the geometry and any light sources

Definition at line 1812 of file W3DVolumetricShadow.cpp.

◆ updateMeshVolume()

void W3DVolumetricShadow::updateMeshVolume ( Int meshIndex,
Int lightIndex,
const Matrix3D * meshXform,
const AABoxClass & meshBox,
float floorZ )
protected

update shadow volume of this mesh.

Todo
: Find a better way to deal with this - use maximum extrusion once! Also avoid hit for units climbing hills.

Definition at line 1975 of file W3DVolumetricShadow.cpp.

◆ updateOptimalExtrusionPadding()

void W3DVolumetricShadow::updateOptimalExtrusionPadding ( void )
protected

for immobile objects, figure out the length of extrusion needed to hit ground - expensive!

Definition at line 1188 of file W3DVolumetricShadow.cpp.

◆ updateVolumes()

void W3DVolumetricShadow::updateVolumes ( Real zoffset)
protected

update shadow volumes of all meshes in this model

Update shadow volumes belonging to all meshes of this shadow caster. Use zoffset to extend shadows below object's base by given amount.

Todo
: Getting the transform of the mesh may be forcing a full hierarchy evaluation. Expensive for off-screen models... do we really need this?

Definition at line 1891 of file W3DVolumetricShadow.cpp.

Friends And Related Symbol Documentation

◆ W3DVolumetricShadowManager

friend class W3DVolumetricShadowManager
friend

Definition at line 95 of file W3DVolumetricShadow.h.

Member Data Documentation

◆ m_extraExtrusionPadding

Real W3DVolumetricShadow::m_extraExtrusionPadding
protected

amount to extrude shadow beyond where it would normally stop (ground level below object).

Definition at line 164 of file W3DVolumetricShadow.h.

◆ m_geometry

W3DShadowGeometry* W3DVolumetricShadow::m_geometry
protected

Definition at line 158 of file W3DVolumetricShadow.h.

◆ m_lightPosHistory

Vector3 W3DVolumetricShadow::m_lightPosHistory[MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 178 of file W3DVolumetricShadow.h.

◆ m_maxSilhouetteEntries

Short W3DVolumetricShadow::m_maxSilhouetteEntries[MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 188 of file W3DVolumetricShadow.h.

◆ m_next

W3DVolumetricShadow* W3DVolumetricShadow::m_next
protected

Definition at line 139 of file W3DVolumetricShadow.h.

◆ m_numIndicesPerMesh

Int W3DVolumetricShadow::m_numIndicesPerMesh[MAX_SHADOW_CASTER_MESHES]
protected

silhouette indices from each mesh.

Definition at line 190 of file W3DVolumetricShadow.h.

◆ m_numSilhouetteIndices

Short W3DVolumetricShadow::m_numSilhouetteIndices[MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 185 of file W3DVolumetricShadow.h.

◆ m_objectXformHistory

Matrix4x4 W3DVolumetricShadow::m_objectXformHistory[MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 179 of file W3DVolumetricShadow.h.

◆ m_robj

RenderObjClass* W3DVolumetricShadow::m_robj
protected

render object belonging to model casting shadow

Definition at line 160 of file W3DVolumetricShadow.h.

◆ m_robjExtent

Real W3DVolumetricShadow::m_robjExtent
protected

maximum possible horizontal reach of shadow from center of object.

Definition at line 163 of file W3DVolumetricShadow.h.

◆ m_shadowLengthScale

Real W3DVolumetricShadow::m_shadowLengthScale
protected

scale factor used to reduce/clamp shadow length

Definition at line 162 of file W3DVolumetricShadow.h.

◆ m_shadowVolume

Geometry* W3DVolumetricShadow::m_shadowVolume[MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 173 of file W3DVolumetricShadow.h.

◆ m_shadowVolumeCount

Int W3DVolumetricShadow::m_shadowVolumeCount[MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 177 of file W3DVolumetricShadow.h.

◆ m_shadowVolumeIB

W3DBufferManager::W3DIndexBufferSlot* W3DVolumetricShadow::m_shadowVolumeIB[MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 175 of file W3DVolumetricShadow.h.

◆ m_shadowVolumeRenderTask

W3DVolumetricShadowRenderTask W3DVolumetricShadow::m_shadowVolumeRenderTask[MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 176 of file W3DVolumetricShadow.h.

◆ m_shadowVolumeVB

W3DBufferManager::W3DVertexBufferSlot* W3DVolumetricShadow::m_shadowVolumeVB[MAX_SHADOW_LIGHTS][MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 174 of file W3DVolumetricShadow.h.

◆ m_silhouetteIndex

Short* W3DVolumetricShadow::m_silhouetteIndex[MAX_SHADOW_CASTER_MESHES]
protected

Definition at line 182 of file W3DVolumetricShadow.h.

◆ m_tempShadowVolume

Geometry W3DVolumetricShadow::m_tempShadowVolume
staticprotected

Definition at line 172 of file W3DVolumetricShadow.h.


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