aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_ta/imp_ta.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/mimesh/libg3d-0.0.8/plugins/import/imp_ta/imp_ta.c')
-rw-r--r--src/others/mimesh/libg3d-0.0.8/plugins/import/imp_ta/imp_ta.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_ta/imp_ta.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_ta/imp_ta.c
new file mode 100644
index 0000000..c472be1
--- /dev/null
+++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_ta/imp_ta.c
@@ -0,0 +1,77 @@
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 <glib.h>
24#include <g3d/types.h>
25
26#include "imp_ta_3do.h"
27#include "imp_ta_3do_palette.h"
28
29EAPI
30gpointer plugin_init(G3DContext *context)
31{
32 G3DMaterial *materials;
33 guint32 i;
34
35#if DEBUG > 0
36 g_debug("TA: initializing 3DO palette");
37#endif
38
39 materials = g_new0(G3DMaterial, 256);
40 for(i = 0; i < 256; i ++)
41 {
42 materials[i].r = ((G3DFloat)ta_3do_palette[i * 3 + 0]) / 255.0;
43 materials[i].g = ((G3DFloat)ta_3do_palette[i * 3 + 1]) / 255.0;
44 materials[i].b = ((G3DFloat)ta_3do_palette[i * 3 + 2]) / 255.0;
45 materials[i].a = 1.0;
46 }
47
48 return materials;
49}
50
51EAPI
52void plugin_cleanup(gpointer user_data)
53{
54 /* (G3DMaterials *) */
55 g_free(user_data);
56}
57
58EAPI
59gboolean plugin_load_model_from_stream(G3DContext *context, G3DStream *stream,
60 G3DModel *model, gpointer user_data)
61{
62 return ta_3do_load_object(context, stream, model,
63 (G3DMaterial *)user_data);
64}
65
66EAPI
67gchar *plugin_description(void)
68{
69 return g_strdup("Total Annihilation unit models.");
70}
71
72EAPI
73gchar **plugin_extensions(void)
74{
75 return g_strsplit("3do", ":", 0);
76}
77