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
42
ShdMeshLoaderClass
_ShdMeshLoader
;
43
ShdMeshLegacyLoaderClass
_ShdMeshLegacyLoader
;
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
*=============================================================================================*/
57
PrototypeClass
*
ShdMeshLoaderClass::Load_W3D
(
ChunkLoadClass
& cload)
58
{
59
ShdMeshClass
* mesh=
NEW_REF
(
ShdMeshClass
, ());
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
76
PrimitivePrototypeClass
* newproto =
new
PrimitivePrototypeClass
(mesh);
77
mesh->
Release_Ref
();
78
return
newproto;
79
}
80
81
82
PrototypeClass
*
ShdMeshLegacyLoaderClass::Load_W3D
(
ChunkLoadClass
& cload)
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
103
PrimitivePrototypeClass
* newproto =
W3DNEW
PrimitivePrototypeClass
(shdmesh);
104
shdmesh->
Release_Ref
();
105
return
newproto;
106
107
}
108
}
NULL
#define NULL
Definition
BaseType.h:92
W3DNEW
#define W3DNEW
Definition
always.h:109
ChunkLoadClass
Definition
chunkio.h:183
MeshClass
Definition
mesh.h:75
MeshClass::Load_W3D
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
Definition
mesh.cpp:1139
PrimitivePrototypeClass
Definition
proto.h:112
PrototypeClass
Definition
proto.h:86
RefCountClass::Num_Refs
int Num_Refs(void) const
Definition
refcount.h:159
RefCountClass::Release_Ref
WWINLINE void Release_Ref(void) const
Definition
refcount.h:146
ShdMeshClass
Definition
shdmesh.h:69
ShdMeshClass::Init_From_Legacy_Mesh
void Init_From_Legacy_Mesh(MeshClass *mesh)
Definition
shdmesh.cpp:515
ShdMeshClass::Load_W3D
WW3DErrorType Load_W3D(ChunkLoadClass &cload)
Definition
shdmesh.cpp:555
ShdMeshLegacyLoaderClass
Definition
shdloader.h:57
ShdMeshLegacyLoaderClass::Load_W3D
virtual PrototypeClass * Load_W3D(ChunkLoadClass &cload)
Definition
shdloader.cpp:82
ShdMeshLoaderClass
Definition
shdloader.h:46
ShdMeshLoaderClass::Load_W3D
virtual PrototypeClass * Load_W3D(ChunkLoadClass &cload)
Definition
shdloader.cpp:57
mesh.h
NEW_REF
#define NEW_REF(C, P)
Definition
refcount.h:62
_ShdMeshLegacyLoader
ShdMeshLegacyLoaderClass _ShdMeshLegacyLoader
Definition
shdloader.cpp:43
_ShdMeshLoader
ShdMeshLoaderClass _ShdMeshLoader
Definition
shdloader.cpp:42
shdloader.h
shdmesh.h
WW3D_ERROR_OK
@ WW3D_ERROR_OK
Definition
w3derr.h:52
Code
Libraries
Source
WWVegas
wwshade
shdloader.cpp
Generated by
1.13.2