--- /dev/null
+;;; guile-irrlicht --- FFI bindings for Irrlicht Engine
+;;; Copyright (C) 2019 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/>.
+
+
+(define-module (irrlicht aabbox3d)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-9 gnu)
+ #:use-module (system foreign)
+ #:use-module ((irrlicht bindings core) #:prefix ffi-core:)
+ #:export (make-aabbox3d
+ aabbox3d-min-edge
+ aabbox3d-max-edge
+ aabbox3d-reset!
+ aabbox3d-add-internal-point!))
+
+(define-record-type <aabbox3d>
+ (make-raw-aabbox3d c-pointer)
+ aabbox3d?
+ (c-pointer aabbox3d-c-pointer))
+
+(define* (make-aabbox3d #:optional (min-edge '(0 0 0)) (max-edge min-edge))
+ (make-raw-aabbox3d
+ (make-c-struct ffi-core:aabbox3d_f32 (append min-edge max-edge))))
+
+(define (aabbox3d-min-edge box)
+ (let ((data (parse-c-struct (aabbox3d-c-pointer box) ffi-core:aabbox3d_f32)))
+ (list-head data 3)))
+
+(define (aabbox3d-max-edge box)
+ (let ((data (parse-c-struct (aabbox3d-c-pointer box) ffi-core:aabbox3d_f32)))
+ (list-tail data 3)))
+
+(define (aabbox3d-reset! box point)
+ (ffi-core:aabbox3d-reset
+ (aabbox3d-c-pointer box)
+ (make-c-struct ffi-core:vector3df point)))
+
+(define (aabbox3d-add-internal-point! box point)
+ (ffi-core:aabbox3d-add-internal-point
+ (aabbox3d-c-pointer box)
+ (make-c-struct ffi-core:vector3df point)))
+
+(set-record-type-printer! <aabbox3d>
+ (lambda (record port)
+ (let ((min (aabbox3d-min-edge record))
+ (max (aabbox3d-max-edge record)))
+ (format port "#<aabbox3d min: ~a max: ~a>" min max))))
(define-module (irrlicht bindings core)
- #:use-module (system foreign))
+ #:use-module (system foreign)
+ #:use-module (irrlicht util))
+
+;; aabbox3d f32 struct and functions
+(define-public aabbox3d_f32
+ (list
+ float float float ;minEdge
+ float float float ;maxEdge
+ ))
+
+(define-foreign aabbox3d-add-internal-point
+ void "irr_core_aabbox3d_addInternalPoint" (list '* '*))
+
+(define-foreign aabbox3d-reset
+ void "irr_core_aabbox3d_reset" (list '* '*))
;; dimension2d struct
(define-public dimension2d