comparison org/sense-util.org @ 167:9e6a30b8c99a

renamed some functions in eyes.org
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 04:07:25 -0700
parents c33a8e5fe7bc
children 0f1c7921d967
comparison
equal deleted inserted replaced
166:e4c2cc79a171 167:9e6a30b8c99a
11 #+begin_src clojure 11 #+begin_src clojure
12 (ns cortex.sense) 12 (ns cortex.sense)
13 (cortex.import/mega-import-jme3) 13 (cortex.import/mega-import-jme3)
14 (import ij.process.ImageProcessor) 14 (import ij.process.ImageProcessor)
15 (import java.awt.image.BufferedImage) 15 (import java.awt.image.BufferedImage)
16 16 (use 'cortex.util)
17 (import jme3tools.converters.ImageToAwt)
17 18
18 (defn meta-data [blender-node key] 19 (defn meta-data [blender-node key]
19 (if-let [data (.getUserData blender-node "properties")] 20 (if-let [data (.getUserData blender-node "properties")]
20 (.findValue data key) 21 (.findValue data key)
21 nil)) 22 nil))
179 (fn [#^Node creature] 180 (fn [#^Node creature]
180 (if-let [sense-node (.getChild creature parent-name)] 181 (if-let [sense-node (.getChild creature parent-name)]
181 (seq (.getChildren sense-node)) 182 (seq (.getChildren sense-node))
182 (do (println-repl "could not find" parent-name "node") [])))) 183 (do (println-repl "could not find" parent-name "node") []))))
183 184
185 (defn load-image
186 "Load an image as a BufferedImage using the asset-manager system."
187 [asset-relative-path]
188 (ImageToAwt/convert
189 (.getImage (.loadTexture (asset-manager) asset-relative-path))
190 false false 0))
191
184 192
185 #+end_src 193 #+end_src
186 194
187 #+results: sense-util 195 #+results: sense-util
188 : #'cortex.sense/meta-data 196 : #'cortex.sense/meta-data