glquake2.h 5.8 KB

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