From bb1fb0e88f7c608d9533e305722de0d34a4ff3c4 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 22 Mar 2020 20:44:16 +0100 Subject: [PATCH] make-aabbox3df make-aabbox3di --- Makefile.am | 1 + src/aabbox3d.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++ src/aabbox3d.h | 48 +++++++++++++++++++++++++++++++++ src/guile-irrlicht.cpp | 2 ++ src/wrapped.h | 4 +-- 5 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 src/aabbox3d.cpp create mode 100644 src/aabbox3d.h diff --git a/Makefile.am b/Makefile.am index f447eb8..4101951 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = libguile-irrlicht.la libguile_irrlicht_la_SOURCES = \ + src/aabbox3d.cpp \ src/animated-mesh.cpp \ src/animated-mesh-md2.cpp \ src/animated-mesh-scene-node.cpp \ diff --git a/src/aabbox3d.cpp b/src/aabbox3d.cpp new file mode 100644 index 0000000..47a7eb2 --- /dev/null +++ b/src/aabbox3d.cpp @@ -0,0 +1,61 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + This file is part of guile-irrlicht. + + guile-irrlicht is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + guile-irrlicht is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with guile-irrlicht. If not, see + . +*/ + +#include +#include +#include "aabbox3d.h" +#include "wrapped.h" + +extern "C" { + + void + init_aabbox3d (void) + { + init_aabbox3df_type (); + init_aabbox3di_type (); + scm_c_define_gsubr ("make-aabbox3df", 0, 0, 0, (scm_t_subr)make_aabbox3df); + scm_c_define_gsubr ("make-aabbox3di", 0, 0, 0, (scm_t_subr)make_aabbox3di); + scm_c_export ("make-aabbox3df", "make-aabbox3di", NULL); + } + + DEFINE_WRAPPED_TYPE (irr::core::aabbox3df*, "aabbox3df", + init_aabbox3df_type, aabbox3df_p, + wrap_aabbox3df, unwrap_aabbox3df); + + DEFINE_WRAPPED_TYPE (irr::core::aabbox3di*, "aabbox3di", + init_aabbox3di_type, aabbox3di_p, + wrap_aabbox3di, unwrap_aabbox3di); + + SCM + make_aabbox3df () + { + irr::core::aabbox3df* box = new irr::core::aabbox3df (); + return wrap_aabbox3df (box); + } + + SCM + make_aabbox3di () + { + irr::core::aabbox3di* box = new irr::core::aabbox3di (); + return wrap_aabbox3di (box); + } + +} diff --git a/src/aabbox3d.h b/src/aabbox3d.h new file mode 100644 index 0000000..8dda8d3 --- /dev/null +++ b/src/aabbox3d.h @@ -0,0 +1,48 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + This file is part of guile-irrlicht. + + guile-irrlicht is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + guile-irrlicht is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with guile-irrlicht. If not, see + . +*/ + +#ifndef __GUILE_IRRLICHT_AABBOX_3D_H_INCLUDED__ +#define __GUILE_IRRLICHT_AABBOX_3D_H_INCLUDED__ + +#include +#include +#include "wrapped.h" + +extern "C" { + + void + init_aabbox3d (void); + + DECLARE_WRAPPED_TYPE (irr::core::aabbox3df*, init_aabbox3df_type, + aabbox3df_p, wrap_aabbox3df, unwrap_aabbox3df); + + DECLARE_WRAPPED_TYPE (irr::core::aabbox3di*, init_aabbox3di_type, + aabbox3di_p, wrap_aabbox3di, unwrap_aabbox3di); + + SCM + make_aabbox3df (); + + SCM + make_aabbox3di (); + +} + +#endif diff --git a/src/guile-irrlicht.cpp b/src/guile-irrlicht.cpp index 69215ac..271ca91 100644 --- a/src/guile-irrlicht.cpp +++ b/src/guile-irrlicht.cpp @@ -21,6 +21,7 @@ #include +#include "aabbox3d.h" #include "animated-mesh.h" #include "animated-mesh-scene-node.h" #include "camera-scene-node.h" @@ -47,6 +48,7 @@ extern "C" { void init_guile_irrlicht (void) { + init_aabbox3d (); init_animated_mesh (); init_animated_mesh_scene_node (); init_camera_scene_node (); diff --git a/src/wrapped.h b/src/wrapped.h index 1f61d95..c68b26a 100644 --- a/src/wrapped.h +++ b/src/wrapped.h @@ -38,9 +38,9 @@ PRED (SCM wrapped_obj); +static SCM wrapped_type; + #define DEFINE_WRAPPED_TYPE(TYPE, PRINT_NAME, INIT, PRED, WRAP, UNWRAP) \ - static SCM wrapped_type; \ - \ void \ INIT (void) \ { \ -- 2.39.5