changeset 397:72ee485d9179

smaller worm segment.
author Robert McIntyre <rlm@mit.edu>
date Mon, 03 Mar 2014 23:24:28 -0500
parents 0898d93a39ef
children 36d492f4deab
files assets/Models/test-touch/touch-cube.blend.orig assets/Models/worm-segment/touch-cube.blend assets/Models/worm-segment/touch-cube.blend.orig assets/Models/worm-segment/worm-segment.blend org/worm_learn.clj
diffstat 5 files changed, 71 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/test-touch/touch-cube.blend.orig has changed
     2.1 Binary file assets/Models/worm-segment/touch-cube.blend has changed
     3.1 Binary file assets/Models/worm-segment/touch-cube.blend.orig has changed
     4.1 Binary file assets/Models/worm-segment/worm-segment.blend has changed
     5.1 --- a/org/worm_learn.clj	Mon Mar 03 23:04:02 2014 -0500
     5.2 +++ b/org/worm_learn.clj	Mon Mar 03 23:24:28 2014 -0500
     5.3 @@ -6,12 +6,82 @@
     5.4    (:import (com.jme3.math ColorRGBA Vector3f))
     5.5    (:import java.io.File)
     5.6    (:import com.jme3.audio.AudioNode)
     5.7 -  (:import com.aurellem.capture.RatchetTimer))
     5.8 +  (:import com.aurellem.capture.RatchetTimer)
     5.9 +  (:import (com.aurellem.capture Capture IsoTimer))
    5.10 +  (:import (com.jme3.math Vector3f ColorRGBA)))
    5.11 +  
    5.12  
    5.13  (dorun (cortex.import/mega-import-jme3))
    5.14  (rlm.rlm-commands/help)
    5.15  
    5.16  
    5.17 +(defn worm-segment []
    5.18 +  (load-blender-model "Models/worm-segment/worm-segment.blend"))
    5.19  
    5.20  
    5.21 +(defn worm-segment []
    5.22 +  (load-blender-model "Models/test-touch/touch-cube.blend"))
    5.23  
    5.24 +
    5.25 +(defn gen-worm
    5.26 +  "create a creature acceptable for testing as a replacement for the
    5.27 +   worm."
    5.28 +  []
    5.29 +  (nodify
    5.30 +   "worm"
    5.31 +   [(nodify
    5.32 +     "eyes"
    5.33 +     [(doto
    5.34 +          (Node. "eye1")
    5.35 +        (.setLocalTranslation (Vector3f. 0 -1.1 0))
    5.36 +        (.setUserData
    5.37 +         
    5.38 +         "eye" 
    5.39 +         "(let [retina
    5.40 +                \"Models/test-creature/retina-small.png\"]
    5.41 +                {:all retina :red retina
    5.42 +                 :green retina :blue retina})"))])
    5.43 +    (box
    5.44 +     0.2 0.2 0.2
    5.45 +     :name "worm-segment"
    5.46 +     :position (Vector3f. 0 0 0)
    5.47 +     :color ColorRGBA/Orange)]))
    5.48 +
    5.49 +
    5.50 +(defn test-basic-touch
    5.51 +  "Testing touch:
    5.52 +   You should see a cube fall onto a table.  There is a cross-shaped
    5.53 +   display which reports the cube's sensation of touch. This display
    5.54 +   should change when the cube hits the table, and whenever you hit
    5.55 +   the cube with balls.
    5.56 +
    5.57 +   Keys:
    5.58 +     <space> : fire ball"
    5.59 +  ([] (test-basic-touch false))
    5.60 +  ([record?]
    5.61 +     (let [head (doto (worm-segment) (body!))
    5.62 +           touch (touch! head)
    5.63 +           touch-display (view-touch)]
    5.64 +       (world
    5.65 +        (nodify [head
    5.66 +                 (box 10 1 10 :position (Vector3f. 0 -10 0)
    5.67 +                      :color ColorRGBA/Gray :mass 0)])
    5.68 +        
    5.69 +        standard-debug-controls
    5.70 +        
    5.71 +        (fn [world]
    5.72 +          (let [timer (IsoTimer. 60)]
    5.73 +            (.setTimer world timer)
    5.74 +            (display-dilated-time world timer))
    5.75 +          (if record?
    5.76 +            (Capture/captureVideo
    5.77 +             world
    5.78 +             (File. "/home/r/proj/cortex/render/touch-cube/main-view/")))
    5.79 +          (speed-up world)
    5.80 +          (light-up-everything world))
    5.81 +        
    5.82 +        (fn [world tpf]
    5.83 +          (touch-display 
    5.84 +           (map #(% (.getRootNode world)) touch)
    5.85 +           (if record?
    5.86 +             (File. "/home/r/proj/cortex/render/touch-cube/touch/"))))))))