mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-05 20:50:43 +00:00
232 lines
6.5 KiB
C
232 lines
6.5 KiB
C
/*
|
|
glquake.h
|
|
|
|
OpenGL-specific definitions and prototypes
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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$
|
|
*/
|
|
|
|
#ifndef __glquake_h
|
|
#define __glquake_h
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
|
# include <windows.h>
|
|
#endif
|
|
|
|
#include <GL/gl.h>
|
|
|
|
#include "QF/model.h"
|
|
#include "QF/wad.h"
|
|
|
|
#include "qfgl_ext.h"
|
|
|
|
|
|
void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
|
void GL_EndRendering (void);
|
|
|
|
extern int texture_extension_number;
|
|
extern int texture_mode;
|
|
|
|
extern float gldepthmin, gldepthmax;
|
|
|
|
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);
|
|
int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel);
|
|
int GL_FindTexture (char *identifier);
|
|
|
|
extern int glx, gly, glwidth, glheight;
|
|
|
|
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
|
|
// normalizing factor so player model works out to about
|
|
// 1 pixel per triangle
|
|
|
|
#define MAX_LBM_HEIGHT 480
|
|
|
|
#define MAX_GLTEXTURES 2048
|
|
|
|
#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
|
|
|
|
#define SKYSHIFT 7
|
|
#define SKYSIZE (1 << SKYSHIFT)
|
|
#define SKYMASK (SKYSIZE - 1)
|
|
#define SKY_TEX 2000 // Quake 2 environment sky
|
|
|
|
#define BACKFACE_EPSILON 0.01
|
|
|
|
#define NUM_GRAPH_TEXTURES 8
|
|
|
|
extern qboolean envmap;
|
|
extern int currenttexture;
|
|
extern int cnttextures[2];
|
|
extern int particletexture;
|
|
extern int graph_texture[NUM_GRAPH_TEXTURES];
|
|
extern int netgraphtexture; // netgraph texture
|
|
|
|
extern int skytexturenum; // index in cl.loadmodel, not gl texture object
|
|
|
|
extern struct cvar_s *r_novis;
|
|
extern struct cvar_s *r_particles;
|
|
extern struct cvar_s *r_norefresh;
|
|
extern struct cvar_s *r_drawviewmodel;
|
|
extern struct cvar_s *r_shadows;
|
|
extern struct cvar_s *r_wateralpha;
|
|
extern struct cvar_s *r_waterripple;
|
|
extern struct cvar_s *r_dynamic;
|
|
extern struct cvar_s *r_netgraph;
|
|
extern struct cvar_s *r_lightmap;
|
|
extern struct cvar_s *r_mirroralpha;
|
|
|
|
extern struct cvar_s *gl_affinemodels;
|
|
extern struct cvar_s *gl_clear;
|
|
extern struct cvar_s *gl_cull;
|
|
extern struct cvar_s *gl_poly;
|
|
extern struct cvar_s *gl_texsort;
|
|
extern struct cvar_s *gl_smoothmodels;
|
|
extern struct cvar_s *gl_affinemodels;
|
|
extern struct cvar_s *gl_polyblend;
|
|
extern struct cvar_s *gl_fb_bmodels;
|
|
extern struct cvar_s *gl_fb_models;
|
|
extern struct cvar_s *gl_dlight_lightmap;
|
|
extern struct cvar_s *gl_dlight_polyblend;
|
|
extern struct cvar_s *gl_dlight_smooth;
|
|
extern struct cvar_s *gl_keeptjunctions;
|
|
extern struct cvar_s *gl_reporttjunctions;
|
|
extern struct cvar_s *gl_flashblend;
|
|
extern struct cvar_s *gl_multitexture;
|
|
extern struct cvar_s *gl_nocolors;
|
|
extern struct cvar_s *gl_doubleeyes;
|
|
|
|
extern struct cvar_s *gl_ztrick;
|
|
extern struct cvar_s *gl_finish;
|
|
extern struct cvar_s *gl_clear;
|
|
extern struct cvar_s *gl_subdivide_size;
|
|
extern struct cvar_s *gl_particles;
|
|
extern struct cvar_s *gl_fires;
|
|
extern struct cvar_s *gl_fb_models;
|
|
extern struct cvar_s *gl_fb_bmodels;
|
|
extern struct cvar_s *gl_poly;
|
|
extern struct cvar_s *gl_polyblend;
|
|
|
|
extern struct cvar_s *gl_max_size;
|
|
extern struct cvar_s *gl_playermip;
|
|
|
|
extern struct cvar_s *r_skyname;
|
|
extern struct cvar_s *gl_skymultipass;
|
|
extern struct cvar_s *gl_sky_clip;
|
|
extern struct cvar_s *gl_sky_divide;
|
|
|
|
extern int mirrortexturenum; // quake texturenum, not gltexturenum
|
|
extern qboolean mirror;
|
|
extern mplane_t *mirror_plane;
|
|
extern int gl_lightmap_format;
|
|
extern int gl_solid_format;
|
|
extern int gl_alpha_format;
|
|
|
|
extern unsigned char lighthalf_v[3];
|
|
|
|
extern const char *gl_vendor;
|
|
extern const char *gl_renderer;
|
|
extern const char *gl_version;
|
|
extern const char *gl_extensions;
|
|
|
|
void GL_Bind (int texnum);
|
|
|
|
// Multitexture
|
|
|
|
#define TEXTURE0_SGIS 0x835E
|
|
#define TEXTURE1_SGIS 0x835F
|
|
|
|
#ifndef APIENTRY
|
|
# ifndef _WIN32
|
|
# define APIENTRY /* */
|
|
# endif
|
|
#endif
|
|
|
|
typedef void (APIENTRY *lpMTexFUNC) (GLenum, GLfloat, GLfloat);
|
|
typedef void (APIENTRY *lpSelTexFUNC) (GLenum);
|
|
extern lpMTexFUNC qglMTexCoord2fSGIS;
|
|
extern lpSelTexFUNC qglSelectTextureSGIS;
|
|
extern lpMTexFUNC qglMTexCoord2f;
|
|
extern lpSelTexFUNC qglSelectTexture;
|
|
|
|
extern qboolean gl_mtexable;
|
|
|
|
void GL_SubdivideSurface (msurface_t *fa);
|
|
|
|
// Multitexturing
|
|
extern QF_glActiveTextureARB qglActiveTexture;
|
|
extern QF_glMultiTexCoord2fARB qglMultiTexCoord2f;
|
|
extern qboolean gl_mtex_capable;
|
|
extern GLenum gl_mtex_enum;
|
|
// convenience check
|
|
#define gl_mtex_active (gl_mtex_capable && gl_multitexture->int_val)
|
|
|
|
void GL_DisableMultitexture (void);
|
|
void GL_EnableMultitexture (void);
|
|
struct model_s;
|
|
void GL_BuildLightmaps (struct model_s **models, int num_models);
|
|
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha) ;
|
|
void GL_Set2D (void);
|
|
void GL_CheckGamma (unsigned char *pal);
|
|
void GL_CheckBrightness (unsigned char *pal);
|
|
|
|
typedef struct {
|
|
int key; // allows reusability
|
|
vec3_t origin, owner;
|
|
float size;
|
|
float die, decay; // duration settings
|
|
float minlight; // lighting threshold
|
|
float color[3]; // RGB
|
|
} fire_t;
|
|
|
|
struct entity_s;
|
|
void R_AddFire (vec3_t, vec3_t, struct entity_s *ent);
|
|
fire_t *R_AllocFire (int);
|
|
void R_DrawFire (fire_t *);
|
|
void R_UpdateFires (void);
|
|
|
|
void R_DrawBrushModel (struct entity_s *e);
|
|
void R_DrawWorld (void);
|
|
void R_RenderDlights (void);
|
|
void R_DrawSky (void);
|
|
void R_DrawSkyChain (msurface_t *s);
|
|
void EmitWaterPolys (msurface_t *fa);
|
|
void R_RotateForEntity (struct entity_s *e);
|
|
void EmitWaterPolys (msurface_t *fa);
|
|
void R_NetGraph (void);
|
|
void R_LoadSkys (const char *sky);
|
|
|
|
extern float bubble_sintable[], bubble_costable[];
|
|
extern float v_blend[4];
|
|
|
|
void AddLightBlend (float, float, float, float);
|
|
extern int c_brush_polys, c_alias_polys;
|
|
extern float r_world_matrix[16];
|
|
|
|
int R_InitGraphTextures (int base);
|
|
|
|
#endif // __glquake_h
|