# HG changeset patch # User Robert McIntyre # Date 1327159828 25200 # Node ID ebfd62779ab41df954d5e637538418724e3137af # Parent 1261444da2c73ed9548e37bec691a23cfd9fbe99 color selection enabled diff -r 1261444da2c7 -r ebfd62779ab4 assets/Models/creature1/try-again.blend Binary file assets/Models/creature1/try-again.blend has changed diff -r 1261444da2c7 -r ebfd62779ab4 org/test-creature.org --- a/org/test-creature.org Sat Jan 21 01:08:35 2012 -0700 +++ b/org/test-creature.org Sat Jan 21 08:30:28 2012 -0700 @@ -83,11 +83,11 @@ width (- (apply max xs) x0) height (- (apply max ys) y0) image (BufferedImage. (inc width) (inc height) - BufferedImage/TYPE_4BYTE_ABGR)] + BufferedImage/TYPE_INT_RGB)] (dorun (for [x (range (.getWidth image)) y (range (.getHeight image))] - (.setRGB image x y 0xFFFF0000))) + (.setRGB image x y 0xFF0000))) (dorun (for [index (range (count points))] (.setRGB image (- (xs index) x0) (- (ys index) y0) -1))) @@ -749,12 +749,21 @@ cam (Camera. cam-width cam-height)] (.setLocation cam (.getWorldTranslation eye)) (.setRotation cam (.getWorldRotation eye)) + (.setFrustumPerspective + cam 45 (/ (.getWidth cam) (.getHeight cam)) + 1 1000) + (bind-camera target cam) cam)) (def presets - {:gray identity}) + {:all 0x000000 + :red 0xFF0000 + :blue 0x0000FF + :green 0x00FF00}) + + (defn enable-vision "return [init-function sensor-functions] for a particular eye" @@ -770,15 +779,20 @@ (fn [r fb bb bi] (if (zero? (rem (swap! counter inc) (inc skip))) (reset! vision-image (BufferedImage! r fb bb bi))))))) - (vector - (let [whites (white-coordinates (:gray retinal-map)) - topology (vec (collapse whites))] - (fn [] - (vector - topology - (vec - (for [[x y] whites] - (.getRGB @vision-image x y))))))) + (vec + (map + (fn [[key image]] + (let [whites (white-coordinates image) + topology (vec (collapse whites)) + mask (presets key)] + (fn [] + (vector + topology + (vec + (for [[x y] whites] + (bit-xor + mask (.getRGB @vision-image x y)))))))) + retinal-map)) ])) (defn vision @@ -882,7 +896,7 @@ ;;(com.aurellem.capture.Capture/captureVideo ;; world (file-str "/home/r/proj/ai-videos/hand")) ;;(.setTimer world (RatchetTimer. 60)) - ;;(speed-up world) + (speed-up world) ;;(set-gravity world (Vector3f. 0 0 0)) ) (fn [world tpf]