comparison org/body.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
78 0.14046453, 0.85894054, -0.34301838, 0.3533118))) 78 0.14046453, 0.85894054, -0.34301838, 0.3533118)))
79 (light-up-everything world) 79 (light-up-everything world)
80 (.setTimer world (RatchetTimer. 60)) 80 (.setTimer world (RatchetTimer. 60))
81 world) 81 world)
82 82
83 (defn test-one [] 83 (defn test-hand-1
84 (world (hand) 84 ([] (test-hand-1 false))
85 standard-debug-controls 85 ([record?]
86 (comp 86 (world (hand)
87 #(Capture/captureVideo 87 standard-debug-controls
88 % (File. "/home/r/proj/cortex/render/body/1")) 88 (fn [world]
89 setup) 89 (if record?
90 no-op)) 90 (Capture/captureVideo
91 world
92 (File. "/home/r/proj/cortex/render/body/1")))
93 (setup world)) no-op)))
91 #+end_src 94 #+end_src
92 95
93 96
94 #+begin_src clojure :results silent 97 #+begin_src clojure :results silent
95 (.start (cortex.test.body/test-one)) 98 (.start (cortex.test.body/test-one))
156 159
157 (defn floor [] 160 (defn floor []
158 (box 10 3 10 :position (Vector3f. 0 -10 0) 161 (box 10 3 10 :position (Vector3f. 0 -10 0)
159 :color ColorRGBA/Gray :mass 0)) 162 :color ColorRGBA/Gray :mass 0))
160 163
161 (defn test-two [] 164 (defn test-hand-2
162 (world (nodify 165 ([] (test-hand-2 false))
163 [(doto (hand) 166 ([record?]
164 (physical!)) 167 (world
165 (floor)]) 168 (nodify
166 (merge standard-debug-controls gravity-control) 169 [(doto (hand)
167 (comp 170 (physical!))
168 #(Capture/captureVideo 171 (floor)])
169 % (File. "/home/r/proj/cortex/render/body/2")) 172 (merge standard-debug-controls gravity-control)
170 #(do (set-gravity % Vector3f/ZERO) %) 173 (fn [world]
171 setup) 174 (if record?
172 no-op)) 175 (Capture/captureVideo
176 world (File. "/home/r/proj/cortex/render/body/2")))
177 (set-gravity world Vector3f/ZERO)
178 (setup world))
179 no-op)))
173 #+end_src 180 #+end_src
174 181
175 #+begin_html 182 #+begin_html
176 <div class="figure"> 183 <div class="figure">
177 <center> 184 <center>
426 433
427 (def debug-control 434 (def debug-control
428 {"key-h" (fn [world val] 435 {"key-h" (fn [world val]
429 (if val (enable-debug world)))}) 436 (if val (enable-debug world)))})
430 437
431 (defn test-three [] 438 (defn test-hand-3
432 (world (nodify 439 ([] (test-hand-3 false))
433 [(doto (hand) 440 ([record?]
434 (physical!) 441 (world
435 (joints!)) 442 (nodify
436 (floor)]) 443 [(doto (hand)
437 (merge standard-debug-controls debug-control 444 (physical!)
438 gravity-control) 445 (joints!))
439 (comp 446 (floor)])
440 #(Capture/captureVideo 447 (merge standard-debug-controls debug-control
441 % (File. "/home/r/proj/cortex/render/body/3")) 448 gravity-control)
442 #(do (set-gravity % Vector3f/ZERO) %) 449 (comp
443 setup) 450 #(Capture/captureVideo
444 no-op)) 451 % (File. "/home/r/proj/cortex/render/body/3"))
452 #(do (set-gravity % Vector3f/ZERO) %)
453 setup)
454 no-op)))
445 #+end_src 455 #+end_src
446 456
447 =physical!= makes the hand solid, then =joints!= connects each 457 =physical!= makes the hand solid, then =joints!= connects each
448 piece together. 458 piece together.
449 459
492 502
493 (defn worm [] 503 (defn worm []
494 (load-blender-model 504 (load-blender-model
495 "Models/test-creature/worm.blend")) 505 "Models/test-creature/worm.blend"))
496 506
497 (defn worm-1 [] 507 (defn test-worm
498 (let [timer (RatchetTimer. 60)] 508 ([] (test-worm false))
499 (world 509 ([record?]
500 (nodify 510 (let [timer (RatchetTimer. 60)]
501 [(doto (worm) 511 (world
502 (body!)) 512 (nodify
503 (floor)]) 513 [(doto (worm)
504 (merge standard-debug-controls debug-control) 514 (body!))
505 #(do 515 (floor)])
506 (speed-up %) 516 (merge standard-debug-controls debug-control)
507 (light-up-everything %) 517 #(do
508 (.setTimer % timer) 518 (speed-up %)
509 (cortex.util/display-dialated-time % timer) 519 (light-up-everything %)
510 (Capture/captureVideo 520 (.setTimer % timer)
511 % (File. "/home/r/proj/cortex/render/body/4"))) 521 (cortex.util/display-dialated-time % timer)
512 no-op))) 522 (if record?
523 (Capture/captureVideo
524 % (File. "/home/r/proj/cortex/render/body/4"))))
525 no-op))))
513 #+end_src 526 #+end_src
514 527
515 #+begin_html 528 #+begin_html
516 <div class="figure"> 529 <div class="figure">
517 <center> 530 <center>