annotate org/cortex.org @ 23:cab2da252494

split off the rest of cortex.org
author Robert McIntyre <rlm@mit.edu>
date Sun, 23 Oct 2011 23:54:26 -0700
parents 01e1427126af
children 775d97247dd0
rev   line source
rlm@0 1 #+title: Simulated Senses
rlm@0 2 #+author: Robert McIntyre
rlm@0 3 #+email: rlm@mit.edu
rlm@0 4 #+description: Simulating senses for AI research using JMonkeyEngine3
rlm@4 5 #+SETUPFILE: ../../aurellem/org/setup.org
rlm@4 6 #+INCLUDE: ../../aurellem/org/level-0.org
rlm@21 7 #+babel: :mkdirp yes :noweb yes :exports both
rlm@0 8
rlm@0 9
rlm@0 10 * Simulation Base
rlm@0 11
rlm@0 12
rlm@0 13 ** Hello
rlm@0 14 Here are the jmonkeyengine "Hello" programs translated to clojure.
rlm@0 15 *** Hello Simple App
rlm@23 16 Here is the hello world example for jme3 in clojure. It's a more or
rlm@23 17 less direct translation from the java source [[http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication][here]].
rlm@0 18
rlm@0 19 Of note is the fact that since we don't have access to the
rlm@0 20 =AssetManager= via extendig =SimpleApplication=, we have to build one
rlm@0 21 ourselves.
rlm@0 22
rlm@0 23 #+srcname: hello-simple-app
rlm@0 24 #+begin_src clojure :results silent
rlm@0 25 (ns hello.hello-simple-app)
rlm@0 26 (require 'cortex.import)
rlm@0 27 (use 'clojure.contrib.def)
rlm@0 28 (rlm.rlm-commands/help)
rlm@21 29 (cortex.import/mega-import-jme3)
rlm@0 30 (use 'cortex.world)
rlm@0 31
rlm@0 32
rlm@0 33 (def cube (Box. Vector3f/ZERO 1 1 1))
rlm@0 34
rlm@0 35 (def geom (Geometry. "Box" cube))
rlm@0 36
rlm@0 37 (def mat (Material. (asset-manager) "Common/MatDefs/Misc/Unshaded.j3md"))
rlm@0 38
rlm@0 39 (.setColor mat "Color" ColorRGBA/Blue)
rlm@0 40
rlm@0 41 (.setMaterial geom mat)
rlm@0 42
rlm@0 43 (defn simple-app []
rlm@0 44 (doto
rlm@0 45 (proxy [SimpleApplication] []
rlm@0 46 (simpleInitApp
rlm@0 47 []
rlm@0 48 ;; Don't take control of the mouse
rlm@0 49 (org.lwjgl.input.Mouse/setGrabbed false)
rlm@0 50 (.attachChild (.getRootNode this) geom)))
rlm@0 51 ;; don't show a menu to change options.
rlm@0 52 (.setShowSettings false)
rlm@0 53 (.setPauseOnLostFocus false)
rlm@0 54 (.setSettings *app-settings*)))
rlm@0 55 #+end_src
rlm@0 56
rlm@0 57 Running this program will begin a new jMonkeyEngine game which
rlm@0 58 displays a single blue cube.
rlm@0 59
rlm@0 60 #+begin_src clojure :exports code :results silent
rlm@0 61 (.start (hello.hello-simple-app/simple-app))
rlm@0 62 #+end_src
rlm@0 63
rlm@0 64 #+caption: the simplest JME game.
rlm@0 65 [[./images/simple-app.jpg]]
rlm@0 66
rlm@0 67
rlm@0 68
rlm@0 69 *** Hello Physics
rlm@0 70 From http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_physics
rlm@0 71
rlm@0 72 #+srcname: brick-wall-header
rlm@0 73 #+begin_src clojure :results silent
rlm@0 74 (ns hello.brick-wall)
rlm@0 75 (require 'cortex.import)
rlm@0 76 (use 'clojure.contrib.def)
rlm@0 77 (rlm.rlm-commands/help)
rlm@0 78 (cortex.import/mega-import-jme3)
rlm@0 79 (use '[pokemon [lpsolve :only [constant-map]]])
rlm@0 80 (use 'cortex.world)
rlm@0 81 #+end_src
rlm@0 82
rlm@0 83 #+srcname: brick-wall-body
rlm@0 84 #+begin_src clojure :results silent
rlm@0 85 (in-ns 'hello.brick-wall)
rlm@0 86
rlm@0 87 (defn floor
rlm@0 88 "make a sturdy, unmovable physical floor"
rlm@0 89 []
rlm@0 90 (box 20 1 20 :mass 0 :color false :position (Vector3f. 0 -2 0)))
rlm@0 91
rlm@0 92 (def brick-length 0.48)
rlm@0 93 (def brick-width 0.24)
rlm@0 94 (def brick-height 0.12)
rlm@0 95
rlm@0 96
rlm@0 97 (defn brick* [position]
rlm@0 98 (doto (box brick-length brick-height brick-width
rlm@0 99 :position position :name "brick"
rlm@0 100 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 101 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
rlm@0 102 :mass 36)
rlm@0 103 (->
rlm@0 104 (.getMesh)
rlm@0 105 (.scaleTextureCoordinates (Vector2f. 1 0.5)))
rlm@0 106 ;;(.setShadowMode RenderQueue$ShadowMode/CastAndReceive)
rlm@0 107 )
rlm@0 108 )
rlm@0 109
rlm@0 110 (defn inception-brick-wall
rlm@0 111 "construct a physical brick wall"
rlm@0 112 []
rlm@0 113 (let [node (Node. "brick-wall")]
rlm@0 114 (dorun
rlm@0 115 (map (comp #(.attachChild node %) brick*)
rlm@0 116 (for
rlm@0 117 [x (range 15)
rlm@0 118 y (range 10)
rlm@0 119 z (range 1)]
rlm@0 120 (Vector3f.
rlm@0 121 (* brick-length x 1.03)
rlm@0 122 (* brick-width y y 10)
rlm@0 123 (* brick-height z)))))
rlm@0 124 node))
rlm@0 125
rlm@0 126 (defn gravity-toggle
rlm@0 127 [new-value]
rlm@0 128 (fn [game value]
rlm@0 129 (println-repl "set gravity to " new-value)
rlm@0 130 (if value
rlm@0 131 (set-gravity* game new-value)
rlm@0 132 (set-gravity* game gravity))))
rlm@0 133
rlm@15 134 (defn fire-cannon-ball
rlm@15 135 ([node]
rlm@15 136 (fn [game value]
rlm@15 137 (if (not value)
rlm@15 138 (let [camera (.getCamera game)
rlm@15 139 cannon-ball
rlm@15 140 (sphere 0.7
rlm@15 141 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@15 142 :texture "Textures/PokeCopper.jpg"
rlm@15 143 :position
rlm@15 144 (.add (.getLocation camera)
rlm@15 145 (.mult (.getDirection camera) (float 1)))
rlm@15 146 :mass 3)] ;200 0.05
rlm@15 147 (.setShadowMode cannon-ball RenderQueue$ShadowMode/CastAndReceive)
rlm@15 148 (.setLinearVelocity
rlm@15 149 (.getControl cannon-ball RigidBodyControl)
rlm@15 150 (.mult (.getDirection camera) (float 50))) ;50
rlm@21 151 (add-element game cannon-ball (if node node (.getRootNode game)))))))
rlm@15 152 ([]
rlm@15 153 (fire-cannon-ball false)))
rlm@15 154
rlm@0 155
rlm@0 156 (defn floor* []
rlm@0 157 (doto (box 10 0.1 5 :name "floor" ;10 0.1 5 ; 240 0.1 240
rlm@0 158 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 159 :texture "Textures/Terrain/Pond/Pond.png"
rlm@0 160 :position (Vector3f. 0 -0.1 0 )
rlm@0 161 :mass 0)
rlm@0 162 (->
rlm@0 163 (.getMesh)
rlm@0 164 (.scaleTextureCoordinates (Vector2f. 3 6)));64 64
rlm@0 165 (->
rlm@0 166 (.getMaterial)
rlm@0 167 (.getTextureParam "ColorMap")
rlm@0 168 (.getTextureValue)
rlm@0 169 (.setWrap Texture$WrapMode/Repeat))
rlm@0 170 (.setShadowMode RenderQueue$ShadowMode/Receive)
rlm@0 171 ))
rlm@0 172
rlm@0 173 (defn brick-wall* []
rlm@0 174 (let [node (Node. "brick-wall")]
rlm@0 175 (dorun
rlm@0 176 (map
rlm@0 177 (comp #(.attachChild node %) brick*)
rlm@0 178 (for [y (range 15)
rlm@0 179 x (range 4)
rlm@0 180 z (range 1)]
rlm@0 181 (Vector3f.
rlm@0 182 (+ (* 2 x brick-length)
rlm@0 183 (if (even? (+ y z))
rlm@0 184 (/ brick-length 4) (/ brick-length -4)))
rlm@0 185 (+ (* brick-height (inc (* 2 y))))
rlm@0 186 (* 2 z brick-width) ))))
rlm@0 187 (.setShadowMode node RenderQueue$ShadowMode/CastAndReceive)
rlm@0 188 node))
rlm@0 189
rlm@0 190 (defn brick-wall-game-run []
rlm@0 191 (doto
rlm@0 192 (world
rlm@0 193 (doto (Node.) (.attachChild (floor*))
rlm@0 194 (.attachChild (brick-wall*))
rlm@0 195 )
rlm@0 196 {"key-i" (gravity-toggle (Vector3f. 0 0 -9.81))
rlm@0 197 "key-m" (gravity-toggle (Vector3f. 0 0 9.81))
rlm@0 198 "key-l" (gravity-toggle (Vector3f. 9.81 0 0))
rlm@0 199 "key-j" (gravity-toggle (Vector3f. -9.81 0 0))
rlm@0 200 "key-k" (gravity-toggle Vector3f/ZERO)
rlm@0 201 "key-u" (gravity-toggle (Vector3f. 0 9.81 0))
rlm@0 202 "key-o" (gravity-toggle (Vector3f. 0 -9.81 0))
rlm@0 203 "key-f" (fn[game value]
rlm@0 204 (if (not value) (add-element game (brick-wall*))))
rlm@0 205 "key-return" (fire-cannon-ball)}
rlm@0 206 position-camera
rlm@0 207 (fn [& _]))
rlm@0 208 (.start)))
rlm@0 209 #+end_src
rlm@0 210
rlm@0 211 #+begin_src clojure :results silent
rlm@0 212 (hello.brick-wall/brick-wall-game-run)
rlm@0 213 #+end_src
rlm@0 214
rlm@0 215 #+caption: the brick wall standing
rlm@0 216 [[./images/brick-wall-standing.jpg]]
rlm@0 217
rlm@0 218 #+caption: the brick wall after it has been knocked over by a "pok\eacute{}ball"
rlm@0 219 [[./images/brick-wall-knocked-down.jpg]]
rlm@0 220
rlm@0 221 *** Other Brick Games
rlm@0 222 #+srcname: other-games
rlm@0 223 #+begin_src clojure :results silent
rlm@0 224 (ns cortex.other-games
rlm@0 225 {:author "Dylan Holmes"})
rlm@0 226 (use 'cortex.world)
rlm@0 227 (use 'hello.brick-wall)
rlm@0 228 (use 'cortex.import)
rlm@0 229 (cortex.import/mega-import-jme3)
rlm@0 230
rlm@0 231 (defn scad [position]
rlm@0 232 (doto (box 0.1 0.1 0.1
rlm@0 233 :position position :name "brick"
rlm@0 234 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 235 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
rlm@0 236 :mass 20)
rlm@0 237 (->
rlm@0 238 (.getMesh)
rlm@0 239 (.scaleTextureCoordinates (Vector2f. 1 0.5))
rlm@0 240 )
rlm@0 241 (-> (.getControl RigidBodyControl)
rlm@0 242 (.setLinearVelocity (Vector3f. 0 100 0))
rlm@0 243 )
rlm@0 244
rlm@0 245 ;;(.setShadowMode RenderQueue$ShadowMode/Cast)
rlm@0 246 ))
rlm@0 247
rlm@0 248
rlm@0 249 (defn shrapnel []
rlm@0 250 (let [node (Node. "explosion-day")]
rlm@0 251 (dorun
rlm@0 252 (map
rlm@0 253 (comp #(.attachChild node %) scad)
rlm@0 254 (for [y (range 15)
rlm@0 255 x (range 4)
rlm@0 256 z (range 1)]
rlm@0 257 (Vector3f.
rlm@0 258 (+ (* 2 x brick-height)
rlm@0 259 (if (even? (+ y z)) (/ brick-height 4) (/ brick-height -4)))
rlm@0 260 (+ (* brick-height (inc (* 2 y))))
rlm@0 261 (* 2 z brick-height) ))))
rlm@0 262 node))
rlm@0 263
rlm@0 264
rlm@0 265 (def domino-height 0.48)
rlm@0 266 (def domino-thickness 0.12)
rlm@0 267 (def domino-width 0.24)
rlm@0 268
rlm@0 269 (def domino-thickness 0.05)
rlm@0 270 (def domino-width 0.5)
rlm@0 271 (def domino-height 1)
rlm@0 272
rlm@0 273 (defn domino
rlm@0 274 ([position]
rlm@0 275 (domino position (Quaternion/IDENTITY)))
rlm@0 276 ([position rotation]
rlm@0 277 (doto (box domino-width domino-height domino-thickness
rlm@0 278 :position position :name "domino"
rlm@0 279 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 280 :texture "Textures/Terrain/BrickWall/BrickWall.jpg"
rlm@0 281 :mass 1
rlm@0 282 :rotation rotation)
rlm@0 283 (.setShadowMode RenderQueue$ShadowMode/CastAndReceive)
rlm@0 284 )))
rlm@0 285
rlm@0 286
rlm@0 287 (defn domino-row []
rlm@0 288 (let [node (Node. "domino-row")]
rlm@0 289 (dorun
rlm@0 290 (map
rlm@0 291 (comp #(.attachChild node %) domino)
rlm@0 292 (for [
rlm@0 293 z (range 10)
rlm@0 294 x (range 5)
rlm@0 295 ]
rlm@0 296 (Vector3f.
rlm@0 297 (+ (* z domino-width) (* x 5 domino-width))
rlm@0 298 (/ domino-height 1)
rlm@0 299 (* -5.5 domino-thickness z) ))))
rlm@0 300
rlm@0 301 node))
rlm@0 302
rlm@0 303 (defn domino-cycle []
rlm@0 304 (let [node (Node. "domino-cycle")]
rlm@0 305 (dorun
rlm@0 306 (map
rlm@0 307 (comp #(.attachChild node %) (partial apply domino) )
rlm@0 308 (for [n (range 720)]
rlm@0 309 (let [space (* domino-height 5.5)
rlm@0 310 r (fn[n] (* (+ n 3) domino-width 0.5))
rlm@0 311 t (fn[n] (reduce
rlm@0 312 +
rlm@0 313 (map
rlm@0 314 (fn dt[n] (/ space (* 2 (Math/PI) (r n))))
rlm@0 315 (range n))))
rlm@0 316 t (t n)
rlm@0 317 r (r n)
rlm@0 318 ct (Math/cos t)
rlm@0 319 st (Math/sin t)
rlm@0 320 ]
rlm@0 321 (list
rlm@0 322 (Vector3f.
rlm@0 323 (* -1 r st)
rlm@0 324 (/ domino-height 1)
rlm@0 325 (* r ct))
rlm@0 326 (.fromAngleAxis (Quaternion.)
rlm@0 327 (- (/ 3.1415926 2) t) (Vector3f. 0 1 0))
rlm@0 328 )))
rlm@0 329 ))
rlm@0 330 node))
rlm@0 331
rlm@0 332
rlm@0 333 (defn domino-game-run []
rlm@0 334 (doto
rlm@0 335 (world
rlm@0 336 (doto (Node.) (.attachChild (floor*))
rlm@0 337 )
rlm@0 338 {"key-i" (gravity-toggle (Vector3f. 0 0 -9.81))
rlm@0 339 "key-m" (gravity-toggle (Vector3f. 0 0 9.81))
rlm@0 340 "key-l" (gravity-toggle (Vector3f. 9.81 0 0))
rlm@0 341 "key-j" (gravity-toggle (Vector3f. -9.81 0 0))
rlm@0 342 "key-k" (gravity-toggle (Vector3f. 0 9.81 0) )
rlm@0 343 "key-u" (fn[g v] ((gravity-toggle (Vector3f. 0 -0 0)) g true))
rlm@0 344 "key-o" (gravity-toggle (Vector3f. 0 -9.81 0))
rlm@0 345
rlm@0 346 "key-space"
rlm@0 347 (fn[game value]
rlm@0 348
rlm@0 349 (if (not value)
rlm@0 350 (let [d (domino (Vector3f. 0 (/ domino-height 0.25) 0)
rlm@0 351 (.fromAngleAxis (Quaternion.)
rlm@0 352 (/ Math/PI 2) (Vector3f. 0 1 0)))]
rlm@0 353 (add-element game d))))
rlm@0 354 "key-f"
rlm@0 355 (fn[game value](if (not value) (add-element game (domino-cycle))))
rlm@0 356 "key-return" (fire-cannon-ball)}
rlm@0 357 position-camera
rlm@0 358 (fn [& _]))
rlm@0 359 (.start)))
rlm@0 360 #+end_src
rlm@0 361
rlm@0 362 #+begin_src clojure :results silent
rlm@0 363 (cortex.other-games/domino-game-run)
rlm@0 364 #+end_src
rlm@0 365
rlm@0 366 #+caption: floating dominos
rlm@0 367 [[./images/dominos.jpg]]
rlm@0 368
rlm@0 369 *** Hello Loop
rlm@0 370 #+srcname: hello-loop
rlm@0 371 #+begin_src clojure :results silent
rlm@0 372 (ns hello.loop)
rlm@0 373 (use 'cortex.world)
rlm@0 374 (use 'cortex.import)
rlm@0 375 (cortex.import/mega-import-jme3)
rlm@0 376 (rlm.rlm-commands/help)
rlm@0 377
rlm@0 378 (defn blue-cube []
rlm@0 379 (box 1 1 1
rlm@0 380 :color ColorRGBA/Blue
rlm@0 381 :texture false
rlm@0 382 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 383 :name "blue-cube"
rlm@0 384 :physical? false))
rlm@0 385
rlm@0 386 (defn blue-cube-game []
rlm@0 387 (let [cube (blue-cube)
rlm@0 388 root (doto (Node.) (.attachChild cube))]
rlm@0 389 (world root
rlm@0 390 {}
rlm@0 391 no-op
rlm@0 392 (fn [game tpf]
rlm@0 393 (.rotate cube 0.0 (* 2 tpf) 0.0)))))
rlm@0 394 #+end_src
rlm@0 395
rlm@0 396 *** Hello Collision
rlm@0 397
rlm@0 398 #+srcname: hello-collision
rlm@0 399 #+begin_src clojure :results silent
rlm@0 400 (ns hello.collision)
rlm@0 401 (use 'cortex.world)
rlm@0 402 (use 'cortex.import)
rlm@0 403 (use 'clojure.contrib.def)
rlm@0 404
rlm@0 405
rlm@0 406 (cortex.import/mega-import-jme3)
rlm@0 407 (rlm.rlm-commands/help)
rlm@0 408 (use '[hello [brick-wall :only [fire-cannon-ball brick-wall*]]])
rlm@0 409
rlm@0 410
rlm@0 411 (defn environment []
rlm@0 412 (let
rlm@0 413 [scene-model
rlm@0 414 (doto
rlm@0 415 (.loadModel
rlm@0 416 (doto (asset-manager)
rlm@0 417 (.registerLocator
rlm@0 418 "/home/r/cortex/assets/zips/town.zip" ZipLocator))
rlm@0 419 "main.scene")
rlm@0 420 (.setLocalScale (float 2.0)))
rlm@0 421 collision-shape
rlm@0 422 (CollisionShapeFactory/createMeshShape #^Node scene-model)
rlm@0 423 landscape (RigidBodyControl. collision-shape 0)]
rlm@0 424 (.setShadowMode scene-model RenderQueue$ShadowMode/CastAndReceive)
rlm@0 425 (.addControl scene-model landscape)
rlm@0 426 scene-model))
rlm@0 427
rlm@0 428 (defn player-fn []
rlm@0 429 (doto
rlm@0 430 (CharacterControl.
rlm@0 431 (CapsuleCollisionShape. (float 1.5) (float 6)(float 1))
rlm@0 432 (float 0.05))
rlm@0 433 (.setJumpSpeed 20)
rlm@0 434 (.setFallSpeed 30)
rlm@0 435 (.setGravity 30) ;30
rlm@0 436 (.setPhysicsLocation (Vector3f. 0 10 0))))
rlm@0 437
rlm@0 438 (defn lights []
rlm@0 439 [(doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 1 1 1 1) (float 1))))
rlm@0 440 (doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 1 0.7 0 1) (float 1))))
rlm@0 441 (doto (DirectionalLight.)
rlm@0 442 (.setColor (.mult ColorRGBA/White (float 0.9) ))
rlm@0 443 (.setDirection (.normalizeLocal (Vector3f. 2.8 -28 2.8))))])
rlm@0 444
rlm@0 445 (defn night-lights []
rlm@0 446 [(doto (AmbientLight.) (.setColor (.mult (ColorRGBA. 0.275 0.467 0.784 1) (float 0.3))))
rlm@0 447 (doto (DirectionalLight.)
rlm@0 448 (.setColor (.mult ColorRGBA/White (float 0.2) ))
rlm@0 449 (.setDirection (.normalizeLocal (Vector3f. 2.8 -28 2.8))))])
rlm@0 450
rlm@0 451 (def player (atom (player-fn)))
rlm@0 452
rlm@0 453 (defn setup-fn [game]
rlm@0 454 (dorun (map #(.addLight (.getRootNode game) %) (lights)))
rlm@0 455 ;; set the color of the sky
rlm@0 456 (.setBackgroundColor (.getViewPort game) (ColorRGBA. 0.3 0.4 0.9 1))
rlm@0 457 ;(.setBackgroundColor (.getViewPort game) (ColorRGBA. 0 0 0 1)
rlm@0 458 (doto (.getFlyByCamera game)
rlm@0 459 (.setMoveSpeed (float 100))
rlm@0 460 (.setRotationSpeed 3))
rlm@0 461 (.add
rlm@0 462 (.getPhysicsSpace
rlm@0 463 (.getState (.getStateManager game) BulletAppState))
rlm@0 464 @player)
rlm@0 465
rlm@0 466 (doto (Node.) (.attachChild (.getRootNode game))
rlm@0 467 (.attachChild (brick-wall*))
rlm@0 468 )
rlm@0 469
rlm@0 470 )
rlm@0 471
rlm@0 472
rlm@0 473 (def walking-up? (atom false))
rlm@0 474 (def walking-down? (atom false))
rlm@0 475 (def walking-left? (atom false))
rlm@0 476 (def walking-right? (atom false))
rlm@0 477
rlm@0 478 (defn set-walk [walk-atom game value]
rlm@0 479 ;;(println-repl "setting stuff to " value)
rlm@0 480 (reset! walk-atom value))
rlm@0 481
rlm@0 482 (defn responses []
rlm@0 483 {"key-w" (partial set-walk walking-up?)
rlm@0 484 "key-d" (partial set-walk walking-right?)
rlm@0 485 "key-s" (partial set-walk walking-down?)
rlm@0 486 "key-a" (partial set-walk walking-left?)
rlm@0 487 "key-return" (fire-cannon-ball)
rlm@0 488 "key-space" (fn [game value] (.jump @player))
rlm@0 489 })
rlm@0 490
rlm@0 491 (defn update-fn
rlm@0 492 [game tpf]
rlm@0 493 (let [camera (.getCamera game)
rlm@0 494 cam-dir (.multLocal
rlm@0 495 (.clone
rlm@0 496 (.getDirection camera)) (float 0.6))
rlm@0 497 cam-left (.multLocal
rlm@0 498 (.clone
rlm@0 499 (.getLeft camera)) (float 0.4))
rlm@0 500 walk-direction (Vector3f. 0 0 0)]
rlm@0 501
rlm@0 502 (cond
rlm@0 503 @walking-up? (.addLocal walk-direction cam-dir)
rlm@0 504 @walking-right? (.addLocal walk-direction (.negate cam-left))
rlm@0 505 @walking-down? (.addLocal walk-direction (.negate cam-dir))
rlm@0 506 @walking-left? (.addLocal walk-direction cam-left))
rlm@0 507 (.setWalkDirection @player walk-direction)
rlm@0 508 (.setLocation camera (.getPhysicsLocation @player))))
rlm@0 509
rlm@0 510 (defn run-game []
rlm@0 511 (.start
rlm@0 512 (world (environment)
rlm@0 513 (responses)
rlm@0 514 setup-fn
rlm@0 515 update-fn)))
rlm@0 516 #+end_src
rlm@0 517
rlm@0 518 *** Hello Terrain
rlm@0 519 #+srcname: hello-terrain
rlm@0 520 #+begin_src clojure :results silent
rlm@0 521 (ns hello.terrain)
rlm@0 522 (use 'cortex.world)
rlm@0 523 (use 'cortex.import)
rlm@0 524 (use 'clojure.contrib.def)
rlm@0 525 (import jme3tools.converters.ImageToAwt)
rlm@0 526
rlm@0 527
rlm@0 528 (cortex.import/mega-import-jme3)
rlm@0 529 (rlm.rlm-commands/help)
rlm@0 530 (use '[hello [brick-wall :only [fire-cannon-ball brick-wall*]]])
rlm@0 531
rlm@0 532
rlm@0 533 (defn setup-fn [type game]
rlm@0 534 (.setMoveSpeed (.getFlyByCamera game) 50)
rlm@0 535 (.setFrustumFar (.getCamera game) 10000)
rlm@0 536 (let [env (environment type)
rlm@0 537 cameras [(.getCamera game)]
rlm@0 538 control (TerrainLodControl. env cameras)]
rlm@0 539 ;;(.addControl env control)
rlm@0 540 (.attachChild (.getRootNode game) env)))
rlm@0 541
rlm@0 542 (defn environment [type]
rlm@0 543 (let
rlm@0 544 [mat_terrain
rlm@0 545 (Material. (asset-manager) "Common/MatDefs/Terrain/Terrain.j3md")
rlm@0 546 grass (.loadTexture (asset-manager) "Textures/Terrain/splat/grass.jpg")
rlm@0 547 dirt (.loadTexture (asset-manager) "Textures/Terrain/splat/dirt.jpg")
rlm@0 548 rock (.loadTexture (asset-manager) "Textures/Terrain/splat/road.jpg")
rlm@0 549 heightmap-image (.loadTexture (asset-manager)
rlm@0 550 ({:mountain "Textures/Terrain/splat/mountains512.png"
rlm@0 551 :fortress "Textures/Terrain/splat/fortress512.png"
rlm@0 552 }type))
rlm@0 553 heightmap (ImageBasedHeightMap.
rlm@0 554 (ImageToAwt/convert (.getImage heightmap-image) false true 0))
rlm@0 555 terrain (do (.load heightmap)
rlm@0 556 (TerrainQuad. "my terrain" 65 513 (.getHeightMap heightmap)))
rlm@0 557 ]
rlm@0 558
rlm@0 559 (dorun (map #(.setWrap % Texture$WrapMode/Repeat)
rlm@0 560 [grass dirt rock]))
rlm@0 561
rlm@0 562 (doto mat_terrain
rlm@0 563 (.setTexture "Tex1" grass)
rlm@0 564 (.setFloat "Tex1Scale" (float 64))
rlm@0 565
rlm@0 566 (.setTexture "Tex2" dirt)
rlm@0 567 (.setFloat "Tex2Scale" (float 32))
rlm@0 568
rlm@0 569 (.setTexture "Tex3" rock)
rlm@0 570 (.setFloat "Tex3Scale" (float 128))
rlm@0 571
rlm@0 572 (.setTexture "Alpha"
rlm@0 573 (.loadTexture
rlm@0 574 (asset-manager)
rlm@0 575 ({:mountain "Textures/Terrain/splat/alphamap.png"
rlm@0 576 :fortress "Textures/Terrain/splat/alphamap2.png"} type))))
rlm@0 577
rlm@0 578 (doto terrain
rlm@0 579 (.setMaterial mat_terrain)
rlm@0 580 (.setLocalTranslation 0 -100 0)
rlm@0 581 (.setLocalScale 2 1 2))))
rlm@0 582
rlm@0 583
rlm@0 584
rlm@0 585 (defn run-terrain-game [type]
rlm@0 586 (.start
rlm@0 587 (world
rlm@0 588 (Node.)
rlm@0 589 {}
rlm@0 590 (partial setup-fn type)
rlm@0 591 no-op)))
rlm@0 592 #+end_src
rlm@0 593
rlm@0 594
rlm@0 595
rlm@0 596 #+srcname: hello-animation
rlm@0 597 #+begin_src clojure :results silent
rlm@0 598 (ns hello.animation)
rlm@0 599 (use 'cortex.world)
rlm@0 600 (use 'cortex.import)
rlm@0 601 (use 'clojure.contrib.def)
rlm@0 602 (cortex.import/mega-import-jme3)
rlm@0 603 (rlm.rlm-commands/help)
rlm@0 604 (use '[hello [collision :only [lights]]])
rlm@0 605
rlm@0 606 (defn stand
rlm@0 607 [channel]
rlm@0 608 (doto channel
rlm@0 609 (.setAnim "stand" (float 0.5))
rlm@0 610 (.setLoopMode LoopMode/DontLoop)
rlm@0 611 (.setSpeed (float 1))))
rlm@0 612
rlm@0 613 (defn anim-listener []
rlm@0 614 (proxy [AnimEventListener] []
rlm@0 615 (onAnimChange
rlm@0 616 [control channel animation-name]
rlm@0 617 (println-repl "RLM --- onAnimChange"))
rlm@0 618 (onAnimCycleDone
rlm@0 619 [control channel animation-name]
rlm@0 620 (if (= animation-name "Walk")
rlm@0 621 (stand channel)
rlm@0 622 ))))
rlm@0 623
rlm@0 624 (defn setup-fn [channel game]
rlm@0 625 (dorun (map #(.addLight (.getRootNode game) %) (lights)))
rlm@0 626 ;; set the color of the sky
rlm@0 627 (.setBackgroundColor (.getViewPort game) (ColorRGBA. 0.3 0.4 0.9 1))
rlm@0 628 ;(.setBackgroundColor (.getViewPort game) (ColorRGBA. 0 0 0 1)
rlm@0 629 (.setAnim channel "stand")
rlm@0 630 (doto (.getFlyByCamera game)
rlm@0 631 (.setMoveSpeed (float 10))
rlm@0 632 (.setRotationSpeed 1)))
rlm@0 633
rlm@0 634 (defn walk [channel]
rlm@0 635 (println-repl "zzz")
rlm@0 636 (doto channel
rlm@0 637 (.setAnim "Walk" (float 0.5))
rlm@0 638 (.setLoopMode LoopMode/Loop)))
rlm@0 639
rlm@0 640
rlm@0 641 (defn key-map [channel]
rlm@0 642 {"key-space" (fn [game value]
rlm@0 643 (if (not value)
rlm@0 644 (walk channel)))})
rlm@0 645
rlm@0 646 (defn player []
rlm@0 647 (let [model (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml")
rlm@0 648 control (.getControl model AnimControl)]
rlm@0 649 (.setLocalScale model (float 0.5))
rlm@0 650 (.clearListeners control)
rlm@0 651 (.addListener control (anim-control))
rlm@0 652 model))
rlm@0 653
rlm@0 654
rlm@0 655
rlm@0 656 (defn run-anim-game []
rlm@0 657 (let [ninja (player)
rlm@0 658 control (.getControl ninja AnimControl)
rlm@0 659 channel (.createChannel control)]
rlm@0 660 (.start
rlm@0 661 (world
rlm@0 662 ninja
rlm@0 663 (key-map channel)
rlm@0 664 (partial setup-fn channel)
rlm@0 665 no-op))))
rlm@0 666 #+end_src
rlm@0 667
rlm@0 668 *** Hello Materials
rlm@0 669 #+srcname: material
rlm@0 670 #+begin_src clojure :results silent
rlm@0 671 (ns hello.material)
rlm@0 672 (use 'cortex.world)
rlm@0 673 (use 'cortex.import)
rlm@0 674 (use 'clojure.contrib.def)
rlm@0 675 (cortex.import/mega-import-jme3)
rlm@0 676 (rlm.rlm-commands/help)
rlm@0 677
rlm@0 678 (defn simple-cube []
rlm@0 679 (box 1 1 1
rlm@0 680 :position (Vector3f. -3 1.1 0)
rlm@0 681 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 682 :texture "Interface/Logo/Monkey.jpg"
rlm@0 683 :physical? false))
rlm@0 684
rlm@0 685 (defn leaky-box []
rlm@0 686 (box 1 1 1
rlm@0 687 :position (Vector3f. 3 -1 0)
rlm@0 688 :material "Common/MatDefs/Misc/ColoredTextured.j3md"
rlm@0 689 :texture "Textures/ColoredTex/Monkey.png"
rlm@0 690 :color (ColorRGBA. 1 0 1 1)
rlm@0 691 :physical? false))
rlm@0 692
rlm@0 693 (defn transparent-box []
rlm@0 694 (doto
rlm@0 695 (box 1 1 0.1
rlm@0 696 :position Vector3f/ZERO
rlm@0 697 :name "window frame"
rlm@0 698 :material "Common/MatDefs/Misc/Unshaded.j3md"
rlm@0 699 :texture "Textures/ColoredTex/Monkey.png"
rlm@0 700 :physical? false)
rlm@0 701 (-> (.getMaterial)
rlm@0 702 (.getAdditionalRenderState)
rlm@0 703 (.setBlendMode RenderState$BlendMode/Alpha))
rlm@0 704 (.setQueueBucket RenderQueue$Bucket/Transparent)))
rlm@0 705
rlm@0 706 (defn bumpy-sphere []
rlm@0 707 (doto
rlm@0 708 (sphere 2
rlm@0 709 :position (Vector3f. 0 2 -2)
rlm@0 710 :name "Shiny rock"
rlm@0 711 :material "Common/MatDefs/Light/Lighting.j3md"
rlm@0 712 :texture false
rlm@0 713 :physical? false)
rlm@0 714 (-> (.getMesh)
rlm@0 715 (doto
rlm@0 716 (.setTextureMode Sphere$TextureMode/Projected)
rlm@0 717 (TangentBinormalGenerator/generate)))
rlm@0 718 (-> (.getMaterial)
rlm@0 719 (doto
rlm@0 720 (.setTexture "DiffuseMap" (.loadTexture (asset-manager)
rlm@0 721 "Textures/Terrain/Pond/Pond.png"))
rlm@0 722 (.setTexture "NormalMap" (.loadTexture (asset-manager)
rlm@0 723 "Textures/Terrain/Pond/Pond_normal.png"))
rlm@0 724 (.setFloat "Shininess" (float 5))))
rlm@0 725 (.rotate (float 1.6) 0 0)))
rlm@0 726
rlm@0 727
rlm@0 728 (defn start-game []
rlm@0 729 (.start
rlm@0 730 (world
rlm@0 731 (let [root (Node.)]
rlm@0 732 (dorun (map #(.attachChild root %)
rlm@0 733 [(simple-cube) (leaky-box) (transparent-box) (bumpy-sphere)]))
rlm@0 734 root)
rlm@0 735 {}
rlm@0 736 (fn [world]
rlm@0 737 (let [sun (doto (DirectionalLight.)
rlm@0 738 (.setDirection (.normalizeLocal (Vector3f. 1 0 -2)))
rlm@0 739 (.setColor ColorRGBA/White))]
rlm@0 740 (.addLight (.getRootNode world) sun)))
rlm@0 741 no-op
rlm@0 742 )))
rlm@0 743 #+end_src
rlm@0 744
rlm@0 745
rlm@0 746
rlm@0 747 * The Body
rlm@0 748 ** Eyes
rlm@0 749
rlm@0 750 Ultimately I want to make creatures with eyes. Each eye can be
rlm@0 751 independely moved and should see its own version of the world
rlm@0 752 depending on where it is.
rlm@0 753 #+srcname: eyes
rlm@0 754 #+begin_src clojure
rlm@0 755 (ns body.eye)
rlm@0 756 (use 'cortex.world)
rlm@0 757 (use 'cortex.import)
rlm@0 758 (use 'clojure.contrib.def)
rlm@0 759 (cortex.import/mega-import-jme3)
rlm@0 760 (rlm.rlm-commands/help)
rlm@0 761 (import java.nio.ByteBuffer)
rlm@0 762 (import java.awt.image.BufferedImage)
rlm@0 763 (import java.awt.Color)
rlm@0 764 (import java.awt.Dimension)
rlm@0 765 (import java.awt.Graphics)
rlm@0 766 (import java.awt.Graphics2D)
rlm@0 767 (import java.awt.event.WindowAdapter)
rlm@0 768 (import java.awt.event.WindowEvent)
rlm@0 769 (import java.awt.image.BufferedImage)
rlm@0 770 (import java.nio.ByteBuffer)
rlm@0 771 (import javax.swing.JFrame)
rlm@0 772 (import javax.swing.JPanel)
rlm@0 773 (import javax.swing.SwingUtilities)
rlm@0 774 (import javax.swing.ImageIcon)
rlm@0 775 (import javax.swing.JOptionPane)
rlm@0 776 (import java.awt.image.ImageObserver)
rlm@0 777
rlm@0 778
rlm@0 779
rlm@0 780 (defn scene-processor
rlm@0 781 "deals with converting FrameBuffers to BufferedImages so
rlm@0 782 that the continuation function can be defined only in terms
rlm@0 783 of what it does with BufferedImages"
rlm@0 784 [continuation]
rlm@0 785 (let [byte-buffer (atom nil)
rlm@0 786 renderer (atom nil)
rlm@0 787 image (atom nil)]
rlm@0 788 (proxy [SceneProcessor] []
rlm@0 789 (initialize
rlm@0 790 [renderManager viewPort]
rlm@0 791 (let [cam (.getCamera viewPort)
rlm@0 792 width (.getWidth cam)
rlm@0 793 height (.getHeight cam)]
rlm@0 794 (reset! renderer (.getRenderer renderManager))
rlm@0 795 (reset! byte-buffer
rlm@0 796 (BufferUtils/createByteBuffer
rlm@0 797 (* width height 4)))
rlm@0 798 (reset! image (BufferedImage. width height
rlm@0 799 BufferedImage/TYPE_4BYTE_ABGR))))
rlm@0 800 (isInitialized [] (not (nil? @byte-buffer)))
rlm@0 801 (reshape [_ _ _])
rlm@0 802 (preFrame [_])
rlm@0 803 (postQueue [_])
rlm@0 804 (postFrame
rlm@0 805 [#^FrameBuffer fb]
rlm@0 806 (.clear @byte-buffer)
rlm@0 807 (.readFrameBuffer @renderer fb @byte-buffer)
rlm@0 808 (Screenshots/convertScreenShot @byte-buffer @image)
rlm@0 809 (continuation @image))
rlm@0 810 (cleanup []))))
rlm@0 811
rlm@0 812 (defn add-eye
rlm@0 813 "Add an eye to the world, and call continuation on
rlm@0 814 every frame produced"
rlm@0 815 [world camera continuation]
rlm@0 816 (let [width (.getWidth camera)
rlm@0 817 height (.getHeight camera)
rlm@0 818 render-manager (.getRenderManager world)
rlm@0 819 viewport (.createMainView render-manager "eye-view" camera)]
rlm@0 820 (doto viewport
rlm@0 821 (.setBackgroundColor ColorRGBA/Black)
rlm@0 822 (.setClearFlags true true true)
rlm@0 823 (.addProcessor (scene-processor continuation))
rlm@0 824 (.attachScene (.getRootNode world)))))
rlm@0 825
rlm@0 826 (defn make-display-frame [display width height]
rlm@0 827 (SwingUtilities/invokeLater
rlm@0 828 (fn []
rlm@0 829 (.setPreferredSize display (Dimension. width height))
rlm@0 830 (doto (JFrame. "Eye Camera!")
rlm@0 831 (-> (.getContentPane) (.add display))
rlm@0 832 (.setDefaultCloseOperation JFrame/DISPOSE_ON_CLOSE)
rlm@0 833 (.pack)
rlm@0 834 (.setLocationRelativeTo nil)
rlm@0 835 (.setResizable false)
rlm@0 836 (.setVisible true)))))
rlm@0 837
rlm@0 838 (defn image-monitor [#^BufferedImage image]
rlm@0 839 (proxy [JPanel] []
rlm@0 840 (paintComponent
rlm@0 841 [g]
rlm@0 842 (proxy-super paintComponent g)
rlm@0 843 (locking image
rlm@0 844 (.drawImage g image 0 0
rlm@0 845 (proxy [ImageObserver]
rlm@0 846 []
rlm@0 847 (imageUpdate
rlm@0 848 []
rlm@0 849 (proxy-super imageUpdate))))))))
rlm@0 850
rlm@0 851 (defn movie-image []
rlm@0 852 (let [setup
rlm@0 853 (runonce
rlm@0 854 (fn [#^BufferedImage image]
rlm@0 855 (let [width (.getWidth image)
rlm@0 856 height (.getHeight image)
rlm@0 857 display (image-monitor image)
rlm@0 858 frame (make-display-frame display width height)]
rlm@0 859 display)))]
rlm@0 860 (fn [#^BufferedImage image]
rlm@0 861 (.repaint (setup image)))))
rlm@0 862
rlm@0 863
rlm@0 864 (defn observer
rlm@0 865 "place thy eye!"
rlm@0 866 [world camera]
rlm@0 867 (let [eye camera
rlm@0 868 width (.getWidth eye)
rlm@0 869 height (.getHeight eye)]
rlm@0 870 (no-exceptions
rlm@0 871 (add-eye
rlm@0 872 world
rlm@0 873 eye
rlm@0 874 (movie-image)))))
rlm@0 875 #+end_src
rlm@0 876
rlm@0 877 #+srcname: test-vision
rlm@0 878 #+begin_src clojure
rlm@0 879
rlm@0 880 (ns test.vision)
rlm@0 881 (use 'cortex.world)
rlm@0 882 (use 'cortex.import)
rlm@0 883 (use 'clojure.contrib.def)
rlm@0 884 (use 'body.eye)
rlm@0 885 (cortex.import/mega-import-jme3)
rlm@0 886 (rlm.rlm-commands/help)
rlm@0 887 (import java.nio.ByteBuffer)
rlm@0 888 (import java.awt.image.BufferedImage)
rlm@0 889 (import java.awt.Color)
rlm@0 890 (import java.awt.Dimension)
rlm@0 891 (import java.awt.Graphics)
rlm@0 892 (import java.awt.Graphics2D)
rlm@0 893 (import java.awt.event.WindowAdapter)
rlm@0 894 (import java.awt.event.WindowEvent)
rlm@0 895 (import java.awt.image.BufferedImage)
rlm@0 896 (import java.nio.ByteBuffer)
rlm@0 897 (import javax.swing.JFrame)
rlm@0 898 (import javax.swing.JPanel)
rlm@0 899 (import javax.swing.SwingUtilities)
rlm@0 900 (import javax.swing.ImageIcon)
rlm@0 901 (import javax.swing.JOptionPane)
rlm@0 902 (import java.awt.image.ImageObserver)
rlm@0 903
rlm@0 904
rlm@0 905 (def width 200)
rlm@0 906 (def height 200)
rlm@0 907
rlm@0 908 (defn camera []
rlm@0 909 (doto (Camera. width height)
rlm@0 910 (.setFrustumPerspective 45 1 1 1000)
rlm@0 911 (.setLocation (Vector3f. -3 0 -5))
rlm@0 912 (.lookAt Vector3f/ZERO Vector3f/UNIT_Y)))
rlm@0 913
rlm@0 914 (defn camera2 []
rlm@0 915 (doto (Camera. width height)
rlm@0 916 (.setFrustumPerspective 45 1 1 1000)
rlm@0 917 (.setLocation (Vector3f. 3 0 -5))
rlm@0 918 (.lookAt Vector3f/ZERO Vector3f/UNIT_Y)))
rlm@0 919
rlm@0 920 (defn setup-fn [world]
rlm@0 921 (let [eye (camera)
rlm@0 922 width (.getWidth eye)
rlm@0 923 height (.getHeight eye)]
rlm@0 924 (no-exceptions
rlm@0 925 (add-eye
rlm@0 926 world
rlm@0 927 eye
rlm@0 928 (runonce visual))
rlm@0 929 (add-eye
rlm@0 930 world
rlm@0 931 (camera2)
rlm@0 932 (runonce visual)))))
rlm@0 933
rlm@0 934 (defn spider-eye [position]
rlm@0 935 (doto (Camera. 200 200 )
rlm@0 936 (.setFrustumPerspective 45 1 1 1000)
rlm@0 937 (.setLocation position)
rlm@0 938 (.lookAt Vector3f/ZERO Vector3f/UNIT_Y)))
rlm@0 939
rlm@0 940 (defn setup-fn* [world]
rlm@0 941 (let [eye (camera)
rlm@0 942 width (.getWidth eye)
rlm@0 943 height (.getHeight eye)]
rlm@0 944 ;;(.setClearFlags (.getViewPort world) true true true)
rlm@0 945 (observer world (.getCamera world))
rlm@0 946 (observer world (spider-eye (Vector3f. 3 0 -5)))
rlm@0 947 ;;(observer world (spider-eye (Vector3f. 0 0 -5)))
rlm@0 948 ;; (observer world (spider-eye (Vector3f. -3 0 -5)))
rlm@0 949 ;; (observer world (spider-eye (Vector3f. 0 3 -5)))
rlm@0 950 ;; (observer world (spider-eye (Vector3f. 0 -3 -5)))
rlm@0 951 ;; (observer world (spider-eye (Vector3f. 3 3 -5)))
rlm@0 952 ;; (observer world (spider-eye (Vector3f. -3 3 -5)))
rlm@0 953 ;; (observer world (spider-eye (Vector3f. 3 -3 -5)))
rlm@0 954 ;; (observer world (spider-eye (Vector3f. -3 -3 -5)))
rlm@0 955
rlm@0 956 )
rlm@0 957 world)
rlm@0 958
rlm@0 959 (defn test-world []
rlm@0 960 (let [thing (box 1 1 1 :physical? false)]
rlm@0 961 (world
rlm@0 962 (doto (Node.)
rlm@0 963 (.attachChild thing))
rlm@0 964 {}
rlm@0 965 setup-fn
rlm@0 966 (fn [world tpf]
rlm@0 967 (.rotate thing (* tpf 0.2) 0 0)
rlm@0 968 ))))
rlm@0 969
rlm@0 970
rlm@0 971 #+end_src
rlm@0 972
rlm@0 973
rlm@0 974 #+results: eyes
rlm@0 975 : #'body.eye/test-world
rlm@0 976
rlm@0 977 Note the use of continuation passing style for connecting the eye to a
rlm@0 978 function to process the output. The example code will create two
rlm@0 979 videos of the same rotating cube from different angles, sutiable for
rlm@0 980 stereoscopic vision.
rlm@0 981
rlm@0 982
rlm@0 983
rlm@0 984
rlm@0 985
rlm@0 986
rlm@0 987 * COMMENT code generation
rlm@0 988 #+begin_src clojure :tangle ../src/cortex/import.clj
rlm@0 989 <<import>>
rlm@0 990 #+end_src
rlm@0 991
rlm@0 992 #+begin_src clojure :tangle ../src/hello/brick_wall.clj
rlm@0 993 <<brick-wall-header>>
rlm@0 994 <<brick-wall-body>>
rlm@0 995 #+end_src
rlm@0 996
rlm@0 997 #+begin_src clojure :tangle ../src/hello/hello_simple_app.clj
rlm@0 998 <<hello-simple-app>>
rlm@0 999 #+end_src
rlm@0 1000
rlm@0 1001 #+begin_src clojure :tangle ../src/cortex/world.clj
rlm@0 1002 <<world-inputs>>
rlm@0 1003 <<world>>
rlm@0 1004 <<world-shapes>>
rlm@0 1005 <<world-view>>
rlm@0 1006 #+end_src
rlm@0 1007
rlm@0 1008 #+begin_src clojure :tangle ../src/cortex/other_games.clj
rlm@0 1009 <<other-games>>
rlm@0 1010 #+end_src
rlm@0 1011
rlm@0 1012 #+begin_src clojure :tangle ../src/hello/loop.clj
rlm@0 1013 <<hello-loop>>
rlm@0 1014 #+end_src
rlm@0 1015
rlm@0 1016 #+begin_src clojure :tangle ../src/hello/collision.clj
rlm@0 1017 <<hello-collision>>
rlm@0 1018 #+end_src
rlm@0 1019
rlm@0 1020 #+begin_src clojure :tangle ../src/hello/terrain.clj
rlm@0 1021 <<hello-terrain>>
rlm@0 1022 #+end_src
rlm@0 1023
rlm@0 1024 #+begin_src clojure :tangle ../src/hello/animation.clj
rlm@0 1025 <<hello-animation>>
rlm@0 1026 #+end_src
rlm@0 1027
rlm@0 1028 #+begin_src clojure :tangle ../src/hello/material.clj
rlm@0 1029 <<material>>
rlm@0 1030 #+end_src
rlm@0 1031
rlm@0 1032 #+begin_src clojure :tangle ../src/body/eye.clj
rlm@0 1033 <<eyes>>
rlm@0 1034 #+end_src
rlm@0 1035
rlm@0 1036 #+begin_src clojure :tangle ../src/test/vision.clj
rlm@0 1037 <<test-vision>>
rlm@0 1038 #+end_src
rlm@0 1039
rlm@0 1040
rlm@0 1041