gl_intern.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /* Emacs style mode select -*- C++ -*-
  2. *-----------------------------------------------------------------------------
  3. *
  4. *
  5. * PrBoom: a Doom port merged with LxDoom and LSDLDoom
  6. * based on BOOM, a modified and improved DOOM engine
  7. * Copyright (C) 1999 by
  8. * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
  9. * Copyright (C) 1999-2000 by
  10. * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
  11. * Copyright 2005, 2006 by
  12. * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version 2
  17. * of the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  27. * 02111-1307, USA.
  28. *
  29. * DESCRIPTION:
  30. *
  31. *---------------------------------------------------------------------
  32. */
  33. #ifndef _GL_INTERN_H
  34. #define _GL_INTERN_H
  35. typedef enum
  36. {
  37. GLDT_UNREGISTERED,
  38. GLDT_BROKEN,
  39. GLDT_PATCH,
  40. GLDT_TEXTURE,
  41. GLDT_FLAT
  42. } GLTexType;
  43. typedef struct
  44. {
  45. int index;
  46. int width,height;
  47. int leftoffset,topoffset;
  48. int tex_width,tex_height;
  49. int realtexwidth, realtexheight;
  50. int buffer_width,buffer_height;
  51. int buffer_size;
  52. GLuint glTexID[CR_LIMIT+MAXPLAYERS];
  53. GLTexType textype;
  54. boolean mipmap;
  55. } GLTexture;
  56. // JDC: moved these to header ---------------------------
  57. #define MAP_COEFF 128.0f
  58. #define MAP_SCALE (MAP_COEFF*(float)FRACUNIT)
  59. typedef struct
  60. {
  61. float x1,x2;
  62. float z1,z2;
  63. } GLSeg;
  64. #define GLDWF_TOP 1
  65. #define GLDWF_M1S 2
  66. #define GLDWF_M2S 3
  67. #define GLDWF_BOT 4
  68. #define GLDWF_SKY 5
  69. #define GLDWF_SKYFLIP 6
  70. typedef struct
  71. {
  72. GLSeg *glseg;
  73. float ytop,ybottom;
  74. float ul,ur,vt,vb;
  75. float light;
  76. float alpha;
  77. float skyymid;
  78. float skyyaw;
  79. GLTexture *gltexture;
  80. byte flag;
  81. #ifdef IPHONE
  82. side_t *side;
  83. #endif
  84. } GLWall;
  85. typedef struct
  86. {
  87. int sectornum;
  88. float light; // the lightlevel of the flat
  89. float uoffs,voffs; // the texture coordinates
  90. float z; // the z position of the flat (height)
  91. GLTexture *gltexture;
  92. boolean ceiling;
  93. } GLFlat;
  94. typedef struct
  95. {
  96. int cm;
  97. float x,y,z;
  98. float vt,vb;
  99. float ul,ur;
  100. float x1,y1;
  101. float x2,y2;
  102. float light;
  103. fixed_t scale;
  104. GLTexture *gltexture;
  105. boolean shadow;
  106. boolean trans;
  107. } GLSprite;
  108. typedef enum
  109. {
  110. GLDIT_NONE,
  111. GLDIT_WALL,
  112. GLDIT_FLAT,
  113. GLDIT_SPRITE
  114. } GLDrawItemType;
  115. typedef struct
  116. {
  117. GLDrawItemType itemtype;
  118. int itemcount;
  119. int firstitemindex;
  120. byte rendermarker;
  121. } GLDrawItem;
  122. typedef struct
  123. {
  124. GLWall *walls;
  125. int num_walls;
  126. int max_walls;
  127. GLFlat *flats;
  128. int num_flats;
  129. int max_flats;
  130. GLSprite *sprites;
  131. int num_sprites;
  132. int max_sprites;
  133. GLDrawItem *drawitems;
  134. int num_drawitems;
  135. int max_drawitems;
  136. } GLDrawInfo;
  137. extern GLDrawInfo gld_drawinfo;
  138. typedef struct
  139. {
  140. GLfloat x;
  141. GLfloat y;
  142. GLfloat z;
  143. } GLVertex;
  144. typedef struct
  145. {
  146. GLfloat u;
  147. GLfloat v;
  148. } GLTexcoord;
  149. /* GLLoopDef is the struct for one loop. A loop is a list of vertexes
  150. * for triangles, which is calculated by the gluTesselator in gld_PrecalculateSector
  151. * and in gld_PreprocessCarvedFlat
  152. */
  153. typedef struct
  154. {
  155. GLenum mode; // GL_TRIANGLES, GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN
  156. int vertexcount; // number of vertexes in this loop
  157. int vertexindex; // index into vertex list
  158. } GLLoopDef;
  159. // GLSector is the struct for a sector with a list of loops.
  160. typedef struct
  161. {
  162. int loopcount; // number of loops for this sector
  163. GLLoopDef *loops; // the loops itself
  164. } GLSector;
  165. extern GLSector *sectorloops;
  166. typedef struct drawVert_s { // JDC
  167. float xyz[3]; // TODO: adjust MAP_SCALE, make shorts
  168. float st[2]; // TODO: set texture matrix, make shorts
  169. unsigned char rgba[4];
  170. } drawVert_t;
  171. #define MAX_DRAW_VERTS 0x10000
  172. extern drawVert_t drawVerts[MAX_DRAW_VERTS];
  173. extern int numDrawVerts;
  174. //--------------------------------------
  175. extern int gld_max_texturesize;
  176. extern const char *gl_tex_format_string;
  177. extern int gl_tex_format;
  178. extern int gl_tex_filter;
  179. extern int gl_mipmap_filter;
  180. extern int gl_texture_filter_anisotropic;
  181. extern int gl_paletted_texture;
  182. extern int gl_shared_texture_palette;
  183. extern boolean use_mipmapping;
  184. extern int transparent_pal_index;
  185. extern unsigned char gld_palmap[256];
  186. extern GLTexture *last_gltexture;
  187. extern int last_cm;
  188. //e6y: in some cases textures with a zero index (NO_TEXTURE) should be registered
  189. GLTexture *gld_RegisterTexture(int texture_num, boolean mipmap, boolean force);
  190. void gld_BindTexture(GLTexture *gltexture);
  191. GLTexture *gld_RegisterPatch(int lump, int cm);
  192. void gld_BindPatch(GLTexture *gltexture, int cm);
  193. GLTexture *gld_RegisterFlat(int lump, boolean mipmap);
  194. void gld_BindFlat(GLTexture *gltexture);
  195. void gld_InitPalettedTextures(void);
  196. int gld_GetTexDimension(int value);
  197. void gld_SetTexturePalette(GLenum target);
  198. void gld_Precache(void);
  199. extern PFNGLCOLORTABLEEXTPROC gld_ColorTableEXT;
  200. #endif // _GL_INTERN_H