                                                       (* (js/Math.cos (+ half-pi (:yaw camera))) delta-strafe elapsed)))))
         (assoc-in [:last-rendered] time-now)
         (assoc :now time-now))))
-
-(defn http-get [url cb]
-  (XhrIo.send (str url)
-              (fn [e]
-                (let [xhr (.-target e)]
-                  (cb (.getResponseText xhr))))))
-
 
 (defmulti control-event
   (fn [message args state] message))

(def manual-step-frame-by-frame?
  (do
    true
    false
    ))

(defn animate-pure [draw-fn step-fn current-value]

        watch-key        (gensym)]

    (reset-gl-canvas! node)
    (doto gl
      (.enable (.-DEPTH_TEST gl))
      (.clearColor 0 0 0 1)
      (.clear (bit-or (.-COLOR_BUFFER_BIT gl) (.-DEPTH_BUFFER_BIT gl))))

    (go
      (let [texture-ch (chan)
            scene-ch   (chan)
            _          (utils/load-cube-map gl "/images/skybox/citadella" #(put! texture-ch %))
            _          (utils/http-get "/models/apartment_2.gltf" #(put! scene-ch (-> (js/JSON.parse %)
                                                                                      (js->clj :keywordize-keys true)
                                                                                      (gltf/process-gltf))))
            skybox     (<! texture-ch)
            scene      (<! scene-ch)
            app-state  (-> app-state
                           (assoc-in [:skybox :texture] (assoc skybox :immutable? true))
                           (assoc-in [:gltf] scene)
                           atom)
            next-tick  (fn []
                         (main* app-state {:comms {:stop     stop
                                                   :controls controls
                                                   :keyboard keyboard}}))]
        (aset js/window "processedGLTF" (clj->js scene))
        (if manual-step-frame-by-frame?
          (set! (.-tick js/window) next-tick)
          (next-tick))))))
