aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml2/imp_vrml2_types.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml2/imp_vrml2_types.c')
-rw-r--r--src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml2/imp_vrml2_types.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml2/imp_vrml2_types.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml2/imp_vrml2_types.c
new file mode 100644
index 0000000..3c10bf2
--- /dev/null
+++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml2/imp_vrml2_types.c
@@ -0,0 +1,78 @@
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#include <string.h>
23
24#include "imp_vrml_types.h"
25#include "imp_vrml_read.h"
26
27VrmlType vrml2_type_cb__float3(VrmlReader *reader)
28{
29 if(!vrml_read_skip_ws(reader))
30 return T_UNKNOWN;
31 if(*(reader->bufp) == '[')
32 return T_LIST_FLOAT3;
33 return T_FLOAT3;
34}
35
36VrmlType vrml2_type_cb__int(VrmlReader *reader)
37{
38 if(!vrml_read_skip_ws(reader))
39 return T_UNKNOWN;
40 if(*(reader->bufp) == '[')
41 return T_LIST_INT;
42 return T_INT;
43}
44
45VrmlType vrml2_type_cb_field(VrmlReader *reader)
46{
47 gchar *id;
48 VrmlType t = T_UNKNOWN;
49
50 id = vrml_read_id(reader);
51 if(!id) {
52 g_warning("VRML: vrml2_type_cb_field: failed to read id");
53 return T_UNKNOWN;
54 }
55 if(strcmp(id, "SFFloat") == 0)
56 t = T_TOKEN2; /* data 0 */
57
58 g_free(id);
59 return t;
60}
61
62VrmlType vrml2_type_cb_children(VrmlReader *reader)
63{
64 if(!vrml_read_skip_ws(reader))
65 return T_UNKNOWN;
66 if(*(reader->bufp) == '[')
67 return T_LIST_OBJECT;
68 return T_OBJECT;
69}
70
71VrmlType vrml2_type_cb_color(VrmlReader *reader)
72{
73 if(!vrml_read_skip_ws(reader))
74 return T_UNKNOWN;
75 if(*(reader->bufp) == '[')
76 return T_LIST_FLOAT3;
77 return T_OBJECT;
78}