Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
shdsubmesh.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/shdsubmesh.h $*
26 * *
27 * Org Author:: Jani P *
28 * *
29 * Author : Kenny Mitchell *
30 * *
31 * $Modtime:: 07/12/02 10:31a $*
32 * *
33 * $Revision:: 1 $*
34 * *
35 * 07/12/02 KM Removed legacy mesh conversion *
36 *---------------------------------------------------------------------------------------------*
37 *---------------------------------------------------------------------------------------------*/
38
39#ifndef SHDSUBMESH_H
40#define SHDSUBMESH_H
41
42#include "always.h"
43#include "meshgeometry.h"
44#include "shdinterface.h"
45#include "dx8wrapper.h"
46#include "sharebuf.h"
47
50class RenderInfoClass;
51class MeshModelClass;
52class HTreeClass;
53
59{
60public:
62
63 ShdSubMeshClass(void);
64 ShdSubMeshClass(const ShdSubMeshClass & that);
65 ~ShdSubMeshClass(void);
66
68 void Reset(int polycount,int vertcount);
69
70// unsigned Get_Vertex_Stream_Count();
71// unsigned Get_Vertex_Size(unsigned stream);
72// void Copy_Vertex_Stream(unsigned stream, void* buffer);
73
75 // Material interface, All of these functions call through to the current
76 // material decription.
78 void Set_Shader(ShdInterfaceClass * shader) { REF_PTR_SET(Shader,shader); }
79 ShdInterfaceClass * Peek_Shader(void) const { return Shader; }
80
82 // Decal interface
85 void Delete_Decal(uint32 decal_id);
86
87 void Init_From_Legacy_Mesh_Model(MeshModelClass* model,int first_polygon);
88
90 // Load from a W3D File
93
94 const Vector2* Get_UV_Array(unsigned stage) { return UV[stage] ? UV[stage]->Get_Array() : NULL; }
95 const unsigned* Get_Diffuse_Array() { return Diffuse ? Diffuse->Get_Array() : NULL; }
96 const Vector3* Get_Tangent_Basis_S_Array() { return S ? S->Get_Array() : NULL; }
97 const Vector3* Get_Tangent_Basis_T_Array() { return T ? T->Get_Array() : NULL; }
98 const Vector3* Get_Tangent_Basis_SxT_Array() { return SxT ? SxT->Get_Array() : NULL; }
99
100 // First and last visible polygon. Default is both zero, which means that all polygons
101 // are visible.
104 bool Is_Sorting() const { return Sorting; }
105
106 void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm, const HTreeClass* htree);
107 void Get_Deformed_Vertices(Vector3 *dst_vert, const HTreeClass* htree);
108
109protected:
112
116
120
121 // MeshClass will set this for skins so that they can get the bone transforms
122// void Set_HTree(const HTreeClass * htree);
123
124protected:
125 // functions to compute the deformed vertices of skins.
126 // Destination pointers MUST point to arrays large enough to hold all vertices
127// void get_deformed_vertices(Vector3 *dst_vert, Vector3 *dst_norm, const HTreeClass * htree);
128// void get_deformed_vertices(Vector3 *dst_vert, const HTreeClass * htree);
129// void get_deformed_screenspace_vertices(Vector4 *dst_vert,const RenderInfoClass & rinfo,const Matrix3D & mesh_tm,const HTreeClass * htree);
130
131 // loading
135
138
143
147
148// WW3DErrorType read_texcoords(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
149// WW3DErrorType read_materials(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
150// WW3DErrorType read_v2_materials(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
151// WW3DErrorType read_v3_materials(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
152// WW3DErrorType read_per_tri_materials(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
153// WW3DErrorType read_vertex_colors(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
154// WW3DErrorType read_material_info(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
155// WW3DErrorType read_shaders(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
156// WW3DErrorType read_vertex_materials(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
157// WW3DErrorType read_textures(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
158// WW3DErrorType read_material_pass(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
159// WW3DErrorType read_vertex_material_ids(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
160// WW3DErrorType read_shader_ids(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
161// WW3DErrorType read_scg(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
162// WW3DErrorType read_dig(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
163// WW3DErrorType read_dcg(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
164// WW3DErrorType read_texture_stage(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
165// WW3DErrorType read_texture_ids(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
166// WW3DErrorType read_stage_texcoords(ChunkLoadClass & cload,ShdMeshLoadContextClass * context);
167// WW3DErrorType read_per_face_texcoord_ids (ChunkLoadClass &cload, ShdMeshLoadContextClass *context);
168// WW3DErrorType read_prelit_material (ChunkLoadClass &cload, ShdMeshLoadContextClass *context);
169
171};
172
173#endif //SHDSUBMESH_H
#define NULL
Definition BaseType.h:92
unsigned long uint32
Definition bittype.h:46
int Get_First_Visible_Polygon() const
Definition shdsubmesh.h:102
WW3DErrorType read_uv0(ChunkLoadClass &cload)
bool Is_Sorting() const
Definition shdsubmesh.h:104
WW3DErrorType read_vertex_influences(ChunkLoadClass &cload)
ShareBufferClass< Vector3 > * S
Definition shdsubmesh.h:113
WW3DErrorType read_tangent_basis_s(ChunkLoadClass &cload)
WW3DErrorType read_shader(ChunkLoadClass &cload)
void Reset(int polycount, int vertcount)
void Init_From_Legacy_Mesh_Model(MeshModelClass *model, int first_polygon)
ShareBufferClass< Vector2 > * UV[MAX_TEXTURE_STAGES]
Definition shdsubmesh.h:110
ShareBufferClass< Vector3 > * SxT
Definition shdsubmesh.h:115
void Create_Decal(DecalGeneratorClass *generator)
const Vector2 * Get_UV_Array(unsigned stage)
Definition shdsubmesh.h:94
WW3DErrorType read_chunks(ChunkLoadClass &cload)
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
const Vector3 * Get_Tangent_Basis_SxT_Array()
Definition shdsubmesh.h:98
ShareBufferClass< unsigned > * Diffuse
Definition shdsubmesh.h:111
WW3DErrorType read_vertex_shade_indices(ChunkLoadClass &cload)
const unsigned * Get_Diffuse_Array()
Definition shdsubmesh.h:95
WW3DErrorType read_tangent_basis_t(ChunkLoadClass &cload)
WW3DErrorType read_triangles(ChunkLoadClass &cload)
WW3DErrorType read_uv1(ChunkLoadClass &cload)
void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm, const HTreeClass *htree)
ShdSubMeshClass & operator=(const ShdSubMeshClass &that)
const Vector3 * Get_Tangent_Basis_T_Array()
Definition shdsubmesh.h:97
const Vector3 * Get_Tangent_Basis_S_Array()
Definition shdsubmesh.h:96
W3DMPO_GLUE(ShdSubMeshClass)
ShdInterfaceClass * Peek_Shader(void) const
Definition shdsubmesh.h:79
int Get_Visible_Polygon_Count() const
Definition shdsubmesh.h:103
void Set_Shader(ShdInterfaceClass *shader)
Definition shdsubmesh.h:78
ShdInterfaceClass * Shader
Definition shdsubmesh.h:170
WW3DErrorType read_vertices(ChunkLoadClass &cload)
WW3DErrorType read_vertex_normals(ChunkLoadClass &cload)
void Delete_Decal(uint32 decal_id)
WW3DErrorType read_tangent_basis_sxt(ChunkLoadClass &cload)
ShareBufferClass< Vector3 > * T
Definition shdsubmesh.h:114
const unsigned MAX_TEXTURE_STAGES
Definition dx8wrapper.h:76
#define REF_PTR_SET(dst, src)
Definition refcount.h:79
WW3DErrorType
Definition w3derr.h:51