]> Dogcows Code - chaz/rasterize/blobdiff - model.h
refactor triangle group into a separate class
[chaz/rasterize] / model.h
diff --git a/model.h b/model.h
new file mode 100644 (file)
index 0000000..23cc3aa
--- /dev/null
+++ b/model.h
@@ -0,0 +1,90 @@
+
+/*
+ * CS5600 University of Utah
+ * Charles McGarvey
+ * mcgarvey@eng.utah.edu
+ */
+
+#ifndef _MODEL_H_
+#define _MODEL_H_
+
+#include "color.h"
+#include "common.h"
+#include "list.h"
+#include "mat.h"
+
+
+#define MODEL_TYPE_RAW (1)
+#define MODEL_TYPE_OBJ (2)
+
+
+/*
+ * A model is a group of geometry and its attributes.
+ */
+typedef struct model model_t;
+
+
+/*
+ * Allocate and load a model from a file.  The file format of the model will
+ * be inferred from the filename extension.
+ */
+model_t* model_alloc(const char* filename);
+
+/*
+ * Allocate and load a model from a file.  You must explicitly pass the file
+ * format of the model data.
+ */
+model_t* model_alloc2(const char* filename, int type);
+
+/*
+ * Destroy a model, freeing up its memory.
+ */
+void model_destroy(model_t* m);
+
+
+/*
+ * Get the model's geometry as a list of triangles.
+ */
+const list_t* model_geometry(const model_t* m);
+
+/*
+ * Get the number of triangles that make up the model.
+ */
+int model_size(const model_t* m);
+
+/*
+ * Get a string representation for the model (i.e. a filename).
+ */
+const char* model_name(const model_t* m);
+
+/*
+ * Get the color of the specular light property of the model.
+ */
+color_t model_specular(const model_t* m);
+
+/*
+ * Get the level of shininess of a model for use in lighting calculations.
+ */
+scal_t model_shininess(const model_t* m);
+
+/*
+ * Get the current transformation of the model.  This can be changed by a call
+ * to model_transform.
+ */
+void model_transformation(const model_t* m, mat_t* transform);
+
+
+/*
+ * Post-multiply a transformation matrix to the internal matrix representing
+ * the model's location and orientation.
+ */
+void model_transform(model_t* m, const mat_t* transform);
+
+/*
+ * Set the material attributes of the model.
+ */
+void model_material(model_t* m, color_t specular, scal_t shininess);
+
+
+#endif // _MODEL_H_
+
This page took 0.019382 seconds and 4 git commands to generate.