MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-wii-texture.h
1
5#ifndef _GDL_WII_TEXTURE_H
6#define _GDL_WII_TEXTURE_H
7
8#include <ogc/gx.h>
9
10
11namespace gdl {
12
13
32 I4 = GX_TF_I4,
33 I8 = GX_TF_I8,
34 IA4 = GX_TF_IA4,
35 IA8 = GX_TF_IA8,
36 RGB565 = GX_TF_RGB565,
37 RGB5A3 = GX_TF_RGB5A3,
38 RGBA8 = GX_TF_RGBA8 ,
39};
40
47 MEM1 = 0,
48 MEM2 = 1
49};
50
51
53
58class Texture {
59
60 bool texAlloc;
61 bool texMipmapped;
62 short texMipLevels;
63 short texXsize;
64 short texYsize;
65 short texFmt;
66 u_int texSize;
67 void *texData;
68 GXTexObj texObj;
69
70 void _ConvertTexture(short xres, short yres, short stride, void *inBuff, void *outBuff);
71 bool _ConvertMipmap(short xres, short yres, void *inBuff);
72
73public:
74
75
77 Texture();
78
79
81 virtual ~Texture();
82
83
85
100 bool Create(short xSize, short ySize, u_int filterMode, u_int format);
101
102
104
133 bool CreateMipmapped(short xSize, short ySize, u_int minFilt, u_int magFilt, short maxMipmaps, u_int format);
134
135
137
150 bool LoadTexture(const char* fileName);
151
152
154
170 bool ConvertRawImage(short rawXres, short rawYres, void *rawBuff, short srcFormat);
171
172
174
193 void CopyFromScreen(short x, short y, short width, short height, u_char clearScreen);
194
195
197
204 void Delete();
205
206
208
213 void Flush();
214
215
217
223 void SetFilterMode(u_int minFilt, u_int magFilt);
224
225
227
231 void SetWrapMode(u_int wrap_s, u_int wrap_t);
232
233
235
250 void PokePixel(short x, short y, u_int col);
251
253
264 u_int PeekPixel(short x, short y);
265
266
268
275 void *TexAddr();
276
277
279
282 u_int TexSize();
283
284
286
289 short TexFmt();
290
291
293
299 GXTexObj *TexObj();
300
301
303
306 short TXsize();
307
308
310
313 short TYsize();
314
315
316};
317
318
320
325int MakeValuePOT(int value);
326
329namespace wii {
330
336
343 void SetAutoFlush(bool flush);
344
346
355 void SetTexAllocMode(bool allocMode);
356
359}
360
361}
362
363
364
365#endif // _GDL_WII_TEXTURE_H
Texture handling class.
Definition mgdl-wii-texture.h:58
void Flush()
Flushes the texture's data block.
Definition wii-texture.cpp:1322
u_int TexSize()
Returns the size of the texture data in bytes.
Definition wii-texture.cpp:1513
virtual ~Texture()
Deconstructor.
Definition wii-texture.cpp:657
u_int PeekPixel(short x, short y)
Peeks a pixel from the texture.
Definition wii-texture.cpp:1410
void SetFilterMode(u_int minFilt, u_int magFilt)
Sets filter modes to a texture.
Definition wii-texture.cpp:1328
void PokePixel(short x, short y, u_int col)
Pokes a pixel into the texture.
Definition wii-texture.cpp:1340
bool Create(short xSize, short ySize, u_int filterMode, u_int format)
Creates a texture image.
Definition wii-texture.cpp:670
void Delete()
Deletes the texture (but not the object itself).
Definition wii-texture.cpp:1301
Texture()
Constructor.
Definition wii-texture.cpp:645
void SetWrapMode(u_int wrap_s, u_int wrap_t)
Sets the wrapping strategy of the texture.
Definition wii-texture.cpp:1334
bool LoadTexture(const char *fileName)
Loads a TPL texture file generated by gxtexconv.
Definition wii-texture.cpp:876
void CopyFromScreen(short x, short y, short width, short height, u_char clearScreen)
Copies pixel data from the active framebuffer.
Definition wii-texture.cpp:1290
GXTexObj * TexObj()
Returns a pointer to the GXTexObj object of the texture.
Definition wii-texture.cpp:1525
short TYsize()
Returns the Y size of the texture in pixels.
Definition wii-texture.cpp:1537
bool ConvertRawImage(short rawXres, short rawYres, void *rawBuff, short srcFormat)
Converts raw image data into a texture.
Definition wii-texture.cpp:1028
bool CreateMipmapped(short xSize, short ySize, u_int minFilt, u_int magFilt, short maxMipmaps, u_int format)
Creates a mipmapped texture image.
Definition wii-texture.cpp:747
short TexFmt()
Returns the texture format index of the texture.
Definition wii-texture.cpp:1519
void * TexAddr()
Returns the pointer to the texture data block.
Definition wii-texture.cpp:1507
short TXsize()
Returns the X size of the texture in pixels.
Definition wii-texture.cpp:1531
int MakeValuePOT(int value)
Pads out a value to make it a power-of-two.
Definition wii-texture.cpp:1544
TextureFormatModes
Definition mgdl-wii-texture.h:31
TextureAllocModes
Definition mgdl-wii-texture.h:46
void SetAutoFlush(bool flush)
Texture flusing mode.
Definition wii-texture.cpp:1553
void SetTexAllocMode(bool allocMode)
Sets which memory area the next texture will be allocated in.
Definition wii-texture.cpp:1559
@ IA8
16-bit intensity with alpha (monochrome) format (2 bytes per pixel).
Definition mgdl-wii-texture.h:35
@ I8
8-bit intensity (alpha) format (1 pixel per byte).
Definition mgdl-wii-texture.h:33
@ I4
4-bit intensity (alpha) format (2 pixels per byte).
Definition mgdl-wii-texture.h:32
@ RGB5A3
16-bit RGB5A3 pixel format (RGB5 if pixel is opaque, RGB4A3 if pixel is translucent,...
Definition mgdl-wii-texture.h:37
@ IA4
8-bit intensity with alpha (monochrome) format (1 byte per pixel).
Definition mgdl-wii-texture.h:34
@ RGB565
16-bit RGB565 pixel format (2 bytes per pixel).
Definition mgdl-wii-texture.h:36
@ RGBA8
32-bit RGBA8 pixel format (4 bytes per pixel).
Definition mgdl-wii-texture.h:38
@ MEM1
Allocate texture in MEM1.
Definition mgdl-wii-texture.h:47
@ MEM2
Allocate texture in MEM2.
Definition mgdl-wii-texture.h:48
Library namespace.
Definition wii-globals.cpp:12