Mercurial > cortex
diff org/vision.org @ 340:4f5a5d5f1613
added time dialation display for test suite.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Jul 2012 11:18:47 -0500 |
parents | d37ccb6c888f |
children | 2e7d786241d3 |
line wrap: on
line diff
1.1 --- a/org/vision.org Sat Jul 21 10:03:02 2012 -0500 1.2 +++ b/org/vision.org Sat Jul 21 11:18:47 2012 -0500 1.3 @@ -492,13 +492,19 @@ 1.4 (if record? 1.5 (File. "/home/r/proj/cortex/render/vision/2"))) 1.6 BufferedImage!)) 1.7 + (let [timer (RatchetTimer. 60)] 1.8 + (.setTimer world timer) 1.9 + (display-dilated-time world timer)) 1.10 ;; This is here to restore the main view 1.11 - ;; after the other views have completed processing 1.12 + ;; after the other views have completed processing 1.13 (add-camera! world (.getCamera world) no-op))) 1.14 (fn [world tpf] 1.15 (.rotate candy (* tpf 0.2) 0 0)))))) 1.16 #+end_src 1.17 1.18 +#+results: test-1 1.19 +: #'cortex.test.vision/test-pipeline 1.20 + 1.21 #+begin_html 1.22 <div class="figure"> 1.23 <video controls="controls" width="755"> 1.24 @@ -599,10 +605,9 @@ 1.25 ([] (test-worm-vision false)) 1.26 ([record?] 1.27 (let [the-worm (doto (worm)(body!)) 1.28 - ;;the-worm (gen-worm) 1.29 - ;;vision (vision! the-worm) 1.30 - ;;vision-display (view-vision) 1.31 - ;;fix-display (gen-fix-display) 1.32 + vision (vision! the-worm) 1.33 + vision-display (view-vision) 1.34 + fix-display (gen-fix-display) 1.35 me (sphere 0.5 :color ColorRGBA/Blue :physical? false) 1.36 x-axis 1.37 (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red 1.38 @@ -613,92 +618,49 @@ 1.39 z-axis 1.40 (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue 1.41 :position (Vector3f. 0 -5 0)) 1.42 - timer (RatchetTimer. 60) 1.43 + 1.44 ] 1.45 1.46 (world 1.47 (nodify [(floor) the-worm x-axis y-axis z-axis me]) 1.48 - standard-debug-controls 1.49 - ;;"key-r" (colored-cannon-ball ColorRGBA/Red) 1.50 - ;;"key-b" (colored-cannon-ball ColorRGBA/Blue) 1.51 - ;;"key-g" (colored-cannon-ball ColorRGBA/Green)) 1.52 + (merge standard-debug-controls 1.53 + {"key-r" (colored-cannon-ball ColorRGBA/Red) 1.54 + "key-b" (colored-cannon-ball ColorRGBA/Blue) 1.55 + "key-g" (colored-cannon-ball ColorRGBA/Green)}) 1.56 1.57 (fn [world] 1.58 - (let 1.59 - [eye-pos (Vector3f. 0 30 0) 1.60 - cam (doto 1.61 - (.clone (.getCamera world)) 1.62 - (.setLocation eye-pos) 1.63 - (.lookAt Vector3f/ZERO 1.64 - Vector3f/UNIT_X)) 1.65 - 1.66 - bad-cam (doto 1.67 - ;;saved-cam 1.68 - ;;(.clone (.getCamera world)) 1.69 - 1.70 - (com.jme3.renderer.Camera. 640 480) 1.71 - (.setFrustumPerspective 1.72 - (float 45) 1.73 - (float (/ 640 480)) 1.74 - (float 1) 1.75 - (float 1000)) 1.76 - 1.77 - (.setLocation eye-pos) 1.78 - (.lookAt Vector3f/ZERO 1.79 - Vector3f/UNIT_X)) 1.80 - 1.81 - bad-cam (add-eye! the-worm (first (eyes the-worm))) 1.82 - ] 1.83 - 1.84 - 1.85 - (light-up-everything world) 1.86 - ;;(speed-up world) 1.87 - (.setTimer world timer) 1.88 - ;;(display-dilated-time world timer) 1.89 - ;; add a view from the worm's perspective 1.90 + (light-up-everything world) 1.91 + (speed-up world) 1.92 + (let [timer (RatchetTimer. 60)] 1.93 + (.setTimer world timer) 1.94 + (display-dilated-time world timer)) 1.95 + ;; add a view from the worm's perspective 1.96 + (if record? 1.97 + (Capture/captureVideo 1.98 + world 1.99 + (File. 1.100 + "/home/r/proj/cortex/render/worm-vision/main-view"))) 1.101 + 1.102 + (add-camera! 1.103 + world 1.104 + (add-eye! the-worm (first (eyes the-worm))) 1.105 + (comp 1.106 + (view-image 1.107 + (if record? 1.108 + (File. 1.109 + "/home/r/proj/cortex/render/worm-vision/worm-view"))) 1.110 + BufferedImage!)) 1.111 + 1.112 + (set-gravity world Vector3f/ZERO) 1.113 + (add-camera! world (.getCamera world) no-op)) 1.114 + 1.115 + (fn [world _] 1.116 + (.setLocalTranslation me (.getLocation (.getCamera world))) 1.117 + (vision-display 1.118 + (map #(% world) vision) 1.119 (if record? 1.120 - (Capture/captureVideo 1.121 - world 1.122 - (File. 1.123 - "/home/r/proj/cortex/render/worm-vision/main-view"))) 1.124 - 1.125 - (bind-sense (last (node-seq the-worm)) cam) 1.126 - (bind-sense (last (node-seq the-worm)) bad-cam) 1.127 - 1.128 - (add-camera! 1.129 - world 1.130 - bad-cam 1.131 - (comp 1.132 - (view-image 1.133 - (if record? 1.134 - (File. 1.135 - "/home/r/proj/cortex/render/worm-vision/worm-view"))) 1.136 - BufferedImage!)) 1.137 - 1.138 - 1.139 - 1.140 - (add-camera! 1.141 - world cam 1.142 - (comp 1.143 - (view-image 1.144 - (if record? 1.145 - (File. 1.146 - "/home/r/proj/cortex/render/worm-vision/worm-view"))) 1.147 - BufferedImage!)) 1.148 - (set-gravity world Vector3f/ZERO) 1.149 - (add-camera! world (.getCamera world) no-op) 1.150 - 1.151 - (println-repl cam "\n" bad-cam) 1.152 - 1.153 - )) 1.154 - 1.155 - (fn [world _ ] 1.156 - (.setLocalTranslation me (.getLocation (.getCamera world))) 1.157 - ;; (vision-display 1.158 - ;; (map #(% world) vision) 1.159 - ;; (if record? 1.160 - ;; (File. "/home/r/proj/cortex/render/worm-vision"))) 1.161 - ;;(fix-display world) 1.162 + (File. "/home/r/proj/cortex/render/worm-vision"))) 1.163 + (fix-display world) 1.164 ))))) 1.165 #+end_src 1.166