hmi.graphics.opengl
Class GLSkinnedMesh

java.lang.Object
  extended by hmi.graphics.opengl.GLBasicMesh
      extended by hmi.graphics.opengl.GLSkinnedMesh
All Implemented Interfaces:
GLRenderObject

public class GLSkinnedMesh
extends GLBasicMesh


Field Summary
(package private)  float[][] directionVectors
           
private  float[] fapAmplitudes
           
private  int[] fapCount
           
private  float[][] fapDirectionVectors
           
private  float[][] fapDisplacements
           
private  int[] fapIndex
           
private  float[] fapWeight
           
private  float[][] inverseBindMatrices
           
private  int[] jointCount
           
private  int[] jointIndex
           
private  GLNodeMarker[] jointMarkers
           
private  float[][] jointMatrices
           
private  String[] jointNames
           
private  String[] jointSIDs
           
private  float[] jointWeight
           
private  String[] morphTargets
           
private  int normalAttrIndex
           
private  float[] normalCurrent
           
private  float[] normalOriginal
           
private static boolean notshown
           
private  int nrOfMorphTargets
           
private  float[][] originalInverseBindMatrices
           
private  int[] parentIndex
           
private  String[] skeletonIds
           
private  float[][] transformMatrices
           
private  boolean useFaps
           
private  int vertexCoordAttrIndex
           
private  float[] vertexCoordBaseData
           
private  float[] vertexCoordCurrent
           
private  float[][] vertexCoordMorphData
           
private  float[] vertexCoordMorphed
           
 
Fields inherited from class hmi.graphics.opengl.GLBasicMesh
geometryType, nrOfVertices
 
Constructor Summary
GLSkinnedMesh()
          Creates a new deformable mesh
 
Method Summary
 SkeletonInterpolator adaptSkeletonInterpolator(SkeletonInterpolator skel)
           
 int addGLVertexAttribute(VertexAttribute va)
          Adds a new vertex attribute, and returns its index number.
 void addJointMarkers()
           
 void addJointMarkers(float radius)
           
 void addJointMarkers(float radius, int grid)
           
private  void calculateMatricesAndFaps()
          (re)calculates the transform matrices: matrices[i] = jointMatrices[i] * inverseBindMatrices[i]
 void deform()
          Transforms the mesh attributes.
private  void deformCN()
          transforms vertex coordinates and vertex normals
 int[] getJointCount()
           
 int[] getJointIndex()
           
 String[] getJointSIDs()
           
 float[] getJointWeight()
           
 int getMorphTargetIndexFor(String morphTarget)
          returns the index of the specified morph target, provided it occurs within the array of morph targets for this mesh.
 String[] getMorphTargets()
          returns the array with morph targets
 void glInit(GLRenderContext glc)
          initializes the OpenGL ARRAY and ELEMENT_ARRAY buffers.
 void glRender(GLRenderContext glc)
          renders the mesh, using the vertexBuffer data.
 void morph(int[] targets, float[] weights)
          Morph the specified morph targets, with specified weights, tohether with the base mesh.
 void morph(int target, float weight)
          Morph the specified morph target, with specified weight, tohether with the base mesh.
 void morph(String[] targetNames, float[] weights)
          Morph the specified morph targets, with specified weights, tohether with the base mesh.
 void morph(String targetName, float weight)
          Morph the specified morph target, with specified weight, tohether with the base mesh.
 void setFapAmplitudes(float[] amplitudes)
          Copies the current FAPS amplitudes from the specified amplitude float array.
 void setFapDirectionVectors(float[][] fapDirectionVectors)
          Sets a reference to an array of Vec3f (i.e. float[3]) vectors, one vector per FAP, definining the direction vector for each FAP.
 void setFapVertexWeights(int[] fapCount, int[] fapIndex, float[] fapWeight)
          Sets the data needed for facial action parameters: indices for FAPS, corresponding weights, and, for every vertex, the number of FAPS to which it is attached.
 void setInverseBindMatrices(float[][] invBindMatrices)
          Creates copies of the specified inverse bind matrices
 void setJointNames(String[] jointNames)
           
 void setJointSIDs(String[] jointSIDs)
           
 void setJointVertexWeights(int[] jointCount, int[] jointIndex, float[] jointWeight)
          Sets the data needed for skinning: indices for joints, corresponding weights, and, for every vertex, the number of joints to which it is attached.
 void setMorphTargets(String[] morphTargets)
           
 void setOriginalInverseBindMatrices(float[][] invBindMatrices)
          Creates copies of the specified inverse bind matrices
 void setParentIndex(int[] parentIndex)
           
 void setSkeletonIds(String[] skeletonIds)
           
 void setUseFaps(boolean useFaps)
          Enables or disables the usage of FAPS
 void setVertexCoordMorphData(float[][] vertexCoordMorphData)
          Sets the array of arrays, containing the coord data for all morph targets
 void setVJoints(VJoint[] vjoints)
           
 
Methods inherited from class hmi.graphics.opengl.GLBasicMesh
bindShaderProg, getId, getVertexData, setGeometryType, setId, setIndexData, setVertexData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vertexCoordBaseData

private float[] vertexCoordBaseData

vertexCoordMorphData

private float[][] vertexCoordMorphData

vertexCoordMorphed

private float[] vertexCoordMorphed

vertexCoordCurrent

private float[] vertexCoordCurrent

vertexCoordAttrIndex

private int vertexCoordAttrIndex

normalOriginal

private float[] normalOriginal

normalCurrent

private float[] normalCurrent

normalAttrIndex

private int normalAttrIndex

jointIndex

private int[] jointIndex

jointWeight

private float[] jointWeight

jointCount

private int[] jointCount

jointMatrices

private float[][] jointMatrices

inverseBindMatrices

private float[][] inverseBindMatrices

originalInverseBindMatrices

private float[][] originalInverseBindMatrices

transformMatrices

private float[][] transformMatrices

jointSIDs

private String[] jointSIDs

jointNames

private String[] jointNames

parentIndex

private int[] parentIndex

skeletonIds

private String[] skeletonIds

useFaps

private boolean useFaps

fapIndex

private int[] fapIndex

fapWeight

private float[] fapWeight

fapCount

private int[] fapCount

directionVectors

float[][] directionVectors

fapDirectionVectors

private float[][] fapDirectionVectors

fapDisplacements

private float[][] fapDisplacements

fapAmplitudes

private float[] fapAmplitudes

morphTargets

private String[] morphTargets

nrOfMorphTargets

private int nrOfMorphTargets

jointMarkers

private GLNodeMarker[] jointMarkers

notshown

private static boolean notshown
Constructor Detail

GLSkinnedMesh

public GLSkinnedMesh()
Creates a new deformable mesh

Method Detail

setParentIndex

public void setParentIndex(int[] parentIndex)

adaptSkeletonInterpolator

public SkeletonInterpolator adaptSkeletonInterpolator(SkeletonInterpolator skel)

setFapDirectionVectors

public void setFapDirectionVectors(float[][] fapDirectionVectors)
Sets a reference to an array of Vec3f (i.e. float[3]) vectors, one vector per FAP, definining the direction vector for each FAP.


setUseFaps

public void setUseFaps(boolean useFaps)
Enables or disables the usage of FAPS


setFapAmplitudes

public void setFapAmplitudes(float[] amplitudes)
Copies the current FAPS amplitudes from the specified amplitude float array. These are scalar numbers, one for every FAP, and are multiplied with the static FAP displacement vector in order to get the current FAP translation.


setMorphTargets

public void setMorphTargets(String[] morphTargets)

getMorphTargets

public String[] getMorphTargets()
returns the array with morph targets


getMorphTargetIndexFor

public int getMorphTargetIndexFor(String morphTarget)
returns the index of the specified morph target, provided it occurs within the array of morph targets for this mesh. Otherwise, it returns -1;


setVertexCoordMorphData

public void setVertexCoordMorphData(float[][] vertexCoordMorphData)
Sets the array of arrays, containing the coord data for all morph targets


setJointSIDs

public void setJointSIDs(String[] jointSIDs)

setJointNames

public void setJointNames(String[] jointNames)

setSkeletonIds

public void setSkeletonIds(String[] skeletonIds)

setVJoints

public void setVJoints(VJoint[] vjoints)

addGLVertexAttribute

public int addGLVertexAttribute(VertexAttribute va)
Adds a new vertex attribute, and returns its index number.

Overrides:
addGLVertexAttribute in class GLBasicMesh

setJointVertexWeights

public void setJointVertexWeights(int[] jointCount,
                                  int[] jointIndex,
                                  float[] jointWeight)
Sets the data needed for skinning: indices for joints, corresponding weights, and, for every vertex, the number of joints to which it is attached.


setFapVertexWeights

public void setFapVertexWeights(int[] fapCount,
                                int[] fapIndex,
                                float[] fapWeight)
Sets the data needed for facial action parameters: indices for FAPS, corresponding weights, and, for every vertex, the number of FAPS to which it is attached.


setInverseBindMatrices

public void setInverseBindMatrices(float[][] invBindMatrices)
Creates copies of the specified inverse bind matrices


setOriginalInverseBindMatrices

public void setOriginalInverseBindMatrices(float[][] invBindMatrices)
Creates copies of the specified inverse bind matrices


calculateMatricesAndFaps

private void calculateMatricesAndFaps()
(re)calculates the transform matrices: matrices[i] = jointMatrices[i] * inverseBindMatrices[i]


addJointMarkers

public void addJointMarkers()

addJointMarkers

public void addJointMarkers(float radius)

addJointMarkers

public void addJointMarkers(float radius,
                            int grid)

glInit

public void glInit(GLRenderContext glc)
initializes the OpenGL ARRAY and ELEMENT_ARRAY buffers. Calculates the buffer offsets for coordinates, normals. colors etc. inside vertexBuffer

Specified by:
glInit in interface GLRenderObject
Overrides:
glInit in class GLBasicMesh

glRender

public void glRender(GLRenderContext glc)
renders the mesh, using the vertexBuffer data.

Specified by:
glRender in interface GLRenderObject
Overrides:
glRender in class GLBasicMesh

morph

public void morph(String targetName,
                  float weight)
Morph the specified morph target, with specified weight, tohether with the base mesh. The latter receives the remaining weight


morph

public void morph(int target,
                  float weight)
Morph the specified morph target, with specified weight, tohether with the base mesh. The latter receives the remaining weight


morph

public void morph(String[] targetNames,
                  float[] weights)
Morph the specified morph targets, with specified weights, tohether with the base mesh. The latter receives the remaining weight


morph

public void morph(int[] targets,
                  float[] weights)
Morph the specified morph targets, with specified weights, tohether with the base mesh. The latter receives the remaining weight


deform

public void deform()
Transforms the mesh attributes.


deformCN

private void deformCN()
transforms vertex coordinates and vertex normals


getJointSIDs

public String[] getJointSIDs()
Returns:
the jointSIDs

getJointIndex

public int[] getJointIndex()
Returns:
the jointIndex

getJointWeight

public float[] getJointWeight()
Returns:
the jointWeight

getJointCount

public int[] getJointCount()
Returns:
the jointCount