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

#include <W3DScene.h>

Inherits SimpleSceneClass, and SubsystemInterface.

Inherited by SkeletonSceneClass.

Public Member Functions

 RTS3DScene ()
 RTSScene constructor.
 
 ~RTS3DScene ()
 RTSScene desctructor.
 
Bool castRay (RayCollisionTestClass &raytest, Bool testAll, Int collisionType)
 ray picking against objects in scene
 
virtual void Customized_Render (RenderInfoClass &rinfo)
 customizable renderer for the RTS3DScene
 
virtual void Visibility_Check (CameraClass *camera)
 
virtual void Render (RenderInfoClass &rinfo)
 
void setCustomPassMode (CustomScenePassModes mode)
 
CustomScenePassModes getCustomPassMode (void)
 
void Flush (RenderInfoClass &rinfo)
 
void drawTerrainOnly (Bool draw)
 Drawing control method.
 
void renderSpecificDrawables (RenderInfoClass &rinfo, Int numDrawables, Drawable **theDrawables)
 Drawing control method.
 
void addDynamicLight (W3DDynamicLight *obj)
 Lighting methods.
 
void removeDynamicLight (W3DDynamicLight *obj)
 
RefRenderObjListIteratorcreateLightsIterator (void)
 
void destroyLightsIterator (RefRenderObjListIterator *it)
 
RefRenderObjListClassgetDynamicLights (void)
 
W3DDynamicLightgetADynamicLight (void)
 
void setGlobalLight (LightClass *pLight, Int lightIndex=0)
 
LightEnvironmentClassgetDefaultLightEnv (void)
 
void init ()
 
void update ()
 
void draw ()
 
void reset ()
 
void doRender (CameraClass *cam)
 
- Public Member Functions inherited from SimpleSceneClass
 SimpleSceneClass (void)
 
virtual ~SimpleSceneClass (void)
 
virtual int Get_Scene_ID (void)
 
virtual void Add_Render_Object (RenderObjClass *obj)
 
virtual void Remove_Render_Object (RenderObjClass *obj)
 
virtual void Remove_All_Render_Objects (void)
 
virtual void Register (RenderObjClass *obj, RegType for_what)
 
virtual void Unregister (RenderObjClass *obj, RegType for_what)
 
virtual SceneIteratorCreate_Iterator (bool onlyvisible=false)
 
virtual void Destroy_Iterator (SceneIterator *it)
 
virtual float Compute_Point_Visibility (RenderInfoClass &rinfo, const Vector3 &point)
 
- Public Member Functions inherited from SceneClass
 SceneClass (void)
 
virtual ~SceneClass (void)
 
virtual int Get_Scene_ID (void) const
 
virtual void Set_Ambient_Light (const Vector3 &color)
 
virtual const Vector3Get_Ambient_Light (void)
 
virtual void Set_Fog_Enable (bool set)
 
virtual bool Get_Fog_Enable (void)
 
virtual void Set_Fog_Color (const Vector3 &color)
 
virtual const Vector3Get_Fog_Color (void)
 
virtual void Set_Fog_Range (float start, float end)
 
virtual void Get_Fog_Range (float *start, float *end)
 
void Set_Polygon_Mode (PolyRenderType mode)
 
PolyRenderType Get_Polygon_Mode (void)
 
void Set_Extra_Pass_Polygon_Mode (ExtraPassPolyRenderType mode)
 
ExtraPassPolyRenderType Get_Extra_Pass_Polygon_Mode (void)
 
virtual void Save (ChunkSaveClass &csave)
 
virtual void Load (ChunkLoadClass &cload)
 
- 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 SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 

Protected Member Functions

void renderOneObject (RenderInfoClass &rinfo, RenderObjClass *robj, Int localPlayerIndex)
 
void updateFixedLightEnvironments (RenderInfoClass &rinfo)
 
void flushTranslucentObjects (RenderInfoClass &rinfo)
 
void flushOccludedObjects (RenderInfoClass &rinfo)
 
void flagOccludedObjects (CameraClass *camera)
 
void flushOccludedObjectsIntoStencil (RenderInfoClass &rinfo)
 
void updatePlayerColorPasses (void)
 
- Protected Member Functions inherited from SimpleSceneClass
virtual void Post_Render_Processing (RenderInfoClass &rinfo)
 
- Protected Member Functions inherited from SceneClass
 SceneClass (const SceneClass &)
 
SceneClassoperator== (const SceneClass &)
 
- Protected Member Functions inherited from RefCountClass
virtual ~RefCountClass (void)
 

Protected Attributes

RefRenderObjListClass m_dynamicLightList
 
Bool m_drawTerrainOnly
 
LightClassm_globalLight [LightEnvironmentClass::MAX_LIGHTS]
 The global directional light (sun, moon) Applies to objects.
 
LightClassm_scratchLight
 a workspace for copying global lights and modifying // MLorenzen
 
Vector3 m_infantryAmbient
 scene ambient modified to make infantry easier to see
 
LightClassm_infantryLight [LightEnvironmentClass::MAX_LIGHTS]
 The global direction light modified to make infantry easier to see.
 
Int m_numGlobalLights
 number of global lights
 
LightEnvironmentClass m_defaultLightEnv
 default light environment applied to objects without custom/dynamic lighting.
 
LightEnvironmentClass m_foggedLightEnv
 default light environment applied to objects without custom/dynamic lighting.
 
W3DShroudMaterialPassClassm_shroudMaterialPass
 Custom render pass which applies shrouds to objects.
 
W3DMaskMaterialPassClassm_maskMaterialPass
 Custom render pass applied to entire scene used to mask out pixels.
 
MaterialPassClassm_heatVisionMaterialPass
 Custom render passed applied on top of objects with heatvision effect.
 
MaterialPassClassm_heatVisionOnlyPass
 Custom render pass applied in place of regular pass on objects with heat vision effect.
 
MaterialPassClassm_frenzyMaterialPass
 
MaterialPassClassm_occludedMaterialPass [MAX_PLAYER_COUNT]
 Custom rendering passes for each possible player color on the map.
 
CustomScenePassModes m_customPassMode
 flag used to force a non-standard rendering of scene.
 
Int m_translucentObjectsCount
 number of translucent objects to render this frame.
 
RenderObjClass ** m_translucentObjectsBuffer
 queue of current frame's translucent objects.
 
Int m_occludedObjectsCount
 number of objects in current frame that need special rendering because occluded.
 
RenderObjClass ** m_potentialOccluders
 objects which may block other objects from being visible
 
RenderObjClass ** m_potentialOccludees
 objects which may be blocked from visibility by other objects.
 
RenderObjClass ** m_nonOccludersOrOccludees
 objects which are neither bockers or blockees (small rocks, shrubs, etc.).
 
Int m_numPotentialOccluders
 
Int m_numPotentialOccludees
 
Int m_numNonOccluderOrOccludee
 
CameraClassm_camera
 
- Protected Attributes inherited from SimpleSceneClass
bool Visibility_Checked
 
RefRenderObjListClass RenderList
 
RefRenderObjListClass UpdateList
 
RefRenderObjListClass LightList
 
RefRenderObjListClass ReleaseList
 
- Protected Attributes inherited from SceneClass
Vector3 AmbientLight
 
PolyRenderType PolyRenderMode
 
ExtraPassPolyRenderType ExtraPassPolyRenderMode
 
bool FogEnabled
 
Vector3 FogColor
 
float FogStart
 
float FogEnd
 
- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Additional Inherited Members

- Public Types inherited from SceneClass
enum  { SCENE_ID_UNKOWN = 0xFFFFFFFF , SCENE_ID_SCENE = 0 , SCENE_ID_SIMPLE , SCENE_ID_LAST = 0x0000FFFF }
 
enum  PolyRenderType { POINT , LINE , FILL }
 
enum  ExtraPassPolyRenderType { EXTRA_PASS_DISABLE , EXTRA_PASS_LINE , EXTRA_PASS_CLEAR_LINE }
 
enum  RegType { ON_FRAME_UPDATE = 0 , LIGHT , RELEASE }
 
- 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 RefCountClass
static RefCountListClass ActiveRefList
 

Detailed Description

Scene management for 3D RTS game

Definition at line 61 of file W3DScene.h.

Constructor & Destructor Documentation

◆ RTS3DScene()

RTS3DScene::RTS3DScene ( )

RTSScene constructor.

Definition at line 95 of file W3DScene.cpp.

◆ ~RTS3DScene()

RTS3DScene::~RTS3DScene ( )

RTSScene desctructor.

Definition at line 201 of file W3DScene.cpp.

Member Function Documentation

◆ addDynamicLight()

void RTS3DScene::addDynamicLight ( W3DDynamicLight * obj)

Lighting methods.

Adds a dynamic light.

Definition at line 1665 of file W3DScene.cpp.

◆ castRay()

Bool RTS3DScene::castRay ( RayCollisionTestClass & raytest,
Bool testAll,
Int collisionType )

ray picking against objects in scene

Does a ray intersection test against objects in our scene. By default, it only tests objects determined to be visible to the user. Setting testAll forces it to test all objects in the scene. CollisionType is used as a mask to ignore certain types of objects.

Definition at line 321 of file W3DScene.cpp.

◆ createLightsIterator()

RefRenderObjListIterator * RTS3DScene::createLightsIterator ( void )

Returns an iterator of the lights in the scene.

Definition at line 1642 of file W3DScene.cpp.

◆ Customized_Render()

void RTS3DScene::Customized_Render ( RenderInfoClass & rinfo)
virtual

customizable renderer for the RTS3DScene

Custom render method for the RTS3DScene, custom render properties for our particular game go here

Reimplemented from SimpleSceneClass.

Definition at line 1081 of file W3DScene.cpp.

◆ destroyLightsIterator()

void RTS3DScene::destroyLightsIterator ( RefRenderObjListIterator * it)

Destroys the iterator returned by createLightsIterator.

Definition at line 1654 of file W3DScene.cpp.

◆ doRender()

void RTS3DScene::doRender ( CameraClass * cam)

Render the scene

Definition at line 1710 of file W3DScene.cpp.

◆ draw()

void RTS3DScene::draw ( void )
virtual

Customized render for the 2d scene management

Reimplemented from SubsystemInterface.

Definition at line 1723 of file W3DScene.cpp.

◆ drawTerrainOnly()

void RTS3DScene::drawTerrainOnly ( Bool draw)
inline

Drawing control method.

Definition at line 82 of file W3DScene.h.

◆ flagOccludedObjects()

void RTS3DScene::flagOccludedObjects ( CameraClass * camera)
protected

Find all objects which need to be drawn in a special way because they are occluded by other objects.

Todo
: Need some kind of scene subdivision or find way to use Partition manger to speed up the ray intersection tests. Maybe truncate the ray to terrain length before using it?

Definition at line 250 of file W3DScene.cpp.

◆ Flush()

void RTS3DScene::Flush ( RenderInfoClass & rinfo)

Draw everything that was submitted from this scene

Definition at line 833 of file W3DScene.cpp.

◆ flushOccludedObjects()

void RTS3DScene::flushOccludedObjects ( RenderInfoClass & rinfo)
protected
Todo
: Optimize this so that the extra passes don't actually install the material since it's all the same.

Definition at line 1534 of file W3DScene.cpp.

◆ flushOccludedObjectsIntoStencil()

void RTS3DScene::flushOccludedObjectsIntoStencil ( RenderInfoClass & rinfo)
protected

<color assigned to each of the visible players

Definition at line 1326 of file W3DScene.cpp.

◆ flushTranslucentObjects()

void RTS3DScene::flushTranslucentObjects ( RenderInfoClass & rinfo)
protected

Definition at line 1605 of file W3DScene.cpp.

◆ getADynamicLight()

W3DDynamicLight * RTS3DScene::getADynamicLight ( void )

Adds a dynamic light.

Definition at line 1676 of file W3DScene.cpp.

◆ getCustomPassMode()

CustomScenePassModes RTS3DScene::getCustomPassMode ( void )
inline

Definition at line 78 of file W3DScene.h.

◆ getDefaultLightEnv()

LightEnvironmentClass & RTS3DScene::getDefaultLightEnv ( void )
inline

Definition at line 95 of file W3DScene.h.

◆ getDynamicLights()

RefRenderObjListClass * RTS3DScene::getDynamicLights ( void )
inline

Definition at line 92 of file W3DScene.h.

◆ init()

void RTS3DScene::init ( )
inlinevirtual
  • Assign any default values to data required for the class
    • Allocate any memory and resources needed throughout the lifetime of the class

Implements SubsystemInterface.

Definition at line 97 of file W3DScene.h.

◆ removeDynamicLight()

void RTS3DScene::removeDynamicLight ( W3DDynamicLight * obj)

Removes a dynamic light.

Definition at line 1700 of file W3DScene.cpp.

◆ Render()

void RTS3DScene::Render ( RenderInfoClass & rinfo)
virtual
Todo
: this probably doesn't need to be done each frame.
Todo
: Clearing to black may not be needed if the scene already did the clear.
Todo
: Clearing to black may not be needed if the scene already did the clear.

Reimplemented from SceneClass.

Definition at line 952 of file W3DScene.cpp.

◆ renderOneObject()

void RTS3DScene::renderOneObject ( RenderInfoClass & rinfo,
RenderObjClass * robj,
Int localPlayerIndex )
protected

Renders a single drawable entity.

Definition at line 577 of file W3DScene.cpp.

◆ renderSpecificDrawables()

void RTS3DScene::renderSpecificDrawables ( RenderInfoClass & rinfo,
Int numDrawable,
Drawable ** theDrawables )

Drawing control method.

Renders a single drawable entity.

Definition at line 538 of file W3DScene.cpp.

◆ reset()

void RTS3DScene::reset ( )
inlinevirtual
  • Any system should be able to reset all data and go back to an empty state that is ready to accept a completely new set of data. Reset() can expect to be used in the context of resetting the engine in order to start or load a new game.
    • Do NOT free and re-allocate resources needed, where possible reorganize and re-initialize the resources already allocated.
    • After a reset, the system does not need to be in EXACTLY the same state as a fresh instantiation. If there are persistent state information for the system make sure you maintain it while restoring or re-initializing other transient parts.

Implements SubsystemInterface.

Definition at line 100 of file W3DScene.h.

◆ setCustomPassMode()

void RTS3DScene::setCustomPassMode ( CustomScenePassModes mode)
inline

Definition at line 77 of file W3DScene.h.

◆ setGlobalLight()

void RTS3DScene::setGlobalLight ( LightClass * pLight,
Int lightIndex = 0 )

Definition at line 238 of file W3DScene.cpp.

◆ update()

void RTS3DScene::update ( )
inlinevirtual
  • Update methods are the place to do system per frame processing. You should call the system update once each time through the game loop to service the system.
    • Note that currently the GameClient and GameLogic will be updating at different rates where the logic is running real time, and the client will adjust how many loops can be done during one server time slice in order to improve performance on low end machines.

Implements SubsystemInterface.

Definition at line 98 of file W3DScene.h.

◆ updateFixedLightEnvironments()

void RTS3DScene::updateFixedLightEnvironments ( RenderInfoClass & rinfo)
protected

Generate a predefined light environment(s) that will be applied to many objects. Useful for things like totally fogged objects and most generaic map objects that are not lit by dynamic lights.

Definition at line 876 of file W3DScene.cpp.

◆ updatePlayerColorPasses()

void RTS3DScene::updatePlayerColorPasses ( void )
protected

Generate custom rendering passes for each potential player color. This is currently only used to render occluded objects using the color of the player

Definition at line 925 of file W3DScene.cpp.

◆ Visibility_Check()

void RTS3DScene::Visibility_Check ( CameraClass * camera)
virtual

Custom visibility check method for the RTS3DScene, we can put optimized culling methods in here

Todo
: Have better flag to detect reflection pass
Todo
: We're not using LOD yet so I disabled this code. MW

Reimplemented from SimpleSceneClass.

Definition at line 394 of file W3DScene.cpp.

Member Data Documentation

◆ m_camera

CameraClass* RTS3DScene::m_camera
protected

Definition at line 141 of file W3DScene.h.

◆ m_customPassMode

CustomScenePassModes RTS3DScene::m_customPassMode
protected

flag used to force a non-standard rendering of scene.

Definition at line 130 of file W3DScene.h.

◆ m_defaultLightEnv

LightEnvironmentClass RTS3DScene::m_defaultLightEnv
protected

default light environment applied to objects without custom/dynamic lighting.

Definition at line 120 of file W3DScene.h.

◆ m_drawTerrainOnly

Bool RTS3DScene::m_drawTerrainOnly
protected

Definition at line 114 of file W3DScene.h.

◆ m_dynamicLightList

RefRenderObjListClass RTS3DScene::m_dynamicLightList
protected

Definition at line 113 of file W3DScene.h.

◆ m_foggedLightEnv

LightEnvironmentClass RTS3DScene::m_foggedLightEnv
protected

default light environment applied to objects without custom/dynamic lighting.

Definition at line 121 of file W3DScene.h.

◆ m_frenzyMaterialPass

MaterialPassClass* RTS3DScene::m_frenzyMaterialPass
protected

Custom render pass applied in place of regular pass on objects with FRENZY effect.

Definition at line 127 of file W3DScene.h.

◆ m_globalLight

LightClass* RTS3DScene::m_globalLight[LightEnvironmentClass::MAX_LIGHTS]
protected

The global directional light (sun, moon) Applies to objects.

Definition at line 115 of file W3DScene.h.

◆ m_heatVisionMaterialPass

MaterialPassClass* RTS3DScene::m_heatVisionMaterialPass
protected

Custom render passed applied on top of objects with heatvision effect.

Definition at line 125 of file W3DScene.h.

◆ m_heatVisionOnlyPass

MaterialPassClass* RTS3DScene::m_heatVisionOnlyPass
protected

Custom render pass applied in place of regular pass on objects with heat vision effect.

Definition at line 126 of file W3DScene.h.

◆ m_infantryAmbient

Vector3 RTS3DScene::m_infantryAmbient
protected

scene ambient modified to make infantry easier to see

Definition at line 117 of file W3DScene.h.

◆ m_infantryLight

LightClass* RTS3DScene::m_infantryLight[LightEnvironmentClass::MAX_LIGHTS]
protected

The global direction light modified to make infantry easier to see.

Definition at line 118 of file W3DScene.h.

◆ m_maskMaterialPass

W3DMaskMaterialPassClass* RTS3DScene::m_maskMaterialPass
protected

Custom render pass applied to entire scene used to mask out pixels.

Definition at line 124 of file W3DScene.h.

◆ m_nonOccludersOrOccludees

RenderObjClass** RTS3DScene::m_nonOccludersOrOccludees
protected

objects which are neither bockers or blockees (small rocks, shrubs, etc.).

Definition at line 136 of file W3DScene.h.

◆ m_numGlobalLights

Int RTS3DScene::m_numGlobalLights
protected

number of global lights

Definition at line 119 of file W3DScene.h.

◆ m_numNonOccluderOrOccludee

Int RTS3DScene::m_numNonOccluderOrOccludee
protected

Definition at line 139 of file W3DScene.h.

◆ m_numPotentialOccludees

Int RTS3DScene::m_numPotentialOccludees
protected

Definition at line 138 of file W3DScene.h.

◆ m_numPotentialOccluders

Int RTS3DScene::m_numPotentialOccluders
protected

Definition at line 137 of file W3DScene.h.

◆ m_occludedMaterialPass

MaterialPassClass* RTS3DScene::m_occludedMaterialPass[MAX_PLAYER_COUNT]
protected

Custom rendering passes for each possible player color on the map.

Definition at line 129 of file W3DScene.h.

◆ m_occludedObjectsCount

Int RTS3DScene::m_occludedObjectsCount
protected

number of objects in current frame that need special rendering because occluded.

Definition at line 133 of file W3DScene.h.

◆ m_potentialOccludees

RenderObjClass** RTS3DScene::m_potentialOccludees
protected

objects which may be blocked from visibility by other objects.

Definition at line 135 of file W3DScene.h.

◆ m_potentialOccluders

RenderObjClass** RTS3DScene::m_potentialOccluders
protected

objects which may block other objects from being visible

Definition at line 134 of file W3DScene.h.

◆ m_scratchLight

LightClass* RTS3DScene::m_scratchLight
protected

a workspace for copying global lights and modifying // MLorenzen

Definition at line 116 of file W3DScene.h.

◆ m_shroudMaterialPass

W3DShroudMaterialPassClass* RTS3DScene::m_shroudMaterialPass
protected

Custom render pass which applies shrouds to objects.

Definition at line 123 of file W3DScene.h.

◆ m_translucentObjectsBuffer

RenderObjClass** RTS3DScene::m_translucentObjectsBuffer
protected

queue of current frame's translucent objects.

Definition at line 132 of file W3DScene.h.

◆ m_translucentObjectsCount

Int RTS3DScene::m_translucentObjectsCount
protected

number of translucent objects to render this frame.

Definition at line 131 of file W3DScene.h.


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