              (inject-scene-partial (:geometry scene) (str base-name ".lxo") separate-files?)
              (:lights scene)
              "\nWorldEnd\n")]
-    (spit lxs-path lxs)
-    lxs))
-
-(defn- serialize-lxm
-  [{:keys [materials]} base-path]
-  (when materials
-    (let [path (str base-path ".lxm")
-          body (str (lx-header path) materials)]
-      (spit path body)
-      body)))
-
-(defn- serialize-lxv
-  [{:keys [volumes]} base-path]
-  (when volumes
-    (let [path (str base-path ".lxv")
-          body (str (lx-header path) volumes)]
-      (spit path body)
-      body)))
-
-(defn- serialize-lxo
-  [{:keys [geometry]} base-path]
-  (when geometry
-    (let [path (str base-path ".lxo")
-          body (str (lx-header path) geometry)]
-      (spit path body)
-      body)))
+    {:path lxs-path :body lxs}))
+
+(defn- serialize-scene-component
+  [group path]
+  (when group
+    {:path path :body (str (lx-header path) group)}))
 
 (defn serialize-scene
   ([scene base-path]

                    :materials :material
                    :volumes :volume
                    :geometry :shape})
           lxs (serialize-lxs scene* base-path separate?)]
       (if separate?
         (-> lxs
             (str (serialize-lxm scene* base-path))
             (str (serialize-lxo scene* base-path))
             (str (serialize-lxv scene* base-path)))
         lxs))))

(defn- make-transform-matrix
  [{:keys [scale rx ry rz axis theta translate] :or {rx 0 ry 0 rz 0} :as tx}]


(defn- include-partials*
  [partials]
  (apply str (map include-file* partials)))

(defn- inject-scene-partial
