Mercurial > cortex
diff 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 |
line wrap: on
line diff
1.1 --- a/org/util.org Fri Jun 07 11:49:09 2013 -0400 1.2 +++ b/org/util.org Tue Jun 11 07:13:42 2013 -0400 1.3 @@ -365,6 +365,73 @@ 1.4 (into-array String ["blend"]))) model)) 1.5 1.6 1.7 + 1.8 +(def brick-length 0.48) 1.9 +(def brick-width 0.24) 1.10 +(def brick-height 0.12) 1.11 +(def gravity (Vector3f. 0 -9.81 0)) 1.12 + 1.13 +(import com.jme3.math.Vector2f) 1.14 +(import com.jme3.renderer.queue.RenderQueue$ShadowMode) 1.15 +(import com.jme3.texture.Texture$WrapMode) 1.16 + 1.17 +(defn brick* [position] 1.18 + (println "get brick.") 1.19 + (doto (box brick-length brick-height brick-width 1.20 + :position position :name "brick" 1.21 + :material "Common/MatDefs/Misc/Unshaded.j3md" 1.22 + :texture "Textures/Terrain/BrickWall/BrickWall.jpg" 1.23 + :mass 34) 1.24 + (-> 1.25 + (.getMesh) 1.26 + (.scaleTextureCoordinates (Vector2f. 1 0.5))) 1.27 + (.setShadowMode RenderQueue$ShadowMode/CastAndReceive) 1.28 + ) 1.29 + ) 1.30 + 1.31 + 1.32 +(defn floor* 1.33 + "make a sturdy, unmovable physical floor" 1.34 + [] 1.35 + (box 10 0.1 5 :name "floor" :mass 0 1.36 + :color ColorRGBA/Gray :position (Vector3f. 0 0 0))) 1.37 + 1.38 +(defn floor* [] 1.39 + (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240 1.40 + :material "Common/MatDefs/Misc/Unshaded.j3md" 1.41 + :texture "Textures/BronzeCopper030.jpg" 1.42 + :position (Vector3f. 0 0 0 ) 1.43 + :mass 0) 1.44 + (-> 1.45 + (.getMesh) 1.46 + (.scaleTextureCoordinates (Vector2f. 3 6)));64 64 1.47 + (-> 1.48 + (.getMaterial) 1.49 + (.getTextureParam "ColorMap") 1.50 + (.getTextureValue) 1.51 + (.setWrap Texture$WrapMode/Repeat)) 1.52 + (.setShadowMode RenderQueue$ShadowMode/Receive) 1.53 + )) 1.54 + 1.55 + 1.56 +(defn brick-wall* [] 1.57 + (let [node (Node. "brick-wall")] 1.58 + (dorun 1.59 + (map 1.60 + (comp #(.attachChild node %) brick*) 1.61 + (for [y (range 10) 1.62 + x (range 4) 1.63 + z (range 1)] 1.64 + (Vector3f. 1.65 + (+ (* 2 x brick-length) 1.66 + (if (even? (+ y z)) 1.67 + (/ brick-length 4) (/ brick-length -4))) 1.68 + (+ (* brick-height (inc (* 2 y)))) 1.69 + (* 2 z brick-width) )))) 1.70 + (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive) 1.71 + node)) 1.72 + 1.73 + 1.74 #+end_src 1.75 1.76