2000-05-10 11:29:38 +00:00
|
|
|
/*
|
2000-05-22 08:40:21 +00:00
|
|
|
glquake.h
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-22 08:40:21 +00:00
|
|
|
OpenGL-specific definitions and prototypes
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-22 08:40:21 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-22 08:40:21 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-22 08:40:21 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-22 08:40:21 +00:00
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
2000-05-10 11:29:38 +00:00
|
|
|
*/
|
2000-05-19 06:44:56 +00:00
|
|
|
|
|
|
|
#ifndef _GLQUAKE_H
|
|
|
|
#define _GLQUAKE_H
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-23 21:46:17 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-06 07:29:17 +00:00
|
|
|
#ifdef HAVE_WINDOWS_H
|
2001-01-04 19:57:26 +00:00
|
|
|
# include <windows.h>
|
2000-05-10 11:29:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <GL/gl.h>
|
|
|
|
|
2001-01-04 19:57:26 +00:00
|
|
|
#include "client.h"
|
|
|
|
#include "cvar.h"
|
2000-05-19 06:44:56 +00:00
|
|
|
#include "model.h"
|
|
|
|
#include "render.h"
|
2001-01-06 07:29:17 +00:00
|
|
|
#include "qfgl_ext.h"
|
2000-05-21 08:24:45 +00:00
|
|
|
#include "wad.h"
|
2000-05-19 06:44:56 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
|
|
|
void GL_EndRendering (void);
|
|
|
|
|
2001-01-06 07:29:17 +00:00
|
|
|
extern int texture_extension_number;
|
|
|
|
extern int texture_mode;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2001-01-06 07:29:17 +00:00
|
|
|
extern float gldepthmin, gldepthmax;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha);
|
|
|
|
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha);
|
2000-06-23 08:43:32 +00:00
|
|
|
int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2001-01-06 07:29:17 +00:00
|
|
|
typedef struct {
|
2000-05-10 11:29:38 +00:00
|
|
|
float x, y, z;
|
|
|
|
float s, t;
|
|
|
|
float r, g, b;
|
|
|
|
} glvert_t;
|
|
|
|
|
|
|
|
extern glvert_t glv;
|
|
|
|
|
|
|
|
extern int glx, gly, glwidth, glheight;
|
|
|
|
|
|
|
|
// r_local.h -- private refresh defs
|
|
|
|
|
|
|
|
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
|
|
|
|
// normalizing factor so player model works out to about
|
|
|
|
// 1 pixel per triangle
|
2000-05-13 02:42:42 +00:00
|
|
|
|
2000-09-20 23:06:26 +00:00
|
|
|
#define MAX_LBM_HEIGHT 480
|
|
|
|
|
|
|
|
#define MAX_GLTEXTURES 2048
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
|
|
|
|
|
|
|
|
#define SKYSHIFT 7
|
|
|
|
#define SKYSIZE (1 << SKYSHIFT)
|
|
|
|
#define SKYMASK (SKYSIZE - 1)
|
2000-11-15 17:20:54 +00:00
|
|
|
#define SKY_TEX 2000 // Quake 2 environment sky
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
#define BACKFACE_EPSILON 0.01
|
|
|
|
|
|
|
|
|
|
|
|
void R_TimeRefresh_f (void);
|
|
|
|
void R_ReadPointFile_f (void);
|
|
|
|
texture_t *R_TextureAnimation (texture_t *base);
|
|
|
|
|
2001-01-06 07:29:17 +00:00
|
|
|
typedef struct surfcache_s {
|
2000-05-10 11:29:38 +00:00
|
|
|
struct surfcache_s *next;
|
|
|
|
struct surfcache_s **owner; // NULL is an empty chunk of memory
|
|
|
|
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
|
|
|
|
int dlight;
|
|
|
|
int size; // including header
|
2000-09-22 09:08:08 +00:00
|
|
|
unsigned int width;
|
|
|
|
unsigned int height; // DEBUG only needed for debug
|
2000-05-10 11:29:38 +00:00
|
|
|
float mipscale;
|
|
|
|
struct texture_s *texture; // checked for animating textures
|
|
|
|
byte data[4]; // width*height elements
|
|
|
|
} surfcache_t;
|
|
|
|
|
|
|
|
|
|
|
|
//====================================================
|
|
|
|
|
|
|
|
|
|
|
|
extern entity_t r_worldentity;
|
|
|
|
extern qboolean r_cache_thrash; // compatability
|
|
|
|
extern vec3_t modelorg, r_entorigin;
|
|
|
|
extern entity_t *currententity;
|
|
|
|
extern int r_visframecount; // ??? what difs?
|
|
|
|
extern int r_framecount;
|
|
|
|
extern mplane_t frustum[4];
|
|
|
|
extern int c_brush_polys, c_alias_polys;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// view origin
|
|
|
|
//
|
|
|
|
extern vec3_t vup;
|
|
|
|
extern vec3_t vpn;
|
|
|
|
extern vec3_t vright;
|
|
|
|
extern vec3_t r_origin;
|
|
|
|
|
|
|
|
//
|
|
|
|
// screen size info
|
|
|
|
//
|
|
|
|
extern refdef_t r_refdef;
|
|
|
|
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
|
|
|
extern texture_t *r_notexture_mip;
|
|
|
|
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
|
|
|
|
|
|
|
extern qboolean envmap;
|
|
|
|
extern int netgraphtexture; // netgraph texture
|
|
|
|
extern int playertextures;
|
2001-01-19 06:16:40 +00:00
|
|
|
extern int player_fb_textures;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
extern int skytexturenum; // index in cl.loadmodel, not gl texture object
|
|
|
|
|
2000-05-23 21:46:17 +00:00
|
|
|
extern cvar_t *r_norefresh;
|
|
|
|
extern cvar_t *r_drawentities;
|
2001-01-06 07:29:17 +00:00
|
|
|
extern cvar_t *r_drawworld;
|
|
|
|
extern cvar_t *r_drawviewmodel;
|
2001-01-29 00:13:01 +00:00
|
|
|
extern cvar_t *r_particles;
|
2001-01-06 07:29:17 +00:00
|
|
|
extern cvar_t *r_speeds;
|
|
|
|
extern cvar_t *r_waterwarp;
|
|
|
|
extern cvar_t *r_shadows;
|
|
|
|
extern cvar_t *r_wateralpha;
|
|
|
|
extern cvar_t *r_waterripple;
|
|
|
|
extern cvar_t *r_dynamic;
|
|
|
|
extern cvar_t *r_novis;
|
|
|
|
extern cvar_t *r_netgraph;
|
|
|
|
|
2001-01-09 00:25:31 +00:00
|
|
|
extern cvar_t *gl_affinemodels;
|
2001-01-06 07:29:17 +00:00
|
|
|
extern cvar_t *gl_clear;
|
|
|
|
extern cvar_t *gl_cull;
|
2001-01-09 00:25:31 +00:00
|
|
|
extern cvar_t *gl_fb_bmodels;
|
|
|
|
extern cvar_t *gl_fb_models;
|
2001-02-01 19:53:15 +00:00
|
|
|
extern cvar_t *gl_dlight_lightmap;
|
|
|
|
extern cvar_t *gl_dlight_polyblend;
|
|
|
|
extern cvar_t *gl_dlight_smooth;
|
2001-01-09 00:25:31 +00:00
|
|
|
extern cvar_t *gl_keeptjunctions;
|
|
|
|
extern cvar_t *gl_multitexture;
|
2001-01-06 07:29:17 +00:00
|
|
|
extern cvar_t *gl_nocolors;
|
2001-01-09 00:25:31 +00:00
|
|
|
extern cvar_t *gl_poly;
|
|
|
|
extern cvar_t *gl_polyblend;
|
2001-01-06 07:29:17 +00:00
|
|
|
|
|
|
|
extern cvar_t *gl_max_size;
|
|
|
|
extern cvar_t *gl_playermip;
|
|
|
|
|
|
|
|
extern cvar_t *r_skyname;
|
|
|
|
extern cvar_t *gl_skymultipass;
|
|
|
|
extern cvar_t *gl_sky_clip;
|
|
|
|
extern cvar_t *gl_sky_divide;
|
|
|
|
|
|
|
|
extern int gl_lightmap_format;
|
|
|
|
extern int gl_solid_format;
|
|
|
|
extern int gl_alpha_format;
|
|
|
|
|
|
|
|
extern float r_world_matrix[16];
|
|
|
|
|
|
|
|
extern const char *gl_vendor;
|
|
|
|
extern const char *gl_renderer;
|
|
|
|
extern const char *gl_version;
|
|
|
|
extern const char *gl_extensions;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
void R_TranslatePlayerSkin (int playernum);
|
|
|
|
|
2001-01-06 07:29:17 +00:00
|
|
|
// Multitexturing
|
|
|
|
extern QF_glActiveTextureARB qglActiveTexture;
|
|
|
|
extern QF_glMultiTexCoord2fARB qglMultiTexCoord2f;
|
|
|
|
extern qboolean gl_mtex_capable;
|
|
|
|
extern GLenum gl_mtex_enum;
|
2001-01-09 00:25:31 +00:00
|
|
|
// convenience check
|
|
|
|
#define gl_mtex_active (gl_mtex_capable && gl_multitexture->int_val)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-06-09 21:34:21 +00:00
|
|
|
void GL_DisableMultitexture (void);
|
|
|
|
void GL_EnableMultitexture (void);
|
|
|
|
void GL_SelectTexture (GLenum target);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-06-19 22:15:18 +00:00
|
|
|
//
|
|
|
|
// gl_rpart.c
|
|
|
|
//
|
|
|
|
typedef struct {
|
|
|
|
int key; // allows reusability
|
|
|
|
vec3_t origin, owner;
|
|
|
|
float size;
|
|
|
|
float die, decay; // duration settings
|
|
|
|
float minlight; // lighting threshold
|
2001-01-27 03:01:09 +00:00
|
|
|
float color[3]; // !RGBA
|
2000-06-19 22:15:18 +00:00
|
|
|
} fire_t;
|
|
|
|
|
|
|
|
void R_AddFire (vec3_t, vec3_t, entity_t *ent);
|
|
|
|
fire_t *R_AllocFire (int);
|
|
|
|
void R_DrawFire (fire_t *);
|
|
|
|
void R_UpdateFires (void);
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
//
|
|
|
|
// gl_warp.c
|
|
|
|
//
|
|
|
|
void GL_SubdivideSurface (msurface_t *fa);
|
|
|
|
void EmitBothSkyLayers (msurface_t *fa);
|
|
|
|
void EmitWaterPolys (msurface_t *fa);
|
|
|
|
void EmitSkyPolys (msurface_t *fa);
|
|
|
|
void R_DrawSkyChain (msurface_t *s);
|
2000-05-18 04:34:26 +00:00
|
|
|
void R_LoadSkys (char *);
|
2000-06-17 10:39:28 +00:00
|
|
|
void R_DrawSky (void);
|
2000-10-29 22:21:53 +00:00
|
|
|
void R_DrawSkyChain (msurface_t *sky_chain);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// gl_draw.c
|
|
|
|
//
|
|
|
|
void GL_Set2D (void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// gl_rmain.c
|
|
|
|
//
|
2000-09-26 09:03:21 +00:00
|
|
|
//qboolean R_CullBox (vec3_t mins, vec3_t maxs);
|
2000-05-10 11:29:38 +00:00
|
|
|
void R_RotateForEntity (entity_t *e);
|
|
|
|
|
2001-05-29 20:29:39 +00:00
|
|
|
static inline qboolean R_CullBox (vec3_t mins, vec3_t maxs)
|
2000-09-26 09:03:21 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i=0 ; i<4 ; i++)
|
|
|
|
if (BoxOnPlaneSide (mins, maxs, &frustum[i]) == 2)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
//
|
|
|
|
// gl_rlight.c
|
|
|
|
//
|
2000-05-12 23:19:23 +00:00
|
|
|
|
2000-06-29 09:21:23 +00:00
|
|
|
extern float bubble_sintable[], bubble_costable[];
|
2000-05-12 23:19:23 +00:00
|
|
|
extern float v_blend[4];
|
|
|
|
|
2000-06-30 23:10:23 +00:00
|
|
|
void R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, mnode_t *node);
|
2000-05-10 11:29:38 +00:00
|
|
|
void R_AnimateLight (void);
|
|
|
|
void R_RenderDlights (void);
|
|
|
|
int R_LightPoint (vec3_t p);
|
2000-06-19 22:56:28 +00:00
|
|
|
void AddLightBlend (float, float, float, float);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// gl_refrag.c
|
|
|
|
//
|
|
|
|
void R_StoreEfrags (efrag_t **ppefrag);
|
|
|
|
|
2000-09-28 00:22:24 +00:00
|
|
|
//
|
|
|
|
// gl_screen.c
|
|
|
|
//
|
|
|
|
|
|
|
|
extern qboolean lighthalf;
|
|
|
|
extern unsigned char lighthalf_v[3];
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
//
|
|
|
|
// gl_rsurf.c
|
|
|
|
//
|
|
|
|
void R_DrawBrushModel (entity_t *e);
|
|
|
|
void R_DrawWorld (void);
|
|
|
|
void GL_BuildLightmaps (void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// gl_ngraph.c
|
|
|
|
//
|
|
|
|
void R_NetGraph (void);
|
|
|
|
|
2000-05-21 08:24:45 +00:00
|
|
|
#endif // _GLQUAKE_H
|