C# 클래스 Axiom.Animating.Skeleton

A collection of Bone objects used to animate a skinned mesh.
Skeletal animation works by having a collection of 'bones' which are actually just joints with a position and orientation, arranged in a tree structure. For example, the wrist joint is a child of the elbow joint, which in turn is a child of the shoulder joint. Rotating the shoulder automatically moves the elbow and wrist as well due to this hierarchy.

So how does this animate a mesh? Well every vertex in a mesh is assigned to one or more bones which affects it's position when the bone is moved. If a vertex is assigned to more than one bone, then weights must be assigned to determine how much each bone affects the vertex (actually a weight of 1.0 is used for single bone assignments). Weighted vertex assignments are especially useful around the joints themselves to avoid 'pinching' of the mesh in this region.

Therefore by moving the skeleton using preset animations, we can animate the mesh. The advantage of using skeletal animation is that you store less animation data, especially as vertex counts increase. In addition, you are able to blend multiple animations together (e.g. walking and looking around, running and shooting) and provide smooth transitions between animations without incurring as much of an overhead as would be involved if you did this on the core vertex data.

Skeleton definitions are loaded from datafiles, namely the .xsf file format. They are loaded on demand, especially when referenced by a Mesh.

상속: Axiom.Core.Resource
파일 보기 프로젝트 열기: WolfgangSt/axiom 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
animationList Axiom.Collections.AnimationCollection
attachmentPoints List
boneList BoneCollection
namedBoneList AxiomCollection
rootBones BoneList

공개 메소드들

메소드 설명
ContainsAnimation ( string name ) : bool
ContainsBone ( string name ) : bool

Checks to see if a bone exists

CreateAnimation ( string name, float length ) : Animation

Creates a new Animation object for animating this skeleton.

CreateAttachmentPoint ( string name, ushort parentHandle, Axiom.MathLib.Quaternion rotation, Vector3 translation ) : AttachmentPoint

TODO: should this replace an existing attachment point with the same name?

CreateBone ( ) : Bone

Creates a brand new Bone owned by this Skeleton.

This method creates an unattached new Bone for this skeleton. Unless this is to be the root bone (there must only be one of these), you must attach it to another Bone in the skeleton using addChild for it to be any use. For this reason you will likely be better off creating child bones using the Bone.CreateChild method instead, once you have created the root bone.

Note that this method automatically generates a handle for the bone, which you can retrieve using Bone.Handle. If you wish the new Bone to have a specific handle, use the alternate form of this method which takes a handle as a parameter, although you should note the restrictions.

CreateBone ( string name ) : Bone

Creates a brand new Bone owned by this Skeleton.

This method creates an unattached new Bone for this skeleton. Unless this is to be the root bone (there must only be one of these), you must attach it to another Bone in the skeleton using addChild for it to be any use. For this reason you will likely be better off creating child bones using the Bone.CreateChild method instead, once you have created the root bone.

CreateBone ( string name, ushort handle ) : Bone

Creates a brand new Bone owned by this Skeleton.

CreateBone ( ushort handle ) : Bone

Creates a brand new Bone owned by this Skeleton.

DumpContents ( string fileName ) : void

GetAnimation ( string name ) : Animation

Returns the animation with the specified name.

GetBone ( string name ) : Bone

Gets a bone by its name.

GetBone ( ushort handle ) : Bone

Gets a bone by its handle.

GetRootBone ( int index ) : Bone

Gets the root bone at the specified index.

InitAnimationState ( Axiom.Animating.AnimationStateSet animSet ) : void

Initialize an animation set suitable for use with this mesh.

Only recommended for use inside the engine, not by applications.

RemoveAnimation ( string name ) : void

Removes the animation with the specified name from this skeleton.

Reset ( ) : void

Resets the position and orientation of all bones in this skeleton to their original binding position.

A skeleton is bound to a mesh in a binding pose. Bone positions are then modified from this position during animation. This method returns all the bones to their original position and orientation.

Reset ( bool resetManualBones ) : void

Resets the position and orientation of all bones in this skeleton to their original binding position.

A skeleton is bound to a mesh in a binding pose. Bone positions are then modified from this position during animation. This method returns all the bones to their original position and orientation.

SetAnimationState ( Axiom.Animating.AnimationStateSet animSet ) : void

SetBindingPose ( ) : void

Sets the current position / orientation to be the 'binding pose' ie the layout in which bones were originally bound to a mesh.

Skeleton ( ResourceManager parent, String name, System.UInt64 handle, string group ) : System

Constructor, don't call directly, use SkeletonManager.

On creation, a Skeleton has a no bones, you should create them and link them together appropriately.

Skeleton ( ResourceManager parent, String name, System.UInt64 handle, string group, bool isManual, IManualResourceLoader loader ) : System

Constructor, don't call directly, use SkeletonManager.

On creation, a Skeleton has a no bones, you should create them and link them together appropriately.

UpdateTransforms ( ) : void

Updates all the derived transforms in the skeleton.

보호된 메소드들

메소드 설명
DeriveRootBone ( ) : void

Internal method which parses the bones to derive the root bone.

load ( ) : void

Generic load, called by SkeletonManager.

unload ( ) : void

Generic unload, called by SkeletonManager.

비공개 메소드들

메소드 설명
GetBoneMatrices ( Axiom.MathLib.Matrix4 matrices ) : void

Populates the passed in array with the bone matrices based on the current position.

Internal use only. The array passed in must be at least as large as the number of bones. Assumes animation has already been updated.

Skeleton ( ) : System

메소드 상세

ContainsAnimation() 공개 메소드

public ContainsAnimation ( string name ) : bool
name string
리턴 bool

ContainsBone() 공개 메소드

Checks to see if a bone exists
public ContainsBone ( string name ) : bool
name string Name of the bone to check.
리턴 bool

CreateAnimation() 공개 메소드

Creates a new Animation object for animating this skeleton.
public CreateAnimation ( string name, float length ) : Animation
name string The name of this animation
length float The length of the animation in seconds
리턴 Animation

CreateAttachmentPoint() 공개 메소드

TODO: should this replace an existing attachment point with the same name?
public CreateAttachmentPoint ( string name, ushort parentHandle, Axiom.MathLib.Quaternion rotation, Vector3 translation ) : AttachmentPoint
name string
parentHandle ushort
rotation Axiom.MathLib.Quaternion
translation Vector3
리턴 AttachmentPoint

CreateBone() 공개 메소드

Creates a brand new Bone owned by this Skeleton.
This method creates an unattached new Bone for this skeleton. Unless this is to be the root bone (there must only be one of these), you must attach it to another Bone in the skeleton using addChild for it to be any use. For this reason you will likely be better off creating child bones using the Bone.CreateChild method instead, once you have created the root bone.

Note that this method automatically generates a handle for the bone, which you can retrieve using Bone.Handle. If you wish the new Bone to have a specific handle, use the alternate form of this method which takes a handle as a parameter, although you should note the restrictions.

public CreateBone ( ) : Bone
리턴 Bone

CreateBone() 공개 메소드

Creates a brand new Bone owned by this Skeleton.
This method creates an unattached new Bone for this skeleton. Unless this is to be the root bone (there must only be one of these), you must attach it to another Bone in the skeleton using addChild for it to be any use. For this reason you will likely be better off creating child bones using the Bone.CreateChild method instead, once you have created the root bone.
public CreateBone ( string name ) : Bone
name string /// The name to give to this new bone - must be unique within this skeleton. /// Note that the way the engine looks up bones is via a numeric handle, so if you name a /// Bone this way it will be given an automatic sequential handle. The name is just /// for your convenience, although it is recommended that you only use the handle to /// retrieve the bone in performance-critical code. ///
리턴 Bone

CreateBone() 공개 메소드

Creates a brand new Bone owned by this Skeleton.
public CreateBone ( string name, ushort handle ) : Bone
name string /// The name to give to this new bone - must be unique within this skeleton. /// Note that the way the engine looks up bones is via a numeric handle, so if you name a /// Bone this way it will be given an automatic sequential handle. The name is just /// for your convenience, although it is recommended that you only use the handle to /// retrieve the bone in performance-critical code. ///
handle ushort /// The handle to give to this new bone - must be unique within this skeleton. /// You should also ensure that all bone handles are eventually contiguous (this is to simplify /// their compilation into an indexed array of transformation matrices). For this reason /// it is advised that you use the simpler createBone method which automatically assigns a /// sequential handle starting from 0. ///
리턴 Bone

CreateBone() 공개 메소드

Creates a brand new Bone owned by this Skeleton.
public CreateBone ( ushort handle ) : Bone
handle ushort /// The handle to give to this new bone - must be unique within this skeleton. /// You should also ensure that all bone handles are eventually contiguous (this is to simplify /// their compilation into an indexed array of transformation matrices). For this reason /// it is advised that you use the simpler createBone method which automatically assigns a /// sequential handle starting from 0. ///
리턴 Bone

DeriveRootBone() 보호된 메소드

Internal method which parses the bones to derive the root bone.
protected DeriveRootBone ( ) : void
리턴 void

DumpContents() 공개 메소드

public DumpContents ( string fileName ) : void
fileName string
리턴 void

GetAnimation() 공개 메소드

Returns the animation with the specified name.
public GetAnimation ( string name ) : Animation
name string Name of the animation to retrieve.
리턴 Animation

GetBone() 공개 메소드

Gets a bone by its name.
public GetBone ( string name ) : Bone
name string Name of the bone to retrieve.
리턴 Bone

GetBone() 공개 메소드

Gets a bone by its handle.
public GetBone ( ushort handle ) : Bone
handle ushort Handle of the bone to retrieve.
리턴 Bone

GetRootBone() 공개 메소드

Gets the root bone at the specified index.
public GetRootBone ( int index ) : Bone
index int Index of the root bone to return.
리턴 Bone

InitAnimationState() 공개 메소드

Initialize an animation set suitable for use with this mesh.
Only recommended for use inside the engine, not by applications.
public InitAnimationState ( Axiom.Animating.AnimationStateSet animSet ) : void
animSet Axiom.Animating.AnimationStateSet
리턴 void

RemoveAnimation() 공개 메소드

Removes the animation with the specified name from this skeleton.
public RemoveAnimation ( string name ) : void
name string Name of the animation to remove.
리턴 void

Reset() 공개 메소드

Resets the position and orientation of all bones in this skeleton to their original binding position.
A skeleton is bound to a mesh in a binding pose. Bone positions are then modified from this position during animation. This method returns all the bones to their original position and orientation.
public Reset ( ) : void
리턴 void

Reset() 공개 메소드

Resets the position and orientation of all bones in this skeleton to their original binding position.
A skeleton is bound to a mesh in a binding pose. Bone positions are then modified from this position during animation. This method returns all the bones to their original position and orientation.
public Reset ( bool resetManualBones ) : void
resetManualBones bool
리턴 void

SetAnimationState() 공개 메소드

public SetAnimationState ( Axiom.Animating.AnimationStateSet animSet ) : void
animSet Axiom.Animating.AnimationStateSet
리턴 void

SetBindingPose() 공개 메소드

Sets the current position / orientation to be the 'binding pose' ie the layout in which bones were originally bound to a mesh.
public SetBindingPose ( ) : void
리턴 void

Skeleton() 공개 메소드

Constructor, don't call directly, use SkeletonManager.
On creation, a Skeleton has a no bones, you should create them and link them together appropriately.
public Skeleton ( ResourceManager parent, String name, System.UInt64 handle, string group ) : System
parent Axiom.Core.ResourceManager
name String
handle System.UInt64
group string
리턴 System

Skeleton() 공개 메소드

Constructor, don't call directly, use SkeletonManager.
On creation, a Skeleton has a no bones, you should create them and link them together appropriately.
public Skeleton ( ResourceManager parent, String name, System.UInt64 handle, string group, bool isManual, IManualResourceLoader loader ) : System
parent Axiom.Core.ResourceManager
name String
handle System.UInt64
group string
isManual bool
loader IManualResourceLoader
리턴 System

UpdateTransforms() 공개 메소드

Updates all the derived transforms in the skeleton.
public UpdateTransforms ( ) : void
리턴 void

load() 보호된 메소드

Generic load, called by SkeletonManager.
protected load ( ) : void
리턴 void

unload() 보호된 메소드

Generic unload, called by SkeletonManager.
protected unload ( ) : void
리턴 void

프로퍼티 상세

animationList 보호되어 있는 프로퍼티

Lookup table for animations related to this skeleton.
protected AnimationCollection,Axiom.Collections animationList
리턴 Axiom.Collections.AnimationCollection

attachmentPoints 보호되어 있는 프로퍼티

Internal list of bones attached to this skeleton, indexed by handle.
protected List attachmentPoints
리턴 List

boneList 보호되어 있는 프로퍼티

Internal list of bones attached to this skeleton, indexed by handle.
protected BoneCollection boneList
리턴 BoneCollection

namedBoneList 보호되어 있는 프로퍼티

Internal list of bones attached to this skeleton, indexed by name.
protected AxiomCollection namedBoneList
리턴 AxiomCollection

rootBones 보호되어 있는 프로퍼티

Reference to the root bone of this skeleton.
protected BoneList rootBones
리턴 BoneList