Mercurial > cortex
comparison org/eyes.org @ 58:25142dad240a
created test suite
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 19 Nov 2011 23:42:21 -0700 |
parents | f080f1e49fba |
children | 1381a6ebd08b |
comparison
equal
deleted
inserted
replaced
57:37a3256e1ed3 | 58:25142dad240a |
---|---|
128 (defn test-two-eyes | 128 (defn test-two-eyes |
129 "Tests the vision system by creating two views of the same rotating | 129 "Tests the vision system by creating two views of the same rotating |
130 object from different angles and displaying both of those views in | 130 object from different angles and displaying both of those views in |
131 JFrames." | 131 JFrames." |
132 [] | 132 [] |
133 (.start | 133 (let [candy |
134 (let [candy | 134 (box 1 1 1 :physical? false :color ColorRGBA/Blue)] |
135 (box 1 1 1 :physical? false :color ColorRGBA/Blue)] | 135 (world (doto (Node.) |
136 (world (doto (Node.) | 136 (.attachChild candy)) |
137 (.attachChild candy)) | 137 {} |
138 {} | 138 (fn [world] |
139 (fn [world] | 139 (let [cam (.clone (.getCamera world)) |
140 (let [cam (.clone (.getCamera world)) | 140 width (.getWidth cam) |
141 width (.getWidth cam) | 141 height (.getHeight cam)] |
142 height (.getHeight cam)] | 142 (add-eye world cam (view-image width height)) |
143 (add-eye world cam (view-image width height)) | 143 (add-eye world |
144 (add-eye world | 144 (doto (.clone cam) |
145 (doto (.clone cam) | 145 (.setLocation (Vector3f. -10 0 0)) |
146 (.setLocation (Vector3f. -10 0 0)) | 146 (.lookAt Vector3f/ZERO Vector3f/UNIT_Y)) |
147 (.lookAt Vector3f/ZERO Vector3f/UNIT_Y)) | 147 (view-image width height)) |
148 (view-image width height)) | |
149 ;; This is here to restore the main view | 148 ;; This is here to restore the main view |
150 ;; after the other views have completed processing | 149 ;; after the other views have completed processing |
151 (add-eye world (.getCamera world) no-op))) | 150 (add-eye world (.getCamera world) no-op))) |
152 (fn [world tpf] | 151 (fn [world tpf] |
153 (.rotate candy (* tpf 0.2) 0 0)))))) | 152 (.rotate candy (* tpf 0.2) 0 0))))) |
154 #+end_src | 153 #+end_src |
155 | 154 |
156 The example code will create two videos of the same rotating object | 155 The example code will create two videos of the same rotating object |
157 from different angles. It can be used both for stereoscopic vision | 156 from different angles. It can be used both for stereoscopic vision |
158 simulation or for simulating multiple creatures, each with their own | 157 simulation or for simulating multiple creatures, each with their own |