diff org/body.org @ 62:2b9d81017cb7

moved utility functions out of body and into util
author Robert McIntyre <rlm@mit.edu>
date Mon, 28 Nov 2011 21:28:46 -0700
parents 7b44348af538
children 7f2653ad3199
line wrap: on
line diff
     1.1 --- a/org/body.org	Mon Nov 28 21:22:35 2011 -0700
     1.2 +++ b/org/body.org	Mon Nov 28 21:28:46 2011 -0700
     1.3 @@ -31,44 +31,6 @@
     1.4      ;; transforms before it is rendered to the screen. 
     1.5      (.resetAndUpdate)))
     1.6  
     1.7 -(defprotocol Textual
     1.8 -  (text [something]
     1.9 -    "Display a detailed textual analysis of the given object."))
    1.10 -
    1.11 -(extend-type com.jme3.scene.Node
    1.12 -  Textual
    1.13 -  (text [node]
    1.14 -    (println "Total Vertexes: " (.getVertexCount node))
    1.15 -    (println "Total Triangles: " (.getTriangleCount node))
    1.16 -    (println "Controls :")
    1.17 -    (dorun (map #(text (.getControl node %)) (range (.getNumControls node))))
    1.18 -    (println "Has " (.getQuantity node) " Children:")
    1.19 -    (doall (map text (.getChildren node)))))
    1.20 -
    1.21 -(extend-type com.jme3.animation.AnimControl
    1.22 -  Textual
    1.23 -  (text [control]
    1.24 -    (let [animations (.getAnimationNames control)]
    1.25 -      (println "Animation Control with " (count animations) " animation(s):")
    1.26 -      (dorun (map println animations)))))
    1.27 -
    1.28 -(extend-type com.jme3.animation.SkeletonControl
    1.29 -  Textual
    1.30 -  (text [control]
    1.31 -    (println "Skeleton Control with the following skeleton:")
    1.32 -    (println (.getSkeleton control))))
    1.33 -
    1.34 -(extend-type com.jme3.bullet.control.KinematicRagdollControl
    1.35 -  Textual
    1.36 -  (text [control]
    1.37 -    (println "Ragdoll Control")))
    1.38 -                 
    1.39 -
    1.40 -(extend-type com.jme3.scene.Geometry
    1.41 -  Textual
    1.42 -  (text [control]
    1.43 -    (println "...geo...")))
    1.44 -
    1.45  
    1.46  (defn green-x-ray []
    1.47    (doto (Material. (asset-manager)
    1.48 @@ -93,14 +55,6 @@
    1.49                   :color (ColorRGBA/randomColor)))]
    1.50      (map nth-segment (range num-segments))))
    1.51  
    1.52 -(defn nodify
    1.53 -  "take a sequence of things that can be attached to a node and return
    1.54 -  a node with all of them attached"
    1.55 -  ([name children]
    1.56 -     (let [node (Node. name)]
    1.57 -       (dorun (map #(.attachChild node %) children))
    1.58 -       node))
    1.59 -  ([children] (nodify "" children)))
    1.60  
    1.61  (defn connect-at-midpoint
    1.62    [segmentA segmentB]
    1.63 @@ -153,14 +107,6 @@
    1.64  ;; torque applied to their joints.  There's not a single straight line
    1.65  ;; of force in the human body at all!  (a straight line of force would
    1.66  ;; correspond to some sort of jet or rocket propulseion)
    1.67 -
    1.68 -(defn node-seq
    1.69 -  "Take a node and return a seq of all its children
    1.70 -   recursively. There will be no nodes left in the resulting
    1.71 -   structure"
    1.72 -  [#^Node node]
    1.73 -  (tree-seq #(isa? (class %) Node) #(.getChildren %) node))
    1.74 -  
    1.75    
    1.76  (defn torque-controls [control]
    1.77    (let [torques