Public Member Functions | Protected Attributes | Friends

sp::scene::Camera Class Reference

#include <spSceneCamera.hpp>

Inheritance diagram for sp::scene::Camera:
sp::scene::SceneNode sp::Node sp::BaseObject sp::scene::FirstPersonCamera

List of all members.

Public Member Functions

 Camera ()
 Camera (const dim::rect2di &Viewport, f32 NearPlane, f32 FarPlane, f32 FieldOfView=DEF_PERSPECTIVE_FOV)
virtual ~Camera ()
virtual void updateControl ()
virtual void drawMenu ()
void setRange (f32 NearRange, f32 FarRange)
void setRangeNear (f32 NearRange)
 Sets only the near clipping plane of the camera view range. By default 0.25.
void setRangeFar (f32 FarRange)
 Sets only the far clipping plane of the camera view range. By default 1000.
void setFOV (f32 FieldOfView)
void setZoom (f32 Zoom)
 Sets the zoom factor. By default 1.0. This uses the setFOV function.
f32 getZoom () const
 Returns the zoom factor. By default 1.0. This uses the getFOV function.
void setOrtho (bool isOrtho)
 Enables or disables the orthographic view. With this you can switch between an orthographic or a perspective view.
void setViewport (const dim::rect2di &Viewport)
void setPerspective (const dim::rect2di &Viewport, f32 NearRange, f32 FarRange, f32 FieldOfView=DEF_PERSPECTIVE_FOV)
void getPerspective (dim::rect2di &Viewport, f32 &NearRange, f32 &FarRange, f32 &FieldOfView)
dim::point2di getProjection (dim::vector3df Position) const
dim::line3df getPickingLine (const dim::point2di &Position, f32 Length=DEF_PICKING_LENGTH) const
void lookAt (dim::vector3df Position, bool isGlobal=false)
void setupRenderView ()
virtual void setupCameraView ()
 Setups viewport and projection matrix.
virtual void updateTransformation ()
 Updates the objects transformation.
Cameracopy () const
const dim::matrix4fgetProjectionMatrix () const
void setProjection (const Projection &Proj)
 Sets the camera's projection object.
const ProjectiongetProjection () const
 Returns a constant reference to the camera's projection object.
ProjectiongetProjection ()
 Returns a reference to the camera's projection object.
const ViewFrustumgetViewFrustum () const
f32 getRangeNear () const
 Returns the near clipping plane range. By default 0.25.
f32 getRangeFar () const
 Returns the far clipping plane range. By default 1000.
f32 getFOV () const
 Returns the field-of-view angle. By default 74.0.
bool getOrtho () const
 Returns true if the camera projection is orthographic.
const dim::rect2digetViewport () const
 Returns the camera's viewport. By default (0, 0, ScreeWidth, ScreenHeight).
void setMirrorMatrix (const dim::matrix4f &Matrix)
const dim::matrix4fgetMirrorMatrix () const
void setMirror (bool isMirror)
bool getMirror () const
 Returns true if the mirror matrix is used. By default false.

Protected Attributes

Projection Projection_
ViewFrustum ViewFrustum_
dim::matrix4f MirrorMatrix_
bool isMirror_

Friends

class SceneGraphPortalBased

Detailed Description

Camera object class.

See also:
FirstPersonCamera
TrackingCamera
BlenderCamera

Constructor & Destructor Documentation

sp::scene::Camera::Camera (  ) 
sp::scene::Camera::Camera ( const dim::rect2di Viewport,
f32  NearPlane,
f32  FarPlane,
f32  FieldOfView = DEF_PERSPECTIVE_FOV 
)
sp::scene::Camera::~Camera (  )  [virtual]

Member Function Documentation

Camera * sp::scene::Camera::copy (  )  const

Reimplemented from sp::scene::SceneNode.

void sp::scene::Camera::drawMenu (  )  [virtual]

Draws the menu for an interaction camera like the FirstPersonCamera on Android or iOS. The base Camera class does not draw any menu. If you have an interaction camera you have to draw the menu in the forground and in 2d.

See also:
RenderSystem::beginDrawing2D, RenderSystem::endDrawing2D.

Reimplemented in sp::scene::FirstPersonCamera.

f32 sp::scene::Camera::getFOV (  )  const [inline]

Returns the field-of-view angle. By default 74.0.

bool sp::scene::Camera::getMirror (  )  const [inline]

Returns true if the mirror matrix is used. By default false.

const dim::matrix4f& sp::scene::Camera::getMirrorMatrix (  )  const [inline]

Returns the mirror matrix.

See also:
setMirrorMatrix
bool sp::scene::Camera::getOrtho (  )  const [inline]

Returns true if the camera projection is orthographic.

void sp::scene::Camera::getPerspective ( dim::rect2di Viewport,
f32 NearRange,
f32 FarRange,
f32 FieldOfView 
)
dim::line3df sp::scene::Camera::getPickingLine ( const dim::point2di Position,
f32  Length = DEF_PICKING_LENGTH 
) const

Computes the picking line (or ray) using the global transformation and projection of this camera.

Parameters:
Position,: 2D point in normal screen space. If you want to pick with your cursor just use the cursor position.
Length,: Length (or depth) of the line. If you only want to pick 2 or 3 units forwards you can save calculation time.
Returns:
3D line which can be used for further picking calculations. Use this line when calling "findIntersection" from the CollisionGraph class.
const Projection& sp::scene::Camera::getProjection (  )  const [inline]

Returns a constant reference to the camera's projection object.

Projection& sp::scene::Camera::getProjection (  )  [inline]

Returns a reference to the camera's projection object.

dim::point2di sp::scene::Camera::getProjection ( dim::vector3df  Position  )  const

Makes a projection from 3D to 2D.

Parameters:
Position,: 3D point which is to be projected to 2D.
Returns:
2D point which is projected by the global transformation of this camera.
const dim::matrix4f & sp::scene::Camera::getProjectionMatrix (  )  const

Returns the camera's projection matrix.

Note:
This depends on the used render system. For OpenGL a right-handed projection matrix is used and for all the other render systems a left-handed projection matrix is used. If you want to choose between them use the "getProjection" function
See also:
Projection3D
f32 sp::scene::Camera::getRangeFar (  )  const [inline]

Returns the far clipping plane range. By default 1000.

f32 sp::scene::Camera::getRangeNear (  )  const [inline]

Returns the near clipping plane range. By default 0.25.

const ViewFrustum& sp::scene::Camera::getViewFrustum (  )  const [inline]

Returns the camera's view frustum, consisting of 6 planes which describe the view's volume.

Note:
The camera's view frustum will be updated every time "updateTransformation" is called because it depends on the view-matrix.
const dim::rect2di& sp::scene::Camera::getViewport (  )  const [inline]

Returns the camera's viewport. By default (0, 0, ScreeWidth, ScreenHeight).

f32 sp::scene::Camera::getZoom (  )  const

Returns the zoom factor. By default 1.0. This uses the getFOV function.

void sp::scene::Camera::lookAt ( dim::vector3df  Position,
bool  isGlobal = false 
)
void sp::scene::Camera::setFOV ( f32  FieldOfView  ) 

Sets the field-of-view angle. By default 74.0 which causes a typical view frustum.

Parameters:
FieldOfView,: Angle for the field of view. The range shall be: 0 < ZoomAngle < 180.
void sp::scene::Camera::setMirror ( bool  isMirror  )  [inline]

Enables or disables the mirror transformation. The transformation is performed by the MirrorMatrix which can be set by "setMirrorMatrix".

Parameters:
isMirror,: Specifies if the mirror transformation it to be enabled or disabled. If true the MirrorMatrix is multiplied by the ViewMatrix (see also: VideoDriver::setViewMatrix) after the basic camera transformations which are process in the "updateModelviewMatrix" function. This additional transformation can be used e.g. for water reflection effects when the scene is rendered a second time.
void sp::scene::Camera::setMirrorMatrix ( const dim::matrix4f Matrix  )  [inline]

Sets the mirror transformation matrix. See more about the mirror matrix at the "setMirror" function.

Parameters:
Matrix,: Transformation matrix which is process in the "updateModelviewMatrix" when the mirror transformation is enabled by "setMirror".
void sp::scene::Camera::setOrtho ( bool  isOrtho  ) 

Enables or disables the orthographic view. With this you can switch between an orthographic or a perspective view.

void sp::scene::Camera::setPerspective ( const dim::rect2di Viewport,
f32  NearRange,
f32  FarRange,
f32  FieldOfView = DEF_PERSPECTIVE_FOV 
)

Sets multiple camera configurations concurrently.

Parameters:
Viewport,: Camera's viewport in screen coordinates.
NearRange,: Range for the camera's near clipping plane. By default 1.0.
FarRange,: Range for the camera's far clipping plane. By default 1000.0.
FieldOfView,: Angle of FOV (Field-of-view). By default 74.0.
Deprecated:
void sp::scene::Camera::setProjection ( const Projection Proj  )  [inline]

Sets the camera's projection object.

void sp::scene::Camera::setRange ( f32  NearRange,
f32  FarRange 
)

Sets the camera view range or the near- and far clipping planes. By defualt the near-clipping-plane is 1.0 and the far-clipping-plane is 1000.0.

Parameters:
NearRange,: Range for the near clipping plane. Must be greater then 0. By default 0.25.
FarRange,: Range for the far clipping plane. Must be greater then NearRange. By default 1000.
void sp::scene::Camera::setRangeFar ( f32  FarRange  ) 

Sets only the far clipping plane of the camera view range. By default 1000.

void sp::scene::Camera::setRangeNear ( f32  NearRange  ) 

Sets only the near clipping plane of the camera view range. By default 0.25.

void sp::scene::Camera::setupCameraView (  )  [virtual]

Setups viewport and projection matrix.

void sp::scene::Camera::setupRenderView (  )  [inline]

Setups the render view. This includes the viewport, projection matrix, view matrix and view frustum. Call this function before render the scene for this camera.

void sp::scene::Camera::setViewport ( const dim::rect2di Viewport  ) 

Sets the camera's viewport in screen space.

Parameters:
Viewport,: Viewport or view area for the camera. In this case the two parameters of rect2di ("Right" and "Bottom") specifie the size (width and height).
void sp::scene::Camera::setZoom ( f32  Zoom  ) 

Sets the zoom factor. By default 1.0. This uses the setFOV function.

void sp::scene::Camera::updateControl (  )  [virtual]

Updates the camera interaction. This can be used derived cameras like the FirstPersonCamera. If you want to use the interaction you have to call this function in your main loop for each frame.

Reimplemented in sp::scene::FirstPersonCamera.

void sp::scene::Camera::updateTransformation (  )  [virtual]

Updates the objects transformation.

Reimplemented from sp::scene::SceneNode.


Friends And Related Function Documentation

friend class SceneGraphPortalBased [friend]

Member Data Documentation

bool sp::scene::Camera::isMirror_ [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines