comparison org/util.org @ 458:42ddfe406c0a

working on depth maps for the lulz.
author Robert McIntyre <rlm@mit.edu>
date Tue, 11 Jun 2013 07:13:42 -0400
parents a44d8a28cbea
children a86555b02916
comparison
equal deleted inserted replaced
457:ee977613c244 458:42ddfe406c0a
363 (doto (asset-manager) 363 (doto (asset-manager)
364 (.registerLoader BlenderModelLoader 364 (.registerLoader BlenderModelLoader
365 (into-array String ["blend"]))) model)) 365 (into-array String ["blend"]))) model))
366 366
367 367
368
369 (def brick-length 0.48)
370 (def brick-width 0.24)
371 (def brick-height 0.12)
372 (def gravity (Vector3f. 0 -9.81 0))
373
374 (import com.jme3.math.Vector2f)
375 (import com.jme3.renderer.queue.RenderQueue$ShadowMode)
376 (import com.jme3.texture.Texture$WrapMode)
377
378 (defn brick* [position]
379 (println "get brick.")
380 (doto (box brick-length brick-height brick-width
381 :position position :name "brick"
382 :material "Common/MatDefs/Misc/Unshaded.j3md"
383 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
384 :mass 34)
385 (->
386 (.getMesh)
387 (.scaleTextureCoordinates (Vector2f. 1 0.5)))
388 (.setShadowMode RenderQueue$ShadowMode/CastAndReceive)
389 )
390 )
391
392
393 (defn floor*
394 "make a sturdy, unmovable physical floor"
395 []
396 (box 10 0.1 5 :name "floor" :mass 0
397 :color ColorRGBA/Gray :position (Vector3f. 0 0 0)))
398
399 (defn floor* []
400 (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240
401 :material "Common/MatDefs/Misc/Unshaded.j3md"
402 :texture "Textures/BronzeCopper030.jpg"
403 :position (Vector3f. 0 0 0 )
404 :mass 0)
405 (->
406 (.getMesh)
407 (.scaleTextureCoordinates (Vector2f. 3 6)));64 64
408 (->
409 (.getMaterial)
410 (.getTextureParam "ColorMap")
411 (.getTextureValue)
412 (.setWrap Texture$WrapMode/Repeat))
413 (.setShadowMode RenderQueue$ShadowMode/Receive)
414 ))
415
416
417 (defn brick-wall* []
418 (let [node (Node. "brick-wall")]
419 (dorun
420 (map
421 (comp #(.attachChild node %) brick*)
422 (for [y (range 10)
423 x (range 4)
424 z (range 1)]
425 (Vector3f.
426 (+ (* 2 x brick-length)
427 (if (even? (+ y z))
428 (/ brick-length 4) (/ brick-length -4)))
429 (+ (* brick-height (inc (* 2 y))))
430 (* 2 z brick-width) ))))
431 (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive)
432 node))
433
434
368 #+end_src 435 #+end_src
369 436
370 437
371 *** Debug Actions 438 *** Debug Actions
372 #+name: debug-actions 439 #+name: debug-actions