Public Member Functions | Properties

CC3SkinMeshNode Class Reference

CC3SkinMeshNode is a CC3MeshNode specialized to use vertex skinning to draw the contents of its mesh. More...

#import <CC3VertexSkinning.h>

Inheritance diagram for CC3SkinMeshNode:
Inheritance graph
[legend]
Collaboration diagram for CC3SkinMeshNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(void) - addSkinSection:
(void) - doNotBufferVertexMatrixIndices
(void) - doNotBufferVertexWeights
(GLushort) - matrixIndexForVertexUnit:at:
(void) - retainVertexMatrixIndices
(void) - retainVertexWeights
(void) - setMatrixIndex:forVertexUnit:at:
(void) - setWeight:forVertexUnit:at:
(void) - updateVertexMatrixIndicesGLBuffer
(void) - updateVertexWeightsGLBuffer
(GLfloat) - weightForVertexUnit:at:

Properties

CC3GLMatrixrestPoseTransformMatrix
CC3SkinMeshskinnedMesh
CCArray * skinSections

Detailed Description

CC3SkinMeshNode is a CC3MeshNode specialized to use vertex skinning to draw the contents of its mesh.

It is one of the key structural descendant nodes of a CC3SoftBodyNode instance.

Like all mesh nodes, a CC3SkinMeshNode contains a material and a mesh. For a CC3SkinMeshNode, the mesh must be a CC3SkinMesh, which manages the mesh vertices, including the vertex weights that determine, for each vertex, how the location of that vertex is influenced by the location and orientation of each skeleton bone.

This CC3MeshNode subclass adds a number of methods for accessing and managing the weights and matrix index data associated with each vertex.

In addition, the CC3SkinMeshNode contains a collection of skin sections, in the form of CC3SkinSection instances. Each CC3SkinSection instance relates a section of the mesh, in the form of a range of vertices, to a set of bones in the skeleton.

Each CC3SkinSection applies the transformations in the referenced bones to the the vertices in the section of the mesh that it controls, and draws that section of the mesh by drawing the vertices within its range in a single GL call.

After copying a CC3SkinMeshNode, the newly created copy will still be influenced by the original skeleton. The result is that both the original mesh and the copy will move and be deformed in tandem as the skeleton moves.

If you are creating a chorus line of dancing characters, this may be the effect you are after. However, if you are creating a squadron of similar, but independently moving characters, each CC3SkinMeshNode copy should be controlled by a separate skeleton.

After creating a copy of the skeleton bone node assembly as well, you can use the reattachBonesFrom: method to attach the skin mesh node to the new skeleton.

When copying a CC3SkinMeshNode as part of copying a CC3SoftBodyNode instance, a copy of the skeleton is also created, and the reattachBonesFrom: method is automatically invoked. When copying CC3SoftBodyNode, you do not need to invoke the reattachBonesFrom: method on the new CC3SkinMeshNode directly.


Member Function Documentation

- (void) addSkinSection: (CC3SkinSection *)  aSkinSection

Adds the specified skin section to the collection in the skinSections property.

- (void) doNotBufferVertexMatrixIndices

Convenience method to cause the vertex matrix index data to be skipped when createGLBuffers is invoked.

The vertex data is not buffered to a GL VBO, is retained in application memory, and is submitted to the GL engine on each frame render.

Only the vertex matrix index will not be buffered to a GL VBO. Any other vertex data, such as locations, or texture coordinates, will be buffered to a GL VBO when createGLBuffers is invoked.

This method causes the vertex data to be retained in application memory, so, if you have invoked this method, you do NOT also need to invoke the retainVertexMatrixIndices method.

- (void) doNotBufferVertexWeights

Convenience method to cause the vertex weight data to be skipped when createGLBuffers is invoked.

The vertex data is not buffered to a GL VBO, is retained in application memory, and is submitted to the GL engine on each frame render.

Only the vertex weight will not be buffered to a GL VBO. Any other vertex data, such as locations, or texture coordinates, will be buffered to a GL VBO when createGLBuffers is invoked.

This method causes the vertex data to be retained in application memory, so, if you have invoked this method, you do NOT also need to invoke the retainVertexWeights method.

- (GLushort) matrixIndexForVertexUnit: (GLuint)  vertexUnit
at: (GLsizei)  index 

Returns the matrix index element, for the specified vertex unit, at the specified index in the underlying vertex data.

The index refers to vertices, not bytes. The implementation takes into consideration the elementStride and elementOffset properties to access the correct element.

Several matrix indices are stored for each vertex, one per vertex unit, corresponding to one for each bone that influences the location of the vertex. The specified vertexUnit parameter must be between zero inclusive, and the elementSize property, exclusive.

If the releaseRedundantData method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.

- (void) retainVertexMatrixIndices

Convenience method to cause the vertex matrix index data to be retained in application memory when releaseRedundantData is invoked, even if it has been buffered to a GL VBO.

Only the vertex matrix index will be retained. Any other vertex data, such as locations, or texture coordinates, that has been buffered to GL VBO's, will be released from application memory when releaseRedundantData is invoked.

- (void) retainVertexWeights

Convenience method to cause the vertex weight data to be retained in application memory when releaseRedundantData is invoked, even if it has been buffered to a GL VBO.

Only the vertex weight will be retained. Any other vertex data, such as locations, or texture coordinates, that has been buffered to GL VBO's, will be released from application memory when releaseRedundantData is invoked.

- (void) setMatrixIndex: (GLushort)  aMatrixIndex
forVertexUnit: (GLuint)  vertexUnit
at: (GLsizei)  index 

Sets the matrix index element, for the specified vertex unit, at the specified index in the underlying vertex data, to the specified value.

The index refers to vertices, not bytes. The implementation takes into consideration the elementStride and elementOffset properties to access the correct element.

Several matrix indices are stored for each vertex, one per vertex unit, corresponding to one for each bone that influences the location of the vertex. The specified vertexUnit parameter must be between zero inclusive, and the elementSize property, exclusive.

When all vertex changes have been made, be sure to invoke the updateVertexMatrixIndicesGLBuffer method to ensure that the GL VBO that holds the vertex data is updated.

If the releaseRedundantData method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.

- (void) setWeight: (GLfloat)  aWeight
forVertexUnit: (GLuint)  vertexUnit
at: (GLsizei)  index 

Sets the weight element, for the specified vertex unit, at the specified index in the underlying vertex data, to the specified value.

The index refers to vertices, not bytes. The implementation takes into consideration the elementStride and elementOffset properties to access the correct element.

Several weights are stored for each vertex, one per vertex unit, corresponding to one for each bone that influences the location of the vertex. The specified vertexUnit parameter must be between zero inclusive, and the elementSize property, exclusive.

When all vertex changes have been made, be sure to invoke the updateVertexWeightsGLBuffer method to ensure that the GL VBO that holds the vertex data is updated.

If the releaseRedundantData method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.

- (void) updateVertexMatrixIndicesGLBuffer

Updates the GL engine buffer with the vertex weight data in this mesh.

- (void) updateVertexWeightsGLBuffer

Updates the GL engine buffer with the vertex weight data in this mesh.

- (GLfloat) weightForVertexUnit: (GLuint)  vertexUnit
at: (GLsizei)  index 

Returns the weight element, for the specified vertex unit, at the specified index in the underlying vertex data.

The index refers to vertices, not bytes. The implementation takes into consideration the elementStride and elementOffset properties to access the correct element.

Several weights are stored for each vertex, one per vertex unit, corresponding to one for each bone that influences the location of the vertex. The specified vertexUnit parameter must be between zero inclusive, and the elementSize property, exclusive.

If the releaseRedundantData method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.


Property Documentation

- (CC3GLMatrix *) restPoseTransformMatrix [read, retain]

Returns the cached rest pose matrix, relative to the soft-body ancestor node.

This is the transform matrix of this node when it is in its rest pose, which is the location and rotation that corresponds to the rest pose of the bones.

The value of this property is set when the bindRestPose method is invoked.

- (CC3SkinMesh*) skinnedMesh [read, assign]

The CC3Mesh used by this node, cast as a CC3SkinMesh, for convenience in accessing the additional behavour available to support bone vertices.

- (CCArray *) skinSections [read, retain]

The collection of CC3SkinSections that are managed by this node.


The documentation for this class was generated from the following file: