]>
Dogcows Code - chaz/rasterize/blob - model.h
3 * CS5600 University of Utah
5 * mcgarvey@eng.utah.edu
18 #define MODEL_TYPE_RAW (1)
19 #define MODEL_TYPE_OBJ (2)
21 // create an interface for a vector array
22 DEFINE_ARRAY_TYPE(tri
);
26 * A model is a group of geometry and its attributes.
28 typedef struct model model_t
;
32 * Allocate and load a model from a file. The file format of the model will
33 * be inferred from the filename extension.
35 model_t
* model_alloc(const char* filename
);
38 * Allocate and load a model from a file. You must explicitly pass the file
39 * format of the model data.
41 model_t
* model_alloc2(const char* filename
, int type
);
44 * Destroy a model, freeing up its memory.
46 void model_destroy(model_t
* m
);
50 * Get the model's geometry as an array of triangles.
52 const array_t
* model_geometry(const model_t
* m
);
55 * Get the number of triangles that make up the model.
57 int model_size(const model_t
* m
);
60 * Get a string representation for the model (i.e. a filename).
62 const char* model_name(const model_t
* m
);
65 * Get the color of the specular light property of the model.
67 color_t
model_specular(const model_t
* m
);
70 * Get the level of shininess of a model for use in lighting calculations.
72 scal_t
model_shininess(const model_t
* m
);
75 * Get the current transformation of the model. This can be changed by a call
78 void model_transformation(const model_t
* m
, mat_t
* transform
);
81 * Get the color of the texture at the given uv coordinates.
83 color_t
model_tcolor(const model_t
* m
, vec_t pt
);
86 * Get a copy of the raw texture data. It must be freed when not needed.
87 * Returns NULL if the model has no texture.
89 void* model_tdata(const model_t
* m
, int* width
, int* height
);
93 * Post-multiply a transformation matrix to the internal matrix representing
94 * the model's location and orientation.
96 void model_transform(model_t
* m
, const mat_t
* transform
);
99 * Set the material attributes of the model.
101 void model_material(model_t
* m
, color_t specular
, scal_t shininess
);
104 * Set the texture of the model.
106 void model_texture(model_t
* m
, const void* p
);
This page took 0.038906 seconds and 5 git commands to generate.