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