CC3SkinnedBone combines the transforms of a bone and a skin mesh node, and applies these transforms to deform the vertices during rendering, or when the deformed location of a vertex is accessed programmatically. More...
#import <CC3VertexSkinning.h>
Public Member Functions | |
(id) | - initWithSkin:onBone: |
(void) | - markTransformDirty |
Static Public Member Functions | |
(id) | + skinnedBoneWithSkin:onBone: |
Properties | |
CC3Bone * | bone |
CC3Matrix * | drawTransformMatrix |
CC3SkinMeshNode * | skinNode |
CC3Matrix * | skinTransformMatrix |
CC3SkinnedBone combines the transforms of a bone and a skin mesh node, and applies these transforms to deform the vertices during rendering, or when the deformed location of a vertex is accessed programmatically.
An instance keeps track of two related transform matrices, a drawTransformMatrix, which is used by the GL engine to deform the vertices during drawing, and a skinTransformMatrix, which is used to deform a vertex into the local coordinate system of the skin mesh node, so that it can be used programmatically.
The CC3SkinnedBone instance registers as a transform listener with both the bone and the skin mesh node, and lazily recalculates the drawTransformMatrix and skinTransformMatrix whenever the transform of either the bone or the skin mesh node changes.
- (id) initWithSkin: | (CC3SkinMeshNode *) | aNode | |
onBone: | (CC3Bone *) | aBone | |
Initializes this instance to apply the specified bone to the specified skin mesh node.
- (void) markTransformDirty |
Marks the transform matrices as dirty.
Once marked as dirty each of the drawTransformMatrix and skinTransformMatrix matrices will be lazily recalculated the next time its respective property is accessed.
This method is invoked automatically when the transform of either the bone or the skin mesh node being tracked by this instance is transformed. The application should never need to invoke this method directly.
+ (id) skinnedBoneWithSkin: | (CC3SkinMeshNode *) | aNode | |
onBone: | (CC3Bone *) | aBone | |
Allocates and initializes an autoreleased instance to apply the specified bone to the specified skin mesh node.
- (CC3Bone *) bone [read, assign] |
Returns the bone whose transforms are being tracked.
- (CC3Matrix *) drawTransformMatrix [read, retain] |
Returns the transform matrix used to draw the deformed nodes during mesh rendering.
This transform matrix combines the transform of the bone, the rest pose of the bone, and the rest pose of the skin mesh node.
This transform matrix is lazily recomputed the first time this property is accessed after the transform is marked dirty via the markTransformDirty method. This occurs automatically when either the bone or the skin mesh node being tracked by this instance is transformed.
- (CC3SkinMeshNode *) skinNode [read, assign] |
Returns the skin mesh node whose transforms are being tracked.
- (CC3Matrix *) skinTransformMatrix [read, retain] |
Returns the transform matrix used to deform vertex locations when retrieved from the mesh for use by the application.
This transform matrix combines the transform of the drawTransformMatrix with the inverse transform of the skin mesh node.
The transform matrix returned can be applied to a mesh vertex location to determine its location after deformation, in the local coordinate system of the skin mesh node.
This transform matrix is lazily recomputed the first time this property is accessed after the transform is marked dirty via the markTransformDirty method. This occurs automatically when either the bone or the skin mesh node being tracked by this instance is transformed.