]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
create-fly-straight-animator
authorJavier Sancho <jsf@jsancho.org>
Thu, 9 Apr 2020 06:42:54 +0000 (08:42 +0200)
committerJavier Sancho <jsf@jsancho.org>
Thu, 9 Apr 2020 06:42:54 +0000 (08:42 +0200)
src/reference-counted.cpp
src/scene-manager.cpp
src/scene-manager.h

index eabc3efa0706d16d07deb53dc69fa3925f554a53..9b858cc6e892e81494aa1ac6bfe386fb319cd934 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "device.h"
 #include "reference-counted.h"
+#include "scene-node-animator.h"
 
 extern "C" {
 
@@ -42,6 +43,10 @@ extern "C" {
       {
         result = unwrap_device (wrapped_obj)->drop ();
       }
+    else if (scene_node_animator_p (wrapped_obj))
+      {
+        result = unwrap_scene_node_animator (wrapped_obj)->drop ();
+      }
     else
       {
         scm_error (scm_arg_type_key, NULL, "Object cannot be dropped: ~S",
index c8bd6679c3c0942ef94898b27788cbd8eaa7822c..9ef592fcbfaa10972e78b68010cda494265d9632 100644 (file)
@@ -59,6 +59,8 @@ extern "C" {
                         (scm_t_subr)irr_scene_addSphereSceneNode);
     scm_c_define_gsubr ("create-fly-circle-animator", 1, 0, 1,
                         (scm_t_subr)irr_scene_createFlyCircleAnimator);
+    scm_c_define_gsubr ("create-fly-straight-animator", 4, 0, 1,
+                        (scm_t_subr)irr_scene_createFlyStraightAnimator);
     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);
@@ -67,8 +69,8 @@ extern "C" {
     scm_c_export ("add-animated-mesh-scene-node!", "add-camera-scene-node!",
                   "add-camera-scene-node-fps!", "add-custom-scene-node!", "add-cube-scene-node!",
                   "add-octree-scene-node!", "add-sphere-scene-node!", "create-fly-circle-animator",
-                  "create-rotation-animator", "get-mesh", "get-root-scene-node",
-                  "get-scene-manager", NULL);
+                  "create-fly-straight-animator", "create-rotation-animator", "get-mesh",
+                  "get-root-scene-node", "get-scene-manager", NULL);
   }
 
   DEFINE_WRAPPED_TYPE (irr::scene::ISceneManager*, "scene-manager",
@@ -441,6 +443,31 @@ extern "C" {
     return wrap_scene_node_animator (anim);
   }
 
+  SCM
+  irr_scene_createFlyStraightAnimator (SCM wrapped_scene_manager,
+                                       SCM start_point,
+                                       SCM end_point,
+                                       SCM time_for_way,
+                                       SCM rest)
+  {
+    SCM loop = scm_from_bool (0);
+    SCM pingpong = scm_from_bool (0);
+
+    scm_c_bind_keyword_arguments ("create-fly-straight-animator", rest, (scm_t_keyword_arguments_flags)0,
+                                  scm_from_utf8_keyword ("loop"), &loop,
+                                  scm_from_utf8_keyword ("pingpong"), &pingpong,
+                                  SCM_UNDEFINED);
+
+    irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
+    irr::scene::ISceneNodeAnimator* anim =
+      smgr->createFlyStraightAnimator (scm_to_vector3df (start_point),
+                                       scm_to_vector3df (end_point),
+                                       scm_to_uint32 (time_for_way),
+                                       scm_to_bool (loop),
+                                       scm_to_bool (pingpong));
+    return wrap_scene_node_animator (anim);
+  }
+
   SCM
   irr_scene_createRotationAnimator (SCM wrapped_scene_manager,
                                     SCM rotation_speed)
index a2c0a5c125cfd35dd08391e9ff465b9493572171..ebd81cfb8e3c5ffccf012f59c414f791eff74303 100644 (file)
@@ -72,6 +72,13 @@ extern "C" {
   irr_scene_createFlyCircleAnimator (SCM wrapped_scene_manager,
                                      SCM rest);
 
+  SCM
+  irr_scene_createFlyStraightAnimator (SCM wrapped_scene_manager,
+                                       SCM start_point,
+                                       SCM end_point,
+                                       SCM time_for_way,
+                                       SCM rest);
+
   SCM
   irr_scene_createRotationAnimator (SCM wrapped_scene_manager,
                                     SCM rotation_speed);