]> Dogcows Code - chaz/rasterize/blob - model.h
refactor triangle group into a separate class
[chaz/rasterize] / model.h
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #ifndef _MODEL_H_
9 #define _MODEL_H_
10
11 #include "color.h"
12 #include "common.h"
13 #include "list.h"
14 #include "mat.h"
15
16
17 #define MODEL_TYPE_RAW (1)
18 #define MODEL_TYPE_OBJ (2)
19
20
21 /*
22 * A model is a group of geometry and its attributes.
23 */
24 typedef struct model model_t;
25
26
27 /*
28 * Allocate and load a model from a file. The file format of the model will
29 * be inferred from the filename extension.
30 */
31 model_t* model_alloc(const char* filename);
32
33 /*
34 * Allocate and load a model from a file. You must explicitly pass the file
35 * format of the model data.
36 */
37 model_t* model_alloc2(const char* filename, int type);
38
39 /*
40 * Destroy a model, freeing up its memory.
41 */
42 void model_destroy(model_t* m);
43
44
45 /*
46 * Get the model's geometry as a list of triangles.
47 */
48 const list_t* model_geometry(const model_t* m);
49
50 /*
51 * Get the number of triangles that make up the model.
52 */
53 int model_size(const model_t* m);
54
55 /*
56 * Get a string representation for the model (i.e. a filename).
57 */
58 const char* model_name(const model_t* m);
59
60 /*
61 * Get the color of the specular light property of the model.
62 */
63 color_t model_specular(const model_t* m);
64
65 /*
66 * Get the level of shininess of a model for use in lighting calculations.
67 */
68 scal_t model_shininess(const model_t* m);
69
70 /*
71 * Get the current transformation of the model. This can be changed by a call
72 * to model_transform.
73 */
74 void model_transformation(const model_t* m, mat_t* transform);
75
76
77 /*
78 * Post-multiply a transformation matrix to the internal matrix representing
79 * the model's location and orientation.
80 */
81 void model_transform(model_t* m, const mat_t* transform);
82
83 /*
84 * Set the material attributes of the model.
85 */
86 void model_material(model_t* m, color_t specular, scal_t shininess);
87
88
89 #endif // _MODEL_H_
90
This page took 0.036318 seconds and 5 git commands to generate.