perf improvements
This commit is contained in:
@@ -14,14 +14,14 @@
|
||||
(let [e (utils/get-entity entities id)]
|
||||
(if-let [[bx1 by1 bx2 by2] (:box e)]
|
||||
(zone/within bx1 by1 bx2 by2 x y)
|
||||
(let [{entity-x :x entity-y :y width :width scale-x :scale-x scale-y :scale-y origin-x :origin-x origin-y :origin-y height :height region :object} (get-in entities [:room :entities id])
|
||||
(let [{^float entity-x :x ^float entity-y :y width :width scale-x :scale-x scale-y :scale-y origin-x :origin-x origin-y :origin-y height :height region :object} (-> entities :room :entities id)
|
||||
|
||||
width (or width (if (instance? TextureRegion region ) (.getRegionWidth ^TextureRegion region) 0))
|
||||
height (or height (if (instance? TextureRegion region ) (.getRegionHeight ^TextureRegion region) 0))
|
||||
entity-x (unchecked-add (float entity-x) (unchecked-multiply (float (or origin-x 0))
|
||||
(float (or scale-x 1))))
|
||||
entity-y (unchecked-add (float entity-y) (unchecked-multiply (float (or origin-y 0))
|
||||
(float (or scale-y 1))))]
|
||||
entity-x (double (unchecked-add (float entity-x) (unchecked-multiply (float (or origin-x 0))
|
||||
(float (or scale-x 1)))))
|
||||
entity-y (double (unchecked-add (float entity-y) (unchecked-multiply (float (or origin-y 0))
|
||||
(float (or scale-y 1)))))]
|
||||
|
||||
(zone/within entity-x entity-y
|
||||
(unchecked-add (float entity-x) (unchecked-multiply (float width) (float (or scale-x 1))))
|
||||
|
||||
Reference in New Issue
Block a user