Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
scene.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : WW3D *
24 * *
25 * $Archive:: /VSS_Sync/ww3d2/scene.h $*
26 * *
27 * $Author:: Vss_sync $*
28 * *
29 * $Modtime:: 8/29/01 7:29p $*
30 * *
31 * $Revision:: 10 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37
38#if defined(_MSC_VER)
39#pragma once
40#endif
41
42#ifndef SCENE_H
43#define SCENE_H
44
45#include "always.h"
46#include "refcount.h"
47#include "vector3.h"
48#include "robjlist.h"
49#include "wwdebug.h"
50
51class RenderObjClass;
52class RenderInfoClass;
53class CameraClass;
54class ChunkLoadClass;
55class ChunkSaveClass;
56
57/*
58** SceneIterator
59** This object is used to iterate through the render objects
60** in a scene.
61*/
63{
64public:
65
66 virtual ~SceneIterator(void) { };
67 virtual void First(void) = 0;
68 virtual void Next(void) = 0;
69 virtual bool Is_Done(void) = 0;
70 virtual RenderObjClass * Current_Item(void) = 0;
71
72protected:
73
74 SceneIterator(void) { };
75};
76
77
95{
96public:
97 SceneClass(void);
98 virtual ~SceneClass(void);
99
101 // RTTI information.
103 enum {
104 SCENE_ID_UNKOWN = 0xFFFFFFFF,
107
108 SCENE_ID_LAST = 0x0000FFFF,
109 };
110 virtual int Get_Scene_ID(void) const { return SCENE_ID_SCENE; }
111
112
113 virtual void Add_Render_Object(RenderObjClass * obj);
114 virtual void Remove_Render_Object(RenderObjClass * obj);
115
116 virtual SceneIterator * Create_Iterator(bool onlyvisible = false) = 0;
117 virtual void Destroy_Iterator(SceneIterator * it) = 0;
118
119 virtual void Set_Ambient_Light(const Vector3 & color) { AmbientLight = color; }
120 virtual const Vector3 & Get_Ambient_Light(void) { return AmbientLight; }
121
123 // Fog methods
125 virtual void Set_Fog_Enable(bool set) { FogEnabled = set; }
126 virtual bool Get_Fog_Enable(void) { return FogEnabled; }
127
128 virtual void Set_Fog_Color(const Vector3 & color) { FogColor = color; }
129 virtual const Vector3 & Get_Fog_Color(void) { return FogColor; }
130
131 virtual void Set_Fog_Range( float start, float end ) { FogStart = start; FogEnd = end; }
132 virtual void Get_Fog_Range( float * start, float * end ) { *start = FogStart; *end = FogEnd; }
133
135 // Render Modes
143
146
148 // Second pass render mode is a debug feature which renders the whole scene twice.
156
159
161 // Object processing registration
169
170 virtual void Register(RenderObjClass * obj,RegType for_what) = 0;
171 virtual void Unregister(RenderObjClass * obj,RegType for_what) = 0;
172
174 // Point visibility - used by DazzleRenderObj when no custom handler is installed
177 const Vector3 & point) { return 1.0f; }
178
179
181 // Save-Load, records the fog, depth cue, etc settings into a chunk
183 virtual void Save(ChunkSaveClass & csave);
184 virtual void Load(ChunkLoadClass & cload);
185
186protected:
187 virtual void Render(RenderInfoClass & rinfo); //Made virtual so we can override -MW
188
192
195 float FogStart;
196 float FogEnd;
197
198 friend class WW3D;
199
200 /*
201 ** Not implemented!
202 */
205
206private:
207 virtual void Customized_Render(RenderInfoClass & rinfo)=0;
208 virtual void Pre_Render_Processing(RenderInfoClass & rinfo) {}
209 virtual void Post_Render_Processing(RenderInfoClass & rinfo) {}
210
211};
212
224{
225public:
226
227 SimpleSceneClass(void);
228 virtual ~SimpleSceneClass(void);
229
230 virtual int Get_Scene_ID(void) { return SCENE_ID_SIMPLE; }
231
232 virtual void Add_Render_Object(RenderObjClass * obj);
233 virtual void Remove_Render_Object(RenderObjClass * obj);
234
235 virtual void Remove_All_Render_Objects(void);
236
237 virtual void Register(RenderObjClass * obj,RegType for_what);
238 virtual void Unregister(RenderObjClass * obj,RegType for_what);
239
240 virtual SceneIterator * Create_Iterator(bool onlyvisible = false);
241 virtual void Destroy_Iterator(SceneIterator * it);
242
243 // Set visibility status for my render objects. If not called explicitly
244 // beforehand, will be called inside Render().
245 virtual void Visibility_Check(CameraClass * camera);
246
248 // Point visibility - used by DazzleRenderObj when no custom handler is installed
250 virtual float Compute_Point_Visibility( RenderInfoClass & rinfo,
251 const Vector3 & point);
252
253protected:
254
255 // Has a visibility check been performed since scene was last rendered?
257
262
264
265 virtual void Customized_Render(RenderInfoClass & rinfo);
266 virtual void Post_Render_Processing(RenderInfoClass& rinfo);
267};
268
269#endif
RefCountClass(void)
Definition refcount.h:108
virtual const Vector3 & Get_Ambient_Light(void)
Definition scene.h:120
ExtraPassPolyRenderType
Definition scene.h:151
@ EXTRA_PASS_CLEAR_LINE
Definition scene.h:154
@ EXTRA_PASS_LINE
Definition scene.h:153
@ EXTRA_PASS_DISABLE
Definition scene.h:152
virtual void Set_Fog_Enable(bool set)
Definition scene.h:125
float FogEnd
Definition scene.h:196
virtual void Load(ChunkLoadClass &cload)
Definition scene.cpp:286
bool FogEnabled
Definition scene.h:193
virtual void Register(RenderObjClass *obj, RegType for_what)=0
Vector3 AmbientLight
Definition scene.h:189
@ SCENE_ID_SIMPLE
Definition scene.h:106
@ SCENE_ID_UNKOWN
Definition scene.h:104
@ SCENE_ID_SCENE
Definition scene.h:105
@ SCENE_ID_LAST
Definition scene.h:108
virtual int Get_Scene_ID(void) const
Definition scene.h:110
virtual void Get_Fog_Range(float *start, float *end)
Definition scene.h:132
float FogStart
Definition scene.h:195
void Set_Polygon_Mode(PolyRenderType mode)
Definition scene.h:144
SceneClass & operator==(const SceneClass &)
virtual void Add_Render_Object(RenderObjClass *obj)
Definition scene.cpp:173
virtual SceneIterator * Create_Iterator(bool onlyvisible=false)=0
virtual void Render(RenderInfoClass &rinfo)
Definition scene.cpp:213
virtual void Save(ChunkSaveClass &csave)
Definition scene.cpp:262
virtual bool Get_Fog_Enable(void)
Definition scene.h:126
ExtraPassPolyRenderType Get_Extra_Pass_Polygon_Mode(void)
Definition scene.h:158
virtual void Set_Ambient_Light(const Vector3 &color)
Definition scene.h:119
virtual ~SceneClass(void)
Definition scene.cpp:152
virtual void Destroy_Iterator(SceneIterator *it)=0
virtual const Vector3 & Get_Fog_Color(void)
Definition scene.h:129
Vector3 FogColor
Definition scene.h:194
PolyRenderType
Definition scene.h:138
void Set_Extra_Pass_Polygon_Mode(ExtraPassPolyRenderType mode)
Definition scene.h:157
@ ON_FRAME_UPDATE
Definition scene.h:165
@ RELEASE
Definition scene.h:167
virtual void Remove_Render_Object(RenderObjClass *obj)
Definition scene.cpp:195
ExtraPassPolyRenderType ExtraPassPolyRenderMode
Definition scene.h:191
virtual float Compute_Point_Visibility(RenderInfoClass &rinfo, const Vector3 &point)
Definition scene.h:176
virtual void Set_Fog_Range(float start, float end)
Definition scene.h:131
PolyRenderType Get_Polygon_Mode(void)
Definition scene.h:145
SceneClass(const SceneClass &)
virtual void Set_Fog_Color(const Vector3 &color)
Definition scene.h:128
SceneClass(void)
Definition scene.cpp:128
friend class WW3D
Definition scene.h:198
virtual void Unregister(RenderObjClass *obj, RegType for_what)=0
PolyRenderType PolyRenderMode
Definition scene.h:190
virtual void Next(void)=0
virtual RenderObjClass * Current_Item(void)=0
virtual void First(void)=0
virtual ~SceneIterator(void)
Definition scene.h:66
virtual bool Is_Done(void)=0
SceneIterator(void)
Definition scene.h:74
virtual float Compute_Point_Visibility(RenderInfoClass &rinfo, const Vector3 &point)
Definition scene.cpp:497
virtual void Remove_All_Render_Objects(void)
Definition scene.cpp:361
virtual void Post_Render_Processing(RenderInfoClass &rinfo)
Definition scene.cpp:619
SimpleSceneClass(void)
Definition scene.cpp:323
virtual ~SimpleSceneClass(void)
Definition scene.cpp:341
virtual void Destroy_Iterator(SceneIterator *it)
Definition scene.cpp:671
virtual void Add_Render_Object(RenderObjClass *obj)
Definition scene.cpp:382
virtual SceneIterator * Create_Iterator(bool onlyvisible=false)
Definition scene.cpp:652
virtual void Remove_Render_Object(RenderObjClass *obj)
Definition scene.cpp:401
virtual void Unregister(RenderObjClass *obj, RegType for_what)
Definition scene.cpp:425
RefRenderObjListClass UpdateList
Definition scene.h:259
virtual void Register(RenderObjClass *obj, RegType for_what)
Definition scene.cpp:410
virtual void Customized_Render(RenderInfoClass &rinfo)
Definition scene.cpp:535
virtual void Visibility_Check(CameraClass *camera)
Definition scene.cpp:455
RefRenderObjListClass LightList
Definition scene.h:260
friend class SimpleSceneIterator
Definition scene.h:263
bool Visibility_Checked
Definition scene.h:256
RefRenderObjListClass ReleaseList
Definition scene.h:261
RefRenderObjListClass RenderList
Definition scene.h:258
virtual int Get_Scene_ID(void)
Definition scene.h:230
RefMultiListClass< RenderObjClass > RefRenderObjListClass
Definition robjlist.h:59