diff org/worm_learn.clj @ 444:ea0bcd47d55b

redo worm and floor textures for final thesis render, with the wonderful help of Dylan.
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Mar 2014 02:08:30 -0400
parents d3c5f9b70574
children 47cfbe84f00e
line wrap: on
line diff
     1.1 --- a/org/worm_learn.clj	Tue Mar 25 00:20:01 2014 -0400
     1.2 +++ b/org/worm_learn.clj	Tue Mar 25 02:08:30 2014 -0400
     1.3 @@ -261,7 +261,22 @@
     1.4  (defn record-experience! [experiences data]
     1.5    (swap! experiences #(conj % data)))
     1.6  
     1.7 +(defn enable-shadows [world]
     1.8 +  (let [bsr (doto
     1.9 +                (BasicShadowRenderer. (asset-manager) 512)
    1.10 +              (.setDirection (.normalizeLocal (Vector3f. 1 -1 -1))))]
    1.11 +    (.addProcessor (.getViewPort world) bsr)))
    1.12  
    1.13 +(defn enable-good-shadows [world]
    1.14 +  (let [pssm
    1.15 +        (doto (PssmShadowRenderer. (asset-manager) 1024 3)
    1.16 +          (.setDirection  (.normalizeLocal (Vector3f. -1 -3 -1)))
    1.17 +          (.setLambda (float 0.55))
    1.18 +          (.setShadowIntensity (float 0.6))
    1.19 +          (.setCompareMode PssmShadowRenderer$CompareMode/Software)
    1.20 +          (.setFilterMode  PssmShadowRenderer$FilterMode/Bilinear))]
    1.21 +    (.addProcessor (.getViewPort world) pssm)))
    1.22 +        
    1.23  
    1.24  (defn worm-world
    1.25    [& {:keys [record motor-control keybindings view experiences
    1.26 @@ -278,15 +293,22 @@
    1.27          prop-display   (view-proprioception)
    1.28          muscle-display (view-movement)
    1.29          
    1.30 -        floor (box 10 1 10 :position (Vector3f. 0 -10 0)
    1.31 -                   :color ColorRGBA/Gray :mass 0
    1.32 -                   :texture "Textures/greenGrid.png")
    1.33 +        floor
    1.34 +        (box 5 1 5 :position (Vector3f. 0 -10 0)
    1.35 +             :mass 0
    1.36 +             :texture "Textures/aurellem.png"
    1.37 +             :material "Common/MatDefs/Misc/Unshaded.j3md")
    1.38          timer (IsoTimer. 60)]
    1.39  
    1.40      (world
    1.41 -       (nodify [worm floor])
    1.42 +     (nodify [worm floor])
    1.43         (merge standard-debug-controls keybindings)
    1.44         (fn [world]
    1.45 +         (enable-good-shadows world)
    1.46 +         (.setShadowMode worm RenderQueue$ShadowMode/CastAndReceive)
    1.47 +         (.setShadowMode floor RenderQueue$ShadowMode/Receive)
    1.48 +                  
    1.49 +         (.setBackgroundColor (.getViewPort world) (ColorRGBA/White))
    1.50           (.setDisplayStatView world false)
    1.51           (.setDisplayFps world false)
    1.52           (position-camera world view)
    1.53 @@ -297,7 +319,8 @@
    1.54              world
    1.55              (dir! (File. record "main-view"))))
    1.56           (speed-up world)
    1.57 -         (light-up-everything world))
    1.58 +         ;;(light-up-everything world)
    1.59 +         )
    1.60         (fn [world tpf]
    1.61           (if (and end-frame (> (.getTime timer) end-frame))
    1.62             (.stop world))