5 #if defined(__WATCOMC__) || defined(_MSC_VER)
14 void (*fillfunc[])(struct pvertex*, int) = {
22 struct pimage pfill_fb, pfill_tex;
24 void polyfill(int mode, struct pvertex *verts, int nverts)
28 fprintf(stderr, "polyfill mode %d not implemented\n", mode);
33 fillfunc[mode](verts, nverts);
36 void polyfill_wire(struct pvertex *verts, int nverts)
38 int i, x0, y0, x1, y1;
39 struct pvertex *v = verts;
40 unsigned short color = ((v->r << 8) & 0xf800) |
41 ((v->g << 3) & 0x7e0) | ((v->b >> 3) & 0x1f);
43 for(i=0; i<nverts - 1; i++) {
49 if(clip_line(&x0, &y0, &x1, &y1, 0, 0, pfill_fb.width, pfill_fb.height)) {
50 draw_line(x0, y0, x1, y1, color);
55 if(clip_line(&x1, &y1, &x0, &y0, 0, 0, pfill_fb.width, pfill_fb.height)) {
56 draw_line(x1, y1, x0, y0, color);
60 #define NEXTIDX(x) (((x) - 1 + nverts) % nverts)
61 #define PREVIDX(x) (((x) + 1) % nverts)
64 * When HIGH_QUALITY is defined, the rasterizer calculates slopes for attribute
65 * interpolation on each scanline separately; otherwise the slope for each
66 * attribute would be calculated once for the whole polygon, which is faster,
67 * but produces some slight quantization artifacts, due to the limited precision
68 * of fixed-point calculations.
72 /* extra bits of precision to use when interpolating colors.
73 * try tweaking this if you notice strange quantization artifacts.
75 #define COLOR_SHIFT 12
78 #define POLYFILL polyfill_flat
79 #define SCANEDGE scanedge_flat
86 #define POLYFILL polyfill_gouraud
87 #define SCANEDGE scanedge_gouraud
94 #define POLYFILL polyfill_tex
95 #define SCANEDGE scanedge_tex
102 #define POLYFILL polyfill_tex_gouraud
103 #define SCANEDGE scanedge_tex_gouraud
106 #include "polytmpl.h"