perf
This commit is contained in:
@@ -892,15 +892,15 @@ void main ()
|
|||||||
(defn get-looped-animation-point [^Animation animation ^double total-time]
|
(defn get-looped-animation-point [^Animation animation ^double total-time]
|
||||||
(mod total-time (animation! animation :get-animation-duration)))
|
(mod total-time (animation! animation :get-animation-duration)))
|
||||||
|
|
||||||
(defn animate [{:keys [anim anim-loop? anim-merges anim-start] :or {anim-loop? true} :as entity} {:keys [delta-time total-time] :or {delta-time 0} :as screen}]
|
(defn animate [{:keys [anim anim-loop? anim-merges ^double anim-start] :or {anim-loop? true} :as entity} {:keys [^double delta-time ^double total-time] :or {^double delta-time 0} :as screen}]
|
||||||
(let [current-frame-index (animation! ^Animation anim :get-key-frame-index
|
(let [current-frame-index (animation! ^Animation anim :get-key-frame-index
|
||||||
(if anim-loop?
|
(if anim-loop?
|
||||||
(get-looped-animation-point anim ^double (- total-time anim-start))
|
(get-looped-animation-point anim ^double (unchecked-subtract total-time anim-start))
|
||||||
(- total-time anim-start)))
|
(unchecked-subtract total-time anim-start)))
|
||||||
previous-frame-index (animation! ^Animation anim :get-key-frame-index
|
previous-frame-index (animation! ^Animation anim :get-key-frame-index
|
||||||
(if anim-loop?
|
(if anim-loop?
|
||||||
(get-looped-animation-point anim ^double (- total-time anim-start delta-time))
|
(get-looped-animation-point anim ^double (unchecked-subtract (unchecked-subtract total-time anim-start ) delta-time))
|
||||||
(- total-time anim-start delta-time)))]
|
(unchecked-subtract (unchecked-subtract total-time anim-start) delta-time)))]
|
||||||
(if (= current-frame-index (:current-frame-index entity) (:previous-frame-index entity))
|
(if (= current-frame-index (:current-frame-index entity) (:previous-frame-index entity))
|
||||||
entity
|
entity
|
||||||
(merge (assoc entity
|
(merge (assoc entity
|
||||||
|
|||||||
Reference in New Issue
Block a user