/* * 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); /* * Get the color of the texture at the given uv coordinates. */ color_t model_tcolor(const model_t* m, vec_t pt); /* * 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); /* * Set the texture of the model. */ void model_texture(model_t* m, const void* p); #endif // _MODEL_H_