    [java.io File Writer OutputStreamWriter StringWriter]
    [java.util Date]))
 
+;; References:
+;; http://www.luxrender.net/wiki/Scene_file_format_dev
+
 (def ^:const version "0.1.0-SNAPSHOT")
 
 (def ^:dynamic *indent* 2)
+
+(def ^:const mesh-types {:inline :trimesh :ply :ply-mesh :stl :stl-mesh})
+
+(def ^:dynamic *degrees* true)
+
+(defn convert-angle
+  [theta]
+  (if *degrees* (m/radians theta) theta))
 
 (defn scaled-absorption-at-depth
   [x scale d]

(defn serialize-lxm
  [{:keys [materials]} base-path]
  (when materials
    (let [lxm-path (str base-path ".lxm")
          lxm (str (lx-header lxm-path) materials)]
      (spit lxm-path lxm)
      lxm)))

(defn serialize-lxv
  [{:keys [volumes]} base-path]
  (when volumes
    (let [lxm-path (str base-path ".lxv")
          lxm (str (lx-header lxm-path) volumes)]
      (spit lxm-path lxm)
      lxm)))

(defn serialize-lxo
  [{:keys [geometry]} base-path]
  (when geometry
    ;; TODO
    ))

(defn serialize-scene
  [scene base-path]
  (let [scene* (reduce
                (fn [s [k type]]
                  (assoc s k (luxvalues-typed type (k scene))))
                {} {:renderer :renderer
                    :accel :accelerator
                    :sampler :sampler
                    :integrator :integrator


(defmethod luxvalue :string-vec
  [_ id xs]
  (format "\"string %s\" [%s]\n"
          (name id)
          (apply str (interpose " " (map #(format "\"%s\"" %) xs)))))

