rayzor

view src/m3dimpl.h @ 18:859ccadca671

portability fixes
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 14 Apr 2014 18:35:37 +0300
parents a68dbf80d547
children
line source
1 #ifndef M3DIMPL_H_
2 #define M3DIMPL_H_
4 #include "min3d.h"
6 #define MSTACK_SIZE 16
8 struct min3d_mstack {
9 float m[MSTACK_SIZE][16];
10 int top;
11 };
13 struct min3d_vertex {
14 float pos[4];
15 uint32_t color;
16 float normal[4];
17 float tex[2];
18 };
20 #define IM_VBSIZE 4
22 struct min3d_context {
23 struct m3d_image *cbuf;
24 uint16_t *zbuf;
26 unsigned long state;
27 int clear_color[3];
29 int mmode; /* matrix mode */
30 struct min3d_mstack mstack[2];
32 int vport[4];
34 float *vert_array;
35 float *norm_array;
36 float *col_array;
37 float *tc_array;
39 /* immediate mode state */
40 float im_varr[IM_VBSIZE * 3];
41 float im_narr[IM_VBSIZE * 3];
42 float im_carr[IM_VBSIZE * 3];
43 float im_tarr[IM_VBSIZE * 2];
45 int im_prim, im_idx;
46 float im_color[4];
47 float im_normal[3];
48 float im_texcoord[2];
49 };
51 extern struct min3d_context *m3dctx;
53 #define ENABLED(x) (m3dctx->state & (1 << x))
55 void m3d_draw_point(struct min3d_vertex *v);
56 void m3d_draw_line(struct min3d_vertex *v);
57 void m3d_draw_poly(struct min3d_vertex *v, int numv);
59 #endif /* M3DIMPL_H_ */