2 Copyright (C) 2003 Rice1964
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "osal_preproc.h"
24 #include "VectorMath.h"
26 #define uchar unsigned char
27 #define uint16 unsigned short
28 #define uint32 unsigned int
29 #define uint64 unsigned long long
31 typedef unsigned char uint8;
33 typedef signed char s8;
35 typedef unsigned int u32;
36 typedef unsigned char u8;
38 typedef unsigned int COLOR;
39 typedef struct _COORDRECT
44 #define COLOR_RGBA(r,g,b,a) (((r&0xFF)<<16) | ((g&0xFF)<<8) | ((b&0xFF)<<0) | ((a&0xFF)<<24))
45 #define SURFFMT_A8R8G8B8 21
47 #define RGBA_GETALPHA(rgb) ((rgb) >> 24)
48 #define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff)
49 #define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
50 #define RGBA_GETBLUE(rgb) ((rgb) & 0xff)
52 typedef XMATRIX Matrix;
53 typedef void* LPRICETEXTURE ;
57 uint32 dwRGBA, dwRGBACopy;
58 char x,y,z; // Direction
65 unsigned int dwFormat:3;
66 unsigned int dwSize:2;
67 unsigned int dwWidth:10;
75 unsigned int dwFormat :3; // e.g. RGBA, YUV etc
76 unsigned int dwSize :2; // e.g 4/8/16/32bpp
77 unsigned int dwLine :9; // Ummm...
78 unsigned int dwPalette :4; // 0..15 - a palette index?
79 uint32 dwTMem; // Texture memory location
81 unsigned int bClampS :1;
82 unsigned int bClampT :1;
83 unsigned int bMirrorS :1;
84 unsigned int bMirrorT :1;
86 unsigned int dwMaskS :4;
87 unsigned int dwMaskT :4;
88 unsigned int dwShiftS :4;
89 unsigned int dwShiftT :4;
91 // Set by RDP_SetTileSize
92 int sl; // Upper left S - 8:3
93 int tl; // Upper Left T - 8:3
94 int sh; // Lower Right S
95 int th; // Lower Right T
102 float fsl; // Upper left S - 8:3
103 float ftl; // Upper Left T - 8:3
104 float fsh; // Lower Right S
105 float fth; // Lower Right T
139 typedef struct VECTOR2
143 VECTOR2( float newx, float newy ) {x=newx; y=newy;}
144 VECTOR2() {x=0; y=0;}
174 } TLITVERTEX, *LPTLITVERTEX;
189 } UTLITVERTEX, *LPUTLITVERTEX;
204 } LITVERTEX, *LPLITVERTEX;
212 } FILLRECTVERTEX, *LPFILLRECTVERTEX;
231 }EXTERNAL_VERTEX, *LPSHADERVERTEX;
241 float range; // Range == 0 for directional light
242 // Range != 0 for point light, Zelda MM
341 class CDirectXTexture;
342 struct TxtrCacheEntry;
345 LPRICETEXTURE m_lpsTexturePtr;
347 CTexture * m_pCTexture;
348 CDirectXTexture * m_pCDirectXTexture;
349 COGLTexture * m_pCOGLTexture;
352 uint32 m_dwTileWidth;
353 uint32 m_dwTileHeight;
355 float m_fTexHeight; // Float to avoid converts when processing verts
356 TxtrCacheEntry *pTextureEntry;
362 unsigned int dwFormat;
364 unsigned int dwWidth;
367 unsigned int dwLastWidth;
368 unsigned int dwLastHeight;
370 unsigned int dwHeight;
371 unsigned int dwMemSize;
374 unsigned int dwCopiedAtFrame;
377 unsigned int lastUsedFrame;
378 unsigned int bUsedByVIAtFrame;
379 unsigned int lastSetAtUcode;
386 } RecentViOriginInfo;
395 TEXTURE_UV_FLAG_WRAP,
396 TEXTURE_UV_FLAG_MIRROR,
397 TEXTURE_UV_FLAG_CLAMP,
402 TextureUVFlag N64flag;
414 TextureFilter N64filter;
419 const char* description;
425 const char* description;
430 uint8 g_Tmem8bit[0x1000];
431 short g_Tmem16bit[0x800];
432 uint32 g_Tmem32bit[0x300];
433 uint64 g_Tmem64bit[0x200];
442 uint32 dwLoadAddress;