comparison org/integration.org @ 297:d1206b11ae2d

creating final video
author Robert McIntyre <rlm@mit.edu>
date Thu, 16 Feb 2012 12:48:51 -0700
parents 1eed471e2ebf
children 85f3ff3e3f26
comparison
equal deleted inserted replaced
296:1eed471e2ebf 297:d1206b11ae2d
28 (rlm.rlm-commands/help) 28 (rlm.rlm-commands/help)
29 29
30 (def hand "Models/test-creature/hand.blend") 30 (def hand "Models/test-creature/hand.blend")
31 31
32 (def output-base (File. "/home/r/proj/cortex/render/hand")) 32 (def output-base (File. "/home/r/proj/cortex/render/hand"))
33
34
35 ;; Let the hand fall palm-up
36
37 ;; it curls its phalanges, starting with the pinky.
38
39 ;; it lets these fall back down?
40
41 ;; block falls down onto the hand, accompanied by a sound. The block
42 ;; can be seen by the hand's eye.
43
44 ;; hand FORCEFULLY catapults the block so that it hits the camera.
45
33 46
34 (defn motor-control-program 47 (defn motor-control-program
35 "Create a function which will execute the motor script" 48 "Create a function which will execute the motor script"
36 [muscle-positions 49 [muscle-positions
37 script] 50 script]
81 :pinky-1-e]) 94 :pinky-1-e])
82 95
83 (def full 9001) 96 (def full 9001)
84 ;; the systax here is [keyframe body-part force] 97 ;; the systax here is [keyframe body-part force]
85 (def wiggle-each-finger-tip 98 (def wiggle-each-finger-tip
86 [[200 :pointer-3-f full] 99 [[300 :pointer-3-f 50]
87 [200 :pointer-3-f 40] 100
88 101
89 [400 :middle-3-f full] 102 [400 :middle-3-f full]
90 [401 :middle-3-f 40] 103 [401 :middle-3-f 50]
91 104
92 [600 :ring-3-f full] 105 [600 :ring-3-f full]
93 [601 :ring-3-f 40] 106 [601 :ring-3-f 40]
94 107
95 [800 :pinky-3-f full] 108 [800 :pinky-3-f full]
96 [801 :pinky-3-f 40]]) 109 [801 :pinky-3-f 50]
97 110
98 111 [1300 :pointer-1-f full]
99 112 [1300 :pointer-2-f full]
113 [1300 :pointer-3-f 0]
114
115 [1289 :middle-1-f full]
116 [1289 :middle-2-f full]
117 [1289 :middle-3-f 0]
118
119 [1310 :pointer-1-f 0]
120 [1310 :pointer-2-f 0]
121 [1310 :pointer-3-f 0]
122
123 [1310 :middle-1-f 0]
124 [1310 :middle-2-f 0]
125 [1310 :middle-3-f 0]
126
127
128
129 ])
130
131 (defn gen-summon-ball []
132 (let [wait (atom 20)]
133 (fn [world]
134 (if (= 0 (swap! wait dec))
135 (let [brick
136 (box 0.8 0.8 0.8 :mass 0.05
137 :position (Vector3f. 0 0 0.5)
138 :color (ColorRGBA/Red))]
139
140 (.addControl
141 brick
142 (proxy [AbstractControl] []
143 (controlUpdate [tpf]
144 (println-repl (.getWorldTranslation brick)))
145 (controlRender [_ _])))
146 (add-element world brick))))))
147
100 148
101 (def control-list 149 (def control-list
102 [ 150 [
103 0 ;;pointer-21 #<Vector3f (0.99999994, 0.0, 0.0)> 151 0 ;;pointer-21 #<Vector3f (0.99999994, 0.0, 0.0)>
104 0 ;;pointer-21 #<Vector3f (-0.99999994, 0.0, 0.0)> 152 0 ;;pointer-21 #<Vector3f (-0.99999994, 0.0, 0.0)>
139 187
140 bell (AudioNode. (asset-manager) 188 bell (AudioNode. (asset-manager)
141 "Sounds/pure.wav" false) 189 "Sounds/pure.wav" false)
142 creature (doto (load-blender-model hand) 190 creature (doto (load-blender-model hand)
143 (body!)) 191 (body!))
144 192
193 summon-ball (gen-summon-ball)
145 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 194 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
146 ;;touch (touch! creature) 195 ;;touch (touch! creature)
147 ;;touch-display (view-touch) 196 ;;touch-display (view-touch)
148 197
149 ;;vision (vision! creature) 198 ;;vision (vision! creature)
173 (if value 222 (if value
174 (.play bell)))}) 223 (.play bell)))})
175 224
176 (fn [world] 225 (fn [world]
177 (.setTimer world (RatchetTimer. 60)) 226 (.setTimer world (RatchetTimer. 60))
227 (position-camera
228 world (Vector3f. 7.7101235, 6.3628435, -14.15047)
229 (Quaternion. 0.3644328, -0.2558489, 0.104854375, 0.8892332))
178 (light-up-everything world) 230 (light-up-everything world)
179 (enable-debug world) 231 (enable-debug world)
180 (add-camera! world 232 (add-camera! world
181 (add-eye! creature 233 (add-eye! creature
182 (.getChild 234 (.getChild
183 (.getChild creature "eyes") "eye")) 235 (.getChild creature "eyes") "eye"))
184 (comp (view-image) BufferedImage!)) 236 (comp (view-image) BufferedImage!))
185 (speed-up world)) 237 (speed-up world)
238 )
186 (fn [world tpf] 239 (fn [world tpf]
187 ;;(prop-display (prop)) 240 ;;(prop-display (prop))
188 ;;(touch-display (map #(% (.getRootNode world)) touch)) 241 ;;(touch-display (map #(% (.getRootNode world)) touch))
189 ;;(vision-display (map #(% world) vision)) 242 ;;(vision-display (map #(% world) vision))
190 ;;(hearing-display (map #(% world) hearing)) 243 ;;(hearing-display (map #(% world) hearing))
191 244 (summon-ball world)
192 ;;(muscle-display 245 ;;(muscle-display
193 (control-script muscles) 246 (control-script muscles)
194 ;;) 247 ;;)
195 248
196 (.setLocalTranslation me (.getLocation (.getCamera world))) 249 (.setLocalTranslation me (.getLocation (.getCamera world)))