home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 14 / MA_Cover_14.iso / source / c / q1source_amy / qw / client / glquake.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-21  |  8.0 KB  |  303 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 <GL/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.  
  37. // Function prototypes for the Texture Object Extension routines
  38. typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
  39.                     const GLboolean *);
  40. typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
  41. typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
  42. typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
  43. typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
  44. typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
  45.                     const GLclampf *);
  46. typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
  47.  
  48. extern    BINDTEXFUNCPTR bindTexFunc;
  49. extern    DELTEXFUNCPTR delTexFunc;
  50. extern    TEXSUBIMAGEPTR TexSubImage2DFunc;
  51.  
  52. extern    int texture_extension_number;
  53. extern    int        texture_mode;
  54.  
  55. extern    float    gldepthmin, gldepthmax;
  56.  
  57. void GL_Upload32 (unsigned *data, int width, int height,  qboolean mipmap, qboolean alpha);
  58. void GL_Upload8 (byte *data, int width, int height,  qboolean mipmap, qboolean alpha);
  59. void GL_Upload8_EXT (byte *data, int width, int height,  qboolean mipmap, qboolean alpha);
  60. int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha);
  61. int GL_FindTexture (char *identifier);
  62.  
  63. typedef struct
  64. {
  65.     float    x, y, z;
  66.     float    s, t;
  67.     float    r, g, b;
  68. } glvert_t;
  69.  
  70. extern glvert_t glv;
  71.  
  72. extern    int glx, gly, glwidth, glheight;
  73.  
  74. #ifdef _WIN32
  75. extern    PROC glArrayElementEXT;
  76. extern    PROC glColorPointerEXT;
  77. extern    PROC glTexturePointerEXT;
  78. extern    PROC glVertexPointerEXT;
  79. #endif
  80.  
  81. // r_local.h -- private refresh defs
  82.  
  83. #define ALIAS_BASE_SIZE_RATIO        (1.0 / 11.0)
  84.                     // normalizing factor so player model works out to about
  85.                     //  1 pixel per triangle
  86. #define    MAX_LBM_HEIGHT        480
  87.  
  88. #define TILE_SIZE        128        // size of textures generated by R_GenTiledSurf
  89.  
  90. #define SKYSHIFT        7
  91. #define    SKYSIZE            (1 << SKYSHIFT)
  92. #define SKYMASK            (SKYSIZE - 1)
  93.  
  94. #define BACKFACE_EPSILON    0.01
  95.  
  96.  
  97. void R_TimeRefresh_f (void);
  98. void R_ReadPointFile_f (void);
  99. texture_t *R_TextureAnimation (texture_t *base);
  100.  
  101. typedef struct surfcache_s
  102. {
  103.     struct surfcache_s    *next;
  104.     struct surfcache_s     **owner;        // NULL is an empty chunk of memory
  105.     int                    lightadj[MAXLIGHTMAPS]; // checked for strobe flush
  106.     int                    dlight;
  107.     int                    size;        // including header
  108.     unsigned            width;
  109.     unsigned            height;        // DEBUG only needed for debug
  110.     float                mipscale;
  111.     struct texture_s    *texture;    // checked for animating textures
  112.     byte                data[4];    // width*height elements
  113. } surfcache_t;
  114.  
  115.  
  116. typedef struct
  117. {
  118.     pixel_t        *surfdat;    // destination for generated surface
  119.     int            rowbytes;    // destination logical width in bytes
  120.     msurface_t    *surf;        // description for surface to generate
  121.     fixed8_t    lightadj[MAXLIGHTMAPS];
  122.                             // adjust for lightmap levels for dynamic lighting
  123.     texture_t    *texture;    // corrected for animating textures
  124.     int            surfmip;    // mipmapped ratio of surface texels / world pixels
  125.     int            surfwidth;    // in mipmapped texels
  126.     int            surfheight;    // in mipmapped texels
  127. } drawsurf_t;
  128.  
  129.  
  130. typedef enum {
  131.     pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
  132. } ptype_t;
  133.  
  134. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  135. typedef struct particle_s
  136. {
  137. // driver-usable fields
  138.     vec3_t        org;
  139.     float        color;
  140. // drivers never touch the following fields
  141.     struct particle_s    *next;
  142.     vec3_t        vel;
  143.     float        ramp;
  144.     float        die;
  145.     ptype_t        type;
  146. } particle_t;
  147.  
  148.  
  149. //====================================================
  150.  
  151.  
  152. extern    entity_t    r_worldentity;
  153. extern    qboolean    r_cache_thrash;        // compatability
  154. extern    vec3_t        modelorg, r_entorigin;
  155. extern    entity_t    *currententity;
  156. extern    int            r_visframecount;    // ??? what difs?
  157. extern    int            r_framecount;
  158. extern    mplane_t    frustum[4];
  159. extern    int        c_brush_polys, c_alias_polys;
  160.  
  161.  
  162. //
  163. // view origin
  164. //
  165. extern    vec3_t    vup;
  166. extern    vec3_t    vpn;
  167. extern    vec3_t    vright;
  168. extern    vec3_t    r_origin;
  169.  
  170. //
  171. // screen size info
  172. //
  173. extern    refdef_t    r_refdef;
  174. extern    mleaf_t        *r_viewleaf, *r_oldviewleaf;
  175. extern    texture_t    *r_notexture_mip;
  176. extern    int        d_lightstylevalue[256];    // 8.8 fraction of base light value
  177.  
  178. extern    qboolean    envmap;
  179. extern    int    currenttexture;
  180. extern    int    cnttextures[2];
  181. extern    int    particletexture;
  182. extern    int    netgraphtexture;    // netgraph texture
  183. extern    int    playertextures;
  184.  
  185. extern    int    skytexturenum;        // index in cl.loadmodel, not gl texture object
  186.  
  187. extern    cvar_t    r_norefresh;
  188. extern    cvar_t    r_drawentities;
  189. extern    cvar_t    r_drawworld;
  190. extern    cvar_t    r_drawviewmodel;
  191. extern    cvar_t    r_speeds;
  192. extern    cvar_t    r_waterwarp;
  193. extern    cvar_t    r_fullbright;
  194. extern    cvar_t    r_lightmap;
  195. extern    cvar_t    r_shadows;
  196. extern    cvar_t    r_mirroralpha;
  197. extern    cvar_t    r_wateralpha;
  198. extern    cvar_t    r_dynamic;
  199. extern    cvar_t    r_novis;
  200. extern    cvar_t    r_netgraph;
  201.  
  202. extern    cvar_t    gl_clear;
  203. extern    cvar_t    gl_cull;
  204. extern    cvar_t    gl_poly;
  205. extern    cvar_t    gl_texsort;
  206. extern    cvar_t    gl_smoothmodels;
  207. extern    cvar_t    gl_affinemodels;
  208. extern    cvar_t    gl_polyblend;
  209. extern    cvar_t    gl_keeptjunctions;
  210. extern    cvar_t    gl_reporttjunctions;
  211. extern    cvar_t    gl_flashblend;
  212. extern    cvar_t    gl_nocolors;
  213. extern    cvar_t    gl_finish;
  214.  
  215. extern    int        gl_lightmap_format;
  216. extern    int        gl_solid_format;
  217. extern    int        gl_alpha_format;
  218.  
  219. extern    cvar_t    gl_max_size;
  220. extern    cvar_t    gl_playermip;
  221.  
  222. extern    int            mirrortexturenum;    // quake texturenum, not gltexturenum
  223. extern    qboolean    mirror;
  224. extern    mplane_t    *mirror_plane;
  225.  
  226. extern    float    r_world_matrix[16];
  227.  
  228. extern    const char *gl_vendor;
  229. extern    const char *gl_renderer;
  230. extern    const char *gl_version;
  231. extern    const char *gl_extensions;
  232.  
  233. void R_TranslatePlayerSkin (int playernum);
  234. void GL_Bind (int texnum);
  235.  
  236. // Multitexture
  237. #define    TEXTURE0_SGIS                0x835E
  238. #define    TEXTURE1_SGIS                0x835F
  239.  
  240. #ifdef _WIN32
  241. typedef void (APIENTRY *lpMTexFUNC) (GLenum, GLfloat, GLfloat);
  242. typedef void (APIENTRY *lpSelTexFUNC) (GLenum);
  243. extern lpMTexFUNC qglMTexCoord2fSGIS;
  244. extern lpSelTexFUNC qglSelectTextureSGIS;
  245. #endif
  246.  
  247. extern qboolean gl_mtexable;
  248.  
  249. void GL_DisableMultitexture(void);
  250. void GL_EnableMultitexture(void);
  251.  
  252. //
  253. // gl_warp.c
  254. //
  255. void GL_SubdivideSurface (msurface_t *fa);
  256. void EmitBothSkyLayers (msurface_t *fa);
  257. void EmitWaterPolys (msurface_t *fa);
  258. void EmitSkyPolys (msurface_t *fa);
  259. void R_DrawSkyChain (msurface_t *s);
  260.  
  261. //
  262. // gl_draw.c
  263. //
  264. int GL_LoadPicTexture (qpic_t *pic);
  265. void GL_Set2D (void);
  266.  
  267. //
  268. // gl_rmain.c
  269. //
  270. qboolean R_CullBox (vec3_t mins, vec3_t maxs);
  271. void R_RotateForEntity (entity_t *e);
  272.  
  273. //
  274. // gl_rlight.c
  275. //
  276. void R_MarkLights (dlight_t *light, int bit, mnode_t *node);
  277. void R_AnimateLight (void);
  278. void R_RenderDlights (void);
  279. int R_LightPoint (vec3_t p);
  280.  
  281. //
  282. // gl_refrag.c
  283. //
  284. void R_StoreEfrags (efrag_t **ppefrag);
  285.  
  286. //
  287. // gl_mesh.c
  288. //
  289. void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr);
  290.  
  291. //
  292. // gl_rsurf.c
  293. //
  294. void R_DrawBrushModel (entity_t *e);
  295. void R_DrawWorld (void);
  296. void GL_BuildLightmaps (void);
  297.  
  298. //
  299. // gl_ngraph.c
  300. //
  301. void R_NetGraph (void);
  302.  
  303.