comparison 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
comparison
equal deleted inserted replaced
443:d3c5f9b70574 444:ea0bcd47d55b
259 file) 259 file)
260 260
261 (defn record-experience! [experiences data] 261 (defn record-experience! [experiences data]
262 (swap! experiences #(conj % data))) 262 (swap! experiences #(conj % data)))
263 263
264 264 (defn enable-shadows [world]
265 (let [bsr (doto
266 (BasicShadowRenderer. (asset-manager) 512)
267 (.setDirection (.normalizeLocal (Vector3f. 1 -1 -1))))]
268 (.addProcessor (.getViewPort world) bsr)))
269
270 (defn enable-good-shadows [world]
271 (let [pssm
272 (doto (PssmShadowRenderer. (asset-manager) 1024 3)
273 (.setDirection (.normalizeLocal (Vector3f. -1 -3 -1)))
274 (.setLambda (float 0.55))
275 (.setShadowIntensity (float 0.6))
276 (.setCompareMode PssmShadowRenderer$CompareMode/Software)
277 (.setFilterMode PssmShadowRenderer$FilterMode/Bilinear))]
278 (.addProcessor (.getViewPort world) pssm)))
279
265 280
266 (defn worm-world 281 (defn worm-world
267 [& {:keys [record motor-control keybindings view experiences 282 [& {:keys [record motor-control keybindings view experiences
268 worm-model end-frame experience-watch] :as settings}] 283 worm-model end-frame experience-watch] :as settings}]
269 (let [{:keys [record motor-control keybindings view experiences 284 (let [{:keys [record motor-control keybindings view experiences
276 291
277 touch-display (view-touch) 292 touch-display (view-touch)
278 prop-display (view-proprioception) 293 prop-display (view-proprioception)
279 muscle-display (view-movement) 294 muscle-display (view-movement)
280 295
281 floor (box 10 1 10 :position (Vector3f. 0 -10 0) 296 floor
282 :color ColorRGBA/Gray :mass 0 297 (box 5 1 5 :position (Vector3f. 0 -10 0)
283 :texture "Textures/greenGrid.png") 298 :mass 0
299 :texture "Textures/aurellem.png"
300 :material "Common/MatDefs/Misc/Unshaded.j3md")
284 timer (IsoTimer. 60)] 301 timer (IsoTimer. 60)]
285 302
286 (world 303 (world
287 (nodify [worm floor]) 304 (nodify [worm floor])
288 (merge standard-debug-controls keybindings) 305 (merge standard-debug-controls keybindings)
289 (fn [world] 306 (fn [world]
307 (enable-good-shadows world)
308 (.setShadowMode worm RenderQueue$ShadowMode/CastAndReceive)
309 (.setShadowMode floor RenderQueue$ShadowMode/Receive)
310
311 (.setBackgroundColor (.getViewPort world) (ColorRGBA/White))
290 (.setDisplayStatView world false) 312 (.setDisplayStatView world false)
291 (.setDisplayFps world false) 313 (.setDisplayFps world false)
292 (position-camera world view) 314 (position-camera world view)
293 (.setTimer world timer) 315 (.setTimer world timer)
294 (display-dilated-time world timer) 316 (display-dilated-time world timer)
295 (when record 317 (when record
296 (Capture/captureVideo 318 (Capture/captureVideo
297 world 319 world
298 (dir! (File. record "main-view")))) 320 (dir! (File. record "main-view"))))
299 (speed-up world) 321 (speed-up world)
300 (light-up-everything world)) 322 ;;(light-up-everything world)
323 )
301 (fn [world tpf] 324 (fn [world tpf]
302 (if (and end-frame (> (.getTime timer) end-frame)) 325 (if (and end-frame (> (.getTime timer) end-frame))
303 (.stop world)) 326 (.stop world))
304 (let [muscle-data (vec (motor-control muscles)) 327 (let [muscle-data (vec (motor-control muscles))
305 proprioception-data (prop) 328 proprioception-data (prop)