annotate org/body.org @ 49:96a41b384100

working on animations in jMonkeyEngine3
author Robert McIntyre <rlm@mit.edu>
date Sat, 12 Nov 2011 16:52:38 -0700
parents ee55966ce7f6
children b1b90c4ab0bf
rev   line source
rlm@0 1 #+title: The BODY!!!
rlm@0 2 #+author: Robert McIntyre
rlm@0 3 #+email: rlm@mit.edu
rlm@4 4 #+description: Simulating a body (movement, touch, propioception) in jMonkeyEngine3.
rlm@4 5 #+SETUPFILE: ../../aurellem/org/setup.org
rlm@4 6 #+INCLUDE: ../../aurellem/org/level-0.org
rlm@4 7
rlm@45 8 * Body
rlm@0 9
rlm@0 10 #+srcname: body-main
rlm@0 11 #+begin_src clojure
rlm@44 12 (ns cortex.body
rlm@44 13 (use (cortex world util import)))
rlm@44 14
rlm@0 15 (use 'clojure.contrib.def)
rlm@0 16 (cortex.import/mega-import-jme3)
rlm@0 17 (rlm.rlm-commands/help)
rlm@0 18
rlm@44 19 ;;(.loadModel
rlm@44 20 ;; (doto (asset-manager)
rlm@44 21 ;; (.registerLoader BlenderModelLoader (into-array String ["blend"])))
rlm@44 22 ;; "Models/person/person.blend")
rlm@44 23
rlm@44 24 (defn view-model [^String model]
rlm@44 25 (view
rlm@44 26 (.loadModel
rlm@44 27 (doto (asset-manager)
rlm@44 28 (.registerLoader BlenderModelLoader (into-array String ["blend"])))
rlm@44 29 model)))
rlm@49 30
rlm@49 31 (defn load-blender-scene [^String model]
rlm@49 32 (.loadModel
rlm@49 33 (doto (asset-manager)
rlm@49 34 (.registerLoader BlenderLoader (into-array String ["blend"])))
rlm@49 35 model))
rlm@49 36
rlm@49 37 (defn load-blender-model
rlm@49 38 [^String model]
rlm@49 39 (.loadModel
rlm@49 40 (doto (asset-manager)
rlm@49 41 (.registerLoader BlenderModelLoader (into-array String ["blend"])))
rlm@49 42 model))
rlm@49 43
rlm@49 44
rlm@49 45 (defn worm
rlm@49 46 []
rlm@49 47 (.loadModel (asset-manager) "Models/anim/worm.mesh.xml"))
rlm@49 48
rlm@49 49
rlm@49 50 (defn worm
rlm@49 51 []
rlm@49 52 (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml"))
rlm@49 53
rlm@49 54
rlm@49 55
rlm@49 56 (defn test-worm-anim []
rlm@49 57
rlm@49 58 (let [the-worm (worm)
rlm@49 59 anim-control (.getControl (worm) AnimControl)
rlm@49 60 channel (doto (.createChannel anim-control)
rlm@49 61 (.addAllBones)
rlm@49 62 (.setLoopMode LoopMode/Loop))
rlm@49 63
rlm@49 64 play-anim
rlm@49 65 (fn [world pressed]
rlm@49 66 (if (not pressed)
rlm@49 67 (do
rlm@49 68 (println-repl "space is pressed")
rlm@49 69 (.setAnim channel "Walk"))))
rlm@49 70
rlm@49 71 ]
rlm@49 72
rlm@49 73 (.start
rlm@49 74 (world
rlm@49 75 (doto (Node.)
rlm@49 76 (.attachChild the-worm))
rlm@49 77 {"key-space" play-anim}
rlm@49 78 light-up-everything
rlm@49 79 no-op
rlm@49 80 )
rlm@49 81
rlm@49 82
rlm@49 83 )))
rlm@49 84
rlm@49 85
rlm@49 86
rlm@49 87
rlm@49 88
rlm@0 89 #+end_src
rlm@0 90
rlm@0 91
rlm@0 92
rlm@0 93
rlm@0 94
rlm@0 95
rlm@0 96
rlm@0 97
rlm@0 98 * COMMENT generate Source.
rlm@44 99 #+begin_src clojure :tangle ../src/cortex/body.clj
rlm@0 100 <<body-main>>
rlm@0 101 #+end_src
rlm@0 102