]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/box3d.cpp
box3d-reset! vertex3d-position
[guile-irrlicht.git] / src / box3d.cpp
diff --git a/src/box3d.cpp b/src/box3d.cpp
new file mode 100644 (file)
index 0000000..ee5c65b
--- /dev/null
@@ -0,0 +1,59 @@
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+   Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+   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
+   <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "box3d.h"
+#include "vector3d.h"
+#include "wrapped.h"
+
+extern "C" {
+
+  void
+  init_box3d (void)
+  {
+    init_box3d_type ();
+    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);
+  }
+
+  DEFINE_WRAPPED_TYPE (irr::core::aabbox3df*, "box3d",
+                       init_box3d_type, box3d_p,
+                       wrap_box3d, unwrap_box3d);
+
+  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 ()
+  {
+    irr::core::aabbox3df* aabbox = new irr::core::aabbox3df ();
+    return wrap_box3d (aabbox);
+  }
+
+}