(else
'())))))
+(define* (get-structs-array num-index root-index struct-size #:optional wrap-proc)
+ (lambda (pointer)
+ (let ((num (bv-uint-ref pointer num-index))
+ (rootp (bv-uint-ref pointer root-index)))
+ (let loop ((i (- num 1)))
+ (cond ((< i 0)
+ '())
+ (else
+ (let* ((p (make-pointer (+ rootp (* i struct-size))))
+ (wp (if wrap-proc (wrap-proc p) p)))
+ (cons wp (loop (- i 1))))))))))
+
(define* (get-pointer-of-pointers num-index root-index #:optional wrap-proc)
(lambda (pointer)
(let* ((num (bv-uint-ref pointer num-index))
(define-type mesh
(num-primitive-types (lambda (p) (bv-uint-ref p 0)))
(vertices (get-pointer-of-pointers 4 12))
- (faces (get-pointer-of-pointers 8 124))
+ (faces (get-structs-array 8 124 8 wrap-face))
(normals (lambda (p) (bv-uint-ref p 16)))
(tangents (lambda (p) (bv-uint-ref p 20)))
(bitangents (lambda (p) (bv-uint-ref p 24)))
(export material?
material-contents)
+
+
+;;; Faces
+
+(define-type face
+ (indices (get-array 0 4 'u32)))
+
+(export face?
+ face-contents)