]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
set-material-flag!
authorJavier Sancho <jsf@jsancho.org>
Sun, 15 Mar 2020 18:20:57 +0000 (19:20 +0100)
committerJavier Sancho <jsf@jsancho.org>
Sun, 15 Mar 2020 18:20:57 +0000 (19:20 +0100)
configure.ac
irrlicht/scene.scm
src/guile-irrlicht.cpp
src/material-flags.cpp
src/material-flags.h

index ca4d56d6832382e2cfcc9bc58b44431fa630038b..9b85b9a50aad2dea3ea65f5a3ad06af237ff27a2 100644 (file)
@@ -26,6 +26,7 @@ AM_PROG_AR
 AC_PROG_CXX
 LT_INIT
 
+PKG_CHECK_MODULES([GUILE], [guile-2.2])
 GUILE_SITE_DIR
 
 AC_CHECK_LIB(
index 17437fe80e7cfeb1b6d02cb7612e5f7d2a32a416..1326783e2e7492b10d2b4ca45a342373e9c57dad 100644 (file)
@@ -20,7 +20,8 @@
 
 (define-module (irrlicht scene)
   #:export (add-animated-mesh-scene-node
-            get-mesh))
+            get-mesh
+            set-material-flag!))
 
 (load-extension "libguile-irrlicht" "init_guile_irrlicht")
 
index a73a419e291bc64646b46c5ad648c572f0dacb86..d80a5dc19950237f1d03e5b40a545816fd524a45 100644 (file)
@@ -27,6 +27,7 @@
 #include "gui-element.h"
 #include "gui-environment.h"
 #include "gui-static-text.h"
+#include "material-flags.h"
 #include "reference-counted.h"
 #include "scene-manager.h"
 #include "scene-node.h"
@@ -43,6 +44,7 @@ extern "C" {
     init_gui_element ();
     init_gui_environment ();
     init_gui_static_text ();
+    init_material_flag ();
     init_reference_counted ();
     init_scene_manager ();
     init_scene_node ();
index df2c884c68eb5c4fed4eb86a7135c9cda71fe29a..788a305a0b28f7a86a4f08796571c784e929652f 100644 (file)
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
 #include "material-flags.h"
+#include "scene-node.h"
 
 extern "C" {
 
+  void
+  init_material_flag (void)
+  {
+    scm_c_define_gsubr ("set-material-flag!", 3, 0, 0, (scm_t_subr)irr_scene_setMaterialFlag);
+  }
+
+  SCM
+  irr_scene_setMaterialFlag (SCM wrapped_obj,
+                             SCM flag,
+                             SCM newvalue)
+  {
+    if (scene_node_p (wrapped_obj))
+      {
+        unwrap_scene_node (wrapped_obj)->setMaterialFlag (scm_to_material_flag (flag),
+                                                          scm_to_bool (newvalue));
+      }
+    else
+      {
+        scm_error (scm_arg_type_key, NULL, "Cannot set material flag for object: ~S",
+                   scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+      }
+    return SCM_UNSPECIFIED;
+  }
+
   irr::video::E_MATERIAL_FLAG
   scm_to_material_flag (SCM material_flag)
   {
index 1b1f0533767d1221d0e7f365047577d58938b962..77aa62b65b9ca81edebbbe93acfe546a2ac7ef53 100644 (file)
 
 extern "C" {
 
+  void
+  init_material_flag (void);
+
+  SCM
+  irr_scene_setMaterialFlag (SCM wrapped_obj,
+                             SCM flag,
+                             SCM newvalue);
+
   irr::video::E_MATERIAL_FLAG
   scm_to_material_flag (SCM material_flag);