org.jdesktop.wonderland.client.jme.utils
Class ScenegraphUtils

java.lang.Object
  extended by org.jdesktop.wonderland.client.jme.utils.ScenegraphUtils

public class ScenegraphUtils
extends java.lang.Object

Various utilties for the JME scene graph

Author:
paulby, Bernard Horan

Constructor Summary
ScenegraphUtils()
           
 
Method Summary
static CellTransform computeChildTransform(CellTransform parentWorld, CellTransform childWorldTransform)
          Given the world coordinates of a child compute the childs localTransform asssuming it will become a child of the parent with the supplied world transform
static com.jme.scene.Spatial findNamedNode(com.jme.scene.Node rootNode, java.lang.String name)
          Traverse the scene graph from rootNode and return the first node with the given name.
static void getNamedNodes(com.jme.scene.Node rootNode, java.util.HashMap<java.lang.String,com.jme.scene.Spatial> nodeMap)
          Scan the graph and add all named nodes (non null names only) to the nodeMap.
static void main(java.lang.String[] args)
           
static void printChildren(com.jme.scene.Node aNode, java.lang.StringBuffer buffer)
          Print the children of the parameter node on the parameter buffer
static void printChildren(com.jme.scene.Node aNode, java.lang.StringBuffer buffer, int indent)
          Print the children of the parameter node on the parameter buffer, using an indent count to produce an indented tree
static void printParents(com.jme.scene.Spatial aSpatial, java.lang.StringBuffer buffer)
          Print the parents of the parameter spatial on the parameter buffer
static void printParents(com.jme.scene.Spatial aSpatial, java.lang.StringBuffer buffer, int indent)
          Print the parents of the parameter spatial on the parameter buffer, using an indent count to indent the printing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScenegraphUtils

public ScenegraphUtils()
Method Detail

printChildren

public static void printChildren(com.jme.scene.Node aNode,
                                 java.lang.StringBuffer buffer)
Print the children of the parameter node on the parameter buffer

Parameters:
aNode - the node whose children are to be printed
buffer - the buffer that will contain the tree of printed nodes

printChildren

public static void printChildren(com.jme.scene.Node aNode,
                                 java.lang.StringBuffer buffer,
                                 int indent)
Print the children of the parameter node on the parameter buffer, using an indent count to produce an indented tree

Parameters:
aNode - the node whose children are to be printed
buffer - the buffer that will contain the tree of printed nodes
indent - a count of how deep this branch is

printParents

public static void printParents(com.jme.scene.Spatial aSpatial,
                                java.lang.StringBuffer buffer)
Print the parents of the parameter spatial on the parameter buffer

Parameters:
aSpatial - the spatial whose parents are to be printed
buffer - the buffer that will contain the tree of printed spatials

printParents

public static void printParents(com.jme.scene.Spatial aSpatial,
                                java.lang.StringBuffer buffer,
                                int indent)
Print the parents of the parameter spatial on the parameter buffer, using an indent count to indent the printing

Parameters:
aSpatial - the spatial whose parents are to be printed
buffer - the buffer that will contain the tree of printed spatials
indent - a count of how deep the parent is up the tree

findNamedNode

public static com.jme.scene.Spatial findNamedNode(com.jme.scene.Node rootNode,
                                                  java.lang.String name)
Traverse the scene graph from rootNode and return the first node with the given name. Returns null if no node is found

Parameters:
rootNode - the root of the graph
name - the name to search for
Returns:
the named node, or null

getNamedNodes

public static void getNamedNodes(com.jme.scene.Node rootNode,
                                 java.util.HashMap<java.lang.String,com.jme.scene.Spatial> nodeMap)
Scan the graph and add all named nodes (non null names only) to the nodeMap. If there are duplicate names a logger warning will be printed and previous name/node will be overwritten

Parameters:
rootNode - root of graph
nodeMap - the HashMap to which nodes are added

computeChildTransform

public static CellTransform computeChildTransform(CellTransform parentWorld,
                                                  CellTransform childWorldTransform)
Given the world coordinates of a child compute the childs localTransform asssuming it will become a child of the parent with the supplied world transform

Parameters:
parent -
childWorldTransform -
Returns:

main

public static void main(java.lang.String[] args)


Open Wonderland - http://openwonderland.org