perf improvements.

This commit is contained in:
Bryce Covert
2015-09-16 09:13:47 -07:00
parent 284b0c20df
commit 60c047d13d
2 changed files with 5 additions and 7 deletions

View File

@@ -490,11 +490,11 @@ with the tiled map file at `path` and `unit` scale.
(let [^Batch batch (.getBatch renderer)]
(.setProjectionMatrix batch (.combined camera))
(.begin batch)
(when shader
(.setShader batch shader))
(doseq [{:keys [additive? opacity ^float r ^float g ^float b ^float hue-amount ^float multiply-amount] :as entity :or {opacity 1.0}} entities
:when (> opacity 0.0)]
(when shader
(.setShader batch shader)
(.setUniformf shader "multiply_amount" (float (or multiply-amount 1.0)))
(.setUniformf shader "hue_amount" (float (or hue-amount 1.0))))
@@ -559,11 +559,7 @@ specify which layers to render with or without.
(render! screen entities)"
([{:keys [renderer] :as screen}]
(cond
(isa? (type renderer) BatchTiledMapRenderer)
(render-map! screen)
(isa? (type renderer) Stage)
(render-stage! screen)))
(render-stage! screen))
([screen entities]
(render! screen)
(draw! screen entities)))

View File

@@ -47,7 +47,9 @@
(.draw object ^Batch batch x y width height))))
(defrecord ParticleEffectEntity [object] Entity
(draw! [{:keys [^ParticleEffect object x y delta-time]} _ batch]
(.setShader ^Batch batch nil)
(let [x (float (or x 0))
y (float (or y 0))
^Graphics g (Gdx/graphics)