summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-12-18 00:41:56 +0000
committerrodri <rgl@antares-labs.eu>2023-12-18 00:41:56 +0000
commit3c74a293451cb8e2992332e2d275823c2a0cb01e (patch)
tree65aaafcb3980f55a3d2b0b18c77e65999d624256 /main.c
parent22bd43e063fa8d518ff034640705a45941f0481a (diff)
downloadtinyrend-3c74a293451cb8e2992332e2d275823c2a0cb01e.tar.gz
tinyrend-3c74a293451cb8e2992332e2d275823c2a0cb01e.tar.bz2
tinyrend-3c74a293451cb8e2992332e2d275823c2a0cb01e.zip
fix the vertex shader for some of the shading pipelines.
Diffstat (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/main.c b/main.c
index 446c3de..e4e5c8d 100644
--- a/main.c
+++ b/main.c
@@ -678,6 +678,23 @@ shade(Memimage *dst, Shader *s)
chanfree(donec);
}
+Point3
+ivshader(VSparams *sp)
+{
+ Matrix3 M, D, V;
+
+ identity3(M);
+ identity3(D);
+ identity3(V);
+ mulm3(M, rota);
+ mulm3(D, proj);
+ mulm3(V, view);
+ mulm3(D, M);
+ mulm3(V, D);
+
+ return xform3(*sp->p, V);
+}
+
Memimage *
triangleshader(FSparams *sp)
{
@@ -793,10 +810,10 @@ boxshader(FSparams *sp)
}
Shader shadertab[] = {
- { "triangle", vertshader, triangleshader },
- { "circle", vertshader, circleshader },
- { "box", vertshader, boxshader },
- { "sf", vertshader, sfshader },
+ { "triangle", ivshader, triangleshader },
+ { "circle", ivshader, circleshader },
+ { "box", ivshader, boxshader },
+ { "sf", ivshader, sfshader },
{ "gouraud", vertshader, gouraudshader },
{ "toon", vertshader, toonshader },
};