Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
geometryexporttask.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 : Max2W3d *
24 * *
25 * $Archive:: /Commando/Code/Tools/max2w3d/geometryexporttask.h $*
26 * *
27 * Original Author:: Greg Hjelstrom *
28 * *
29 * $Author:: Greg_h $*
30 * *
31 * $Modtime:: 10/27/00 5:00p $*
32 * *
33 * $Revision:: 6 $*
34 * *
35 *---------------------------------------------------------------------------------------------*
36 * Functions: *
37 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38
39#ifndef GEOMETRYEXPORTTASK_H
40#define GEOMETRYEXPORTTASK_H
41
42#include <string.h>
43#include <Max.h>
44#include "w3d_file.h"
45#include "vector.h"
46
47
49
50
59{
60public:
61
64 virtual ~GeometryExportTaskClass(void);
65
66 virtual void Export_Geometry(GeometryExportContextClass & context) = 0;
67
68 /*
69 ** Accessors
70 */
71 char * Get_Name(void) { return Name; }
72 char * Get_Container_Name(void) { return ContainerName; }
73 void Get_Full_Name(char * buffer,int size);
74
75 int Get_Bone_Index(void) { return BoneIndex; }
76 INode * Get_Object_Node(void) { return Node; }
78
79 void Set_Name(char * name) { strncpy(Name,name,sizeof(Name)); }
80 void Set_Container_Name(char * name) { strncpy(ContainerName,name,sizeof(ContainerName)); }
81 /*
82 ** Unique Name generation. During optimization, new meshes may get created. When this happens,
83 ** we have to create a unique name for each one. The name will be generated from the original
84 ** mesh's name, the index passed in, and the LOD level of the original mesh.
85 */
86 void Generate_Name(char * root,int index,GeometryExportContextClass & context);
87
88
89 /*
90 ** Get vertex normal. This function should return the normal of a vertex at the
91 ** specified x,y,z and smoothing_group if one exists. It is used in the algorithm which
92 ** smooths the vertex normals on the boundaries of meshes.
93 */
94 virtual Point3 Get_Shared_Vertex_Normal(const Point3 & world_space_point,int smgroup) { return Point3(0,0,0); }
95
96 /*
97 ** Aggregate Model Detection. An "aggregate" is an external W3D model that we are requesting
98 ** to be attached to a bone in the model being exported. In order for our LOD system to work
99 ** properly, some special handling of aggregates is required (they must be added into the model
100 ** as "additional models" rather than being placed in the normal LOD arrays). This virtual
101 ** can be used to detect "aggregate" models.
102 */
103 virtual bool Is_Aggregate(void) { return false; }
104
105 /*
106 ** Proxy Detection. A "proxy" is a reference (by name) to an external game object that should
107 ** be instantiated at the specified transform. Like the aggregates, these had to unfortunately
108 ** be handled with special cases and therefore have this virtual function devoted solely to them.
109 */
110 virtual bool Is_Proxy(void) { return false; }
111
112 /*
113 ** Virtual Constructor
114 */
115 static GeometryExportTaskClass * Create_Task(INode * node,GeometryExportContextClass & context);
116
117 /*
118 ** Pre-Export Optimization of a set of geometry export tasks. This does things like
119 ** separating multi-material meshes, combining small meshes which are nearby and use the
120 ** same material, etc.
121 */
123 GeometryExportContextClass & context );
124
125protected:
126
127 /*
128 ** Internal RTTI
129 */
130 enum
131 {
132 MESH = 0,
138 };
139 virtual int Get_Geometry_Type(void) = 0;
140
141protected:
142
146
148 TimeValue CurTime;
149 INode * Node;
150};
151
152
153
154#endif //GEOMETRYEXPORTTASK_H
155
#define W3D_NAME_LEN
Definition w3d_file.h:319
virtual Point3 Get_Shared_Vertex_Normal(const Point3 &world_space_point, int smgroup)
void Generate_Name(char *root, int index, GeometryExportContextClass &context)
GeometryExportTaskClass(INode *node, GeometryExportContextClass &context)
static GeometryExportTaskClass * Create_Task(INode *node, GeometryExportContextClass &context)
virtual void Export_Geometry(GeometryExportContextClass &context)=0
virtual bool Is_Proxy(void)
virtual int Get_Geometry_Type(void)=0
static void Optimize_Geometry(DynamicVectorClass< GeometryExportTaskClass * > &tasks, GeometryExportContextClass &context)
void Set_Container_Name(char *name)
virtual bool Is_Aggregate(void)
void Get_Full_Name(char *buffer, int size)
char ContainerName[W3D_NAME_LEN]