# HG changeset patch # User Robert McIntyre # Date 1327164959 25200 # Node ID 05e60a0ed0437e2f6b972a92d4df1fe58fee9458 # Parent 83e638955e89d3a4ca92e69129ad8bfcd23f7770 preliminary eyes are fully implemented diff -r 83e638955e89 -r 05e60a0ed043 assets/Models/creature1/try-again.blend Binary file assets/Models/creature1/try-again.blend has changed diff -r 83e638955e89 -r 05e60a0ed043 org/test-creature.org --- a/org/test-creature.org Sat Jan 21 09:30:47 2012 -0700 +++ b/org/test-creature.org Sat Jan 21 09:55:59 2012 -0700 @@ -757,7 +757,7 @@ (def presets - {:all 0x000000 + {:all 0xFFFFFF :red 0xFF0000 :blue 0x0000FF :green 0x00FF00}) @@ -795,21 +795,17 @@ ])) (defn vision + [#^Node creature & {skip :skip :or {skip 0}}] - ;; need to create a camera based on UV image, - ;; update this camera every frame based on the position of this - ;; geometry. (maybe can get cam to follow the object) - - ;; use a stack for the continuation to grab the image. - - - [#^Geometry eye] - - - - -) - + (reduce + (fn [[init-a senses-a] + [init-b senses-b]] + [(conj init-a init-b) + (into senses-a senses-b)]) + [[][]] + (for [eye (creature-eyes creature)] + (enable-vision creature eye)))) + (defn blender-creature "Return a creature with all joints in place." @@ -821,11 +817,6 @@ (do (println-repl "could not find joints node") []))] (assemble-creature model joints))) - - - - - (defn debug-window "creates function that offers a debug view of sensor data" [] @@ -853,8 +844,6 @@ (sensor-data i)))) (vi image))))) - - ;;(defn test-touch [world creature] @@ -868,9 +857,8 @@ creature (blender-creature thing) touch-nerves (touch creature) touch-debug-windows (map (fn [_] (debug-window)) touch-nerves) - [init-vision [vision-data]] - (enable-vision creature (test-eye)) - vision-debug (debug-vision-window) + [init-vision-fns vision-data] (vision creature) + vision-debug (map (fn [_] (debug-vision-window)) vision-data) me (sphere 0.5 :color ColorRGBA/Blue :physical? false) ] (world @@ -884,7 +872,7 @@ (fn [world] (light-up-everything world) (enable-debug world) - (init-vision world) + (map #(% world) init-vision-fns) (add-eye world (attach-eye creature (test-eye)) @@ -904,12 +892,15 @@ (dorun (map #(%1 (%2 (.getRootNode world))) - touch-debug-windows touch-nerves) - ) + touch-debug-windows touch-nerves)) + (dorun + (map #(%1 (%2)) + vision-debug vision-data)) + ;;(println-repl (vision-data)) (.setLocalTranslation me (.getLocation (.getCamera world))) - (vision-debug (vision-data)) + ) ;;(let [timer (atom 0)] ;; (fn [_ _]