Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
shddeffactory.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/shddeffactory.h $*
26 * *
27 * $Org Author:: Jani_p
28 *
29 * $Author:: Kenny_m
30 *
31 * $Modtime:: 6/01/02 3:12p $*
32 * *
33 * $Revision:: 1 $*
34 * *
35 *---------------------------------------------------------------------------------------------*
36 * Functions: *
37 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38
39#ifndef SHDDEFFACTORY_H
40#define SHDDEFFACTORY_H
41
42#include "always.h"
43#include "bittype.h"
44
45class ShdDefClass;
46
47/*
48** NOTE: For most users, the only thing you need from this module is the REGISTER_SHDDEF(T,ID,NAME) macro
49*/
50
51
59{
60public:
61 ShdDefFactoryClass (void);
62 virtual ~ShdDefFactoryClass (void);
63
65 // Public methods
67 virtual ShdDefClass * Create (void) const = 0;
68 virtual const char * Get_Name (void) const = 0;
69 virtual uint32 Get_Class_ID (void) const = 0;
70
71protected:
72
74 // Protected member data
78
79 friend class ShdDefManagerClass;
80};
81
82
90template<class T, int class_id, char *name> class SimpleShdDefFactoryClass : public ShdDefFactoryClass
91{
92public:
94 virtual ~SimpleShdDefFactoryClass (void) { }
95
97 // Public methods
99 virtual ShdDefClass * Create (void) const { return new T; }
100 virtual const char * Get_Name (void) const { return name; }
101 virtual uint32 Get_Class_ID (void) const { return class_id; }
102};
103
104
105/*
106** Use this macro in the .CPP file for your shader definition to automatically link it
107** into the shader editing system.
108*/
109#define REGISTER_SHDDEF(T,ID,NAME) \
110char T ## Name[] = NAME; \
111SimpleShdDefFactoryClass<T,ID,T ## Name> T ## Factory \
112
113
114
115#endif //SHDDEFFACTORY_H
unsigned long uint32
Definition bittype.h:46
virtual const char * Get_Name(void) const =0
ShdDefFactoryClass * NextFactory
virtual uint32 Get_Class_ID(void) const =0
virtual ~ShdDefFactoryClass(void)
Destructor for ShdDefFactoryClass.
ShdDefFactoryClass * PrevFactory
ShdDefFactoryClass(void)
Constructor for ShdDefFactoryClass.
friend class ShdDefManagerClass
virtual ShdDefClass * Create(void) const =0
virtual ShdDefClass * Create(void) const
virtual uint32 Get_Class_ID(void) const
virtual ~SimpleShdDefFactoryClass(void)
virtual const char * Get_Name(void) const