polyfill debugging mode
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Sat, 1 Oct 2016 12:27:47 +0000 (15:27 +0300)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Sat, 1 Oct 2016 12:27:47 +0000 (15:27 +0300)
src/polyfill.c
src/polytest.c

index 215cd78..3608b33 100644 (file)
@@ -46,7 +46,7 @@ void polyfill_wire(struct pvertex *verts, int nverts)
        }
 }
 
-#define NEXTIDX(x) ((x) ? (x) - 1 : nverts - 1)
+#define NEXTIDX(x) (((x) - 1 + nverts) % nverts)
 #define PREVIDX(x) (((x) + 1) % nverts)
 
 #define CALC_EDGE(which) \
@@ -116,7 +116,7 @@ void polyfill_flat(struct pvertex *pv, int nverts)
 
                pixptr = (uint16_t*)fb_pixels + sline * fb_width + x;
                for(i=0; i<slen; i++) {
-                       *pixptr++ = color;
+                       *pixptr++ += 10;
                }
 
                ++sline;
index fc38c16..f1835d4 100644 (file)
@@ -84,12 +84,12 @@ static void draw(void)
 
        g3d_matrix_mode(G3D_MODELVIEW);
        g3d_load_identity();
-       g3d_translate(0, 0, -5);
+       g3d_translate(0, 0, -3);
        g3d_rotate(phi, 1, 0, 0);
        g3d_rotate(theta, 0, 1, 0);
 
-       zsort(&torus);
-       draw_mesh(&torus);
+       /*zsort(&torus);*/
+       draw_mesh(&cube);
 
        swap_buffers(fb_pixels);
 }