Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
shdsimple.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/shdsimple.cpp $*
26 * *
27 * $Org Author:: Kenny_m
28 *
29 * $Author:: Kenny_m
30 *
31 * $Modtime:: 7/12/02 3:12p $*
32 * *
33 * $Revision:: 1 $*
34 * *
35 *---------------------------------------------------------------------------------------------*
36 * Functions: *
37 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38
39#ifndef SHDSIMPLE_H
40#define SHDSIMPLE_H
41
42#ifndef SHDINTERFACE_H
43#include "shdinterface.h"
44#endif
45
46#include "shddef.h"
47
48
50{
51public:
52
54 // Editable interface requirements
57
60 virtual ~ShdSimpleDefClass();
61
62 virtual ShdDefClass* Clone() const { return new ShdSimpleDefClass(*this); }
63
64 // Shader Creation (should create a shader compatible with the current hardware/API)
65 virtual void Init();
66 virtual void Shutdown();
67 virtual ShdInterfaceClass* Create() const;
68
69 // Validation methods
70 virtual bool Is_Valid_Config(StringClass &message);
71
72 // Requirements
73 virtual bool Requires_Normals() const { return true; }
74 virtual bool Requires_Tangent_Space_Vectors() const { return false; }
75 virtual bool Requires_Sorting() const { return false; }
76 virtual int Static_Sort_Index() const { return 0; }
77
78 // From PersistClass
79 virtual bool Save(ChunkSaveClass &csave);
80 virtual bool Load(ChunkLoadClass &cload);
81
82 void Set_Texture_Name(const StringClass& name) { TextureName=name; }
83 const StringClass& Get_Texture_Name() const { return TextureName; }
84
85 void Set_Ambient(const Vector3& ambient) { Ambient=ambient; }
86 const Vector3& Get_Ambient() const { return Ambient; }
87
88 void Set_Diffuse(const Vector3& diffuse) { Diffuse=diffuse; }
89 const Vector3& Get_Diffuse() const { return Diffuse; }
90
91private:
92
93 bool Save_Variables(ChunkSaveClass &csave);
94 bool Load_Variables(ChunkLoadClass &cload);
95
96 StringClass TextureName;
97
98 Vector3 Ambient;
99 Vector3 Diffuse;
100};
101
102
103
105{
106public:
107 Shd6SimpleClass(const ShdDefClass* def);
108 virtual ~Shd6SimpleClass();
109
110 static void Init();
111 static void Shutdown();
112
113 virtual int Get_Pass_Count() { return 1; }
114
115 virtual int Get_Texture_Count() const { return 1; }
116 virtual TextureClass* Peek_Texture(int idx) const { return Texture; }
117
118 virtual void Apply_Shared(int cur_pass, RenderInfoClass& rinfo);
119 virtual void Apply_Instance(int cur_pass, RenderInfoClass& rinfo);
120
121 virtual unsigned Get_Vertex_Stream_Count() const;
122 virtual unsigned Get_Vertex_Size(unsigned stream) const;
123 virtual bool Use_HW_Vertex_Processing() const { return true; }
124
125 virtual void Copy_Vertex_Stream
126 (
127 unsigned stream,
128 void* dest_buffer,
129 const VertexStreamStruct& vss,
130 unsigned vertex_count
131 );
132
133protected:
134
136
137 D3DMATERIAL8* Material;
138
140
143};
144
145
146#endif //SHDSIMPLE_H
Shd6SimpleClass(const ShdDefClass *def)
virtual int Get_Texture_Count() const
Definition shdsimple.h:115
virtual unsigned Get_Vertex_Size(unsigned stream) const
virtual unsigned Get_Vertex_Stream_Count() const
D3DMATERIAL8 * Material
Definition shdsimple.h:137
static void Init()
virtual void Apply_Instance(int cur_pass, RenderInfoClass &rinfo)
Apply per instance states for 1 pass DX6.
static void Shutdown()
TextureClass * Texture
Definition shdsimple.h:139
virtual int Get_Pass_Count()
Definition shdsimple.h:113
virtual ~Shd6SimpleClass()
virtual void Apply_Shared(int cur_pass, RenderInfoClass &rinfo)
virtual TextureClass * Peek_Texture(int idx) const
Definition shdsimple.h:116
Vector4 Ambient
Definition shdsimple.h:141
Vector4 Diffuse
Definition shdsimple.h:142
static Matrix4x4 View_Projection_Matrix
Definition shdsimple.h:135
virtual bool Use_HW_Vertex_Processing() const
Definition shdsimple.h:123
virtual void Copy_Vertex_Stream(unsigned stream, void *dest_buffer, const VertexStreamStruct &vss, unsigned vertex_count)
ShdDefClass(uint32 class_id)
Definition shddef.cpp:45
ShdInterfaceClass(const ShdDefClass *def, int class_id)
Constructor.
virtual void Init()
virtual ShdInterfaceClass * Create() const
void Set_Diffuse(const Vector3 &diffuse)
Definition shdsimple.h:88
virtual ~ShdSimpleDefClass()
Definition shdsimple.cpp:92
void Set_Ambient(const Vector3 &ambient)
Definition shdsimple.h:85
void Set_Texture_Name(const StringClass &name)
Definition shdsimple.h:82
virtual bool Is_Valid_Config(StringClass &message)
Definition shdsimple.cpp:96
virtual bool Load(ChunkLoadClass &cload)
Load this ShdDef from a chunk loader.
const StringClass & Get_Texture_Name() const
Definition shdsimple.h:83
virtual bool Save(ChunkSaveClass &csave)
Serialize this ShdDef into a chunk saver.
virtual ShdDefClass * Clone() const
Definition shdsimple.h:62
virtual bool Requires_Normals() const
Definition shdsimple.h:73
const Vector3 & Get_Ambient() const
Definition shdsimple.h:86
virtual bool Requires_Sorting() const
Definition shdsimple.h:75
const Vector3 & Get_Diffuse() const
Definition shdsimple.h:89
virtual void Shutdown()
virtual bool Requires_Tangent_Space_Vectors() const
Definition shdsimple.h:74
virtual int Static_Sort_Index() const
Definition shdsimple.h:76
DECLARE_EDITABLE(ShdSimpleDefClass, ShdDefClass)