espresso3d.engine.world.sector.actor.skeleton
Class E3DBone

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.world.sector.actor.skeleton.E3DBone

public class E3DBone
extends E3DRenderable

Author:
Curt TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Constructor Summary
E3DBone(E3DBone toCopyBone)
           
E3DBone(E3DEngine engine, java.lang.String boneID, E3DVector3F startPosition)
           
 
Method Summary
 void attachBone(E3DBone bone)
          Attach a child bone to this bone.
 void attachVertex(E3DVertex vertex)
          Attach a vertex to this bone
 E3DBone findBoneByID(java.lang.String boneID)
          Searches this and all sub-bones for the correct bone with ID == boneID
 java.util.ArrayList getAttachedVertices()
           
 java.lang.String getBoneID()
           
 java.util.HashMap getChildBones()
           
 E3DVector3F getCurrentPosition()
           
 E3DBone getParentBone()
           
 E3DSkeleton getSkeleton()
           
 E3DVector3F getStartPosition()
           
 void render()
           
 void resetAll()
          This will reset all animation for the bone and all child bones recursively.
 void rotateBoneAroundParent(double angle)
          This will rotate a bone and all attached vertices around its parent's joint.
 void rotateBoneAroundVec(double angle, E3DVector3F aroundVec)
          This will rotate a bone and all child bones angle radian amount around aroundVec.
 void setAttachedVertices(java.util.ArrayList attachedVertices)
           
 void setSkeleton(E3DSkeleton skeleton)
           
 void translateBone(E3DVector3F translationAmt)
          Translate the bone and all attached vertices with the bone
 void translateBoneWithoutVertices(E3DVector3F translationAmt)
          Translates a bone without actually translating linked vertices.
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getBlendMode, getKey, getRenderMode, initCorrectGeometryRenderer, isKeyChanged, setBlendMode, setKeyChanged, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DBone

public E3DBone(E3DEngine engine,
               java.lang.String boneID,
               E3DVector3F startPosition)

E3DBone

public E3DBone(E3DBone toCopyBone)
Method Detail

render

public void render()
Specified by:
render in class E3DRenderable

attachVertex

public void attachVertex(E3DVertex vertex)
Attach a vertex to this bone

Parameters:
vertex -

attachBone

public void attachBone(E3DBone bone)
Attach a child bone to this bone. This child will become property of this bone exclusively. Bones must NOT be referenced by more than one other parent bone. This will cause animation and other functions to completely fail. IE: A bone can only be in 1 bone group and only have 1 parent -- so it can only be attached to 1 parent bone at a time


rotateBoneAroundParent

public void rotateBoneAroundParent(double angle)
This will rotate a bone and all attached vertices around its parent's joint. All child bones will also be moved along with this bone by the same amt as this bone.


rotateBoneAroundVec

public void rotateBoneAroundVec(double angle,
                                E3DVector3F aroundVec)
This will rotate a bone and all child bones angle radian amount around aroundVec. This will only work if it is a root bone (ie: has no parent). Otherwise, no action will be performed!

Parameters:
angle -
aroundVec -

translateBone

public void translateBone(E3DVector3F translationAmt)
Translate the bone and all attached vertices with the bone

Parameters:
translationAmt -

translateBoneWithoutVertices

public void translateBoneWithoutVertices(E3DVector3F translationAmt)
Translates a bone without actually translating linked vertices. This is only used by the skeleton for something like an entire actor translation to keep it oriented correctly with the actor

Parameters:
translationAmt -

resetAll

public void resetAll()
This will reset all animation for the bone and all child bones recursively. It ensures that the new position of the bone will be centered around the actor position correctly (not the origin as would be specified by the bone definition)


getAttachedVertices

public java.util.ArrayList getAttachedVertices()

setAttachedVertices

public void setAttachedVertices(java.util.ArrayList attachedVertices)

getBoneID

public java.lang.String getBoneID()

getChildBones

public java.util.HashMap getChildBones()

getParentBone

public E3DBone getParentBone()

getSkeleton

public E3DSkeleton getSkeleton()

setSkeleton

public void setSkeleton(E3DSkeleton skeleton)

getCurrentPosition

public E3DVector3F getCurrentPosition()

getStartPosition

public E3DVector3F getStartPosition()

findBoneByID

public E3DBone findBoneByID(java.lang.String boneID)
Searches this and all sub-bones for the correct bone with ID == boneID

Parameters:
boneID -
Returns:
Either a bone with boneID == boneID or null