From: Javier Sancho Date: Sun, 15 Mar 2020 18:20:57 +0000 (+0100) Subject: set-material-flag! X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=153e920eb83776d841bc0989879a2abb7ac3d685;p=guile-irrlicht.git set-material-flag! --- diff --git a/configure.ac b/configure.ac index ca4d56d..9b85b9a 100644 --- a/configure.ac +++ b/configure.ac @@ -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( diff --git a/irrlicht/scene.scm b/irrlicht/scene.scm index 17437fe..1326783 100644 --- a/irrlicht/scene.scm +++ b/irrlicht/scene.scm @@ -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") diff --git a/src/guile-irrlicht.cpp b/src/guile-irrlicht.cpp index a73a419..d80a5dc 100644 --- a/src/guile-irrlicht.cpp +++ b/src/guile-irrlicht.cpp @@ -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 (); diff --git a/src/material-flags.cpp b/src/material-flags.cpp index df2c884..788a305 100644 --- a/src/material-flags.cpp +++ b/src/material-flags.cpp @@ -22,9 +22,34 @@ #include #include #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) { diff --git a/src/material-flags.h b/src/material-flags.h index 1b1f053..77aa62b 100644 --- a/src/material-flags.h +++ b/src/material-flags.h @@ -27,6 +27,14 @@ 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);