comparison org/integration.org @ 73:257a86328adb

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