com.threerings.opengl.model.tools
Class ModelDef.TriMeshDef

java.lang.Object
  extended by com.threerings.opengl.model.tools.ModelDef.SpatialDef
      extended by com.threerings.opengl.model.tools.ModelDef.TriMeshDef
Direct Known Subclasses:
ModelDef.SkinMeshDef
Enclosing class:
ModelDef

public static class ModelDef.TriMeshDef
extends ModelDef.SpatialDef

Represents a triangle mesh.


Field Summary
 boolean colored
          Whether or not any of the vertices are non-white.
 ArrayList<Integer> indices
          The triangle indices.
 float[] offsetRotation
           
 float[] offsetScale
           
 float[] offsetTranslation
          The geometry offset transform.
 String tag
          The mesh's tag, if any.
 String texture
          The texture of the mesh, if any.
 ModelDef.HashArrayList<ModelDef.Vertex> vertices
          The vertices of the mesh.
 
Fields inherited from class com.threerings.opengl.model.tools.ModelDef.SpatialDef
_transformMatrix, bone, childDefs, name, parent, parentDef, point, rotation, scale, translation
 
Constructor Summary
ModelDef.TriMeshDef()
           
 
Method Summary
 void addVertex(ModelDef.Vertex vertex)
          Called by the parser to add a vertex to this mesh.
protected  boolean containsCollisionMesh()
          Determines whether this node contains an explicit collision mesh.
 CollisionMesh createCollisionMesh()
          Creates and returns a collision mesh object for this mesh.
protected  GeometryConfig createGeometry(Box bounds, GeometryConfig.AttributeArrayConfig[] vertexAttribArrays, ClientArrayConfig[] texCoordArrays, ClientArrayConfig colorArray, ClientArrayConfig normalArray, ClientArrayConfig vertexArray)
          Creates the geometry for this node.
protected  ShortBuffer createIndexBuffer()
          Creates the index buffer for the mesh.
 ArticulatedConfig.Node createNode(ArticulatedConfig config, boolean haveCollisionMesh)
          Creates an articulation node.
protected  GeometryConfig.AttributeArrayConfig[] createVertexAttribArrays(ModelConfig.Imported config)
          Creates the attribute arrays.
 ModelConfig.VisibleMesh createVisibleMesh(ModelConfig.Imported config)
          Creates and returns a visible mesh config for this mesh.
 Object getConfigurationKey()
          Returns a key representing the configuration of this mesh that will be compared to others in order to determine which meshes can be merged.
protected  String getDefaultTag()
          Returns the default tag for this mesh type.
 void merge(ModelDef.TriMeshDef omesh)
          Merges another mesh (assumed to have the same configuration, transform, etc.) into this one.
 void mergeMeshes(HashMap<Object,ModelDef.TriMeshDef> meshes)
          Merges meshes with the same properties under this node.
 void mergeMeshes(ModelDef.TriMeshDef mesh)
          Merges all of the meshes under this node.
protected  void optimizeVertexOrder(boolean generateTangents)
          Reorders the vertices to optimize for vertex cache utilization.
protected  void transformVertices(Matrix4f vtrans)
          Transforms all of the mesh's vertices by the specified matrix.
 
Methods inherited from class com.threerings.opengl.model.tools.ModelDef.SpatialDef
clearTransform, clearTransforms, createChildNodes, createMeshes, getTransformMatrix, mergeSkinMeshes, mergeSkinMeshes, removeBoneWeights, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offsetTranslation

public float[] offsetTranslation
The geometry offset transform.


offsetRotation

public float[] offsetRotation

offsetScale

public float[] offsetScale

texture

public String texture
The texture of the mesh, if any.


tag

public String tag
The mesh's tag, if any.


vertices

public ModelDef.HashArrayList<ModelDef.Vertex> vertices
The vertices of the mesh.


indices

public ArrayList<Integer> indices
The triangle indices.


colored

public boolean colored
Whether or not any of the vertices are non-white.

Constructor Detail

ModelDef.TriMeshDef

public ModelDef.TriMeshDef()
Method Detail

addVertex

public void addVertex(ModelDef.Vertex vertex)
Called by the parser to add a vertex to this mesh.


createNode

public ArticulatedConfig.Node createNode(ArticulatedConfig config,
                                         boolean haveCollisionMesh)
Description copied from class: ModelDef.SpatialDef
Creates an articulation node.

Specified by:
createNode in class ModelDef.SpatialDef

mergeMeshes

public void mergeMeshes(HashMap<Object,ModelDef.TriMeshDef> meshes)
Description copied from class: ModelDef.SpatialDef
Merges meshes with the same properties under this node.

Overrides:
mergeMeshes in class ModelDef.SpatialDef

mergeMeshes

public void mergeMeshes(ModelDef.TriMeshDef mesh)
Description copied from class: ModelDef.SpatialDef
Merges all of the meshes under this node.

Overrides:
mergeMeshes in class ModelDef.SpatialDef

getConfigurationKey

public Object getConfigurationKey()
Returns a key representing the configuration of this mesh that will be compared to others in order to determine which meshes can be merged.


merge

public void merge(ModelDef.TriMeshDef omesh)
Merges another mesh (assumed to have the same configuration, transform, etc.) into this one.


createVisibleMesh

public ModelConfig.VisibleMesh createVisibleMesh(ModelConfig.Imported config)
Creates and returns a visible mesh config for this mesh.


createCollisionMesh

public CollisionMesh createCollisionMesh()
Creates and returns a collision mesh object for this mesh.


createVertexAttribArrays

protected GeometryConfig.AttributeArrayConfig[] createVertexAttribArrays(ModelConfig.Imported config)
Creates the attribute arrays.


getDefaultTag

protected String getDefaultTag()
Returns the default tag for this mesh type.


createGeometry

protected GeometryConfig createGeometry(Box bounds,
                                        GeometryConfig.AttributeArrayConfig[] vertexAttribArrays,
                                        ClientArrayConfig[] texCoordArrays,
                                        ClientArrayConfig colorArray,
                                        ClientArrayConfig normalArray,
                                        ClientArrayConfig vertexArray)
Creates the geometry for this node.


containsCollisionMesh

protected boolean containsCollisionMesh()
Description copied from class: ModelDef.SpatialDef
Determines whether this node contains an explicit collision mesh.

Overrides:
containsCollisionMesh in class ModelDef.SpatialDef

transformVertices

protected void transformVertices(Matrix4f vtrans)
Transforms all of the mesh's vertices by the specified matrix.


optimizeVertexOrder

protected void optimizeVertexOrder(boolean generateTangents)
Reorders the vertices to optimize for vertex cache utilization. Uses the algorithm described in Tom Forsyth's article Linear-Speed Vertex Cache Optimization.


createIndexBuffer

protected ShortBuffer createIndexBuffer()
Creates the index buffer for the mesh.