From 445b38f04b47d1d664afebc4304385ec8fa7a998 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Fri, 27 Mar 2020 09:53:14 +0100 Subject: [PATCH] box3d-add-internal-point! --- examples/03.CustomSceneNode.scm | 2 +- src/box3d.cpp | 12 +++++++++++- src/box3d.h | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/03.CustomSceneNode.scm b/examples/03.CustomSceneNode.scm index 11869fb..f5c9161 100644 --- a/examples/03.CustomSceneNode.scm +++ b/examples/03.CustomSceneNode.scm @@ -78,7 +78,7 @@ (box3d-reset! box (vertex3d-position (car vertices))) (for-each (lambda (vertex) - (aabbox3d-add-internal-point! box (vertex3d-position vertex))) + (box3d-add-internal-point! box (vertex3d-position vertex))) (cdr vertices)) (define (custom-render) diff --git a/src/box3d.cpp b/src/box3d.cpp index ee5c65b..7185c0b 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -31,15 +31,25 @@ extern "C" { init_box3d (void) { init_box3d_type (); + scm_c_define_gsubr ("box3d-add-internal-point!", 2, 0, 0, (scm_t_subr)box3d_add_internal_point); scm_c_define_gsubr ("box3d-reset!", 2, 0, 0, (scm_t_subr)box3d_reset); scm_c_define_gsubr ("make-box3d", 0, 0, 0, (scm_t_subr)make_box3d); - scm_c_export ("box3d-reset!", "make-box3d", NULL); + scm_c_export ("box3d-add-internal-point!", "box3d-reset!", "make-box3d", NULL); } 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 box3d_reset (SCM box3d, SCM init_value) diff --git a/src/box3d.h b/src/box3d.h index 8ed47f5..689dded 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -34,6 +34,10 @@ extern "C" { DECLARE_WRAPPED_TYPE (irr::core::aabbox3df*, init_box3d_type, box3d_p, wrap_box3d, unwrap_box3d); + SCM + box3d_add_internal_point (SCM box3d, + SCM point); + SCM box3d_reset (SCM box3d, SCM init_value); -- 2.39.5