summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/quake/r_shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sdl/progs/quake/r_shared.h')
-rw-r--r--apps/plugins/sdl/progs/quake/r_shared.h157
1 files changed, 157 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/quake/r_shared.h b/apps/plugins/sdl/progs/quake/r_shared.h
new file mode 100644
index 0000000000..f2a6db3096
--- /dev/null
+++ b/apps/plugins/sdl/progs/quake/r_shared.h
@@ -0,0 +1,157 @@
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20#ifndef GLQUAKE
21// r_shared.h: general refresh-related stuff shared between the refresh and the
22// driver
23
24// FIXME: clean up and move into d_iface.h
25
26#ifndef _R_SHARED_H_
27#define _R_SHARED_H_
28
29#define MAXVERTS 16 // max points in a surface polygon
30#define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate
31 // polygon (while processing)
32// !!! if this is changed, it must be changed in d_ifacea.h too !!!
33#define MAXHEIGHT 1024
34#define MAXWIDTH 1280
35#define MAXDIMENSION ((MAXHEIGHT > MAXWIDTH) ? MAXHEIGHT : MAXWIDTH)
36
37#define SIN_BUFFER_SIZE (MAXDIMENSION+CYCLE)
38
39#define INFINITE_DISTANCE 0x10000 // distance that's always guaranteed to
40 // be farther away than anything in
41 // the scene
42
43//===================================================================
44
45extern void R_DrawLine (polyvert_t *polyvert0, polyvert_t *polyvert1);
46
47extern int cachewidth;
48extern pixel_t *cacheblock;
49extern int screenwidth;
50
51extern float pixelAspect;
52
53extern int r_drawnpolycount;
54
55extern cvar_t r_clearcolor;
56
57extern int sintable[SIN_BUFFER_SIZE];
58extern int intsintable[SIN_BUFFER_SIZE];
59
60extern vec3_t vup, base_vup;
61extern vec3_t vpn, base_vpn;
62extern vec3_t vright, base_vright;
63extern entity_t *currententity;
64
65#define NUMSTACKEDGES 2400
66#define MINEDGES NUMSTACKEDGES
67#define NUMSTACKSURFACES 800
68#define MINSURFACES NUMSTACKSURFACES
69#define MAXSPANS 3000
70
71// !!! if this is changed, it must be changed in asm_draw.h too !!!
72typedef struct espan_s
73{
74 int u, v, count;
75 struct espan_s *pnext;
76} espan_t;
77
78// FIXME: compress, make a union if that will help
79// insubmodel is only 1, flags is fewer than 32, spanstate could be a byte
80typedef struct surf_s
81{
82 struct surf_s *next; // active surface stack in r_edge.c
83 struct surf_s *prev; // used in r_edge.c for active surf stack
84 struct espan_s *spans; // pointer to linked list of spans to draw
85 int key; // sorting key (BSP order)
86 int last_u; // set during tracing
87 int spanstate; // 0 = not in span
88 // 1 = in span
89 // -1 = in inverted span (end before
90 // start)
91 int flags; // currentface flags
92 void *data; // associated data like msurface_t
93 entity_t *entity;
94 float nearzi; // nearest 1/z on surface, for mipmapping
95 qboolean insubmodel;
96 float d_ziorigin, d_zistepu, d_zistepv;
97
98 int pad[2]; // to 64 bytes
99} surf_t;
100
101extern surf_t *surfaces, *surface_p, *surf_max;
102
103// surfaces are generated in back to front order by the bsp, so if a surf
104// pointer is greater than another one, it should be drawn in front
105// surfaces[1] is the background, and is used as the active surface stack.
106// surfaces[0] is a dummy, because index 0 is used to indicate no surface
107// attached to an edge_t
108
109//===================================================================
110
111extern vec3_t sxformaxis[4]; // s axis transformed into viewspace
112extern vec3_t txformaxis[4]; // t axis transformed into viewspac
113
114extern vec3_t modelorg, base_modelorg;
115
116extern float xcenter, ycenter;
117extern float xscale, yscale;
118extern float xscaleinv, yscaleinv;
119extern float xscaleshrink, yscaleshrink;
120
121extern int d_lightstylevalue[256]; // 8.8 frac of base light value
122
123extern void TransformVector (vec3_t in, vec3_t out);
124extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
125 fixed8_t endvertu, fixed8_t endvertv);
126
127extern int r_skymade;
128extern void R_MakeSky (void);
129
130extern int ubasestep, errorterm, erroradjustup, erroradjustdown;
131
132// flags in finalvert_t.flags
133#define ALIAS_LEFT_CLIP 0x0001
134#define ALIAS_TOP_CLIP 0x0002
135#define ALIAS_RIGHT_CLIP 0x0004
136#define ALIAS_BOTTOM_CLIP 0x0008
137#define ALIAS_Z_CLIP 0x0010
138// !!! if this is changed, it must be changed in d_ifacea.h too !!!
139#define ALIAS_ONSEAM 0x0020 // also defined in modelgen.h;
140 // must be kept in sync
141#define ALIAS_XY_CLIP_MASK 0x000F
142
143// !!! if this is changed, it must be changed in asm_draw.h too !!!
144typedef struct edge_s
145{
146 fixed16_t u;
147 fixed16_t u_step;
148 struct edge_s *prev, *next;
149 unsigned short surfs[2];
150 struct edge_s *nextremove;
151 float nearzi;
152 medge_t *owner;
153} edge_t;
154
155#endif // _R_SHARED_H_
156
157#endif // GLQUAKE