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