Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
shdloader.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/***********************************************************************************************
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:: /Commando/Code/wwshade/shdloader.cpp $*
26 * *
27 * Org Author:: Kenny Mitchell *
28 * *
29 * Author : Kenny Mitchell *
30 * *
31 * $Modtime:: 06/27/02 3:51p $*
32 * *
33 * $Revision:: 1 $*
34 * *
35 * 06/26/02 KM Abstracting shader system
36 *---------------------------------------------------------------------------------------------*/
37
38#include "shdloader.h"
39#include "shdmesh.h"
40#include "mesh.h"
41
44
45/***********************************************************************************************
46 * ShdMeshLoaderClass::Load -- reads in a shader mesh and creates a prototype for it *
47 * *
48 * INPUT: *
49 * *
50 * OUTPUT: *
51 * *
52 * WARNINGS: *
53 * *
54 * HISTORY: *
55 * 5/21/02 KJM : Created. *
56 *=============================================================================================*/
58{
60
61 if (mesh==NULL)
62 {
63 return NULL;
64 }
65
66 if (mesh->Load_W3D(cload)!=WW3D_ERROR_OK)
67 {
68 // if the load failed, delete the mesh
69 assert(mesh->Num_Refs() == 1);
70 mesh->Release_Ref();
71 return NULL;
72
73 }
74
75 // create the prototype and add it to the lists
77 mesh->Release_Ref();
78 return newproto;
79}
80
81
83{
84 MeshClass * mesh = NEW_REF( MeshClass, () );
85
86 if (mesh == NULL) {
87 return NULL;
88 }
89
90 if (mesh->Load_W3D(cload) != WW3D_ERROR_OK) {
91
92 // if the load failed, delete the mesh
93 assert(mesh->Num_Refs() == 1);
94 mesh->Release_Ref();
95 return NULL;
96
97 } else {
98 ShdMeshClass* shdmesh=NEW_REF( ShdMeshClass, () );
99 shdmesh->Init_From_Legacy_Mesh(mesh);
100 mesh->Release_Ref();
101
102 // create the prototype and add it to the lists
104 shdmesh->Release_Ref();
105 return newproto;
106
107 }
108}
#define NULL
Definition BaseType.h:92
#define W3DNEW
Definition always.h:109
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
Definition mesh.cpp:1139
int Num_Refs(void) const
Definition refcount.h:159
WWINLINE void Release_Ref(void) const
Definition refcount.h:146
void Init_From_Legacy_Mesh(MeshClass *mesh)
Definition shdmesh.cpp:515
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
Definition shdmesh.cpp:555
virtual PrototypeClass * Load_W3D(ChunkLoadClass &cload)
Definition shdloader.cpp:82
virtual PrototypeClass * Load_W3D(ChunkLoadClass &cload)
Definition shdloader.cpp:57
#define NEW_REF(C, P)
Definition refcount.h:62
ShdMeshLegacyLoaderClass _ShdMeshLegacyLoader
Definition shdloader.cpp:43
ShdMeshLoaderClass _ShdMeshLoader
Definition shdloader.cpp:42
@ WW3D_ERROR_OK
Definition w3derr.h:52