view org/games.org @ 31:f0562b9bde94

fixed picture links
author Robert McIntyre <rlm@mit.edu>
date Mon, 24 Oct 2011 12:54:04 -0700
parents 0206878c28b4
children 183744c179e6
line wrap: on
line source
1 #+title: Games! Games! Games! <3
2 #+author: Robert McIntyre
3 #+email: rlm@mit.edu
4 #+description: Simulating senses for AI research using JMonkeyEngine3
5 #+SETUPFILE: ../../aurellem/org/setup.org
6 #+INCLUDE: ../../aurellem/org/level-0.org
7 #+babel: :mkdirp yes :noweb yes :exports both
10 * Games!
12 Here are the jMonkeyEngine "Hello" programs translated to clojure.
13 ** Hello Simple App
14 Here is the hello world example for jme3 in clojure. It's a more or
15 less direct translation from the java source [[http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication][here]].
17 Of note is the fact that since we don't have access to the
18 =AssetManager= via extendig =SimpleApplication=, we have to build one
19 ourselves.
21 #+srcname: hello-simple-app
22 #+begin_src clojure :results silent
23 (ns hello.hello-simple-app)
24 (require 'cortex.import)
25 (use 'clojure.contrib.def)
26 (rlm.rlm-commands/help)
27 (cortex.import/mega-import-jme3)
28 (use 'cortex.world)
31 (def cube (Box. Vector3f/ZERO 1 1 1))
33 (def geom (Geometry. "Box" cube))
35 (def mat (Material. (asset-manager) "Common/MatDefs/Misc/Unshaded.j3md"))
37 (.setColor mat "Color" ColorRGBA/Blue)
39 (.setMaterial geom mat)
41 (defn simple-app []
42 (doto
43 (proxy [SimpleApplication] []
44 (simpleInitApp
45 []
46 ;; Don't take control of the mouse
47 (org.lwjgl.input.Mouse/setGrabbed false)
48 (.attachChild (.getRootNode this) geom)))
49 ;; don't show a menu to change options.
50 (.setShowSettings false)
51 (.setPauseOnLostFocus false)
52 (.setSettings *app-settings*)))
53 #+end_src
55 Running this program will begin a new jMonkeyEngine game which
56 displays a single blue cube.
58 #+begin_src clojure :exports code :results silent
59 (.start (hello.hello-simple-app/simple-app))
60 #+end_src
62 #+caption: the simplest JME game.
63 [[../images/simple-app.jpg]]
66 ** Hello Physics
67 From http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_physics
69 #+srcname: brick-wall-header
70 #+begin_src clojure :results silent
71 (ns hello.brick-wall)
72 (require 'cortex.import)
73 (use 'clojure.contrib.def)
74 (rlm.rlm-commands/help)
75 (cortex.import/mega-import-jme3)
76 (use '[pokemon [lpsolve :only [constant-map]]])
77 (use 'cortex.world)
78 (use 'cortex.util)
79 #+end_src
81 #+srcname: brick-wall-body
82 #+begin_src clojure :results silent
83 (in-ns 'hello.brick-wall)
85 (defn floor
86 "make a sturdy, unmovable physical floor"
87 []
88 (box 20 1 20 :mass 0 :color false :position (Vector3f. 0 -2 0)))
90 (def brick-length 0.48)
91 (def brick-width 0.24)
92 (def brick-height 0.12)
95 (defn brick* [position]
96 (doto (box brick-length brick-height brick-width
97 :position position :name "brick"
98 :material "Common/MatDefs/Misc/Unshaded.j3md"
99 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
100 :mass 36)
101 (->
102 (.getMesh)
103 (.scaleTextureCoordinates (Vector2f. 1 0.5)))
104 ;;(.setShadowMode RenderQueue$ShadowMode/CastAndReceive)
105 )
106 )
108 (defn inception-brick-wall
109 "construct a physical brick wall"
110 []
111 (let [node (Node. "brick-wall")]
112 (dorun
113 (map (comp #(.attachChild node %) brick*)
114 (for
115 [x (range 15)
116 y (range 10)
117 z (range 1)]
118 (Vector3f.
119 (* brick-length x 1.03)
120 (* brick-width y y 10)
121 (* brick-height z)))))
122 node))
124 (defn gravity-toggle
125 [new-value]
126 (fn [game value]
127 (println-repl "set gravity to " new-value)
128 (if value
129 (set-gravity* game new-value)
130 (set-gravity* game gravity))))
132 (defn fire-cannon-ball
133 ([node]
134 (fn [game value]
135 (if (not value)
136 (let [camera (.getCamera game)
137 cannon-ball
138 (sphere 0.7
139 :material "Common/MatDefs/Misc/Unshaded.j3md"
140 :texture "Textures/PokeCopper.jpg"
141 :position
142 (.add (.getLocation camera)
143 (.mult (.getDirection camera) (float 1)))
144 :mass 3)] ;200 0.05
145 (.setShadowMode cannon-ball RenderQueue$ShadowMode/CastAndReceive)
146 (.setLinearVelocity
147 (.getControl cannon-ball RigidBodyControl)
148 (.mult (.getDirection camera) (float 50))) ;50
149 (add-element game cannon-ball (if node node (.getRootNode game)))))))
150 ([]
151 (fire-cannon-ball false)))
154 (defn floor* []
155 (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240
156 :material "Common/MatDefs/Misc/Unshaded.j3md"
157 :texture "Textures/Terrain/Pond/Pond.png"
158 :position (Vector3f. 0 -0.1 0 )
159 :mass 0)
160 (->
161 (.getMesh)
162 (.scaleTextureCoordinates (Vector2f. 3 6)));64 64
163 (->
164 (.getMaterial)
165 (.getTextureParam "ColorMap")
166 (.getTextureValue)
167 (.setWrap Texture$WrapMode/Repeat))
168 (.setShadowMode RenderQueue$ShadowMode/Receive)
169 ))
171 (defn brick-wall* []
172 (let [node (Node. "brick-wall")]
173 (dorun
174 (map
175 (comp #(.attachChild node %) brick*)
176 (for [y (range 15)
177 x (range 4)
178 z (range 1)]
179 (Vector3f.
180 (+ (* 2 x brick-length)
181 (if (even? (+ y z))
182 (/ brick-length 4) (/ brick-length -4)))
183 (+ (* brick-height (inc (* 2 y))))
184 (* 2 z brick-width) ))))
185 (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive)
186 node))
188 (defn brick-wall-game-run []
189 (doto
190 (world
191 (doto (Node.) (.attachChild (floor*))
192 (.attachChild (brick-wall*))
193 )
194 {"key-i" (gravity-toggle (Vector3f. 0 0 -9.81))
195 "key-m" (gravity-toggle (Vector3f. 0 0 9.81))
196 "key-l" (gravity-toggle (Vector3f. 9.81 0 0))
197 "key-j" (gravity-toggle (Vector3f. -9.81 0 0))
198 "key-k" (gravity-toggle Vector3f/ZERO)
199 "key-u" (gravity-toggle (Vector3f. 0 9.81 0))
200 "key-o" (gravity-toggle (Vector3f. 0 -9.81 0))
201 "key-f" (fn[game value]
202 (if (not value) (add-element game (brick-wall*))))
203 "key-return" (fire-cannon-ball)}
204 position-camera
205 (fn [& _]))
206 (.start)))
207 #+end_src
209 #+begin_src clojure :results silent
210 (hello.brick-wall/brick-wall-game-run)
211 #+end_src
213 #+caption: the brick wall standing
214 [[../images/brick-wall-standing.jpg]]
216 #+caption: the brick wall after it has been knocked over by a "pok\eacute{}ball"
217 [[../images/brick-wall-knocked-down.jpg]]
219 ** Other Brick Games
220 #+srcname: other-games
221 #+begin_src clojure :results silent
222 (ns cortex.other-games
223 {:author "Dylan Holmes"})
224 (use 'cortex.world)
225 (use 'hello.brick-wall)
226 (use 'cortex.import)
227 (cortex.import/mega-import-jme3)
229 (defn scad [position]
230 (doto (box 0.1 0.1 0.1
231 :position position :name "brick"
232 :material "Common/MatDefs/Misc/Unshaded.j3md"
233 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
234 :mass 20)
235 (->
236 (.getMesh)
237 (.scaleTextureCoordinates (Vector2f. 1 0.5))
238 )
239 (-> (.getControl RigidBodyControl)
240 (.setLinearVelocity (Vector3f. 0 100 0))
241 )
243 ;;(.setShadowMode RenderQueue$ShadowMode/Cast)
244 ))
247 (defn shrapnel []
248 (let [node (Node. "explosion-day")]
249 (dorun
250 (map
251 (comp #(.attachChild node %) scad)
252 (for [y (range 15)
253 x (range 4)
254 z (range 1)]
255 (Vector3f.
256 (+ (* 2 x brick-height)
257 (if (even? (+ y z)) (/ brick-height 4) (/ brick-height -4)))
258 (+ (* brick-height (inc (* 2 y))))
259 (* 2 z brick-height) ))))
260 node))
263 (def domino-height 0.48)
264 (def domino-thickness 0.12)
265 (def domino-width 0.24)
267 (def domino-thickness 0.05)
268 (def domino-width 0.5)
269 (def domino-height 1)
271 (defn domino
272 ([position]
273 (domino position (Quaternion/IDENTITY)))
274 ([position rotation]
275 (doto (box domino-width domino-height domino-thickness
276 :position position :name "domino"
277 :material "Common/MatDefs/Misc/Unshaded.j3md"
278 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
279 :mass 1
280 :rotation rotation)
281 (.setShadowMode RenderQueue$ShadowMode/CastAndReceive)
282 )))
285 (defn domino-row []
286 (let [node (Node. "domino-row")]
287 (dorun
288 (map
289 (comp #(.attachChild node %) domino)
290 (for [
291 z (range 10)
292 x (range 5)
293 ]
294 (Vector3f.
295 (+ (* z domino-width) (* x 5 domino-width))
296 (/ domino-height 1)
297 (* -5.5 domino-thickness z) ))))
299 node))
301 (defn domino-cycle []
302 (let [node (Node. "domino-cycle")]
303 (dorun
304 (map
305 (comp #(.attachChild node %) (partial apply domino) )
306 (for [n (range 720)]
307 (let [space (* domino-height 5.5)
308 r (fn[n] (* (+ n 3) domino-width 0.5))
309 t (fn[n] (reduce
310 +
311 (map
312 (fn dt[n] (/ space (* 2 (Math/PI) (r n))))
313 (range n))))
314 t (t n)
315 r (r n)
316 ct (Math/cos t)
317 st (Math/sin t)
318 ]
319 (list
320 (Vector3f.
321 (* -1 r st)
322 (/ domino-height 1)
323 (* r ct))
324 (.fromAngleAxis (Quaternion.)
325 (- (/ 3.1415926 2) t) (Vector3f. 0 1 0))
326 )))
327 ))
328 node))
331 (defn domino-game-run []
332 (doto
333 (world
334 (doto (Node.) (.attachChild (floor*))
335 )
336 {"key-i" (gravity-toggle (Vector3f. 0 0 -9.81))
337 "key-m" (gravity-toggle (Vector3f. 0 0 9.81))
338 "key-l" (gravity-toggle (Vector3f. 9.81 0 0))
339 "key-j" (gravity-toggle (Vector3f. -9.81 0 0))
340 "key-k" (gravity-toggle (Vector3f. 0 9.81 0) )
341 "key-u" (fn[g v] ((gravity-toggle (Vector3f. 0 -0 0)) g true))
342 "key-o" (gravity-toggle (Vector3f. 0 -9.81 0))
344 "key-space"
345 (fn[game value]
347 (if (not value)
348 (let [d (domino (Vector3f. 0 (/ domino-height 0.25) 0)
349 (.fromAngleAxis (Quaternion.)
350 (/ Math/PI 2) (Vector3f. 0 1 0)))]
351 (add-element game d))))
352 "key-f"
353 (fn[game value](if (not value) (add-element game (domino-cycle))))
354 "key-return" (fire-cannon-ball)}
355 position-camera
356 (fn [& _]))
357 (.start)))
358 #+end_src
360 #+begin_src clojure :results silent
361 (cortex.other-games/domino-game-run)
362 #+end_src
364 #+caption: floating dominos
365 [[../images/dominos.jpg]]
367 ** Hello Loop
368 #+srcname: hello-loop
369 #+begin_src clojure :results silent
370 (ns hello.loop)
371 (use 'cortex.world)
372 (use 'cortex.import)
373 (cortex.import/mega-import-jme3)
374 (rlm.rlm-commands/help)
376 (defn blue-cube []
377 (box 1 1 1
378 :color ColorRGBA/Blue
379 :texture false
380 :material "Common/MatDefs/Misc/Unshaded.j3md"
381 :name "blue-cube"
382 :physical? false))
384 (defn blue-cube-game []
385 (let [cube (blue-cube)
386 root (doto (Node.) (.attachChild cube))]
387 (world root
388 {}
389 no-op
390 (fn [game tpf]
391 (.rotate cube 0.0 (* 2 tpf) 0.0)))))
392 #+end_src
394 ** Hello Collision
396 #+srcname: hello-collision
397 #+begin_src clojure :results silent
398 (ns hello.collision)
399 (use 'cortex.world)
400 (use 'cortex.import)
401 (use 'clojure.contrib.def)
404 (cortex.import/mega-import-jme3)
405 (rlm.rlm-commands/help)
406 (use '[hello [brick-wall :only [fire-cannon-ball brick-wall*]]])
409 (defn environment []
410 (let
411 [scene-model
412 (doto
413 (.loadModel
414 (doto (asset-manager)
415 (.registerLocator
416 "/home/r/cortex/assets/zips/town.zip" ZipLocator))
417 "main.scene")
418 (.setLocalScale (float 2.0)))
419 collision-shape
420 (CollisionShapeFactory/createMeshShape #^Node scene-model)
421 landscape (RigidBodyControl. collision-shape 0)]
422 (.setShadowMode scene-model RenderQueue$ShadowMode/CastAndReceive)
423 (.addControl scene-model landscape)
424 scene-model))
426 (defn player-fn []
427 (doto
428 (CharacterControl.
429 (CapsuleCollisionShape. (float 1.5) (float 6)(float 1))
430 (float 0.05))
431 (.setJumpSpeed 20)
432 (.setFallSpeed 30)
433 (.setGravity 30) ;30
434 (.setPhysicsLocation (Vector3f. 0 10 0))))
436 (defn lights []
437 [(doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 1 1 1 1) (float 1))))
438 (doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 1 0.7 0 1) (float 1))))
439 (doto (DirectionalLight.)
440 (.setColor (.mult ColorRGBA/White (float 0.9) ))
441 (.setDirection (.normalizeLocal (Vector3f. 2.8 -28 2.8))))])
443 (defn night-lights []
444 [(doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 0.275 0.467 0.784 1) (float 0.3))))
445 (doto (DirectionalLight.)
446 (.setColor (.mult ColorRGBA/White (float 0.2) ))
447 (.setDirection (.normalizeLocal (Vector3f. 2.8 -28 2.8))))])
449 (def player (atom (player-fn)))
451 (defn setup-fn [game]
452 (dorun (map #(.addLight (.getRootNode game) %) (lights)))
453 ;; set the color of the sky
454 (.setBackgroundColor (.getViewPort game) (ColorRGBA. 0.3 0.4 0.9 1))
455 ;(.setBackgroundColor (.getViewPort game) (ColorRGBA. 0 0 0 1)
456 (doto (.getFlyByCamera game)
457 (.setMoveSpeed (float 100))
458 (.setRotationSpeed 3))
459 (.add
460 (.getPhysicsSpace
461 (.getState (.getStateManager game) BulletAppState))
462 @player)
464 (doto (Node.) (.attachChild (.getRootNode game))
465 (.attachChild (brick-wall*))
466 )
468 )
471 (def walking-up? (atom false))
472 (def walking-down? (atom false))
473 (def walking-left? (atom false))
474 (def walking-right? (atom false))
476 (defn set-walk [walk-atom game value]
477 ;;(println-repl "setting stuff to " value)
478 (reset! walk-atom value))
480 (defn responses []
481 {"key-w" (partial set-walk walking-up?)
482 "key-d" (partial set-walk walking-right?)
483 "key-s" (partial set-walk walking-down?)
484 "key-a" (partial set-walk walking-left?)
485 "key-return" (fire-cannon-ball)
486 "key-space" (fn [game value] (.jump @player))
487 })
489 (defn update-fn
490 [game tpf]
491 (let [camera (.getCamera game)
492 cam-dir (.multLocal
493 (.clone
494 (.getDirection camera)) (float 0.6))
495 cam-left (.multLocal
496 (.clone
497 (.getLeft camera)) (float 0.4))
498 walk-direction (Vector3f. 0 0 0)]
500 (cond
501 @walking-up? (.addLocal walk-direction cam-dir)
502 @walking-right? (.addLocal walk-direction (.negate cam-left))
503 @walking-down? (.addLocal walk-direction (.negate cam-dir))
504 @walking-left? (.addLocal walk-direction cam-left))
505 (.setWalkDirection @player walk-direction)
506 (.setLocation camera (.getPhysicsLocation @player))))
508 (defn run-game []
509 (.start
510 (world (environment)
511 (responses)
512 setup-fn
513 update-fn)))
514 #+end_src
516 ** Hello Terrain
517 #+srcname: hello-terrain
518 #+begin_src clojure :results silent
519 (ns hello.terrain)
520 (use 'cortex.world)
521 (use 'cortex.import)
522 (use 'clojure.contrib.def)
523 (import jme3tools.converters.ImageToAwt)
526 (cortex.import/mega-import-jme3)
527 (rlm.rlm-commands/help)
528 (use '[hello [brick-wall :only [fire-cannon-ball brick-wall*]]])
531 (defn setup-fn [type game]
532 (.setMoveSpeed (.getFlyByCamera game) 50)
533 (.setFrustumFar (.getCamera game) 10000)
534 (let [env (environment type)
535 cameras [(.getCamera game)]
536 control (TerrainLodControl. env cameras)]
537 ;;(.addControl env control)
538 (.attachChild (.getRootNode game) env)))
540 (defn environment [type]
541 (let
542 [mat_terrain
543 (Material. (asset-manager) "Common/MatDefs/Terrain/Terrain.j3md")
544 grass (.loadTexture (asset-manager) "Textures/Terrain/splat/grass.jpg")
545 dirt (.loadTexture (asset-manager) "Textures/Terrain/splat/dirt.jpg")
546 rock (.loadTexture (asset-manager) "Textures/Terrain/splat/road.jpg")
547 heightmap-image (.loadTexture (asset-manager)
548 ({:mountain "Textures/Terrain/splat/mountains512.png"
549 :fortress "Textures/Terrain/splat/fortress512.png"
550 }type))
551 heightmap (ImageBasedHeightMap.
552 (ImageToAwt/convert (.getImage heightmap-image) false true 0))
553 terrain (do (.load heightmap)
554 (TerrainQuad. "my terrain" 65 513 (.getHeightMap heightmap)))
555 ]
557 (dorun (map #(.setWrap % Texture$WrapMode/Repeat)
558 [grass dirt rock]))
560 (doto mat_terrain
561 (.setTexture "Tex1" grass)
562 (.setFloat "Tex1Scale" (float 64))
564 (.setTexture "Tex2" dirt)
565 (.setFloat "Tex2Scale" (float 32))
567 (.setTexture "Tex3" rock)
568 (.setFloat "Tex3Scale" (float 128))
570 (.setTexture "Alpha"
571 (.loadTexture
572 (asset-manager)
573 ({:mountain "Textures/Terrain/splat/alphamap.png"
574 :fortress "Textures/Terrain/splat/alphamap2.png"} type))))
576 (doto terrain
577 (.setMaterial mat_terrain)
578 (.setLocalTranslation 0 -100 0)
579 (.setLocalScale 2 1 2))))
583 (defn run-terrain-game [type]
584 (.start
585 (world
586 (Node.)
587 {}
588 (partial setup-fn type)
589 no-op)))
590 #+end_src
594 #+srcname: hello-animation
595 #+begin_src clojure :results silent
596 (ns hello.animation)
597 (use 'cortex.world)
598 (use 'cortex.import)
599 (use 'clojure.contrib.def)
600 (cortex.import/mega-import-jme3)
601 (rlm.rlm-commands/help)
602 (use '[hello [collision :only [lights]]])
604 (defn stand
605 [channel]
606 (doto channel
607 (.setAnim "stand" (float 0.5))
608 (.setLoopMode LoopMode/DontLoop)
609 (.setSpeed (float 1))))
611 (defn anim-listener []
612 (proxy [AnimEventListener] []
613 (onAnimChange
614 [control channel animation-name]
615 (println-repl "RLM --- onAnimChange"))
616 (onAnimCycleDone
617 [control channel animation-name]
618 (if (= animation-name "Walk")
619 (stand channel)
620 ))))
622 (defn setup-fn [channel game]
623 (dorun (map #(.addLight (.getRootNode game) %) (lights)))
624 ;; set the color of the sky
625 (.setBackgroundColor (.getViewPort game) (ColorRGBA. 0.3 0.4 0.9 1))
626 ;(.setBackgroundColor (.getViewPort game) (ColorRGBA. 0 0 0 1)
627 (.setAnim channel "stand")
628 (doto (.getFlyByCamera game)
629 (.setMoveSpeed (float 10))
630 (.setRotationSpeed 1)))
632 (defn walk [channel]
633 (println-repl "zzz")
634 (doto channel
635 (.setAnim "Walk" (float 0.5))
636 (.setLoopMode LoopMode/Loop)))
639 (defn key-map [channel]
640 {"key-space" (fn [game value]
641 (if (not value)
642 (walk channel)))})
644 (defn player []
645 (let [model (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml")
646 control (.getControl model AnimControl)]
647 (.setLocalScale model (float 0.5))
648 (.clearListeners control)
649 (.addListener control (anim-control))
650 model))
654 (defn run-anim-game []
655 (let [ninja (player)
656 control (.getControl ninja AnimControl)
657 channel (.createChannel control)]
658 (.start
659 (world
660 ninja
661 (key-map channel)
662 (partial setup-fn channel)
663 no-op))))
664 #+end_src
666 ** Hello Materials
667 #+srcname: material
668 #+begin_src clojure :results silent
669 (ns hello.material)
670 (use 'cortex.world)
671 (use 'cortex.import)
672 (use 'clojure.contrib.def)
673 (cortex.import/mega-import-jme3)
674 (rlm.rlm-commands/help)
676 (defn simple-cube []
677 (box 1 1 1
678 :position (Vector3f. -3 1.1 0)
679 :material "Common/MatDefs/Misc/Unshaded.j3md"
680 :texture "Interface/Logo/Monkey.jpg"
681 :physical? false))
683 (defn leaky-box []
684 (box 1 1 1
685 :position (Vector3f. 3 -1 0)
686 :material "Common/MatDefs/Misc/ColoredTextured.j3md"
687 :texture "Textures/ColoredTex/Monkey.png"
688 :color (ColorRGBA. 1 0 1 1)
689 :physical? false))
691 (defn transparent-box []
692 (doto
693 (box 1 1 0.1
694 :position Vector3f/ZERO
695 :name "window frame"
696 :material "Common/MatDefs/Misc/Unshaded.j3md"
697 :texture "Textures/ColoredTex/Monkey.png"
698 :physical? false)
699 (-> (.getMaterial)
700 (.getAdditionalRenderState)
701 (.setBlendMode RenderState$BlendMode/Alpha))
702 (.setQueueBucket RenderQueue$Bucket/Transparent)))
704 (defn bumpy-sphere []
705 (doto
706 (sphere 2
707 :position (Vector3f. 0 2 -2)
708 :name "Shiny rock"
709 :material "Common/MatDefs/Light/Lighting.j3md"
710 :texture false
711 :physical? false)
712 (-> (.getMesh)
713 (doto
714 (.setTextureMode Sphere$TextureMode/Projected)
715 (TangentBinormalGenerator/generate)))
716 (-> (.getMaterial)
717 (doto
718 (.setTexture "DiffuseMap"
719 (.loadTexture (asset-manager)
720 "Textures/Terrain/Pond/Pond.png"))
721 (.setTexture "NormalMap"
722 (.loadTexture (asset-manager)
723 "Textures/Terrain/Pond/Pond_normal.png"))
724 (.setFloat "Shininess" (float 5))))
725 (.rotate (float 1.6) 0 0)))
728 (defn start-game []
729 (.start
730 (world
731 (let [root (Node.)]
732 (dorun (map #(.attachChild root %)
733 [(simple-cube) (leaky-box) (transparent-box) (bumpy-sphere)]))
734 root)
735 {}
736 (fn [world]
737 (let [sun (doto (DirectionalLight.)
738 (.setDirection (.normalizeLocal (Vector3f. 1 0 -2)))
739 (.setColor ColorRGBA/White))]
740 (.addLight (.getRootNode world) sun)))
741 no-op
742 )))
743 #+end_src
747 * COMMENT code generation
749 #+begin_src clojure :tangle ../src/hello/brick_wall.clj
750 <<brick-wall-header>>
751 <<brick-wall-body>>
752 #+end_src
754 #+begin_src clojure :tangle ../src/hello/hello_simple_app.clj
755 <<hello-simple-app>>
756 #+end_src
758 #+begin_src clojure :tangle ../src/cortex/other_games.clj
759 <<other-games>>
760 #+end_src
762 #+begin_src clojure :tangle ../src/hello/loop.clj
763 <<hello-loop>>
764 #+end_src
766 #+begin_src clojure :tangle ../src/hello/collision.clj
767 <<hello-collision>>
768 #+end_src
770 #+begin_src clojure :tangle ../src/hello/terrain.clj
771 <<hello-terrain>>
772 #+end_src
774 #+begin_src clojure :tangle ../src/hello/animation.clj
775 <<hello-animation>>
776 #+end_src
778 #+begin_src clojure :tangle ../src/hello/material.clj
779 <<material>>
780 #+end_src