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