hmi.elckerlyc.faceengine
Class MorphFU

java.lang.Object
  extended by hmi.elckerlyc.faceengine.MorphFU
All Implemented Interfaces:
KeyPositionManager, FaceUnit

public class MorphFU
extends Object
implements FaceUnit

A basic facial animation unit consisting of one morph target. The key positions are: start, ready, relax, end. This descripes an apex-like intensity development: The between start and ready, the morph target is blended in; between relax and end the morph target is blended out. The max intensity for the morph target can also be specified. More than one MorphFU can be active at the same time. Parameter constraints: none

Author:
Dennis Reidsma

Field Summary
private  FacePlayer facePlayer
           
private  float intensity
           
private  KeyPositionManager keyPositionManager
           
private  String[] morphTargets
           
private  boolean multiple
           
private  float prevMorphedWeight
           
private  String targetName
           
 
Constructor Summary
MorphFU()
           
 
Method Summary
 void addKeyPosition(KeyPosition kp)
           
 void cleanup()
          Clean up the face - i.e. remove traces of this faceunit
 FaceUnit copy(FacePlayer fp)
          Create a copy of this face unit and link it to the faceplayer
 TimedFaceUnit createTFU(BMLBlockPeg bbPeg, String i, String bmlId)
          Creates the TimedFaceUnit corresponding to this face unit
 KeyPosition getKeyPosition(String name)
           
 List<KeyPosition> getKeyPositions()
          Gets a sorted view of the list of keypositions
 String getParameterValue(String name)
           
 double getPreferedDuration()
           
 String getReplacementGroup()
          Get the faceunit replacement group (=typically the BML behavior) Used to determine the currently active persistent TFU for this group in the player Only one group is active at a time
 boolean hasValidParameters()
           
 void play(double t)
          Executes the face unit, by morphing the face.
 void removeKeyPosition(String id)
           
 void setFacePlayer(FacePlayer fp)
           
 void setKeyPositions(List<KeyPosition> p)
           
 void setParameterValue(String name, float value)
           
 void setParameterValue(String name, String value)
           
private  void updateMorphTargets()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

intensity

private float intensity

targetName

private String targetName

multiple

private boolean multiple

keyPositionManager

private final KeyPositionManager keyPositionManager

morphTargets

private String[] morphTargets

facePlayer

private FacePlayer facePlayer

prevMorphedWeight

private float prevMorphedWeight
Constructor Detail

MorphFU

public MorphFU()
Method Detail

setFacePlayer

public void setFacePlayer(FacePlayer fp)

setParameterValue

public void setParameterValue(String name,
                              float value)
Specified by:
setParameterValue in interface FaceUnit

setParameterValue

public void setParameterValue(String name,
                              String value)
Specified by:
setParameterValue in interface FaceUnit

getParameterValue

public String getParameterValue(String name)
Specified by:
getParameterValue in interface FaceUnit

hasValidParameters

public boolean hasValidParameters()
Specified by:
hasValidParameters in interface FaceUnit

updateMorphTargets

private void updateMorphTargets()

play

public void play(double t)
          throws FUPlayException
Executes the face unit, by morphing the face. Linear interpolate from intensity 0..max between start and ready; keep at max till relax; then back to zero from relax till end.

Specified by:
play in interface FaceUnit
Parameters:
t - execution time, 0 < t < 1
Throws:
FUPlayException - if the play fails for some reason

cleanup

public void cleanup()
Description copied from interface: FaceUnit
Clean up the face - i.e. remove traces of this faceunit

Specified by:
cleanup in interface FaceUnit

createTFU

public TimedFaceUnit createTFU(BMLBlockPeg bbPeg,
                               String i,
                               String bmlId)
Creates the TimedFaceUnit corresponding to this face unit

Specified by:
createTFU in interface FaceUnit
Parameters:
i - behaviour id
bmlId - BML block id
Returns:
the TFU

getReplacementGroup

public String getReplacementGroup()
Description copied from interface: FaceUnit
Get the faceunit replacement group (=typically the BML behavior) Used to determine the currently active persistent TFU for this group in the player Only one group is active at a time

Specified by:
getReplacementGroup in interface FaceUnit

getPreferedDuration

public double getPreferedDuration()
Specified by:
getPreferedDuration in interface FaceUnit
Returns:
Prefered duration (in seconds) of this face unit, 0 means not determined/infinite

copy

public FaceUnit copy(FacePlayer fp)
Create a copy of this face unit and link it to the faceplayer

Specified by:
copy in interface FaceUnit

getKeyPosition

public KeyPosition getKeyPosition(String name)
Specified by:
getKeyPosition in interface KeyPositionManager

addKeyPosition

public void addKeyPosition(KeyPosition kp)
Specified by:
addKeyPosition in interface KeyPositionManager

getKeyPositions

public List<KeyPosition> getKeyPositions()
Description copied from interface: KeyPositionManager
Gets a sorted view of the list of keypositions

Specified by:
getKeyPositions in interface KeyPositionManager

setKeyPositions

public void setKeyPositions(List<KeyPosition> p)
Specified by:
setKeyPositions in interface KeyPositionManager

removeKeyPosition

public void removeKeyPosition(String id)
Specified by:
removeKeyPosition in interface KeyPositionManager