comparison org/sense.org @ 283:23aadf376e9d

upgraded to latest jMonkeyEngine, streamlined tests
author Robert McIntyre <rlm@mit.edu>
date Wed, 15 Feb 2012 16:56:01 -0700
parents c39b8b29a79e
children 7e7f8d6d9ec5
comparison
equal deleted inserted replaced
282:2ad29b68ff22 283:23aadf376e9d
446 #+name: test 446 #+name: test
447 #+begin_src clojure 447 #+begin_src clojure
448 (defn test-bind-sense 448 (defn test-bind-sense
449 "Show a camera that stays in the same relative position to a blue 449 "Show a camera that stays in the same relative position to a blue
450 cube." 450 cube."
451 [] 451 ([] (test-bind-sense false))
452 (let [eye-pos (Vector3f. 0 30 0) 452 ([record?]
453 rock (box 1 1 1 :color ColorRGBA/Blue 453 (let [eye-pos (Vector3f. 0 30 0)
454 :position (Vector3f. 0 10 0) 454 rock (box 1 1 1 :color ColorRGBA/Blue
455 :mass 30) 455 :position (Vector3f. 0 10 0)
456 table (box 3 1 10 :color ColorRGBA/Gray :mass 0 456 :mass 30)
457 :position (Vector3f. 0 -3 0))] 457 table (box 3 1 10 :color ColorRGBA/Gray :mass 0
458 (world 458 :position (Vector3f. 0 -3 0))]
459 (nodify [rock table]) 459 (world
460 standard-debug-controls 460 (nodify [rock table])
461 (fn init [world] 461 standard-debug-controls
462 (let [cam (doto (.clone (.getCamera world)) 462 (fn init [world]
463 (.setLocation eye-pos) 463 (let [cam (doto (.clone (.getCamera world))
464 (.lookAt Vector3f/ZERO 464 (.setLocation eye-pos)
465 Vector3f/UNIT_X))] 465 (.lookAt Vector3f/ZERO
466 (bind-sense rock cam) 466 Vector3f/UNIT_X))]
467 (.setTimer world (RatchetTimer. 60)) 467 (bind-sense rock cam)
468 (Capture/captureVideo 468 (.setTimer world (RatchetTimer. 60))
469 world (File. "/home/r/proj/cortex/render/bind-sense0")) 469 (if record?
470 (add-camera! 470 (Capture/captureVideo
471 world cam 471 world (File. "/home/r/proj/cortex/render/bind-sense0")))
472 (comp (view-image 472 (add-camera!
473 (File. "/home/r/proj/cortex/render/bind-sense1")) 473 world cam
474 BufferedImage!)) 474 (comp (view-image
475 (add-camera! world (.getCamera world) no-op))) 475 (if record?
476 no-op))) 476 (File. "/home/r/proj/cortex/render/bind-sense1")))
477 BufferedImage!))
478 (add-camera! world (.getCamera world) no-op)))
479 no-op))))
477 #+end_src 480 #+end_src
478 481
479 #+begin_html 482 #+begin_html
480 <video controls="controls" width="755"> 483 <video controls="controls" width="755">
481 <source src="../video/bind-sense.ogg" type="video/ogg" 484 <source src="../video/bind-sense.ogg" type="video/ogg"