(ns cortex.test.sense (:use (cortex world util sense vision)) (:import java.io.File (com.jme3.math Vector3f ColorRGBA) (com.aurellem.capture RatchetTimer Capture))) (in-ns 'cortex.test.sense) (defn test-bind-sense "Show a camera that stays in the same relative position to a blue cube." ([] (test-bind-sense false)) ([record?] (let [eye-pos (Vector3f. 0 30 0) rock (box 1 1 1 :color ColorRGBA/Blue :position (Vector3f. 0 10 0) :mass 30) table (box 3 1 10 :color ColorRGBA/Gray :mass 0 :position (Vector3f. 0 -3 0))] (world (nodify [rock table]) standard-debug-controls (fn init [world] (let [cam (doto (.clone (.getCamera world)) (.setLocation eye-pos) (.lookAt Vector3f/ZERO Vector3f/UNIT_X))] (bind-sense rock cam) (.setTimer world (RatchetTimer. 60)) (if record? (Capture/captureVideo world (File. "/home/r/proj/cortex/render/bind-sense0"))) (add-camera! world cam (comp (view-image (if record? (File. "/home/r/proj/cortex/render/bind-sense1"))) BufferedImage!)) (add-camera! world (.getCamera world) no-op))) no-op))))