working on supporting custom shaders.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
VertexAttributes$Usage]
|
||||
[com.badlogic.gdx.graphics.g2d Batch ParticleEffect]
|
||||
[com.badlogic.gdx.graphics.g3d ModelBatch]
|
||||
[com.badlogic.gdx.graphics.glutils ShapeRenderer]
|
||||
[com.badlogic.gdx.graphics.glutils ShapeRenderer ShaderProgram]
|
||||
[com.badlogic.gdx.input GestureDetector
|
||||
GestureDetector$GestureListener]
|
||||
[com.badlogic.gdx.maps MapLayer MapLayers MapObject MapObjects
|
||||
@@ -35,7 +35,8 @@
|
||||
[com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener
|
||||
ChangeListener ClickListener DragListener FocusListener]
|
||||
[com.badlogic.gdx.utils ScreenUtils Timer$Task]
|
||||
[play_clj.entities BundleEntity ShapeEntity]))
|
||||
[play_clj.entities BundleEntity ShapeEntity]
|
||||
))
|
||||
|
||||
(load "core_basics")
|
||||
(load "core_cameras")
|
||||
|
||||
@@ -486,28 +486,25 @@ with the tiled map file at `path` and `unit` scale.
|
||||
entities)
|
||||
|
||||
(defmethod draw! Stage
|
||||
[{:keys [^Stage renderer ^Camera camera] :as screen} entities]
|
||||
[{:keys [^Stage renderer ^Camera camera ^ShaderProgram shader] :as screen} entities]
|
||||
(let [^Batch batch (.getBatch renderer)]
|
||||
(.setProjectionMatrix batch (.combined camera))
|
||||
(.begin batch)
|
||||
(doseq [{:keys [additive? opacity colorize?] :as entity :or {opacity 1.0}} entities
|
||||
(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
|
||||
(.setUniformf shader "multiply_amount" (float (or multiply-amount 1.0)))
|
||||
(.setUniformf shader "hue_amount" (float (or hue-amount 1.0))))
|
||||
|
||||
(when additive?
|
||||
(.setBlendFunction ^Batch batch (gl :gl-src-alpha) (gl :gl-one)))
|
||||
(if colorize?
|
||||
(do (.setBlendFunction ^Batch batch (gl :gl-dst-color) (gl :gl-one-minus-src-alpha))
|
||||
(.setColor batch (color 1 1 1 opacity))
|
||||
(e/draw! entity screen batch)
|
||||
(.setColor batch (color 1 1 1 (* opacity 0.25)))
|
||||
(.setBlendFunction ^Batch batch (gl :gl-src-alpha) (gl :gl-one))
|
||||
(e/draw! entity screen batch))
|
||||
(do (.setColor batch (color 1 1 1 opacity))
|
||||
(e/draw! entity screen batch)
|
||||
(.setColor batch (color 1 1 1 1))))
|
||||
(do (.setColor batch (color (or r 1.0) (or g 1.0) (or b 1.0) opacity))
|
||||
(e/draw! entity screen batch)
|
||||
(.setColor batch (color 1 1 1 1)))
|
||||
|
||||
(when (or additive? colorize?)
|
||||
(when (or additive?)
|
||||
(.setBlendFunction ^Batch batch (gl :gl-src-alpha) (gl :gl-one-minus-src-alpha))))
|
||||
(.end batch))
|
||||
entities)
|
||||
|
||||
Reference in New Issue
Block a user