1 // SONIC ROBO BLAST 2
2 //-----------------------------------------------------------------------------
3 // Copyright (C) 1998-2000 by DooM Legacy Team.
4 // Copyright (C) 1999-2020 by Sonic Team Junior.
5 //
6 // This program is free software distributed under the
7 // terms of the GNU General Public License, version 2.
8 // See the 'LICENSE' file for more details.
9 //-----------------------------------------------------------------------------
10 /// \file hw_data.h
11 /// \brief defines structures and exports for the hardware interface used by Sonic Robo Blast 2
12 
13 #ifndef _HWR_DATA_
14 #define _HWR_DATA_
15 
16 #if defined (_WIN32) && !defined (__CYGWIN__)
17 //#define WIN32_LEAN_AND_MEAN
18 #define RPC_NO_WINDOWS_H
19 #include <windows.h>
20 #endif
21 
22 #include "../doomdef.h"
23 #include "../screen.h"
24 
25 
26 // ==========================================================================
27 //                                                               TEXTURE INFO
28 // ==========================================================================
29 
30 typedef enum GLTextureFormat_e
31 {
32 	GL_TEXFMT_P_8                 = 0x01, /* 8-bit palette */
33 	GL_TEXFMT_AP_88               = 0x02, /* 8-bit alpha, 8-bit palette */
34 
35 	GL_TEXFMT_RGBA                = 0x10, /* 32 bit RGBA! */
36 
37 	GL_TEXFMT_ALPHA_8             = 0x20, /* (0..0xFF) alpha     */
38 	GL_TEXFMT_INTENSITY_8         = 0x21, /* (0..0xFF) intensity */
39 	GL_TEXFMT_ALPHA_INTENSITY_88  = 0x22,
40 } GLTextureFormat_t;
41 
42 // Colormap structure for mipmaps.
43 struct GLColormap_s
44 {
45 	const UINT8 *source;
46 	UINT8 data[256];
47 };
48 typedef struct GLColormap_s GLColormap_t;
49 
50 
51 // Texture information (misleadingly named "mipmap" all over the code.)
52 // The *data pointer holds the address of the graphics data cached in heap memory.
53 // NULL if the texture is not in SRB2's heap cache.
54 struct GLMipmap_s
55 {
56 	// for UpdateTexture
57 	GLTextureFormat_t     format;
58 	void                 *data;
59 
60 	UINT32                flags;
61 	UINT16                height;
62 	UINT16                width;
63 	UINT32                downloaded; // The GPU has this texture.
64 
65 	struct GLMipmap_s    *nextcolormap;
66 	struct GLColormap_s  *colormap;
67 };
68 typedef struct GLMipmap_s GLMipmap_t;
69 
70 
71 //
72 // Level textures, as cached for hardware rendering.
73 //
74 struct GLMapTexture_s
75 {
76 	GLMipmap_t  mipmap;
77 	float       scaleX; // Used for scaling textures on walls
78 	float       scaleY;
79 };
80 typedef struct GLMapTexture_s GLMapTexture_t;
81 
82 
83 // Patch information for the hardware renderer.
84 struct GLPatch_s
85 {
86 	GLMipmap_t *mipmap; // Texture data. Allocated whenever the patch is.
87 	float       max_s, max_t;
88 };
89 typedef struct GLPatch_s GLPatch_t;
90 
91 #endif //_HWR_DATA_
92