changeset 126:0efe6f04bc26

greatly enhanced touch sensitivity
author Robert McIntyre <rlm@mit.edu>
date Wed, 25 Jan 2012 04:54:48 -0700
parents 3d65633dd736
children bc49d452c42a
files org/test-creature.org
diffstat 1 files changed, 45 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/test-creature.org	Tue Jan 24 18:20:57 2012 -0700
     1.2 +++ b/org/test-creature.org	Wed Jan 25 04:54:48 2012 -0700
     1.3 @@ -9,29 +9,36 @@
     1.4  * ideas
     1.5  
     1.6  ** have to get done before winston
     1.7 - - [ ] write an explination for why greyscale bitmaps for senses is appropiate
     1.8 - - [ ] muscle control
     1.9 - - [ ] proprioception sensor map in the style of the other senses
    1.10 - - [ ] enable greyscale bitmaps for touch
    1.11 + - [ ] write an explination for why greyscale bitmaps for senses is
    1.12 +       appropiate -- 1/2 day
    1.13 + - [ ] muscle control -- day
    1.14 + - [ ] proprioception sensor map in the style of the other senses -- day
    1.15   - [ ] refactor integration code to distribute to each of the senses
    1.16 - - [ ] create video showing all the senses for Winston
    1.17 - - [ ] write summary for Winston
    1.18 - - [ ] project proposals for Winston
    1.19 - - [ ] send winston package
    1.20 +       -- day
    1.21 + - [ ] create video showing all the senses for Winston -- 2 days 
    1.22 + - [ ] write summary of project for Winston            \
    1.23 + - [ ] project proposals for Winston                    \
    1.24 + - [ ] additional senses to be implemented for Winston   |  -- 2 days 
    1.25 + - [ ] send Winston package                             /
    1.26  
    1.27  ** would be cool to get done before winston
    1.28 - - [ ] use sawfish to auto-tile sense windows
    1.29 - - [ ] sawfish keybinding to automatically delete all sense windows
    1.30 - - [ ] proof of concept C sense manipulation
    1.31 - - [ ] proof of concept GPU sense manipulation
    1.32 - - [ ] fourier view of sound
    1.33 - - [ ] directly change the UV-pixels to show sensor activation
    1.34 + - [X] enable greyscale bitmaps for touch -- 2 hours 
    1.35 + - [X] use sawfish to auto-tile sense windows -- 6 hours
    1.36 + - [X] sawfish keybinding to automatically delete all sense windows
    1.37 + - [ ] directly change the UV-pixels to show sensor activation -- 2
    1.38 +       days
    1.39 + - [ ] proof of concept C sense manipulation  -- 2 days 
    1.40 + - [ ] proof of concept GPU sense manipulation -- week
    1.41 + - [ ] fourier view of sound -- 2 or 3 days 
    1.42 + - [ ] dancing music generator
    1.43  
    1.44  ** don't have to get done before winston
    1.45 - - [ ] write tests for integration
    1.46 - - [ ] usertime/gametime clock HUD display
    1.47 - - [ ] find papers for each of the senses justifying my own representation
    1.48 - - [ ] show sensor maps in HUD display?
    1.49 + - [ ] write tests for integration -- 3 days
    1.50 + - [ ] usertime/gametime clock HUD display -- day 
    1.51 + - [ ] find papers for each of the senses justifying my own
    1.52 +       representation -- week
    1.53 + - [ ] show sensor maps in HUD display? -- 4 days
    1.54 + - [ ] show sensor maps in AWT display? -- 2 days
    1.55  
    1.56  
    1.57  * Intro 
    1.58 @@ -629,11 +636,16 @@
    1.59                  (let [results (CollisionResults.)]
    1.60                    (.collideWith node ray results)
    1.61                    (let [touch-objects
    1.62 -                        (set
    1.63 -                         (filter #(not (= geo %))
    1.64 -                                 (map #(.getGeometry %) results)))]
    1.65 -                    (if (> (count touch-objects) 0)
    1.66 -                      1 0))))))))))))
    1.67 +                        (filter #(not (= geo (.getGeometry %)))
    1.68 +                                results)]
    1.69 +                    (- 255
    1.70 +                       (if (empty? touch-objects) 255
    1.71 +                           (rem 
    1.72 +                            (int
    1.73 +                             (* 255 (/ (.getDistance
    1.74 +                                        (first touch-objects)) limit)))
    1.75 +                            256))))))))))))))
    1.76 +                         
    1.77    
    1.78  (defn touch [#^Node pieces]
    1.79    (filter (comp not nil?)
    1.80 @@ -910,6 +922,11 @@
    1.81            (do (println-repl "could not find joints node") []))]
    1.82    (assemble-creature model joints)))
    1.83  
    1.84 +(defn gray-scale [num]
    1.85 +  (+ num
    1.86 +     (bit-shift-left num 8)
    1.87 +     (bit-shift-left num 16)))
    1.88 +
    1.89  (defn debug-window
    1.90    "creates function that offers a debug view of sensor data"
    1.91    []
    1.92 @@ -920,8 +937,9 @@
    1.93          (dorun
    1.94           (for [i (range (count coords))]
    1.95             (.setRGB image ((coords i) 0) ((coords i) 1)
    1.96 -                    ({0 0x000000
    1.97 -                      1 0xFFFFFF} (sensor-data i)))))
    1.98 +                    (gray-scale (sensor-data i)))))
    1.99 +
   1.100 +                   
   1.101          (vi image)))))
   1.102  
   1.103  (defn debug-vision-window
   1.104 @@ -949,10 +967,8 @@
   1.105             (dorun
   1.106              (for [y (range height)]
   1.107                (let [raw-sensor (sensor-data x)]
   1.108 -                (.setRGB image x y
   1.109 -                         (+ raw-sensor
   1.110 -                            (bit-shift-left raw-sensor 8)
   1.111 -                            (bit-shift-left raw-sensor 16))))))))
   1.112 +                (.setRGB image x y (gray-scale raw-sensor)))))))
   1.113 +
   1.114          (vi image)))))
   1.115          
   1.116