org.odejava.xode
Class XODERoot

java.lang.Object
  extended by org.odejava.xode.XODEObject
      extended by org.odejava.xode.XODEContainer
          extended by org.odejava.xode.XODERoot
All Implemented Interfaces:
Serializable

public class XODERoot
extends XODEContainer
implements Serializable

Root XODE node

Author:
William Denniss
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.odejava.xode.XODEContainer
absoluteTransform, cachedBodyRelTransform, cachedRootTransform, cachedTransform, relTransform, xodeObjects
 
Fields inherited from class org.odejava.xode.XODEObject
node, odeObject
 
Constructor Summary
protected XODERoot()
           
  XODERoot(Node xode, org.openmali.vecmath2.Matrix4f parentTransform)
           
  XODERoot(String name, org.openmali.vecmath2.Matrix4f transform)
           
  XODERoot(String name, org.openmali.vecmath2.Matrix4f transform, World world, Space space)
          Creates an XODE tree based on an ODE scene
 
Method Summary
 Document buildDocument()
           
 Element buildElement(Document doc)
          Builds an XML DOM representation of this XODEObject
 List<Object> buildODEScene(World world, Space space, String namePrefix)
          Creates all the ODE bodies, geoms and joints represented in this XODE tree.
 List<Object> buildODEScene(World world, Space space, String namePrefix, org.openmali.vecmath2.Matrix4f transform)
          Creates all the ODE bodies, geoms and joints represented in this XODE tree.
static void removeAllODEObjects(List<Object> odeObjects)
          Attempts to remove and delete all given ODE objects from their respective WorldS and SpaceS.
 void setRootTransform(org.openmali.vecmath2.Matrix4f transform)
          Changes the root transform and forces child nodes to recalculate their relitive transforms next time a transform getter is called.
 
Methods inherited from class org.odejava.xode.XODEContainer
addChild, addChildElements, addChildren, addTransformElement, buildOde, getBodyRelTransform, getChildren, getPosition, getRootTransform, getRotation, getTransform, getTransform, getXODETransform, invalidateTransformCache, isAbsoluteTransformMode, parseTransform, removeChild, scrapDOMObjectCache, scrapODEObjectCache, setAbsolute, setParent, setPosition, setRotation, setTransform
 
Methods inherited from class org.odejava.xode.XODEObject
clone, getDOMNode, getFirstBodyAncestor, getFirstJointGroupAncestor, getFirstSpaceAncestor, getName, getODEObject, getParent, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XODERoot

protected XODERoot()

XODERoot

public XODERoot(String name,
                org.openmali.vecmath2.Matrix4f transform)

XODERoot

public XODERoot(Node xode,
                org.openmali.vecmath2.Matrix4f parentTransform)

XODERoot

public XODERoot(String name,
                org.openmali.vecmath2.Matrix4f transform,
                World world,
                Space space)
Creates an XODE tree based on an ODE scene

Parameters:
name - name of the root node
transform - root transform
world - ODE World to parse
space - ODE Space to parse
Method Detail

buildODEScene

public List<Object> buildODEScene(World world,
                                  Space space,
                                  String namePrefix)
Creates all the ODE bodies, geoms and joints represented in this XODE tree. All object names are prefixed with the given String.

Parameters:
world - the World the ODE objects are added to
space - the Space the ODE objects are added to
namePrefix - String the names of the objects are prefixed by

buildODEScene

public List<Object> buildODEScene(World world,
                                  Space space,
                                  String namePrefix,
                                  org.openmali.vecmath2.Matrix4f transform)
Creates all the ODE bodies, geoms and joints represented in this XODE tree. All object names are prefixed with the given String.

Parameters:
world - the World the ODE objects are added to
space - the Space the ODE objects are added to
namePrefix - String the names of the objects are prefixed by
transform - The transform offset that will be applied to all XODE nodes
See Also:
setRootTransform(org.openmali.vecmath2.Matrix4f)

setRootTransform

public void setRootTransform(org.openmali.vecmath2.Matrix4f transform)
Changes the root transform and forces child nodes to recalculate their relitive transforms next time a transform getter is called. Can be called before ODE objects are built to move the origin of XODE scene.

Parameters:
transform - the replacement root transform

buildDocument

public Document buildDocument()
                       throws ParserConfigurationException
Throws:
ParserConfigurationException

buildElement

public Element buildElement(Document doc)
Description copied from class: XODEObject
Builds an XML DOM representation of this XODEObject

Specified by:
buildElement in class XODEObject
Parameters:
doc - the Document this Element will be associated with
Returns:
and XML DOM representation of this XODEObject

removeAllODEObjects

public static void removeAllODEObjects(List<Object> odeObjects)
Attempts to remove and delete all given ODE objects from their respective WorldS and SpaceS. Use with the returned List from buildODEScene to remove all created ODE objects.

Parameters:
odeObjects - the list of ODE objects to be removed