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"
28 video::E_MATERIAL_TYPE
29 scm_to_material_type (SCM material_type)
31 char* type = scm_to_utf8_string (scm_symbol_to_string (material_type));
32 if (!strcmp (type, "solid"))
34 return video::EMT_SOLID;
36 else if (!strcmp (type, "solid-2-layer"))
38 return video::EMT_SOLID_2_LAYER;
40 else if (!strcmp (type, "lightmap"))
42 return video::EMT_LIGHTMAP;
44 else if (!strcmp (type, "lightmap-add"))
46 return video::EMT_LIGHTMAP_ADD;
48 else if (!strcmp (type, "lightmap-m2"))
50 return video::EMT_LIGHTMAP_M2;
52 else if (!strcmp (type, "lightmap-m4"))
54 return video::EMT_LIGHTMAP_M4;
56 else if (!strcmp (type, "lightmap-lighting"))
58 return video::EMT_LIGHTMAP_LIGHTING;
60 else if (!strcmp (type, "lightmap-lighting-m2"))
62 return video::EMT_LIGHTMAP_LIGHTING_M2;
64 else if (!strcmp (type, "lightmap-lighting-m4"))
66 return video::EMT_LIGHTMAP_LIGHTING_M4;
68 else if (!strcmp (type, "detail-map"))
70 return video::EMT_DETAIL_MAP;
72 else if (!strcmp (type, "sphere-map"))
74 return video::EMT_SPHERE_MAP;
76 else if (!strcmp (type, "reflection-2-layer"))
78 return video::EMT_REFLECTION_2_LAYER;
80 else if (!strcmp (type, "transparent-add-color"))
82 return video::EMT_TRANSPARENT_ADD_COLOR;
84 else if (!strcmp (type, "transparent-alpha-channel"))
86 return video::EMT_TRANSPARENT_ALPHA_CHANNEL;
88 else if (!strcmp (type, "transparent-alpha-channel-ref"))
90 return video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
92 else if (!strcmp (type, "transparent-vertex-alpha"))
94 return video::EMT_TRANSPARENT_VERTEX_ALPHA;
96 else if (!strcmp (type, "transparent-reflection-2-layer"))
98 return video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
100 else if (!strcmp (type, "normal-map-solid"))
102 return video::EMT_NORMAL_MAP_SOLID;
104 else if (!strcmp (type, "normal-map-transparent-add-color"))
106 return video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
108 else if (!strcmp (type, "normal-map-transparent-vertex-alpha"))
110 return video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
112 else if (!strcmp (type, "parallax-map-solid"))
114 return video::EMT_PARALLAX_MAP_SOLID;
116 else if (!strcmp (type, "parallax-map-transparent-add-color"))
118 return video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
120 else if (!strcmp (type, "parallax-map-transparent-vertex-alpha"))
122 return video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
124 else if (!strcmp (type, "onetexture-blend"))
126 return video::EMT_ONETEXTURE_BLEND;
130 scm_error (scm_arg_type_key, NULL, "Wrong material type: ~S",
131 scm_list_1 (material_type), scm_list_1 (material_type));