summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-07-22 14:06:35 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-07-27 17:15:47 +0200
commit9339716f26faea54d5ce5c5abe61534d11e1997f (patch)
tree2825a991b8d2c9d46aec8635056d5ff459416a6e
parent25061aee05d41254735b46298693326ca4d46a44 (diff)
Optionally accept a sprite shader.
-rw-r--r--engine/node-2d.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/engine/node-2d.scm b/engine/node-2d.scm
index d5d9234..163a798 100644
--- a/engine/node-2d.scm
+++ b/engine/node-2d.scm
@@ -302,12 +302,18 @@
;;;
(define-class <sprite> (<node-2d>)
- (texture #:accessor texture #:init-keyword #:texture))
+ (texture #:accessor texture #:init-keyword #:texture)
+ (shader #:accessor shader #:init-keyword #:shader #:init-form #f))
(define-method (draw (sprite <sprite>) alpha)
- (draw-sprite* (asset-ref (texture sprite))
- (texture-gl-rect (texture sprite))
- (world-matrix sprite)))
+ (if (shader sprite)
+ (draw-sprite* (asset-ref (texture sprite))
+ (texture-gl-rect (texture sprite))
+ (world-matrix sprite)
+ #:shader (force (shader sprite)))
+ (draw-sprite* (asset-ref (texture sprite))
+ (texture-gl-rect (texture sprite))
+ (world-matrix sprite))))
(define-class <animated-sprite> (<sprite>)
(atlas #:accessor atlas #:init-keyword #:atlas)