diff org/world.org @ 34:183744c179e6

MASSIVE cleanup, especially in the vision code
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 08:28:26 -0700
parents 6372c108c5c6
children 00d0e1639d4b
line wrap: on
line diff
     1.1 --- a/org/world.org	Wed Nov 02 11:03:12 2011 -0700
     1.2 +++ b/org/world.org	Thu Nov 03 08:28:26 2011 -0700
     1.3 @@ -1,4 +1,4 @@
     1.4 -#+title: A World for the Creatures
     1.5 +#+title: A Virtual World for Sensate Creatures
     1.6  #+author: Robert McIntyre
     1.7  #+email: rlm@mit.edu
     1.8  #+description: Creating a Virtual World for AI constructs using clojure and JME3
     1.9 @@ -31,12 +31,12 @@
    1.10     - Use a map from keys->functions to specify key-bindings. 
    1.11     - Use functions to create objects separately from any particular
    1.12       application.
    1.13 -   - Use an REPL -- this means that there's only ever one JVM, and
    1.14 +   - Use a REPL -- this means that there's only ever one JVM, and
    1.15       Applications come and go.
    1.16  
    1.17  Since most development work using jMonkeyEngine is done in Java, jme3
    1.18  supports "the Java way" quite well out of the box. To work "the
    1.19 -clojure way", it necessary to wrap the jme3 elements that deal with
    1.20 +clojure way", it necessary to wrap the JME3 elements that deal with
    1.21  the Application life-cycle with a REPL driven interface.
    1.22  
    1.23  The most important modifications are:
    1.24 @@ -57,11 +57,12 @@
    1.25    (:use [pokemon [lpsolve :only [constant-map]]])
    1.26    (:use [clojure.contrib [str-utils :only [re-gsub]]])
    1.27  
    1.28 +  (:import com.aurellem.capture.IsoTimer)
    1.29 +
    1.30    (:import com.jme3.math.Vector3f)
    1.31    (:import com.jme3.scene.Node)
    1.32    (:import com.jme3.system.AppSettings)
    1.33    (:import com.jme3.system.JmeSystem)
    1.34 -  (:import com.jme3.system.IsoTimer)
    1.35    (:import com.jme3.input.KeyInput)
    1.36    (:import com.jme3.input.controls.KeyTrigger)
    1.37    (:import com.jme3.input.controls.MouseButtonTrigger)
    1.38 @@ -83,9 +84,8 @@
    1.39    (doto (AppSettings. true)
    1.40      (.setFullscreen false)
    1.41      (.setTitle "Aurellem.")
    1.42 -    ;; disable 32 bit stuff for now
    1.43 -    ;;(.setAudioRenderer "Send")
    1.44 -    )
    1.45 +    ;; The "Send" AudioRenderer supports sumulated hearing.
    1.46 +    (.setAudioRenderer "Send"))
    1.47    "These settings control how the game is displayed on the screen for
    1.48     debugging purposes.  Use binding forms to change this if desired.
    1.49     Full-screen mode does not work on some computers.")    
    1.50 @@ -102,7 +102,8 @@
    1.51  =Application= whenever they extend that class. However,
    1.52  =AssetManagers= are useful on their own to create objects/ materials,
    1.53  independent from any particular application. =(asset-manager)= makes
    1.54 -object creation less tightly bound to Application initialization.
    1.55 +object creation less tightly bound to a particular Application
    1.56 +Instance.
    1.57  
    1.58  
    1.59  ** Exception Protection
    1.60 @@ -170,18 +171,18 @@
    1.61     (map (fn [name] 
    1.62            (.addListener
    1.63             ^InputManager input-manager game
    1.64 -           (into-array String  [name]))) (keys key-map))))
    1.65 +           (into-array String [name]))) (keys key-map))))
    1.66  
    1.67  #+end_src
    1.68  
    1.69  These functions are for controlling the world through the keyboard and
    1.70  mouse.
    1.71  
    1.72 -I reuse =constant-map= from [[../../pokemon-types/html/lpsolve.html#sec-3-3-4][=pokemon.lpsolve=]] to get the numerical
    1.73 +I reuse =constant-map= from [[../../pokemon-types/html/lpsolve.html#sec-3-2-4][=pokemon.lpsolve=]] to get the numerical
    1.74  values for all the keys defined in the =KeyInput= class. The
    1.75  documentation for =constant-map= is:
    1.76  
    1.77 -#+begin_src clojure :results output
    1.78 +#+begin_src clojure :results output :exports both
    1.79  (doc pokemon.lpsolve/constant-map)
    1.80  #+end_src
    1.81  
    1.82 @@ -220,7 +221,6 @@
    1.83  :  ["key-o" #<KeyTrigger com.jme3.input.controls.KeyTrigger@685c53ff>]
    1.84  :  ["key-at" #<KeyTrigger com.jme3.input.controls.KeyTrigger@4c3e2e5f>])
    1.85  
    1.86 -
    1.87  ** World Creation
    1.88  #+srcname: world
    1.89  #+begin_src clojure :results silent
    1.90 @@ -271,9 +271,7 @@
    1.91         value always being the same.
    1.92    "
    1.93    [root-node key-map setup-fn update-fn]
    1.94 -  (let [physics-manager (BulletAppState.)
    1.95 -	shadow-renderer (BasicShadowRenderer.
    1.96 -                         (asset-manager) (int 256))]   	
    1.97 +  (let [physics-manager (BulletAppState.)]
    1.98      (doto
    1.99          (proxy [SimpleApplication ActionListener] []
   1.100            (simpleInitApp
   1.101 @@ -302,15 +300,6 @@
   1.102                                (.add (.getPhysicsSpace physics-manager)
   1.103                                      (.getControl geom n))))))
   1.104                         (.getRootNode this))
   1.105 -             ;;(.addAll (.getPhysicsSpace physics-manager) (.getRootNode this))
   1.106 -             
   1.107 -             ;; set some basic defaults for the shadow renderer.
   1.108 -             ;; these can be undone in the setup function
   1.109 -             (.setDirection shadow-renderer
   1.110 -                            (.normalizeLocal (Vector3f. -1 -1 -1)))
   1.111 -             (.addProcessor (.getViewPort this) shadow-renderer)
   1.112 -             (.setShadowMode (.getRootNode this)
   1.113 -                             RenderQueue$ShadowMode/Off)
   1.114               ;; call the supplied setup-fn
   1.115               (if setup-fn
   1.116                 (setup-fn this))))