From feecec6c4d7f3798c2298cd6c68b06d77eab719d Mon Sep 17 00:00:00 2001 From: rodri Date: Tue, 30 Jan 2024 19:34:55 +0000 Subject: make the vertex shader process actual vertices. --- camera.c | 1 + graphics.h | 3 +-- render.c | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/camera.c b/camera.c index 7b33c91..d54f0dd 100644 --- a/camera.c +++ b/camera.c @@ -92,6 +92,7 @@ shootcamera(Camera *c, OBJ *m, Memimage *tex, Shader *s) 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); diff --git a/graphics.h b/graphics.h index e044811..55c378c 100644 --- a/graphics.h +++ b/graphics.h @@ -35,8 +35,7 @@ typedef Vertex Triangle[3]; struct VSparams { SUparams *su; - Point3 *p; - Point3 *n; + Vertex *v; uint idx; }; diff --git a/render.c b/render.c index 48a15e6..b28c3ff 100644 --- a/render.c +++ b/render.c @@ -253,16 +253,13 @@ shaderunit(void *arg) 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); -- cgit v1.2.3