# HG changeset patch # User Robert McIntyre # Date 1328541980 25200 # Node ID 7eb966144dadd12f0096ac936ac761280c8f9363 # Parent 305439cec54d721d647cd4d061dcf682aed0e48b finished video for sense.org, now with subtitles! diff -r 305439cec54d -r 7eb966144dad .hgignore --- a/.hgignore Mon Feb 06 01:40:22 2012 -0700 +++ b/.hgignore Mon Feb 06 08:26:20 2012 -0700 @@ -6,6 +6,7 @@ capture-video.html render* sources* +*.hdr syntax: regexp ^.*blend\d$ \ No newline at end of file diff -r 305439cec54d -r 7eb966144dad assets/Models/subtitles/subtitles.blend Binary file assets/Models/subtitles/subtitles.blend has changed diff -r 305439cec54d -r 7eb966144dad org/sense.org --- a/org/sense.org Mon Feb 06 01:40:22 2012 -0700 +++ b/org/sense.org Mon Feb 06 08:26:20 2012 -0700 @@ -219,38 +219,16 @@ * Viewing Sense Data It's vital to /see/ the sense data to make sure that everything is -behaving as it should. =(view-sense)= is here so that each sense can -define its own way of turning sense-data into pictures, while the -actual rendering of said pictures stays in one central place. -=(points->image)= helps senses generate a base image onto which they -can overlay actual sense data. +behaving as it should. =(view-sense)= and its helper, =(view-image)= +are here so that each sense can define its own way of turning +sense-data into pictures, while the actual rendering of said pictures +stays in one central place. =(points->image)= helps senses generate a +base image onto which they can overlay actual sense data. #+name: view-senses #+begin_src clojure (in-ns 'cortex.sense) -(defn points->image - "Take a collection of points and visuliaze it as a BufferedImage." - [points] - (if (empty? points) - (BufferedImage. 1 1 BufferedImage/TYPE_BYTE_BINARY) - (let [xs (vec (map first points)) - ys (vec (map second points)) - x0 (apply min xs) - y0 (apply min ys) - width (- (apply max xs) x0) - height (- (apply max ys) y0) - image (BufferedImage. (inc width) (inc height) - BufferedImage/TYPE_INT_RGB)] - (dorun - (for [x (range (.getWidth image)) - y (range (.getHeight image))] - (.setRGB image x y 0xFF0000))) - (dorun - (for [index (range (count points))] - (.setRGB image (- (xs index) x0) (- (ys index) y0) -1))) - image))) - (defn view-image "Initailizes a JPanel on which you may draw a BufferedImage. Returns a function that accepts a BufferedImage and draws it to the @@ -303,6 +281,28 @@ (display (sense-display-kernel datum))) @windows data))))) +(defn points->image + "Take a collection of points and visuliaze it as a BufferedImage." + [points] + (if (empty? points) + (BufferedImage. 1 1 BufferedImage/TYPE_BYTE_BINARY) + (let [xs (vec (map first points)) + ys (vec (map second points)) + x0 (apply min xs) + y0 (apply min ys) + width (- (apply max xs) x0) + height (- (apply max ys) y0) + image (BufferedImage. (inc width) (inc height) + BufferedImage/TYPE_INT_RGB)] + (dorun + (for [x (range (.getWidth image)) + y (range (.getHeight image))] + (.setRGB image x y 0xFF0000))) + (dorun + (for [index (range (count points))] + (.setRGB image (- (xs index) x0) (- (ys index) y0) -1))) + image))) + (defn gray "Create a gray RGB pixel with R, G, and B set to num. num must be between 0 and 255." @@ -378,6 +378,8 @@ (.localToWorld object local-coordinate nil)) #+end_src +** Sense Binding + =(bind-sense)= binds either a Camera or a Listener object to any object so that they will follow that object no matter how it moves. It is used to create both eyes and ears. @@ -410,8 +412,8 @@ (controlRender [_ _]))))) #+end_src -Here is some example code which shows a camera bound to a blue -box as it is buffeted by white cannonballs. +Here is some example code which shows how a camera bound to a blue box +with =(bind-sense)= moves as the box is buffeted by white cannonballs. #+name: test #+begin_src clojure @@ -454,8 +456,6 @@ no-op))) #+end_src -** Demo Video - #+begin_html