]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
animated-mesh
authorJavier Sancho <jsf@jsancho.org>
Thu, 7 May 2020 10:01:53 +0000 (12:01 +0200)
committerJavier Sancho <jsf@jsancho.org>
Thu, 7 May 2020 10:01:53 +0000 (12:01 +0200)
src/animated-mesh.cpp
src/animated-mesh.h

index 327deb03b639a94f7909928567b7345372ae88cc..b79f196e668b2edca7eb347191fb234545f0fede 100644 (file)
 #include <libguile.h>
 
 #include "animated-mesh.h"
-#include "animated-mesh-scene-node.h"
 #include "gsubr.h"
-#include "wrapped.h"
 
-extern "C" {
 
-  void
-  init_animated_mesh (void)
-  {
-    init_animated_mesh_type ();
-    DEFINE_GSUBR ("set-animation-speed!", 2, 0, 0, irr_scene_setAnimationSpeed);
-  }
+using namespace irr;
 
-  DEFINE_WRAPPED_TYPE (irr::scene::IAnimatedMesh*, "animated-mesh",
-                       init_animated_mesh_type, animated_mesh_p,
-                       wrap_animated_mesh, unwrap_animated_mesh);
 
-  SCM
-  irr_scene_setAnimationSpeed (SCM wrapped_obj,
-                               SCM frames_per_second)
-  {
-#define SET_ANIMATION_SPEED(OBJ) OBJ->setAnimationSpeed (scm_to_double (frames_per_second));
+SCM
+irr_scene_IAnimatedMesh_setAnimationSpeed (SCM animated_mesh,
+                                           SCM frames_per_second)
+{
+  ((scene::IAnimatedMesh*)scm_to_pointer (animated_mesh))->
+    setAnimationSpeed (scm_to_double (frames_per_second));
+  return SCM_UNSPECIFIED;
+}
+
 
-    if (animated_mesh_p (wrapped_obj))
-      {
-        SET_ANIMATION_SPEED (unwrap_animated_mesh (wrapped_obj));
-      }
-    else if (animated_mesh_scene_node_p (wrapped_obj))
-      {
-        SET_ANIMATION_SPEED (unwrap_animated_mesh_scene_node (wrapped_obj));
-      }
-    else
-      {
-        scm_error (scm_arg_type_key, NULL, "Cannot set animation speed to object: ~S",
-                   scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
-      }
+extern "C" {
 
-    return SCM_UNSPECIFIED;
+  void
+  init_animated_mesh (void)
+  {
+    DEFINE_GSUBR ("irr_scene_IAnimatedMesh_setAnimationSpeed", 2, 0, 0,
+                  irr_scene_IAnimatedMesh_setAnimationSpeed);
   }
 
 }
index 4798c31063431ecd25770747fdf2e0ad7c003a46..fd65653d0c93e4b5fea7534d1f6942fbe3511252 100644 (file)
 
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
-#include "wrapped.h"
+
+
+SCM
+irr_scene_IAnimatedMesh_setAnimationSpeed (SCM animated_mesh,
+                                           SCM frames_per_second);
+
 
 extern "C" {
 
   void
   init_animated_mesh (void);
 
-  DECLARE_WRAPPED_TYPE (irr::scene::IAnimatedMesh*, init_animated_mesh_type,
-                        animated_mesh_p, wrap_animated_mesh, unwrap_animated_mesh);
-
-  SCM
-  irr_scene_setAnimationSpeed (SCM wrapped_obj,
-                               SCM frames_per_second);
-
 }
 
 #endif