From dc597a2c65278119b7d11f83218b860c0c5da051 Mon Sep 17 00:00:00 2001 From: rodri Date: Tue, 4 Jun 2024 18:11:11 +0000 Subject: add a tangent parameter for normal mapping, and a world2model xform. --- graphics.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'graphics.h') diff --git a/graphics.h b/graphics.h index 7eded0e..7998d01 100644 --- a/graphics.h +++ b/graphics.h @@ -87,6 +87,7 @@ struct Vertex Color c; /* shading color */ Point2 uv; /* texture coordinate */ Material *mtl; + Point3 tangent; /* TODO it'd be neat to use a dynamic hash table instead */ Vertexattr *attrs; /* attributes (aka varyings) */ @@ -116,6 +117,7 @@ struct Primitive int type; Vertex v[3]; Material *mtl; + Point3 tangent; /* used for normal mapping */ }; struct Model @@ -123,7 +125,6 @@ struct Model Primitive *prims; ulong nprims; Memimage *tex; /* texture map */ - Memimage *nor; /* normals map */ Material *materials; ulong nmaterials; }; @@ -290,6 +291,7 @@ Point3 ndc2vcs(Camera*, Point3); Point3 viewport2vcs(Camera*, Point3); Point3 vcs2world(Camera*, Point3); Point3 viewport2world(Camera*, Point3); +Point3 world2model(Entity*, Point3); void perspective(Matrix3, double, double, double, double); void orthographic(Matrix3, double, double, double, double, double, double); -- cgit v1.2.3