diff options
Diffstat (limited to '')
-rw-r--r-- | src/others/mimesh/libg3d-0.0.8/plugins/import/imp_r4/imp_r4.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_r4/imp_r4.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_r4/imp_r4.c new file mode 100644 index 0000000..8367461 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_r4/imp_r4.c | |||
@@ -0,0 +1,79 @@ | |||
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 | #include <stdio.h> | ||
24 | #include <string.h> | ||
25 | |||
26 | #include <glib.h> | ||
27 | |||
28 | #include <g3d/stream.h> | ||
29 | #include <g3d/iff.h> | ||
30 | |||
31 | #include "imp_r4_chunks.h" | ||
32 | |||
33 | EAPI | ||
34 | gboolean plugin_load_model_from_stream(G3DContext *context, G3DStream *stream, | ||
35 | G3DModel *model, gpointer user_data) | ||
36 | { | ||
37 | G3DIffGlobal *global; | ||
38 | G3DIffLocal *local; | ||
39 | guint32 id; | ||
40 | gsize len; | ||
41 | |||
42 | if(!g3d_iff_check(stream, &id, &len) || | ||
43 | id != G3D_IFF_MKID('R','E','F','L')) { | ||
44 | g_warning("file is not an .r4 (REFL) file %s", stream->uri); | ||
45 | return FALSE; | ||
46 | } | ||
47 | |||
48 | local = g_new0(G3DIffLocal, 1); | ||
49 | global = g_new0(G3DIffGlobal, 1); | ||
50 | |||
51 | global->context = context; | ||
52 | global->model = model; | ||
53 | global->stream = stream; | ||
54 | |||
55 | local->parent_id = id; | ||
56 | local->nb = len; | ||
57 | |||
58 | g3d_iff_read_ctnr(global, local, r4_chunks, G3D_IFF_PAD1); | ||
59 | |||
60 | g_free(local); | ||
61 | g_free(global); | ||
62 | |||
63 | return TRUE; | ||
64 | } | ||
65 | |||
66 | EAPI | ||
67 | gchar *plugin_description(void) | ||
68 | { | ||
69 | return g_strdup( | ||
70 | "Reflections R4 models."); | ||
71 | } | ||
72 | |||
73 | EAPI | ||
74 | gchar **plugin_extensions(void) | ||
75 | { | ||
76 | return g_strsplit("r4:r3:mon", ":", 0); | ||
77 | } | ||
78 | |||
79 | |||