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

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

public class CalSubmesh
extends java.lang.Object

The submesh class.


Nested Class Summary
 class CalSubmesh.PhysicalProperty
           
 
Field Summary
protected  CalCoreMaterial coreMaterial
           
protected  CalCoreSubmesh coreSubmesh
           
protected  int faceCount
           
protected  IndexBuffer faceIndices
           
protected  boolean internalData
           
protected  float[] vectorMorphTargetWeight
           
protected  CalSubmesh.PhysicalProperty[] vectorPhysicalProperty
           
protected  int vertexCount
           
protected  Vector3fBuffer vertexNormals
           
protected  Vector3fBuffer vertexPositions
           
protected  ScalarfBuffer[] vertexTangentCrossFactors
           
protected  Vector3fBuffer[] vertexTangents
           
 
Constructor Summary
CalSubmesh(CalCoreSubmesh coreSubmesh)
          Creates a submesh based on a core submesh.
 
Method Summary
 void disableInternalData()
          Disable internal data (and thus springs system)
 float getBaseWeight()
          Gets weight of the base vertices.
 CalCoreMaterial getCoreMaterial()
           
 CalCoreSubmesh getCoreSubmesh()
          Provides access to the core submesh.
 int getFaceCount()
          Returns the number of faces.
 IndexBuffer getFaceIndices()
          Provides access to the face data.
 float getMorphTargetWeight(int blendId)
          Gets weight of a morph target with the given id.
 int getMorphTargetWeightCount()
           
 float[] getVectorMorphTargetWeight()
           
 CalSubmesh.PhysicalProperty[] getVectorPhysicalProperty()
          Returns the physical property vector.
 int getVertexCount()
          Returns the number of vertices.
 Vector3fBuffer getVertexNormals()
          Returns the normal vector.
 Vector3fBuffer getVertexPositions()
          Returns the vertex vector.
 Vector3fBuffer getVertexTangents(int mapId)
           
 int getVertexTangentsMapCount()
           
 boolean hasInternalData()
          Returns if the submesh instance handles vertex data internally.
 boolean isTangentsEnabled(int mapId)
          Returns true if tangent vectors are enabled.
 void setCoreMaterial(CalCoreMaterial coreMaterial)
          Sets the core material ID.
 void setLodLevel(float lodLevel)
          Sets the LOD level.
 void setMorphTargetWeight(int blendId, float weight)
          Sets weight of a morph target with the given id.
 void setTangentsEnabled(int mapId, boolean enabled)
          Enables (and calculates) or disables the storage of tangent spaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coreSubmesh

protected CalCoreSubmesh coreSubmesh

vertexPositions

protected Vector3fBuffer vertexPositions

vertexNormals

protected Vector3fBuffer vertexNormals

vertexTangents

protected Vector3fBuffer[] vertexTangents

vertexTangentCrossFactors

protected ScalarfBuffer[] vertexTangentCrossFactors

faceIndices

protected IndexBuffer faceIndices

vectorMorphTargetWeight

protected float[] vectorMorphTargetWeight

vectorPhysicalProperty

protected CalSubmesh.PhysicalProperty[] vectorPhysicalProperty

vertexCount

protected int vertexCount

faceCount

protected int faceCount

coreMaterial

protected CalCoreMaterial coreMaterial

internalData

protected boolean internalData
Constructor Detail

CalSubmesh

public CalSubmesh(CalCoreSubmesh coreSubmesh)
Creates a submesh based on a core submesh.

Parameters:
coreSubmesh - A pointer to the core submesh on which this submesh instance should be based on.
Method Detail

getCoreMaterial

public CalCoreMaterial getCoreMaterial()
Returns:
the core material. This function returns the core material of the submesh instance.

getCoreSubmesh

public CalCoreSubmesh getCoreSubmesh()
Provides access to the core submesh. This function returns the core submesh on which this submesh instance is based on.


getFaceCount

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

Returns:
The number of faces.

getFaceIndices

public IndexBuffer getFaceIndices()
Provides access to the face data. This function returns the face data (vertex indices) of the submesh instance. The LOD setting of the submesh instance is taken into account.

Returns:
The number of faces written to the buffer.

getVertexNormals

public Vector3fBuffer getVertexNormals()
Returns the normal vector. This function returns the vector that contains all normals of the submesh instance.

Returns:
A reference to the normal vector.

getVertexTangents

public Vector3fBuffer getVertexTangents(int mapId)

getVertexTangentsMapCount

public int getVertexTangentsMapCount()

getVectorPhysicalProperty

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

Returns:
A reference to the physical property vector.

getVertexPositions

public Vector3fBuffer getVertexPositions()
Returns the vertex vector. This function returns the vector that contains all vertices of the 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 submesh instance.

Returns:
The number of vertices.

hasInternalData

public boolean hasInternalData()
Returns if the submesh instance handles vertex data internally. This function returns wheter the submesh instance handles vertex data internally.

Returns:
true if vertex data is handled internally, false if not

disableInternalData

public void disableInternalData()
Disable internal data (and thus springs system)


isTangentsEnabled

public boolean isTangentsEnabled(int mapId)
Returns true if tangent vectors are enabled. This function returns true if the submesh contains tangent vectors.

Returns:
True if tangent vectors are enabled.

setTangentsEnabled

public void setTangentsEnabled(int mapId,
                               boolean enabled)
Enables (and calculates) or disables the storage of tangent spaces. This function enables or disables the storage of tangent space bases.


setCoreMaterial

public void setCoreMaterial(CalCoreMaterial coreMaterial)
Sets the core material ID. This function sets the core material ID of the submesh instance.

Parameters:
coreMaterial - The core material ID that should be set.

setLodLevel

public void setLodLevel(float lodLevel)
Sets the LOD level. This function sets the LOD level of the submesh instance.

Parameters:
lodLevel - The LOD level in the range [0.0, 1.0].

setMorphTargetWeight

public void setMorphTargetWeight(int blendId,
                                 float weight)
Sets weight of a morph target with the given id.

Parameters:
blendId - The morph target id.
weight - The weight to be set.

getMorphTargetWeight

public float getMorphTargetWeight(int blendId)
Gets weight of a morph target with the given id.

Parameters:
blendId - The morph target id.
Returns:
The weight of the morph target.

getBaseWeight

public float getBaseWeight()
Gets weight of the base vertices.

Returns:
The weight of the base vertices.

getVectorMorphTargetWeight

public float[] getVectorMorphTargetWeight()

getMorphTargetWeightCount

public int getMorphTargetWeightCount()