summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-12-09 17:00:41 -0500
committerDavid Thompson <dthompson2@worcester.edu>2020-12-09 17:00:41 -0500
commit5610b6a4a23855680d0d105b85f35a79d4015124 (patch)
treeb67050e17dcee8e941adb85f026cb8e28c65599d
parent91d8fd2efde2afa242e47a432f9fa1f90fb9e5d0 (diff)
graphics: buffer: Remove unused buffer view procedures.
-rw-r--r--chickadee/graphics/buffer.scm103
1 files changed, 0 insertions, 103 deletions
diff --git a/chickadee/graphics/buffer.scm b/chickadee/graphics/buffer.scm
index 62c9c18..66609a2 100644
--- a/chickadee/graphics/buffer.scm
+++ b/chickadee/graphics/buffer.scm
@@ -71,7 +71,6 @@
make-streaming-buffer-view
buffer-view?
buffer-view->buffer
- buffer-view->vector
buffer-view-name
buffer-view-offset
buffer-view-component-type
@@ -83,9 +82,6 @@
buffer-view-sparse
buffer-view-data
buffer-view-divisor
- map-buffer-view!
- unmap-buffer-view!
- with-mapped-buffer-view
make-vertex-array
apply-vertex-array
@@ -420,7 +416,6 @@ resized."
(* (component-type-size component-type)
(type-size type))))))
-
(define* (make-buffer-view #:key
(name "anonymous")
buffer
@@ -528,15 +523,6 @@ which attributes advance when rendering multiple instances."
('float (data-type float))
('double (data-type double))))
-(define (map-buffer-view! buffer-view)
- (map-buffer! (buffer-view->buffer buffer-view)))
-
-(define (unmap-buffer-view! buffer-view)
- (unmap-buffer! (buffer-view->buffer buffer-view)))
-
-(define-syntax-rule (with-mapped-buffer-view buffer-view body ...)
- (with-mapped-buffer (buffer-view->buffer buffer-view) body ...))
-
(define* (apply-buffer-view buffer-view #:optional attribute-index)
(set-gpu-vertex-buffer! (current-gpu) (buffer-view->buffer buffer-view))
;; If there is no attribute-index, we assume this is being bound for
@@ -553,95 +539,6 @@ which attributes advance when rendering multiple instances."
(when divisor
(gl-vertex-attrib-divisor attribute-index divisor)))))
-;; TODO: Handle 4-byte alignment rule for the types that need it.
-(define (buffer-view->vector buffer-view)
- (define (component-parser type)
- (match type
- ('byte bytevector-s8-ref)
- ('unsigned-byte bytevector-u8-ref)
- ('short
- (lambda (bv i)
- (bytevector-s16-ref bv i (native-endianness))))
- ('unsigned-short
- (lambda (bv i)
- (bytevector-u16-ref bv i (native-endianness))))
- ('unsigned-int
- (lambda (bv i)
- (bytevector-u32-ref bv i (native-endianness))))
- ('float bytevector-ieee-single-native-ref)))
- (define (element-parser type component-type)
- (let ((parse-component (component-parser component-type))
- (component-type-size (component-type-size component-type)))
- (match type
- ('scalar parse-component)
- ('vec2
- (lambda (bv i)
- (vec2 (parse-component bv i)
- (parse-component bv (+ i component-type-size)))))
- ('vec3
- (lambda (bv i)
- (vec3 (parse-component bv i)
- (parse-component bv (+ i component-type-size))
- (parse-component bv (+ i (* component-type-size 2))))))
- ;; TODO: Use a proper vec4 type when it exists.
- ('vec4
- (lambda (bv i)
- (vector (parse-component bv i)
- (parse-component bv (+ i component-type-size))
- (parse-component bv (+ i (* component-type-size 2)))
- (parse-component bv (+ i (* component-type-size 3))))))
- ;; TODO: Use proper matrix2 type when it exists.
- ('mat2
- (lambda (bv i)
- (vector (vector (parse-component bv i)
- (parse-component bv (+ i component-type-size)))
- (vector (parse-component bv (+ i (* component-type-size 2)))
- (parse-component bv (+ i (* component-type-size 3)))))))
- ;; TODO: Use proper matrix3 type when it exists.
- ('mat3
- (lambda (bv i)
- (vector (vector (parse-component bv i)
- (parse-component bv (+ i component-type-size))
- (parse-component bv (+ i (* component-type-size 2))))
- (vector (parse-component bv (+ i (* component-type-size 3)))
- (parse-component bv (+ i (* component-type-size 4)))
- (parse-component bv (+ i (* component-type-size 5)))))))
- ('mat4
- (lambda (bv i)
- (make-matrix4 (parse-component bv i)
- (parse-component bv (+ i component-type-size))
- (parse-component bv (+ i (* component-type-size 2)))
- (parse-component bv (+ i (* component-type-size 3)))
- (parse-component bv (+ i (* component-type-size 4)))
- (parse-component bv (+ i (* component-type-size 5)))
- (parse-component bv (+ i (* component-type-size 6)))
- (parse-component bv (+ i (* component-type-size 7)))
- (parse-component bv (+ i (* component-type-size 8)))
- (parse-component bv (+ i (* component-type-size 9)))
- (parse-component bv (+ i (* component-type-size 10)))
- (parse-component bv (+ i (* component-type-size 11)))
- (parse-component bv (+ i (* component-type-size 12)))
- (parse-component bv (+ i (* component-type-size 13)))
- (parse-component bv (+ i (* component-type-size 14)))
- (parse-component bv (+ i (* component-type-size 15)))))))))
- (with-mapped-buffer-view buffer-view
- (let* ((data (buffer-view-data buffer-view))
- (length (buffer-view-length buffer-view))
- (offset (buffer-view-offset buffer-view))
- (stride (buffer-view-stride buffer-view))
- (type (buffer-view-type buffer-view))
- (component-type (buffer-view-component-type buffer-view))
- (type-byte-size (* (type-size type)
- (component-type-size component-type)))
- (v (make-vector length))
- (parse-element (element-parser type component-type)))
- (let loop ((i 0))
- (when (< i length)
- (let ((byte-index (+ (* i stride) offset)))
- (vector-set! v i (parse-element data byte-index)))
- (loop (+ i 1))))
- v)))
-
;;;
;;; Vertex Arrays