]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
material-types
authorJavier Sancho <jsf@jsancho.org>
Sun, 10 May 2020 08:14:08 +0000 (10:14 +0200)
committerJavier Sancho <jsf@jsancho.org>
Sun, 10 May 2020 08:14:08 +0000 (10:14 +0200)
src/material-types.cpp
src/material-types.h

index a1a52ea6513988ada350171283825741f3f6792d..07d3b618ac94c616cec04a1952964276230eff40 100644 (file)
 #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));
+    }
 }
index 69de5d0417f630c90e18873f63c2aa9943415be1..2886e42f8206f6cb6e996007503b22a2f8a3d52a 100644 (file)
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
 
-extern "C" {
-
-  irr::video::E_MATERIAL_TYPE
-  scm_to_material_type (SCM material_type);
-
-}
+irr::video::E_MATERIAL_TYPE
+scm_to_material_type (SCM material_type);
 
 #endif