diff org/sense.org @ 338:d37ccb6c888f

determined that the laptop cannot support arbitray dimensions when creating cameras. will need to use desktop from here on out when doing actual simulations.
author Robert McIntyre <rlm@mit.edu>
date Fri, 20 Jul 2012 16:40:25 -0500
parents 702b5c78c2de
children 02cc0734a976
line wrap: on
line diff
     1.1 --- a/org/sense.org	Fri Jul 20 13:14:22 2012 -0500
     1.2 +++ b/org/sense.org	Fri Jul 20 16:40:25 2012 -0500
     1.3 @@ -14,13 +14,21 @@
     1.4  
     1.5  #+name: blender-1
     1.6  #+begin_src clojure
     1.7 +(in-ns 'cortex.sense)
     1.8  (defn meta-data
     1.9    "Get the meta-data for a node created with blender."
    1.10    [blender-node key]
    1.11    (if-let [data (.getUserData blender-node "properties")]
    1.12 -    (.findValue data key) nil))
    1.13 +    ;; this part is to accomodate weird blender properties
    1.14 +    ;; as well as sensible clojure maps.
    1.15 +    (.findValue data key)
    1.16 +    (.getUserData blender-node key)))
    1.17 +
    1.18  #+end_src
    1.19  
    1.20 +#+results: blender-1
    1.21 +: #'cortex.sense/meta-data
    1.22 +
    1.23  Blender uses a different coordinate system than jMonkeyEngine so it
    1.24  is useful to be able to convert between the two. These only come into
    1.25  play when the meta-data of a node refers to a vector in the blender
    1.26 @@ -446,6 +454,8 @@
    1.27  
    1.28  #+name: test
    1.29  #+begin_src clojure 
    1.30 +(in-ns 'cortex.test.sense)
    1.31 +
    1.32  (defn test-bind-sense
    1.33    "Show a camera that stays in the same relative position to a blue
    1.34    cube."
    1.35 @@ -469,12 +479,14 @@
    1.36              (.setTimer world (RatchetTimer. 60))
    1.37              (if record?
    1.38                (Capture/captureVideo
    1.39 -               world (File. "/home/r/proj/cortex/render/bind-sense0")))
    1.40 +               world 
    1.41 +               (File. "/home/r/proj/cortex/render/bind-sense0")))
    1.42              (add-camera!
    1.43               world cam
    1.44 -             (comp (view-image
    1.45 -                    (if record?
    1.46 -                    (File. "/home/r/proj/cortex/render/bind-sense1")))
    1.47 +             (comp
    1.48 +              (view-image
    1.49 +               (if record?
    1.50 +                 (File. "/home/r/proj/cortex/render/bind-sense1")))
    1.51                     BufferedImage!))
    1.52              (add-camera! world (.getCamera world) no-op)))
    1.53          no-op))))