Mercurial > cortex
view org/games.org @ 45:f080f1e49fba
fixed imports, moved fox
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 08 Nov 2011 02:11:01 -0700 |
parents | 183744c179e6 |
children | b1b90c4ab0bf |
line wrap: on
line source
1 #+title: jMonkeyEngine3 from Clojure2 #+author: Robert McIntyre3 #+email: rlm@mit.edu4 #+description: Using jMonkeyEngine3 from clojure5 #+keywords: clojure, jMonkeyEngine3, tutorial, examples6 #+SETUPFILE: ../../aurellem/org/setup.org7 #+INCLUDE: ../../aurellem/org/level-0.org8 #+babel: :mkdirp yes :noweb yes :exports both10 [TABLE-OF-CONTENTS]13 Here are the jMonkeyEngine "Hello" programs translated to clojure.15 * Hello Simple App16 Here is the hello world example for jme3 in clojure. It's a more or17 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 the20 =AssetManager= via extendig =SimpleApplication=, we have to build one21 ourselves.23 #+srcname: hello-simple-app24 #+begin_src clojure :results silent25 (ns hello.hello-simple-app26 (:use cortex.world)27 (:import com.jme3.math.Vector3f)28 (:import com.jme3.material.Material)29 (:import com.jme3.scene.Geometry)30 (:import com.jme3.math.ColorRGBA)31 (:import com.jme3.app.SimpleApplication)32 (:import com.jme3.scene.shape.Box))34 (def cube (Box. Vector3f/ZERO 1 1 1))36 (def geom (Geometry. "Box" cube))38 (def mat (Material. (asset-manager) "Common/MatDefs/Misc/Unshaded.j3md"))40 (.setColor mat "Color" ColorRGBA/Blue)42 (.setMaterial geom mat)44 (defn simple-app []45 (doto46 (proxy [SimpleApplication] []47 (simpleInitApp48 []49 ;; Don't take control of the mouse50 (org.lwjgl.input.Mouse/setGrabbed false)51 (.attachChild (.getRootNode this) geom)))52 ;; don't show a menu to change options.53 (.setShowSettings false)54 (.setPauseOnLostFocus false)55 (.setSettings *app-settings*)))56 #+end_src58 Running this program will begin a new jMonkeyEngine game which59 displays a single blue cube.61 #+begin_src clojure :exports code :results silent62 (.start (hello.hello-simple-app/simple-app))63 #+end_src65 #+caption: the simplest JME game.66 [[../images/simple-app.jpg]]68 * Simpler HelloSimpleApp70 #+srcname: hello-simpler-app71 #+begin_src clojure72 (ns hello.hello-simpler-app73 (:use cortex.world)74 (:use cortex.util)75 (:import com.jme3.math.ColorRGBA)76 (:import com.jme3.scene.Node))78 (defn simpler-world79 "The jMonkeyEngine3 Hello World program. Displays a blue 3D cube in80 a basic 3D world."81 []82 (world (doto (Node.)83 (.attachChild84 (box 1 1 185 :color ColorRGBA/Blue :physical? false)))86 {} no-op no-op))87 #+end_src89 More information about the jMonkeyEngine3 hello world program can be90 found [[http://jmonkeyengine.org/wiki/doku.php/starter:hello_world][here]].92 * COMMENT Hello Physics93 From http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_physics95 #+srcname: brick-wall-header96 #+begin_src clojure :results silent97 (ns hello.brick-wall)98 (require 'cortex.import)99 (use 'clojure.contrib.def)100 (rlm.rlm-commands/help)101 (cortex.import/mega-import-jme3)102 (use '[pokemon [lpsolve :only [constant-map]]])103 (use 'cortex.world)104 (use 'cortex.util)105 #+end_src107 #+srcname: brick-wall-body108 #+begin_src clojure :results silent109 (in-ns 'hello.brick-wall)111 (defn floor112 "make a sturdy, unmovable physical floor"113 []114 (box 20 1 20 :mass 0 :color false :position (Vector3f. 0 -2 0)))116 (def brick-length 0.48)117 (def brick-width 0.24)118 (def brick-height 0.12)119 (def gravity (Vector3f. 0 -9.81 0))121 (defn brick* [position]122 (doto (box brick-length brick-height brick-width123 :position position :name "brick"124 :material "Common/MatDefs/Misc/Unshaded.j3md"125 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"126 :mass 36)127 (->128 (.getMesh)129 (.scaleTextureCoordinates (Vector2f. 1 0.5)))130 ;;(.setShadowMode RenderQueue$ShadowMode/CastAndReceive)131 )132 )134 (defn inception-brick-wall135 "construct a physical brick wall"136 []137 (let [node (Node. "brick-wall")]138 (dorun139 (map (comp #(.attachChild node %) brick*)140 (for141 [x (range 15)142 y (range 10)143 z (range 1)]144 (Vector3f.145 (* brick-length x 1.03)146 (* brick-width y y 10)147 (* brick-height z)))))148 node))150 (defn gravity-toggle151 [new-value]152 (fn [game value]153 (println-repl "set gravity to " new-value)154 (if value155 (set-gravity game new-value)156 (set-gravity game gravity))))158 (defn fire-cannon-ball159 ([node]160 (fn [game value]161 (if (not value)162 (let [camera (.getCamera game)163 cannon-ball164 (sphere 0.7165 :material "Common/MatDefs/Misc/Unshaded.j3md"166 :texture "Textures/PokeCopper.jpg"167 :position168 (.add (.getLocation camera)169 (.mult (.getDirection camera) (float 1)))170 :mass 3)] ;200 0.05171 (.setShadowMode cannon-ball RenderQueue$ShadowMode/CastAndReceive)172 (.setLinearVelocity173 (.getControl cannon-ball RigidBodyControl)174 (.mult (.getDirection camera) (float 50))) ;50175 (add-element game cannon-ball (if node node (.getRootNode game)))))))176 ([]177 (fire-cannon-ball false)))180 (defn floor* []181 (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240182 :material "Common/MatDefs/Misc/Unshaded.j3md"183 :texture "Textures/Terrain/Pond/Pond.png"184 :position (Vector3f. 0 -0.1 0 )185 :mass 0)186 (->187 (.getMesh)188 (.scaleTextureCoordinates (Vector2f. 3 6)));64 64189 (->190 (.getMaterial)191 (.getTextureParam "ColorMap")192 (.getTextureValue)193 (.setWrap Texture$WrapMode/Repeat))194 (.setShadowMode RenderQueue$ShadowMode/Receive)195 ))197 (defn brick-wall* []198 (let [node (Node. "brick-wall")]199 (dorun200 (map201 (comp #(.attachChild node %) brick*)202 (for [y (range 15)203 x (range 4)204 z (range 1)]205 (Vector3f.206 (+ (* 2 x brick-length)207 (if (even? (+ y z))208 (/ brick-length 4) (/ brick-length -4)))209 (+ (* brick-height (inc (* 2 y))))210 (* 2 z brick-width) ))))211 (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive)212 node))214 (defn brick-wall-game-run []215 (doto216 (world217 (doto (Node.) (.attachChild (floor*))218 (.attachChild (brick-wall*))219 )220 {"key-i" (gravity-toggle (Vector3f. 0 0 -9.81))221 "key-m" (gravity-toggle (Vector3f. 0 0 9.81))222 "key-l" (gravity-toggle (Vector3f. 9.81 0 0))223 "key-j" (gravity-toggle (Vector3f. -9.81 0 0))224 "key-k" (gravity-toggle Vector3f/ZERO)225 "key-u" (gravity-toggle (Vector3f. 0 9.81 0))226 "key-o" (gravity-toggle (Vector3f. 0 -9.81 0))227 "key-f" (fn[game value]228 (if (not value) (add-element game (brick-wall*))))229 "key-return" (fire-cannon-ball)}230 position-camera231 (fn [& _]))232 (.start)))233 #+end_src235 #+begin_src clojure :results silent236 (hello.brick-wall/brick-wall-game-run)237 #+end_src239 #+caption: the brick wall standing240 [[../images/brick-wall-standing.jpg]]242 #+caption: the brick wall after it has been knocked over by a "pok\eacute{}ball"243 [[../images/brick-wall-knocked-down.jpg]]245 * COMMENT Other Brick Games246 #+srcname: other-games247 #+begin_src clojure :results silent248 (ns hello.other-games249 {:author "Dylan Holmes"})250 (use 'cortex.world)251 (use 'hello.brick-wall)252 (use 'cortex.import)253 (cortex.import/mega-import-jme3)255 (defn scad [position]256 (doto (box 0.1 0.1 0.1257 :position position :name "brick"258 :material "Common/MatDefs/Misc/Unshaded.j3md"259 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"260 :mass 20)261 (->262 (.getMesh)263 (.scaleTextureCoordinates (Vector2f. 1 0.5))264 )265 (-> (.getControl RigidBodyControl)266 (.setLinearVelocity (Vector3f. 0 100 0))267 )269 ;;(.setShadowMode RenderQueue$ShadowMode/Cast)270 ))273 (defn shrapnel []274 (let [node (Node. "explosion-day")]275 (dorun276 (map277 (comp #(.attachChild node %) scad)278 (for [y (range 15)279 x (range 4)280 z (range 1)]281 (Vector3f.282 (+ (* 2 x brick-height)283 (if (even? (+ y z)) (/ brick-height 4) (/ brick-height -4)))284 (+ (* brick-height (inc (* 2 y))))285 (* 2 z brick-height) ))))286 node))289 (def domino-height 0.48)290 (def domino-thickness 0.12)291 (def domino-width 0.24)293 (def domino-thickness 0.05)294 (def domino-width 0.5)295 (def domino-height 1)297 (defn domino298 ([position]299 (domino position (Quaternion/IDENTITY)))300 ([position rotation]301 (doto (box domino-width domino-height domino-thickness302 :position position :name "domino"303 :material "Common/MatDefs/Misc/Unshaded.j3md"304 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"305 :mass 1306 :rotation rotation)307 (.setShadowMode RenderQueue$ShadowMode/CastAndReceive)308 )))311 (defn domino-row []312 (let [node (Node. "domino-row")]313 (dorun314 (map315 (comp #(.attachChild node %) domino)316 (for [317 z (range 10)318 x (range 5)319 ]320 (Vector3f.321 (+ (* z domino-width) (* x 5 domino-width))322 (/ domino-height 1)323 (* -5.5 domino-thickness z) ))))325 node))327 (defn domino-cycle []328 (let [node (Node. "domino-cycle")]329 (dorun330 (map331 (comp #(.attachChild node %) (partial apply domino) )332 (for [n (range 720)]333 (let [space (* domino-height 5.5)334 r (fn[n] (* (+ n 3) domino-width 0.5))335 t (fn[n] (reduce336 +337 (map338 (fn dt[n] (/ space (* 2 (Math/PI) (r n))))339 (range n))))340 t (t n)341 r (r n)342 ct (Math/cos t)343 st (Math/sin t)344 ]345 (list346 (Vector3f.347 (* -1 r st)348 (/ domino-height 1)349 (* r ct))350 (.fromAngleAxis (Quaternion.)351 (- (/ 3.1415926 2) t) (Vector3f. 0 1 0))352 )))353 ))354 node))357 (defn domino-game-run []358 (doto359 (world360 (doto (Node.) (.attachChild (floor*))361 )362 {"key-i" (gravity-toggle (Vector3f. 0 0 -9.81))363 "key-m" (gravity-toggle (Vector3f. 0 0 9.81))364 "key-l" (gravity-toggle (Vector3f. 9.81 0 0))365 "key-j" (gravity-toggle (Vector3f. -9.81 0 0))366 "key-k" (gravity-toggle (Vector3f. 0 9.81 0) )367 "key-u" (fn[g v] ((gravity-toggle (Vector3f. 0 -0 0)) g true))368 "key-o" (gravity-toggle (Vector3f. 0 -9.81 0))370 "key-space"371 (fn[game value]373 (if (not value)374 (let [d (domino (Vector3f. 0 (/ domino-height 0.25) 0)375 (.fromAngleAxis (Quaternion.)376 (/ Math/PI 2) (Vector3f. 0 1 0)))]377 (add-element game d))))378 "key-f"379 (fn[game value](if (not value) (add-element game (domino-cycle))))380 "key-return" (fire-cannon-ball)}381 position-camera382 (fn [& _]))383 (.start)))384 #+end_src386 #+begin_src clojure :results silent387 (cortex.other-games/domino-game-run)388 #+end_src390 #+caption: floating dominos391 [[../images/dominos.jpg]]393 * Hello Loop394 #+srcname: hello-loop395 #+begin_src clojure :results silent396 (ns hello.loop397 (:use cortex.world)398 (:use cortex.util)399 (:import com.jme3.math.ColorRGBA)400 (:import com.jme3.scene.Node))402 (defn blue-cube []403 (box 1 1 1404 :color ColorRGBA/Blue405 :texture false406 :material "Common/MatDefs/Misc/Unshaded.j3md"407 :name "blue-cube"408 :physical? false))410 (defn blue-cube-game []411 (let [cube (blue-cube)412 root (doto (Node.) (.attachChild cube))]413 (world root414 {}415 no-op416 (fn [game tpf]417 (.rotate cube 0.0 (* 2 tpf) 0.0)))))418 #+end_src420 * COMMENT Hello Collision422 #+srcname: hello-collision423 #+begin_src clojure :results silent424 (ns hello.collision)425 (use 'cortex.world)426 (use 'cortex.import)427 (use 'clojure.contrib.def)430 (cortex.import/mega-import-jme3)431 (rlm.rlm-commands/help)432 (use '[hello [brick-wall :only [fire-cannon-ball brick-wall*]]])435 (defn environment []436 (let437 [scene-model438 (doto439 (.loadModel440 (doto (asset-manager)441 (.registerLocator442 "/home/r/cortex/assets/zips/town.zip" ZipLocator))443 "main.scene")444 (.setLocalScale (float 2.0)))445 collision-shape446 (CollisionShapeFactory/createMeshShape #^Node scene-model)447 landscape (RigidBodyControl. collision-shape 0)]448 (.setShadowMode scene-model RenderQueue$ShadowMode/CastAndReceive)449 (.addControl scene-model landscape)450 scene-model))452 (defn player-fn []453 (doto454 (CharacterControl.455 (CapsuleCollisionShape. (float 1.5) (float 6)(float 1))456 (float 0.05))457 (.setJumpSpeed 20)458 (.setFallSpeed 30)459 (.setGravity 30) ;30460 (.setPhysicsLocation (Vector3f. 0 10 0))))462 (defn lights []463 [(doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 1 1 1 1) (float 1))))464 (doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 1 0.7 0 1) (float 1))))465 (doto (DirectionalLight.)466 (.setColor (.mult ColorRGBA/White (float 0.9) ))467 (.setDirection (.normalizeLocal (Vector3f. 2.8 -28 2.8))))])469 (defn night-lights []470 [(doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 0.275 0.467 0.784 1) (float 0.3))))471 (doto (DirectionalLight.)472 (.setColor (.mult ColorRGBA/White (float 0.2) ))473 (.setDirection (.normalizeLocal (Vector3f. 2.8 -28 2.8))))])475 (def player (atom (player-fn)))477 (defn setup-fn [game]478 (dorun (map #(.addLight (.getRootNode game) %) (lights)))479 ;; set the color of the sky480 (.setBackgroundColor (.getViewPort game) (ColorRGBA. 0.3 0.4 0.9 1))481 ;(.setBackgroundColor (.getViewPort game) (ColorRGBA. 0 0 0 1)482 (doto (.getFlyByCamera game)483 (.setMoveSpeed (float 100))484 (.setRotationSpeed 3))485 (.add486 (.getPhysicsSpace487 (.getState (.getStateManager game) BulletAppState))488 @player)490 (doto (Node.) (.attachChild (.getRootNode game))491 (.attachChild (brick-wall*))492 )494 )497 (def walking-up? (atom false))498 (def walking-down? (atom false))499 (def walking-left? (atom false))500 (def walking-right? (atom false))502 (defn set-walk [walk-atom game value]503 ;;(println-repl "setting stuff to " value)504 (reset! walk-atom value))506 (defn responses []507 {"key-w" (partial set-walk walking-up?)508 "key-d" (partial set-walk walking-right?)509 "key-s" (partial set-walk walking-down?)510 "key-a" (partial set-walk walking-left?)511 "key-return" (fire-cannon-ball)512 "key-space" (fn [game value] (.jump @player))513 })515 (defn update-fn516 [game tpf]517 (let [camera (.getCamera game)518 cam-dir (.multLocal519 (.clone520 (.getDirection camera)) (float 0.6))521 cam-left (.multLocal522 (.clone523 (.getLeft camera)) (float 0.4))524 walk-direction (Vector3f. 0 0 0)]526 (cond527 @walking-up? (.addLocal walk-direction cam-dir)528 @walking-right? (.addLocal walk-direction (.negate cam-left))529 @walking-down? (.addLocal walk-direction (.negate cam-dir))530 @walking-left? (.addLocal walk-direction cam-left))531 (.setWalkDirection @player walk-direction)532 (.setLocation camera (.getPhysicsLocation @player))))534 (defn run-game []535 (.start536 (world (environment)537 (responses)538 setup-fn539 update-fn)))540 #+end_src542 * COMMENT Hello Terrain543 #+srcname: hello-terrain544 #+begin_src clojure :results silent545 (ns hello.terrain)546 (use 'cortex.world)547 (use 'cortex.import)548 (use 'clojure.contrib.def)549 (import jme3tools.converters.ImageToAwt)552 (cortex.import/mega-import-jme3)553 (rlm.rlm-commands/help)554 (use '[hello [brick-wall :only [fire-cannon-ball brick-wall*]]])557 (defn setup-fn [type game]558 (.setMoveSpeed (.getFlyByCamera game) 50)559 (.setFrustumFar (.getCamera game) 10000)560 (let [env (environment type)561 cameras [(.getCamera game)]562 control (TerrainLodControl. env cameras)]563 ;;(.addControl env control)564 (.attachChild (.getRootNode game) env)))566 (defn environment [type]567 (let568 [mat_terrain569 (Material. (asset-manager) "Common/MatDefs/Terrain/Terrain.j3md")570 grass (.loadTexture (asset-manager) "Textures/Terrain/splat/grass.jpg")571 dirt (.loadTexture (asset-manager) "Textures/Terrain/splat/dirt.jpg")572 rock (.loadTexture (asset-manager) "Textures/Terrain/splat/road.jpg")573 heightmap-image (.loadTexture (asset-manager)574 ({:mountain "Textures/Terrain/splat/mountains512.png"575 :fortress "Textures/Terrain/splat/fortress512.png"576 }type))577 heightmap (ImageBasedHeightMap.578 (ImageToAwt/convert (.getImage heightmap-image) false true 0))579 terrain (do (.load heightmap)580 (TerrainQuad. "my terrain" 65 513 (.getHeightMap heightmap)))581 ]583 (dorun (map #(.setWrap % Texture$WrapMode/Repeat)584 [grass dirt rock]))586 (doto mat_terrain587 (.setTexture "Tex1" grass)588 (.setFloat "Tex1Scale" (float 64))590 (.setTexture "Tex2" dirt)591 (.setFloat "Tex2Scale" (float 32))593 (.setTexture "Tex3" rock)594 (.setFloat "Tex3Scale" (float 128))596 (.setTexture "Alpha"597 (.loadTexture598 (asset-manager)599 ({:mountain "Textures/Terrain/splat/alphamap.png"600 :fortress "Textures/Terrain/splat/alphamap2.png"} type))))602 (doto terrain603 (.setMaterial mat_terrain)604 (.setLocalTranslation 0 -100 0)605 (.setLocalScale 2 1 2))))609 (defn run-terrain-game [type]610 (.start611 (world612 (Node.)613 {}614 (partial setup-fn type)615 no-op)))616 #+end_src620 #+srcname: hello-animation621 #+begin_src clojure :results silent622 (ns hello.animation)623 (use 'cortex.world)624 (use 'cortex.import)625 (use 'clojure.contrib.def)626 (cortex.import/mega-import-jme3)627 (rlm.rlm-commands/help)628 (use '[hello [collision :only [lights]]])630 (defn stand631 [channel]632 (doto channel633 (.setAnim "stand" (float 0.5))634 (.setLoopMode LoopMode/DontLoop)635 (.setSpeed (float 1))))637 (defn anim-listener []638 (proxy [AnimEventListener] []639 (onAnimChange640 [control channel animation-name]641 (println-repl "RLM --- onAnimChange"))642 (onAnimCycleDone643 [control channel animation-name]644 (if (= animation-name "Walk")645 (stand channel)646 ))))648 (defn setup-fn [channel game]649 (dorun (map #(.addLight (.getRootNode game) %) (lights)))650 ;; set the color of the sky651 (.setBackgroundColor (.getViewPort game) (ColorRGBA. 0.3 0.4 0.9 1))652 ;(.setBackgroundColor (.getViewPort game) (ColorRGBA. 0 0 0 1)653 (.setAnim channel "stand")654 (doto (.getFlyByCamera game)655 (.setMoveSpeed (float 10))656 (.setRotationSpeed 1)))658 (defn walk [channel]659 (println-repl "zzz")660 (doto channel661 (.setAnim "Walk" (float 0.5))662 (.setLoopMode LoopMode/Loop)))665 (defn key-map [channel]666 {"key-space" (fn [game value]667 (if (not value)668 (walk channel)))})670 (defn player []671 (let [model (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml")672 control (.getControl model AnimControl)]673 (.setLocalScale model (float 0.5))674 (.clearListeners control)675 (.addListener control (anim-control))676 model))680 (defn run-anim-game []681 (let [ninja (player)682 control (.getControl ninja AnimControl)683 channel (.createChannel control)]684 (.start685 (world686 ninja687 (key-map channel)688 (partial setup-fn channel)689 no-op))))690 #+end_src692 * COMMENT Hello Materials693 #+srcname: material694 #+begin_src clojure :results silent695 (ns hello.material)696 (use 'cortex.world)697 (use 'cortex.import)698 (use 'cortex.util)699 (use 'clojure.contrib.def)700 (cortex.import/mega-import-jme3)701 (rlm.rlm-commands/help)703 (defn simple-cube []704 (box 1 1 1705 :position (Vector3f. -3 1.1 0)706 :material "Common/MatDefs/Misc/Unshaded.j3md"707 :texture "Interface/Logo/Monkey.jpg"708 :physical? false))710 (defn leaky-box []711 (box 1 1 1712 :position (Vector3f. 3 -1 0)713 :material "Common/MatDefs/Misc/ColoredTextured.j3md"714 :texture "Textures/ColoredTex/Monkey.png"715 :color (ColorRGBA. 1 0 1 1)716 :physical? false))718 (defn transparent-box []719 (doto720 (box 1 1 0.1721 :position Vector3f/ZERO722 :name "window frame"723 :material "Common/MatDefs/Misc/Unshaded.j3md"724 :texture "Textures/ColoredTex/Monkey.png"725 :physical? false)726 (-> (.getMaterial)727 (.getAdditionalRenderState)728 (.setBlendMode RenderState$BlendMode/Alpha))729 (.setQueueBucket RenderQueue$Bucket/Transparent)))731 (defn bumpy-sphere []732 (doto733 (sphere 2734 :position (Vector3f. 0 2 -2)735 :name "Shiny rock"736 :material "Common/MatDefs/Light/Lighting.j3md"737 :texture false738 :physical? false)739 (-> (.getMesh)740 (doto741 (.setTextureMode Sphere$TextureMode/Projected)742 (TangentBinormalGenerator/generate)))743 (-> (.getMaterial)744 (doto745 (.setTexture "DiffuseMap"746 (.loadTexture (asset-manager)747 "Textures/Terrain/Pond/Pond.jpg"))748 (.setTexture "NormalMap"749 (.loadTexture (asset-manager)750 "Textures/Terrain/Pond/Pond_normal.png"))751 (.setFloat "Shininess" (float 5))))752 (.rotate (float 1.6) 0 0)))755 (defn start-game []756 (.start757 (world758 (let [root (Node.)]759 (dorun (map #(.attachChild root %)760 [(simple-cube) (leaky-box) (transparent-box) (bumpy-sphere)]))761 root)762 {}763 (fn [world]764 (let [sun (doto (DirectionalLight.)765 (.setDirection (.normalizeLocal (Vector3f. 1 0 -2)))766 (.setColor ColorRGBA/White))]767 (.addLight (.getRootNode world) sun)))768 no-op769 )))770 #+end_src774 * COMMENT code generation776 #+begin_src clojure :tangle ../src/hello/brick_wall.clj777 <<brick-wall-header>>778 <<brick-wall-body>>779 #+end_src781 #+begin_src clojure :tangle ../src/hello/hello_simple_app.clj782 <<hello-simple-app>>783 #+end_src785 #+begin_src clojure :tangle ../src/hello/hello_simpler_app.clj786 <<hello-simpler-app>>787 #+end_src790 #+begin_src clojure :tangle ../src/hello/other_games.clj791 <<other-games>>792 #+end_src794 #+begin_src clojure :tangle ../src/hello/loop.clj795 <<hello-loop>>796 #+end_src798 #+begin_src clojure :tangle ../src/hello/collision.clj799 <<hello-collision>>800 #+end_src802 #+begin_src clojure :tangle ../src/hello/terrain.clj803 <<hello-terrain>>804 #+end_src806 #+begin_src clojure :tangle ../src/hello/animation.clj807 <<hello-animation>>808 #+end_src810 #+begin_src clojure :tangle ../src/hello/material.clj811 <<material>>812 #+end_src