diff org/worm_learn.clj @ 445:47cfbe84f00e

complete images in first third of first chapter.
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Mar 2014 03:18:04 -0400
parents ea0bcd47d55b
children 09b7c8dd4365
line wrap: on
line diff
     1.1 --- a/org/worm_learn.clj	Tue Mar 25 02:08:30 2014 -0400
     1.2 +++ b/org/worm_learn.clj	Tue Mar 25 03:18:04 2014 -0400
     1.3 @@ -223,12 +223,12 @@
     1.4  (declare phi-space phi-scan)
     1.5  
     1.6  (defn debug-experience
     1.7 -  [experiences]
     1.8 +  [experiences text]
     1.9    (cond
    1.10 -   (grand-circle? experiences) (println "Grand Circle")
    1.11 -   (curled? experiences)       (println "Curled")
    1.12 -   (wiggling? experiences)     (println "Wiggling")
    1.13 -   (resting? experiences)      (println "Resting")))
    1.14 +   (grand-circle? experiences) (.setText text "Grand Circle")
    1.15 +   (curled? experiences)       (.setText text "Curled")
    1.16 +   (wiggling? experiences)     (.setText text "Wiggling")
    1.17 +   (resting? experiences)      (.setText text "Resting")))
    1.18  
    1.19  
    1.20  (def standard-world-view
    1.21 @@ -278,6 +278,16 @@
    1.22      (.addProcessor (.getViewPort world) pssm)))
    1.23          
    1.24  
    1.25 +(defn display-text [[x y :as location]]
    1.26 +  (let []
    1.27 +    (.setLocalTranslation text 300 (.getLineHeight text) 0)
    1.28 +   (fn [world]
    1.29 +     
    1.30 +  
    1.31 +  
    1.32 +  
    1.33 +  (fn [new-text]
    1.34 +
    1.35  (defn worm-world
    1.36    [& {:keys [record motor-control keybindings view experiences
    1.37               worm-model end-frame experience-watch] :as settings}]
    1.38 @@ -298,12 +308,21 @@
    1.39               :mass 0
    1.40               :texture "Textures/aurellem.png"
    1.41               :material "Common/MatDefs/Misc/Unshaded.j3md")
    1.42 -        timer (IsoTimer. 60)]
    1.43 +        timer (IsoTimer. 60)
    1.44 +
    1.45 +        font (.loadFont (asset-manager) "Interface/Fonts/Console.fnt")
    1.46 +        worm-action (doto (BitmapText. font false)
    1.47 +                      (.setSize 35)
    1.48 +                      (.setColor (ColorRGBA/Black)))]
    1.49  
    1.50      (world
    1.51       (nodify [worm floor])
    1.52         (merge standard-debug-controls keybindings)
    1.53         (fn [world]
    1.54 +         (.setLocalTranslation
    1.55 +          worm-action 20 470 0)
    1.56 +         (.attachChild (.getGuiNode world) worm-action)
    1.57 +         
    1.58           (enable-good-shadows world)
    1.59           (.setShadowMode worm RenderQueue$ShadowMode/CastAndReceive)
    1.60           (.setShadowMode floor RenderQueue$ShadowMode/Receive)
    1.61 @@ -315,6 +334,7 @@
    1.62           (.setTimer world timer)
    1.63           (display-dilated-time world timer)
    1.64           (when record
    1.65 +           (dir! record)
    1.66             (Capture/captureVideo
    1.67              world
    1.68              (dir! (File. record "main-view"))))
    1.69 @@ -333,7 +353,7 @@
    1.70                             :proprioception proprioception-data
    1.71                             :muscle muscle-data}))
    1.72             (when experience-watch
    1.73 -             (experience-watch @experiences))
    1.74 +             (experience-watch @experiences worm-action))
    1.75             (muscle-display
    1.76              muscle-data
    1.77              (when record (dir! (File. record "muscle"))))