Public Member Functions | Properties

CC3SkinMesh Class Reference

CC3SkinMesh is a CC3VertexArrayMesh that, in addition to the familiar vertex data such as locations, normals and texture coordinates, adds vertex arrays for bone weights and bone matrix indices. More...

#import <CC3VertexSkinning.h>

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

List of all members.

Public Member Functions

(GLuint) - matrixIndexForVertexUnit:at:
(void) - setMatrixIndex:forVertexUnit:at:
(void) - setWeight:forVertexUnit:at:
(GLfloat) - weightForVertexUnit:at:

Properties

CC3VertexMatrixIndices
*boneMatrixIndices 
DEPRECATED_ATTRIBUTE
CC3VertexWeights *boneWeights DEPRECATED_ATTRIBUTE
CC3VertexContent vertexContentTypes
CC3VertexMatrixIndicesvertexMatrixIndices
CC3VertexWeightsvertexWeights

Detailed Description

CC3SkinMesh is a CC3VertexArrayMesh that, in addition to the familiar vertex data such as locations, normals and texture coordinates, adds vertex arrays for bone weights and bone matrix indices.

Each element of the CC3VertexMatrixIndices vertex array in the vertexMatrixIndices property is a set of index values that reference a set of bones that influence the location of that vertex.

Each element of the CC3VertexWeights vertex array in the vertexWeights property contains a corresponding set of weighting values that determine the relative influence that each of the bones identified in the vertexMatrixIndices has on transforming the location of the vertex.

For each vertex, there is a one-to-one correspondence between each bone index values and the weights. The first weight is applied to the bone identified by the first index. Therefore, the elementSize property of the vertex arrays in the vertexWeights and vertexMatrixIndices properties must be the same. The value of these elementSize properties therefore effectively defines how many bones influence each vertex in these arrays, and this value must be the same for all vertices in these arrays.

Since the bone indexes can change from vertex to vertex, different vertices can be influenced by a different set of bones, but the absolute number of bones influencing each vertex must be consistent, and is defined by the elementSize properties. For any vertex, the weighting values define the influence that each of the bones has on the vertex. A zero value for a bone weight in a vertex indicates that location of that vertex is not affected by the tranformation of that bone.

There is a limit to how many bones may be assigned to each vertex, and this limit is defined by the number of vertex units supported by the platform, and the elementSize property of each of the vertexMatrixIndices and vertexWeights vertex arrays must not be larger than the number of available vertex units. This value can be retrieved from [CC3OpenGLES11Engine engine].platform.maxVertexUnits.value.

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


Member Function Documentation

- (GLuint) matrixIndexForVertexUnit: (GLuint)  vertexUnit
at: (GLuint)  DEPRECATED_ATTRIBUTE 
Deprecated:
Renamed to vertexMatrixIndexForVertexUnit:at:
- (void) setMatrixIndex: (GLuint)  aMatrixIndex
forVertexUnit: (GLuint)  vertexUnit
at: (GLuint)  DEPRECATED_ATTRIBUTE 
Deprecated:
Renamed to setVertexMatrixIndex:forVertexUnit:at:
- (void) setWeight: (GLfloat)  aWeight
forVertexUnit: (GLuint)  vertexUnit
at: (GLuint)  DEPRECATED_ATTRIBUTE 
Deprecated:
Renamed to setVertexWeight:forVertexUnit:at:
- (GLfloat) weightForVertexUnit: (GLuint)  vertexUnit
at: (GLuint)  DEPRECATED_ATTRIBUTE 
Deprecated:
Renamed to vertexWeightForVertexUnit:at:

Property Documentation

- (CC3VertexMatrixIndices* boneMatrixIndices) DEPRECATED_ATTRIBUTE [read, write, retain]
Deprecated:
Renamed to vertexMatrixIndices.

Implements CC3Mesh.

- (CC3VertexWeights* boneWeights) DEPRECATED_ATTRIBUTE [read, write, retain]
Deprecated:
Renamed to vertexWeights.

Implements CC3Mesh.

- (CC3VertexContent) vertexContentTypes [read, write, assign]

Indicates the types of content contained in each vertex of this mesh.

Each vertex can contain several types of content, optionally including location, normal, color, texture coordinates, and vertex skinning weights and matrices. To identify this various content, this property is a bitwise-OR of flags that enumerate the types of content contained in each vertex of this mesh.

Valid component flags of this property include:

  • kCC3VertexContentLocation
  • kCC3VertexContentNormal
  • kCC3VertexContentColor
  • kCC3VertexContentTextureCoordinates
  • kCC3VertexContentWeights
  • kCC3VertexContentMatrixIndices

To indicate that this mesh should contain particular vertex content, construct a bitwise-OR combination of one or more of the component types listed above, and set this property to that combined value.

Setting each bitwise-OR component in this property instructs this instance to automatically construct the appropriate type of contained vertex array:

  • kCC3VertexContentLocation - automatically constructs a CC3VertexLocations instance in the vertexLocations property, that holds 3D vertex locations, in one CC3Vector structure per vertex. This component is optional, as the vertexLocations property will be constructed regardless.
  • kCC3VertexContentNormal - automatically constructs a CC3VertexNormals instance in the vertexNormals property, that holds 3D vertex normals, in one CC3Vector structure per vertex.
  • kCC3VertexContentColor - automatically constructs a CC3VertexColors instance in the vertexColors property, that holds RGBA colors with GLubyte components, in one ccColor4B structure per vertex.
  • kCC3VertexContentTextureCoordinates - automatically constructs a CC3VertexTextureCoordinates instance in the vertexTextureCoordinates property, that holds 2D texture coordinates, in one ccTex2F structure per vertex.
  • kCC3VertexContentWeights - automatically constructs a CC3VertexWeights instance in the vertexWeights property, that holds several GLfloat values per vertex.
  • kCC3VertexContentMatrixIndices - automatically constructs a CC3VertexMatrixIndices instance in the vertexMatrixIndices property, that holds several GLubyte values per vertex.

This property is a convenience property. Instead of using this property, you can create the appropriate vertex arrays in those properties directly.

The vertex arrays constructed by this property will be configured to use interleaved data if the shouldInterleaveVertices property is set to YES. You should ensure the value of the shouldInterleaveVertices property to the desired value before setting the value of this property. The initial value of the shouldInterleaveVertices property is YES.

The CC3VertexWeights and CC3VertexMatrixIndices vertex arrays created with this property, are each initialized with a value of zero in the elementSize property. After creating these vertex arrays with this property, you must access these two vertex arrays, via the vertexWeights and vertexMatrixIndices properties respectively, and set the elementSize properties to a value that is appropriate for your vertex skinning needs. Once you have done so, if the vertex content is interleaved, invoke the updateVertexStride method on this instance to automatically align the elementOffset and vertexStride properties of all the contained vertex arrays to the correct interleaved vertex content.

If the content is interleaved, for each vertex, the content is held in the structures identified in the list above, in the order that they appear in the list. You can use this consistent organization to create an enclosing structure to access all data for a single vertex, if it makes it easier to access vertex data that way. If vertex content is not specified, it is simply absent, and the content from the following type will be concatenated directly to the content from the previous type.

It is safe to set this property more than once. Doing so will remove any existing vertex arrays and replace them with those indicated by this property.

When reading this property, the appropriate bitwise-OR values are returned, corresponding to the contained vertex arrays, even if those arrays were constructed directly, instead of by setting this property. If this mesh contains no vertex arrays, this property will return kCC3VertexContentNone.

Implements CC3VertexArrayMesh.

- (CC3VertexMatrixIndices *) vertexMatrixIndices [read, write, retain]

The vertex array that manages the indices of the bones that influence each vertex.

Each element of the vertex array in this property is a small set of index values that reference a set of bones that influence the location of that vertex.

The elementSize property of the vertex arrays in the vertexWeights and vertexMatrixIndices properties must be the same, and must not be larger than the maximum number of available vertex units for the platform, which can be retreived from [CC3OpenGLES11Engine engine].platform.maxVertexUnits.value.

- (CC3VertexWeights *) vertexWeights [read, write, retain]

The vertex array that manages the weighting that each bone has in influencing each vertex.

Each element of the vertex array in this property contains a small set of weighting values that determine the relative influence that each of the bones identified for that vertex in the vertexMatrixIndices property has on transforming the location of the vertex.

The elementSize property of the vertex arrays in the vertexWeights and vertexMatrixIndices properties must be the same, and must not be larger than the maximum number of available vertex units for the platform, which can be retreived from [CC3OpenGLES11Engine engine].platform.maxVertexUnits.value.


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