Bounding volumes are used by CC3Nodes to determine whether a node interset the camera's frustum, or to determine boundaries for collision detection during physics simulation. More...
#import <CC3BoundingVolumes.h>
Public Member Functions | |
(void) | - buildVolume |
(BOOL) | - doesIntersectFrustum: |
(void) | - update |
Static Public Member Functions | |
(id) | + boundingVolume |
Properties | |
CC3Node * | node |
BOOL | volumeNeedsBuilding |
Bounding volumes are used by CC3Nodes to determine whether a node interset the camera's frustum, or to determine boundaries for collision detection during physics simulation.
Many different shapes of boundaries are available, including points, spheres, bounding boxes, etc, permitting tradeoffs between accuracy and computational processing time.
+ (id) boundingVolume |
Allocates and initializes an autoreleased instance.
- (void) buildVolume |
Template method that builds the bounding volume in the node's local coordinate system.
Default does nothing except set the volumeNeedsBuilding property to NO. Subclasses will override to calculated a real bounding volume, but should invoke this superclass method to set the volumeNeedsBuilding property to NO.
- (BOOL) doesIntersectFrustum: | (CC3Frustum *) | aFrustum |
Returns whether this bounding volume intersects the specfied frustum.
This default implementation always returns YES. Subclasses will override appropriately.
This method is invoked automatically by the node whenever it needs to determine whether or not it should be drawn.
- (void) update |
Transforms this bounding volume to match the transformation of the node.
If this bounding volume has not yet been built, invokes the buildVolume method first.
This method is invoked automatically by the node whenever it recalculates its transformMatrix. Usually, the application never needs to invoke this method directly.
- (CC3Node *) node [read, write, assign] |
The node whose boundary this instance is keeping track of.
- (BOOL) volumeNeedsBuilding [read, write, assign] |
Indicates whether the volume needs building.
This is typically set to YES during instance initialization, and then to NO when the local bounding volume is calculated. This occurs the first time the update method is invoked. Usually, that is sufficient, and the application never needs to set this property. But, if for some reason it is determined that the bounding volume needs to be recalculated, this property can be reset back to YES, and the next invocation of the update method will rebuild the volume.