|
|
1.1 root 1: // r_shared.h: general refresh-related stuff shared between the refresh and the
2: // driver
3:
4: // FIXME: clean up and move into d_iface.h
5:
6: #ifndef _R_SHARED_H_
7: #define _R_SHARED_H_
8:
9: #define MAXVERTS 16 // max points in a surface polygon
10: #define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate
11: // polygon (while processing)
12: // !!! if this is changed, it must be changed in d_ifacea.h too !!!
13: #define MAXHEIGHT 1024
14: #define MAXWIDTH 1280
15:
16: #define INFINITE_DISTANCE 0x10000 // distance that's always guaranteed to
17: // be farther away than anything in
18: // the scene
19:
20: //===================================================================
21:
22: extern void R_DrawLine (polyvert_t *polyvert0, polyvert_t *polyvert1);
23:
24: extern int cachewidth;
25: extern pixel_t *cacheblock;
26: extern int screenwidth;
27:
28: extern float pixelAspect;
29:
30: extern int r_drawnpolycount;
31:
32: extern cvar_t r_clearcolor;
33:
34: extern int sintable[1280];
35: extern int intsintable[1280];
36:
37: extern vec3_t vup, base_vup;
38: extern vec3_t vpn, base_vpn;
39: extern vec3_t vright, base_vright;
40: extern entity_t *currententity;
41:
42: #define NUMSTACKEDGES 2000
43: #define MINEDGES NUMSTACKEDGES
44: #define NUMSTACKSURFACES 1000
45: #define MINSURFACES NUMSTACKSURFACES
46: #define MAXSPANS 3000
47:
48: // !!! if this is changed, it must be changed in asm_draw.h too !!!
49: typedef struct espan_s
50: {
51: int u, v, count;
52: struct espan_s *pnext;
53: } espan_t;
54:
55: // FIXME: compress, make a union if that will help
56: // insubmodel is only 1, flags is fewer than 32, spanstate could be a byte
57: typedef struct surf_s
58: {
59: struct surf_s *next; // active surface stack in r_edge.c
60: struct surf_s *prev; // used in r_edge.c for active surf stack
61: struct espan_s *spans; // pointer to linked list of spans to draw
62: int key; // sorting key (BSP order)
63: int last_u; // set during tracing
64: int spanstate; // 0 = not in span
65: // 1 = in span
66: // -1 = in inverted span (end before
67: // start)
68: int flags; // currentface flags
69: void *data; // associated data like msurface_t
70: entity_t *entity;
71: float nearzi; // nearest 1/z on surface, for mipmapping
72: qboolean insubmodel;
73: float d_ziorigin, d_zistepu, d_zistepv;
74:
75: int pad[2]; // to 64 bytes
76: } surf_t;
77:
78: extern surf_t *surfaces, *surface_p, *surf_max;
79:
80: // surfaces are generated in back to front order by the bsp, so if a surf
81: // pointer is greater than another one, it should be drawn in front
82: // surfaces[1] is the background, and is used as the active surface stack.
83: // surfaces[0] is a dummy, because index 0 is used to indicate no surface
84: // attached to an edge_t
85:
86: //===================================================================
87:
88: extern vec3_t sxformaxis[4]; // s axis transformed into viewspace
89: extern vec3_t txformaxis[4]; // t axis transformed into viewspac
90:
91: extern vec3_t modelorg;
92:
93: extern float xcenter, ycenter;
94: extern float xscale, yscale;
95: extern float xscaleinv, yscaleinv;
96: extern float xscaleshrink, yscaleshrink;
97:
98: extern int d_lightstylevalue[256]; // 8.8 frac of base light value
99:
100: extern void TransformVector (vec3_t in, vec3_t out);
101: extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
102: fixed8_t endvertu, fixed8_t endvertv);
103:
104: extern int r_skymade;
105: extern void R_MakeSky (void);
106:
107: extern int ubasestep, errorterm, erroradjustup, erroradjustdown;
108:
109: // flags in finalvert_t.flags
110: #define ALIAS_LEFT_CLIP 0x0001
111: #define ALIAS_TOP_CLIP 0x0002
112: #define ALIAS_RIGHT_CLIP 0x0004
113: #define ALIAS_BOTTOM_CLIP 0x0008
114: #define ALIAS_Z_CLIP 0x0010
115: // !!! if this is changed, it must be changed in d_ifacea.h too !!!
116: #define ALIAS_ONSEAM 0x0020 // also defined in modelgen.h;
117: // must be kept in sync
118: #define ALIAS_XY_CLIP_MASK 0x000F
119:
120: // !!! if this is changed, it must be changed in asm_draw.h too !!!
121: typedef struct edge_s
122: {
123: fixed16_t u;
124: fixed16_t u_step;
125: struct edge_s *prev, *next;
126: unsigned short surfs[2];
127: struct edge_s *nextremove;
128: float nearzi;
129: medge_t *owner;
130: } edge_t;
131:
132: #endif // _R_SHARED_H_
133:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.