From d8ff74866c89933d74577d7887e47f013d515c69 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 29 Mar 2020 20:40:25 +0200 Subject: [PATCH] add-animator! --- examples/03.CustomSceneNode.scm | 4 ++-- src/scene-node.cpp | 13 ++++++++++++- src/scene-node.h | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/03.CustomSceneNode.scm b/examples/03.CustomSceneNode.scm index 3c35e7c..ee1c67e 100644 --- a/examples/03.CustomSceneNode.scm +++ b/examples/03.CustomSceneNode.scm @@ -109,7 +109,7 @@ ;; loop (define frames 0) -(while (device-run? device) +(while (run device) (begin-scene driver #:color '(0 100 100 100)) (draw-all scene-manager) (end-scene driver) @@ -124,5 +124,5 @@ (set! frames 0))) ;; delete device -(device-drop! device) +(drop! device) (exit #t) diff --git a/src/scene-node.cpp b/src/scene-node.cpp index d7b5e36..c92c2d5 100644 --- a/src/scene-node.cpp +++ b/src/scene-node.cpp @@ -25,6 +25,7 @@ #include "animated-mesh-scene-node.h" #include "mesh-scene-node.h" #include "scene-node.h" +#include "scene-node-animator.h" #include "texture.h" #include "vector3d.h" #include "wrapped.h" @@ -35,14 +36,24 @@ extern "C" { init_scene_node (void) { init_scene_node_type (); + scm_c_define_gsubr ("add-animator!", 2, 0, 0, (scm_t_subr)irr_scene_addAnimator); scm_c_define_gsubr ("set-material-texture!", 3, 0, 0, (scm_t_subr)irr_scene_setMaterialTexture); - scm_c_export ("set-material-texture!", NULL); + scm_c_export ("add-animator!", "set-material-texture!", NULL); } DEFINE_WRAPPED_TYPE (irr::scene::ISceneNode*, "scene-node", init_scene_node_type, scene_node_p, wrap_scene_node, unwrap_scene_node); + SCM + irr_scene_addAnimator (SCM wrapped_scene_node, + SCM animator) + { + irr::scene::ISceneNode* node = unwrap_scene_node (wrapped_scene_node); + node->addAnimator (unwrap_scene_node_animator (animator)); + return SCM_UNSPECIFIED; + } + SCM irr_scene_setMaterialTexture (SCM wrapped_scene_node, SCM texture_layer, diff --git a/src/scene-node.h b/src/scene-node.h index afb6973..4aab1e1 100644 --- a/src/scene-node.h +++ b/src/scene-node.h @@ -34,6 +34,10 @@ extern "C" { DECLARE_WRAPPED_TYPE (irr::scene::ISceneNode*, init_scene_node_type, scene_node_p, wrap_scene_node, unwrap_scene_node); + SCM + irr_scene_addAnimator (SCM wrapped_scene_node, + SCM animator); + SCM irr_scene_setMaterialTexture (SCM wrapped_scene_node, SCM texture_layer, -- 2.39.5