X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fpolyfill.c;h=3f94e25849e41bb9d30fcb444b2c547b0c7137df;hb=HEAD;hp=634d525602eef240d4c12ca013e1a9d3600c0fc2;hpb=6218ea71a2a175dca5bf88ca7922e97f42f85e69;p=dosdemo diff --git a/src/polyfill.c b/src/polyfill.c deleted file mode 100644 index 634d525..0000000 --- a/src/polyfill.c +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include -#include -#if defined(__WATCOMC__) || defined(_MSC_VER) -#include -#else -#include -#endif -#include "polyfill.h" -#include "gfxutil.h" -#include "demo.h" - -void (*fillfunc[])(struct pvertex*, int) = { - polyfill_wire, - polyfill_flat, - polyfill_gouraud, - polyfill_tex, - polyfill_tex_gouraud -}; - -struct pimage pimg_fb, pimg_texture; - -void polyfill(int mode, struct pvertex *verts, int nverts) -{ -#ifndef NDEBUG - if(!fillfunc[mode]) { - fprintf(stderr, "polyfill mode %d not implemented\n", mode); - abort(); - } -#endif - - fillfunc[mode](verts, nverts); -} - -void polyfill_wire(struct pvertex *verts, int nverts) -{ - int i, x0, y0, x1, y1; - struct pvertex *v = verts; - unsigned short color = ((v->r << 8) & 0xf800) | - ((v->g << 3) & 0x7e0) | ((v->b >> 3) & 0x1f); - - for(i=0; ix >> 8; - y0 = v->y >> 8; - ++v; - x1 = v->x >> 8; - y1 = v->y >> 8; - if(clip_line(&x0, &y0, &x1, &y1, 0, 0, pimg_fb.width, pimg_fb.height)) { - draw_line(x0, y0, x1, y1, color); - } - } - x0 = verts[0].x >> 8; - y0 = verts[0].y >> 8; - if(clip_line(&x1, &y1, &x0, &y0, 0, 0, pimg_fb.width, pimg_fb.height)) { - draw_line(x1, y1, x0, y0, color); - } -} - -#define NEXTIDX(x) (((x) - 1 + nverts) % nverts) -#define PREVIDX(x) (((x) + 1) % nverts) - -#define POLYFILL polyfill_flat -#define SCANEDGE scanedge_flat -#undef GOURAUD -#undef TEXMAP -#include "polytmpl.h" -#undef POLYFILL -#undef SCANEDGE - -#define POLYFILL polyfill_gouraud -#define SCANEDGE scanedge_gouraud -#define GOURAUD -#undef TEXMAP -#include "polytmpl.h" -#undef POLYFILL -#undef SCANEDGE - -#define POLYFILL polyfill_tex -#define SCANEDGE scanedge_tex -#undef GOURAUD -#define TEXMAP -#include "polytmpl.h" -#undef POLYFILL -#undef SCANEDGE - -#define POLYFILL polyfill_tex_gouraud -#define SCANEDGE scanedge_tex_gouraud -#define GOURAUD -#define TEXMAP -#include "polytmpl.h" -#undef POLYFILL -#undef SCANEDGE