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