Mercurial > cortex
diff org/vision.org @ 335:5dcd44576cbc
add BufferedImage to Viewable Protocol
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 20 Jul 2012 13:02:58 -0500 |
parents | 702b5c78c2de |
children | fdc98824d69b |
line wrap: on
line diff
1.1 --- a/org/vision.org Fri Jul 20 11:22:21 2012 -0500 1.2 +++ b/org/vision.org Fri Jul 20 13:02:58 2012 -0500 1.3 @@ -576,45 +576,51 @@ 1.4 :position (Vector3f. 0 -5 0)) 1.5 timer (RatchetTimer. 60)] 1.6 1.7 - (world (nodify [(floor) the-worm x-axis y-axis z-axis me]) 1.8 - (assoc standard-debug-controls 1.9 - "key-r" (colored-cannon-ball ColorRGBA/Red) 1.10 - "key-b" (colored-cannon-ball ColorRGBA/Blue) 1.11 - "key-g" (colored-cannon-ball ColorRGBA/Green)) 1.12 - (fn [world] 1.13 - (light-up-everything world) 1.14 - (speed-up world) 1.15 - (.setTimer world timer) 1.16 - (display-dilated-time world timer) 1.17 - ;; add a view from the worm's perspective 1.18 - (if record? 1.19 - (Capture/captureVideo 1.20 - world 1.21 - (File. 1.22 - "/home/r/proj/cortex/render/worm-vision/main-view"))) 1.23 - 1.24 - (add-camera! 1.25 - world 1.26 - (add-eye! the-worm 1.27 - (.getChild 1.28 - (.getChild the-worm "eyes") "eye")) 1.29 - (comp 1.30 - (view-image 1.31 - (if record? 1.32 - (File. 1.33 - "/home/r/proj/cortex/render/worm-vision/worm-view"))) 1.34 - BufferedImage!)) 1.35 - 1.36 - (set-gravity world Vector3f/ZERO)) 1.37 - 1.38 - (fn [world _ ] 1.39 - (.setLocalTranslation me (.getLocation (.getCamera world))) 1.40 - (vision-display 1.41 - (map #(% world) vision) 1.42 - (if record? (File. "/home/r/proj/cortex/render/worm-vision"))) 1.43 - (fix-display world)))))) 1.44 + (world 1.45 + (nodify [(floor) the-worm x-axis y-axis z-axis me]) 1.46 + (assoc standard-debug-controls 1.47 + "key-r" (colored-cannon-ball ColorRGBA/Red) 1.48 + "key-b" (colored-cannon-ball ColorRGBA/Blue) 1.49 + "key-g" (colored-cannon-ball ColorRGBA/Green)) 1.50 + (fn [world] 1.51 + (light-up-everything world) 1.52 + (speed-up world) 1.53 + (.setTimer world timer) 1.54 + (display-dilated-time world timer) 1.55 + ;; add a view from the worm's perspective 1.56 + (if record? 1.57 + (Capture/captureVideo 1.58 + world 1.59 + (File. 1.60 + "/home/r/proj/cortex/render/worm-vision/main-view"))) 1.61 + 1.62 + (add-camera! 1.63 + world 1.64 + (add-eye! the-worm 1.65 + (.getChild 1.66 + (.getChild the-worm "eyes") "eye")) 1.67 + (comp 1.68 + (view-image 1.69 + (if record? 1.70 + (File. 1.71 + "/home/r/proj/cortex/render/worm-vision/worm-view"))) 1.72 + BufferedImage!)) 1.73 + (set-gravity world Vector3f/ZERO)) 1.74 + 1.75 + (fn [world _ ] 1.76 + (.setLocalTranslation me (.getLocation (.getCamera world))) 1.77 + (vision-display 1.78 + (map #(% world) vision) 1.79 + (if record? 1.80 + (File. "/home/r/proj/cortex/render/worm-vision"))) 1.81 + (fix-display world) 1.82 + ))))) 1.83 #+end_src 1.84 1.85 +#+RESULTS: test-2 1.86 +| | #'cortex.test.vision/test-worm-vision | 1.87 + 1.88 + 1.89 The world consists of the worm and a flat gray floor. I can shoot red, 1.90 green, blue and white cannonballs at the worm. The worm is initially 1.91 looking down at the floor, and there is no gravity. My perspective