changeset 388:4c37d39a3cf6

removed dependency on swank, which had silently bit rotted. Restored functionality of mege-import-jme3.
author Robert McIntyre <rlm@mit.edu>
date Thu, 06 Jun 2013 10:09:37 -0400
parents 13059eb62899
children 4bd8fd8e950c
files org/body.org org/integration.org org/test.org org/util.org
diffstat 4 files changed, 32 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/body.org	Wed May 29 17:17:40 2013 -0400
     1.2 +++ b/org/body.org	Thu Jun 06 10:09:37 2013 -0400
     1.3 @@ -24,8 +24,8 @@
     1.4  Collision Mesh in tandem with its Geometric Mesh under the influence
     1.5  of the armature. Without this the creature will not be able to grab
     1.6  things in its environment, and it won't be able to tell where its
     1.7 -physical body is by using its eyes. Also, armatures do not specify
     1.8 -any rotational limits for a joint, making it hard to model elbows,
     1.9 +physical body is by using its eyes. Also, armatures do not specify any
    1.10 +rotational limits for a joint, making it hard to model elbows,
    1.11  shoulders, etc.
    1.12  
    1.13  ** EVE
     2.1 --- a/org/integration.org	Wed May 29 17:17:40 2013 -0400
     2.2 +++ b/org/integration.org	Thu Jun 06 10:09:37 2013 -0400
     2.3 @@ -48,8 +48,8 @@
     2.4  
     2.5  For this demonstration I have to manually drive the muscles of the
     2.6  hand. I do this by creating a little mini-language to describe
     2.7 +simulated muscle contraction.
     2.8  
     2.9 -simulated muscle contraction.
    2.10  #+name: integration-2
    2.11  #+begin_src clojure
    2.12  (defn motor-control-program
    2.13 @@ -224,8 +224,8 @@
    2.14  
    2.15  (import com.aurellem.capture.Capture)
    2.16  
    2.17 -(defn test-everything! 
    2.18 -  ([] (test-everything! false))
    2.19 +(defn test-integration 
    2.20 +  ([] (test-integration false))
    2.21    ([record?]
    2.22    (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
    2.23  
     3.1 --- a/org/test.org	Wed May 29 17:17:40 2013 -0400
     3.2 +++ b/org/test.org	Thu Jun 06 10:09:37 2013 -0400
     3.3 @@ -18,8 +18,8 @@
     3.4               touch
     3.5               proprioception
     3.6               movement
     3.7 +             integration])
     3.8  
     3.9 -             ])
    3.10    (:import com.jme3.app.state.AppState
    3.11  	   com.jme3.system.AppSettings)
    3.12    (:import (com.jme3.math Triangle Vector3f Vector2f Ray Matrix4f)))
    3.13 @@ -73,6 +73,8 @@
    3.14     #'cortex.test.proprioception/test-proprioception
    3.15  
    3.16     #'cortex.test.movement/test-worm-movement
    3.17 +
    3.18 +   #'cortex.test.integration/test-integration
    3.19     ])
    3.20     
    3.21     
     4.1 --- a/org/util.org	Wed May 29 17:17:40 2013 -0400
     4.2 +++ b/org/util.org	Thu Jun 06 10:09:37 2013 -0400
     4.3 @@ -16,7 +16,7 @@
     4.4  #+name: import
     4.5  #+begin_src clojure :results silent
     4.6  (ns cortex.import
     4.7 -  (:require swank.util.class-browse))
     4.8 +  (:import java.io.File java.util.jar.JarFile))
     4.9  
    4.10  (defn permissive-import
    4.11    [classname]
    4.12 @@ -32,19 +32,34 @@
    4.13     ;;  upon being loaded.
    4.14     (not (re-matches #".*Lwjgl.*" classname))))
    4.15  
    4.16 -(defn jme-classes
    4.17 -  "returns a list of all jme3 classes"
    4.18 -  []
    4.19 +(defn jme-jars []
    4.20 +  (map 
    4.21 +   #(JarFile. (File. %))
    4.22 +   (filter (partial re-matches #".*jME3.*")
    4.23 +           (clojure.string/split
    4.24 +            (System/getProperty "java.class.path") #":"))))
    4.25 +
    4.26 +(defn jme-class-names []
    4.27    (filter
    4.28     jme-class?
    4.29 -   (map :name
    4.30 -        swank.util.class-browse/available-classes)))
    4.31 -  
    4.32 +   (map
    4.33 +    (comp
    4.34 +     #(.replace % File/separator ".")
    4.35 +     #(clojure.string/replace % ".class" ""))
    4.36 +    (filter
    4.37 +     (partial re-matches #".*\.class$")
    4.38 +     (mapcat
    4.39 +      #(map
    4.40 +        str
    4.41 +        (enumeration-seq
    4.42 +         (.entries %)))
    4.43 +      (jme-jars))))))
    4.44 +         
    4.45  (defn mega-import-jme3
    4.46    "Import ALL the jme classes. For REPL use."
    4.47    []
    4.48 -  (doall
    4.49 -   (map (comp permissive-import symbol) (jme-classes))))
    4.50 +  (dorun
    4.51 +   (map (comp permissive-import symbol) (jme-class-names))))
    4.52  #+end_src  
    4.53  
    4.54  jMonkeyEngine3 has a plethora of classes which can be overwhelming to