1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3 Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
5 This file is part of guile-irrlicht.
7 guile-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 guile-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <irrlicht/irrlicht.h>
24 #include "material-types.h"
30 video::E_MATERIAL_TYPE
31 scm_to_material_type (SCM material_type)
33 char* type = scm_to_utf8_stringn (scm_symbol_to_string (material_type), NULL);
34 if (!strcmp (type, "solid"))
36 return video::EMT_SOLID;
38 else if (!strcmp (type, "solid-2-layer"))
40 return video::EMT_SOLID_2_LAYER;
42 else if (!strcmp (type, "lightmap"))
44 return video::EMT_LIGHTMAP;
46 else if (!strcmp (type, "lightmap-add"))
48 return video::EMT_LIGHTMAP_ADD;
50 else if (!strcmp (type, "lightmap-m2"))
52 return video::EMT_LIGHTMAP_M2;
54 else if (!strcmp (type, "lightmap-m4"))
56 return video::EMT_LIGHTMAP_M4;
58 else if (!strcmp (type, "lightmap-lighting"))
60 return video::EMT_LIGHTMAP_LIGHTING;
62 else if (!strcmp (type, "lightmap-lighting-m2"))
64 return video::EMT_LIGHTMAP_LIGHTING_M2;
66 else if (!strcmp (type, "lightmap-lighting-m4"))
68 return video::EMT_LIGHTMAP_LIGHTING_M4;
70 else if (!strcmp (type, "detail-map"))
72 return video::EMT_DETAIL_MAP;
74 else if (!strcmp (type, "sphere-map"))
76 return video::EMT_SPHERE_MAP;
78 else if (!strcmp (type, "reflection-2-layer"))
80 return video::EMT_REFLECTION_2_LAYER;
82 else if (!strcmp (type, "transparent-add-color"))
84 return video::EMT_TRANSPARENT_ADD_COLOR;
86 else if (!strcmp (type, "transparent-alpha-channel"))
88 return video::EMT_TRANSPARENT_ALPHA_CHANNEL;
90 else if (!strcmp (type, "transparent-alpha-channel-ref"))
92 return video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
94 else if (!strcmp (type, "transparent-vertex-alpha"))
96 return video::EMT_TRANSPARENT_VERTEX_ALPHA;
98 else if (!strcmp (type, "transparent-reflection-2-layer"))
100 return video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
102 else if (!strcmp (type, "normal-map-solid"))
104 return video::EMT_NORMAL_MAP_SOLID;
106 else if (!strcmp (type, "normal-map-transparent-add-color"))
108 return video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
110 else if (!strcmp (type, "normal-map-transparent-vertex-alpha"))
112 return video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
114 else if (!strcmp (type, "parallax-map-solid"))
116 return video::EMT_PARALLAX_MAP_SOLID;
118 else if (!strcmp (type, "parallax-map-transparent-add-color"))
120 return video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
122 else if (!strcmp (type, "parallax-map-transparent-vertex-alpha"))
124 return video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
126 else if (!strcmp (type, "onetexture-blend"))
128 return video::EMT_ONETEXTURE_BLEND;
132 scm_error (scm_arg_type_key, NULL, "Wrong material type: ~S",
133 scm_list_1 (material_type), scm_list_1 (material_type));