# HG changeset patch # User Robert McIntyre # Date 1395957421 14400 # Node ID 763d13f77e037be224d5ed2ccf38b967051a7933 # Parent a86555b029165b06ef14628d8b9581f528d3c94b# Parent 26c13c42481f912ebc0732c4ebcab53cad469473 merge in laptop changes. diff -r 26c13c42481f -r 763d13f77e03 org/body.org --- a/org/body.org Thu Mar 27 17:56:25 2014 -0400 +++ b/org/body.org Thu Mar 27 17:57:01 2014 -0400 @@ -179,6 +179,9 @@ no-op))) #+end_src +#+results: test-2 +: #'cortex.test.body/test-hand-2 + #+begin_html
diff -r 26c13c42481f -r 763d13f77e03 org/depth-map.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/depth-map.org Thu Mar 27 17:57:01 2014 -0400 @@ -0,0 +1,67 @@ + +#+begin_src clojure +(ns cortex.depth-map + "lol depth maps." + {:author "Robert McIntyre"} + (:use (cortex world util body sense vision touch)) + (:import (com.jme3.scene Geometry Node Mesh)) + (:import com.jme3.collision.CollisionResults) + (:import com.jme3.scene.VertexBuffer$Type) + + (:import (com.jme3.math Triangle Vector3f Vector2f Ray Matrix4f))) + +(cortex.import/mega-import-jme3) + +(defn convert-pixel-to-ray + [camera ray x y] + (let [pixel-arrow + (.getWorldCoordinates + camera + (Vector2f. (float x) (float y)) + ;; this is the "z depth" and can be anything, since + ;; we only care about direction + (float 1)) + ;; now that we have the direction of a pixel, subtract + ray (Ray.)] + (set-ray ray Matrix4f/IDENTITY (.getLocation camera) + pixel-arrow) ray)) + +(defn generate-depth-map-points + "Generate a data structure representating the depth of the first + object to collide with a ray from the camera's current position." + [world camera] + (let [width (.getWidth camera) + height (.getHeight camera) + pixels (for [x (range width) y (range height)] + [x y]) + temp-ray (Ray.) + depths + (for [[x y] pixels] + (let [ray (convert-pixel-to-ray camera temp-ray x y) + results (CollisionResults.)] + (.collideWith world ray results) + (if-let [closest (.getClosestCollision results)] + (.hashCode (.getGeometry closest)) 0)))] + + (zipmap pixels depths))) + +(defn test-world [] + (nodify [(floor*) (brick-wall*)])) + +(import com.aurellem.capture.RatchetTimer) + +(defn depth-map-test [] + (let [the-world (test-world)] + (world + the-world + ;;controls + standard-debug-controls + ;;init + (fn [world] + (let [timer (RatchetTimer. 60)] + (.setTimer world timer) + (display-dilated-time world timer))) + ;; update + no-op))) + +#+end_src \ No newline at end of file diff -r 26c13c42481f -r 763d13f77e03 org/gabor.org --- a/org/gabor.org Thu Mar 27 17:56:25 2014 -0400 +++ b/org/gabor.org Thu Mar 27 17:57:01 2014 -0400 @@ -177,68 +177,6 @@ (println (.dump kernel))) -(def brick-length 0.48) -(def brick-width 0.24) -(def brick-height 0.12) -(def gravity (Vector3f. 0 -9.81 0)) - - -(defn brick* [position] - (println "get brick.") - (doto (box brick-length brick-height brick-width - :position position :name "brick" - :material "Common/MatDefs/Misc/Unshaded.j3md" - :texture "Textures/Terrain/BrickWall/BrickWall.jpg" - :mass 34) - (-> - (.getMesh) - (.scaleTextureCoordinates (Vector2f. 1 0.5))) - (.setShadowMode RenderQueue$ShadowMode/CastAndReceive) - ) - ) - - -(defn floor* - "make a sturdy, unmovable physical floor" - [] - (box 10 0.1 5 :name "floor" :mass 0 - :color ColorRGBA/Gray :position (Vector3f. 0 0 0))) - -(defn floor* [] - (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240 - :material "Common/MatDefs/Misc/Unshaded.j3md" - :texture "Textures/BronzeCopper030.jpg" - :position (Vector3f. 0 0 0 ) - :mass 0) - (-> - (.getMesh) - (.scaleTextureCoordinates (Vector2f. 3 6)));64 64 - (-> - (.getMaterial) - (.getTextureParam "ColorMap") - (.getTextureValue) - (.setWrap Texture$WrapMode/Repeat)) - (.setShadowMode RenderQueue$ShadowMode/Receive) - )) - - -(defn brick-wall* [] - (let [node (Node. "brick-wall")] - (dorun - (map - (comp #(.attachChild node %) brick*) - (for [y (range 10) - x (range 4) - z (range 1)] - (Vector3f. - (+ (* 2 x brick-length) - (if (even? (+ y z)) - (/ brick-length 4) (/ brick-length -4))) - (+ (* brick-height (inc (* 2 y)))) - (* 2 z brick-width) )))) - (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive) - node)) - (import com.aurellem.capture.Capture) (import java.io.File) diff -r 26c13c42481f -r 763d13f77e03 org/ideas.org --- a/org/ideas.org Thu Mar 27 17:56:25 2014 -0400 +++ b/org/ideas.org Thu Mar 27 17:57:01 2014 -0400 @@ -2,6 +2,11 @@ * Brainstorming different sensors and effectors. +** toys +Make toys in the world with "docking points," which would attach +together in physically stable ways. Could make analogs to legos, +tinker toys, and lincoln logs. + Every sense that we have should have an effector that changes what that sense (or others who have that sense) experiences. diff -r 26c13c42481f -r 763d13f77e03 org/integration.org --- a/org/integration.org Thu Mar 27 17:56:25 2014 -0400 +++ b/org/integration.org Thu Mar 27 17:57:01 2014 -0400 @@ -225,6 +225,18 @@ (import com.aurellem.capture.Capture) (defn test-integration + "Testing Everything! + + You will see an articulated hand fall onto the table. It has all + senses including: + - Vision, 4 channels + - Hearing + - Touch + - Proprioceptoin + - Muscle Tension + + Keys: + : fire ball" ([] (test-integration false)) ([record?] (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false) diff -r 26c13c42481f -r 763d13f77e03 org/touch.org --- a/org/touch.org Thu Mar 27 17:56:25 2014 -0400 +++ b/org/touch.org Thu Mar 27 17:57:01 2014 -0400 @@ -388,7 +388,6 @@ (.normalizeLocal (.getDirection ray))) (import com.jme3.math.FastMath) - (defn touch-kernel "Constructs a function which will return tactile sensory data from diff -r 26c13c42481f -r 763d13f77e03 org/util.org --- a/org/util.org Thu Mar 27 17:56:25 2014 -0400 +++ b/org/util.org Thu Mar 27 17:57:01 2014 -0400 @@ -59,6 +59,7 @@ "Import ALL the jme classes. For REPL use." [] (dorun + (import com.aurellem.capture.IsoTimer) (map (comp permissive-import symbol) (jme-class-names)))) #+end_src @@ -74,11 +75,11 @@ imports: #+begin_src clojure :exports both :results output -(println (clojure.core/count (cortex.import/jme-classes)) "classes") +(println (clojure.core/count (cortex.import/jme-class-names)) "classes") #+end_src #+results: -: 955 classes +: 938 classes * Utilities @@ -368,6 +369,73 @@ (into-array String ["blend"]))) model)) + +(def brick-length 0.48) +(def brick-width 0.24) +(def brick-height 0.12) +(def gravity (Vector3f. 0 -9.81 0)) + +(import com.jme3.math.Vector2f) +(import com.jme3.renderer.queue.RenderQueue$ShadowMode) +(import com.jme3.texture.Texture$WrapMode) + +(defn brick* [position] + (println "get brick.") + (doto (box brick-length brick-height brick-width + :position position :name "brick" + :material "Common/MatDefs/Misc/Unshaded.j3md" + :texture "Textures/Terrain/BrickWall/BrickWall.jpg" + :mass 34) + (-> + (.getMesh) + (.scaleTextureCoordinates (Vector2f. 1 0.5))) + (.setShadowMode RenderQueue$ShadowMode/CastAndReceive) + ) + ) + + +(defn floor* + "make a sturdy, unmovable physical floor" + [] + (box 10 0.1 5 :name "floor" :mass 0 + :color ColorRGBA/Gray :position (Vector3f. 0 0 0))) + +(defn floor* [] + (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240 + :material "Common/MatDefs/Misc/Unshaded.j3md" + :texture "Textures/BronzeCopper030.jpg" + :position (Vector3f. 0 0 0 ) + :mass 0) + (-> + (.getMesh) + (.scaleTextureCoordinates (Vector2f. 3 6)));64 64 + (-> + (.getMaterial) + (.getTextureParam "ColorMap") + (.getTextureValue) + (.setWrap Texture$WrapMode/Repeat)) + (.setShadowMode RenderQueue$ShadowMode/Receive) + )) + + +(defn brick-wall* [] + (let [node (Node. "brick-wall")] + (dorun + (map + (comp #(.attachChild node %) brick*) + (for [y (range 10) + x (range 4) + z (range 1)] + (Vector3f. + (+ (* 2 x brick-length) + (if (even? (+ y z)) + (/ brick-length 4) (/ brick-length -4))) + (+ (* brick-height (inc (* 2 y)))) + (* 2 z brick-width) )))) + (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive) + node)) + + #+end_src