org.jagatoo.loaders.models.cal3d.core
Class CalCoreSubmesh

java.lang.Object
  extended by org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh

public class CalCoreSubmesh
extends java.lang.Object

The core submesh class.


Nested Class Summary
static class CalCoreSubmesh.Face
           
 
Field Summary
protected  int coreMaterialThreadId
           
protected  java.util.Vector<CalCoreSubMorphTarget> coreSubMorphTargets
           
protected  int lodCount
           
protected  boolean[] tangentsEnabled
           
protected  TexCoord2fBuffer[] textureCoordinateBuffers
           
protected  CalCoreSubmesh.Face[] vectorFace
           
protected  float[] vectorPhysicalProperty
           
protected  org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.Spring[] vectorSpring
           
protected  org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.VertexInfo[] vectorVertexInfo
           
protected  Vector3fBuffer vertexNormals
           
protected  Vector3fBuffer vertexPositions
           
protected  ScalarfBuffer[] vertexTangentCrossFactors
           
protected  Vector3fBuffer[] vertexTangents
           
 
Constructor Summary
CalCoreSubmesh()
          Constructs the core submesh instance.
 
Method Summary
 int addCoreSubMorphTarget(CalCoreSubMorphTarget subMorphTarget)
          Add a core sub morph target to the submesh.
 int getCoreMaterialThreadId()
          Returns the ID of the core material thread.
 CalCoreSubMorphTarget getCoreSubMorphTarget(int id)
          Gets a core sub morph target by id.
 int getCoreSubMorphTargetCount()
           
 java.util.Vector<CalCoreSubMorphTarget> getCoreSubMorphTargets()
           
 int getFaceCount()
          Returns the number of faces.
 int getLodCount()
          Returns the number of LOD steps.
 int getSpringCount()
          Returns the number of springs.
 TexCoord2fBuffer[] getTextureCoordinates()
          Returns an array of texture coordinate buffers - one for each texture map.
 CalCoreSubmesh.Face[] getVectorFace()
          Returns the face vector.
 float[] getVectorPhysicalProperty()
          Returns the physical property vector.
 org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.Spring[] getVectorSpring()
          Returns the spring vector.
 org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.VertexInfo[] getVectorVertexInfo()
          Returns the vertex vector.
 int getVertexCount()
          Returns the number of vertices.
 void getVertexNormal(int vertexId, org.openmali.vecmath2.Vector3f normal)
           
 Vector3fBuffer getVertexNormals()
           
 void getVertexPosition(int vertexId, org.openmali.vecmath2.Vector3f position)
           
 Vector3fBuffer getVertexPositions()
           
 ScalarfBuffer getVertexTangentCrossFactors(int mapId)
           
 Vector3fBuffer getVertexTangents(int mapId)
           
 boolean isTangentsEnabled(int mapId)
           
 void reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount)
          Reserves memory for the vertices, faces and texture coordinates.
 void scale(float factor)
          Scale the Submesh.
 void setCoreMaterialThreadId(int coreMaterialThreadId)
          Sets the ID of the core material thread.
 void setFace(int faceId, CalCoreSubmesh.Face face)
          Sets a specified face.
 void setLodCount(int lodCount)
          Sets the number of LOD steps.
 void setPhysicalProperty(int vertexId, float physicalProperty)
          Sets a specified physical property.
 void setSpring(int springId, org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.Spring spring)
          Sets a specified spring.
 void setTangentsEnabled(int mapId, boolean enabled)
           
 void setTangentSpace(int vertexId, int textureCoordinateId, org.openmali.vecmath2.Vector3f tangent, float crossFactor)
          Sets the tangent vector associated with a specified texture coordinate pair.
 void setTextureCoordinate(int vertexId, int textureCoordinateId, org.openmali.vecmath2.Vector2f textureCoordinate)
          Sets a specified texture coordinate.
 void setVertex(int vertexId, org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.VertexInfo vertex, org.openmali.vecmath2.Vector3f position, org.openmali.vecmath2.Vector3f normal)
          Sets a specified vertex.
 void updateTangentVector(int v0, int v1, int v2, int mapId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vectorVertexInfo

protected org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.VertexInfo[] vectorVertexInfo

vertexPositions

protected Vector3fBuffer vertexPositions

vertexNormals

protected Vector3fBuffer vertexNormals

tangentsEnabled

protected boolean[] tangentsEnabled

vertexTangents

protected Vector3fBuffer[] vertexTangents

vertexTangentCrossFactors

protected ScalarfBuffer[] vertexTangentCrossFactors

textureCoordinateBuffers

protected TexCoord2fBuffer[] textureCoordinateBuffers

vectorPhysicalProperty

protected float[] vectorPhysicalProperty

vectorFace

protected CalCoreSubmesh.Face[] vectorFace

vectorSpring

protected org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.Spring[] vectorSpring

coreSubMorphTargets

protected java.util.Vector<CalCoreSubMorphTarget> coreSubMorphTargets

coreMaterialThreadId

protected int coreMaterialThreadId

lodCount

protected int lodCount
Constructor Detail

CalCoreSubmesh

public CalCoreSubmesh()
Constructs the core submesh instance. This function is the default constructor of the core submesh instance.

Method Detail

getCoreMaterialThreadId

public int getCoreMaterialThreadId()
Returns the ID of the core material thread. This function returns the ID of the core material thread of this core submesh instance.

Returns:
The ID of the core material thread.

getFaceCount

public int getFaceCount()
Returns the number of faces. This function returns the number of faces in the core submesh instance.

Returns:
The number of faces.

getLodCount

public int getLodCount()
Returns the number of LOD steps. This function returns the number of LOD steps in the core submesh instance.

Returns:
The number of LOD steps.

getSpringCount

public int getSpringCount()
Returns the number of springs. This function returns the number of springs in the core submesh instance.

Returns:
The number of springs.

getVectorFace

public CalCoreSubmesh.Face[] getVectorFace()
Returns the face vector. This function returns the vector that contains all faces of the core submesh instance.

Returns:
A reference to the face vector.

getVectorPhysicalProperty

public float[] getVectorPhysicalProperty()
Returns the physical property vector. This function returns the vector that contains all physical properties of the core submesh instance.

Returns:
A reference to the physical property vector.

getVectorSpring

public org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.Spring[] getVectorSpring()
Returns the spring vector. This function returns the vector that contains all springs of the core submesh instance.

Returns:
A reference to the spring vector.

getTextureCoordinates

public TexCoord2fBuffer[] getTextureCoordinates()
Returns an array of texture coordinate buffers - one for each texture map.

Returns:
an array of texture coordinate buffers.

getVectorVertexInfo

public org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.VertexInfo[] getVectorVertexInfo()
Returns the vertex vector. This function returns the vector that contains all vertices of the core submesh instance.

Returns:
A reference to the vertex vector.

getVertexCount

public int getVertexCount()
Returns the number of vertices. This function returns the number of vertices in the core submesh instance.

Returns:
The number of vertices.

reserve

public void reserve(int vertexCount,
                    int textureCoordinateCount,
                    int faceCount,
                    int springCount)
Reserves memory for the vertices, faces and texture coordinates. This function reserves memory for the vertices, faces, texture coordinates and springs of the core submesh instance.

Parameters:
vertexCount - The number of vertices that this core submesh instance should be able to hold.
textureCoordinateCount - The number of texture coordinates that this core submesh instance should be able to hold.
faceCount - The number of faces that this core submesh instance should be able to hold.
springCount - The number of springs that this core submesh instance should be able to hold.

setCoreMaterialThreadId

public void setCoreMaterialThreadId(int coreMaterialThreadId)
Sets the ID of the core material thread. This function sets the ID of the core material thread of the core submesh instance.

Parameters:
coreMaterialThreadId - The ID of the core material thread that should be set.

setFace

public void setFace(int faceId,
                    CalCoreSubmesh.Face face)
Sets a specified face. This function sets a specified face in the core submesh instance.

Parameters:
faceId - The ID of the face.
face - The face that should be set.

setLodCount

public void setLodCount(int lodCount)
Sets the number of LOD steps. This function sets the number of LOD steps of the core submesh instance.

Parameters:
lodCount - The number of LOD steps that should be set.

setPhysicalProperty

public void setPhysicalProperty(int vertexId,
                                float physicalProperty)
Sets a specified physical property. This function sets a specified physical property in the core submesh instance.

Parameters:
vertexId - The ID of the vertex.
physicalProperty - The physical property that should be set.

setSpring

public void setSpring(int springId,
                      org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.Spring spring)
Sets a specified spring. This function sets a specified spring in the core submesh instance.

Parameters:
springId - The ID of the spring.
spring - The spring that should be set.

setTextureCoordinate

public void setTextureCoordinate(int vertexId,
                                 int textureCoordinateId,
                                 org.openmali.vecmath2.Vector2f textureCoordinate)
Sets a specified texture coordinate. This function sets a specified texture coordinate in the core submesh instance.

Parameters:
vertexId - The ID of the vertex.
textureCoordinateId - The ID of the texture coordinate.
textureCoordinate - The texture coordinate that should be set.

setVertex

public void setVertex(int vertexId,
                      org.jagatoo.loaders.models.cal3d.core.CalCoreSubmesh.VertexInfo vertex,
                      org.openmali.vecmath2.Vector3f position,
                      org.openmali.vecmath2.Vector3f normal)
Sets a specified vertex. This function sets a specified vertex in the core submesh instance.

Parameters:
vertexId - The ID of the vertex.
vertex - The vertex that should be set.

setTangentSpace

public void setTangentSpace(int vertexId,
                            int textureCoordinateId,
                            org.openmali.vecmath2.Vector3f tangent,
                            float crossFactor)
Sets the tangent vector associated with a specified texture coordinate pair. This function sets the tangent vector associated with a specified texture coordinate pair in the core submesh instance.

Parameters:
vertexId - The ID of the vertex.
textureCoordinateId - The ID of the texture coordinate channel.
tangent - The tangent vector that should be stored.
crossFactor - The cross-product factor that should be stored.

getVertexNormals

public Vector3fBuffer getVertexNormals()
Returns:
the vertex normals buffer.

getVertexNormal

public void getVertexNormal(int vertexId,
                            org.openmali.vecmath2.Vector3f normal)

getVertexPositions

public Vector3fBuffer getVertexPositions()
Returns:
the vertex positions buffer.

getVertexPosition

public void getVertexPosition(int vertexId,
                              org.openmali.vecmath2.Vector3f position)

getVertexTangents

public Vector3fBuffer getVertexTangents(int mapId)

getVertexTangentCrossFactors

public ScalarfBuffer getVertexTangentCrossFactors(int mapId)

isTangentsEnabled

public boolean isTangentsEnabled(int mapId)
Returns:
true if tangent vectors are enabled for the specified mapId.

setTangentsEnabled

public void setTangentsEnabled(int mapId,
                               boolean enabled)

updateTangentVector

public void updateTangentVector(int v0,
                                int v1,
                                int v2,
                                int mapId)

addCoreSubMorphTarget

public int addCoreSubMorphTarget(CalCoreSubMorphTarget subMorphTarget)
Add a core sub morph target to the submesh.


getCoreSubMorphTarget

public CalCoreSubMorphTarget getCoreSubMorphTarget(int id)
Gets a core sub morph target by id.


getCoreSubMorphTargets

public java.util.Vector<CalCoreSubMorphTarget> getCoreSubMorphTargets()

getCoreSubMorphTargetCount

public int getCoreSubMorphTargetCount()

scale

public void scale(float factor)
Scale the Submesh. This function rescale all the data that are in the core submesh instance.

Parameters:
factor - A float with the scale factor