 (ns threedee.core
-  (:require [cljs.pprint :refer [pprint] ]
+  (:require [cljs.pprint :refer [pprint]]
             [cljsjs.three :as THREE]
             [threedee.vectors :as v]))
 


(def WIDTH 600)
(def HEIGHT 600)
(def attractor-acceleration 0.04)
(def max-velocity 2)

(defonce scene (THREE.Scene.))
(def camera (THREE.PerspectiveCamera. 75 (/ WIDTH HEIGHT) 0.2 1000))
(defonce renderer (THREE.WebGLRenderer. #js {"antialias" true}))

(.setPixelRatio renderer js.window.devicePixelRatio)
(.setSize renderer WIDTH HEIGHT)

(defonce x (.appendChild (.getElementById js/document "main") renderer.domElement))

(defonce model (atom {:attractor {:pos [0 0]}
                      :balls     (for [n (range 1 10)]
                                   {:id n :pos [(* n 0.4) 0] :velocity [0 0.3] :acceleration [0 0]})}))



(defonce initial-setup
         (do
           (prn "Initial setup")
           (add-items-to-scene scene @model)
           (mainloop)))