comparison org/util.org @ 306:7e7f8d6d9ec5

massive spellchecking
author Robert McIntyre <rlm@mit.edu>
date Sat, 18 Feb 2012 10:59:41 -0700
parents d1206b11ae2d
children bb3f8a4af87f
comparison
equal deleted inserted replaced
305:19c43ec6958d 306:7e7f8d6d9ec5
26 classname) 26 classname)
27 27
28 (defn jme-class? [classname] 28 (defn jme-class? [classname]
29 (and 29 (and
30 (.startsWith classname "com.jme3.") 30 (.startsWith classname "com.jme3.")
31 ;; Don't import the Lwjgl stuff since it can throw exceptions 31 ;; Don't import the LWJGL stuff since it can throw exceptions
32 ;; upon being loaded. 32 ;; upon being loaded.
33 (not (re-matches #".*Lwjgl.*" classname)))) 33 (not (re-matches #".*Lwjgl.*" classname))))
34 34
35 (defn jme-classes 35 (defn jme-classes
36 "returns a list of all jme3 classes" 36 "returns a list of all jme3 classes"
50 jMonkeyEngine3 has a plethora of classes which can be overwhelming to 50 jMonkeyEngine3 has a plethora of classes which can be overwhelming to
51 manage. This code uses reflection to import all of them. Once I'm 51 manage. This code uses reflection to import all of them. Once I'm
52 happy with the general structure of a namespace I can deal with 52 happy with the general structure of a namespace I can deal with
53 importing only the classes it actually needs. 53 importing only the classes it actually needs.
54 54
55 The =mega-import-jme3= is quite usefull for debugging purposes since 55 The =mega-import-jme3= is quite useful for debugging purposes since
56 it allows completion for almost all of JME's classes from the REPL. 56 it allows completion for almost all of JME's classes from the REPL.
57 57
58 Out of curiousity, let's see just how many classes =mega-import-jme3= 58 Out of curiosity, let's see just how many classes =mega-import-jme3=
59 imports: 59 imports:
60 60
61 #+begin_src clojure :exports both :results output 61 #+begin_src clojure :exports both :results output
62 (println (clojure.core/count (cortex.import/jme-classes)) "classes") 62 (println (clojure.core/count (cortex.import/jme-classes)) "classes")
63 #+end_src 63 #+end_src
224 #+name: shapes 224 #+name: shapes
225 #+begin_src clojure :results silent 225 #+begin_src clojure :results silent
226 (in-ns 'cortex.util) 226 (in-ns 'cortex.util)
227 227
228 (defn load-bullet 228 (defn load-bullet
229 "Runnig this function unpacks the native bullet libraries and makes 229 "Running this function unpacks the native bullet libraries and makes
230 them available." 230 them available."
231 [] 231 []
232 (let [sim (world (Node.) {} no-op no-op)] 232 (let [sim (world (Node.) {} no-op no-op)]
233 (doto sim 233 (doto sim
234 (.enqueue 234 (.enqueue
314 (make-shape (assoc options 314 (make-shape (assoc options
315 :shape (Sphere. 32 32 (float r)))))) 315 :shape (Sphere. 32 32 (float r))))))
316 ([] (sphere 0.5))) 316 ([] (sphere 0.5)))
317 317
318 (defn x-ray 318 (defn x-ray
319 "A usefull material for debuging -- it can be seen no matter what 319 "A useful material for debugging -- it can be seen no matter what
320 object occuldes it." 320 object occludes it."
321 [#^ColorRGBA color] 321 [#^ColorRGBA color]
322 (doto (Material. (asset-manager) 322 (doto (Material. (asset-manager)
323 "Common/MatDefs/Misc/Unshaded.j3md") 323 "Common/MatDefs/Misc/Unshaded.j3md")
324 (.setColor "Color" color) 324 (.setColor "Color" color)
325 (-> (.getAdditionalRenderState) 325 (-> (.getAdditionalRenderState)
357 #+name: debug-actions 357 #+name: debug-actions
358 #+begin_src clojure :results silent 358 #+begin_src clojure :results silent
359 (in-ns 'cortex.util) 359 (in-ns 'cortex.util)
360 360
361 (defn basic-light-setup 361 (defn basic-light-setup
362 "returns a sequence of lights appropiate for fully lighting a scene" 362 "returns a sequence of lights appropriate for fully lighting a scene"
363 [] 363 []
364 (conj 364 (conj
365 (doall 365 (doall
366 (map 366 (map
367 (fn [direction] 367 (fn [direction]
377 (.mult Vector3f/UNIT_Z (float -1))])) 377 (.mult Vector3f/UNIT_Z (float -1))]))
378 (doto (AmbientLight.) 378 (doto (AmbientLight.)
379 (.setColor ColorRGBA/White)))) 379 (.setColor ColorRGBA/White))))
380 380
381 (defn light-up-everything 381 (defn light-up-everything
382 "Add lights to a world appropiate for quickly seeing everything 382 "Add lights to a world appropriate for quickly seeing everything
383 in the scene. Adds six DirectionalLights facing in orthogonal 383 in the scene. Adds six DirectionalLights facing in orthogonal
384 directions, and one AmbientLight to provide overall lighting 384 directions, and one AmbientLight to provide overall lighting
385 coverage." 385 coverage."
386 [world] 386 [world]
387 (dorun 387 (dorun
431 [object 431 [object
432 [up down left right roll-up roll-down :as keyboard] 432 [up down left right roll-up roll-down :as keyboard]
433 forces 433 forces
434 [root-node 434 [root-node
435 keymap 435 keymap
436 intilization 436 initialization
437 world-loop]] 437 world-loop]]
438 (let [add-keypress 438 (let [add-keypress
439 (fn [state keymap key] 439 (fn [state keymap key]
440 (merge keymap 440 (merge keymap
441 {key 441 {key
470 world-loop* (fn [world tpf] 470 world-loop* (fn [world tpf]
471 (world-loop world tpf) 471 (world-loop world tpf)
472 (splice-loop))] 472 (splice-loop))]
473 [root-node 473 [root-node
474 keymap* 474 keymap*
475 intilization 475 initialization
476 world-loop*])) 476 world-loop*]))
477 477
478 (import com.jme3.font.BitmapText) 478 (import com.jme3.font.BitmapText)
479 (import com.jme3.scene.control.AbstractControl) 479 (import com.jme3.scene.control.AbstractControl)
480 (import com.aurellem.capture.IsoTimer) 480 (import com.aurellem.capture.IsoTimer)
481 481
482 (defn display-dialated-time 482 (defn display-dilated-time
483 "Shows the time as it is flowing in the simulation on a HUD display. 483 "Shows the time as it is flowing in the simulation on a HUD display.
484 Useful for making videos." 484 Useful for making videos."
485 [world timer] 485 [world timer]
486 (let [font (.loadFont (asset-manager) "Interface/Fonts/Default.fnt") 486 (let [font (.loadFont (asset-manager) "Interface/Fonts/Default.fnt")
487 text (BitmapText. font false)] 487 text (BitmapText. font false)]