|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.hanim.HAnimObject org.j3d.geom.hanim.HAnimJoint
public class HAnimJoint
Representation of a H-Anim Joint object.
The joint object is defined by 6.5 Joint.
Although the HAnim spec does not define bounding box fields, VRML/X3D do, and we have an internal Grouping node to handling this joint, so we've added fields and support for it anyway.
Internationalisation Resource Names
Field Summary | |
---|---|
protected float[] |
bboxCenter
The current bboxCenter of the joint |
protected float[] |
bboxSize
The current bboxSize of the joint |
protected HAnimObject[] |
children
The current collection of children nodes registered to this object. |
protected HAnimDisplacer[] |
displacers
The current collection of children nodes registered to this object. |
protected javax.vecmath.Matrix4f |
globalMatrix
Matrix that contains the global transformation down to this site |
protected javax.vecmath.Matrix4f |
localMatrix
Local matrix value that combines all the fields together |
protected boolean |
matrixChanged
Flag to indicate the root matrix values have changed, thus needing to regenerate the entire skeleton and vertices. |
protected int |
numChildren
The number of valid children of this object |
protected int |
numDisplacers
The number of valid children of this object |
protected int |
numSkinCoord
The number of items in skinCoordIndex and skinCoordWeight fields |
protected int |
numSourceCoords
The current number of source skin coordinates |
protected int |
numSourceNormals
The current number of source skin normals |
protected int |
objectIndex
Index of this joint into the global array of values. |
protected java.lang.Object |
outputCoords
Reference to the object that we place the modified coordinates in. |
protected java.lang.Object |
outputNormals
Reference to the object that we place the modified normals in. |
protected HAnimObjectParent |
parent
The parent of this joint |
protected int[] |
skinCoordIndex
The skin coordinate index values into the global coordinate list |
protected float[] |
skinCoordWeight
The skin coordinate weight values. |
protected float[] |
sourceCoords
Reference to the array that holds the base coordinate values |
protected float[] |
sourceNormals
Reference to the array that holds the base normal values |
protected boolean |
updateSent
Flag to say that we're already sent an update request and there's no need to send another. |
Fields inherited from class org.j3d.geom.hanim.HAnimObject |
---|
errorReporter, name |
Constructor Summary | |
---|---|
HAnimJoint()
Create a new, default instance of the joint. |
Method Summary | |
---|---|
void |
addChild(HAnimObject kid)
Add a child node to the existing collection. |
void |
addDisplacer(HAnimDisplacer kid)
Add a child node to the existing collection. |
void |
childUpdateRequired(HAnimObject child)
Notification that the child has changed and will need to recalculate it's vertex positions. |
void |
getBboxCenter(float[] val)
Get the current value of the bboxCenter. |
void |
getBboxSize(float[] val)
Get the current value of the bboxSize. |
void |
getCenter(float[] val)
Get the current value of the center. |
void |
getChildren(HAnimObject[] vals)
Get the current collection of children. |
void |
getDisplacers(HAnimDisplacer[] vals)
Get the current collection of children. |
void |
getLimitOrientation(float[] val)
Get the current value of the limitOrientation. |
void |
getLowerLimit(float[] val)
Get the current value of the lowerLimit. |
void |
getRotation(float[] val)
Get the current value of the rotation. |
void |
getScale(float[] val)
Get the current value of the scale. |
void |
getScaleOrientation(float[] val)
Get the current value of the scaleOrientation. |
void |
getSkinCoordIndex(float[] val)
Get the current value of the skinCoordIndex. |
void |
getSkinCoordWeight(float[] val)
Get the current value of the skinCoordWeight. |
void |
getStiffness(float[] val)
Get the current value of the stiffness. |
void |
getTranslation(float[] val)
Get the current value of the translation. |
void |
getUpperLimit(float[] val)
Get the current value of the upperLimit. |
int |
numChildren()
Get the number of currently valid children. |
int |
numDisplacers()
Get the number of currently valid children. |
int |
numLowerLimit()
Get the number of elements in lowerLimit |
int |
numSkinCoord()
Get the number of elements in the skinCoordIndex field, and by association skinCoordWeight (if any weights have been set). |
int |
numStiffness()
Get the number of elements in stiffness |
int |
numUpperLimit()
Get the number of elements in upperLimit |
void |
removeChild(HAnimObject kid)
Remove a child node from the existing collection. |
void |
removeDisplacer(HAnimDisplacer kid)
Remove a child node from the existing collection. |
int |
requestNextObjectIndex()
Get the object's index into the greater list of things. |
protected void |
sendUpdateMsg()
Send an update message to the parent, if one has not already been sent. |
void |
setBboxCenter(float[] val)
Set a new value for the bboxCenter of this segment. |
void |
setBboxSize(float[] val)
Set a new value for the bboxSize of this segment. |
void |
setCenter(float[] val)
Set a new value for the center of this joint. |
void |
setChildren(HAnimObject[] kids,
int numValid)
Replace the existing children with the new set of children. |
void |
setDisplacers(HAnimDisplacer[] kids,
int numValid)
Replace the existing displacers with the new set of displacers. |
void |
setErrorReporter(ErrorReporter reporter)
Register an error reporter with the object so that any errors generated by the object can be reported in a nice, pretty fashion. |
void |
setLimitOrientation(float[] val)
Set a new value for the limitOrientation of this joint. |
void |
setLowerLimit(float[] val,
int numElements)
Set a new value for the lowerLimit of this joint. |
protected void |
setParent(HAnimObjectParent parent,
float[] srcCoords,
int numCoords,
float[] srcNormals,
int numNormals,
java.lang.Object destCoords,
java.lang.Object destNormals)
Set the parent of this node to the given reference. |
void |
setRotation(float[] val)
Set a new value for the rotation of this joint. |
void |
setScale(float[] val)
Set a new value for the scale of this joint. |
void |
setScaleOrientation(float[] val)
Set a new value for the scaleOrientation of this joint. |
void |
setSkinCoordIndex(int[] val,
int numValid)
Set a new value for the skinCoordIndex of this joint. |
void |
setSkinCoordWeight(float[] val)
Set a new value for the skinCoordWeight of this joint. |
void |
setStiffness(float[] val,
int numElements)
Set a new value for the stiffness of this joint. |
void |
setTranslation(float[] val)
Set a new value for the translation of this joint. |
void |
setUpperLimit(float[] val,
int numElements)
Set a new value for the upperLimit of this joint. |
protected void |
updateSkeleton(javax.vecmath.Matrix4f parentTransform,
boolean parentChanged)
All the skeletal changes are in for this frame, so update the matrix values now. |
protected void |
updateSources(float[] srcCoords,
int numCoords,
float[] srcNormals,
int numNormals,
java.lang.Object destCoords,
java.lang.Object destNormals)
The global coordinate and/or normal values were changed by the user, so go through and update the local references. |
Methods inherited from class org.j3d.geom.hanim.HAnimObject |
---|
getName, setName, updateMatrix |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected float[] bboxCenter
protected float[] bboxSize
protected int[] skinCoordIndex
protected float[] skinCoordWeight
protected int numSkinCoord
protected HAnimObject[] children
protected int numChildren
protected HAnimDisplacer[] displacers
protected int numDisplacers
protected javax.vecmath.Matrix4f localMatrix
protected javax.vecmath.Matrix4f globalMatrix
protected HAnimObjectParent parent
protected boolean matrixChanged
protected boolean updateSent
protected float[] sourceCoords
protected int numSourceCoords
protected float[] sourceNormals
protected int numSourceNormals
protected java.lang.Object outputCoords
protected java.lang.Object outputNormals
protected int objectIndex
Constructor Detail |
---|
public HAnimJoint()
Method Detail |
---|
public void childUpdateRequired(HAnimObject child)
childUpdateRequired
in interface HAnimObjectParent
child
- Reference to the child that has changedpublic int requestNextObjectIndex()
requestNextObjectIndex
in interface HAnimObjectParent
public void setErrorReporter(ErrorReporter reporter)
setErrorReporter
in class HAnimObject
reporter
- The instance to use or nullpublic void setCenter(float[] val)
val
- The new center value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getCenter(float[] val)
val
- An array of at least length 3 to copy the value topublic void getScale(float[] val)
val
- An array of at least length 3 to copy the value topublic void setScale(float[] val)
val
- The new scale value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getTranslation(float[] val)
val
- An array of at least length 3 to copy the value topublic void setTranslation(float[] val)
val
- The new translation value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getScaleOrientation(float[] val)
val
- An array of at least length 4 to copy the value topublic void setScaleOrientation(float[] val)
val
- The new scaleOrientation value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getRotation(float[] val)
val
- An array of at least length 4 to copy the value topublic void setRotation(float[] val)
val
- The new rotation value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getBboxCenter(float[] val)
val
- An array of at least length 3 to copy the value topublic void setBboxCenter(float[] val)
val
- The new bboxCenter value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getBboxSize(float[] val)
val
- An array of at least length 3 to copy the value topublic void setBboxSize(float[] val)
If the three values are all -1, then this will disable the use of the explicit bounds.
val
- The new bboxSize value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getLimitOrientation(float[] val)
val
- An array of at least length 3 to copy the value topublic void setLimitOrientation(float[] val)
val
- The new limitOrientation value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public int numLowerLimit()
public void getLowerLimit(float[] val)
val
- An array of at least length of numLowerLimit() * 3 to copy
the values topublic void setLowerLimit(float[] val, int numElements)
val
- The new lowerLimit value to usenumElements
- The number of 3d-vectors in the array
java.lang.IllegalArgumentException
- The array is null or not long enough.public int numUpperLimit()
public void getUpperLimit(float[] val)
val
- An array of at least length of numUpperLimit() * 3 to copy
the values topublic void setUpperLimit(float[] val, int numElements)
val
- The new upperLimit value to usenumElements
- The number of 3d-vectors in the array
java.lang.IllegalArgumentException
- The array is null or not long enough.public int numStiffness()
public void getStiffness(float[] val)
val
- An array of at least length of numStiffness() * 3 to copy
the values topublic void setStiffness(float[] val, int numElements)
val
- The new stiffness value to usenumElements
- The number of values in the array
java.lang.IllegalArgumentException
- The array is null or not long enough.public int numSkinCoord()
public void getSkinCoordIndex(float[] val)
val
- An array of at least length of numSkinCoord() to copy
the values topublic void setSkinCoordIndex(int[] val, int numValid)
val
- The new skinCoordIndex value to usenumValid
- The number of valid values to read from the index list
java.lang.IllegalArgumentException
- The array is null or not long enough.public void getSkinCoordWeight(float[] val)
val
- An array of at least length of numSkinCoord() to copy
the values topublic void setSkinCoordWeight(float[] val)
val
- The new skinCoordWeight value to use
java.lang.IllegalArgumentException
- The array is null or not long enough.public int numChildren()
public void getChildren(HAnimObject[] vals)
vals
- An array of at least length numChildren() to copy the values topublic void setChildren(HAnimObject[] kids, int numValid)
kids
- The collection of child objects to now usenumValid
- The number kids to copy from the given array
java.lang.IllegalArgumentException
- The child is not one of a Joint,
Segment or Sitepublic void addChild(HAnimObject kid)
kid
- The new child instance to add
java.lang.IllegalArgumentException
- The child is not one of a Joint,
Segment or Sitepublic void removeChild(HAnimObject kid)
kid
- The child instance to remove
java.lang.IllegalArgumentException
- The child is not one of a Joint,
Segment or Sitepublic int numDisplacers()
public void getDisplacers(HAnimDisplacer[] vals)
vals
- An array of at least length numChildren() to copy the values topublic void setDisplacers(HAnimDisplacer[] kids, int numValid)
kids
- The collection of child objects to now usenumValid
- The number kids to copy from the given arraypublic void addDisplacer(HAnimDisplacer kid)
kid
- The new child instance to addpublic void removeDisplacer(HAnimDisplacer kid)
kid
- The child instance to removeprotected void setParent(HAnimObjectParent parent, float[] srcCoords, int numCoords, float[] srcNormals, int numNormals, java.lang.Object destCoords, java.lang.Object destNormals)
parent
- The new parent instance to usesrcCoords
- The array for the original, unmodified coordinatesnumCoords
- Number of valid coordinate valuessrcNormals
- The array for the original, unmodified normalsnumNormals
- Number of valid normal valuesdestCoords
- The array/buffer for the transformed coordinatesdestNormals
- The array/buffer for the transformed normalsprotected void updateSources(float[] srcCoords, int numCoords, float[] srcNormals, int numNormals, java.lang.Object destCoords, java.lang.Object destNormals)
srcCoords
- The array for the original, unmodified coordinatesnumCoords
- Number of valid coordinate valuessrcNormals
- The array for the original, unmodified normalsnumNormals
- Number of valid normal valuesdestCoords
- The array/buffer for the transformed coordinatesdestNormals
- The array/buffer for the transformed normalsprotected void updateSkeleton(javax.vecmath.Matrix4f parentTransform, boolean parentChanged)
parentTransform
- The transformation into global coordinates of
the parent of this jointparentChanged
- Flag to indicate that the parent transformation
matrix has changed or is still the same as last callprotected void sendUpdateMsg()
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |