]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/EMaterialFlags.cpp
refactor
[guile-irrlicht.git] / src / EMaterialFlags.cpp
diff --git a/src/EMaterialFlags.cpp b/src/EMaterialFlags.cpp
new file mode 100644 (file)
index 0000000..7c38fe8
--- /dev/null
@@ -0,0 +1,114 @@
+/* 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 "EMaterialFlags.h"
+
+extern "C" {
+
+  irr::video::E_MATERIAL_FLAG
+  scm_to_material_flag (SCM material_flag)
+  {
+    char* flag = scm_to_utf8_stringn (scm_symbol_to_string (material_flag), NULL);
+    if (!strcmp (flag, "wireframe"))
+      {
+        return irr::video::EMF_WIREFRAME;
+      }
+    else if (!strcmp (flag, "pointcloud"))
+      {
+        return irr::video::EMF_POINTCLOUD;
+      }
+    else if (!strcmp (flag, "gouraud-shading"))
+      {
+        return irr::video::EMF_GOURAUD_SHADING;
+      }
+    else if (!strcmp (flag, "lighting"))
+      {
+        return irr::video::EMF_LIGHTING;
+      }
+    else if (!strcmp (flag, "zbuffer"))
+      {
+        return irr::video::EMF_ZBUFFER;
+      }
+    else if (!strcmp (flag, "zwrite-enable"))
+      {
+        return irr::video::EMF_ZWRITE_ENABLE;
+      }
+    else if (!strcmp (flag, "back-face-culling"))
+      {
+        return irr::video::EMF_BACK_FACE_CULLING;
+      }
+    else if (!strcmp (flag, "front-face-culling"))
+      {
+        return irr::video::EMF_FRONT_FACE_CULLING;
+      }
+    else if (!strcmp (flag, "bilinear-filter"))
+      {
+        return irr::video::EMF_BILINEAR_FILTER;
+      }
+    else if (!strcmp (flag, "trilinear-filter"))
+      {
+        return irr::video::EMF_TRILINEAR_FILTER;
+      }
+    else if (!strcmp (flag, "anisotropic-filter"))
+      {
+        return irr::video::EMF_ANISOTROPIC_FILTER;
+      }
+    else if (!strcmp (flag, "fog-enable"))
+      {
+        return irr::video::EMF_FOG_ENABLE;
+      }
+    else if (!strcmp (flag, "normalize-normals"))
+      {
+        return irr::video::EMF_NORMALIZE_NORMALS;
+      }
+    else if (!strcmp (flag, "texture-wrap"))
+      {
+        return irr::video::EMF_TEXTURE_WRAP;
+      }
+    else if (!strcmp (flag, "anti-aliasing"))
+      {
+        return irr::video::EMF_ANTI_ALIASING;
+      }
+    else if (!strcmp (flag, "color-mask"))
+      {
+        return irr::video::EMF_COLOR_MASK;
+      }
+    else if (!strcmp (flag, "color-material"))
+      {
+        return irr::video::EMF_COLOR_MATERIAL;
+      }
+    else if (!strcmp (flag, "use-mip-maps"))
+      {
+        return irr::video::EMF_USE_MIP_MAPS;
+      }
+    else if (!strcmp (flag, "blend-operation"))
+      {
+        return irr::video::EMF_BLEND_OPERATION;
+      }
+    else if (!strcmp (flag, "polygon-offset"))
+      {
+        return irr::video::EMF_POLYGON_OFFSET;
+      }
+  }
+
+}