From: Javier Sancho Date: Thu, 7 May 2020 10:36:01 +0000 (+0200) Subject: box3d X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=6537f348407a540c027d92d0b766a8684f0fdf95;p=guile-irrlicht.git box3d --- diff --git a/src/animated-mesh-md2.cpp b/src/animated-mesh-md2.cpp index 83d6aaf..3cd2d39 100644 --- a/src/animated-mesh-md2.cpp +++ b/src/animated-mesh-md2.cpp @@ -23,93 +23,97 @@ #include #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 { diff --git a/src/animated-mesh-scene-node.cpp b/src/animated-mesh-scene-node.cpp index 480c665..01286e9 100644 --- a/src/animated-mesh-scene-node.cpp +++ b/src/animated-mesh-scene-node.cpp @@ -21,12 +21,14 @@ #include #include - #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, diff --git a/src/animated-mesh-scene-node.h b/src/animated-mesh-scene-node.h index fb90936..32cb02f 100644 --- a/src/animated-mesh-scene-node.h +++ b/src/animated-mesh-scene-node.h @@ -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 diff --git a/src/animated-mesh.cpp b/src/animated-mesh.cpp index b79f196..dd1a2c1 100644 --- a/src/animated-mesh.cpp +++ b/src/animated-mesh.cpp @@ -21,7 +21,6 @@ #include #include - #include "animated-mesh.h" #include "gsubr.h" diff --git a/src/animated-mesh.h b/src/animated-mesh.h index fd65653..2afec61 100644 --- a/src/animated-mesh.h +++ b/src/animated-mesh.h @@ -30,12 +30,9 @@ SCM irr_scene_IAnimatedMesh_setAnimationSpeed (SCM animated_mesh, SCM frames_per_second); - extern "C" { - void init_animated_mesh (void); - } #endif diff --git a/src/box3d.cpp b/src/box3d.cpp index 9b78836..1c0152a 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -24,46 +24,48 @@ #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); } } diff --git a/src/box3d.h b/src/box3d.h index 689dded..75b3482 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -24,27 +24,21 @@ #include #include -#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