Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
shddef.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/shddef.h $*
26 * *
27 * $Org Author:: Jani_p
28 *
29 * $Author:: Kenny_m
30 *
31 * $Modtime:: 6/07/02 3:12p $*
32 * *
33 * $Revision:: 2 $*
34 * *
35 * 6/07/02 KJM : Added validation enum
36 *---------------------------------------------------------------------------------------------*
37 * Functions: *
38 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
39
40#ifndef SHDDEF_H
41#define SHDDEF_H
42
43#include "always.h"
44#include "editable.h"
45#include "refcount.h"
46
48
56
58{
59public:
61
62 void Set(const SHDVER ver) { Version=ver; }
63 SHDVER Get() const { return Version; }
64
65private:
66
68};
69
70
71
85{
86public:
88
89 ShdDefClass(uint32 class_id);
90 ShdDefClass(const ShdDefClass & that);
91 virtual ~ShdDefClass(void);
92
93 virtual ShdDefClass * Clone(void) const = 0;
94 virtual void Reset(void);
95
96 // Run-Time Type identification (ID's defined in "shdclassids.h")
97 WWINLINE uint32 Get_Class_ID (void) const { return ClassID; }
98
99 // Shader Management & Creation (should create a shader compatible with the current hardware/API)
100 virtual void Init()=0;
101 virtual void Shutdown()=0;
102 virtual ShdInterfaceClass * Create (void) const = 0;
103
104 // Name methods
105 const char * Get_Name (void) const;
106 void Set_Name (const char *new_name);
107
108 // Surface type, used for decal, sound, and emitter creation
109 int Get_Surface_Type(void) const { return SurfaceType; }
110 void Set_Surface_Type(int t) { SurfaceType = t; }
111
112 // Validation methods
113 virtual bool Is_Valid_Config (StringClass &message) { return true; }
114
115 // Requirements PRELIMINARY, NEED TO VALIDATE THIS PART OF THE INTERFACE!!!
116 virtual bool Uses_Vertex_Alpha(void) const { return false; }
117 virtual bool Uses_UV_Channel(int i) const { return (i==0); }
118 virtual bool Uses_Vertex_Colors(void) const { return false; }
119 virtual bool Requires_Normals(void) const { return false; }
120 virtual bool Requires_Tangent_Space_Vectors(void) const { return false; }
121 virtual bool Requires_Sorting(void) const { return false; }
122 virtual int Static_Sort_Index(void) const { return 0; }
123
124 // From PersistClass
125 virtual bool Save (ChunkSaveClass &csave);
126 virtual bool Load (ChunkLoadClass &cload);
127
128private:
129
130 bool Save_Variables (ChunkSaveClass &csave);
131 bool Load_Variables (ChunkLoadClass &cload);
132
133 uint32 ClassID;
134 StringClass Name;
135 int SurfaceType;
136};
137
138
139
140#endif //SHDDEF_H
#define WWINLINE
Definition always.h:172
unsigned long uint32
Definition bittype.h:46
RefCountClass(void)
Definition refcount.h:108
virtual bool Is_Valid_Config(StringClass &message)
Definition shddef.h:113
virtual bool Uses_UV_Channel(int i) const
Definition shddef.h:117
virtual void Shutdown()=0
virtual void Reset(void)
Definition shddef.cpp:112
virtual ShdInterfaceClass * Create(void) const =0
virtual int Static_Sort_Index(void) const
Definition shddef.h:122
int Get_Surface_Type(void) const
Definition shddef.h:109
ShdDefClass(uint32 class_id)
Definition shddef.cpp:45
virtual bool Requires_Sorting(void) const
Definition shddef.h:121
DECLARE_EDITABLE(ShdDefClass, EditableClass)
virtual bool Uses_Vertex_Alpha(void) const
Definition shddef.h:116
virtual bool Load(ChunkLoadClass &cload)
Load this ShdDef from a chunk loader.
Definition shddef.cpp:160
virtual ~ShdDefClass(void)
Definition shddef.cpp:98
virtual bool Uses_Vertex_Colors(void) const
Definition shddef.h:118
virtual bool Requires_Tangent_Space_Vectors(void) const
Definition shddef.h:120
virtual ShdDefClass * Clone(void) const =0
virtual bool Requires_Normals(void) const
Definition shddef.h:119
void Set_Name(const char *new_name)
Definition shddef.cpp:107
WWINLINE uint32 Get_Class_ID(void) const
Definition shddef.h:97
const char * Get_Name(void) const
Definition shddef.cpp:102
void Set_Surface_Type(int t)
Definition shddef.h:110
virtual bool Save(ChunkSaveClass &csave)
Serialize this ShdDef into a chunk saver.
Definition shddef.cpp:140
virtual void Init()=0
ShdVersion()
Definition shddef.h:60
void Set(const SHDVER ver)
Definition shddef.h:62
SHDVER Get() const
Definition shddef.h:63
SHDVER
Definition shddef.h:50
@ SHDVER_6
Definition shddef.h:52
@ SHDVER_8
Definition shddef.h:54
@ SHDVER_UNDEFINED
Definition shddef.h:51
@ SHDVER_7
Definition shddef.h:53