--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "material-types.h"
+
+extern "C" {
+
+ irr::video::E_MATERIAL_TYPE
+ scm_to_material_type (SCM material_type)
+ {
+ char* type = scm_to_utf8_stringn (scm_symbol_to_string (material_type), NULL);
+ if (!strcmp (type, "solid"))
+ {
+ return irr::video::EMT_SOLID;
+ }
+ else if (!strcmp (type, "solid-2-layer"))
+ {
+ return irr::video::EMT_SOLID_2_LAYER;
+ }
+ else if (!strcmp (type, "lightmap"))
+ {
+ return irr::video::EMT_LIGHTMAP;
+ }
+ else if (!strcmp (type, "lightmap-add"))
+ {
+ return irr::video::EMT_LIGHTMAP_ADD;
+ }
+ else if (!strcmp (type, "lightmap-m2"))
+ {
+ return irr::video::EMT_LIGHTMAP_M2;
+ }
+ else if (!strcmp (type, "lightmap-m4"))
+ {
+ return irr::video::EMT_LIGHTMAP_M4;
+ }
+ else if (!strcmp (type, "lightmap-lighting"))
+ {
+ return irr::video::EMT_LIGHTMAP_LIGHTING;
+ }
+ else if (!strcmp (type, "lightmap-lighting-m2"))
+ {
+ return irr::video::EMT_LIGHTMAP_LIGHTING_M2;
+ }
+ else if (!strcmp (type, "lightmap-lighting-m4"))
+ {
+ return irr::video::EMT_LIGHTMAP_LIGHTING_M4;
+ }
+ else if (!strcmp (type, "detail-map"))
+ {
+ return irr::video::EMT_DETAIL_MAP;
+ }
+ else if (!strcmp (type, "sphere-map"))
+ {
+ return irr::video::EMT_SPHERE_MAP;
+ }
+ else if (!strcmp (type, "reflection-2-layer"))
+ {
+ return irr::video::EMT_REFLECTION_2_LAYER;
+ }
+ else if (!strcmp (type, "transparent-add-color"))
+ {
+ return irr::video::EMT_TRANSPARENT_ADD_COLOR;
+ }
+ else if (!strcmp (type, "transparent-alpha-channel"))
+ {
+ return irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
+ }
+ else if (!strcmp (type, "transparent-alpha-channel-ref"))
+ {
+ return irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ }
+ else if (!strcmp (type, "transparent-vertex-alpha"))
+ {
+ return irr::video::EMT_TRANSPARENT_VERTEX_ALPHA;
+ }
+ else if (!strcmp (type, "transparent-reflection-2-layer"))
+ {
+ return irr::video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
+ }
+ else if (!strcmp (type, "normal-map-solid"))
+ {
+ return irr::video::EMT_NORMAL_MAP_SOLID;
+ }
+ else if (!strcmp (type, "normal-map-transparent-add-color"))
+ {
+ return irr::video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
+ }
+ else if (!strcmp (type, "normal-map-transparent-vertex-alpha"))
+ {
+ return irr::video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
+ }
+ else if (!strcmp (type, "parallax-map-solid"))
+ {
+ return irr::video::EMT_PARALLAX_MAP_SOLID;
+ }
+ else if (!strcmp (type, "parallax-map-transparent-add-color"))
+ {
+ return irr::video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
+ }
+ else if (!strcmp (type, "parallax-map-transparent-vertex-alpha"))
+ {
+ return irr::video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
+ }
+ else if (!strcmp (type, "onetexture-blend"))
+ {
+ return irr::video::EMT_ONETEXTURE_BLEND;
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Wrong material type: ~S",
+ scm_list_1 (material_type), scm_list_1 (material_type));
+ }
+ }
+
+}