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

index 83d6aafc6d5a5fd8121fb7a820cac05f1d2f8f39..3cd2d39e82a9451566e3df83df2ee8fd8253d1b6 100644 (file)
 #include <libguile.h>
 #include "animated-mesh-md2.h"
 
-irr::scene::EMD2_ANIMATION_TYPE
+
+using namespace irr;
+
+
+scene::EMD2_ANIMATION_TYPE
 scm_to_md2_animation_type (SCM md2_animation_type)
 {
   char* flag = scm_to_utf8_stringn (scm_symbol_to_string (md2_animation_type), NULL);
   if (!strcmp (flag, "stand"))
     {
-      return irr::scene::EMAT_STAND;
+      return scene::EMAT_STAND;
     }
   else if (!strcmp (flag, "run"))
     {
-      return irr::scene::EMAT_RUN;
+      return scene::EMAT_RUN;
     }
   else if (!strcmp (flag, "attack"))
     {
-      return irr::scene::EMAT_ATTACK;
+      return scene::EMAT_ATTACK;
     }
   else if (!strcmp (flag, "pain-a"))
     {
-      return irr::scene::EMAT_PAIN_A;
+      return scene::EMAT_PAIN_A;
     }
   else if (!strcmp (flag, "pain-b"))
     {
-      return irr::scene::EMAT_PAIN_B;
+      return scene::EMAT_PAIN_B;
     }
   else if (!strcmp (flag, "pain-c"))
     {
-      return irr::scene::EMAT_PAIN_C;
+      return scene::EMAT_PAIN_C;
     }
   else if (!strcmp (flag, "jump"))
     {
-      return irr::scene::EMAT_JUMP;
+      return scene::EMAT_JUMP;
     }
   else if (!strcmp (flag, "flip"))
     {
-      return irr::scene::EMAT_FLIP;
+      return scene::EMAT_FLIP;
     }
   else if (!strcmp (flag, "salute"))
     {
-      return irr::scene::EMAT_SALUTE;
+      return scene::EMAT_SALUTE;
     }
   else if (!strcmp (flag, "fallback"))
     {
-      return irr::scene::EMAT_FALLBACK;
+      return scene::EMAT_FALLBACK;
     }
   else if (!strcmp (flag, "wave"))
     {
-      return irr::scene::EMAT_WAVE;
+      return scene::EMAT_WAVE;
     }
   else if (!strcmp (flag, "point"))
     {
-      return irr::scene::EMAT_POINT;
+      return scene::EMAT_POINT;
     }
   else if (!strcmp (flag, "crouch-stand"))
     {
-      return irr::scene::EMAT_CROUCH_STAND;
+      return scene::EMAT_CROUCH_STAND;
     }
   else if (!strcmp (flag, "crouch-walk"))
     {
-      return irr::scene::EMAT_CROUCH_WALK;
+      return scene::EMAT_CROUCH_WALK;
     }
   else if (!strcmp (flag, "crouch-attack"))
     {
-      return irr::scene::EMAT_CROUCH_ATTACK;
+      return scene::EMAT_CROUCH_ATTACK;
     }
   else if (!strcmp (flag, "crouch-pain"))
     {
-      return irr::scene::EMAT_CROUCH_PAIN;
+      return scene::EMAT_CROUCH_PAIN;
     }
   else if (!strcmp (flag, "crouch-death"))
     {
-      return irr::scene::EMAT_CROUCH_DEATH;
+      return scene::EMAT_CROUCH_DEATH;
     }
   else if (!strcmp (flag, "death-fallback"))
     {
-      return irr::scene::EMAT_DEATH_FALLBACK;
+      return scene::EMAT_DEATH_FALLBACK;
     }
   else if (!strcmp (flag, "death-fallforward"))
     {
-      return irr::scene::EMAT_DEATH_FALLFORWARD;
+      return scene::EMAT_DEATH_FALLFORWARD;
     }
   else if (!strcmp (flag, "death-fallbackslow"))
     {
-      return irr::scene::EMAT_DEATH_FALLBACKSLOW;
+      return scene::EMAT_DEATH_FALLBACKSLOW;
     }
   else if (!strcmp (flag, "boom"))
     {
-      return irr::scene::EMAT_BOOM;
+      return scene::EMAT_BOOM;
     }
   else
     {
index 480c6652ee0e37f2892fbf4347ab5913ff53c25b..01286e9dfb921c164179d4499c336210f44df8da 100644 (file)
 
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
-
 #include "animated-mesh-md2.h"
 #include "animated-mesh-scene-node.h"
 #include "gsubr.h"
 
 
+using namespace irr;
+
+
 SCM
 irr_scene_IAnimatedMeshSceneNode_setFrameLoop (SCM animated_mesh_scene_node,
                                                SCM begin,
index fb90936e8ef57fec1188ff7c4e77fe3df3b6a093..32cb02fa2bc5752187d90f013c8c15d27339c274 100644 (file)
@@ -35,10 +35,8 @@ irr_scene_IAnimatedMeshSceneNode_setMD2Animation (SCM animated_mesh_scene_node,
                                                   SCM anim);
 
 extern "C" {
-
   void
   init_animated_mesh_scene_node (void);
-
 }
 
 #endif
index b79f196e668b2edca7eb347191fb234545f0fede..dd1a2c152428a50763238d01754e18d9e31e1b3c 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
-
 #include "animated-mesh.h"
 #include "gsubr.h"
 
index fd65653d0c93e4b5fea7534d1f6942fbe3511252..2afec61b7cb8ec925091faeb05b2938fd893ec08 100644 (file)
@@ -30,12 +30,9 @@ SCM
 irr_scene_IAnimatedMesh_setAnimationSpeed (SCM animated_mesh,
                                            SCM frames_per_second);
 
-
 extern "C" {
-
   void
   init_animated_mesh (void);
-
 }
 
 #endif
index 9b78836f1a25165fc2bf5d8b9c7ef71693217960..1c0152a186739f6dec133fa47e118f88bb957be9 100644 (file)
 #include "box3d.h"
 #include "gsubr.h"
 #include "vector3d.h"
-#include "wrapped.h"
 
-extern "C" {
 
-  void
-  init_box3d (void)
-  {
-    init_box3d_type ();
-    DEFINE_GSUBR ("box3d-add-internal-point!", 2, 0, 0, box3d_add_internal_point);
-    DEFINE_GSUBR ("box3d-reset!", 2, 0, 0, box3d_reset);
-    DEFINE_GSUBR ("make-box3d", 0, 0, 0, make_box3d);
-  }
+using namespace irr;
 
-  DEFINE_WRAPPED_TYPE (irr::core::aabbox3df*, "box3d",
-                       init_box3d_type, box3d_p,
-                       wrap_box3d, unwrap_box3d);
 
-  SCM
-  box3d_add_internal_point (SCM box3d,
-                            SCM point)
-  {
-    irr::core::aabbox3df* aabbox = unwrap_box3d (box3d);
-    aabbox->addInternalPoint (scm_to_vector3df (point));
-    return SCM_UNSPECIFIED;
-  }
+SCM
+irr_core_aabbox3d_addInternalPoint (SCM box3d,
+                                    SCM point)
+{
+  ((core::aabbox3df*)scm_to_pointer (box3d))->addInternalPoint (scm_to_vector3df (point));
+  return SCM_UNSPECIFIED;
+}
 
-  SCM
-  box3d_reset (SCM box3d,
-               SCM init_value)
-  {
-    irr::core::aabbox3df* aabbox = unwrap_box3d (box3d);
-    aabbox->reset (scm_to_vector3df (init_value));
-    return SCM_UNSPECIFIED;
-  }
 
-  SCM
-  make_box3d ()
+SCM
+irr_core_aabbox3d_make ()
+{
+  core::aabbox3df* aabbox = new core::aabbox3df ();
+  return scm_from_pointer ((void*)aabbox, NULL);
+}
+
+
+SCM
+irr_core_aabbox3d_reset (SCM box3d,
+                         SCM init_value)
+{
+  ((core::aabbox3df*)scm_to_pointer (box3d))->reset (scm_to_vector3df (init_value));
+  return SCM_UNSPECIFIED;
+}
+
+
+extern "C" {
+
+  void
+  init_box3d (void)
   {
-    irr::core::aabbox3df* aabbox = new irr::core::aabbox3df ();
-    return wrap_box3d (aabbox);
+    DEFINE_GSUBR ("irr_core_aabbox3d_addInternalPoint", 2, 0, 0,
+                  irr_core_aabbox3d_addInternalPoint);
+    DEFINE_GSUBR ("irr_core_aabbox3d_make", 0, 0, 0,
+                  irr_core_aabbox3d_make);
+    DEFINE_GSUBR ("irr_core_aabbox3d_reset", 2, 0, 0,
+                  irr_core_aabbox3d_reset);
   }
 
 }
index 689dded4dcb493b213fc7173491c49562630771f..75b34825e8fc21b2a5fc6736d8c9ec58a4638382 100644 (file)
 
 #include <irrlicht/irrlicht.h>
 #include <libguile.h>
-#include "wrapped.h"
 
-extern "C" {
-
-  void
-  init_box3d (void);
-
-  DECLARE_WRAPPED_TYPE (irr::core::aabbox3df*, init_box3d_type,
-                        box3d_p, wrap_box3d, unwrap_box3d);
+SCM
+irr_core_aabbox3d_addInternalPoint (SCM box3d,
+                                    SCM point);
 
-  SCM
-  box3d_add_internal_point (SCM box3d,
-                            SCM point);
+SCM
+irr_core_aabbox3d_make ();
 
-  SCM
-  box3d_reset (SCM box3d,
-               SCM init_value);
-
-  SCM
-  make_box3d ();
+SCM
+irr_core_aabbox3d_reset (SCM box3d,
+                         SCM init_value);
 
+extern "C" {
+  void
+  init_box3d (void);
 }
 
 #endif