![]() |
Plasma Engine
2.0
|
A camera class that stores the orientation and some basic camera settings. More...
#include <Camera.h>
Public Member Functions | |
void | SetCoordinateSystem (plBasisAxis::Enum forwardAxis, plBasisAxis::Enum rightAxis, plBasisAxis::Enum axis) |
Allows to specify a different coordinate system in which the camera input and output coordinates are given. | |
void | SetCoordinateSystem (const plSharedPtr< plCoordinateSystemProvider > &pProvider) |
Allows to specify a full plCoordinateSystemProvider to determine forward/right/up vectors for camera movement. | |
plVec3 | GetPosition (plCameraEye eye=plCameraEye::Left) const |
Returns the position of the camera that should be used for rendering etc. | |
plVec3 | GetDirForwards (plCameraEye eye=plCameraEye::Left) const |
Returns the forwards vector that should be used for rendering etc. | |
plVec3 | GetDirUp (plCameraEye eye=plCameraEye::Left) const |
Returns the up vector that should be used for rendering etc. | |
plVec3 | GetDirRight (plCameraEye eye=plCameraEye::Left) const |
Returns the right vector that should be used for rendering etc. | |
plAngle | GetFovX (float fAspectRatioWidthDivHeight) const |
Returns the horizontal FOV. | |
plAngle | GetFovY (float fAspectRatioWidthDivHeight) const |
Returns the vertical FOV. | |
float | GetDimensionX (float fAspectRatioWidthDivHeight) const |
Returns the horizontal dimension for an orthographic view. | |
float | GetDimensionY (float fAspectRatioWidthDivHeight) const |
Returns the vertical dimension for an orthographic view. | |
plVec3 | GetCenterPosition () const |
Returns the average camera position. | |
plVec3 | GetCenterDirForwards () const |
Returns the average forwards vector. | |
plVec3 | GetCenterDirUp () const |
Returns the average up vector. | |
plVec3 | GetCenterDirRight () const |
Returns the average right vector. | |
float | GetNearPlane () const |
Returns the near plane distance that was passed to SetCameraProjectionAndMode(). | |
float | GetFarPlane () const |
Returns the far plane distance that was passed to SetCameraProjectionAndMode(). | |
void | SetCameraMode (plCameraMode::Enum mode, float fFovOrDim, float fNearPlane, float fFarPlane) |
Specifies the mode and the projection settings that this camera uses. | |
void | SetStereoProjection (const plMat4 &mProjectionLeftEye, const plMat4 &mProjectionRightEye, float fAspectRatioWidthDivHeight) |
float | GetFovOrDim () const |
Returns the fFovOrDim parameter that was passed to SetCameraProjectionAndMode(). | |
plCameraMode::Enum | GetCameraMode () const |
Returns the current camera mode. | |
bool | IsPerspective () const |
bool | IsOrthographic () const |
bool | IsStereoscopic () const |
Whether this is a stereoscopic camera. | |
void | SetViewMatrix (const plMat4 &mLookAtMatrix, plCameraEye eye=plCameraEye::Left) |
Sets the view matrix directly. | |
void | LookAt (const plVec3 &vCameraPos, const plVec3 &vTargetPos, const plVec3 &vUp) |
Repositions the camera such that it looks at the given target position. | |
void | MoveLocally (float fForward, float fRight, float fUp) |
Moves the camera in its local space along the forward/right/up directions of the coordinate system. | |
void | MoveGlobally (float fForward, float fRight, float fUp) |
Moves the camera in global space along the forward/right/up directions of the coordinate system. | |
void | RotateLocally (plAngle forwardAxis, plAngle rightAxis, plAngle axis) |
Rotates the camera around the forward, right and up axis in its own local space. | |
void | RotateGlobally (plAngle forwardAxis, plAngle rightAxis, plAngle axis) |
Rotates the camera around the forward, right and up axis of the coordinate system in global space. | |
const plMat4 & | GetViewMatrix (plCameraEye eye=plCameraEye::Left) const |
Returns the view matrix for the given eye. | |
void | GetProjectionMatrix (float fAspectRatioWidthDivHeight, plMat4 &out_mProjectionMatrix, plCameraEye eye=plCameraEye::Left, plClipSpaceDepthRange::Enum depthRange=plClipSpaceDepthRange::Default) const |
Calculates the projection matrix from the current camera properties and stores it in out_projectionMatrix. | |
float | GetExposure () const |
void | SetExposure (float fExposure) |
float | GetAperture () const |
void | SetAperture (float fAperture) |
float | GetShutterSpeed () const |
void | SetShutterSpeed (float fShutterSpeed) |
float | GetISO () const |
void | SetISO (float fISO) |
float | GetFocusDistance () const |
void | SetFocusDistance (float fFocusDistance) |
plUInt32 | GetSettingsModificationCounter () const |
Returns a counter that is increased every time the camera settings are modified. | |
plUInt32 | GetOrientationModificationCounter () const |
Returns a counter that is increased every time the camera orientation is modified. | |
A camera class that stores the orientation and some basic camera settings.
|
inline |
Returns the average forwards vector.
For all cameras execpt Stereo cameras this is identical to GetDirForwards()
|
inline |
Returns the average right vector.
For all cameras execpt Stereo cameras this is identical to GetDirRight()
|
inline |
Returns the average up vector.
For all cameras execpt Stereo cameras this is identical to GetDirUp()
|
inline |
Returns the average camera position.
For all cameras execpt Stereo cameras this is identical to GetPosition()
float plCamera::GetDimensionX | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the horizontal dimension for an orthographic view.
Works only with plCameraMode::OrthoFixedWidth and plCameraMode::OrthoFixedWidth
float plCamera::GetDimensionY | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the vertical dimension for an orthographic view.
Works only with plCameraMode::OrthoFixedWidth and plCameraMode::OrthoFixedWidth
plAngle plCamera::GetFovX | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the horizontal FOV.
Works only with plCameraMode::PerspectiveFixedFovX and plCameraMode::PerspectiveFixedFovY
plAngle plCamera::GetFovY | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the vertical FOV.
Works only with plCameraMode::PerspectiveFixedFovX and plCameraMode::PerspectiveFixedFovY
|
inline |
Returns a counter that is increased every time the camera orientation is modified.
The camera orientation is used to compute the view matrix. This counter can be used to determine whether the view matrix has changed and thus whether cached values need to be updated.
void plCamera::GetProjectionMatrix | ( | float | fAspectRatioWidthDivHeight, |
plMat4 & | out_mProjectionMatrix, | ||
plCameraEye | eye = plCameraEye::Left, | ||
plClipSpaceDepthRange::Enum | depthRange = plClipSpaceDepthRange::Default ) const |
Calculates the projection matrix from the current camera properties and stores it in out_projectionMatrix.
If the camera is stereo and the given aspect ratio is close to the aspect ratio passed in SetStereoProjection, the matrix set in SetStereoProjection will be used.
|
inline |
Returns a counter that is increased every time the camera settings are modified.
The camera settings are used to compute the projection matrix. This counter can be used to determine whether the projection matrix has changed and thus whether cached values need to be updated.
PL_ALWAYS_INLINE const plMat4 & plCamera::GetViewMatrix | ( | plCameraEye | eye = plCameraEye::Left | ) | const |
Returns the view matrix for the given eye.
Repositions the camera such that it looks at the given target position.
Not supported for stereo cameras.
void plCamera::MoveGlobally | ( | float | fForward, |
float | fRight, | ||
float | fUp ) |
Moves the camera in global space along the forward/right/up directions of the coordinate system.
Not supported for stereo cameras.
void plCamera::MoveLocally | ( | float | fForward, |
float | fRight, | ||
float | fUp ) |
Moves the camera in its local space along the forward/right/up directions of the coordinate system.
Not supported for stereo cameras.
Rotates the camera around the forward, right and up axis of the coordinate system in global space.
Rotate around Z for turning the camera left/right. Not supported for stereo cameras.
Rotates the camera around the forward, right and up axis in its own local space.
Rotate around rightAxis for looking up/down. \forwardAxis is roll. For turning left/right use RotateGlobally(). Not supported for stereo cameras.
void plCamera::SetCameraMode | ( | plCameraMode::Enum | mode, |
float | fFovOrDim, | ||
float | fNearPlane, | ||
float | fFarPlane ) |
Specifies the mode and the projection settings that this camera uses.
fFovOrDim | Fov X/Y in degree or width/height (depending on Mode). |
void plCamera::SetCoordinateSystem | ( | plBasisAxis::Enum | forwardAxis, |
plBasisAxis::Enum | rightAxis, | ||
plBasisAxis::Enum | axis ) |
Allows to specify a different coordinate system in which the camera input and output coordinates are given.
The default in z is forward = PositiveX, right = PositiveY, Up = PositiveZ.
void plCamera::SetStereoProjection | ( | const plMat4 & | mProjectionLeftEye, |
const plMat4 & | mProjectionRightEye, | ||
float | fAspectRatioWidthDivHeight ) |
Sets the camera mode to stereo and specifies projection matrices directly.
fAspectRatio | These stereo projection matrices will only be returned by getProjectionMatrix for the given aspectRatio. |
void plCamera::SetViewMatrix | ( | const plMat4 & | mLookAtMatrix, |
plCameraEye | eye = plCameraEye::Left ) |
Sets the view matrix directly.
Works with all camera types. Position- and direction- getter/setter will work as usual.