Public Member Functions | Properties

CC3DrawableVertexArray Class Reference

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

#import <CC3VertexArrays.h>

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

List of all members.

Public Member Functions

(void) - allocateStripLengths:
(void) - deallocateStripLengths
(void) - drawFrom:forCount:withVisitor:
(void) - drawWithVisitor:
(GLuint) - faceCountFromVertexCount:
(GLuint) - faceCountFromVertexIndexCount:
(CC3FaceIndices- faceIndicesAt:
(GLuint) - vertexCountFromFaceCount:
(GLuint) - vertexIndexCountFromFaceCount:

Properties

GLenum drawingMode
GLuint faceCount
GLuint firstElement
GLuint stripCount
GLuint * stripLengths

Detailed Description

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.


Member Function Documentation

- (void) allocateStripLengths: (GLuint)  sCount

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.

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.

- (void) deallocateStripLengths

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

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.

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

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

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.

- (void) drawWithVisitor: (CC3NodeDrawingVisitor *)  visitor

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

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

- (GLuint) faceCountFromVertexCount: (GLuint)  DEPRECATED_ATTRIBUTE
Deprecated:
Renamed to faceCountFromVertexIndexCount:.
- (GLuint) faceCountFromVertexIndexCount: (GLuint)  vc

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

- (CC3FaceIndices) faceIndicesAt: (GLuint)  faceIndex

Returns the vertex indices of the face from the mesh at the specified index.

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.

Implemented in CC3VertexIndices.

- (GLuint) vertexCountFromFaceCount: (GLuint)  DEPRECATED_ATTRIBUTE
Deprecated:
Renamed to vertexIndexCountFromFaceCount:.
- (GLuint) vertexIndexCountFromFaceCount: (GLuint)  fc

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


Property Documentation

- (GLenum) drawingMode [read, write, assign]

The drawing mode indicating how the vertices are connected (points, lines, triangles...).

This must be set with a valid GL drawing mode enumeration.

The default value is GL_TRIANGLES.

- (GLuint) faceCount [read, assign]

Returns the number of faces in this array.

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

- (GLuint) firstElement [read, assign]

An index reference to the first element that will be drawn.

This abstract implementation always returns zero. Subclasses will override.

Implemented in CC3VertexLocations.

- (GLuint) stripCount [read, write, assign]

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.

- (GLuint *) stripLengths [read, write, assign]

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.

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.


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