# HG changeset patch # User Robert McIntyre # Date 1393907068 18000 # Node ID 72ee485d9179e7767554009ef83358e23a153dda # Parent 0898d93a39ef5bf42925439e17e3ee817347f1fc smaller worm segment. diff -r 0898d93a39ef -r 72ee485d9179 assets/Models/test-touch/touch-cube.blend.orig Binary file assets/Models/test-touch/touch-cube.blend.orig has changed diff -r 0898d93a39ef -r 72ee485d9179 assets/Models/worm-segment/touch-cube.blend Binary file assets/Models/worm-segment/touch-cube.blend has changed diff -r 0898d93a39ef -r 72ee485d9179 assets/Models/worm-segment/touch-cube.blend.orig Binary file assets/Models/worm-segment/touch-cube.blend.orig has changed diff -r 0898d93a39ef -r 72ee485d9179 assets/Models/worm-segment/worm-segment.blend Binary file assets/Models/worm-segment/worm-segment.blend has changed diff -r 0898d93a39ef -r 72ee485d9179 org/worm_learn.clj --- a/org/worm_learn.clj Mon Mar 03 23:04:02 2014 -0500 +++ b/org/worm_learn.clj Mon Mar 03 23:24:28 2014 -0500 @@ -6,12 +6,82 @@ (:import (com.jme3.math ColorRGBA Vector3f)) (:import java.io.File) (:import com.jme3.audio.AudioNode) - (:import com.aurellem.capture.RatchetTimer)) + (:import com.aurellem.capture.RatchetTimer) + (:import (com.aurellem.capture Capture IsoTimer)) + (:import (com.jme3.math Vector3f ColorRGBA))) + (dorun (cortex.import/mega-import-jme3)) (rlm.rlm-commands/help) +(defn worm-segment [] + (load-blender-model "Models/worm-segment/worm-segment.blend")) +(defn worm-segment [] + (load-blender-model "Models/test-touch/touch-cube.blend")) + +(defn gen-worm + "create a creature acceptable for testing as a replacement for the + worm." + [] + (nodify + "worm" + [(nodify + "eyes" + [(doto + (Node. "eye1") + (.setLocalTranslation (Vector3f. 0 -1.1 0)) + (.setUserData + + "eye" + "(let [retina + \"Models/test-creature/retina-small.png\"] + {:all retina :red retina + :green retina :blue retina})"))]) + (box + 0.2 0.2 0.2 + :name "worm-segment" + :position (Vector3f. 0 0 0) + :color ColorRGBA/Orange)])) + + +(defn test-basic-touch + "Testing touch: + You should see a cube fall onto a table. There is a cross-shaped + display which reports the cube's sensation of touch. This display + should change when the cube hits the table, and whenever you hit + the cube with balls. + + Keys: + : fire ball" + ([] (test-basic-touch false)) + ([record?] + (let [head (doto (worm-segment) (body!)) + touch (touch! head) + touch-display (view-touch)] + (world + (nodify [head + (box 10 1 10 :position (Vector3f. 0 -10 0) + :color ColorRGBA/Gray :mass 0)]) + + standard-debug-controls + + (fn [world] + (let [timer (IsoTimer. 60)] + (.setTimer world timer) + (display-dilated-time world timer)) + (if record? + (Capture/captureVideo + world + (File. "/home/r/proj/cortex/render/touch-cube/main-view/"))) + (speed-up world) + (light-up-everything world)) + + (fn [world tpf] + (touch-display + (map #(% (.getRootNode world)) touch) + (if record? + (File. "/home/r/proj/cortex/render/touch-cube/touch/"))))))))