1 ;;; guile-assimp, foreign interface to libassimp
2 ;;; Copyright (C) 2014 by Javier Sancho Fernandez <jsf at jsancho dot org>
4 ;;; This program is free software: you can redistribute it and/or modify
5 ;;; it under the terms of the GNU General Public License as published by
6 ;;; the Free Software Foundation, either version 3 of the License, or
7 ;;; (at your option) any later version.
9 ;;; This program is distributed in the hope that it will be useful,
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ;;; GNU General Public License for more details.
14 ;;; You should have received a copy of the GNU General Public License
15 ;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
18 (define-module (assimp assimp)
19 #:use-module (rnrs bytevectors)
20 #:use-module (system foreign))
22 (define libassimp (dynamic-link "libassimp"))
25 (pointer->procedure '*
26 (dynamic-func "aiImportFile" libassimp)
27 (list '* unsigned-int)))
29 (define-wrapped-pointer-type scene
31 wrap-scene unwrap-scene
33 (format p "#<scene ~x>"
34 (pointer-address (unwrap-scene s)))))
36 (define (load-scene filename flags)
38 (aiImportFile (string->pointer filename)
41 (bytevector-uint-ref (pointer->bytevector numptob (sizeof long))
45 (define (scene-contents scene)
46 (bytevector-uint-ref (pointer->bytevector (unwrap-scene scene) 16)
47 0 (native-endiannes) 4))