backported g3d changes:
[dosdemo] / src / polyfill.c
index 1393cd2..3f94e25 100644 (file)
@@ -9,14 +9,30 @@
 #endif
 #include "polyfill.h"
 #include "gfxutil.h"
-#include "demo.h"
 
+#define FILL_POLY_BITS 0x03
+
+/* mode bits: 00-wire 01-flat 10-gouraud 11-reserved
+ *     bit 2: texture
+ *     bit 3: blend
+ */
 void (*fillfunc[])(struct pvertex*, int) = {
        polyfill_wire,
        polyfill_flat,
        polyfill_gouraud,
-       polyfill_tex,
-       polyfill_tex_gouraud
+       0,
+       polyfill_tex_wire,
+       polyfill_tex_flat,
+       polyfill_tex_gouraud,
+       0,
+       polyfill_blend_wire,
+       polyfill_blend_flat,
+       polyfill_blend_gouraud,
+       0,
+       polyfill_blend_tex_wire,
+       polyfill_blend_tex_flat,
+       polyfill_blend_tex_gouraud,
+       0
 };
 
 struct pimage pfill_fb, pfill_tex;
@@ -57,6 +73,21 @@ void polyfill_wire(struct pvertex *verts, int nverts)
        }
 }
 
+void polyfill_tex_wire(struct pvertex *verts, int nverts)
+{
+       polyfill_wire(verts, nverts);   /* TODO */
+}
+
+void polyfill_blend_wire(struct pvertex *verts, int nverts)
+{
+       polyfill_wire(verts, nverts);   /* TODO */
+}
+
+void polyfill_blend_tex_wire(struct pvertex *verts, int nverts)
+{
+       polyfill_wire(verts, nverts);   /* TODO */
+}
+
 #define NEXTIDX(x) (((x) - 1 + nverts) % nverts)
 #define PREVIDX(x) (((x) + 1) % nverts)
 
@@ -79,6 +110,7 @@ void polyfill_wire(struct pvertex *verts, int nverts)
 #define SCANEDGE scanedge_flat
 #undef GOURAUD
 #undef TEXMAP
+#undef BLEND
 #include "polytmpl.h"
 #undef POLYFILL
 #undef SCANEDGE
@@ -87,14 +119,16 @@ void polyfill_wire(struct pvertex *verts, int nverts)
 #define SCANEDGE scanedge_gouraud
 #define GOURAUD
 #undef TEXMAP
+#undef BLEND
 #include "polytmpl.h"
 #undef POLYFILL
 #undef SCANEDGE
 
-#define POLYFILL polyfill_tex
-#define SCANEDGE scanedge_tex
+#define POLYFILL polyfill_tex_flat
+#define SCANEDGE scanedge_tex_flat
 #undef GOURAUD
 #define TEXMAP
+#undef BLEND
 #include "polytmpl.h"
 #undef POLYFILL
 #undef SCANEDGE
@@ -103,6 +137,43 @@ void polyfill_wire(struct pvertex *verts, int nverts)
 #define SCANEDGE scanedge_tex_gouraud
 #define GOURAUD
 #define TEXMAP
+#undef BLEND
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_blend_flat
+#define SCANEDGE scanedge_blend_flat
+#undef GOURAUD
+#undef TEXMAP
+#define BLEND
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_blend_gouraud
+#define SCANEDGE scanedge_blend_gouraud
+#define GOURAUD
+#undef TEXMAP
+#define BLEND
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_blend_tex_flat
+#define SCANEDGE scanedge_blend_tex_flat
+#undef GOURAUD
+#define TEXMAP
+#define BLEND
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_blend_tex_gouraud
+#define SCANEDGE scanedge_blend_tex_gouraud
+#define GOURAUD
+#define TEXMAP
+#define BLEND
 #include "polytmpl.h"
 #undef POLYFILL
 #undef SCANEDGE