Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
dx8texman.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 : DX8 Texture Manager *
24 * *
25 * $Archive:: /Commando/Code/ww3d2/dx8texman.h $*
26 * *
27 * Original Author:: Hector Yee *
28 * *
29 * Author : Kenny Mitchell *
30 * *
31 * $Modtime:: 06/27/02 1:27p $*
32 * *
33 * $Revision:: 4 $*
34 * *
35 * 06/27/02 KM Texture class abstraction *
36 *---------------------------------------------------------------------------------------------*
37 * Functions: *
38 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
39
40#if defined(_MSC_VER)
41#pragma once
42#endif
43
44#ifndef DX8TEXTUREMANAGER_H
45#define DX8TEXTUREMANAGER_H
46
47#include "always.h"
48#include "texture.h"
49#include "dx8wrapper.h"
50#include "ww3dformat.h"
51#include "dx8list.h"
52#include "ww3dformat.h"
53#include "multilist.h"
54
56
58{
59public:
61 (
62 unsigned int w,
63 unsigned int h,
64 MipCountType count,
66 )
67 : Width(w),
68 Height(h),
69 Mip_level_count(count),
70 Texture(tex)
71 {
72 }
73
74 virtual void Recreate() const =0;
75
76 void Release()
77 {
78 Texture->Set_D3D_Base_Texture(NULL);
79 }
80
82
83
84protected:
85
86 unsigned int Width;
87 unsigned int Height;
90};
91
93{
94public:
96 (
97 unsigned int w,
98 unsigned int h,
99 WW3DFormat format,
100 MipCountType count,
101 TextureBaseClass *tex,
102 bool rt
103 )
104 : TextureTrackerClass(w,h,count,tex), Format(format), RenderTarget(rt)
105 {
106 }
107
108 virtual void Recreate() const
109 {
110 WWASSERT(Texture->Peek_D3D_Base_Texture()==NULL);
111 Texture->Poke_Texture
112 (
114 (
115 Width,
116 Height,
117 Format,
119 D3DPOOL_DEFAULT,
120 RenderTarget
121 )
122 );
123 }
124
125private:
126 WW3DFormat Format;
127 bool RenderTarget;
128};
129
131{
132public:
134 (
135 unsigned int w,
136 unsigned int h,
137 WW3DZFormat zformat,
138 MipCountType count,
140 )
141 : TextureTrackerClass(w,h,count,tex), ZFormat(zformat)
142 {
143 }
144
145 virtual void Recreate() const
146 {
147 WWASSERT(Texture->Peek_D3D_Base_Texture()==NULL);
148 Texture->Poke_Texture
149 (
151 (
152 Width,
153 Height,
154 ZFormat,
156 D3DPOOL_DEFAULT
157 )
158 );
159 }
160
161
162private:
163 WW3DZFormat ZFormat;
164};
165
166
168{
169public:
170 static void Shutdown();
171 static void Add(TextureTrackerClass *track);
172 static void Remove(TextureBaseClass *tex);
173 static void Release_Textures();
174 static void Recreate_Textures();
175private:
176 static TextureTrackerList Managed_Textures;
177};
178
179#endif // ifdef TEXTUREMANAGER
#define NULL
Definition BaseType.h:92
#define WWASSERT
static void Remove(TextureBaseClass *tex)
static void Recreate_Textures()
static void Shutdown()
Definition dx8texman.cpp:74
static void Release_Textures()
static void Add(TextureTrackerClass *track)
virtual void Recreate() const
Definition dx8texman.h:108
DX8TextureTrackerClass(unsigned int w, unsigned int h, WW3DFormat format, MipCountType count, TextureBaseClass *tex, bool rt)
Definition dx8texman.h:96
static IDirect3DTexture8 * _Create_DX8_Texture(unsigned int width, unsigned int height, WW3DFormat format, MipCountType mip_level_count, D3DPOOL pool=D3DPOOL_MANAGED, bool rendertarget=false)
static IDirect3DTexture8 * _Create_DX8_ZTexture(unsigned int width, unsigned int height, WW3DZFormat zformat, MipCountType mip_level_count, D3DPOOL pool=D3DPOOL_MANAGED)
DX8ZTextureTrackerClass(unsigned int w, unsigned int h, WW3DZFormat zformat, MipCountType count, TextureBaseClass *tex)
Definition dx8texman.h:134
virtual void Recreate() const
Definition dx8texman.h:145
unsigned int Width
Definition dx8texman.h:86
TextureBaseClass * Get_Texture() const
Definition dx8texman.h:81
TextureBaseClass * Texture
Definition dx8texman.h:89
virtual void Recreate() const =0
MipCountType Mip_level_count
Definition dx8texman.h:88
TextureTrackerClass(unsigned int w, unsigned int h, MipCountType count, TextureBaseClass *tex)
Definition dx8texman.h:61
unsigned int Height
Definition dx8texman.h:87
MultiListClass< TextureTrackerClass > TextureTrackerList
Definition dx8list.h:69
MipCountType
WW3DFormat
Definition ww3dformat.h:75
WW3DZFormat
Definition ww3dformat.h:106