view org/games.org @ 30:0206878c28b4

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