com.threerings.opengl.model.tools
Class ModelDef

java.lang.Object
  extended by com.threerings.opengl.model.tools.ModelDef

public class ModelDef
extends Object

An intermediate representation for models used to store data parsed from XML.


Nested Class Summary
static class ModelDef.BoneWeight
          The influence of a single bone on a vertex.
static class ModelDef.Extra
          An extra bit of data associated with a vertex.
protected static class ModelDef.HashArrayList<E>
          Accelerates ArrayList.indexOf(java.lang.Object), ArrayList.contains(java.lang.Object), and ArrayList.remove(int) using an internal hash map (assumes that all elements of the list are unique and non-null).
static class ModelDef.NodeDef
          Represents a node without geometry.
static class ModelDef.SkinMeshDef
          Represents a triangle mesh whose vertices are influenced by sets of bones.
static class ModelDef.SkinVertex
          A vertex with bone influences.
static class ModelDef.SpatialDef
          The abstract base class of the nodes stored in the model definition.
protected static class ModelDef.Triangle
          Represents a triangle for processing purposes.
static class ModelDef.TriMeshDef
          Represents a triangle mesh.
static class ModelDef.Vertex
          A single vertex in a mesh.
 
Field Summary
protected static int MAX_BONE_COUNT
          The maximum number of bones that may influence a single mesh.
 HashMap<String,ModelDef.SpatialDef> spatials
          The nodes in the model, mapped by name.
 
Constructor Summary
ModelDef()
           
 
Method Summary
 void addSpatial(ModelDef.SpatialDef spatial)
          Called by the parser to add a node to this model.
protected static Matrix4f createMatrix(float[] translation, float[] rotation, float[] scale)
          Creates and returns a matrix containing the described transform.
protected static Matrix4f createMatrix(float[] translation, float[] rotation, float[] scale, float gscale)
          Creates and returns a matrix containing the described transform.
protected  ModelDef.NodeDef createRootNode()
          Resolves the node references and returns a root node containing the hierarchy.
static Transform3D createTransform(float[] translation, float[] rotation, float[] scale, float gscale)
          Creates a Transform3D object from the supplied arrays.
protected  ArrayList<ModelDef.SpatialDef> resolveReferences()
          Resolves the parent/child references and returns a list of the top-level children.
 void update(ArticulatedConfig config)
          Updates the supplied configuration with the model data in this definition.
 void update(StaticConfig config)
          Updates the supplied configuration with the model data in this definition.
 void update(StaticSetConfig config)
          Updates the supplied configuration with the model data in this definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spatials

public HashMap<String,ModelDef.SpatialDef> spatials
The nodes in the model, mapped by name.


MAX_BONE_COUNT

protected static final int MAX_BONE_COUNT
The maximum number of bones that may influence a single mesh.

See Also:
Constant Field Values
Constructor Detail

ModelDef

public ModelDef()
Method Detail

createTransform

public static Transform3D createTransform(float[] translation,
                                          float[] rotation,
                                          float[] scale,
                                          float gscale)
Creates a Transform3D object from the supplied arrays.


addSpatial

public void addSpatial(ModelDef.SpatialDef spatial)
Called by the parser to add a node to this model.


update

public void update(StaticConfig config)
Updates the supplied configuration with the model data in this definition.


update

public void update(StaticSetConfig config)
Updates the supplied configuration with the model data in this definition.


update

public void update(ArticulatedConfig config)
Updates the supplied configuration with the model data in this definition.


createRootNode

protected ModelDef.NodeDef createRootNode()
Resolves the node references and returns a root node containing the hierarchy.


resolveReferences

protected ArrayList<ModelDef.SpatialDef> resolveReferences()
Resolves the parent/child references and returns a list of the top-level children.


createMatrix

protected static Matrix4f createMatrix(float[] translation,
                                       float[] rotation,
                                       float[] scale)
Creates and returns a matrix containing the described transform.


createMatrix

protected static Matrix4f createMatrix(float[] translation,
                                       float[] rotation,
                                       float[] scale,
                                       float gscale)
Creates and returns a matrix containing the described transform.