Open chr15m opened 2 years ago
This worked for me:
(ns my.ns (:require ["three" :as three]))
(defn canvas [world*]
(reagent/with-let [render (fn [] [root @world*])]
[:canvas {:width 400
:height 300
:style {:border "solid 1px lightgrey"}
:ref (fn [el]
(when el
(doto (ta/render render el)
(-> :threejs-scene (.-background) (set! (three/Color. 0xffffff)))
(-> :threejs-scene (.-fog) (set! (three/FogExp2. 0xffffff 0.5))))))}]))
^^ This is inter-oping with the underlying scene directly; it would be nice if scene attributes could be set by data instead like [:scene {:fog ... :background {:color 0xffffff}]
but I don't think that's a feature yet.
What is the recommended way to add fog to a scene? Can I pass the values to the renderer or is it something I should use interop to add after setting up?