Mercurial > cortex
comparison org/sense.org @ 187:6142e85f5825
extracted common elements of display code
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 04 Feb 2012 09:42:19 -0700 |
parents | 21816b27d7c8 |
children | 22548d48cc85 |
comparison
equal
deleted
inserted
replaced
186:21816b27d7c8 | 187:6142e85f5825 |
---|---|
212 "Convert from Blender coordinates to JME coordinates" | 212 "Convert from Blender coordinates to JME coordinates" |
213 [#^Vector3f in] | 213 [#^Vector3f in] |
214 (Vector3f. (.getX in) | 214 (Vector3f. (.getX in) |
215 (.getZ in) | 215 (.getZ in) |
216 (- (.getY in)))) | 216 (- (.getY in)))) |
217 | |
218 | |
219 (defn view-sense | |
220 "Take a function that produces a BufferedImage from some sense data | |
221 and return a function which takes a list of sense and displays | |
222 those images in multiple JFrames." | |
223 [sense-display-kernel] | |
224 (let | |
225 [windows (atom [])] | |
226 (fn [data] | |
227 (if (> (count data) (count @windows)) | |
228 (reset! windows (map (fn [_] (view-image)) | |
229 (range (count data))))) | |
230 (dorun | |
231 (map | |
232 (fn [display gen data] | |
233 (display (gen data))) | |
234 @windows sense-display-kernel data))))) | |
235 | |
236 | |
237 | |
217 #+end_src | 238 #+end_src |
218 | 239 |
219 | 240 |
220 * COMMENT generate source | 241 * COMMENT generate source |
221 #+begin_src clojure :tangle ../src/cortex/sense.clj | 242 #+begin_src clojure :tangle ../src/cortex/sense.clj |