![]() |
ezEngine
Milestone 9
|
A camera class that stores the orientation and some basic camera settings. More...
#include <Camera.h>
Public Member Functions | |
ezVec3 | GetPosition (ezCameraEye eye=ezCameraEye::Left) const |
Returns the position of the camera that should be used for rendering etc. | |
ezVec3 | GetDirForwards (ezCameraEye eye=ezCameraEye::Left) const |
Returns the forwards vector that should be used for rendering etc. | |
ezVec3 | GetDirUp (ezCameraEye eye=ezCameraEye::Left) const |
Returns the up vector that should be used for rendering etc. | |
ezVec3 | GetDirRight (ezCameraEye eye=ezCameraEye::Left) const |
Returns the right vector that should be used for rendering etc. | |
ezAngle | GetFovX (float fAspectRatioWidthDivHeight) const |
Returns the horizontal FOV. More... | |
ezAngle | GetFovY (float fAspectRatioWidthDivHeight) const |
Returns the vertical FOV. More... | |
float | GetDimensionX (float fAspectRatioWidthDivHeight) const |
Returns the horizontal dimension for an orthographic view. More... | |
float | GetDimensionY (float fAspectRatioWidthDivHeight) const |
Returns the vertical dimension for an orthographic view. More... | |
ezVec3 | GetCenterPosition () const |
Returns the average camera position. More... | |
ezVec3 | GetCenterDirForwards () const |
Returns the average forwards vector. More... | |
ezVec3 | GetCenterDirUp () const |
Returns the average up vector. More... | |
ezVec3 | GetCenterDirRight () const |
Returns the average right vector. More... | |
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 (ezCameraMode::Enum Mode, float fFovOrDim, float fNearPlane, float fFarPlane) |
Specifies the mode and the projection settings that this camera uses. More... | |
void | SetStereoProjection (const ezMat4 &mProjectionLeftEye, const ezMat4 &mProjectionRightEye, float fAspectRatioWidthDivHeight) |
float | GetFovOrDim () const |
Returns the fFovOrDim parameter that was passed to SetCameraProjectionAndMode(). | |
ezCameraMode::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 ezMat4 &mLookAtMatrix, ezCameraEye eye=ezCameraEye::Left) |
Sets the view matrix directly. More... | |
void | LookAt (const ezVec3 &vCameraPos, const ezVec3 &vTargetPos, const ezVec3 &vUp) |
Repositions the camera such that it looks at the given target position. More... | |
ezVec3 | MoveLocally (float fForward, float fRight, float fUp) |
Moves the camera in its local space. Returns the movement that was made. More... | |
void | MoveGlobally (const ezVec3 &vMove) |
Moves the camera in global space. More... | |
void | RotateLocally (ezAngle X, ezAngle Y, ezAngle Z) |
Rotates the camera around the X (forward), Y (right) and Z (up) axis in its own local space. More... | |
void | RotateGlobally (ezAngle X, ezAngle Y, ezAngle Z) |
Rotates the camera around the X, Y and Z axis in global space. More... | |
const ezMat4 & | GetViewMatrix (ezCameraEye eye=ezCameraEye::Left) const |
Returns the view matrix for the given eye. | |
void | GetProjectionMatrix (float fAspectRatioWidthDivHeight, ezMat4 &out_projectionMatrix, ezCameraEye eye=ezCameraEye::Left, ezProjectionDepthRange::Enum depthRange=ezProjectionDepthRange::Default) const |
Calculates the projection matrix from the current camera properties and stores it in out_projectionMatrix. More... | |
float | GetExposure () const |
void | SetExposure (float fExposure) |
ezUInt32 | GetSettingsModificationCounter () const |
Returns a counter that is increased every time the camera settings are modified. More... | |
ezUInt32 | GetOrientationModificationCounter () const |
Returns a counter that is increased every time the camera orientation is modified. More... | |
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 ezCamera::GetDimensionX | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the horizontal dimension for an orthographic view.
Works only with ezCameraMode::OrthoFixedWidth and ezCameraMode::OrthoFixedWidth
float ezCamera::GetDimensionY | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the vertical dimension for an orthographic view.
Works only with ezCameraMode::OrthoFixedWidth and ezCameraMode::OrthoFixedWidth
ezAngle ezCamera::GetFovX | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the horizontal FOV.
Works only with ezCameraMode::PerspectiveFixedFovX and ezCameraMode::PerspectiveFixedFovY
ezAngle ezCamera::GetFovY | ( | float | fAspectRatioWidthDivHeight | ) | const |
Returns the vertical FOV.
Works only with ezCameraMode::PerspectiveFixedFovX and ezCameraMode::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 ezCamera::GetProjectionMatrix | ( | float | fAspectRatioWidthDivHeight, |
ezMat4 & | out_projectionMatrix, | ||
ezCameraEye | eye = ezCameraEye::Left , |
||
ezProjectionDepthRange::Enum | depthRange = ezProjectionDepthRange::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.
Repositions the camera such that it looks at the given target position.
Not supported for stereo cameras.
void ezCamera::MoveGlobally | ( | const ezVec3 & | vMove | ) |
Moves the camera in global space.
Not supported for stereo cameras.
ezVec3 ezCamera::MoveLocally | ( | float | fForward, |
float | fRight, | ||
float | fUp | ||
) |
Moves the camera in its local space. Returns the movement that was made.
Not supported for stereo cameras.
Rotates the camera around the X, Y and Z axis in global space.
Rotate around Z for turning the camera left/right. Not supported for stereo cameras.
Rotates the camera around the X (forward), Y (right) and Z (up) axis in its own local space.
Rotate around Y for looking up/down. X is roll. For turning left/right use Z with RotateGlobally(). Not supported for stereo cameras.
void ezCamera::SetCameraMode | ( | ezCameraMode::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 ezCamera::SetStereoProjection | ( | const ezMat4 & | mProjectionLeftEye, |
const ezMat4 & | 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 ezCamera::SetViewMatrix | ( | const ezMat4 & | mLookAtMatrix, |
ezCameraEye | eye = ezCameraEye::Left |
||
) |
Sets the view matrix directly.
Works with all camera types. Position- and direction- getter/setter will work as usual.