Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
decalmsh.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:: /Commando/Code/ww3d2/decalmsh.h $*
26 * *
27 * Original Author:: Greg Hjelstrom *
28 * *
29 * $Author:: Jani_p $*
30 * *
31 * $Modtime:: 11/24/01 6:18p $*
32 * *
33 * $Revision:: 7 $*
34 * *
35 *---------------------------------------------------------------------------------------------*
36 * Functions: *
37 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38
39#if defined(_MSC_VER)
40#pragma once
41#endif
42
43#ifndef DECALMSH_H
44#define DECALMSH_H
45
46#include "always.h"
47#include "bittype.h"
48#include "simplevec.h"
49#include "vector.h"
50#include "vector2.h"
51#include "vector3.h"
52#include "vector3i.h"
53#include "vector4.h"
54#include "shader.h"
55#include "vertmaterial.h"
56#include "meshgeometry.h"
57
58class MeshClass;
59class RenderInfoClass;
62class OBBoxClass;
63class TextureClass;
64
78
80{
81public:
82
83 DecalMeshClass(MeshClass * parent,DecalSystemClass * system);
84 virtual ~DecalMeshClass(void);
85
86 // world_vertex_locs and world_vertex_norms are dynamically updated worldspace vertex data
87 // which are used by some decal types which cannot use static object geometry (such as decals
88 // for skins, procedurally generated meshes, etc.)
89
90 virtual void Render(void) = 0;
91
92 virtual bool Create_Decal( DecalGeneratorClass * generator,
93 const OBBoxClass & localbox,
95 const DynamicVectorClass<Vector3> * world_vertex_locs = 0) = 0;
96
97 virtual bool Delete_Decal(uint32 id) = 0;
98
99 virtual int Decal_Count(void) = 0;
100 virtual uint32 Get_Decal_ID(int decal_index) = 0;
101
102 MeshClass * Peek_Parent(void);
104
107
108protected:
109
110 /*
111 ** Members
112 */
116};
117
118
119/*
120** RigidDecalMeshClass: a concrete class derived from DecalMeshClass which is
121** used for decals on rigid (non-skin) meshes.
122*/
123
125{
126public:
127
129 virtual ~RigidDecalMeshClass(void);
130
131 // Rigid decal meshes have static geometry so they do not use world_vertex_locs/norms
132
133 virtual void Render(void);
134
135 virtual bool Create_Decal( DecalGeneratorClass * generator,
136 const OBBoxClass & localbox,
138 const DynamicVectorClass<Vector3> * world_vertex_locs = 0);
139
140 virtual bool Delete_Decal(uint32 id);
141
142 int Decal_Count(void);
143 uint32 Get_Decal_ID(int decal_index);
144
145protected:
146
147 int Process_Material_Run(int start_index);
148
149 /*
150 ** Connectivity
151 */
153
154 /*
155 ** Geometry
156 */
159
160 /*
161 ** Materials
162 */
167
168 /*
169 ** Decal Organization
170 */
179
181};
182
183
184/*
185** SkinDecalMeshClass: a concrete class derived from DecalMeshClass which is
186** used for decals on skin meshes.
187*/
188
190{
191public:
192
194 virtual ~SkinDecalMeshClass(void);
195
196 // Skin decals use world_vertex_locs/norms since they cannot use static geometry
197
198 virtual void Render(void);
199
200 virtual bool Create_Decal( DecalGeneratorClass * generator,
201 const OBBoxClass & localbox,
203 const DynamicVectorClass<Vector3> * world_vertex_locs);
204
205 virtual bool Delete_Decal(uint32 id);
206
207 int Decal_Count(void);
208 uint32 Get_Decal_ID(int decal_index);
209
210protected:
211
212 int Process_Material_Run(int start_index);
213
214 /*
215 ** Connectivity
216 */
218
219 /*
220 ** Indirected vertex indices (for copying dynamically updated mesh geometry)
221 */
223
224 /*
225 ** Materials
226 */
231
232 /*
233 ** Decal Organization
234 */
243
245};
246
247
248/*
249** DecalMeshClass inline functions
250*/
251
253{
254 return Parent;
255}
256
258{
259 return DecalSystem;
260}
261
262
263/*
264** RigidDecalMeshClass inline functions
265*/
266
268{
269 return Decals.Count();
270}
271
273{
274 return Decals[decal_index].DecalID;
275}
276
277
278/*
279** SkinDecalMeshClass inline functions
280*/
281
283{
284 return Decals.Count();
285}
286
288{
289 return Decals[decal_index].DecalID;
290}
291
292
293#endif //DECALMSH_H
294
unsigned short uint16
Definition bittype.h:45
unsigned long uint32
Definition bittype.h:46
virtual int Decal_Count(void)=0
virtual uint32 Get_Decal_ID(int decal_index)=0
DecalMeshClass * Peek_Next_Visible(void)
Definition decalmsh.h:105
DecalSystemClass * DecalSystem
Definition decalmsh.h:114
virtual bool Delete_Decal(uint32 id)=0
virtual void Render(void)=0
MeshClass * Parent
Definition decalmsh.h:113
MeshClass * Peek_Parent(void)
Definition decalmsh.h:252
DecalSystemClass * Peek_System(void)
Definition decalmsh.h:257
virtual ~DecalMeshClass(void)
Definition decalmsh.cpp:219
DecalMeshClass(MeshClass *parent, DecalSystemClass *system)
Definition decalmsh.cpp:198
void Set_Next_Visible(DecalMeshClass *mesh)
Definition decalmsh.h:106
DecalMeshClass * NextVisible
Definition decalmsh.h:115
virtual bool Create_Decal(DecalGeneratorClass *generator, const OBBoxClass &localbox, SimpleDynVecClass< uint32 > &apt, const DynamicVectorClass< Vector3 > *world_vertex_locs=0)=0
RefCountClass(void)
Definition refcount.h:108
virtual ~RigidDecalMeshClass(void)
Definition decalmsh.cpp:259
SimpleDynVecClass< Vector3 > Verts
Definition decalmsh.h:157
virtual bool Create_Decal(DecalGeneratorClass *generator, const OBBoxClass &localbox, SimpleDynVecClass< uint32 > &apt, const DynamicVectorClass< Vector3 > *world_vertex_locs=0)
Definition decalmsh.cpp:415
virtual void Render(void)
Definition decalmsh.cpp:292
SimpleDynVecClass< ShaderClass > Shaders
Definition decalmsh.h:163
SimpleDynVecClass< VertexMaterialClass * > VertexMaterials
Definition decalmsh.h:165
SimpleDynVecClass< TriIndex > Polys
Definition decalmsh.h:152
uint32 Get_Decal_ID(int decal_index)
Definition decalmsh.h:272
RigidDecalMeshClass(MeshClass *parent, DecalSystemClass *system)
Definition decalmsh.cpp:241
SimpleDynVecClass< DecalStruct > Decals
Definition decalmsh.h:180
SimpleDynVecClass< Vector2 > TexCoords
Definition decalmsh.h:166
int Decal_Count(void)
Definition decalmsh.h:267
SimpleDynVecClass< Vector3 > VertNorms
Definition decalmsh.h:158
virtual bool Delete_Decal(uint32 id)
Definition decalmsh.cpp:620
int Process_Material_Run(int start_index)
Definition decalmsh.cpp:384
SimpleDynVecClass< TextureClass * > Textures
Definition decalmsh.h:164
virtual ~SkinDecalMeshClass(void)
Definition decalmsh.cpp:742
SimpleDynVecClass< VertexMaterialClass * > VertexMaterials
Definition decalmsh.h:229
SimpleDynVecClass< ShaderClass > Shaders
Definition decalmsh.h:227
virtual bool Delete_Decal(uint32 id)
SimpleDynVecClass< uint32 > ParentVertexIndices
Definition decalmsh.h:222
SimpleDynVecClass< DecalStruct > Decals
Definition decalmsh.h:244
virtual void Render(void)
Definition decalmsh.cpp:775
int Decal_Count(void)
Definition decalmsh.h:282
SimpleDynVecClass< TextureClass * > Textures
Definition decalmsh.h:228
uint32 Get_Decal_ID(int decal_index)
Definition decalmsh.h:287
virtual bool Create_Decal(DecalGeneratorClass *generator, const OBBoxClass &localbox, SimpleDynVecClass< uint32 > &apt, const DynamicVectorClass< Vector3 > *world_vertex_locs)
Definition decalmsh.cpp:913
SimpleDynVecClass< Vector2 > TexCoords
Definition decalmsh.h:230
int Process_Material_Run(int start_index)
Definition decalmsh.cpp:882
SkinDecalMeshClass(MeshClass *parent, DecalSystemClass *system)
Definition decalmsh.cpp:724
SimpleDynVecClass< TriIndex > Polys
Definition decalmsh.h:217