aboutsummaryrefslogtreecommitdiff
path: root/graphics.h
diff options
context:
space:
mode:
Diffstat (limited to 'graphics.h')
-rw-r--r--graphics.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/graphics.h b/graphics.h
index 44f213d..8e63b67 100644
--- a/graphics.h
+++ b/graphics.h
@@ -8,6 +8,7 @@ typedef struct Vertex Vertex;
typedef struct Framebuffer Framebuffer;
typedef struct Viewport Viewport;
typedef struct Camera Camera;
+typedef struct Triangle Triangle;
struct Color
{
@@ -19,6 +20,7 @@ struct Vertex
Point3 p; /* position */
Point3 n; /* surface normal */
Color c; /* shading color */
+ Point2 uv; /* texture coordinate */
};
struct Framebuffer
@@ -47,6 +49,11 @@ struct Camera
Projection ptype;
};
+struct Triangle
+{
+ Point p0, p1, p2;
+};
+
/* Camera */
void configcamera(Camera*, Image*, double, double, double, Projection);
void placecamera(Camera*, Point3, Point3, Point3);
@@ -64,5 +71,12 @@ Point toviewport(Camera*, Point3);
Point2 fromviewport(Camera*, Point);
void perspective(Matrix3, double, double, double, double);
void orthographic(Matrix3, double, double, double, double, double, double);
+/* temporary debug helpers */
void line3(Camera*, Point3, Point3, int, int, Image*);
Point string3(Camera*, Point3, Image*, Font*, char*);
+
+/* triangle */
+Triangle Trian(int, int, int, int, int, int);
+Triangle Trianpt(Point, Point, Point);
+void triangle(Image*, Triangle, int, Image*, Point);
+void filltriangle(Image*, Triangle, Image*, Point);