Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <camera.h>
Public Member Functions | |
void | Translate (const DirectX::XMFLOAT3 &translation) |
void | Rotate (const DirectX::XMFLOAT3 &rotation) |
void | SetPosition (const DirectX::XMFLOAT3 &position) |
void | SetRotation (const DirectX::XMFLOAT3 &rotation) |
const DirectX::XMFLOAT3 & | GetPosition () const |
const DirectX::XMFLOAT3 & | GetRotation () const |
void | SetNearPlane (float near_plane) |
void | SetFarPlane (float far_plane) |
float | GetNearPlane () const |
float | GetFarPlane () const |
const DirectX::XMMATRIX & | GetViewMatrix () |
const DirectX::XMMATRIX & | GetProjectionMatrix () |
Protected Member Functions | |
void | UpdateViewMatrix () |
virtual void | UpdateProjectionMatrix ()=0 |
Protected Attributes | |
DirectX::XMFLOAT3 | position_ |
DirectX::XMFLOAT3 | rotation_ |
DirectX::XMMATRIX | view_ |
DirectX::XMMATRIX | projection_ |
bool | view_dirty_ |
bool | projection_dirty_ |
float | near_plane_ |
float | far_plane_ |
Private Attributes | |
DirectX::XMFLOAT3 | translation_acculumator_ |
A camera through which the scene is rendered.
This is the base class for all cameras in Blowbox. It exposes the base functionality that every camera should have. Pretty straightforward.
float blowbox::Camera::GetFarPlane | ( | ) | const |
float blowbox::Camera::GetNearPlane | ( | ) | const |
const DirectX::XMFLOAT3 & blowbox::Camera::GetPosition | ( | ) | const |
const DirectX::XMMATRIX & blowbox::Camera::GetProjectionMatrix | ( | ) |
const DirectX::XMFLOAT3 & blowbox::Camera::GetRotation | ( | ) | const |
const DirectX::XMMATRIX & blowbox::Camera::GetViewMatrix | ( | ) |
void blowbox::Camera::Rotate | ( | const DirectX::XMFLOAT3 & | rotation | ) |
Rotates the camera by a certain rotation relative to its current rotation.
[in] | rotation | How much the camera should be rotated. |
void blowbox::Camera::SetFarPlane | ( | float | far_plane | ) |
Sets the far plane of the camera.
[in] | far_plane | The far plane z-value. |
void blowbox::Camera::SetNearPlane | ( | float | near_plane | ) |
Sets the near plane of the camera.
[in] | near_plane | The near plane z-value. |
void blowbox::Camera::SetPosition | ( | const DirectX::XMFLOAT3 & | position | ) |
Sets the position of the camera in world space.
[in] | position | The new position of the camera. |
void blowbox::Camera::SetRotation | ( | const DirectX::XMFLOAT3 & | rotation | ) |
Sets the rotation of the camera in world space.
[in] | rotation | The new rotation of the camera. |
void blowbox::Camera::Translate | ( | const DirectX::XMFLOAT3 & | translation | ) |
Translates the camera in a given direction relative to its current orientation.
[in] | translation | How much the camera should be translated. |
|
protectedpure virtual |
(Re)-calculates the projection matrix of the camera.
Implemented in blowbox::PerspectiveCamera, and blowbox::OrthographicCamera.
|
protected |
(Re)-calculates the view matrix of the camera.
|
protected |
The far plane z-value of the camera.
|
protected |
The near plane z-value of the camera.
|
protected |
The position of the camera.
|
protected |
The projection matrix of the camera.
|
protected |
Whether the projection matrix has to be updated before it can be used again.
|
protected |
The rotation of the camera.
|
private |
Accumulator for how much the camera should be translated relative to its current orientation.
|
protected |
The view matrix of the camera.
|
protected |
Whether the view matrix has to be updated before it can be used again.