CC3VertexIndices Class Reference
Inherits from | CC3DrawableVertexArray : CC3VertexArray : CC3Identifiable : NSObject |
Declared in | CC3VertexArrays.h |
Overview
A CC3VertexArray that manages the drawing indices of an array of vertices.
This class is also a type of CC3DrawableVertexArray, and as such, is capable of drawing the vertices to the GL engine.
A vertex index array is different than other vertex arrays in that instead of managing actual vertex content, it manages indexes that reference the vertices of the other vertex arrays. The bufferTarget property is GL_ELEMENT_ARRAY_BUFFER, the elementSize property is 1, and the elementType is either GL_UNSIGNED_SHORT or GL_UNSIGNED_BYTE
Because an index datum does not describe an aspect of a particular vertex, but rather points to a vertex, index content cannot be interleaved with the vertex content. As such, the content underlying a CC3VertexIndices is never interleaved and shared with the content underlying the other vertex arrays in a mesh.
Tasks
Other Methods
-
– allocateTriangles:
-
– indexAt:
-
– setIndex:at:
-
– faceIndicesAt:
-
– populateFromRunLengthArray:ofLength:
-
– copyVertices:from:to:offsettingBy:
-
– copyVertices:from:toAddress:offsettingBy:
-
– copyVertices:fromAddress:to:offsettingBy:
-
– copyVertices:fromAddress:toAddress:offsettingBy:
PVRPOD Methods
Instance Methods
allocateTriangles:
@deprecated Use allocatedVertexCapacity property instead.
- (GLuint *)allocateTriangles:(GLuint)triangleCount
Declared In
CC3VertexArrays.h
copyVertices:from:to:offsettingBy:
Copies vertex indices for the specified number of vertices from memory starting at the specified source vertex index to memory starting at the specified destination vertex index, and offsets each value by the specified offset amount. The value at the destination vertex will be that of the source vertex, plus the specified offset.
- (void)copyVertices:(GLuint)vtxCount from:(GLuint)srcIdx to:(GLuint)dstIdx offsettingBy:(GLint)offset
Discussion
You can use this method to copy content from one area in the vertex array to another area, while adjusting for movement of the underlying vertex content pointed to by these vertex indices.
Declared In
CC3VertexArrays.h
copyVertices:from:toAddress:offsettingBy:
Copies vertex indices for the specified number of vertices from memory starting at the specified source vertex index to memory starting at the specified destination address pointer, and offsets each value by the specified offset amount. The value at the destination vertex will be that of the source vertex, plus the specified offset.
- (void)copyVertices:(GLuint)vtxCount from:(GLuint)srcIdx toAddress:(GLvoid *)dstPtr offsettingBy:(GLint)offset
Discussion
You can use this method to copy content out of this vertex array to a memory location outside this vertex array, while adjusting for movement of the underlying vertex content pointed to by these vertex indices.
This is a fast copy that assumes that the vertex content at the destination is of the same type (GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT) as the vertex content in this vertex array.
Declared In
CC3VertexArrays.h
copyVertices:fromAddress:to:offsettingBy:
Copies vertex indices for the specified number of vertices from memory starting at the specified source address pointer to memory starting at the specified destination vertex index, and offsets each value by the specified offset amount. The value at the destination vertex will be that of the source vertex, plus the specified offset.
- (void)copyVertices:(GLuint)vtxCount fromAddress:(GLvoid *)srcPtr to:(GLuint)dstIdx offsettingBy:(GLint)offset
Discussion
You can use this method to copy content into this vertex array from a memory location outside this vertex array, while adjusting for movement of the underlying vertex content pointed to by these vertex indices.
This is a fast copy that assumes that the vertex content at the source is of the same type (GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT) as the vertex content in this vertex array.
Declared In
CC3VertexArrays.h
copyVertices:fromAddress:toAddress:offsettingBy:
Copies vertex indices for the specified number of vertices from memory starting at the specified source address pointer to memory starting at the specified destination address pointer, and offsets each value by the specified offset amount. The value at the destination vertex will be that of the source vertex, plus the specified offset.
- (void)copyVertices:(GLuint)vtxCount fromAddress:(GLvoid *)srcPtr toAddress:(GLvoid *)dstPtr offsettingBy:(GLint)offset
Discussion
You can use this method to copy content between two memory location outside this vertex array, while adjusting for movement of the underlying vertex content pointed to by these vertex indices.
This is a fast copy that assumes that the vertex content at the source and destination is of the same type (GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT) as the vertex content in this vertex array.
Declared In
CC3VertexArrays.h
faceIndicesAt:
Returns the vertex indices of the face from the mesh at the specified index.
- (CC3FaceIndices)faceIndicesAt:(GLuint)faceIndex
Discussion
The specified faceIndex value refers to the index of the face, not the vertices themselves. So, a value of 5 will retrieve the three vertices that make up the fifth triangular face in this mesh. The specified index must be between zero, inclusive, and the value of the faceCount property, exclusive.
The returned structure reference contains the indices of the three vertices that make up the triangular face. These indices index into the actual vertex locations in the CC3VertexLocations array.
This method takes into consideration the drawingMode of this vertex array, and any padding (stride) between the vertex indices.
The indices in the returned face are of type GLuint, regardless of whether the elementType property is GL_UNSIGNED_SHORT or GL_UNSIGNED_BYTE.
Declared In
CC3VertexArrays.h
indexAt:
Returns the index element at the specified index in the underlying vertex content.
- (GLuint)indexAt:(GLuint)index
Discussion
The index refers to vertices, not bytes. The implementation takes into consideration the vertexStride and elementOffset properties to access the correct element.
If the releaseRedundantContent method has been invoked and the underlying vertex content has been released, this method will raise an assertion exception.
Declared In
CC3VertexArrays.h
initFromCPODData:fromSPODMesh:
Calc vertexCount after drawingMode has been set.
- (id)initFromCPODData:(PODClassPtr)aCPODData fromSPODMesh:(PODStructPtr)aSPODMesh
Declared In
CC3VertexArraysPODExtensions.mm
populateFromRunLengthArray:ofLength:
Convenience method to populate this index array from the specified run-length encoded array.
- (void)populateFromRunLengthArray:(GLushort *)runLenArray ofLength:(GLuint)rlaLen
Discussion
Run-length encoded arrays are used to compactly store a set of variable-length sub-arrays of indexes, where the first element of each sub-array indicates the number of content elements contained in that sub-array.
For example, if the first element of the array (element zero) contains the value 5, then the next 5 elements of the array contain the first 5 content elements of the first sub-array. Then the next element of the array (element 6) contains the length of the second sub-array, and so on.
The total number of elements in the run-length array, including the run-length entries is specified by the rlaLen parameter.
Run-length encoded arrays are of limited use as GL index arrays, because they cannot easily be copied into, and managed as a VBO in the GL engine, which is a performance hinderance. And becuase run-length encoded arrays intermix vertex indices and run lengths, it makes accessing individual vertex indices and faces unwieldy.
Declared In
CC3VertexArrays.h
setElementsFromCPODData:fromSPODMesh:
Template method extracts the vertex data from the specified SPODMesh and CPODData structures.
- (void)setElementsFromCPODData:(CPODData *)aCPODData fromSPODMesh:(SPODMesh *)aSPODMesh
Declared In
CC3VertexArraysPODExtensions.mm
setIndex:at:
Sets the index element at the specified index in the underlying vertex content, to the specified value.
- (void)setIndex:(GLuint)vertexIndex at:(GLuint)index
Discussion
The index refers to vertices, not bytes. The implementation takes into consideration the vertexStride and elementOffset properties to access the correct element.
If the releaseRedundantContent method has been invoked and the underlying vertex content has been released, this method will raise an assertion exception.
Declared In
CC3VertexArrays.h