moved over the polyfiller code and implemented blending
[bootcensus] / src / census / polyfill.h
1 #ifndef POLYFILL_H_
2 #define POLYFILL_H_
3
4 #include "inttypes.h"
5
6 #define POLYFILL_MODE_MASK      0x03
7 #define POLYFILL_TEX_BIT        0x04
8 #define POLYFILL_BLEND_BIT      0x08
9
10 enum {
11         POLYFILL_WIRE                   = 0,
12         POLYFILL_FLAT,
13         POLYFILL_GOURAUD,
14
15         POLYFILL_TEX_WIRE               = 4,
16         POLYFILL_TEX_FLAT,
17         POLYFILL_TEX_GOURAUD,
18
19         POLYFILL_BLEND_WIRE             = 8,
20         POLYFILL_BLEND_FLAT,
21         POLYFILL_BLEND_GOURAUD,
22
23         POLYFILL_BLEND_TEX_WIRE = 12,
24         POLYFILL_BLEND_TEX_FLAT,
25         POLYFILL_BLEND_TEX_GOURAUD
26 };
27
28 /* projected vertices for the rasterizer */
29 struct pvertex {
30         int32_t x, y; /* 24.8 fixed point */
31         int32_t u, v; /* 16.16 fixed point */
32         int32_t r, g, b, a;  /* int 0-255 */
33 };
34
35 struct pimage {
36         uint32_t *pixels;
37         int width, height;
38
39         int xshift, yshift;
40         unsigned int xmask, ymask;
41 };
42
43 extern struct pimage pfill_fb;
44 extern struct pimage pfill_tex;
45
46 void polyfill(int mode, struct pvertex *verts, int nverts);
47
48 void polyfill_wire(struct pvertex *verts, int nverts);
49 void polyfill_flat(struct pvertex *verts, int nverts);
50 void polyfill_gouraud(struct pvertex *verts, int nverts);
51 void polyfill_tex_wire(struct pvertex *verts, int nverts);
52 void polyfill_tex_flat(struct pvertex *verts, int nverts);
53 void polyfill_tex_gouraud(struct pvertex *verts, int nverts);
54 void polyfill_blend_wire(struct pvertex *verts, int nverts);
55 void polyfill_blend_flat(struct pvertex *verts, int nverts);
56 void polyfill_blend_gouraud(struct pvertex *verts, int nverts);
57 void polyfill_blend_tex_wire(struct pvertex *verts, int nverts);
58 void polyfill_blend_tex_flat(struct pvertex *verts, int nverts);
59 void polyfill_blend_tex_gouraud(struct pvertex *verts, int nverts);
60
61 #endif  /* POLYFILL_H_ */