home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / glquake_src / glquake.h < prev    next >
C/C++ Source or Header  |  2000-01-21  |  7KB  |  254 lines

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