From 63469535cb96aa77331d39a05fbf0645c3f29cb6 Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Tue, 17 Mar 2015 15:45:36 -0700 Subject: [PATCH] added additive blending. --- src/play_clj/core_graphics.clj | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/play_clj/core_graphics.clj b/src/play_clj/core_graphics.clj index 82f1d3e..9a3b7a3 100644 --- a/src/play_clj/core_graphics.clj +++ b/src/play_clj/core_graphics.clj @@ -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)