]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
create-rotation-animator
authorJavier Sancho <jsf@jsancho.org>
Sun, 29 Mar 2020 18:26:54 +0000 (20:26 +0200)
committerJavier Sancho <jsf@jsancho.org>
Sun, 29 Mar 2020 18:26:54 +0000 (20:26 +0200)
Makefile.am
src/guile-irrlicht.cpp
src/scene-manager.cpp
src/scene-manager.h
src/scene-node-animator.cpp [new file with mode: 0644]
src/scene-node-animator.h [new file with mode: 0644]

index b2fc266772dac5311798b824e2c98e03b29b08b1..43eb9c141ccd87e3fac7ed8a926622c908cac5db 100644 (file)
@@ -50,6 +50,7 @@ libguile_irrlicht_la_SOURCES = \
   src/reference-counted.cpp \
   src/scene-manager.cpp \
   src/scene-node.cpp \
+  src/scene-node-animator.cpp \
   src/texture.cpp \
   src/vector2d.cpp \
   src/vector3d.cpp \
index 6e7a937ea8d6c155e007adf92bd13696ccdc1c2c..1bb87cf909beaeb18ac62fb9e9d58e08081757d4 100644 (file)
@@ -41,6 +41,7 @@
 #include "reference-counted.h"
 #include "scene-manager.h"
 #include "scene-node.h"
+#include "scene-node-animator.h"
 #include "texture.h"
 #include "vertex3d.h"
 #include "video-driver.h"
@@ -70,6 +71,7 @@ extern "C" {
     init_reference_counted ();
     init_scene_manager ();
     init_scene_node ();
+    init_scene_node_animator ();
     init_texture ();
     init_vertex3d ();
     init_video_driver ();
index da5425aba7ffb9ea6ea2bc76dedff95ca170324a..f5d1bf7c8315d403ddc13045f0d002b23d4f0178 100644 (file)
@@ -33,6 +33,7 @@
 #include "mesh-scene-node.h"
 #include "scene-manager.h"
 #include "scene-node.h"
+#include "scene-node-animator.h"
 #include "vector3d.h"
 #include "wrapped.h"
 
@@ -52,12 +53,15 @@ extern "C" {
                         (scm_t_subr)irr_scene_addCustomSceneNode);
     scm_c_define_gsubr ("add-octree-scene-node!", 2, 0, 1,
                         (scm_t_subr)irr_scene_addOctreeSceneNode);
+    scm_c_define_gsubr ("create-rotation-animator", 2, 0, 0,
+                        (scm_t_subr)irr_scene_createRotationAnimator);
     scm_c_define_gsubr ("get-mesh", 2, 0, 0, (scm_t_subr)irr_scene_getMesh);
     scm_c_define_gsubr ("get-root-scene-node", 1, 0, 0, (scm_t_subr)irr_scene_getRootSceneNode);
     scm_c_define_gsubr ("get-scene-manager", 1, 0, 0, (scm_t_subr)irr_getSceneManager);
     scm_c_export ("add-animated-mesh-scene-node!", "add-camera-scene-node!",
                   "add-camera-scene-node-fps!", "add-custom-scene-node!",
-                  "add-octree-scene-node!", "get-mesh", "get-root-scene-node",
+                  "add-octree-scene-node!", "create-rotation-animator",
+                  "get-mesh", "get-root-scene-node",
                   "get-scene-manager", NULL);
   }
 
@@ -319,6 +323,16 @@ extern "C" {
     return wrap_mesh_scene_node (node);
   }
 
+  SCM
+  irr_scene_createRotationAnimator (SCM wrapped_scene_manager,
+                                    SCM rotation_speed)
+  {
+    irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
+    irr::scene::ISceneNodeAnimator* anim =
+      smgr->createRotationAnimator(scm_to_vector3df (rotation_speed));
+    return wrap_scene_node_animator (anim);
+  }
+
   SCM
   irr_scene_getMesh (SCM wrapped_scene_manager,
                      SCM filename)
index b4a099d885aeca1b0c041389078c7a686549869f..5da835810049a8e8414a3eb746d12c4ab6e000e7 100644 (file)
@@ -60,6 +60,10 @@ extern "C" {
                                 SCM wrapped_mesh,
                                 SCM rest);
 
+  SCM
+  irr_scene_createRotationAnimator (SCM wrapped_scene_manager,
+                                    SCM rotation_speed);
+
   SCM
   irr_scene_getMesh (SCM wrapped_scene_manager,
                      SCM filename);
diff --git a/src/scene-node-animator.cpp b/src/scene-node-animator.cpp
new file mode 100644 (file)
index 0000000..440fd4a
--- /dev/null
@@ -0,0 +1,39 @@
+/* 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 "scene-node-animator.h"
+#include "wrapped.h"
+
+extern "C" {
+
+  void
+  init_scene_node_animator (void)
+  {
+    init_scene_node_animator_type ();
+  }
+
+  DEFINE_WRAPPED_TYPE (irr::scene::ISceneNodeAnimator*, "scene-node-animator",
+                       init_scene_node_animator_type, scene_node_animator_p,
+                       wrap_scene_node_animator, unwrap_scene_node_animator);
+
+}
diff --git a/src/scene-node-animator.h b/src/scene-node-animator.h
new file mode 100644 (file)
index 0000000..baddc1b
--- /dev/null
@@ -0,0 +1,40 @@
+/* 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/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_SCENE_NODE_ANIMATOR_H_INCLUDED__
+#define __GUILE_IRRLICHT_SCENE_NODE_ANIMATOR_H_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "wrapped.h"
+
+extern "C" {
+
+  void
+  init_scene_node_animator (void);
+
+  DECLARE_WRAPPED_TYPE (irr::scene::ISceneNodeAnimator*, init_scene_node_animator_type,
+                        scene_node_animator_p, wrap_scene_node_animator,
+                        unwrap_scene_node_animator);
+
+}
+
+#endif