Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
meshcon.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/meshcon.cpp 34 10/27/00 4:12p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando / G Math Library *
25 * *
26 * $Archive:: /Commando/Code/Tools/max2w3d/meshcon.cpp $*
27 * *
28 * $Author:: Greg_h $*
29 * *
30 * $Modtime:: 10/27/00 10:39a $*
31 * *
32 * $Revision:: 34 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * MeshConnectionsClass::MeshConnectionsClass -- Constructor *
37 * MeshConnectionsClass::~MeshConnectionsClass -- Destructor *
38 * MeshConnectionsClass::Get_Aggregate_Data -- name and bone for the given aggregate *
39 * MeshConnectionsClass::Get_Proxy_Data -- name and transform for the specified proxy object *
40 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
41
42
43#include "meshcon.h"
44#include "util.h"
45#include "SnapPoints.h"
46#include "w3dappdata.h"
47#include "geometryexporttask.h"
49
50
51/***********************************************************************************************
52 * MeshConnectionsClass::MeshConnectionsClass -- Constructor *
53 * *
54 * INPUT: *
55 * *
56 * OUTPUT: *
57 * *
58 * WARNINGS: *
59 * *
60 * HISTORY: *
61 * 10/19/2000 gth : New version which uses the GeometryExportTasks *
62 *=============================================================================================*/
64(
67) :
68 CurTime(context.CurTime),
69 Origin(context.Origin)
70{
71 unsigned int i;
72 assert(Origin != NULL);
73
74 /*
75 ** Set the name, count the sub-objects and aggregates
76 */
77 Set_W3D_Name(Name,context.ModelName);
78
79 /*
80 ** For each sub-object, record the bone it is attached to and its name
81 */
82 int count = sub_object_list.Count();
83 for (i=0; i<count; i++) {
84
86 sub_object_list[i]->Get_Full_Name(con.ObjectName,sizeof(con.ObjectName));
87 con.BoneIndex = sub_object_list[i]->Get_Bone_Index();
88 con.MeshINode = sub_object_list[i]->Get_Object_Node();
89
90 if (sub_object_list[i]->Is_Aggregate()) {
91 Aggregates.Add(con);
92 } else if (sub_object_list[i]->Is_Proxy()) {
93 ProxyObjects.Add(con);
94 } else {
95 SubObjects.Add(con);
96 }
97 }
98}
99
100
101/***********************************************************************************************
102 * MeshConnectionsClass::~MeshConnectionsClass -- Destructor *
103 * *
104 * INPUT: *
105 * *
106 * OUTPUT: *
107 * *
108 * WARNINGS: *
109 * *
110 * HISTORY: *
111 * 07/24/1997 GH : Created. *
112 *=============================================================================================*/
116
117
118/***********************************************************************************************
119 * MeshConnectionsClass::Get_Sub_Object_Data -- Returns the name and bone index for a given obj*
120 * *
121 * INPUT: *
122 * *
123 * OUTPUT: *
124 * *
125 * WARNINGS: *
126 * *
127 * HISTORY: *
128 * 9/14/1999 AJA : Created. *
129 *=============================================================================================*/
130bool MeshConnectionsClass::Get_Sub_Object_Data (int mesh_idx, char **out_name, int *out_boneindex,
131 INode **out_inode)
132{
133 if (mesh_idx >= SubObjects.Count()) return false;
134
135 if (out_name)
136 *out_name = SubObjects[mesh_idx].ObjectName;
137 if (out_boneindex)
138 *out_boneindex = SubObjects[mesh_idx].BoneIndex;
139 if (out_inode)
140 *out_inode = SubObjects[mesh_idx].MeshINode;
141
142 return true;
143}
144
145
146/***********************************************************************************************
147 * MeshConnectionsClass::Get_Aggregate_Data -- name and bone for the given aggregate *
148 * *
149 * INPUT: *
150 * *
151 * OUTPUT: *
152 * *
153 * WARNINGS: *
154 * *
155 * HISTORY: *
156 * 10/25/2000 gth : Created. *
157 *=============================================================================================*/
158bool MeshConnectionsClass::Get_Aggregate_Data(int mesh_idx, char **out_name, int *out_boneindex,
159 INode **out_inode)
160{
161 if (mesh_idx >= Aggregates.Count()) return false;
162
163 if (out_name)
164 *out_name = Aggregates[mesh_idx].ObjectName;
165 if (out_boneindex)
166 *out_boneindex = Aggregates[mesh_idx].BoneIndex;
167 if (out_inode)
168 *out_inode = Aggregates[mesh_idx].MeshINode;
169
170 return true;
171}
172
173
174/***********************************************************************************************
175 * MeshConnectionsClass::Get_Proxy_Data -- name and transform for the specified proxy object *
176 * *
177 * INPUT: *
178 * *
179 * OUTPUT: *
180 * *
181 * WARNINGS: *
182 * *
183 * HISTORY: *
184 * 10/26/2000 gth : Created. *
185 *=============================================================================================*/
186bool MeshConnectionsClass::Get_Proxy_Data(int index, char **out_name, int *out_boneindex,
187 INode **out_inode)
188{
189 if (index >= ProxyObjects.Count()) return false;
190
191 if (out_name)
192 *out_name = ProxyObjects[index].ObjectName;
193 if (out_boneindex)
194 *out_boneindex = ProxyObjects[index].BoneIndex;
195 if (out_inode)
196 *out_inode = ProxyObjects[index].MeshINode;
197
198 return true;
199}
#define NULL
Definition BaseType.h:92
int Count(void) const
Definition Vector.H:507
MeshConnectionsClass(DynamicVectorClass< GeometryExportTaskClass * > sub_objects, GeometryExportContextClass &context)
Definition meshcon.cpp:64
bool Get_Proxy_Data(int index, char **out_name, int *out_boneindex, INode **out_inode=NULL)
Definition meshcon.cpp:186
bool Get_Sub_Object_Data(int index, char **out_name, int *out_boneindex, INode **out_inode=NULL)
Definition meshcon.cpp:130
bool Get_Aggregate_Data(int index, char **out_name, int *out_boneindex, INode **out_inode=NULL)
Definition meshcon.cpp:158
char ObjectName[2 *W3D_NAME_LEN]
Definition meshcon.h:80
INode * MeshINode
Definition meshcon.h:81
void Set_W3D_Name(char *set_name, const char *src)
Definition util.cpp:112
bool Is_Aggregate(INode *node)
bool Is_Proxy(INode &node)
Definition w3dappdata.h:120