rlm@73: rlm@73: rlm@73: * TODO goals for today rlm@73: - [X] create falling cube in blender rlm@73: - [ ] record falling cube animation in blender rlm@73: - [ ] import falling cube in jMonkeyEngine rlm@73: - [ ] record jmonkeyEngine cube animation rlm@73: rlm@73: rlm@73: #+name: integration rlm@73: #+begin_src clojure rlm@73: (ns cortex.integration rlm@73: "Enable loading creatures with senses from blender." rlm@73: {:author "Robert McIntyre"}) rlm@73: rlm@73: ;; TODO remove this! rlm@73: (require 'cortex.import) rlm@73: (cortex.import/mega-import-jme3) rlm@73: (use '(cortex world util)) rlm@73: rlm@73: (rlm.rlm-commands/help) rlm@73: rlm@73: rlm@73: rlm@73: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rlm@73: rlm@73: ;; this could be a good way to give objects special properties like rlm@73: ;; being eyes and the like rlm@73: (defn load-blender-model rlm@73: "Load a .blend file using an asset folder relative path." rlm@73: [^String model] rlm@73: (.loadModel rlm@73: (doto (asset-manager) rlm@73: (.registerLoader BlenderModelLoader (into-array String ["blend"]))) rlm@73: model)) rlm@73: rlm@73: (defn scene [] rlm@73: (load-blender-model "Models/property/test.blend")) rlm@73: rlm@73: (defn test-GET! [] rlm@73: (.getUserData rlm@73: (.getChild rlm@73: (scene) 0) rlm@73: "properties")) rlm@73: rlm@73: (defn make-eye [] rlm@73: (println "hi")) rlm@73: rlm@73: (defn test-eval-prop [] rlm@73: (eval (read-string (.findValue (test-GET!) "form")))) rlm@73: rlm@73: ;; the properties are saved along with the blender file. rlm@73: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rlm@73: rlm@73: rlm@73: rlm@73: ;; Sensors are thunk-functions that return sensory data. rlm@73: ;; Effectors take data and cause changes in the results of the sensor rlm@73: ;; functions. rlm@73: rlm@73: (defrecord Creature [sensors effectors]) rlm@73: rlm@73: rlm@73: rlm@73: rlm@73: rlm@73: rlm@73: rlm@73: rlm@73: rlm@73: #+end_src rlm@73: rlm@73: rlm@73: rlm@73: #+begin_src clojure :tangle ../src/cortex/integration.clj rlm@73: <> rlm@73: #+end_src rlm@73: rlm@73: rlm@73: