diff 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
line wrap: on
line diff
     1.1 --- a/org/body.org	Fri Nov 11 04:07:44 2011 -0700
     1.2 +++ b/org/body.org	Sat Nov 12 16:52:38 2011 -0700
     1.3 @@ -27,6 +27,65 @@
     1.4      (doto (asset-manager)
     1.5        (.registerLoader BlenderModelLoader (into-array String ["blend"])))
     1.6      model)))
     1.7 +
     1.8 +(defn load-blender-scene [^String model]
     1.9 +  (.loadModel
    1.10 +   (doto (asset-manager)
    1.11 +     (.registerLoader BlenderLoader (into-array String ["blend"])))
    1.12 +    model))
    1.13 +
    1.14 +(defn load-blender-model 
    1.15 +  [^String model]
    1.16 +  (.loadModel
    1.17 +   (doto (asset-manager)
    1.18 +     (.registerLoader BlenderModelLoader (into-array String ["blend"])))
    1.19 +   model))
    1.20 +
    1.21 +
    1.22 +(defn worm
    1.23 +  []
    1.24 +  (.loadModel (asset-manager) "Models/anim/worm.mesh.xml"))
    1.25 +
    1.26 +
    1.27 +(defn worm
    1.28 +  []
    1.29 +  (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml"))
    1.30 +
    1.31 +
    1.32 +
    1.33 +(defn test-worm-anim []
    1.34 +  
    1.35 +  (let [the-worm (worm)
    1.36 +        anim-control (.getControl (worm) AnimControl)
    1.37 +        channel (doto (.createChannel anim-control)
    1.38 +                  (.addAllBones)
    1.39 +                  (.setLoopMode LoopMode/Loop))
    1.40 +
    1.41 +        play-anim
    1.42 +        (fn [world pressed]
    1.43 +          (if (not pressed)
    1.44 +            (do 
    1.45 +              (println-repl "space is pressed")
    1.46 +              (.setAnim channel "Walk"))))
    1.47 +
    1.48 +        ]
    1.49 +
    1.50 +    (.start 
    1.51 +     (world
    1.52 +      (doto (Node.)
    1.53 +        (.attachChild the-worm))
    1.54 +      {"key-space" play-anim}
    1.55 +      light-up-everything
    1.56 +      no-op
    1.57 +      )
    1.58 +  
    1.59 +     
    1.60 +     )))
    1.61 +    
    1.62 +    
    1.63 +
    1.64 +
    1.65 +
    1.66  #+end_src
    1.67  
    1.68