ICamera Interface Reference

A common interface for Camera2D and Camera3D. More...

Inheritance diagram for ICamera:
Camera2D Camera3D

List of all members.

Public Member Functions

void SetAspectFromViewport ()
 Read aspect ratio from viewport and update camera projection data accordingly.
void Push ()
 Push all matrices on the stack, and set Projection and View.
void Pop ()
 Pop all matrices from the stack.
Matrix4 GetTransform ()
 Return the camera transform matrix (orthonormal positioning matrix), as a Matrix4.
void DebugDraw (float step)
 Draw a world grid and the world coordinate system, for debug.
void Navigate (int control)
 Process input for debug navigation.
void SetViewFromViewport ()
 Set a camera view so that the bottom left of the screen matches world point (0,0) and the top right of the screen matches world point (screen width, sreen height).
Vector2 NormalizedToWorld (Vector2 bottom_left_minus_1_minus_1_top_left_1_1_normalized_screen_pos)
 Given a point in normalized screen coordinates (-1->1), return its corresponding world position.
Vector2 GetTouchPos (int nth=0, bool prev=false)
 Return the 'nth' touch position in world coordinates.
Bounds2 CalcBounds ()
 Calculate the world bounds currently visible on screen.
float GetPixelSize ()
 Based on current viewport size, get the size of a "screen pixel" in world coordinates.
void SetTouchPlaneMatrix (Matrix4 mat)
 The the orientation of the 3D plane that should be used by GetTouchPos().

Detailed Description

A common interface for Camera2D and Camera3D.


Member Function Documentation

Bounds2 CalcBounds ( )

Calculate the world bounds currently visible on screen.

This function is 2D only, somehow extended to 3D.

Implemented in Camera2D, and Camera3D.

void DebugDraw ( float  step)

Draw a world grid and the world coordinate system, for debug.

Note that DebugDraw() doesn't call Push()/Pop() internally. It is your responsability to call it between this Camera's Push()/Pop().

Implemented in Camera2D, and Camera3D.

float GetPixelSize ( )

Based on current viewport size, get the size of a "screen pixel" in world coordinates.

Can be used to determine scale factor needed to draw sprites 1:1 for example. 2D only, somehow extended to 3D.

Implemented in Camera2D, and Camera3D.

Vector2 GetTouchPos ( int  nth = 0,
bool  prev = false 
)

Return the 'nth' touch position in world coordinates.

The 'prev' flag is for internal use only.

Implemented in Camera2D, and Camera3D.

Matrix4 GetTransform ( )

Return the camera transform matrix (orthonormal positioning matrix), as a Matrix4.

GetTransform().InverseOrthonormal() is what you push on the view matrix stack.

Implemented in Camera2D, and Camera3D.

void SetTouchPlaneMatrix ( Matrix4  mat)

The the orientation of the 3D plane that should be used by GetTouchPos().

3D only.

Implemented in Camera2D, and Camera3D.