1 #if (USE_POLYMOST == 0) 2 #error Polymost not enabled. 3 #endif 4 5 #define PI 3.14159265358979323 6 7 extern int rendmode; 8 extern float gtang; 9 extern double dxb1[MAXWALLSB], dxb2[MAXWALLSB]; 10 11 #ifdef DEBUGGINGAIDS 12 struct polymostcallcounts { 13 int drawpoly_glcall; 14 int drawaux_glcall; 15 int drawpoly; 16 int domost; 17 int drawalls; 18 int drawmaskwall; 19 int drawsprite; 20 }; 21 extern struct polymostcallcounts polymostcallcounts; 22 #endif 23 24 enum { 25 METH_SOLID = 0, 26 METH_MASKED = 1, 27 METH_TRANS = 2, 28 METH_INTRANS = 3, 29 30 METH_CLAMPED = 4, 31 METH_LAYERS = 8, // when given to drawpoly, renders the additional texture layers 32 METH_POW2XSPLIT = 16, // when given to drawpoly, splits polygons for non-2^x-capable GL devices 33 METH_ROTATESPRITE = 32, // when given to drawpoly, use the rotatesprite projection matrix 34 }; 35 36 #if USE_OPENGL 37 38 #include "glbuild.h" 39 40 typedef struct { unsigned char r, g, b, a; } coltype; 41 typedef struct { GLfloat r, g, b, a; } coltypef; 42 43 extern float glox1, gloy1; 44 extern double gxyaspect, grhalfxdown10x; 45 extern double gcosang, gsinang, gcosang2, gsinang2; 46 extern double gchang, gshang, gctang, gstang; 47 extern int gfogpalnum; 48 extern float gfogdensity; 49 50 struct glfiltermodes { 51 char *name; 52 int min,mag; 53 }; 54 #define numglfiltermodes 6 55 extern struct glfiltermodes glfiltermodes[numglfiltermodes]; 56 57 extern int gltexcomprquality; // 0 = fast, 1 = slow and pretty, 2 = very slow and pretty 58 extern int gltexmaxsize; // 0 means autodetection on first run 59 extern int gltexmiplevel; // discards this many mipmap levels 60 61 extern const GLfloat gidentitymat[4][4]; 62 extern GLfloat gdrawroomsprojmat[4][4]; // Proj. matrix for drawrooms() calls. 63 extern GLfloat grotatespriteprojmat[4][4]; // Proj. matrix for rotatesprite() calls. 64 extern GLfloat gorthoprojmat[4][4]; // Proj. matrix for 2D (aux) calls. 65 66 struct polymostvboitem { 67 struct { // Vertex 68 GLfloat x, y, z; 69 } v; 70 struct { // Texture 71 GLfloat s, t; 72 } t; 73 }; 74 75 struct polymostdrawpolycall { 76 GLuint texture0; 77 GLuint texture1; 78 GLfloat alphacut; 79 coltypef colour; 80 coltypef fogcolour; 81 GLfloat fogdensity; 82 83 const GLfloat *modelview; // 4x4 matrices. 84 const GLfloat *projection; 85 86 GLuint indexbuffer; // Buffer object identifier, or 0 for the global index buffer. 87 GLuint indexcount; // Number of index items. 88 89 GLuint elementbuffer; // Buffer object identifier. >0 ignores elementvbo. 90 GLuint elementcount; // Number of elements in the element buffer. Ignored if elementbuffer >0. 91 const struct polymostvboitem *elementvbo; // Elements. elementbuffer must be 0 to recognise this. 92 }; 93 94 // Smallest initial size for the global index buffer. 95 #define MINVBOINDEXES 16 96 97 struct polymostdrawauxcall { 98 GLuint texture0; 99 coltypef colour; 100 coltypef bgcolour; 101 int mode; 102 103 GLuint indexcount; // Number of index items. 104 GLushort *indexes; // Array of indexes, or NULL to use the global index buffer. 105 106 int elementcount; 107 struct polymostvboitem *elementvbo; 108 }; 109 110 void polymost_drawpoly_glcall(GLenum mode, struct polymostdrawpolycall *draw); 111 112 int polymost_texmayhavealpha (int dapicnum, int dapalnum); 113 void polymost_texinvalidate (int dapicnum, int dapalnum, int dameth); 114 void polymost_texinvalidateall (void); 115 void polymost_glinit(void); 116 int polymost_printext256(int xpos, int ypos, short col, short backcol, const char *name, char fontsize); 117 int polymost_drawline256(int x1, int y1, int x2, int y2, unsigned char col); 118 int polymost_plotpixel(int x, int y, unsigned char col); 119 void polymost_fillpolygon (int npoints); 120 void polymost_setview(void); 121 122 #endif //USE_OPENGL 123 124 void polymost_nextpage(void); 125 void polymost_aftershowframe(void); 126 void polymost_drawrooms (void); 127 void polymost_drawmaskwall (int damaskwallcnt); 128 void polymost_drawsprite (int snum); 129 void polymost_dorotatesprite (int sx, int sy, int z, short a, short picnum, 130 signed char dashade, unsigned char dapalnum, unsigned char dastat, int cx1, int cy1, int cx2, int cy2, int uniqid); 131 void polymost_initosdfuncs(void); 132