Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
shdmesh.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 : WWShade *
24 * *
25 * $Archive:: wwshade/shdmesh.h $*
26 * *
27 * Org Author:: Jani P *
28 * *
29 * Author : Kenny Mitchell *
30 * *
31 * $Modtime:: 07/12/02 10:31a $*
32 * *
33 * $Revision:: 2 $*
34 * *
35 * 07/12/02 KM Removed legacy mesh conversion *
36 *---------------------------------------------------------------------------------------------*
37 *---------------------------------------------------------------------------------------------*/
38
39#ifndef SHDMESH_H
40#define SHDMESH_H
41
42#include "rendobj.h"
43#include "wwstring.h"
44#include "simplevec.h"
45#include "w3derr.h"
46#include "matrix4.h"
47
48class ChunkLoadClass;
51class ShdSubMeshClass;
53class MeshClass;
54class TexProjectClass;
55
61
69{
70public:
71 ShdMeshClass(void);
72 ShdMeshClass(const ShdMeshClass & src);
73 virtual ~ShdMeshClass(void);
74
76 // Render Object Interface
78 virtual RenderObjClass * Clone(void) const;
79 virtual int Class_ID(void) const { return CLASSID_SHDMESH; }
80 virtual const char * Get_Name(void) const;
81 virtual void Set_Name(const char * name);
82 virtual int Get_Num_Polys(void) const;
83 int Get_Num_Vertices(void) const;
84 virtual void Render(RenderInfoClass & rinfo);
85// void Render_Material_Pass(MaterialPassClass * pass,IndexBufferClass * ib);
86 virtual void Special_Render(SpecialRenderInfoClass & rinfo);
87
89 // Render Object Interface - Collision Detection
91 virtual bool Cast_Ray(RayCollisionTestClass & raytest);
92 virtual bool Cast_AABox(AABoxCollisionTestClass & boxtest);
93 virtual bool Cast_OBBox(OBBoxCollisionTestClass & boxtest);
94 virtual bool Intersect_AABox(AABoxIntersectionTestClass & boxtest);
95 virtual bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest);
96
98 // Render Object Interface - Bounding Volumes
100 virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const;
101 virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const;
102
104 // Render Object Interface - Attributes, Options, Properties, etc
106// virtual int Get_Sort_Level(void) const;
107// virtual void Set_Sort_Level(int level);
108
110 // Render Object Interface - Decals
112// virtual void Create_Decal(DecalGeneratorClass * generator);
113// virtual void Delete_Decal(uint32 decal_id);
114
116 // MeshClass Interface
119// WW3DErrorType Init(const MeshBuilderClass & builder,MaterialInfoClass * matinfo,const char * name,const char * hmodelname);
122// MeshModelClass * Get_Model(void);
123// MeshModelClass * Peek_Model(void);
125 const char * Get_User_Text(void) const;
126
127 bool Contains(const Vector3 &point);
128
129 void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm);
131
134
135// void Set_Next_Visible_Skin(MeshClass * next_visible) { NextVisibleSkin = next_visible; }
136// MeshClass * Peek_Next_Visible_Skin(void) { return NextVisibleSkin; }
137//
138// void Set_Base_Vertex_Offset(int base) { BaseVertexOffset = base; }
139// int Get_Base_Vertex_Offset(void) { return BaseVertexOffset; }
140
141 // Do old .w3d mesh files get fog turned on or off?
143
144// void Replace_Texture(TextureClass* texture,TextureClass* new_texture);
145// void Replace_VertexMaterial(VertexMaterialClass* vmat,VertexMaterialClass* new_vmat);
146
148// unsigned Get_Debug_Id() const { return MeshDebugId; }
149//
150// void Set_Debugger_Disable(bool b) { IsDisabledByDebugger=b; }
151// bool Is_Disabled_By_Debugger() const { return IsDisabledByDebugger; }
152
153 /*
154 ** User Lighting feature, meshes can have a user lighting array.
155 */
156// void Install_User_Lighting_Array(Vector4 * lighting);
157// unsigned int * Get_User_Lighting_Array(bool alloc = false);
158//
159// virtual void Save_User_Lighting (ChunkSaveClass & csave);
160// virtual void Load_User_Lighting (ChunkLoadClass & cload);
161
165
167
168 // ShdMesh Accessors
169 int Get_Sub_Mesh_Count(void) const;
170 ShdSubMeshClass * Peek_Sub_Mesh(int i) const;
171
172protected:
173
174 void Free(void);
175
176 virtual void Add_Dependencies_To_List (DynamicVectorClass<StringClass> &file_list, bool textures_only = false);
177 virtual void Update_Cached_Bounding_Volumes(void) const;
178
181 LightEnvironmentClass * LightEnvironment; // cached pointer to the light environment for this mesh
184};
185
186#endif //SHDMESH_H
unsigned long uint32
Definition bittype.h:46
RenderObjClass(void)
Definition rendobj.cpp:170
void Get_Deformed_Vertices(Vector3 *dst_vert)
TexProjectClass * Peek_Texture_Projector() const
Definition shdmesh.h:166
virtual bool Intersect_AABox(AABoxIntersectionTestClass &boxtest)
Definition shdmesh.cpp:345
int Get_Num_Vertices(void) const
Definition shdmesh.cpp:128
void Init_From_Legacy_Mesh(MeshClass *mesh)
Definition shdmesh.cpp:515
bool Is_Applying_Shadow_Map() const
Definition shdmesh.h:164
virtual RenderObjClass * Clone(void) const
Definition shdmesh.cpp:78
void Generate_Culling_Tree(void)
uint32 Get_W3D_Flags(void)
virtual bool Cast_AABox(AABoxCollisionTestClass &boxtest)
Definition shdmesh.cpp:270
ShdSubMeshClass * Peek_Sub_Mesh(int i) const
Definition shdmesh.cpp:677
LightEnvironmentClass * LightEnvironment
Definition shdmesh.h:181
virtual void Update_Cached_Bounding_Volumes(void) const
Definition shdmesh.cpp:438
void Unset_Is_Applying_Shadow_Map()
Definition shdmesh.h:163
void Set_Lighting_Environment(LightEnvironmentClass *light_env)
Definition shdmesh.h:132
virtual bool Intersect_OBBox(OBBoxIntersectionTestClass &boxtest)
Definition shdmesh.cpp:374
LightEnvironmentClass * Get_Lighting_Environment(void)
Definition shdmesh.h:133
SimpleVecClass< ShdSubMeshStruct > SubMeshes
Definition shdmesh.h:180
static bool Legacy_Meshes_Fogged
Definition shdmesh.h:142
bool Contains(const Vector3 &point)
virtual int Get_Num_Polys(void) const
Definition shdmesh.cpp:118
virtual void Add_Dependencies_To_List(DynamicVectorClass< StringClass > &file_list, bool textures_only=false)
Definition shdmesh.cpp:402
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
Definition shdmesh.cpp:219
virtual void Render(RenderInfoClass &rinfo)
Definition shdmesh.cpp:139
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
Definition shdmesh.cpp:469
virtual int Class_ID(void) const
Definition shdmesh.h:79
virtual void Set_Name(const char *name)
Definition shdmesh.cpp:88
virtual bool Cast_OBBox(OBBoxCollisionTestClass &boxtest)
Definition shdmesh.cpp:298
int Get_Sub_Mesh_Count(void) const
Definition shdmesh.cpp:672
virtual ~ShdMeshClass(void)
Definition shdmesh.cpp:72
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
Definition shdmesh.cpp:555
virtual void Special_Render(SpecialRenderInfoClass &rinfo)
Definition shdmesh.cpp:203
bool Applying_Shadow_Map
Definition shdmesh.h:182
TexProjectClass * Texture_Projector
Definition shdmesh.h:183
void Free(void)
Definition shdmesh.cpp:105
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition shdmesh.cpp:498
StringClass Name
Definition shdmesh.h:179
ShdMeshClass(void)
Definition shdmesh.cpp:49
void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm)
virtual const char * Get_Name(void) const
Definition shdmesh.cpp:83
void Make_Unique()
void Set_Is_Applying_Shadow_Map()
Definition shdmesh.h:162
const char * Get_User_Text(void) const
ShdSubMeshClass * Mesh
Definition shdmesh.h:58
ShdRendererNodeClass * Renderer
Definition shdmesh.h:59
WW3DErrorType
Definition w3derr.h:51