glquake.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. // disable data conversion warnings
  16. #pragma warning(disable : 4244) // MIPS
  17. #pragma warning(disable : 4136) // X86
  18. #pragma warning(disable : 4051) // ALPHA
  19. #ifdef _WIN32
  20. #include <windows.h>
  21. #endif
  22. #include <GL/gl.h>
  23. #include <GL/glu.h>
  24. void GL_BeginRendering (int *x, int *y, int *width, int *height);
  25. void GL_EndRendering (void);
  26. // Function prototypes for the Texture Object Extension routines
  27. typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
  28. const GLboolean *);
  29. typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
  30. typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
  31. typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
  32. typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
  33. typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
  34. const GLclampf *);
  35. typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
  36. extern BINDTEXFUNCPTR bindTexFunc;
  37. extern DELTEXFUNCPTR delTexFunc;
  38. extern TEXSUBIMAGEPTR TexSubImage2DFunc;
  39. extern int texture_extension_number;
  40. extern int texture_mode;
  41. extern float gldepthmin, gldepthmax;
  42. void GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap, qboolean alpha);
  43. void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha);
  44. void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha);
  45. int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha);
  46. int GL_FindTexture (char *identifier);
  47. typedef struct
  48. {
  49. float x, y, z;
  50. float s, t;
  51. float r, g, b;
  52. } glvert_t;
  53. extern glvert_t glv;
  54. extern int glx, gly, glwidth, glheight;
  55. #ifdef _WIN32
  56. extern PROC glArrayElementEXT;
  57. extern PROC glColorPointerEXT;
  58. extern PROC glTexturePointerEXT;
  59. extern PROC glVertexPointerEXT;
  60. #endif
  61. // r_local.h -- private refresh defs
  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. #define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
  67. #define SKYSHIFT 7
  68. #define SKYSIZE (1 << SKYSHIFT)
  69. #define SKYMASK (SKYSIZE - 1)
  70. #define BACKFACE_EPSILON 0.01
  71. void R_TimeRefresh_f (void);
  72. void R_ReadPointFile_f (void);
  73. texture_t *R_TextureAnimation (texture_t *base);
  74. typedef struct surfcache_s
  75. {
  76. struct surfcache_s *next;
  77. struct surfcache_s **owner; // NULL is an empty chunk of memory
  78. int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
  79. int dlight;
  80. int size; // including header
  81. unsigned width;
  82. unsigned height; // DEBUG only needed for debug
  83. float mipscale;
  84. struct texture_s *texture; // checked for animating textures
  85. byte data[4]; // width*height elements
  86. } surfcache_t;
  87. typedef struct
  88. {
  89. pixel_t *surfdat; // destination for generated surface
  90. int rowbytes; // destination logical width in bytes
  91. msurface_t *surf; // description for surface to generate
  92. fixed8_t lightadj[MAXLIGHTMAPS];
  93. // adjust for lightmap levels for dynamic lighting
  94. texture_t *texture; // corrected for animating textures
  95. int surfmip; // mipmapped ratio of surface texels / world pixels
  96. int surfwidth; // in mipmapped texels
  97. int surfheight; // in mipmapped texels
  98. } drawsurf_t;
  99. typedef enum {
  100. pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
  101. } ptype_t;
  102. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  103. typedef struct particle_s
  104. {
  105. // driver-usable fields
  106. vec3_t org;
  107. float color;
  108. // drivers never touch the following fields
  109. struct particle_s *next;
  110. vec3_t vel;
  111. float ramp;
  112. float die;
  113. ptype_t type;
  114. } particle_t;
  115. //====================================================
  116. extern entity_t r_worldentity;
  117. extern qboolean r_cache_thrash; // compatability
  118. extern vec3_t modelorg, r_entorigin;
  119. extern entity_t *currententity;
  120. extern int r_visframecount; // ??? what difs?
  121. extern int r_framecount;
  122. extern mplane_t frustum[4];
  123. extern int c_brush_polys, c_alias_polys;
  124. //
  125. // view origin
  126. //
  127. extern vec3_t vup;
  128. extern vec3_t vpn;
  129. extern vec3_t vright;
  130. extern vec3_t r_origin;
  131. //
  132. // screen size info
  133. //
  134. extern refdef_t r_refdef;
  135. extern mleaf_t *r_viewleaf, *r_oldviewleaf;
  136. extern texture_t *r_notexture_mip;
  137. extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
  138. extern qboolean envmap;
  139. extern int currenttexture;
  140. extern int cnttextures[2];
  141. extern int particletexture;
  142. extern int netgraphtexture; // netgraph texture
  143. extern int playertextures;
  144. extern int skytexturenum; // index in cl.loadmodel, not gl texture object
  145. extern cvar_t r_norefresh;
  146. extern cvar_t r_drawentities;
  147. extern cvar_t r_drawworld;
  148. extern cvar_t r_drawviewmodel;
  149. extern cvar_t r_speeds;
  150. extern cvar_t r_waterwarp;
  151. extern cvar_t r_fullbright;
  152. extern cvar_t r_lightmap;
  153. extern cvar_t r_shadows;
  154. extern cvar_t r_mirroralpha;
  155. extern cvar_t r_wateralpha;
  156. extern cvar_t r_dynamic;
  157. extern cvar_t r_novis;
  158. extern cvar_t r_netgraph;
  159. extern cvar_t gl_clear;
  160. extern cvar_t gl_cull;
  161. extern cvar_t gl_poly;
  162. extern cvar_t gl_texsort;
  163. extern cvar_t gl_smoothmodels;
  164. extern cvar_t gl_affinemodels;
  165. extern cvar_t gl_polyblend;
  166. extern cvar_t gl_keeptjunctions;
  167. extern cvar_t gl_reporttjunctions;
  168. extern cvar_t gl_flashblend;
  169. extern cvar_t gl_nocolors;
  170. extern cvar_t gl_finish;
  171. extern int gl_lightmap_format;
  172. extern int gl_solid_format;
  173. extern int gl_alpha_format;
  174. extern cvar_t gl_max_size;
  175. extern cvar_t gl_playermip;
  176. extern int mirrortexturenum; // quake texturenum, not gltexturenum
  177. extern qboolean mirror;
  178. extern mplane_t *mirror_plane;
  179. extern float r_world_matrix[16];
  180. extern const char *gl_vendor;
  181. extern const char *gl_renderer;
  182. extern const char *gl_version;
  183. extern const char *gl_extensions;
  184. void R_TranslatePlayerSkin (int playernum);
  185. void GL_Bind (int texnum);
  186. // Multitexture
  187. #define TEXTURE0_SGIS 0x835E
  188. #define TEXTURE1_SGIS 0x835F
  189. #ifdef _WIN32
  190. typedef void (APIENTRY *lpMTexFUNC) (GLenum, GLfloat, GLfloat);
  191. typedef void (APIENTRY *lpSelTexFUNC) (GLenum);
  192. extern lpMTexFUNC qglMTexCoord2fSGIS;
  193. extern lpSelTexFUNC qglSelectTextureSGIS;
  194. #endif
  195. extern qboolean gl_mtexable;
  196. void GL_DisableMultitexture(void);
  197. void GL_EnableMultitexture(void);
  198. //
  199. // gl_warp.c
  200. //
  201. void GL_SubdivideSurface (msurface_t *fa);
  202. void EmitBothSkyLayers (msurface_t *fa);
  203. void EmitWaterPolys (msurface_t *fa);
  204. void EmitSkyPolys (msurface_t *fa);
  205. void R_DrawSkyChain (msurface_t *s);
  206. //
  207. // gl_draw.c
  208. //
  209. int GL_LoadPicTexture (qpic_t *pic);
  210. void GL_Set2D (void);
  211. //
  212. // gl_rmain.c
  213. //
  214. qboolean R_CullBox (vec3_t mins, vec3_t maxs);
  215. void R_RotateForEntity (entity_t *e);
  216. //
  217. // gl_rlight.c
  218. //
  219. void R_MarkLights (dlight_t *light, int bit, mnode_t *node);
  220. void R_AnimateLight (void);
  221. void R_RenderDlights (void);
  222. int R_LightPoint (vec3_t p);
  223. //
  224. // gl_refrag.c
  225. //
  226. void R_StoreEfrags (efrag_t **ppefrag);
  227. //
  228. // gl_mesh.c
  229. //
  230. void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr);
  231. //
  232. // gl_rsurf.c
  233. //
  234. void R_DrawBrushModel (entity_t *e);
  235. void R_DrawWorld (void);
  236. void GL_BuildLightmaps (void);
  237. //
  238. // gl_ngraph.c
  239. //
  240. void R_NetGraph (void);