#include <spSceneCamera.hpp>
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. | |
Camera * | copy () const |
const dim::matrix4f & | getProjectionMatrix () const |
void | setProjection (const Projection &Proj) |
Sets the camera's projection object. | |
const Projection & | getProjection () const |
Returns a constant reference to the camera's projection object. | |
Projection & | getProjection () |
Returns a reference to the camera's projection object. | |
const ViewFrustum & | getViewFrustum () 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::rect2di & | getViewport () const |
Returns the camera's viewport. By default (0, 0, ScreeWidth, ScreenHeight). | |
void | setMirrorMatrix (const dim::matrix4f &Matrix) |
const dim::matrix4f & | getMirrorMatrix () 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 |
Camera object class.
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] |
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.
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.
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.
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. |
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.
Position,: | 3D point which is to be projected to 2D. |
const dim::matrix4f & sp::scene::Camera::getProjectionMatrix | ( | ) | const |
Returns the camera's projection matrix.
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.
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.
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".
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.
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.
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. |
void sp::scene::Camera::setProjection | ( | const Projection & | Proj | ) | [inline] |
Sets the camera's projection object.
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.
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.
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.
friend class SceneGraphPortalBased [friend] |
bool sp::scene::Camera::isMirror_ [protected] |
dim::matrix4f sp::scene::Camera::MirrorMatrix_ [protected] |
Projection sp::scene::Camera::Projection_ [protected] |
ViewFrustum sp::scene::Camera::ViewFrustum_ [protected] |