2 #define TPOLYTYPE_ALPHA 0
3 #define TPOLYTYPE_ADD 1
5 extern void transpolyclear(void);
6 extern void transpolyrender(void);
7 extern void transpolybegin(int texnum, int glowtexnum, int fogtexnum, int transpolytype);
8 extern void transpolyend(void);
10 extern void wallpolyclear(void);
11 extern void wallpolyrender(void);
13 extern void skypolyclear(void);
14 extern void skypolyrender(void);
15 extern void skypolybegin(void);
16 extern void skypolyvert(float x, float y, float z);
17 extern void skypolyend(void);
19 #define MAX_TRANSPOLYS 65536
20 #define MAX_TRANSVERTS (MAX_TRANSPOLYS*4)
21 #define MAX_WALLPOLYS 65536
22 #define MAX_WALLVERTS (MAX_WALLPOLYS*3)
23 #define MAX_SKYPOLYS 2048
24 #define MAX_SKYVERTS (MAX_SKYPOLYS*4)
36 // vec_t mindistance, maxdistance; // closest and farthest distance along v_forward
37 // vec_t distance; // distance to center
38 // vec3_t n; // normal
39 // vec_t ndist; // distance from origin along that normal
40 unsigned short texnum;
41 unsigned short glowtexnum;
42 unsigned short fogtexnum;
43 unsigned short firstvert;
45 unsigned short transpolytype;
49 // note: must match format of glpoly_t vertices due to a memcpy used in RSurf_DrawWall
52 vec_t vert[VERTEXSIZE]; // xyz st uv
64 unsigned short texnum, lighttexnum, glowtexnum;
65 unsigned short firstvert;
66 unsigned short numverts;
67 unsigned short lit; // doesn't need to be an unsigned short, but to keep the structure consistent...
73 // the order and type of these is crucial to the vertex array based rendering
81 unsigned short firstvert;
86 extern transvert_t *transvert;
87 extern transpoly_t *transpoly;
88 extern unsigned short *transpolyindex;
89 extern wallvert_t *wallvert;
90 extern wallvertcolor_t *wallvertcolor;
91 extern wallpoly_t *wallpoly;
92 extern skyvert_t *skyvert;
93 extern skypoly_t *skypoly;
95 extern int currenttranspoly;
96 extern int currenttransvert;
97 extern int currentwallpoly;
98 extern int currentwallvert;
99 extern int currentskypoly;
100 extern int currentskyvert;
102 #define transpolybegin(ttexnum, tglowtexnum, tfogtexnum, ttranspolytype)\
104 if (currenttranspoly < MAX_TRANSPOLYS && currenttransvert < MAX_TRANSVERTS)\
106 transpoly[currenttranspoly].texnum = (unsigned short) (ttexnum);\
107 transpoly[currenttranspoly].glowtexnum = (unsigned short) (tglowtexnum);\
108 transpoly[currenttranspoly].fogtexnum = (unsigned short) (tfogtexnum);\
109 transpoly[currenttranspoly].transpolytype = (unsigned short) (ttranspolytype);\
110 transpoly[currenttranspoly].firstvert = currenttransvert;\
111 transpoly[currenttranspoly].verts = 0;\
115 #define transpolyvert(vx,vy,vz,vs,vt,vr,vg,vb,va) \
117 if (currenttranspoly < MAX_TRANSPOLYS && currenttransvert < MAX_TRANSVERTS)\
119 transvert[currenttransvert].s = (vs);\
120 transvert[currenttransvert].t = (vt);\
123 transvert[currenttransvert].r = (byte) (bound(0, (int) (vr) >> 1, 255));\
124 transvert[currenttransvert].g = (byte) (bound(0, (int) (vg) >> 1, 255));\
125 transvert[currenttransvert].b = (byte) (bound(0, (int) (vb) >> 1, 255));\
129 transvert[currenttransvert].r = (byte) (bound(0, (int) (vr), 255));\
130 transvert[currenttransvert].g = (byte) (bound(0, (int) (vg), 255));\
131 transvert[currenttransvert].b = (byte) (bound(0, (int) (vb), 255));\
133 transvert[currenttransvert].a = (byte) (bound(0, (int) (va), 255));\
134 transvert[currenttransvert].v[0] = (vx);\
135 transvert[currenttransvert].v[1] = (vy);\
136 transvert[currenttransvert].v[2] = (vz);\
138 transpoly[currenttranspoly].verts++;\
142 #define transpolyvertub(vx,vy,vz,vs,vt,vr,vg,vb,va) \
144 if (currenttranspoly < MAX_TRANSPOLYS && currenttransvert < MAX_TRANSVERTS)\
146 transvert[currenttransvert].s = (vs);\
147 transvert[currenttransvert].t = (vt);\
150 transvert[currenttransvert].r = (vr) >> 1;\
151 transvert[currenttransvert].g = (vg) >> 1;\
152 transvert[currenttransvert].b = (vb) >> 1;\
156 transvert[currenttransvert].r = (vr);\
157 transvert[currenttransvert].g = (vg);\
158 transvert[currenttransvert].b = (vb);\
160 transvert[currenttransvert].a = (va);\
161 transvert[currenttransvert].v[0] = (vx);\
162 transvert[currenttransvert].v[1] = (vy);\
163 transvert[currenttransvert].v[2] = (vz);\
165 transpoly[currenttranspoly].verts++;\