diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-01-24 11:04:49 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-01-26 17:40:59 -0500 |
commit | aeb2a61f9d231ef3106f4f25d815d64d2649fbb8 (patch) | |
tree | eb41c29aa41fa277506f4a98312c7190c356b4a0 | |
parent | 7648fe4df578c4afcf2309b8a82c4070e68ee575 (diff) |
render: mesh: Add data field.
* sly/render/mesh.scm (<mesh>) [data]: New field.
-rw-r--r-- | sly/render/mesh.scm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sly/render/mesh.scm b/sly/render/mesh.scm index dc1a1ca..7a34ee5 100644 --- a/sly/render/mesh.scm +++ b/sly/render/mesh.scm @@ -44,12 +44,13 @@ ;;; (define-record-type <vertex-buffer> - (%make-vertex-buffer id type attr-size length) + (%make-vertex-buffer id type attr-size length data) vertex-buffer? (id vertex-buffer-id) (type vertex-buffer-type) (attr-size vertex-buffer-attr-size) - (length vertex-buffer-length)) + (length vertex-buffer-length) + (data vertex-buffer-data)) (define (generate-vertex-buffer) (let ((bv (u32vector 1))) @@ -118,11 +119,12 @@ (arb-vertex-buffer-object array-buffer-arb))) (define* (make-vertex-buffer vertices #:optional (index? #f)) - (let ((bv (vertices-bytevector vertices index?)) - (vbo (%make-vertex-buffer (generate-vertex-buffer) - (gl-buffer-type index?) - (attribute-size (vector-ref vertices 0)) - (vector-length vertices)))) + (let* ((bv (vertices-bytevector vertices index?)) + (vbo (%make-vertex-buffer (generate-vertex-buffer) + (gl-buffer-type index?) + (attribute-size (vector-ref vertices 0)) + (vector-length vertices) + bv))) (with-vertex-buffer vbo (glBufferData (vertex-buffer-type vbo) (bytevector-length bv) |