hmi.graphics.scenegraph
Class VertexWeights

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.graphics.scenegraph.VertexWeights
All Implemented Interfaces:
XMLStructure

public class VertexWeights
extends XMLStructureAdapter

A VertexWeight object couples GMesh vertices to one or more joints, with a certain weight. The number of joints associated which a single vertex is variable, and specified with the jcount parameter of the constructor. Joints are referred to by means of joint indices, resolved within the GMesh to actual joint names.

Author:
Job Zwiers

Field Summary
private static float DEFAULT_EPSMIN
           
private static float DEFAULT_EPSPLUS
           
private static int INDICESPERLINE
           
private  int[] jcount
           
private static int JCOUNTSPERLINE
           
private  int[] jointIndices
           
private  float[] jointWeights
           
private  int[] offsets
           
private static int WEIGHTSPERLINE
           
private static String XMLTAG
           
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING
 
Constructor Summary
VertexWeights()
          Default constructor
VertexWeights(int[] jcount, int[] jointIndices, float[] jointWeights)
          Creates a new VertexWeight object: jcounts specifies, for every GMesh vertex, the number of associated joints.
 
Method Summary
 StringBuilder appendAttributeString(StringBuilder buf, XMLFormatting fmt)
          appends the id and sid XML attributes to buf.
private  int calculateOffsets()
           
 boolean checkAccumulatedWeights(float epsmin, float epsplus, boolean showdeviations)
           
 void decodeAttributes(HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          decodes the id and sid XML attributes.
 int[] getJCounts()
           
 int[] getJointIndices()
          Returns the jointIndices array.
 float[] getJointWeights()
          Returns the jointWeights array.
 float[] getVertexWeightColors(boolean useWeights, float[][] colorCoding)
          Returns a float array filled with vertex colors, encoding the vertex weight information.
 String getXMLTag()
          returns the XML Stag for XML encoding
protected  void remapData(int nrOfDistinctVertices, int[] map)
           
 String toString()
          the default toString() method returns the result of toXMLSTring()
static String xmlTag()
          The XML Stag for XML encoding
 
Methods inherited from class hmi.xml.XMLStructureAdapter
appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttributes, appendAttributes, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, appendContent, appendDoubleElement, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendETag, appendETag, appendFloatArrayElement, appendFloatElement, appendFloats, appendIntArrayElement, appendIntElement, appendInts, appendLongElement, appendNewLine, appendNewLine, appendNewLine, appendOpenSTag, appendOptionalDoubleElement, appendOptionalFloatElement, appendOptionalIntElement, appendOptionalLongElement, appendSpaces, appendSpaces, appendSTag, appendSTag, appendSTag, appendStringArrayElement, appendStrings, appendSystemNewLine, appendTab, appendTextElement, appendXML, appendXML, appendXML, appendXML, appendXML, appendXMLStructure, appendXMLStructureList, appendXMLTextElementList, countTokens, countTokens, decodeAttribute, decodeAttribute, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeContent, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getNamespace, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, hasContent, parseXMLElement, postProcess, preProcess, readXML, readXML, readXML, setConsoleAttributeEnabled, setDefaultRecoverMode, setRecoverMode, spaces, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, writeXML, writeXML, writeXML, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jcount

private int[] jcount

jointIndices

private int[] jointIndices

jointWeights

private float[] jointWeights

offsets

private int[] offsets

DEFAULT_EPSMIN

private static final float DEFAULT_EPSMIN
See Also:
Constant Field Values

DEFAULT_EPSPLUS

private static final float DEFAULT_EPSPLUS
See Also:
Constant Field Values

JCOUNTSPERLINE

private static final int JCOUNTSPERLINE
See Also:
Constant Field Values

INDICESPERLINE

private static final int INDICESPERLINE
See Also:
Constant Field Values

WEIGHTSPERLINE

private static final int WEIGHTSPERLINE
See Also:
Constant Field Values

XMLTAG

private static final String XMLTAG
See Also:
Constant Field Values
Constructor Detail

VertexWeights

public VertexWeights()
Default constructor


VertexWeights

public VertexWeights(int[] jcount,
                     int[] jointIndices,
                     float[] jointWeights)
Creates a new VertexWeight object: jcounts specifies, for every GMesh vertex, the number of associated joints. The jointIndices array contains the actual joint indices, arranged into small (variable length) segments with lengths specified by the jcount parameter. Each element of a segment refers to a single joint. The jointWeights array has a structure similar to jointIndices. It specifies the weights for the vertex-to-joint links.

Method Detail

calculateOffsets

private int calculateOffsets()

getJointIndices

public int[] getJointIndices()
Returns the jointIndices array.


getJointWeights

public float[] getJointWeights()
Returns the jointWeights array.


getJCounts

public int[] getJCounts()

remapData

protected void remapData(int nrOfDistinctVertices,
                         int[] map)

checkAccumulatedWeights

public boolean checkAccumulatedWeights(float epsmin,
                                       float epsplus,
                                       boolean showdeviations)

getVertexWeightColors

public float[] getVertexWeightColors(boolean useWeights,
                                     float[][] colorCoding)
Returns a float array filled with vertex colors, encoding the vertex weight information.


toString

public String toString()
Description copied from class: XMLStructureAdapter
the default toString() method returns the result of toXMLSTring()

Overrides:
toString in class XMLStructureAdapter

appendAttributeString

public StringBuilder appendAttributeString(StringBuilder buf,
                                           XMLFormatting fmt)
appends the id and sid XML attributes to buf.

Overrides:
appendAttributeString in class XMLStructureAdapter

decodeAttributes

public void decodeAttributes(HashMap<String,String> attrMap,
                             XMLTokenizer tokenizer)
decodes the id and sid XML attributes.

Overrides:
decodeAttributes in class XMLStructureAdapter

xmlTag

public static String xmlTag()
The XML Stag for XML encoding


getXMLTag

public String getXMLTag()
returns the XML Stag for XML encoding

Specified by:
getXMLTag in interface XMLStructure
Overrides:
getXMLTag in class XMLStructureAdapter