Public Member Functions | Properties

CC3VertexLocations Class Reference

A CC3VertexArray that manages the location aspect of an array of vertices. More...

#import <CC3VertexArrays.h>

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

List of all members.

Public Member Functions

(CC3Vector- locationAt:
(void) - markBoundaryDirty
(void) - movePivotTo:
(void) - movePivotToCenterOfGeometry
(void) - setLocation:at:

Properties

CC3BoundingBox boundingBox
CC3Vector centerOfGeometry
GLuint firstElement
GLfloat radius

Detailed Description

A CC3VertexArray that manages the location aspect 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.

Since the vertex locations determine the size and shape of the mesh, this class is also responsible for determining the boundingBox of the mesh.


Member Function Documentation

- (CC3Vector) locationAt: (GLsizei)  index

Returns the location element at the specified index in the underlying vertex data.

The index refers to elements, not bytes. The implementation takes into consideration the elementStride and elementOffset properties to access the correct element.

If the releaseRedundantData method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.

- (void) markBoundaryDirty

Marks the boundary, including bounding box and radius, as dirty, and need of recalculation.

- (void) movePivotTo: (CC3Vector aLocation

Changes the mesh data so that the pivot point of the mesh will be at the specified location.

The pivot point of the mesh is the location in the local coordinate system around which all transforms are performed. A vertex at the pivot point would have local coordinates (0,0,0).

This method can be used to adjust the mesh structure to make it easier to apply transformations, by moving the origin of the transformations to a more convenient location in the mesh.

This method changes the location component of every vertex in the mesh data. This can be quite costly, and should only be performed once to adjust a mesh so that it is easier to manipulate.

Do not use this method to move your model around. Instead, use the transform properties (location, rotation and scale) of the CC3Node that contains this mesh, and let the GL engine do the heavy lifting of transforming the mesh vertices.

If this instance is being used by any mesh nodes, be sure to invoke the rebuildBoundingVolume method on all mesh nodes that use this vertex array, to ensure that the boundingVolume encompasses the new vertex locations.

This method ensures that the GL VBO that holds the vertex data is updated.

- (void) movePivotToCenterOfGeometry

Changes the mesh data so that the pivot point of the mesh will be at the center of geometry of the mesh vertices.

The pivot point of the mesh is the location in the local coordinate system around which all transforms are performed. A vertex at the pivot point would have local coordinates (0,0,0).

This method can be used to adjust the mesh structure to make it easier to apply transformations, by moving the origin of the transformations to the center of the mesh.

This method changes the location component of every vertex in the mesh data. This can be quite costly, and should only be performed once to adjust a mesh so that it is easier to manipulate.

Do not use this method to move your model around. Instead, use the transform properties (location, rotation and scale) of the CC3Node that contains this mesh, and let the GL engine do the heavy lifting of transforming the mesh vertices.

If this instance is being used by any mesh nodes, be sure to invoke the rebuildBoundingVolume method on all mesh nodes that use this vertex array, to ensure that the boundingVolume encompasses the new vertex locations.

This method ensures that the GL VBO that holds the vertex data is updated.

- (void) setLocation: (CC3Vector aLocation
at: (GLsizei)  index 

Sets the location element at the specified index in the underlying vertex data to the specified location value.

The index refers to elements, not bytes. The implementation takes into consideration the elementStride and elementOffset properties to access the correct element.

If the new vertex location changes the bounding box of this instance, and this instance is being used by any mesh nodes, be sure to invoke the rebuildBoundingVolume method on all mesh nodes that use this vertex array, to ensure that the boundingVolume encompasses the new vertex location.

If the releaseRedundantData method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.


Property Documentation

- (CC3BoundingBox) boundingBox [read, assign]

Indicates that the bounding box should be rebuilt on next access.

Returns the axially-aligned bounding box of this mesh.

- (CC3Vector) centerOfGeometry [read, assign]

Returns the center of geometry of this mesh.

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

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

Typically, all elements are to be drawn, and this property will be zero. In some applications, large sets of underlying data may be used for the vertex arrays of more than one mesh. In such a case, it may be desirable to start drawing from an element that is not the first element of the array. This property can be set to indicate at which element index to start drawing. If drawing is being performed in strips, this will be the index of the start of the first strip to be drawn.

The initial value is zero.

Implements CC3DrawableVertexArray.

- (GLfloat) radius [read, assign]

Returns the radius of a spherical boundary, centered on the centerOfGeometry, that encompasses all the vertices of this mesh.


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