2 #define TPOLYTYPE_ALPHA 0
3 #define TPOLYTYPE_ADD 1
5 extern void transpolyclear();
6 extern void transpolyrender();
7 extern void transpolybegin(int texnum, int glowtexnum, int fogtexnum, int transpolytype);
8 extern void transpolyend();
10 extern void wallpolyclear();
11 extern void wallpolyrender();
13 extern void skypolyclear();
14 extern void skypolyrender();
15 extern void skypolybegin();
16 extern void skypolyvert(float x, float y, float z);
17 extern void skypolyend();
19 #define MAX_TRANSPOLYS 8192
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)
35 // vec_t mindistance, maxdistance; // closest and farthest distance along v_forward
36 // vec_t distance; // distance to center
37 // vec3_t n; // normal
38 // vec_t ndist; // distance from origin along that normal
39 unsigned short texnum;
40 unsigned short glowtexnum;
41 unsigned short fogtexnum;
42 unsigned short firstvert;
44 unsigned short transpolytype;
56 unsigned short texnum, lighttexnum, glowtexnum;
57 unsigned short firstvert;
58 unsigned short numverts;
59 unsigned short lit; // doesn't need to be an unsigned short, but to keep the structure consistent...
69 unsigned short firstvert;
73 extern transvert_t *transvert;
74 extern transpoly_t *transpoly;
75 extern unsigned short *transpolyindex;
76 extern wallvert_t *wallvert;
77 extern wallpoly_t *wallpoly;
78 extern skyvert_t *skyvert;
79 extern skypoly_t *skypoly;
81 extern unsigned short currenttranspoly;
82 extern unsigned short currenttransvert;
83 extern unsigned short currentwallpoly;
84 extern unsigned short currentwallvert;
85 extern unsigned short currentskypoly;
86 extern unsigned short currentskyvert;
88 #define transpolybegin(ttexnum, tglowtexnum, tfogtexnum, ttranspolytype)\
90 if (currenttranspoly < MAX_TRANSPOLYS && currenttransvert < MAX_TRANSVERTS)\
92 transpoly[currenttranspoly].texnum = (unsigned short) (ttexnum);\
93 transpoly[currenttranspoly].glowtexnum = (unsigned short) (tglowtexnum);\
94 transpoly[currenttranspoly].fogtexnum = (unsigned short) (tfogtexnum);\
95 transpoly[currenttranspoly].transpolytype = (unsigned short) (ttranspolytype);\
96 transpoly[currenttranspoly].firstvert = currenttransvert;\
97 transpoly[currenttranspoly].verts = 0;\
101 #define transpolyvert(vx,vy,vz,vs,vt,vr,vg,vb,va) \
103 if (currenttranspoly < MAX_TRANSPOLYS && currenttransvert < MAX_TRANSVERTS)\
105 transvert[currenttransvert].s = (vs);\
106 transvert[currenttransvert].t = (vt);\
109 transvert[currenttransvert].r = (byte) (bound(0, (int) (vr) >> 1, 255));\
110 transvert[currenttransvert].g = (byte) (bound(0, (int) (vg) >> 1, 255));\
111 transvert[currenttransvert].b = (byte) (bound(0, (int) (vb) >> 1, 255));\
115 transvert[currenttransvert].r = (byte) (bound(0, (int) (vr), 255));\
116 transvert[currenttransvert].g = (byte) (bound(0, (int) (vg), 255));\
117 transvert[currenttransvert].b = (byte) (bound(0, (int) (vb), 255));\
119 transvert[currenttransvert].a = (byte) (bound(0, (int) (va), 255));\
120 transvert[currenttransvert].v[0] = (vx);\
121 transvert[currenttransvert].v[1] = (vy);\
122 transvert[currenttransvert].v[2] = (vz);\
124 transpoly[currenttranspoly].verts++;\