1// disable data conversion warnings
2
3#pragma warning(disable : 4244)     // MIPS
4#pragma warning(disable : 4136)     // X86
5#pragma warning(disable : 4051)     // ALPHA
6
7#include <windows.h>
8
9#include <gl\gl.h>
10#include <gl\glu.h>
11
12void GL_BeginRendering (int *x, int *y, int *width, int *height);
13void GL_EndRendering (void);
14
15
16// Function prototypes for the Texture Object Extension routines
17typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
18                    const GLboolean *);
19typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
20typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
21typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
22typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
23typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
24                    const GLclampf *);
25typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
26
27extern	BINDTEXFUNCPTR bindTexFunc;
28extern	DELTEXFUNCPTR delTexFunc;
29extern	TEXSUBIMAGEPTR TexSubImage2DFunc;
30
31extern	int texture_extension_number;
32extern	int		texture_mode;
33
34extern	float	gldepthmin, gldepthmax;
35
36void GL_Upload32 (unsigned *data, int width, int height,  qboolean mipmap, qboolean alpha, qboolean modulate);
37void GL_Upload8 (byte *data, int width, int height,  qboolean mipmap, qboolean alpha, qboolean modulate);
38int GL_LoadTexture (char *identifier, int width, int height, byte *data, int mipmap, int alpha, int modulate);
39int GL_FindTexture (char *identifier);
40
41typedef struct
42{
43	float	x, y, z;
44	float	s, t;
45	float	r, g, b;
46} glvert_t;
47
48extern glvert_t glv;
49
50extern	int glx, gly, glwidth, glheight;
51
52extern	PROC glArrayElementEXT;
53extern	PROC glColorPointerEXT;
54extern	PROC glTexturePointerEXT;
55extern	PROC glVertexPointerEXT;
56
57
58// r_local.h -- private refresh defs
59
60#define MAXALIASVERTS		2000	// TODO: tune this
61
62#define ALIAS_BASE_SIZE_RATIO		(1.0 / 11.0)
63					// normalizing factor so player model works out to about
64					//  1 pixel per triangle
65#define	MAX_LBM_HEIGHT		480
66
67#define TILE_SIZE		128		// size of textures generated by R_GenTiledSurf
68
69#define SKYSHIFT		7
70#define	SKYSIZE			(1 << SKYSHIFT)
71#define SKYMASK			(SKYSIZE - 1)
72
73#define BACKFACE_EPSILON	0.01
74
75
76void R_TimeRefresh_f (void);
77void R_ReadPointFile_f (void);
78texture_t *R_TextureAnimation (texture_t *base);
79
80typedef struct surfcache_s
81{
82	struct surfcache_s	*next;
83	struct surfcache_s 	**owner;		// NULL is an empty chunk of memory
84	int					lightadj[MAXLIGHTMAPS]; // checked for strobe flush
85	int					dlight;
86	int					size;		// including header
87	unsigned			width;
88	unsigned			height;		// DEBUG only needed for debug
89	float				mipscale;
90	struct texture_s	*texture;	// checked for animating textures
91	byte				data[4];	// width*height elements
92} surfcache_t;
93
94
95typedef struct
96{
97	pixel_t		*surfdat;	// destination for generated surface
98	int			rowbytes;	// destination logical width in bytes
99	msurface_t	*surf;		// description for surface to generate
100	fixed8_t	lightadj[MAXLIGHTMAPS];
101							// adjust for lightmap levels for dynamic lighting
102	texture_t	*texture;	// corrected for animating textures
103	int			surfmip;	// mipmapped ratio of surface texels / world pixels
104	int			surfwidth;	// in mipmapped texels
105	int			surfheight;	// in mipmapped texels
106} drawsurf_t;
107
108
109typedef enum {
110	pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
111} ptype_t;
112
113// !!! if this is changed, it must be changed in d_ifacea.h too !!!
114typedef struct particle_s
115{
116// driver-usable fields
117	vec3_t		org;
118	float		color;
119// drivers never touch the following fields
120	struct particle_s	*next;
121	vec3_t		vel;
122	float		ramp;
123	float		die;
124	ptype_t		type;
125} particle_t;
126
127
128//====================================================
129
130
131extern	entity_t	r_worldentity;
132extern	qboolean	r_cache_thrash;		// compatability
133extern	vec3_t		modelorg, r_entorigin;
134extern	entity_t	*currententity;
135extern	int			r_visframecount;	// ??? what difs?
136extern	int			r_framecount;
137extern	mplane_t	frustum[4];
138extern	int		c_brush_polys, c_alias_polys;
139
140
141//
142// view origin
143//
144extern	vec3_t	vup;
145extern	vec3_t	vpn;
146extern	vec3_t	vright;
147extern	vec3_t	r_origin;
148
149//
150// screen size info
151//
152extern	refdef_t	r_refdef;
153extern	mleaf_t		*r_viewleaf, *r_oldviewleaf;
154extern	texture_t	*r_notexture_mip;
155extern	int		d_lightstylevalue[256];	// 8.8 fraction of base light value
156
157extern	qboolean	envmap;
158extern	int	currenttexture;
159extern	int	particletexture;
160extern	int	playertextures;
161
162extern	int	skytexturenum;		// index in cl.loadmodel, not gl texture object
163
164extern	cvar_t	r_drawentities;
165extern	cvar_t	r_drawworld;
166extern	cvar_t	r_drawviewmodel;
167extern	cvar_t	r_speeds;
168extern	cvar_t	r_waterwarp;
169extern	cvar_t	r_fullbright;
170extern	cvar_t	r_lightmap;
171extern	cvar_t	r_shadows;
172extern	cvar_t	r_dynamic;
173
174extern	cvar_t	gl_clear;
175extern	cvar_t	gl_cull;
176extern	cvar_t	gl_poly;
177extern	cvar_t	gl_texsort;
178extern	cvar_t	gl_smoothmodels;
179extern	cvar_t	gl_affinemodels;
180extern	cvar_t	gl_fogblend;
181extern	cvar_t	gl_polyblend;
182extern	cvar_t	gl_keeptjunctions;
183extern	cvar_t	gl_reporttjunctions;
184
185extern	int		gl_lightmap_format;
186extern	int		gl_solid_format;
187extern	int		gl_alpha_format;
188
189void R_TranslatePlayerSkin (int playernum);
190void GL_Bind (int texnum);
191