# HG changeset patch # User Robert McIntyre # Date 1328624025 25200 # Node ID 1c915cc1118b863a00fd281ac616ee89d0ee8c42 # Parent 7eb966144dadd12f0096ac936ac761280c8f9363 minor edits for sense.org diff -r 7eb966144dad -r 1c915cc1118b org/sense.org --- a/org/sense.org Mon Feb 06 08:26:20 2012 -0700 +++ b/org/sense.org Tue Feb 07 07:13:45 2012 -0700 @@ -75,11 +75,11 @@ Blender and jMonkeyEngine already have support for exactly this sort of data structure because it is used to "skin" models for games. It is -called [[http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV][UV-mapping]]. The three-dimensional surface is cut and smooshed -until it fits on a two-dimensional image. You paint whatever you want -on that image, and when the three-dimensional shape is rendered in a -game that image the smooshing and cutting us reversed and the image -appears on the three-dimensional object. +called [[http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV][UV-mapping]]. The three-dimensional surface of a model is cut +and smooshed until it fits on a two-dimensional image. You paint +whatever you want on that image, and when the three-dimensional shape +is rendered in a game the smooshing and cutting us reversed and the +image appears on the three-dimensional object. To make a sense, interpret the UV-image as describing the distribution of that senses sensors. To get different types of sensors, you can @@ -111,7 +111,7 @@ pixels so that they can be used to create senses. =(load-image)= finds images using jMonkeyEngine's asset-manager, so the image path is expected to be relative to the =assets= directory. Thanks to Dylan -for the beautiful version of filter-pixels. +for the beautiful version of =(filter-pixels)=. #+name: topology-1 #+begin_src clojure @@ -352,7 +352,8 @@ (do (println-repl "could not find" parent-name "node") [])))) (defn closest-node - "Return the node in creature which is closest to the given node." + "Return the physical node in creature which is closest to the given + node." [#^Node creature #^Node empty] (loop [radius (float 0.01)] (let [results (CollisionResults.)] @@ -425,24 +426,23 @@ (com.aurellem.capture RatchetTimer Capture))) (defn test-bind-sense - "Show a camera that stays in the same relative position to a blue cube." + "Show a camera that stays in the same relative position to a blue + cube." [] - (let [camera-pos (Vector3f. 0 30 0) + (let [eye-pos (Vector3f. 0 30 0) rock (box 1 1 1 :color ColorRGBA/Blue :position (Vector3f. 0 10 0) :mass 30) - rot (.getWorldRotation rock) table (box 3 1 10 :color ColorRGBA/Gray :mass 0 :position (Vector3f. 0 -3 0))] (world (nodify [rock table]) standard-debug-controls - (fn [world] - (let - [cam (doto (.clone (.getCamera world)) - (.setLocation camera-pos) - (.lookAt Vector3f/ZERO - Vector3f/UNIT_X))] + (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)) (Capture/captureVideo