j3d.org Code

org.j3d.geom.hanim
Class HAnimHumanoid

java.lang.Object
  extended by org.j3d.geom.hanim.HAnimObject
      extended by org.j3d.geom.hanim.HAnimHumanoid
All Implemented Interfaces:
HAnimObjectParent

public abstract class HAnimHumanoid
extends HAnimObject
implements HAnimObjectParent

Common base representation of a H-Anim Humanoid object.

The Humanoid object is defined by 6.2 Humanoid.

Derived classes must set a collection of renderer-specific values. The most critical is the output object. Internationalisation Resource Names

Version:
$Revision: 1.6 $
Author:
Justin Couch

Field Summary
protected  float[] bboxCenter
          The current bboxCenter of the segment
protected  float[] bboxSize
          The current bboxSize of the segment
protected  boolean hasChildUpdates
          Flag to indicate if anything has changed this frame
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 numSkeleton
          The number of valid viewpoints of this object
protected  int numSkinCoords
          The number of items in the coordinate list (raw number, not * 3)
protected  int numSkinNormals
          The number of items in the coordinate list (raw number, not * 3)
protected  int numViewpoints
          The number of valid viewpoints of this object
protected  int objectCount
          Counter for the number of children that have requested IDs
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  HAnimJoint rootJoint
          This is the root joint for the skeleton
protected  HAnimObject[] skeleton
          The current collection of the root joint and any attached sites.
protected  boolean skeletonChanged
          Flag indicating that the skeleton (rootJoint) has had one or more of it's children change and needs to be recalculated.
protected  float[] skinCoords
          The current coordinates of the segment
protected  float[] skinNormals
          The current coordinates of the segment
protected  java.lang.Object[] viewpoints
          The current collection of viewpoints nodes registered to this object.
 
Fields inherited from class org.j3d.geom.hanim.HAnimObject
errorReporter, name
 
Constructor Summary
HAnimHumanoid()
          Create a new, default instance of the site.
 
Method Summary
 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 getInfo(java.lang.String[] vals)
          Get the current collection of info strings.
 void getJoints(HAnimJoint[] vals)
          Get the current collection of joints.
 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 getSegments(HAnimObject[] vals)
          Get the current collection of segments.
 void getSites(HAnimObject[] vals)
          Get the current collection of sites.
 void getSkeleton(HAnimObject[] vals)
          Get the current collection of skeleton.
 void getSkinCoord(float[] val)
          Get the current value of the skinCoord.
 void getSkinNormal(float[] val)
          Get the current value of the skinNormal.
 void getTranslation(float[] val)
          Get the current value of the translation.
 java.lang.String getVersion()
          Get the currently set version string.
 void getViewpoints(java.lang.Object[] vals)
          Get the current collection of viewpoints.
 int numInfo()
          Get the number of elements in the info string array.
 int numJoints()
          Get the number of currently valid joints.
 int numSegments()
          Get the number of currently valid segments.
 int numSites()
          Get the number of currently valid sites.
 int numSkeleton()
          Get the number of currently valid skeleton.
 int numSkinCoord()
          Get the number of elements in skinCoord
 int numSkinNormal()
          Get the number of elements in skinNormal
 int numViewpoints()
          Get the number of currently valid viewpoints.
 int requestNextObjectIndex()
          Get the object's index into the greater list of things.
 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 site.
 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 setInfo(java.lang.String[] infoStrings, int numValid)
          Set the new list of info strings.
 void setJoints(HAnimJoint[] kids, int numValid)
          Replace the existing joints with the new set of joints.
 void setRotation(float[] val)
          Set a new value for the rotation of this site.
 void setScale(float[] val)
          Set a new value for the scale of this site.
 void setScaleOrientation(float[] val)
          Set a new value for the scaleOrientation of this site.
 void setSegments(HAnimSegment[] kids, int numValid)
          Replace the existing segments with the new set of segments.
 void setSites(HAnimSite[] kids, int numValid)
          Replace the existing sites with the new set of sites.
 void setSkeleton(HAnimObject[] kids, int numValid)
          Replace the existing skeleton with the new set of skeleton.
 void setSkinCoord(float[] val, int numElements)
          Set a new value for the skinCoord of this joint.
 void setSkinNormal(float[] val, int numElements)
          Set a new value for the skinNormal of this joint.
 void setTranslation(float[] val)
          Set a new value for the translation of this site.
 void setVersion(java.lang.String ver)
          Set the new version string for this humanoid.
 void setViewpoints(java.lang.Object[] kids, int numValid)
          Replace the existing viewpoints with the new set of viewpoints.
 void updateSkeleton()
          All the skeletal changes are in for this frame, so update the matrix values now.
 
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

bboxCenter

protected float[] bboxCenter
The current bboxCenter of the segment


bboxSize

protected float[] bboxSize
The current bboxSize of the segment


skinCoords

protected float[] skinCoords
The current coordinates of the segment


numSkinCoords

protected int numSkinCoords
The number of items in the coordinate list (raw number, not * 3)


skinNormals

protected float[] skinNormals
The current coordinates of the segment


numSkinNormals

protected int numSkinNormals
The number of items in the coordinate list (raw number, not * 3)


outputCoords

protected java.lang.Object outputCoords
Reference to the object that we place the modified coordinates in. May be either a float[] or NIO FloatBuffer, depending on the end user implementation.


outputNormals

protected java.lang.Object outputNormals
Reference to the object that we place the modified normals in. May be either a float[] or NIO FloatBuffer, depending on the end user implementation.


viewpoints

protected java.lang.Object[] viewpoints
The current collection of viewpoints nodes registered to this object.


numViewpoints

protected int numViewpoints
The number of valid viewpoints of this object


skeleton

protected HAnimObject[] skeleton
The current collection of the root joint and any attached sites.


numSkeleton

protected int numSkeleton
The number of valid viewpoints of this object


localMatrix

protected javax.vecmath.Matrix4f localMatrix
Local matrix value that combines all the fields together


rootJoint

protected HAnimJoint rootJoint
This is the root joint for the skeleton


hasChildUpdates

protected boolean hasChildUpdates
Flag to indicate if anything has changed this frame


matrixChanged

protected boolean matrixChanged
Flag to indicate the root matrix values have changed, thus needing to regenerate the entire skeleton and vertices.


skeletonChanged

protected boolean skeletonChanged
Flag indicating that the skeleton (rootJoint) has had one or more of it's children change and needs to be recalculated.


objectCount

protected int objectCount
Counter for the number of children that have requested IDs

Constructor Detail

HAnimHumanoid

public HAnimHumanoid()
Create a new, default instance of the site.

Method Detail

childUpdateRequired

public void childUpdateRequired(HAnimObject child)
Notification that the child has changed and will need to recalculate it's vertex positions. A change could be in the transformation matrix, coordinate weights or referenced coordinates (or elsewhere).

Specified by:
childUpdateRequired in interface HAnimObjectParent
Parameters:
child - Reference to the child that has changed

requestNextObjectIndex

public int requestNextObjectIndex()
Get the object's index into the greater list of things. For example, a joint needs to be able to update it's matrix in a large array of matrices and it needs to update the same matrix every time.

Specified by:
requestNextObjectIndex in interface HAnimObjectParent
Returns:
The index of the object into global lists

setErrorReporter

public 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. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Overrides:
setErrorReporter in class HAnimObject
Parameters:
reporter - The instance to use or null

getCenter

public void getCenter(float[] val)
Get the current value of the center.

Parameters:
val - An array of at least length 3 to copy the value to

setCenter

public void setCenter(float[] val)
Set a new value for the center of this site. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the center is taken from the 1st three values.

Parameters:
val - The new center value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getScale

public void getScale(float[] val)
Get the current value of the scale.

Parameters:
val - An array of at least length 3 to copy the value to

setScale

public void setScale(float[] val)
Set a new value for the scale of this site. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the scale is taken from the 1st three values.

Parameters:
val - The new scale value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getTranslation

public void getTranslation(float[] val)
Get the current value of the translation.

Parameters:
val - An array of at least length 3 to copy the value to

setTranslation

public void setTranslation(float[] val)
Set a new value for the translation of this site. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the translation is taken from the 1st three values.

Parameters:
val - The new translation value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getScaleOrientation

public void getScaleOrientation(float[] val)
Get the current value of the scaleOrientation.

Parameters:
val - An array of at least length 4 to copy the value to

setScaleOrientation

public void setScaleOrientation(float[] val)
Set a new value for the scaleOrientation of this site. If the array is null or not long enough an exception is generated. The array must be at least 4 units long, and the scaleOrientation is taken from the 1st three values.

Parameters:
val - The new scaleOrientation value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getRotation

public void getRotation(float[] val)
Get the current value of the rotation.

Parameters:
val - An array of at least length 4 to copy the value to

setRotation

public void setRotation(float[] val)
Set a new value for the rotation of this site. If the array is null or not long enough an exception is generated. The array must be at least 4 units long, and the rotation is taken from the 1st three values.

Parameters:
val - The new rotation value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getBboxCenter

public void getBboxCenter(float[] val)
Get the current value of the bboxCenter.

Parameters:
val - An array of at least length 3 to copy the value to

setBboxCenter

public void setBboxCenter(float[] val)
Set a new value for the bboxCenter of this segment. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the bboxCenter is taken from the 1st three values.

Parameters:
val - The new bboxCenter value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getBboxSize

public void getBboxSize(float[] val)
Get the current value of the bboxSize.

Parameters:
val - An array of at least length 3 to copy the value to

setBboxSize

public void setBboxSize(float[] val)
Set a new value for the bboxSize of this segment. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the bboxSize is taken from the 1st three values.

Parameters:
val - The new bboxSize value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getVersion

public java.lang.String getVersion()
Get the currently set version string. If none is set, null is returned.

Returns:
The current string instance or null

setVersion

public void setVersion(java.lang.String ver)
Set the new version string for this humanoid. A null value will remove it.

Parameters:
ver - The new string to use

numInfo

public int numInfo()
Get the number of elements in the info string array.

Returns:
The number of values kept in the info list

getInfo

public void getInfo(java.lang.String[] vals)
Get the current collection of info strings. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numInfo() to copy the values to

setInfo

public void setInfo(java.lang.String[] infoStrings,
                    int numValid)
Set the new list of info strings. A numValid of zero will remove all the currently set values.

Parameters:
infoStrings - The collection of strings to use
numValid - The number kids to copy from the given array

numSkinCoord

public int numSkinCoord()
Get the number of elements in skinCoord

Returns:
The number of elements kept in the skinCoordinates list

getSkinCoord

public void getSkinCoord(float[] val)
Get the current value of the skinCoord.

Parameters:
val - An array of at least length of numSkinCoord() * 3 to copy the values to

setSkinCoord

public void setSkinCoord(float[] val,
                         int numElements)
Set a new value for the skinCoord of this joint. If the array is null or not long enough an exception is generated. The array must be at least a multiple of 3 units long.

Parameters:
val - The new skinCoord value to use
numElements - The number of 3d-vectors in the array
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

numSkinNormal

public int numSkinNormal()
Get the number of elements in skinNormal

Returns:
The number of elements kept in the skinNormalinates list

getSkinNormal

public void getSkinNormal(float[] val)
Get the current value of the skinNormal.

Parameters:
val - An array of at least length of numSkinNormal() * 3 to copy the values to

setSkinNormal

public void setSkinNormal(float[] val,
                          int numElements)
Set a new value for the skinNormal of this joint. If the array is null or not long enough an exception is generated. The array must be at least a multiple of 3 units long.

Parameters:
val - The new skinNormal value to use
numElements - The number of 3d-vectors in the array
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

numViewpoints

public int numViewpoints()
Get the number of currently valid viewpoints.

Returns:
The number of values kept in the viewpoint list

getViewpoints

public void getViewpoints(java.lang.Object[] vals)
Get the current collection of viewpoints. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numViewpoints() to copy the values to

setViewpoints

public void setViewpoints(java.lang.Object[] kids,
                          int numValid)
Replace the existing viewpoints with the new set of viewpoints.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array

numJoints

public int numJoints()
Get the number of currently valid joints.

Returns:
The number of values kept in the joint list

getJoints

public void getJoints(HAnimJoint[] vals)
Get the current collection of joints. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numJoints() to copy the values to

setJoints

public void setJoints(HAnimJoint[] kids,
                      int numValid)
Replace the existing joints with the new set of joints.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array

numSkeleton

public int numSkeleton()
Get the number of currently valid skeleton.

Returns:
The number of values kept in the joint list

getSkeleton

public void getSkeleton(HAnimObject[] vals)
Get the current collection of skeleton. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numSkeleton() to copy the values to

setSkeleton

public void setSkeleton(HAnimObject[] kids,
                        int numValid)
Replace the existing skeleton with the new set of skeleton. The skeleton can only consist of a single Joint and multiple Site objects. Any other HAnim object types shall issue an exception.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array
Throws:
java.lang.IllegalArgumentException - One of the provided s

numSites

public int numSites()
Get the number of currently valid sites.

Returns:
The number of values kept in the joint list

getSites

public void getSites(HAnimObject[] vals)
Get the current collection of sites. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numSites() to copy the values to

setSites

public void setSites(HAnimSite[] kids,
                     int numValid)
Replace the existing sites with the new set of sites. The sites can only consist of a single Joint and multiple Site objects. Any other HAnim object types shall issue an exception.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array

numSegments

public int numSegments()
Get the number of currently valid segments.

Returns:
The number of values kept in the joint list

getSegments

public void getSegments(HAnimObject[] vals)
Get the current collection of segments. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numSegments() to copy the values to

setSegments

public void setSegments(HAnimSegment[] kids,
                        int numValid)
Replace the existing segments with the new set of segments. The segments can only consist of a single Joint and multiple Segment objects. Any other HAnim object types shall issue an exception.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array

updateSkeleton

public void updateSkeleton()
All the skeletal changes are in for this frame, so update the matrix values now. If nothing has changed, don't bother doing any calculations and return immediately.


j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org