added additive blending.

This commit is contained in:
2015-03-17 15:45:36 -07:00
parent 3b9972e958
commit 63469535cb

View File

@@ -490,10 +490,14 @@ with the tiled map file at `path` and `unit` scale.
(let [^Batch batch (.getBatch renderer)]
(.setProjectionMatrix batch (.combined camera))
(.begin batch)
(doseq [entity entities]
(.setColor batch (color 1 1 1 (or (:opacity entity) 1.0)))
(doseq [{:keys [additive? opacity] :as entity} entities]
(when additive?
(.setBlendFunction ^Batch batch (gl :gl-src-alpha) (gl :gl-one)))
(.setColor batch (color 1 1 1 (or opacity 1.0)))
(e/draw! entity screen batch)
(.setColor batch (color 1 1 1 1)))
(.setColor batch (color 1 1 1 1))
(when additive?
(.setBlendFunction ^Batch batch (gl :gl-src-alpha) (gl :gl-one-minus-src-alpha))))
(.end batch))
entities)