X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Frasterize;a=blobdiff_plain;f=model.h;fp=model.h;h=23cc3aab16f2bad688ab57654f6bc0ee37c0b649;hp=0000000000000000000000000000000000000000;hb=143da66e7f625b7f195a115b9740a748ee003534;hpb=e00aec23409a0f95317c110305e6448ec882bd0e diff --git a/model.h b/model.h new file mode 100644 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_ +