From d90f35ebd1816b818700badf108882040e82c5cb Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Wed, 30 Jul 2014 13:34:38 +0200 Subject: [PATCH] Use bytevectors instead structs when passing pointers to arrays of numbers to the assimp C library. * src/assimp.scm: Replace make-c-struct calls with bytevector->pointer --- src/assimp.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/assimp.scm b/src/assimp.scm index fcb9492..3925805 100644 --- a/src/assimp.scm +++ b/src/assimp.scm @@ -169,24 +169,24 @@ (pkey (string->pointer (car color-type))) (type (cadr color-type)) (index (caddr color-type)) - (pout (make-c-struct (make-list max float) '(0))) - (pmax (make-c-struct (list unsigned-int) (list max)))) + (pout (bytevector->pointer (list->f32vector (make-list max 0)))) + (pmax (bytevector->pointer (list->u32vector (list max))))) (let ((res (aiGetMaterialFloatArray pmat pkey type index pout pmax))) (if (< res 0) res - (parse-c-struct pout (make-list max float)))))) + (f32vector->list (pointer->bytevector pout max 0 'f32)))))) (define-public (ai-get-material-integer-array mat color-type max) (let ((pmat (unwrap-ai-material mat)) (pkey (string->pointer (car color-type))) (type (cadr color-type)) (index (caddr color-type)) - (pout (make-c-struct (make-list max int) '(0))) - (pmax (make-c-struct (list unsigned-int) (list max)))) + (pout (bytevector->pointer (list->s32vector (make-list max 0)))) + (pmax (bytevector->pointer (list->u32vector (list max))))) (let ((res (aiGetMaterialIntegerArray pmat pkey type index pout pmax))) (if (< res 0) res - (parse-c-struct pout (make-list max int)))))) + (s32vector->list (pointer->bytevector pout max 0 's32)))))) ;;; Faces -- 2.39.2