diff 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
line wrap: on
line diff
     1.1 --- a/org/util.org	Thu Nov 03 10:03:22 2011 -0700
     1.2 +++ b/org/util.org	Thu Nov 03 10:10:55 2011 -0700
     1.3 @@ -96,7 +96,10 @@
     1.4    (:import com.jme3.math.ColorRGBA)
     1.5    (:import com.jme3.bullet.BulletAppState)
     1.6    (:import com.jme3.material.Material)
     1.7 -  (:import com.jme3.scene.Geometry))
     1.8 +  (:import com.jme3.scene.Geometry)
     1.9 +  (:import (java.util.logging Level Logger)))
    1.10 +
    1.11 +
    1.12  
    1.13  (defvar println-repl
    1.14    (bound-fn [& args] (apply println args))
    1.15 @@ -124,6 +127,22 @@
    1.16       BulletAppState))
    1.17     (asset-manager)))
    1.18  
    1.19 +(defn no-logging 
    1.20 +  "Disable all of jMonkeyEngine's logging."
    1.21 +  []
    1.22 +  (.setLevel (Logger/getLogger "com.jme3") Level/OFF))
    1.23 +
    1.24 +(defn set-accuracy
    1.25 +  "Change the accuracy at which the World's Physics is calculated."
    1.26 +  [world new-accuracy]
    1.27 +  (let [physics-manager
    1.28 +        (.getState
    1.29 +         (.getStateManager world) BulletAppState)]
    1.30 +    (.setAccuracy
    1.31 +     (.getPhysicsSpace physics-manager)
    1.32 +     (float new-accuracy))))
    1.33 +
    1.34 +
    1.35  (defn set-gravity 
    1.36    "In order to change the gravity of a scene, it is not only necessary
    1.37     to set the gravity variable, but to \"tap\" every physics object in