changeset 283:23aadf376e9d

upgraded to latest jMonkeyEngine, streamlined tests
author Robert McIntyre <rlm@mit.edu>
date Wed, 15 Feb 2012 16:56:01 -0700
parents 2ad29b68ff22
children 3dd13e6095e5
files assets/Models/test-creature/finger-tip.png assets/Models/test-creature/finger-tip.xcf assets/Models/test-creature/hand.blend assets/Models/test-touch/touch-cube.blend org/body.org org/hearing.org org/movement.org org/proprioception.org org/sense.org org/touch.org org/vision.org
diffstat 11 files changed, 233 insertions(+), 216 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/test-creature/finger-tip.png has changed
     2.1 Binary file assets/Models/test-creature/finger-tip.xcf has changed
     3.1 Binary file assets/Models/test-creature/hand.blend has changed
     4.1 Binary file assets/Models/test-touch/touch-cube.blend has changed
     5.1 --- a/org/body.org	Wed Feb 15 14:09:20 2012 -0700
     5.2 +++ b/org/body.org	Wed Feb 15 16:56:01 2012 -0700
     5.3 @@ -80,14 +80,17 @@
     5.4    (.setTimer world (RatchetTimer. 60))
     5.5    world)
     5.6  
     5.7 -(defn test-one []
     5.8 -  (world (hand)
     5.9 -         standard-debug-controls
    5.10 -         (comp
    5.11 -          #(Capture/captureVideo
    5.12 -            % (File. "/home/r/proj/cortex/render/body/1"))
    5.13 -          setup)
    5.14 -         no-op))
    5.15 +(defn test-hand-1
    5.16 +  ([] (test-hand-1 false))
    5.17 +  ([record?]
    5.18 +     (world (hand)
    5.19 +            standard-debug-controls
    5.20 +            (fn [world]
    5.21 +              (if record?
    5.22 +                (Capture/captureVideo
    5.23 +                 world
    5.24 +                 (File. "/home/r/proj/cortex/render/body/1")))
    5.25 +             (setup world)) no-op)))
    5.26  #+end_src
    5.27  
    5.28  
    5.29 @@ -158,18 +161,22 @@
    5.30    (box 10 3 10 :position (Vector3f. 0 -10 0)
    5.31         :color ColorRGBA/Gray :mass 0))
    5.32  
    5.33 -(defn test-two []
    5.34 -  (world (nodify
    5.35 -          [(doto (hand)
    5.36 -             (physical!))
    5.37 -          (floor)])
    5.38 -         (merge standard-debug-controls gravity-control)
    5.39 -         (comp
    5.40 -          #(Capture/captureVideo
    5.41 -            % (File. "/home/r/proj/cortex/render/body/2"))
    5.42 -          #(do (set-gravity % Vector3f/ZERO) %)
    5.43 -          setup)
    5.44 -         no-op))
    5.45 +(defn test-hand-2
    5.46 +  ([] (test-hand-2 false))
    5.47 +  ([record?]
    5.48 +     (world
    5.49 +      (nodify
    5.50 +       [(doto (hand)
    5.51 +          (physical!))
    5.52 +        (floor)])
    5.53 +      (merge standard-debug-controls gravity-control)
    5.54 +      (fn [world]
    5.55 +        (if record?
    5.56 +          (Capture/captureVideo
    5.57 +           world (File. "/home/r/proj/cortex/render/body/2")))
    5.58 +        (set-gravity world Vector3f/ZERO)
    5.59 +        (setup world))
    5.60 +      no-op)))
    5.61  #+end_src
    5.62  
    5.63  #+begin_html
    5.64 @@ -428,20 +435,23 @@
    5.65    {"key-h" (fn [world val]
    5.66               (if val (enable-debug world)))})
    5.67    
    5.68 -(defn test-three []
    5.69 -  (world (nodify
    5.70 -          [(doto (hand)
    5.71 -             (physical!)
    5.72 -             (joints!))
    5.73 -           (floor)])
    5.74 -         (merge standard-debug-controls debug-control
    5.75 -                gravity-control)
    5.76 -         (comp
    5.77 -          #(Capture/captureVideo
    5.78 -            % (File. "/home/r/proj/cortex/render/body/3"))
    5.79 -          #(do (set-gravity % Vector3f/ZERO) %)
    5.80 -          setup)
    5.81 -         no-op))
    5.82 +(defn test-hand-3
    5.83 +  ([] (test-hand-3 false))
    5.84 +  ([record?]
    5.85 +     (world 
    5.86 +      (nodify
    5.87 +       [(doto (hand)
    5.88 +          (physical!)
    5.89 +          (joints!))
    5.90 +        (floor)])
    5.91 +      (merge standard-debug-controls debug-control
    5.92 +             gravity-control)
    5.93 +      (comp
    5.94 +       #(Capture/captureVideo
    5.95 +         % (File. "/home/r/proj/cortex/render/body/3"))
    5.96 +       #(do (set-gravity % Vector3f/ZERO) %)
    5.97 +       setup)
    5.98 +      no-op)))
    5.99  #+end_src
   5.100  
   5.101  =physical!= makes the hand solid, then =joints!= connects each
   5.102 @@ -494,22 +504,25 @@
   5.103   (load-blender-model
   5.104              "Models/test-creature/worm.blend"))
   5.105  
   5.106 -(defn worm-1 []
   5.107 -  (let [timer (RatchetTimer. 60)]
   5.108 -    (world
   5.109 -     (nodify
   5.110 -      [(doto (worm)
   5.111 -         (body!))
   5.112 -       (floor)])
   5.113 -     (merge standard-debug-controls debug-control)
   5.114 -     #(do
   5.115 -        (speed-up %)
   5.116 -        (light-up-everything %)
   5.117 -        (.setTimer % timer)
   5.118 -        (cortex.util/display-dialated-time % timer)
   5.119 -        (Capture/captureVideo
   5.120 -         % (File. "/home/r/proj/cortex/render/body/4")))
   5.121 -     no-op)))
   5.122 +(defn test-worm
   5.123 +  ([] (test-worm false))
   5.124 +  ([record?]
   5.125 +     (let [timer (RatchetTimer. 60)]
   5.126 +       (world
   5.127 +        (nodify
   5.128 +         [(doto (worm)
   5.129 +            (body!))
   5.130 +          (floor)])
   5.131 +        (merge standard-debug-controls debug-control)
   5.132 +        #(do
   5.133 +           (speed-up %)
   5.134 +           (light-up-everything %)
   5.135 +           (.setTimer % timer)
   5.136 +           (cortex.util/display-dialated-time % timer)
   5.137 +           (if record?
   5.138 +             (Capture/captureVideo
   5.139 +              % (File. "/home/r/proj/cortex/render/body/4"))))
   5.140 +        no-op))))
   5.141  #+end_src
   5.142  
   5.143  #+begin_html
     6.1 --- a/org/hearing.org	Wed Feb 15 14:09:20 2012 -0700
     6.2 +++ b/org/hearing.org	Wed Feb 15 16:56:01 2012 -0700
     6.3 @@ -1018,43 +1018,43 @@
     6.4  #+begin_src clojure 
     6.5  (in-ns 'cortex.test.hearing)
     6.6  
     6.7 -(cortex.import/mega-import-jme3)
     6.8 -(import java.io.File)
     6.9 -
    6.10 -(use 'cortex.body)
    6.11 -
    6.12 -(defn test-worm-hearing []
    6.13 -  (let [the-worm (doto (worm) (body!))
    6.14 -        hearing (hearing! the-worm)
    6.15 -        hearing-display (view-hearing)
    6.16 +(defn test-worm-hearing
    6.17 +  ([] (test-worm-hearing false))
    6.18 +  ([record?] 
    6.19 +     (let [the-worm (doto (worm) (body!))
    6.20 +           hearing (hearing! the-worm)
    6.21 +           hearing-display (view-hearing)
    6.22 +           
    6.23 +           tone (AudioNode. (asset-manager)
    6.24 +                            "Sounds/pure.wav" false)
    6.25 +           
    6.26 +           hymn (AudioNode. (asset-manager) 
    6.27 +                            "Sounds/ear-and-eye.wav" false)]
    6.28 +       (world
    6.29 +        (nodify [the-worm (floor)])
    6.30 +        (merge standard-debug-controls
    6.31 +               {"key-return"
    6.32 +                (fn [_ value]
    6.33 +                  (if value (.play tone)))
    6.34 +                "key-l"
    6.35 +                (fn [_ value]
    6.36 +                  (if value (.play hymn)))})
    6.37 +        (fn [world]
    6.38 +          (light-up-everything world)
    6.39 +          (if record?
    6.40 +            (do 
    6.41 +              (com.aurellem.capture.Capture/captureVideo
    6.42 +               world
    6.43 +               (File."/home/r/proj/cortex/render/worm-audio/frames"))
    6.44 +              (com.aurellem.capture.Capture/captureAudio
    6.45 +               world
    6.46 +               (File."/home/r/proj/cortex/render/worm-audio/audio.wav")))))
    6.47          
    6.48 -        tone (AudioNode. (asset-manager)
    6.49 -                         "Sounds/pure.wav" false)
    6.50 -        
    6.51 -        hymn (AudioNode. (asset-manager) 
    6.52 -                         "Sounds/ear-and-eye.wav" false)]
    6.53 -    (world
    6.54 -     (nodify [the-worm (floor)])
    6.55 -     (merge standard-debug-controls
    6.56 -            {"key-return"
    6.57 -             (fn [_ value]
    6.58 -               (if value (.play tone)))
    6.59 -             "key-l"
    6.60 -             (fn [_ value]
    6.61 -               (if value (.play hymn)))})
    6.62 -     (fn [world]
    6.63 -       (light-up-everything world)
    6.64 -       (com.aurellem.capture.Capture/captureVideo
    6.65 -        world
    6.66 -        (File."/home/r/proj/cortex/render/worm-audio/frames"))
    6.67 -       (com.aurellem.capture.Capture/captureAudio
    6.68 -        world
    6.69 -        (File."/home/r/proj/cortex/render/worm-audio/audio.wav")))
    6.70 -     
    6.71 -     (fn [world tpf]
    6.72 -       (hearing-display
    6.73 -        (map #(% world) hearing)
    6.74 -        (File. "/home/r/proj/cortex/render/worm-audio/hearing-data"))))))
    6.75 +        (fn [world tpf]
    6.76 +          (hearing-display
    6.77 +           (map #(% world) hearing)
    6.78 +           (if record?
    6.79 +             (File. "/home/r/proj/cortex/render/worm-audio/hearing-data"))))))))
    6.80  #+end_src
    6.81  
    6.82  In this test, I load the worm with its newly formed ear and let it
    6.83 @@ -1154,11 +1154,13 @@
    6.84  #+name: test-header
    6.85  #+begin_src clojure
    6.86  (ns cortex.test.hearing
    6.87 -  (:use (cortex world util hearing))
    6.88 +  (:use (cortex world util hearing body))
    6.89    (:use cortex.test.body)
    6.90    (:import (com.jme3.audio AudioNode Listener))
    6.91 +  (:import java.io.File)
    6.92    (:import com.jme3.scene.Node
    6.93 -	   com.jme3.system.AppSettings))
    6.94 +	   com.jme3.system.AppSettings
    6.95 +           com.jme3.math.Vector3f))
    6.96  #+end_src
    6.97  
    6.98  * Source Listing
     7.1 --- a/org/movement.org	Wed Feb 15 14:09:20 2012 -0700
     7.2 +++ b/org/movement.org	Wed Feb 15 16:56:01 2012 -0700
     7.3 @@ -183,9 +183,10 @@
     7.4  #+caption: The node highlighted in orange is the parent node of all muscles in the worm.  The arrow highlighted in yellow represents the creature's single muscle, which moves the top segment.  The other nodes which are not highlighted are joints, eyes, and ears.
     7.5  [[../images/worm-with-muscle.png]]
     7.6  
     7.7 +#+name: test-movement
     7.8  #+begin_src clojure
     7.9 -(defn test-movement
    7.10 -  ([] (test-movement false))
    7.11 +(defn test-worm-movement
    7.12 +  ([] (test-worm-movement false))
    7.13    ([record?]
    7.14       (let [creature (doto (worm) (body!))
    7.15  
    7.16 @@ -307,11 +308,9 @@
    7.17    (:import java.io.File)
    7.18    (:import java.awt.image.BufferedImage)
    7.19    (:import com.jme3.scene.Node)
    7.20 -  (:import com.jme3.math.Vector3f)
    7.21 +  (:import (com.jme3.math Quaternion Vector3f))
    7.22    (:import (com.aurellem.capture Capture RatchetTimer))
    7.23    (:import com.jme3.bullet.control.RigidBodyControl))
    7.24 -
    7.25 -(cortex.import/mega-import-jme3)
    7.26  #+end_src
    7.27  
    7.28  * Source Listing
     8.1 --- a/org/proprioception.org	Wed Feb 15 14:09:20 2012 -0700
     8.2 +++ b/org/proprioception.org	Wed Feb 15 16:56:01 2012 -0700
     8.3 @@ -351,10 +351,12 @@
     8.4  #+name: test-proprioception-header
     8.5  #+begin_src clojure
     8.6  (ns cortex.test.proprioception
     8.7 -(:import (com.aurellem.capture Capture RatchetTimer))
     8.8 -(:use (cortex util world proprioception body))
     8.9 -(:import java.io.File))
    8.10 -(cortex.import/mega-import-jme3)
    8.11 +  (:import (com.aurellem.capture Capture RatchetTimer))
    8.12 +  (:use (cortex util world proprioception body))
    8.13 +  (:import java.io.File)
    8.14 +  (:import com.jme3.bullet.control.RigidBodyControl)
    8.15 +  (:import com.jme3.bullet.collision.PhysicsCollisionObject)
    8.16 +  (:import (com.jme3.math Vector3f Quaternion ColorRGBA)))
    8.17  #+end_src
    8.18  
    8.19  * Source Listing
     9.1 --- a/org/sense.org	Wed Feb 15 14:09:20 2012 -0700
     9.2 +++ b/org/sense.org	Wed Feb 15 16:56:01 2012 -0700
     9.3 @@ -448,32 +448,35 @@
     9.4  (defn test-bind-sense
     9.5    "Show a camera that stays in the same relative position to a blue
     9.6    cube."
     9.7 -  []
     9.8 -  (let [eye-pos (Vector3f. 0 30 0)
     9.9 -        rock (box 1 1 1 :color ColorRGBA/Blue
    9.10 -                  :position (Vector3f. 0 10 0)
    9.11 -                  :mass 30)
    9.12 -        table (box 3 1 10 :color ColorRGBA/Gray :mass 0
    9.13 -                   :position (Vector3f. 0 -3 0))]
    9.14 -    (world
    9.15 -     (nodify [rock table])
    9.16 -     standard-debug-controls
    9.17 -     (fn init [world]
    9.18 -       (let [cam (doto (.clone (.getCamera world))
    9.19 -                   (.setLocation eye-pos)
    9.20 -                   (.lookAt Vector3f/ZERO
    9.21 -                            Vector3f/UNIT_X))]
    9.22 -         (bind-sense rock cam)
    9.23 -         (.setTimer world (RatchetTimer. 60))
    9.24 -         (Capture/captureVideo
    9.25 -          world (File. "/home/r/proj/cortex/render/bind-sense0"))
    9.26 -         (add-camera!
    9.27 -          world cam
    9.28 -          (comp (view-image
    9.29 -                 (File. "/home/r/proj/cortex/render/bind-sense1"))
    9.30 -                BufferedImage!))
    9.31 -         (add-camera! world (.getCamera world) no-op)))
    9.32 -     no-op)))
    9.33 +  ([] (test-bind-sense false))
    9.34 +  ([record?]
    9.35 +     (let [eye-pos (Vector3f. 0 30 0)
    9.36 +           rock (box 1 1 1 :color ColorRGBA/Blue
    9.37 +                     :position (Vector3f. 0 10 0)
    9.38 +                     :mass 30)
    9.39 +           table (box 3 1 10 :color ColorRGBA/Gray :mass 0
    9.40 +                      :position (Vector3f. 0 -3 0))]
    9.41 +       (world
    9.42 +        (nodify [rock table])
    9.43 +        standard-debug-controls
    9.44 +        (fn init [world]
    9.45 +          (let [cam (doto (.clone (.getCamera world))
    9.46 +                      (.setLocation eye-pos)
    9.47 +                      (.lookAt Vector3f/ZERO
    9.48 +                               Vector3f/UNIT_X))]
    9.49 +            (bind-sense rock cam)
    9.50 +            (.setTimer world (RatchetTimer. 60))
    9.51 +            (if record?
    9.52 +              (Capture/captureVideo
    9.53 +               world (File. "/home/r/proj/cortex/render/bind-sense0")))
    9.54 +            (add-camera!
    9.55 +             world cam
    9.56 +             (comp (view-image
    9.57 +                    (if record?
    9.58 +                    (File. "/home/r/proj/cortex/render/bind-sense1")))
    9.59 +                   BufferedImage!))
    9.60 +            (add-camera! world (.getCamera world) no-op)))
    9.61 +        no-op))))
    9.62  #+end_src
    9.63  
    9.64  #+begin_html
    10.1 --- a/org/touch.org	Wed Feb 15 14:09:20 2012 -0700
    10.2 +++ b/org/touch.org	Wed Feb 15 16:56:01 2012 -0700
    10.3 @@ -435,7 +435,7 @@
    10.4                                               touch-objects))]
    10.5                           (FastMath/clamp
    10.6                            (float 
    10.7 -                           (if (> response limit) 0.0
    10.8 +                           (if (> response limit) (float 0.0)
    10.9                                 (+ response correction)))
   10.10                             (float 0.0)
   10.11                             limit)))
   10.12 @@ -485,7 +485,7 @@
   10.13          (for [i (range (count coords))]
   10.14            (.setRGB image ((coords i) 0) ((coords i) 1)
   10.15                     (apply touch->gray (sensor-data i)))))
   10.16 -       image))))
   10.17 +     image))))
   10.18  #+end_src
   10.19  
   10.20  #+results: visualization
   10.21 @@ -623,8 +623,8 @@
   10.22  #+begin_src clojure
   10.23  (in-ns 'cortex.test.touch)
   10.24  
   10.25 -(defn test-touch 
   10.26 -  ([] (test-touch false))
   10.27 +(defn test-worm-touch 
   10.28 +  ([] (test-worm-touch false))
   10.29    ([record?]
   10.30       (let [the-worm (doto (worm) (body!))
   10.31             touch (touch! the-worm)
   10.32 @@ -730,6 +730,7 @@
   10.33    - [[../src/cortex/test/touch.clj][cortex.test.touch]]
   10.34    - [[../src/cortex/video/magick4.clj][cortex.video.magick4]]
   10.35    - [[../src/cortex/video/magick5.clj][cortex.video.magick5]]
   10.36 +  - [[../assets/Models/test-touch/touch-cube.blend][touch-cube.blend]]
   10.37  #+html: <ul> <li> <a href="../org/touch.org">This org file</a> </li> </ul>
   10.38    - [[http://hg.bortreb.com ][source-repository]]
   10.39  
   10.40 @@ -781,11 +782,3 @@
   10.41  #+begin_src clojure :tangle ../src/cortex/video/magick5.clj
   10.42  <<magick5>>
   10.43  #+end_src
   10.44 -
   10.45 -
   10.46 -
   10.47 -
   10.48 -  
   10.49 -
   10.50 -
   10.51 -
    11.1 --- a/org/vision.org	Wed Feb 15 14:09:20 2012 -0700
    11.2 +++ b/org/vision.org	Wed Feb 15 16:56:01 2012 -0700
    11.3 @@ -453,35 +453,38 @@
    11.4  
    11.5     You should see a rotating cube, and two windows,
    11.6     each displaying a different view of the cube."
    11.7 -  []
    11.8 -  (let [candy
    11.9 -        (box 1 1 1 :physical? false :color ColorRGBA/Blue)]
   11.10 -    (world
   11.11 -     (doto (Node.)
   11.12 -       (.attachChild candy))
   11.13 -     {}
   11.14 -     (fn [world]
   11.15 -       (let [cam (.clone (.getCamera world))
   11.16 -             width (.getWidth cam)
   11.17 -             height (.getHeight cam)]
   11.18 -         (add-camera! world cam 
   11.19 -                      (comp
   11.20 -                       (view-image
   11.21 -                        (File. "/home/r/proj/cortex/render/vision/1"))
   11.22 -                        BufferedImage!))
   11.23 -         (add-camera! world
   11.24 -                  (doto (.clone cam)
   11.25 -                    (.setLocation (Vector3f. -10 0 0))
   11.26 -                    (.lookAt Vector3f/ZERO Vector3f/UNIT_Y))
   11.27 -                  (comp
   11.28 -                   (view-image
   11.29 -                    (File. "/home/r/proj/cortex/render/vision/2"))
   11.30 -                        BufferedImage!))
   11.31 -         ;; This is here to restore the main view
   11.32 +  ([] (test-pipeline false))
   11.33 +  ([record?]
   11.34 +     (let [candy
   11.35 +           (box 1 1 1 :physical? false :color ColorRGBA/Blue)]
   11.36 +       (world
   11.37 +        (doto (Node.)
   11.38 +          (.attachChild candy))
   11.39 +        {}
   11.40 +        (fn [world]
   11.41 +          (let [cam (.clone (.getCamera world))
   11.42 +                width (.getWidth cam)
   11.43 +                height (.getHeight cam)]
   11.44 +            (add-camera! world cam 
   11.45 +                         (comp
   11.46 +                          (view-image
   11.47 +                           (if record?
   11.48 +                             (File. "/home/r/proj/cortex/render/vision/1")))
   11.49 +                          BufferedImage!))
   11.50 +            (add-camera! world
   11.51 +                         (doto (.clone cam)
   11.52 +                           (.setLocation (Vector3f. -10 0 0))
   11.53 +                           (.lookAt Vector3f/ZERO Vector3f/UNIT_Y))
   11.54 +                         (comp
   11.55 +                          (view-image
   11.56 +                           (if record?
   11.57 +                             (File. "/home/r/proj/cortex/render/vision/2")))
   11.58 +                          BufferedImage!))
   11.59 +            ;; This is here to restore the main view
   11.60           ;; after the other views have completed processing
   11.61 -         (add-camera! world (.getCamera world) no-op)))
   11.62 -     (fn [world tpf]
   11.63 -       (.rotate candy (* tpf 0.2) 0 0)))))
   11.64 +            (add-camera! world (.getCamera world) no-op)))
   11.65 +        (fn [world tpf]
   11.66 +          (.rotate candy (* tpf 0.2) 0 0))))))
   11.67  #+end_src
   11.68  
   11.69  #+begin_html
   11.70 @@ -541,60 +544,62 @@
   11.71    (comp #(change-color % color)
   11.72           (fire-cannon-ball)))
   11.73  
   11.74 -(defn test-worm-vision [record] 
   11.75 -  (let [the-worm (doto (worm)(body!))
   11.76 -        vision (vision! the-worm)
   11.77 -        vision-display (view-vision)
   11.78 -        fix-display (gen-fix-display)
   11.79 -        me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
   11.80 -        x-axis
   11.81 -        (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red
   11.82 -             :position (Vector3f. 0 -5 0))
   11.83 -        y-axis
   11.84 -        (box 0.01 1 0.01 :physical? false :color ColorRGBA/Green
   11.85 -             :position (Vector3f. 0 -5 0))
   11.86 -        z-axis
   11.87 -        (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue
   11.88 -             :position (Vector3f. 0 -5 0))
   11.89 -        timer (RatchetTimer. 60)]
   11.90 +(defn test-worm-vision 
   11.91 +  ([] (test-worm-vision false))
   11.92 +  ([record?] 
   11.93 +     (let [the-worm (doto (worm)(body!))
   11.94 +           vision (vision! the-worm)
   11.95 +           vision-display (view-vision)
   11.96 +           fix-display (gen-fix-display)
   11.97 +           me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
   11.98 +           x-axis
   11.99 +           (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red
  11.100 +                :position (Vector3f. 0 -5 0))
  11.101 +           y-axis
  11.102 +           (box 0.01 1 0.01 :physical? false :color ColorRGBA/Green
  11.103 +                :position (Vector3f. 0 -5 0))
  11.104 +           z-axis
  11.105 +           (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue
  11.106 +                :position (Vector3f. 0 -5 0))
  11.107 +           timer (RatchetTimer. 60)]
  11.108  
  11.109 -    (world (nodify [(floor) the-worm x-axis y-axis z-axis me])
  11.110 -           (assoc standard-debug-controls
  11.111 -             "key-r" (colored-cannon-ball ColorRGBA/Red)
  11.112 -             "key-b" (colored-cannon-ball ColorRGBA/Blue)
  11.113 -             "key-g" (colored-cannon-ball ColorRGBA/Green))
  11.114 -           (fn [world]
  11.115 -             (light-up-everything world)
  11.116 -             (speed-up world)
  11.117 -             (.setTimer world timer)
  11.118 -             (display-dialated-time world timer)
  11.119 -             ;; add a view from the worm's perspective
  11.120 -             (if record
  11.121 -               (Capture/captureVideo
  11.122 -                  world
  11.123 -                  (File.
  11.124 -                   "/home/r/proj/cortex/render/worm-vision/main-view")))
  11.125 -             
  11.126 -             (add-camera!
  11.127 -              world
  11.128 -              (add-eye! the-worm
  11.129 -                        (.getChild 
  11.130 -                         (.getChild the-worm "eyes") "eye"))
  11.131 -              (comp
  11.132 -               (view-image
  11.133 -                (if record
  11.134 -                  (File.
  11.135 -                   "/home/r/proj/cortex/render/worm-vision/worm-view")))
  11.136 -               BufferedImage!))
  11.137 -                 
  11.138 -             (set-gravity world Vector3f/ZERO))
  11.139 -               
  11.140 -           (fn [world _ ]
  11.141 -             (.setLocalTranslation me (.getLocation (.getCamera world)))
  11.142 -             (vision-display
  11.143 -              (map #(% world) vision)
  11.144 -              (if record (File. "/home/r/proj/cortex/render/worm-vision")))
  11.145 -             (fix-display world)))))
  11.146 +       (world (nodify [(floor) the-worm x-axis y-axis z-axis me])
  11.147 +              (assoc standard-debug-controls
  11.148 +                "key-r" (colored-cannon-ball ColorRGBA/Red)
  11.149 +                "key-b" (colored-cannon-ball ColorRGBA/Blue)
  11.150 +                "key-g" (colored-cannon-ball ColorRGBA/Green))
  11.151 +              (fn [world]
  11.152 +                (light-up-everything world)
  11.153 +                (speed-up world)
  11.154 +                (.setTimer world timer)
  11.155 +                (display-dialated-time world timer)
  11.156 +                ;; add a view from the worm's perspective
  11.157 +                (if record?
  11.158 +                  (Capture/captureVideo
  11.159 +                   world
  11.160 +                   (File.
  11.161 +                    "/home/r/proj/cortex/render/worm-vision/main-view")))
  11.162 +                
  11.163 +                (add-camera!
  11.164 +                 world
  11.165 +                 (add-eye! the-worm
  11.166 +                           (.getChild 
  11.167 +                            (.getChild the-worm "eyes") "eye"))
  11.168 +                 (comp
  11.169 +                  (view-image
  11.170 +                   (if record?
  11.171 +                     (File.
  11.172 +                      "/home/r/proj/cortex/render/worm-vision/worm-view")))
  11.173 +                  BufferedImage!))
  11.174 +                
  11.175 +                (set-gravity world Vector3f/ZERO))
  11.176 +              
  11.177 +              (fn [world _ ]
  11.178 +                (.setLocalTranslation me (.getLocation (.getCamera world)))
  11.179 +                (vision-display
  11.180 +                 (map #(% world) vision)
  11.181 +                 (if record? (File. "/home/r/proj/cortex/render/worm-vision")))
  11.182 +                (fix-display world))))))
  11.183  #+end_src
  11.184  
  11.185  The world consists of the worm and a flat gray floor. I can shoot red,