summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-01-30 19:34:55 +0000
committerrodri <rgl@antares-labs.eu>2024-01-30 19:34:55 +0000
commitfeecec6c4d7f3798c2298cd6c68b06d77eab719d (patch)
treedcd4dc45afa0b1e5345322702380c9c8c8a71442
parent19c85d5ea0a31fd311a4ca0cbe75e0d1a0c2cc0d (diff)
downloadlibgraphics-feecec6c4d7f3798c2298cd6c68b06d77eab719d.tar.gz
libgraphics-feecec6c4d7f3798c2298cd6c68b06d77eab719d.tar.bz2
libgraphics-feecec6c4d7f3798c2298cd6c68b06d77eab719d.zip
make the vertex shader process actual vertices.
-rw-r--r--camera.c1
-rw-r--r--graphics.h3
-rw-r--r--render.c9
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);