Public Member Functions | Static Public Member Functions | Protected Attributes | Properties

CC3Frustum Class Reference

Represents a camera's frustum. More...

#import <CC3Camera.h>

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

List of all members.

Public Member Functions

(void) - DEPRECATED_ATTRIBUTE
(BOOL) - doesIntersectPointAt:
(BOOL) - doesIntersectSphereAt:withRadius:
(id) - initOnModelviewMatrix:
(void) - populateFrom:andAspect:andNearClip:andFarClip:andZoom:

Static Public Member Functions

(id) + frustumOnModelviewMatrix:

Protected Attributes

CC3Plane planes [6]
CC3Vector vertices [8]

Properties

GLfloat bottom
CC3Plane bottomPlane
GLfloat far
CC3Vector farBottomLeft
CC3Vector farBottomRight
CC3Plane farPlane
CC3Vector farTopLeft
CC3Vector farTopRight
CC3MatrixinfiniteProjectionMatrix
BOOL isUsingParallelProjection: 1
GLfloat left
CC3Plane leftPlane
CC3MatrixmodelviewMatrix
CC3MatrixmodelviewProjectionMatrix
GLfloat near
CC3Vector nearBottomLeft
CC3Vector nearBottomRight
CC3Plane nearPlane
CC3Vector nearTopLeft
CC3Vector nearTopRight
CC3MatrixprojectionMatrix
GLfloat right
CC3Plane rightPlane
GLfloat top
CC3Plane topPlane

Detailed Description

Represents a camera's frustum.

Each CC3Camera instance contains an instance of this class.

Each frustum has four sides: top, bottom, left and right, and has two caps: near and far. These sides and caps are represented as six planes.

The frustum is a truncated pyramid that has the location of the camera as the pyrimid apex. This frustum manages and populates the projection matrix used by the camera, and builds its planes from a combination of that projection matrix and the camera's modelview matrix.

The frustum is a type of bounding volume and therefore supports methods for testing whether locations, rays, shapes, and other bounding volumes intersect the volume of the frustum.


Member Function Documentation

Deprecated:
Renamed to markDirty.
- (BOOL) doesIntersectPointAt: (CC3Vector DEPRECATED_ATTRIBUTE
Deprecated:
Renamed to doesIntersectLocation:.
- (BOOL) doesIntersectSphereAt: (CC3Vector aLocation
withRadius: (GLfloat)  DEPRECATED_ATTRIBUTE 
Deprecated:
Renamed to doesIntersectLocation:.
+ (id) frustumOnModelviewMatrix: (CC3Matrix *)  aMtx

Allocates and initializes an autoreleased instance on the specified modelview matrix.

- (id) initOnModelviewMatrix: (CC3Matrix *)  aMtx

Initializes this instance on the specified modelview matrix.

- (void) populateFrom: (GLfloat)  fieldOfView
andAspect: (GLfloat)  aspect
andNearClip: (GLfloat)  nearClip
andFarClip: (GLfloat)  farClip
andZoom: (GLfloat)  zoomFactor 

Sets the six frustum clipping planes and the projectionMatrix from the specified projection parameters.

The zoomFactor is applied to the field of view to create an effective field of view. A zoomFactor of greater than one will decrease the effective field of view (zooming-in), and a zoomFactor of less than one will increase the effective field of view (zooming-out). For smaller zoomFactor values, the effective field of view is clamped at slightly less than 180 degrees, to avoid an extreme fish-eye effect that makes the scene completely disappear into the distance.

The aspect parameter indicates the width:height ratio of the viewport. The field of view angle is applied to the narrower dimension, to ensure that overall perspective are consistent across a simple transposition of the viewport dimensions (ie- a rotation of the viewport by 90 degrees).


Member Data Documentation

- (CC3Plane planes[6]) [protected]

For bounding volumes that are described in terms of a hull of vertices and planes, this property returns the array of planes that define the boundary surface of this bounding volume.

The planes are defined in the global coordinate system. The number of planes in the array is specified by the planeCount property.

Not all bounding volumes are based on vertices and planes, and this abstract implementation returns the NULL pointer. Subclasses that make use of vertices and planes will allocate the underlying array and override this implementation.

Implements CC3BoundingVolume.

- (CC3Vector vertices[8]) [protected]

For bounding volumes that are described in terms of a hull of vertices and planes, this property returns the array of vertices at the points where the planes intersect.

The vertices are defined in the global coordinate system. The number of vertices in the array is defined by the vertexCount property.

The returned vertices are not in any defined order.

Not all bounding volumes are based on vertices and planes, and this abstract implementation returns the NULL pointer. Subclasses that make use of vertices and planes will allocate the underlying array and override this implementation.

Implements CC3BoundingVolume.


Property Documentation

- (GLfloat) bottom [read, assign]

The distance from view center to the bottom of this frustum at the near clipping plane.

- (CC3Plane) bottomPlane [read, assign]

The clip plane at the bottom of this frustum, in global coordinates.

- (GLfloat) far [read, assign]

The distance to the far end of this frustum.

- (CC3Vector) farBottomLeft [read, assign]

Returns the location of the far bottom left corner of this frustum, in the global coordinate system.

- (CC3Vector) farBottomRight [read, assign]

Returns the location of the far bottom right corner of this frustum, in the global coordinate system.

- (CC3Plane) farPlane [read, assign]

The clip plane at the far end of this frustum, in global coordinates.

- (CC3Vector) farTopLeft [read, assign]

Returns the location of the far top left corner of this frustum, in the global coordinate system.

- (CC3Vector) farTopRight [read, assign]

Returns the location of the far top right corner of this frustum, in the global coordinate system.

- (CC3Matrix *) infiniteProjectionMatrix [read, assign]

The projection matrix modified to have an infinite depth of view, by assuming a farClippingDistance set at infinity.

- (BOOL) isUsingParallelProjection [read, write, assign]

Indicates whether this frustum uses parallel projection.

If this value is set to NO, the projection matrix will be configured for perspective projection, which is typical for 3D scenes. If this value is set to YES, the projection matrix will be configured for orthographic projection.

The initial value of this property is NO, indicating that perspective projection will be used.

- (GLfloat) left [read, assign]

The distance from view center to the left edge of this frustum at the near clipping plane.

- (CC3Plane) leftPlane [read, assign]

The clip plane at the left side of this frustum, in global coordinates.

- (CC3Matrix *) modelviewMatrix [read, write, retain]

The modelview matrix of the camera.

Setting this property will automatically mark the planes as dirty. However, if the contents of the matrix change, this instance will be unaware, and the application is responsible for invoking the markPlanesDirty method to let this instance know.

- (CC3Matrix *) modelviewProjectionMatrix [read, assign]

The combined modelview-projection matrix that projects the scene to the viewport.

This is simply a multiplicative product of the camera's modelview and projection matrices. It is calculated as part of the recalculation of the frustum planes.

- (GLfloat) near [read, assign]

The distance to the near end of this frustum.

- (CC3Vector) nearBottomLeft [read, assign]

Returns the location of the near bottom left corner of this frustum, in the global coordinate system.

- (CC3Vector) nearBottomRight [read, assign]

Returns the location of the near bottom right corner of this frustum, in the global coordinate system.

- (CC3Plane) nearPlane [read, assign]

The clip plane at the near end of this frustum, in global coordinates.

- (CC3Vector) nearTopLeft [read, assign]

Returns the location of the near top left corner of this frustum, in the global coordinate system.

- (CC3Vector) nearTopRight [read, assign]

Returns the location of the near top right corner of this frustum, in the global coordinate system.

- (CC3Matrix *) projectionMatrix [read, assign]

The projection matrix that takes the camera's modelview and projects it to the viewport.

- (GLfloat) right [read, assign]

The distance from view center to the right edge of this frustum at the near clipping plane.

- (CC3Plane) rightPlane [read, assign]

The clip plane at the right side of this frustum, in global coordinates.

- (GLfloat) top [read, assign]

The distance from view center to the top of this frustum at the near clipping plane.

- (CC3Plane) topPlane [read, assign]

The clip plane at the top of this frustum, in global coordinates.


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