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

#include <W3DProjectedShadow.h>

Inherits ProjectedShadowManager.

Public Member Functions

 W3DProjectedShadowManager (void)
 
 ~W3DProjectedShadowManager (void)
 
Bool init (void)
 allocate one-time shadow assets for length of entire game.
 
void reset (void)
 free all existing shadows - ready for next map.
 
void shutdown (void)
 free all assets prior to shutdown of entire game.
 
Int renderShadows (RenderInfoClass &rinfo)
 iterate over each object and render its shadow onto affected objects.
 
void ReleaseResources (void)
 release device dependent D3D resources.
 
Bool ReAcquireResources (void)
 allocate device dependent D3D resources.
 
void invalidateCachedLightPositions (void)
 forces shadows to update regardless of last lightposition
 
virtual ShadowaddDecal (RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo)
 add a non-shadow decal
 
virtual ShadowaddDecal (Shadow::ShadowTypeInfo *shadowInfo)
 add a non-shadow decal which does not follow an object.
 
W3DProjectedShadowaddShadow (RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo, Drawable *draw)
 add a new shadow with texture of given name or that of robj.
 
W3DProjectedShadowcreateDecalShadow (Shadow::ShadowTypeInfo *shadowInfo)
 add a new shadow with texture of given name or that of robj.
 
void removeShadow (W3DProjectedShadow *shadow)
 
void removeAllShadows (void)
 Remove all shadows.
 
TextureClassgetRenderTarget (void)
 
SpecialRenderInfoClassgetRenderContext (void)
 
void updateRenderTargetTextures (void)
 render into any textures that need updating.
 
void queueDecal (W3DProjectedShadow *shadow)
 add shadow decal to render list - decal conforms to terrain.
 
void queueSimpleDecal (W3DProjectedShadow *shadow)
 add shadow decal to render list - decal floats on terrain.
 
void flushDecals (W3DShadowTexture *texture, ShadowType type)
 empty queue by rendering all decals with given texture
 
- Public Member Functions inherited from ProjectedShadowManager
virtual ~ProjectedShadowManager ()
 

Detailed Description

Definition at line 46 of file W3DProjectedShadow.h.

Constructor & Destructor Documentation

◆ W3DProjectedShadowManager()

W3DProjectedShadowManager::W3DProjectedShadowManager ( void )

Definition at line 215 of file W3DProjectedShadow.cpp.

◆ ~W3DProjectedShadowManager()

W3DProjectedShadowManager::~W3DProjectedShadowManager ( void )

Definition at line 226 of file W3DProjectedShadow.cpp.

Member Function Documentation

◆ addDecal() [1/2]

Shadow * W3DProjectedShadowManager::addDecal ( RenderObjClass * robj,
Shadow::ShadowTypeInfo * shadowInfo )
virtual

add a non-shadow decal

Generic function which can be used to create arbitrary decals that follow the renderObject but don't have to be used for shadows. Some examples: Scorch marks, blood, stains, selection/status indicators, etc.

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Todo
: Fix projected shadows to allow multiple lights

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Implements ProjectedShadowManager.

Definition at line 1597 of file W3DProjectedShadow.cpp.

◆ addDecal() [2/2]

Shadow * W3DProjectedShadowManager::addDecal ( Shadow::ShadowTypeInfo * shadowInfo)
virtual

add a non-shadow decal which does not follow an object.

Generic function which can be used to create arbitrary decals that don't have to be used for shadows. Some examples: Scorch marks, blood, stains, selection/status indicators, etc.

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Todo
: Fix projected shadows to allow multiple lights

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Implements ProjectedShadowManager.

Definition at line 1481 of file W3DProjectedShadow.cpp.

◆ addShadow()

W3DProjectedShadow * W3DProjectedShadowManager::addShadow ( RenderObjClass * robj,
Shadow::ShadowTypeInfo * shadowInfo,
Drawable * draw )

add a new shadow with texture of given name or that of robj.

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Todo
: Fix projected shadows to allow multiple lights

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Definition at line 1731 of file W3DProjectedShadow.cpp.

◆ createDecalShadow()

W3DProjectedShadow * W3DProjectedShadowManager::createDecalShadow ( Shadow::ShadowTypeInfo * shadowInfo)

add a new shadow with texture of given name or that of robj.

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

type of projection

wrap shadow around world geometry - else align perpendicular to local z-axis.

Definition at line 1927 of file W3DProjectedShadow.cpp.

◆ flushDecals()

void W3DProjectedShadowManager::flushDecals ( W3DShadowTexture * texture,
ShadowType type )

empty queue by rendering all decals with given texture

Definition at line 685 of file W3DProjectedShadow.cpp.

◆ getRenderContext()

SpecialRenderInfoClass * W3DProjectedShadowManager::getRenderContext ( void )
inline

Definition at line 72 of file W3DProjectedShadow.h.

◆ getRenderTarget()

TextureClass * W3DProjectedShadowManager::getRenderTarget ( void )
inline

Definition at line 71 of file W3DProjectedShadow.h.

◆ init()

Bool W3DProjectedShadowManager::init ( void )

allocate one-time shadow assets for length of entire game.

Definition at line 252 of file W3DProjectedShadow.cpp.

◆ invalidateCachedLightPositions()

void W3DProjectedShadowManager::invalidateCachedLightPositions ( void )

forces shadows to update regardless of last lightposition

Definition at line 326 of file W3DProjectedShadow.cpp.

◆ queueDecal()

void W3DProjectedShadowManager::queueDecal ( W3DProjectedShadow * shadow)

add shadow decal to render list - decal conforms to terrain.

Decals have a low poly count so its better to render large numbers at once. This system will queue them up until the buffers fill up. It will then flush the buffer (draw decals) and be ready for new decals. This is an optimized system that only uses the render objects bounding box to determine shadow visibility.

Todo
: Optimize this bounding box calculation to use transformed extents
Todo
: fix the winding order in heightmap to be in strip order like above!

Definition at line 811 of file W3DProjectedShadow.cpp.

◆ queueSimpleDecal()

void W3DProjectedShadowManager::queueSimpleDecal ( W3DProjectedShadow * shadow)

add shadow decal to render list - decal floats on terrain.

Simpler/faster decal system that always uses 2 triangles that are roughly oriented to terrain. Since they are not projected onto terrain, there may be clipping artifacts in certain situations. TODO: Too much clipping. Need to check terrain heights at all 4 corners and adjust tilt to match

Todo
: We should have a pre-made static filled index buffer since we always send down 2 triangles.

Definition at line 1154 of file W3DProjectedShadow.cpp.

◆ ReAcquireResources()

Bool W3DProjectedShadowManager::ReAcquireResources ( void )

allocate device dependent D3D resources.

Todo
: We should allocate our render target pool here.

Definition at line 263 of file W3DProjectedShadow.cpp.

◆ ReleaseResources()

void W3DProjectedShadowManager::ReleaseResources ( void )

release device dependent D3D resources.

Definition at line 314 of file W3DProjectedShadow.cpp.

◆ removeAllShadows()

void W3DProjectedShadowManager::removeAllShadows ( void )

Remove all shadows.

Definition at line 2084 of file W3DProjectedShadow.cpp.

◆ removeShadow()

void W3DProjectedShadowManager::removeShadow ( W3DProjectedShadow * shadow)

Definition at line 2028 of file W3DProjectedShadow.cpp.

◆ renderShadows()

Int W3DProjectedShadowManager::renderShadows ( RenderInfoClass & rinfo)

iterate over each object and render its shadow onto affected objects.

Todo
: implement this method.
Todo
: may need to fix this if shadows are large enough to be seen while object is not visible
Todo
: don't apply shadows to translcuent objects unless they are MOBILE - hack to get tanks to work.
Todo
: may need to fix this if shadows are large enough to be seen while object is not visible

Definition at line 1294 of file W3DProjectedShadow.cpp.

◆ reset()

void W3DProjectedShadowManager::reset ( void )

free all existing shadows - ready for next map.

Definition at line 242 of file W3DProjectedShadow.cpp.

◆ shutdown()

void W3DProjectedShadowManager::shutdown ( void )

free all assets prior to shutdown of entire game.

◆ updateRenderTargetTextures()

void W3DProjectedShadowManager::updateRenderTargetTextures ( void )

render into any textures that need updating.

Todo
: Don't update texture for shadows that can't be seen!!

Definition at line 331 of file W3DProjectedShadow.cpp.


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