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