diff options
-rw-r--r-- | chickadee/render/asset.scm | 20 | ||||
-rw-r--r-- | chickadee/render/particles.scm | 82 |
2 files changed, 51 insertions, 51 deletions
diff --git a/chickadee/render/asset.scm b/chickadee/render/asset.scm index bb774e8..44e7afc 100644 --- a/chickadee/render/asset.scm +++ b/chickadee/render/asset.scm @@ -233,16 +233,16 @@ (when (and (vector? min) (not (= (vector-length min) (type-length type)))) (error "not enough elements for min" min type)) - (make-typed-buffer #:name name - #:buffer view - #:offset offset - #:component-type component-type - #:normalized? normalized? - #:length length - #:type type - #:max max - #:min min - #:sparse sparse))) + (make-buffer-view #:name name + #:buffer view + #:offset offset + #:component-type component-type + #:normalized? normalized? + #:length length + #:type type + #:max max + #:min min + #:sparse sparse))) (define (texture-filter n) (match n (9728 'nearest) diff --git a/chickadee/render/particles.scm b/chickadee/render/particles.scm index 9d15ecd..5afae81 100644 --- a/chickadee/render/particles.scm +++ b/chickadee/render/particles.scm @@ -155,49 +155,49 @@ void main (void) { ")) (define (make-particles-vertex-array capacity width height texture buffer) - (let* ((indices (make-typed-buffer #:type 'scalar - #:component-type 'unsigned-int - #:divisor 0 - #:buffer (make-buffer - (u32vector 0 3 2 0 2 1) - #:target 'index))) - (verts (make-typed-buffer #:type 'vec2 - #:component-type 'float - #:divisor 0 - #:buffer (make-buffer - ;; TODO: use the texture - ;; size in pixels. - (let ((hw (/ width 2.0)) - (hh (/ height 2.0))) - (f32vector (- hw) (- hh) - hw (- hh) - hw hh - (- hw) hh)) - #:target 'vertex))) - (tex (make-typed-buffer #:type 'vec2 - #:component-type 'float - #:divisor 0 - #:buffer (make-buffer - (let ((tex (texture-gl-tex-rect - texture))) - (f32vector 0 0 - 1 0 - 1 1 - 0 1)) - #:target 'vertex))) - (pos (make-typed-buffer #:name "particle position buffer" + (let* ((indices (make-buffer-view #:type 'scalar + #:component-type 'unsigned-int + #:divisor 0 + #:buffer (make-buffer + (u32vector 0 3 2 0 2 1) + #:target 'index))) + (verts (make-buffer-view #:type 'vec2 + #:component-type 'float + #:divisor 0 + #:buffer (make-buffer + ;; TODO: use the texture + ;; size in pixels. + (let ((hw (/ width 2.0)) + (hh (/ height 2.0))) + (f32vector (- hw) (- hh) + hw (- hh) + hw hh + (- hw) hh)) + #:target 'vertex))) + (tex (make-buffer-view #:type 'vec2 + #:component-type 'float + #:divisor 0 + #:buffer (make-buffer + (let ((tex (texture-gl-tex-rect + texture))) + (f32vector 0 0 + 1 0 + 1 1 + 0 1)) + #:target 'vertex))) + (pos (make-buffer-view #:name "particle position buffer" + #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length capacity + #:divisor 1)) + (life (make-buffer-view #:name "particle life remaining buffer" #:buffer buffer - #:type 'vec2 - #:component-type 'float + #:type 'scalar + #:component-type 'int + #:offset 24 #:length capacity - #:divisor 1)) - (life (make-typed-buffer #:name "particle life remaining buffer" - #:buffer buffer - #:type 'scalar - #:component-type 'int - #:offset 24 - #:length capacity - #:divisor 1))) + #:divisor 1))) (make-vertex-array #:indices indices #:attributes `((0 . ,verts) (1 . ,tex) |