annotate org/integration.org @ 82:6b4ca076285e

making some progress on cone joints...
author Robert McIntyre <rlm@mit.edu>
date Fri, 06 Jan 2012 02:03:43 -0700
parents 257a86328adb
children
rev   line source
rlm@73 1
rlm@73 2
rlm@73 3 * TODO goals for today
rlm@73 4 - [X] create falling cube in blender
rlm@73 5 - [ ] record falling cube animation in blender
rlm@73 6 - [ ] import falling cube in jMonkeyEngine
rlm@73 7 - [ ] record jmonkeyEngine cube animation
rlm@73 8
rlm@73 9
rlm@73 10 #+name: integration
rlm@73 11 #+begin_src clojure
rlm@73 12 (ns cortex.integration
rlm@73 13 "Enable loading creatures with senses from blender."
rlm@73 14 {:author "Robert McIntyre"})
rlm@73 15
rlm@73 16 ;; TODO remove this!
rlm@73 17 (require 'cortex.import)
rlm@73 18 (cortex.import/mega-import-jme3)
rlm@73 19 (use '(cortex world util))
rlm@73 20
rlm@73 21 (rlm.rlm-commands/help)
rlm@73 22
rlm@73 23
rlm@73 24
rlm@73 25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rlm@73 26
rlm@73 27 ;; this could be a good way to give objects special properties like
rlm@73 28 ;; being eyes and the like
rlm@73 29 (defn load-blender-model
rlm@73 30 "Load a .blend file using an asset folder relative path."
rlm@73 31 [^String model]
rlm@73 32 (.loadModel
rlm@73 33 (doto (asset-manager)
rlm@73 34 (.registerLoader BlenderModelLoader (into-array String ["blend"])))
rlm@73 35 model))
rlm@73 36
rlm@73 37 (defn scene []
rlm@73 38 (load-blender-model "Models/property/test.blend"))
rlm@73 39
rlm@73 40 (defn test-GET! []
rlm@73 41 (.getUserData
rlm@73 42 (.getChild
rlm@73 43 (scene) 0)
rlm@73 44 "properties"))
rlm@73 45
rlm@73 46 (defn make-eye []
rlm@73 47 (println "hi"))
rlm@73 48
rlm@73 49 (defn test-eval-prop []
rlm@73 50 (eval (read-string (.findValue (test-GET!) "form"))))
rlm@73 51
rlm@73 52 ;; the properties are saved along with the blender file.
rlm@73 53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rlm@73 54
rlm@73 55
rlm@73 56
rlm@73 57 ;; Sensors are thunk-functions that return sensory data.
rlm@73 58 ;; Effectors take data and cause changes in the results of the sensor
rlm@73 59 ;; functions.
rlm@73 60
rlm@73 61 (defrecord Creature [sensors effectors])
rlm@73 62
rlm@73 63
rlm@73 64
rlm@73 65
rlm@73 66
rlm@73 67
rlm@73 68
rlm@73 69
rlm@73 70
rlm@73 71 #+end_src
rlm@73 72
rlm@73 73
rlm@73 74
rlm@73 75 #+begin_src clojure :tangle ../src/cortex/integration.clj
rlm@73 76 <<integration>>
rlm@73 77 #+end_src
rlm@73 78
rlm@73 79
rlm@73 80