#ifndef _MODEL_H_
#define _MODEL_H_
+#include "array.h"
#include "color.h"
#include "common.h"
-#include "list.h"
#include "mat.h"
+#include "tri.h"
#define MODEL_TYPE_RAW (1)
#define MODEL_TYPE_OBJ (2)
+// create an interface for a vector array
+DEFINE_ARRAY_TYPE(tri);
+
/*
* A model is a group of geometry and its attributes.
/*
- * Get the model's geometry as a list of triangles.
+ * Get the model's geometry as an array of triangles.
*/
-const list_t* model_geometry(const model_t* m);
+const array_t* model_geometry(const model_t* m);
/*
* Get the number of triangles that make up the model.
*/
void model_transformation(const model_t* m, mat_t* transform);
+/*
+ * Get the color of the texture at the given uv coordinates.
+ */
+color_t model_tcolor(const model_t* m, vec_t pt);
+
+/*
+ * Get a copy of the raw texture data. It must be freed when not needed.
+ * Returns NULL if the model has no texture.
+ */
+void* model_tdata(const model_t* m, int* width, int* height);
+
/*
* Post-multiply a transformation matrix to the internal matrix representing
*/
void model_material(model_t* m, color_t specular, scal_t shininess);
+/*
+ * Set the texture of the model.
+ */
+void model_texture(model_t* m, const void* p);
+
#endif // _MODEL_H_