   [geom1 geom2]
   (let [out-mesh (Mesh.)]
     (GeometryBatchFactory/mergeGeometries [geom1 geom2] out-mesh)
-    (doto (Geometry. "structured" out-mesh)
-      (.setMaterial (default-material)))))
-
-
-(defn merge-all
-
-  [geometries]
-  (let [out-mesh (Mesh.)]
-    (GeometryBatchFactory/mergeGeometries geometries out-mesh)
     (doto (Geometry. "structured" out-mesh)
       (.setMaterial (default-material)))))
 



(defn mknode
  [& objs]
  (let [new-node (Node. "node")]
    (doseq [geom objs] (.attachChild new-node geom))
    new-node))



  [filename]
  (let [imported-model ^Geometry (.loadModel asset-manager filename)]
    (doto imported-model
      (.setMaterial (default-material)))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Other operations
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defhigh mkpol
  "Mk polyedra.

   Vertices is a list of vertices, and dim is a keyword
   representing the dimension of the shape been created.
   Legal values for dim: :0 , :1, :2."
  [vertices dim]

  (cond-match

   [:0 dim]
   (let [result (struct2 (map #(line %1 %2) (butlast vertices) (next vertices)))]
     (skeleton 0 result))

   [:1 dim]
   (doto (struct2 (map #(line %1 %2) (butlast vertices) (next vertices)))
     (.setMaterial (unlit-material)))
   

   [? dim] (println "TODO")))