shithub: libgraphics

Download patch

ref: feecec6c4d7f3798c2298cd6c68b06d77eab719d
parent: 19c85d5ea0a31fd311a4ca0cbe75e0d1a0c2cc0d
author: rodri <rgl@antares-labs.eu>
date: Tue Jan 30 14:34:55 EST 2024

make the vertex shader process actual vertices.

--- a/camera.c
+++ b/camera.c
@@ -92,6 +92,7 @@
 
 	c->vp->fbctl->reset(c->vp->fbctl);
 	t0 = nanosec();
+	/* TODO let the user choose the nproc value (left at 1 for now) */
 	shade(c->vp->fbctl->fb[c->vp->fbctl->idx^1], m, tex, s, 1);	/* address the back buffer */
 	t1 = nanosec();
 	c->vp->fbctl->swap(c->vp->fbctl);
--- a/graphics.h
+++ b/graphics.h
@@ -35,8 +35,7 @@
 struct VSparams
 {
 	SUparams *su;
-	Point3 *p;
-	Point3 *n;
+	Vertex *v;
 	uint idx;
 };
 
--- a/render.c
+++ b/render.c
@@ -253,16 +253,13 @@
 			t[0].n = t[1].n = t[2].n = mulpt3(n, -1);
 		}
 
-		vsp.p = &t[0].p;
-		vsp.n = &t[0].n;
+		vsp.v = &t[0];
 		vsp.idx = 0;
 		t[0].p = params->vshader(&vsp);
-		vsp.p = &t[1].p;
-		vsp.n = &t[1].n;
+		vsp.v = &t[1];
 		vsp.idx = 1;
 		t[1].p = params->vshader(&vsp);
-		vsp.p = &t[2].p;
-		vsp.n = &t[2].n;
+		vsp.v = &t[2];
 		vsp.idx = 2;
 		t[2].p = params->vshader(&vsp);