comparison org/util.org @ 192:deac7b708750

cleaned up test-creature.org and renamed to integreation.org.
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 11:29:45 -0700
parents c33a8e5fe7bc
children fc0bf33bded2
comparison
equal deleted inserted replaced
191:66fbab414d45 192:deac7b708750
100 (:import com.jme3.scene.Geometry) 100 (:import com.jme3.scene.Geometry)
101 (:import java.awt.image.BufferedImage) 101 (:import java.awt.image.BufferedImage)
102 (:import javax.swing.JPanel) 102 (:import javax.swing.JPanel)
103 (:import javax.swing.JFrame) 103 (:import javax.swing.JFrame)
104 (:import javax.swing.SwingUtilities) 104 (:import javax.swing.SwingUtilities)
105 105 (:import com.jme3.scene.plugins.blender.BlenderModelLoader)
106 (:import (java.util.logging Level Logger))) 106 (:import (java.util.logging Level Logger)))
107 107
108 (defvar println-repl 108 (defvar println-repl
109 (bound-fn [& args] (apply println args)) 109 (bound-fn [& args] (apply println args))
110 "println called from the LWJGL thread will not go to the REPL, but 110 "println called from the LWJGL thread will not go to the REPL, but
316 (let [options (merge base-shape options)] 316 (let [options (merge base-shape options)]
317 (make-shape (assoc options 317 (make-shape (assoc options
318 :shape (Sphere. 32 32 (float r)))))) 318 :shape (Sphere. 32 32 (float r))))))
319 ([] (sphere 0.5))) 319 ([] (sphere 0.5)))
320 320
321 (defn green-x-ray 321 (defn x-ray
322 "A usefull material for debuging -- it can be seen no matter what 322 "A usefull material for debuging -- it can be seen no matter what
323 object occuldes it." 323 object occuldes it."
324 [] 324 [#^ColorRGBA color]
325 (doto (Material. (asset-manager) 325 (doto (Material. (asset-manager)
326 "Common/MatDefs/Misc/Unshaded.j3md") 326 "Common/MatDefs/Misc/Unshaded.j3md")
327 (.setColor "Color" ColorRGBA/Green) 327 (.setColor "Color" color)
328 (-> (.getAdditionalRenderState) 328 (-> (.getAdditionalRenderState)
329 (.setDepthTest false)))) 329 (.setDepthTest false))))
330 330
331 (defn node-seq 331 (defn node-seq
332 "Take a node and return a seq of all its children 332 "Take a node and return a seq of all its children
333 recursively. There will be no nodes left in the resulting 333 recursively. There will be no nodes left in the resulting
334 structure" 334 structure"
341 ([name children] 341 ([name children]
342 (let [node (Node. name)] 342 (let [node (Node. name)]
343 (dorun (map #(.attachChild node %) children)) 343 (dorun (map #(.attachChild node %) children))
344 node)) 344 node))
345 ([children] (nodify "" children))) 345 ([children] (nodify "" children)))
346
347 (defn load-blender-model
348 "Load a .blend file using an asset folder relative path."
349 [^String model]
350 (.loadModel
351 (doto (asset-manager)
352 (.registerLoader BlenderModelLoader
353 (into-array String ["blend"]))) model))
346 354
347 355
348 #+end_src 356 #+end_src
349 357
350 358