/* mode bits: 00-wire 01-flat 10-gouraud 11-reserved
* bit 2: texture
* bit 3-4: blend mode: 00-none 01-alpha 10-additive 11-reserved
+ * bit 5: zbuffering
*/
void (*fillfunc[])(struct pvertex*, int) = {
polyfill_wire,
polyfill_add_tex_wire,
polyfill_add_tex_flat,
polyfill_add_tex_gouraud,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ polyfill_wire,
+ polyfill_flat_zbuf,
+ polyfill_gouraud_zbuf,
+ 0,
+ polyfill_tex_wire,
+ polyfill_tex_flat_zbuf,
+ polyfill_tex_gouraud_zbuf,
+ 0,
+ polyfill_alpha_wire,
+ polyfill_alpha_flat_zbuf,
+ polyfill_alpha_gouraud_zbuf,
+ 0,
+ polyfill_alpha_tex_wire,
+ polyfill_alpha_tex_flat_zbuf,
+ polyfill_alpha_tex_gouraud_zbuf,
+ 0,
+ polyfill_add_wire,
+ polyfill_add_flat_zbuf,
+ polyfill_add_gouraud_zbuf,
+ 0,
+ polyfill_add_tex_wire,
+ polyfill_add_tex_flat_zbuf,
+ polyfill_add_tex_gouraud_zbuf,
0, 0, 0, 0, 0, 0, 0, 0, 0
};
struct pimage pfill_fb, pfill_tex;
+uint16_t *pfill_zbuf;
#define EDGEPAD 8
static struct pvertex *edgebuf, *left, *right;
#undef TEXMAP
#undef BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#undef TEXMAP
#undef BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#define TEXMAP
#undef BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#define TEXMAP
#undef BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#undef TEXMAP
#define BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#undef TEXMAP
#define BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#define TEXMAP
#define BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#define TEXMAP
#define BLEND_ALPHA
#undef BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#undef TEXMAP
#undef BLEND_ALPHA
#define BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#undef TEXMAP
#undef BLEND_ALPHA
#define BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#define TEXMAP
#undef BLEND_ALPHA
#define BLEND_ADD
+#undef ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE
#define TEXMAP
#undef BLEND_ALPHA
#define BLEND_ADD
+#undef ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+/* ---- zbuffer variants ----- */
+
+#define POLYFILL polyfill_flat_zbuf
+#define SCANEDGE scanedge_flat_zbuf
+#undef GOURAUD
+#undef TEXMAP
+#undef BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_gouraud_zbuf
+#define SCANEDGE scanedge_gouraud_zbuf
+#define GOURAUD
+#undef TEXMAP
+#undef BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_tex_flat_zbuf
+#define SCANEDGE scanedge_tex_flat_zbuf
+#undef GOURAUD
+#define TEXMAP
+#undef BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_tex_gouraud_zbuf
+#define SCANEDGE scanedge_tex_gouraud_zbuf
+#define GOURAUD
+#define TEXMAP
+#undef BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_alpha_flat_zbuf
+#define SCANEDGE scanedge_alpha_flat_zbuf
+#undef GOURAUD
+#undef TEXMAP
+#define BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_alpha_gouraud_zbuf
+#define SCANEDGE scanedge_alpha_gouraud_zbuf
+#define GOURAUD
+#undef TEXMAP
+#define BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_alpha_tex_flat_zbuf
+#define SCANEDGE scanedge_alpha_tex_flat_zbuf
+#undef GOURAUD
+#define TEXMAP
+#define BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_alpha_tex_gouraud_zbuf
+#define SCANEDGE scanedge_alpha_tex_gouraud_zbuf
+#define GOURAUD
+#define TEXMAP
+#define BLEND_ALPHA
+#undef BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_add_flat_zbuf
+#define SCANEDGE scanedge_add_flat_zbuf
+#undef GOURAUD
+#undef TEXMAP
+#undef BLEND_ALPHA
+#define BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_add_gouraud_zbuf
+#define SCANEDGE scanedge_add_gouraud_zbuf
+#define GOURAUD
+#undef TEXMAP
+#undef BLEND_ALPHA
+#define BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_add_tex_flat_zbuf
+#define SCANEDGE scanedge_add_tex_flat_zbuf
+#undef GOURAUD
+#define TEXMAP
+#undef BLEND_ALPHA
+#define BLEND_ADD
+#define ZBUF
+#include "polytmpl.h"
+#undef POLYFILL
+#undef SCANEDGE
+
+#define POLYFILL polyfill_add_tex_gouraud_zbuf
+#define SCANEDGE scanedge_add_tex_gouraud_zbuf
+#define GOURAUD
+#define TEXMAP
+#undef BLEND_ALPHA
+#define BLEND_ADD
+#define ZBUF
#include "polytmpl.h"
#undef POLYFILL
#undef SCANEDGE