comparison org/util.org @ 40:bc93abad23ee

moved usefull functions to util
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 10:10:55 -0700
parents 183744c179e6
children ee55966ce7f6
comparison
equal deleted inserted replaced
39:2ce7400825c2 40:bc93abad23ee
94 (:import com.jme3.scene.shape.Sphere) 94 (:import com.jme3.scene.shape.Sphere)
95 (:import com.jme3.light.DirectionalLight) 95 (:import com.jme3.light.DirectionalLight)
96 (:import com.jme3.math.ColorRGBA) 96 (:import com.jme3.math.ColorRGBA)
97 (:import com.jme3.bullet.BulletAppState) 97 (:import com.jme3.bullet.BulletAppState)
98 (:import com.jme3.material.Material) 98 (:import com.jme3.material.Material)
99 (:import com.jme3.scene.Geometry)) 99 (:import com.jme3.scene.Geometry)
100 (:import (java.util.logging Level Logger)))
101
102
100 103
101 (defvar println-repl 104 (defvar println-repl
102 (bound-fn [& args] (apply println args)) 105 (bound-fn [& args] (apply println args))
103 "println called from the LWJGL thread will not go to the REPL, but 106 "println called from the LWJGL thread will not go to the REPL, but
104 instead to whatever terminal started the JVM process. This function 107 instead to whatever terminal started the JVM process. This function
121 (.getPhysicsSpace 124 (.getPhysicsSpace
122 (.getState 125 (.getState
123 (.getStateManager world) 126 (.getStateManager world)
124 BulletAppState)) 127 BulletAppState))
125 (asset-manager))) 128 (asset-manager)))
129
130 (defn no-logging
131 "Disable all of jMonkeyEngine's logging."
132 []
133 (.setLevel (Logger/getLogger "com.jme3") Level/OFF))
134
135 (defn set-accuracy
136 "Change the accuracy at which the World's Physics is calculated."
137 [world new-accuracy]
138 (let [physics-manager
139 (.getState
140 (.getStateManager world) BulletAppState)]
141 (.setAccuracy
142 (.getPhysicsSpace physics-manager)
143 (float new-accuracy))))
144
126 145
127 (defn set-gravity 146 (defn set-gravity
128 "In order to change the gravity of a scene, it is not only necessary 147 "In order to change the gravity of a scene, it is not only necessary
129 to set the gravity variable, but to \"tap\" every physics object in 148 to set the gravity variable, but to \"tap\" every physics object in
130 the scene to reactivate physics calculations." 149 the scene to reactivate physics calculations."