Inherits from CC3VertexArray : CC3Identifiable : NSObject
Declared in CC3VertexArrays.h

Overview

This abstract subclass of CC3VertexArray adds the functionality to draw the vertex content to the display through the GL engine.

The underlying content is drawn by invoking the drawWithVisitor: method, and can be drawn in a single GL call for all vertices, or the vertices can be arranged in strips, and the strips drawn serially.

You define vertex strips using the stripCount and stripLengths properties, or using the allocateStripLengths: method to set both properties at once.

Using vertex strips performs more GL calls, and will be less efficient, but in some applications, might assist in the organization of mesh vertex content.

Alternately, a subset of the vertices may be drawn by invoking the drawFrom:forCount:withVisitor: method instead of the drawWithVisitor: method.

Properties

__deprecated

@deprecated Renamed to firstVertex on CC3VertexLocations.

@property (nonatomic, readonly) GLuint firstElement __deprecated

Declared In

CC3VertexArrays.h

drawingMode

The drawing mode indicating how the vertices are connected (points, lines, triangles…). This must be set with a valid GL drawing mode enumeration.

@property (nonatomic, assign) GLenum drawingMode

Discussion

The default value is GL_TRIANGLES.

Declared In

CC3VertexArrays.h

faceCount

Returns the number of faces in this array.

@property (nonatomic, readonly) GLuint faceCount

Discussion

This is calculated from the number of vertices, taking into consideration the drawing mode of this array.

Declared In

CC3VertexArrays.h

stripCount

The underlying content can be drawn in strips, using multiple GL calls, rather than a single call. This property indicates the number of strips to draw. A value of zero indicates that vertex drawing should be done in a single GL call.

@property (nonatomic, assign) GLuint stripCount

Declared In

CC3VertexArrays.h

stripLengths

An array of values, each indicating the number of vertices to draw in the corresponding strip. The stripCount property indicates the number of items in this array. If drawing is not performed in strips (stripCount is zero), this property will be NULL.

@property (nonatomic, assign) GLuint *stripLengths

Discussion

An easy way to create a suitable array for this property, and set the associated stripCount property at the same time, is to invoke the allocateStripLengths: method.

Declared In

CC3VertexArrays.h

Instance Methods

allocateStripLengths:

Sets the specified number of strips into the stripCount property, then allocates an array of Gluints of that length, and sets that array in the stripLengths property.

- (void)allocateStripLengths:(GLuint)sCount

Discussion

It is safe to invoke this method more than once. The previously allocated array of strip-lengths will be deallocated before the new array is created.

The array can be deallocated by invoking the deallocateStripLengths method.

Declared In

CC3VertexArrays.h

deallocateStripLengths

Deallocates the array of strip-lengths that was created by a previous invocation of the allocateStripLengths: method.

- (void)deallocateStripLengths

Discussion

It is safe to invoke this method more than once, or even if allocateStripLengths: was not previously invoked.

This method is invoked automatically when this instance is deallocated.

Declared In

CC3VertexArrays.h

drawFrom:forCount:withVisitor:

Draws the specified number of vertices, starting at the specified vertex index, in a single GL draw call.

- (void)drawFrom:(GLuint)vertexIndex forCount:(GLuint)vertexCount withVisitor:(CC3NodeDrawingVisitor *)visitor

Discussion

This method can be used to draw a subset of thevertices. This can be used when this array holds content for a number of meshes, or when content is being sectioned for palette matrices.

This abstract implementation collects drawing performance statistics if the visitor is configured to do so. Subclasses will override to perform appropriate drawing activity, but should also invoke this superclass implementation to perform the collection of performance content.

Declared In

CC3VertexArrays.h

drawWithVisitor:

Draws the vertices, either in strips, or in a single call, depending on the value of the stripCount property.

- (void)drawWithVisitor:(CC3NodeDrawingVisitor *)visitor

Discussion

This method is invoked automatically from the draw method of CC3Mesh.

Declared In

CC3VertexArrays.h

faceCountFromVertexCount:

@deprecated Renamed to faceCountFromVertexIndexCount:.

- (GLuint)faceCountFromVertexCount:(GLuint)vc

Declared In

CC3VertexArrays.h

faceCountFromVertexIndexCount:

Returns the number of faces to be drawn from the specified number of vertex indices, based on the drawingMode of this array.

- (GLuint)faceCountFromVertexIndexCount:(GLuint)vc

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.

Declared In

CC3VertexArrays.h

initFromCPODData:fromSPODMesh:

Initializes this instance from the specified CPODData and SPODMesh structures.

- (id)initFromCPODData:(PODClassPtr)aCPODData fromSPODMesh:(PODStructPtr)aSPODMesh

Declared In

CC3VertexArraysPODExtensions.h

vertexCountFromFaceCount:

@deprecated Renamed to vertexIndexCountFromFaceCount:.

- (GLuint)vertexCountFromFaceCount:(GLuint)fc

Declared In

CC3VertexArrays.h

vertexIndexCountFromFaceCount:

Returns the number of vertex indices required to draw the specified number of faces, based on the drawingMode of this array.

- (GLuint)vertexIndexCountFromFaceCount:(GLuint)fc

Declared In

CC3VertexArrays.h