diff options
Diffstat (limited to '')
-rw-r--r-- | src/others/mimesh/libg3d-0.0.8/include/g3d/plugins.h | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/include/g3d/plugins.h b/src/others/mimesh/libg3d-0.0.8/include/g3d/plugins.h new file mode 100644 index 0000000..0a98dcd --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/include/g3d/plugins.h | |||
@@ -0,0 +1,243 @@ | |||
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_PLUGINS_H__ | ||
24 | #define __G3D_PLUGINS_H__ | ||
25 | |||
26 | #include <gmodule.h> | ||
27 | #include <g3d/types.h> | ||
28 | |||
29 | #ifdef __cplusplus | ||
30 | extern "C" { | ||
31 | #endif /* ifdef __cplusplus */ | ||
32 | |||
33 | /** | ||
34 | * SECTION:plugins | ||
35 | * @short_description: G3DPlugin interface | ||
36 | * @see_also: #G3DPlugin | ||
37 | * @include: g3d/plugins.h | ||
38 | * | ||
39 | * Direct interaction with the plugin system is normally not needed when using | ||
40 | * libg3d. It may be required when writing a plugin which should load a | ||
41 | * #G3DImage or a #G3DModel with another plugin. | ||
42 | */ | ||
43 | |||
44 | /** | ||
45 | * G3DPluginType: | ||
46 | * @G3D_PLUGIN_UNKNOWN: unknown plugin type | ||
47 | * @G3D_PLUGIN_IMPORT: model import plugin | ||
48 | * @G3D_PLUGIN_IMAGE: image loading plugin | ||
49 | * | ||
50 | * Type of plugin. | ||
51 | */ | ||
52 | typedef enum { | ||
53 | G3D_PLUGIN_UNKNOWN = 0x00, | ||
54 | G3D_PLUGIN_IMPORT, | ||
55 | G3D_PLUGIN_IMAGE | ||
56 | } G3DPluginType; | ||
57 | |||
58 | /** | ||
59 | * G3DPluginInitFunc: | ||
60 | * @context: the context | ||
61 | * | ||
62 | * Prototype for plugin_init(). | ||
63 | * | ||
64 | * Returns: opaque plugin data. | ||
65 | */ | ||
66 | typedef gpointer (* G3DPluginInitFunc)(G3DContext *context); | ||
67 | |||
68 | /** | ||
69 | * G3DPluginCleanupFunc: | ||
70 | * @user_data: opaque plugin data | ||
71 | * | ||
72 | * Prototype for plugin_cleanup(). | ||
73 | */ | ||
74 | typedef void (* G3DPluginCleanupFunc)(gpointer user_data); | ||
75 | |||
76 | /** | ||
77 | * G3DPluginLoadModelFromStreamFunc: | ||
78 | * @context: the context | ||
79 | * @stream: the stream to load from | ||
80 | * @model: the model structure to fill | ||
81 | * @user_data: opaque plugin data | ||
82 | * | ||
83 | * Prototype for plugin_load_model_from_stream(). | ||
84 | * | ||
85 | * Returns: TRUE on success, FALSE else. | ||
86 | */ | ||
87 | typedef gboolean (* G3DPluginLoadModelFromStreamFunc)(G3DContext *context, | ||
88 | G3DStream *stream, G3DModel *model, gpointer user_data); | ||
89 | |||
90 | /** | ||
91 | * G3DPluginLoadImageStreamFunc: | ||
92 | * @context: the context | ||
93 | * @stream: the stream to load from | ||
94 | * @image: image structure to fill | ||
95 | * @user_data: opaque plugin data | ||
96 | * | ||
97 | * Prototype for plugin_load_image_from_stream(). | ||
98 | * | ||
99 | * Returns: TRUE on success, FALSE else. | ||
100 | */ | ||
101 | typedef gboolean (* G3DPluginLoadImageStreamFunc)(G3DContext *context, | ||
102 | G3DStream *stream, G3DImage *image, gpointer user_data); | ||
103 | |||
104 | /** | ||
105 | * G3DPluginGetDescFunc: | ||
106 | * @context: the context | ||
107 | * | ||
108 | * Prototype for plugin_description(). | ||
109 | * | ||
110 | * Returns: a newly-allocated string containing the description of the plugin. | ||
111 | */ | ||
112 | typedef gchar *(* G3DPluginGetDescFunc)(G3DContext *context); | ||
113 | |||
114 | /** | ||
115 | * G3DPluginGetExtFunc: | ||
116 | * @context: the context | ||
117 | * | ||
118 | * Prototype for plugin_extensions(). | ||
119 | * | ||
120 | * Returns: NULL-terminated list of file extensions supported by this plugin. | ||
121 | * Free with g_strfreev(). | ||
122 | */ | ||
123 | typedef gchar **(* G3DPluginGetExtFunc)(G3DContext *context); | ||
124 | |||
125 | /** | ||
126 | * G3DPlugin: | ||
127 | * | ||
128 | * A libg3d plugin. | ||
129 | */ | ||
130 | struct _G3DPlugin { | ||
131 | /*< private >*/ | ||
132 | gchar *name; | ||
133 | gchar *path; | ||
134 | G3DPluginType type; | ||
135 | gchar **extensions; | ||
136 | |||
137 | G3DPluginInitFunc init_func; | ||
138 | G3DPluginCleanupFunc cleanup_func; | ||
139 | G3DPluginLoadModelFromStreamFunc loadmodelstream_func; | ||
140 | G3DPluginLoadImageStreamFunc loadimagestream_func; | ||
141 | G3DPluginGetDescFunc desc_func; | ||
142 | G3DPluginGetExtFunc ext_func; | ||
143 | |||
144 | gpointer user_data; | ||
145 | |||
146 | GModule *module; | ||
147 | }; | ||
148 | |||
149 | /** | ||
150 | * g3d_plugins_init: | ||
151 | * @context: a valid #G3DContext | ||
152 | * | ||
153 | * Initializes the plugin system. This is implicitly done when using | ||
154 | * g3d_context_new(). | ||
155 | * | ||
156 | * Returns: TRUE on success, FALSE else. | ||
157 | */ | ||
158 | EAPI | ||
159 | gboolean g3d_plugins_init(G3DContext *context); | ||
160 | |||
161 | /** | ||
162 | * g3d_plugins_cleanup: | ||
163 | * @context: a valid context | ||
164 | * | ||
165 | * Clean up the plugin system. Usually done by g3d_context_free(). | ||
166 | */ | ||
167 | EAPI | ||
168 | void g3d_plugins_cleanup(G3DContext *context); | ||
169 | |||
170 | /** | ||
171 | * g3d_plugins_load_model: | ||
172 | * @context: a valid context | ||
173 | * @filename: file name of model to load | ||
174 | * @model: model structure to fill | ||
175 | * | ||
176 | * Try to load a model from file using import plugins. | ||
177 | * | ||
178 | * Returns: TRUE on success, FALSE else. | ||
179 | */ | ||
180 | EAPI | ||
181 | gboolean g3d_plugins_load_model(G3DContext *context, const gchar *filename, | ||
182 | G3DModel *model); | ||
183 | |||
184 | /** | ||
185 | * g3d_plugins_load_model_from_stream: | ||
186 | * @context: a valid context | ||
187 | * @stream: stream to load model from | ||
188 | * @model: model structure to fill | ||
189 | * | ||
190 | * Try to load a model from stream using import plugins. | ||
191 | * | ||
192 | * Returns: TRUE on success, FALSE else. | ||
193 | */ | ||
194 | EAPI | ||
195 | gboolean g3d_plugins_load_model_from_stream(G3DContext *context, | ||
196 | G3DStream *stream, G3DModel *model); | ||
197 | |||
198 | /** | ||
199 | * g3d_plugins_load_image: | ||
200 | * @context: a valid context | ||
201 | * @filename: file name of image to load | ||
202 | * @image: image structure to fill | ||
203 | * | ||
204 | * Try to load an image from file using import plugins. | ||
205 | * | ||
206 | * Returns: TRUE on success, FALSE else. | ||
207 | */ | ||
208 | EAPI | ||
209 | gboolean g3d_plugins_load_image(G3DContext *context, const gchar *filename, | ||
210 | G3DImage *image); | ||
211 | |||
212 | /** | ||
213 | * g3d_plugins_load_image_from_stream: | ||
214 | * @context: a valid context | ||
215 | * @stream: stream to load image from | ||
216 | * @image: image structure to fill | ||
217 | * | ||
218 | * Try to load an image from stream using import plugins. | ||
219 | * | ||
220 | * Returns: TRUE on success, FALSE else. | ||
221 | */ | ||
222 | EAPI | ||
223 | gboolean g3d_plugins_load_image_from_stream(G3DContext *context, | ||
224 | G3DStream *stream, G3DImage *image); | ||
225 | |||
226 | /** | ||
227 | * g3d_plugins_get_image_extensions: | ||
228 | * @context: a valid context | ||
229 | * | ||
230 | * Get the supported image type extensions. | ||
231 | * | ||
232 | * Returns: NULL-terminated list of image file extensions supported by this | ||
233 | * plugin. Free with g_strfreev(). | ||
234 | */ | ||
235 | EAPI | ||
236 | gchar **g3d_plugins_get_image_extensions(G3DContext *context); | ||
237 | |||
238 | #ifdef __cplusplus | ||
239 | } | ||
240 | #endif /* ifdef __cplusplus */ | ||
241 | |||
242 | #endif /* __G3D_PLUGINS_H__ */ | ||
243 | |||