Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
nodefilt.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/* $Header: /Commando/Code/Tools/max2w3d/nodefilt.cpp 9 1/16/98 10:34a Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando / G *
25 * *
26 * File Name : NODEFILT.CPP *
27 * *
28 * Programmer : Greg Hjelstrom *
29 * *
30 * Start Date : 06/09/97 *
31 * *
32 * Last Update : June 9, 1997 [GH] *
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * VisibleMeshINodeFilter::Accept_Node -- Accepts visible meshes *
37 * AnimatedINodeFilter::Accept_Node -- Accepts animated INodes *
38 * RootINodeFilter::Accept_Node -- Accepts root INodes *
39 * VisibleHelperINodeFilter::Accept_Node -- Accepts visible helper objects *
40 * VisibleMeshOrHelperINodeFilter::Accept_Node -- Accepts visible helper or mesh objects *
41 * HelperINodeFilter::Accept_Node -- Accepts all helper inodes (including hidden) *
42 * MeshINodeFilter::Accept_Node -- Accepts all mesh inodes (including hidden) *
43 * VisibleSelectedINodeFilter::Accept_Node -- Accepts Visible and selected inodes *
44 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
45
46
47#include "nodefilt.h"
48#include <istdplug.h>
49
50
51/*
52** The default node filter:
53*/
55
56
57/***********************************************************************************************
58 * HelperINodeFilter::Accept_Node -- Accepts all helper inodes (including hidden) *
59 * *
60 * INPUT: *
61 * *
62 * OUTPUT: *
63 * *
64 * WARNINGS: *
65 * *
66 * HISTORY: *
67 * 07/10/1997 GH : Created. *
68 *=============================================================================================*/
69BOOL HelperINodeFilter::Accept_Node(INode * node,TimeValue time)
70{
71 Object * obj = node->EvalWorldState(time).obj;
72
73 if (obj && obj->SuperClassID() == HELPER_CLASS_ID) {
74
75 return TRUE;
76
77 }
78
79 return FALSE;
80}
81
82
83/***********************************************************************************************
84 * MeshINodeFilter::Accept_Node -- Accepts all mesh inodes (including hidden) *
85 * *
86 * INPUT: *
87 * *
88 * OUTPUT: *
89 * *
90 * WARNINGS: *
91 * *
92 * HISTORY: *
93 * 07/10/1997 GH : Created. *
94 *=============================================================================================*/
95BOOL MeshINodeFilter::Accept_Node(INode * node,TimeValue time)
96{
97 Object * obj = node->EvalWorldState(time).obj;
98
99 if (obj &&
100 obj->CanConvertToType(triObjectClassID) &&
101 obj->SuperClassID() == GEOMOBJECT_CLASS_ID)
102 {
103
104 return TRUE;
105
106 } else {
107
108 return FALSE;
109
110 }
111}
112
113
114/***********************************************************************************************
115 * VisibleMeshINodeFilter::Accept_Node -- Accepts visible meshes *
116 * *
117 * Accepts nodes which: *
118 * - can be converted to tri-meshes *
119 * - are not hidden *
120 * - whose visibility > 0.0 *
121 * *
122 * INPUT: *
123 * *
124 * OUTPUT: *
125 * *
126 * WARNINGS: *
127 * *
128 * HISTORY: *
129 * 06/09/1997 GH : Created. *
130 *=============================================================================================*/
131BOOL VisibleMeshINodeFilter::Accept_Node(INode * node, TimeValue time)
132{
133 Object * obj = node->EvalWorldState(time).obj;
134
135 if
136 (
137 obj
138 && !node->IsHidden ()
139 && obj->CanConvertToType(triObjectClassID)
140 && obj->SuperClassID() == GEOMOBJECT_CLASS_ID
141// && node->GetVisibility (time) > 0.0f
142 )
143 {
144
145 return TRUE;
146
147 } else {
148
149 return FALSE;
150
151 }
152}
153
154/***********************************************************************************************
155 * VisibleHelperINodeFilter::Accept_Node -- Accepts visible helper objects *
156 * *
157 * INPUT: *
158 * *
159 * OUTPUT: *
160 * *
161 * WARNINGS: *
162 * *
163 * HISTORY: *
164 * 07/03/1997 GH : Created. *
165 *=============================================================================================*/
166BOOL VisibleHelperINodeFilter::Accept_Node(INode * node, TimeValue time)
167{
168 Object * obj = node->EvalWorldState(time).obj;
169
170 if ((!obj) || (node->IsHidden()) /*|| (node->GetVisibility(time) <= 0.0f)*/) {
171
172 return FALSE;
173
174 }
175
176 if (obj->SuperClassID() == HELPER_CLASS_ID) {
177
178 return TRUE;
179
180 }
181
182 return FALSE;
183}
184
185
186/***********************************************************************************************
187 * VisibleMeshOrHelperINodeFilter::Accept_Node -- Accepts visible helper or mesh objects *
188 * *
189 * INPUT: *
190 * *
191 * OUTPUT: *
192 * *
193 * WARNINGS: *
194 * *
195 * HISTORY: *
196 * 07/03/1997 GH : Created. *
197 *=============================================================================================*/
199{
200 Object * obj = node->EvalWorldState(time).obj;
201
202 if ((!obj) || (node->IsHidden()) /*|| (node->GetVisibility(time) <= 0.0f)*/) {
203
204 return FALSE;
205
206 }
207
208 if (obj->CanConvertToType(triObjectClassID) && obj->SuperClassID() == GEOMOBJECT_CLASS_ID) {
209
210 return TRUE;
211
212 }
213
214 if (obj->SuperClassID() == HELPER_CLASS_ID) {
215
216 return TRUE;
217
218 }
219
220 return FALSE;
221}
222
223/***********************************************************************************************
224 * AnimatedINodeFilter::Accept_Node -- Accepts animated INodes *
225 * *
226 * Accepts nodes which: *
227 * - can be converted to tri-meshes *
228 * - are not hidden *
229 * - whose visibility > 0.0 *
230 * - have animation keys! *
231 * *
232 * INPUT: *
233 * *
234 * OUTPUT: *
235 * *
236 * WARNINGS: *
237 * *
238 * HISTORY: *
239 * 06/09/1997 GH : Created. *
240 *=============================================================================================*/
241BOOL AnimatedINodeFilter::Accept_Node(INode * node, TimeValue time)
242{
243 Object * obj = node->EvalWorldState(time).obj;
244 Control * poscon = node->GetTMController()->GetPositionController();
245 Control * rotcon = node->GetTMController()->GetRotationController();
246
247 int numkeys = 0;
248 if (poscon != NULL) {
249 IKeyControl * poskeys = GetKeyControlInterface(poscon);
250 if (poskeys != NULL) numkeys += poskeys->GetNumKeys();
251 }
252
253 if (rotcon != NULL) {
254 IKeyControl * rotkeys = GetKeyControlInterface(rotcon);
255 if (rotkeys != NULL) numkeys += rotkeys->GetNumKeys();
256 }
257
258 if (obj && !node->IsHidden() && numkeys > 0) {
259 return TRUE;
260 }
261
262 return FALSE;
263}
264
265
266/***********************************************************************************************
267 * VisibleSelectedINodeFilter::Accept_Node -- Accepts Visible and selected inodes *
268 * *
269 * INPUT: *
270 * *
271 * OUTPUT: *
272 * *
273 * WARNINGS: *
274 * *
275 * HISTORY: *
276 * 1/13/98 GTH : Created. *
277 *=============================================================================================*/
279{
280 if (!node->IsHidden() && node->Selected()) {
281 return TRUE;
282 } else {
283 return FALSE;
284 }
285}
286
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
#define BOOL
Definition Wnd_File.h:57
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:241
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:69
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:95
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:166
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:131
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:198
virtual BOOL Accept_Node(INode *node, TimeValue time)
Definition nodefilt.cpp:278
VisibleMeshINodeFilter DefaultINodeFilter
Definition nodefilt.cpp:54