changeset 40:bc93abad23ee

moved usefull functions to util
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 10:10:55 -0700
parents 2ce7400825c2
children cce471a4108a
files org/skin.org org/util.org
diffstat 2 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/skin.org	Thu Nov 03 10:03:22 2011 -0700
     1.2 +++ b/org/skin.org	Thu Nov 03 10:10:55 2011 -0700
     1.3 @@ -112,8 +112,6 @@
     1.4  
     1.5  (cortex.import/mega-import-jme3)
     1.6    
     1.7 -(import java.util.logging.Level)
     1.8 -(import java.util.logging.Logger)
     1.9  (use 'hello.brick-wall)
    1.10  
    1.11  
    1.12 @@ -183,15 +181,6 @@
    1.13         (update-ray-debug
    1.14          (.getChild debug-node n) (nth rays n) (nth touch-data n))))))
    1.15  
    1.16 -
    1.17 -
    1.18 -(defn no-logging []
    1.19 -  (.setLevel (Logger/getLogger "com.jme3") Level/OFF))
    1.20 -
    1.21 -(defn set-accuracy [world new-accuracy]
    1.22 -  (let [physics-manager (.getState (.getStateManager world) BulletAppState)]
    1.23 -    (.setAccuracy (.getPhysicsSpace physics-manager) (float new-accuracy))))
    1.24 -
    1.25  (defn transparent-sphere []
    1.26    (doto
    1.27        (make-shape
     2.1 --- a/org/util.org	Thu Nov 03 10:03:22 2011 -0700
     2.2 +++ b/org/util.org	Thu Nov 03 10:10:55 2011 -0700
     2.3 @@ -96,7 +96,10 @@
     2.4    (:import com.jme3.math.ColorRGBA)
     2.5    (:import com.jme3.bullet.BulletAppState)
     2.6    (:import com.jme3.material.Material)
     2.7 -  (:import com.jme3.scene.Geometry))
     2.8 +  (:import com.jme3.scene.Geometry)
     2.9 +  (:import (java.util.logging Level Logger)))
    2.10 +
    2.11 +
    2.12  
    2.13  (defvar println-repl
    2.14    (bound-fn [& args] (apply println args))
    2.15 @@ -124,6 +127,22 @@
    2.16       BulletAppState))
    2.17     (asset-manager)))
    2.18  
    2.19 +(defn no-logging 
    2.20 +  "Disable all of jMonkeyEngine's logging."
    2.21 +  []
    2.22 +  (.setLevel (Logger/getLogger "com.jme3") Level/OFF))
    2.23 +
    2.24 +(defn set-accuracy
    2.25 +  "Change the accuracy at which the World's Physics is calculated."
    2.26 +  [world new-accuracy]
    2.27 +  (let [physics-manager
    2.28 +        (.getState
    2.29 +         (.getStateManager world) BulletAppState)]
    2.30 +    (.setAccuracy
    2.31 +     (.getPhysicsSpace physics-manager)
    2.32 +     (float new-accuracy))))
    2.33 +
    2.34 +
    2.35  (defn set-gravity 
    2.36    "In order to change the gravity of a scene, it is not only necessary
    2.37     to set the gravity variable, but to \"tap\" every physics object in