Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
blowbox::Camera Class Referenceabstract

#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_
 

Detailed Description

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.

Inheritance diagram for blowbox::Camera:
blowbox::OrthographicCamera blowbox::PerspectiveCamera

Member Function Documentation

float blowbox::Camera::GetFarPlane ( ) const
Returns
The far plane z-value of the camera.
float blowbox::Camera::GetNearPlane ( ) const
Returns
The near plane z-value of the camera.
const DirectX::XMFLOAT3 & blowbox::Camera::GetPosition ( ) const
Returns
The world space position of the camera.
const DirectX::XMMATRIX & blowbox::Camera::GetProjectionMatrix ( )
Returns
The projection matrix of the camera.
const DirectX::XMFLOAT3 & blowbox::Camera::GetRotation ( ) const
Returns
The world space rotation of the camera.
const DirectX::XMMATRIX & blowbox::Camera::GetViewMatrix ( )
Returns
The view matrix of the camera.
void blowbox::Camera::Rotate ( const DirectX::XMFLOAT3 &  rotation)

Rotates the camera by a certain rotation relative to its current rotation.

Parameters
[in]rotationHow much the camera should be rotated.
void blowbox::Camera::SetFarPlane ( float  far_plane)

Sets the far plane of the camera.

Parameters
[in]far_planeThe far plane z-value.
void blowbox::Camera::SetNearPlane ( float  near_plane)

Sets the near plane of the camera.

Parameters
[in]near_planeThe near plane z-value.
void blowbox::Camera::SetPosition ( const DirectX::XMFLOAT3 &  position)

Sets the position of the camera in world space.

Parameters
[in]positionThe new position of the camera.
void blowbox::Camera::SetRotation ( const DirectX::XMFLOAT3 &  rotation)

Sets the rotation of the camera in world space.

Parameters
[in]rotationThe 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.

Parameters
[in]translationHow much the camera should be translated.
virtual void blowbox::Camera::UpdateProjectionMatrix ( )
protectedpure virtual

(Re)-calculates the projection matrix of the camera.

Implemented in blowbox::PerspectiveCamera, and blowbox::OrthographicCamera.

void blowbox::Camera::UpdateViewMatrix ( )
protected

(Re)-calculates the view matrix of the camera.

Member Data Documentation

float blowbox::Camera::far_plane_
protected

The far plane z-value of the camera.

float blowbox::Camera::near_plane_
protected

The near plane z-value of the camera.

DirectX::XMFLOAT3 blowbox::Camera::position_
protected

The position of the camera.

DirectX::XMMATRIX blowbox::Camera::projection_
protected

The projection matrix of the camera.

bool blowbox::Camera::projection_dirty_
protected

Whether the projection matrix has to be updated before it can be used again.

DirectX::XMFLOAT3 blowbox::Camera::rotation_
protected

The rotation of the camera.

DirectX::XMFLOAT3 blowbox::Camera::translation_acculumator_
private

Accumulator for how much the camera should be translated relative to its current orientation.

DirectX::XMMATRIX blowbox::Camera::view_
protected

The view matrix of the camera.

bool blowbox::Camera::view_dirty_
protected

Whether the view matrix has to be updated before it can be used again.


The documentation for this class was generated from the following files: