glquake2.h 5.1 KB

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