+++ /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"
-
-using namespace irr;
-
-video::E_MATERIAL_TYPE
-scm_to_material_type (SCM material_type)
-{
- char* type_name = scm_to_utf8_string (scm_symbol_to_string (material_type));
- video::E_MATERIAL_TYPE type;
-
- if (!strcmp (type_name, "solid"))
- {
- type = video::EMT_SOLID;
- }
- else if (!strcmp (type_name, "solid-2-layer"))
- {
- type = video::EMT_SOLID_2_LAYER;
- }
- else if (!strcmp (type_name, "lightmap"))
- {
- type = video::EMT_LIGHTMAP;
- }
- else if (!strcmp (type_name, "lightmap-add"))
- {
- type = video::EMT_LIGHTMAP_ADD;
- }
- else if (!strcmp (type_name, "lightmap-m2"))
- {
- type = video::EMT_LIGHTMAP_M2;
- }
- else if (!strcmp (type_name, "lightmap-m4"))
- {
- type = video::EMT_LIGHTMAP_M4;
- }
- else if (!strcmp (type_name, "lightmap-lighting"))
- {
- type = video::EMT_LIGHTMAP_LIGHTING;
- }
- else if (!strcmp (type_name, "lightmap-lighting-m2"))
- {
- type = video::EMT_LIGHTMAP_LIGHTING_M2;
- }
- else if (!strcmp (type_name, "lightmap-lighting-m4"))
- {
- type = video::EMT_LIGHTMAP_LIGHTING_M4;
- }
- else if (!strcmp (type_name, "detail-map"))
- {
- type = video::EMT_DETAIL_MAP;
- }
- else if (!strcmp (type_name, "sphere-map"))
- {
- type = video::EMT_SPHERE_MAP;
- }
- else if (!strcmp (type_name, "reflection-2-layer"))
- {
- type = video::EMT_REFLECTION_2_LAYER;
- }
- else if (!strcmp (type_name, "transparent-add-color"))
- {
- type = video::EMT_TRANSPARENT_ADD_COLOR;
- }
- else if (!strcmp (type_name, "transparent-alpha-channel"))
- {
- type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
- }
- else if (!strcmp (type_name, "transparent-alpha-channel-ref"))
- {
- type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
- }
- else if (!strcmp (type_name, "transparent-vertex-alpha"))
- {
- type = video::EMT_TRANSPARENT_VERTEX_ALPHA;
- }
- else if (!strcmp (type_name, "transparent-reflection-2-layer"))
- {
- type = video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
- }
- else if (!strcmp (type_name, "normal-map-solid"))
- {
- type = video::EMT_NORMAL_MAP_SOLID;
- }
- else if (!strcmp (type_name, "normal-map-transparent-add-color"))
- {
- type = video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
- }
- else if (!strcmp (type_name, "normal-map-transparent-vertex-alpha"))
- {
- type = video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
- }
- else if (!strcmp (type_name, "parallax-map-solid"))
- {
- type = video::EMT_PARALLAX_MAP_SOLID;
- }
- else if (!strcmp (type_name, "parallax-map-transparent-add-color"))
- {
- type = video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
- }
- else if (!strcmp (type_name, "parallax-map-transparent-vertex-alpha"))
- {
- type = video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
- }
- else if (!strcmp (type_name, "onetexture-blend"))
- {
- type = 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));
- }
-
- free (type_name);
- return type;
-}