Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
cullsys.cpp
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 : WWMath *
24 * *
25 * $Archive:: /VSS_Sync/wwmath/cullsys.cpp $*
26 * *
27 * Author:: Greg Hjelstrom *
28 * *
29 * $Modtime:: 10/16/00 11:42a $*
30 * *
31 * $Revision:: 5 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#include "cullsys.h"
38#include "wwdebug.h"
39#include "wwprofile.h"
40
41
42/*************************************************************************
43**
44** CullableClass Implementation
45**
46*************************************************************************/
48 CullLink(NULL),
49 NextCollected(NULL)
50{
51 CullBox.Init(Vector3(0,0,0),Vector3(1,1,1));
52}
53
55{
56 // the cull system that contains us is responsible for any culling link
57 // so we better be out of it and it should have cleared our pointer before
58 // we are deleted.
59 WWASSERT(CullLink == NULL);
60}
61
62void CullableClass::Set_Cull_Box(const AABoxClass & box,bool just_loaded)
63{
64 CullBox = box;
65
66 WWPROFILE("Cullable::Set_Cull_Box");
67
68 // Just_loaded flag allows us to update the box without notifying the
69 // culling system. Use this when you've saved and loaded the linkage
70 // so you know you're in the right node of the culling system...
71 if (!just_loaded) {
73 if (sys != NULL) {
74 sys->Update_Culling(this);
75 }
76 }
77}
78
80{
81 if (CullLink) {
82 CullLink->Set_Culling_System(sys);
83 }
84}
85
87{
88 if (CullLink) {
89 return CullLink->Get_Culling_System();
90 }
91 return NULL;
92}
93
94
95/*************************************************************************
96**
97** CullSystemClass Implementation
98**
99** The base CullSystemClass mainly contains code for maintaining the
100** current collection list and iterating through it.
101**
102*************************************************************************/
107
111
112// NOTE: THE Get_() functions currently are the same as the Peek_() functions (e.g., they do not
113// add a Ref). This is wrong and will be fixed.
118
120{
121 if (obj != NULL) {
122 return obj->NextCollected;
123 }
124 return NULL;
125}
126
131
133{
134 if (obj != NULL) {
135 return obj->NextCollected;
136 }
137 return NULL;
138}
139
144
146{
147 WWASSERT(obj != NULL);
148 obj->NextCollected = CollectionHead;
149 CollectionHead = obj;
150}
151
152
153
154
#define NULL
Definition BaseType.h:92
#define WWASSERT
CullableClass * Get_Next_Collected_Object_Internal(CullableClass *obj)
Definition cullsys.cpp:119
virtual void Update_Culling(CullableClass *obj)=0
void Reset_Collection(void)
Definition cullsys.cpp:140
CullableClass * Get_First_Collected_Object_Internal(void)
Definition cullsys.cpp:114
friend class CullableClass
Definition cullsys.h:197
CullableClass * Peek_First_Collected_Object_Internal(void)
Definition cullsys.cpp:127
void Add_To_Collection(CullableClass *obj)
Definition cullsys.cpp:145
virtual ~CullSystemClass(void)
Definition cullsys.cpp:108
CullSystemClass(void)
Definition cullsys.cpp:103
CullableClass * Peek_Next_Collected_Object_Internal(CullableClass *obj)
Definition cullsys.cpp:132
CullableClass * CollectionHead
Definition cullsys.h:195
void Set_Culling_System(CullSystemClass *sys)
Definition cullsys.cpp:79
void Set_Cull_Box(const AABoxClass &box, bool just_loaded=false)
Definition cullsys.cpp:62
friend class CullSystemClass
Definition cullsys.h:140
virtual ~CullableClass(void)
Definition cullsys.cpp:54
CullableClass(void)
Definition cullsys.cpp:47
CullSystemClass * Get_Culling_System(void) const
Definition cullsys.cpp:86
#define WWPROFILE(name)
Definition wwprofile.h:270