X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=model.h;h=8f05c7aff37281fda39016346fafdda5270010ce;hb=bc662e293c854e1bdc9d46e9a410fe220247e6d4;hp=23cc3aab16f2bad688ab57654f6bc0ee37c0b649;hpb=143da66e7f625b7f195a115b9740a748ee003534;p=chaz%2Frasterize diff --git a/model.h b/model.h index 23cc3aa..8f05c7a 100644 --- a/model.h +++ b/model.h @@ -8,15 +8,19 @@ #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. @@ -43,9 +47,9 @@ void model_destroy(model_t* m); /* - * 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. @@ -73,6 +77,17 @@ scal_t model_shininess(const model_t* m); */ 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 @@ -85,6 +100,11 @@ void model_transform(model_t* m, const mat_t* transform); */ 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_