diff options
Diffstat (limited to '')
-rw-r--r-- | src/others/mimesh/libg3d-0.0.8/include/g3d/model.h | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/include/g3d/model.h b/src/others/mimesh/libg3d-0.0.8/include/g3d/model.h new file mode 100644 index 0000000..86047a6 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/include/g3d/model.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* $Id$ */ | ||
2 | |||
3 | /* | ||
4 | libg3d - 3D object loading library | ||
5 | |||
6 | Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de> | ||
7 | |||
8 | This library is free software; you can redistribute it and/or | ||
9 | modify it under the terms of the GNU Lesser General Public | ||
10 | License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. | ||
12 | |||
13 | This library is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | Lesser General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __G3D_MODEL_H__ | ||
24 | #define __G3D_MODEL_H__ | ||
25 | |||
26 | #include <g3d/types.h> | ||
27 | |||
28 | #ifdef __cplusplus | ||
29 | extern "C" { | ||
30 | #endif /* ifdef __cplusplus */ | ||
31 | |||
32 | /** | ||
33 | * SECTION:model | ||
34 | * @short_description: Model manipulation functions | ||
35 | * @include: g3d/g3d.h | ||
36 | * | ||
37 | * A model is a group of objects. All information loaded from a file by libg3d | ||
38 | * is found in this model. | ||
39 | */ | ||
40 | |||
41 | /** | ||
42 | * g3d_model_new: | ||
43 | * | ||
44 | * This functions allocates and initializes a new G3DModel. | ||
45 | * | ||
46 | * Returns: a newly allocated G3DModel | ||
47 | */ | ||
48 | EAPI | ||
49 | G3DModel *g3d_model_new(void); | ||
50 | |||
51 | /** | ||
52 | * G3D_MODEL_SCALE: | ||
53 | * | ||
54 | * The model should be scaled to a maximum extension of +/- 10.0. | ||
55 | */ | ||
56 | #define G3D_MODEL_SCALE (1 << 0) | ||
57 | /** | ||
58 | * G3D_MODEL_CENTER: | ||
59 | * | ||
60 | * The model should be centered around the (0,0,0). | ||
61 | */ | ||
62 | #define G3D_MODEL_CENTER (1 << 1) | ||
63 | /** | ||
64 | * G3D_MODEL_OPTIMIZE: | ||
65 | * | ||
66 | * The model material/object/face lists should be serialized to some private | ||
67 | * arrays (deprecated). | ||
68 | */ | ||
69 | #define G3D_MODEL_OPTIMIZE (1 << 2) | ||
70 | /** | ||
71 | * G3D_MODEL_NOCHECK: | ||
72 | * | ||
73 | * The common checks should be disabled. The checks include: | ||
74 | * <itemizedlist> | ||
75 | * <listitem>faces have at least 3 indices</listitem> | ||
76 | * <listitem>face indices are <= number of vertices</listitem> | ||
77 | * <listitem>material of faces is not NULL</listitem> | ||
78 | * </itemizedlist> | ||
79 | */ | ||
80 | #define G3D_MODEL_NOCHECK (1 << 3) | ||
81 | |||
82 | /** | ||
83 | * g3d_model_load_full: | ||
84 | * @context: a valid context | ||
85 | * @filename: the file name of the model to load | ||
86 | * @flags: object manipulation flags | ||
87 | * | ||
88 | * Loads a model from a file. Depending on @flags the model is checked, | ||
89 | * centered, resized, optimized. | ||
90 | * | ||
91 | * Returns: the loaded model or NULL in case of an error. | ||
92 | */ | ||
93 | EAPI | ||
94 | G3DModel *g3d_model_load_full(G3DContext *context, const gchar *filename, | ||
95 | guint32 flags); | ||
96 | |||
97 | /** | ||
98 | * g3d_model_load: | ||
99 | * @context: a valid context | ||
100 | * @filename: the file name of the model to load | ||
101 | * | ||
102 | * Loads a model from a file. The model is checked, centered, resized, | ||
103 | * optimized. | ||
104 | * | ||
105 | * Returns: the loaded model or NULL in case of an error | ||
106 | */ | ||
107 | EAPI | ||
108 | G3DModel *g3d_model_load(G3DContext *context, const gchar *filename); | ||
109 | |||
110 | /** | ||
111 | * g3d_model_check: | ||
112 | * @model: the model to check | ||
113 | * | ||
114 | * Checks whether a model returned by plugin is valid. | ||
115 | * | ||
116 | * Returns: TRUE on success, FALSE on error | ||
117 | */ | ||
118 | EAPI | ||
119 | gboolean g3d_model_check(G3DModel *model); | ||
120 | |||
121 | /** | ||
122 | * g3d_model_center: | ||
123 | * @model: the model to center | ||
124 | * | ||
125 | * Translates all object coordinates that the object center is at (0, 0, 0) | ||
126 | * | ||
127 | * Returns: TRUE on success, FALSE on error | ||
128 | */ | ||
129 | EAPI | ||
130 | gboolean g3d_model_center(G3DModel *model); | ||
131 | |||
132 | /** | ||
133 | * g3d_model_clear: | ||
134 | * @model: the model to clear | ||
135 | * | ||
136 | * Removes all objects from a model. | ||
137 | */ | ||
138 | EAPI | ||
139 | void g3d_model_clear(G3DModel *model); | ||
140 | |||
141 | /** | ||
142 | * g3d_model_free: | ||
143 | * @model: the model to free | ||
144 | * | ||
145 | * Frees all memory allocated for the model including all objects, materials | ||
146 | * and textures. | ||
147 | */ | ||
148 | EAPI | ||
149 | void g3d_model_free(G3DModel *model); | ||
150 | |||
151 | /** | ||
152 | * g3d_model_get_object_by_name: | ||
153 | * @model: the model containing all objects | ||
154 | * @name: the name of the requested object | ||
155 | * | ||
156 | * Searches the object tree for an object with the given name. | ||
157 | * | ||
158 | * Returns: the requested object or NULL if non was found | ||
159 | */ | ||
160 | EAPI | ||
161 | G3DObject *g3d_model_get_object_by_name(G3DModel *model, const gchar *name); | ||
162 | |||
163 | /** | ||
164 | * g3d_model_transform: | ||
165 | * @model: the model | ||
166 | * @matrix: transformation matrix | ||
167 | * | ||
168 | * Transform all toplevel objects in model with matrix. | ||
169 | * | ||
170 | * Returns: TRUE on success, FALSE else | ||
171 | */ | ||
172 | EAPI | ||
173 | gboolean g3d_model_transform(G3DModel *model, G3DMatrix *matrix); | ||
174 | |||
175 | #ifdef __cplusplus | ||
176 | } | ||
177 | #endif /* ifdef __cplusplus */ | ||
178 | |||
179 | #endif /* __G3D_MODEL_H__ */ | ||
180 | |||