Public Member Functions | Static Public Member Functions

CC3Projector Class Reference

A helper class of CC3Camera for projecting 3D locations to 2D points. More...

#import <CC3Camera.h>

List of all members.

Public Member Functions

(id) - initOnCamera:
(CC3Vector- orientProjectedPoint:
(CC3Vector- projectLocation:
(void) - updateDeviceOrientation:

Static Public Member Functions

(id) + projectorOnCamera:

Detailed Description

The projection calculations can take into consideration the orientation of the device.


Member Function Documentation

- (id) initOnCamera: (CC3Camera *)  aCamera

Initializes this instance on the specified camera.

- (CC3Vector) orientProjectedPoint: (CC3Vector aProjectedPoint

Orients the specified projected point to the orientation of the device.

The X and Y components will be mapped accordingly. The Z-component will be left unchanged.

- (CC3Vector) projectLocation: (CC3Vector a3DLocation

Projects the specified 3D world location onto a 2D position in the viewport coordinate space, indicating where on the screen this 3D location will be seen.

The 2D position can be read from the X and Y components of the returned 3D location. This method takes into account the orientation of the device (portrait, landscape). The Z-component of the returned location will be +1 for 3D locations that are in front of the camera and -1 for locations that are behind the camera. See the notes at the projectLocation: method of CC3Camera for more explanatory information.

This method invokes the methods projectLocation:usingModelMatrix:andProjectionMatrix:andViewport: and orientProjectedPoint: of this class.

+ (CC3Vector) projectLocation: (CC3Vector a3DLocation
usingModelMatrix: (CC3GLMatrix *)  modelviewMatrix
andProjectionMatrix: (CC3GLMatrix *)  projectionMatrix
andViewport: (CC3Viewport viewport 

Projects the specified 3D world location onto a 2D position in the viewport coordinate space, by transforming the location with the specified modelview and projection matrices, and then mapping the X and Y components of the result to the specified viewport.

+ (id) projectorOnCamera: (CC3Camera *)  aCamera

Allocates and initializes an autorelease instance on the specified camera.

- (void) updateDeviceOrientation: (ccDeviceOrientation)  deviceOrientation

Sets the appropriate X and Y mappings to be used by the orientProjectedPoint: method when a 3D location is projected to 2D.

This method is invoked automatically by the updateDeviceOrientation: method of CC3Camera.


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