summaryrefslogtreecommitdiff
path: root/chickadee/graphics/shader.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chickadee/graphics/shader.scm')
-rw-r--r--chickadee/graphics/shader.scm12
1 files changed, 4 insertions, 8 deletions
diff --git a/chickadee/graphics/shader.scm b/chickadee/graphics/shader.scm
index edde064..3d8d369 100644
--- a/chickadee/graphics/shader.scm
+++ b/chickadee/graphics/shader.scm
@@ -198,17 +198,13 @@
#:validator (lambda (x) (or (rect? x) (color? x)))
#:serializer
(let ((unwrap-rect (@@ (chickadee math rect) unwrap-rect)))
- (lambda (bv i v)
+ (lambda (bv i x)
;; As of now, there is no vec4 Scheme type, but we do want to
;; accept colors and rects as vec4s since there is no special
;; color or rect type in GLSL.
- (if (rect? v)
- (bytevector-copy! (unwrap-rect v) 0 bv i 16)
- (begin
- (bytevector-ieee-single-native-set! bv i (color-r v))
- (bytevector-ieee-single-native-set! bv (+ i 4) (color-g v))
- (bytevector-ieee-single-native-set! bv (+ i 8) (color-b v))
- (bytevector-ieee-single-native-set! bv (+ i 12) (color-a v))))))
+ (if (rect? x)
+ (bytevector-copy! (unwrap-rect x) 0 bv i 16)
+ (bytestruct-pack! <color> ((() x)) bv i))))
#:setter gl-uniform4fv
#:null (make-null-rect))