summaryrefslogtreecommitdiff
path: root/graphics.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-06-04 18:11:11 +0000
committerrodri <rgl@antares-labs.eu>2024-06-04 18:11:11 +0000
commitdc597a2c65278119b7d11f83218b860c0c5da051 (patch)
treea6baf268c4dc7f8ed15465e66268986e03415db7 /graphics.h
parent5fa75a6d4b03c676112ca04cf5ff3f3ccd2f0fee (diff)
downloadlibgraphics-dc597a2c65278119b7d11f83218b860c0c5da051.tar.gz
libgraphics-dc597a2c65278119b7d11f83218b860c0c5da051.tar.bz2
libgraphics-dc597a2c65278119b7d11f83218b860c0c5da051.zip
add a tangent parameter for normal mapping, and a world2model xform.
Diffstat (limited to 'graphics.h')
-rw-r--r--graphics.h4
1 files changed, 3 insertions, 1 deletions
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);