rev |
line source |
nuclear@0
|
1 #ifndef MGL_IMPL_H_
|
nuclear@0
|
2 #define MGL_IMPL_H_
|
nuclear@0
|
3
|
nuclear@14
|
4 #include "vmath.h"
|
nuclear@14
|
5
|
nuclear@0
|
6 #define MATRIX_STACK_SIZE 8
|
nuclear@0
|
7 #define MAX_LIGHTS 4
|
nuclear@0
|
8
|
nuclear@9
|
9 #define ZTILE_SIZE 16384
|
nuclear@9
|
10 #define ZTILE_SHIFT 14
|
nuclear@9
|
11 #define ZTILE_MASK 0x3fff
|
nuclear@9
|
12
|
nuclear@9
|
13 #define ZTILE(x) (((x) & ~ZTILE_MASK) >> ZTILE_SHIFT)
|
nuclear@9
|
14 #define ZTILE_OFFS(x) ((x) & ZTILE_MASK)
|
nuclear@9
|
15
|
nuclear@0
|
16 #define ROUND(x) ((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5)
|
nuclear@0
|
17
|
nuclear@0
|
18
|
nuclear@0
|
19 typedef float mat4_t[16];
|
nuclear@0
|
20
|
nuclear@0
|
21 struct vertex {
|
nuclear@0
|
22 vec4_t pos;
|
nuclear@0
|
23 vec3_t norm;
|
nuclear@0
|
24 vec2_t tc;
|
nuclear@0
|
25 float energy;
|
nuclear@0
|
26 int cidx;
|
nuclear@0
|
27 };
|
nuclear@0
|
28
|
nuclear@3
|
29 struct texture {
|
nuclear@3
|
30 int width, height;
|
nuclear@3
|
31 int xshift, yshift;
|
nuclear@3
|
32 unsigned int xmask, ymask;
|
nuclear@3
|
33 unsigned char *pixels;
|
nuclear@3
|
34 };
|
nuclear@3
|
35
|
nuclear@0
|
36 struct state {
|
nuclear@0
|
37 unsigned int flags;
|
nuclear@0
|
38 int ord, frontface, cullface;
|
nuclear@0
|
39 int mmode, mtop[2];
|
nuclear@0
|
40 mat4_t matrix[2][MATRIX_STACK_SIZE];
|
nuclear@0
|
41 int prim;
|
nuclear@0
|
42 struct vertex curv, v[4];
|
nuclear@0
|
43 int vidx;
|
nuclear@0
|
44 int vp[4]; /* viewport */
|
nuclear@0
|
45 int col_range; /* color interpolation range */
|
nuclear@11
|
46 vec4_t lpos[MAX_LIGHTS];
|
nuclear@0
|
47 float lint[MAX_LIGHTS];
|
nuclear@3
|
48
|
nuclear@3
|
49 struct texture tex;
|
nuclear@0
|
50 };
|
nuclear@0
|
51
|
nuclear@0
|
52 struct framebuffer {
|
nuclear@0
|
53 int width, height;
|
nuclear@0
|
54 unsigned char *pixels;
|
nuclear@9
|
55 unsigned short **zbuf; /* zbuffer broken in ZTILE_SIZE tiles */
|
nuclear@9
|
56 int num_ztiles;
|
nuclear@0
|
57 };
|
nuclear@0
|
58
|
nuclear@3
|
59
|
nuclear@0
|
60 int mgl_rast_init(struct state *state, struct framebuffer *fbuf);
|
nuclear@0
|
61 void mgl_rast_cleanup(void);
|
nuclear@0
|
62 void mgl_rast_prepare(void);
|
nuclear@0
|
63 void mgl_draw_point(struct vertex *v);
|
nuclear@0
|
64 void mgl_draw_line(struct vertex *v0, struct vertex *v1);
|
nuclear@0
|
65 void mgl_draw_poly(struct vertex *v, int numv);
|
nuclear@0
|
66
|
nuclear@0
|
67 #endif /* MGL_IMPL_H_ */
|