CC3DeformedFaceArray Class Reference
Inherits from | CC3FaceArray : CC3Identifiable : NSObject |
Declared in | CC3VertexSkinning.h |
Overview
CC3DeformedFaceArray extends CC3FaceArray to hold the deformed positions of each vertex. From this, the deformed shape and orientation of each face in the mesh can be retrieved.
If configured to cache the face data (if the shouldCacheFaces is set to YES), the instance will register as a transform listener with the skin mesh node, so that the faces can be rebuilt if the skin mesh node or any of the bones move.
Properties
deformedVertexLocations
An array containing the vertex locations of the underlying mesh, as deformed by the current position and orientation of the bones.
@property (nonatomic, assign) CC3Vector *deformedVertexLocations
Discussion
This property will be lazily initialized on the first access after the node property has been set, by an automatic invocation of the populateDeformedVertexLocations method. When created in this manner, the memory allocated to hold the data in the returned array will be managed by this instance.
Alternately, this property may be set directly to an array that was created externally. In this case, the underlying data memory is not managed by this instance, and it is up to the application to manage the allocation and deallocation of the underlying data memory, and to ensure that the array is large enough to contain the number of CC3Vector structures specified by the vertexCount property.
Declared In
CC3VertexSkinning.h
node
The skin mesh node containing the vertices for which this face array is managing faces.
@property (nonatomic, assign) CC3SkinMeshNode *node
Discussion
Setting this property will also set the mesh property, and will cause the deformedVertexLocations, centers, normals, planes and neighbours properties to be deallocated and then re-built on the next access.
Declared In
CC3VertexSkinning.h
Instance Methods
allocateDeformedVertexLocations
Allocates underlying memory for the deformedVertexLocations property, and returns a pointer to the allocated memory.
- (CC3Vector *)allocateDeformedVertexLocations
Discussion
This method will allocate enough memory for the deformedVertexLocations property to hold the number of CC3Vector structures specified by the vertexCount property.
This method is invoked automatically by the populateDeformedVertexLocations method. Usually, the application never needs to invoke this method directly.
It is safe to invoke this method more than once, but understand that any previously allocated memory will be safely released prior to the allocation of the new memory. The memory allocated earlier will therefore be lost and should not be referenced.
The memory allocated will automatically be released when this instance is deallocated.
Declared In
CC3VertexSkinning.h
clearDeformableCaches
Clears any caches that contain deformable information, including deformed vertices, plus face centers, normals, and planes.
- (void)clearDeformableCaches
Declared In
CC3VertexSkinning.h
deallocateDeformedVertexLocations
Deallocates the underlying memory that was previously allocated with the allocateDeformedVertexLocations method. It is safe to invoke this method more than once, or even if the allocateDeformedVertexLocations method was not previously invoked.
- (void)deallocateDeformedVertexLocations
Discussion
This method is invoked automatically when allocateDeformedVertexLocations is invoked, and when this instance is deallocated. Usually, the application never needs to invoke this method directly.
Declared In
CC3VertexSkinning.h
deformedVertexLocationAt:fromFaceAt:
Returns the deformed vertex location of the face at the specified vertex index, that is contained in the face with the specified index, lazily initializing the deformedVertexLocations property if needed.
- (CC3Vector)deformedVertexLocationAt:(GLuint)vertexIndex fromFaceAt:(GLuint)faceIndex
Declared In
CC3VertexSkinning.h
markDeformedVertexLocationsDirty
Marks the deformed vertices data as dirty. It will be automatically repopulated on the next access.
- (void)markDeformedVertexLocationsDirty
Declared In
CC3VertexSkinning.h
populateDeformedVertexLocations
Populates the contents of the deformedVertexLocations property from the associated mesh, automatically allocating memory for the property if needed.
- (void)populateDeformedVertexLocations
Discussion
This method is invoked automatically on the first access of the deformedVertexLocations property after the node property has been set. Usually, the application never needs to invoke this method directly.
However, if the deformedVertexLocations property has been set to an array created outside this instance, this method may be invoked to populate that array from the mesh.
Declared In
CC3VertexSkinning.h