aboutsummaryrefslogtreecommitdiff
path: root/vertex.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-03-21 11:58:10 +0000
committerrodri <rgl@antares-labs.eu>2024-03-21 11:58:10 +0000
commit764afe37e2438498bcace9de56b9618565b7cd34 (patch)
tree5c0ac0a454eae6a2dfe4198dd9fda926e44c878a /vertex.c
parent2b19d1a580c0e281010fd200128081b8e3f4af7f (diff)
downloadlibgraphics-764afe37e2438498bcace9de56b9618565b7cd34.tar.gz
libgraphics-764afe37e2438498bcace9de56b9618565b7cd34.tar.bz2
libgraphics-764afe37e2438498bcace9de56b9618565b7cd34.zip
use the new libgeometry berp routines. add a frame counter to the camstats.
Diffstat (limited to 'vertex.c')
-rw-r--r--vertex.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/vertex.c b/vertex.c
index d18d9ac..bc7759f 100644
--- a/vertex.c
+++ b/vertex.c
@@ -76,18 +76,9 @@ berpvertex(Vertex *v, Vertex *v0, Vertex *v1, Vertex *v2, Point3 bc)
Vertexattr va;
int i;
- v->n = addpt3(addpt3(
- mulpt3(v0->n, bc.x),
- mulpt3(v1->n, bc.y)),
- mulpt3(v2->n, bc.z));
- v->c = addpt3(addpt3(
- mulpt3(v0->c, bc.x),
- mulpt3(v1->c, bc.y)),
- mulpt3(v2->c, bc.z));
- v->uv = addpt2(addpt2(
- mulpt2(v0->uv, bc.x),
- mulpt2(v1->uv, bc.y)),
- mulpt2(v2->uv, bc.z));
+ v->n = berp3(v0->n, v1->n, v2->n, bc);
+ v->c = berp3(v0->c, v1->c, v2->c, bc);
+ v->uv = berp2(v0->uv, v1->uv, v2->uv, bc);
v->mtl = v0->mtl != nil? v0->mtl: v1->mtl != nil? v1->mtl: v2->mtl;
v->attrs = nil;
v->nattrs = 0;
@@ -95,12 +86,9 @@ berpvertex(Vertex *v, Vertex *v0, Vertex *v1, Vertex *v2, Point3 bc)
va.id = v0->attrs[i].id;
va.type = v0->attrs[i].type;
if(va.type == VAPoint)
- va.p = addpt3(addpt3(
- mulpt3(v0->attrs[i].p, bc.x),
- mulpt3(v1->attrs[i].p, bc.y)),
- mulpt3(v2->attrs[i].p, bc.z));
+ va.p = berp3(v0->attrs[i].p, v1->attrs[i].p, v2->attrs[i].p, bc);
else
- va.n = dotvec3(Vec3(v0->attrs[i].n, v1->attrs[i].n, v2->attrs[i].n), bc);
+ va.n = fberp(v0->attrs[i].n, v1->attrs[i].n, v2->attrs[i].n, bc);
_addvattr(v, &va);
}
}