Nameless Engine
Loading...
Searching...
No Matches
ne::CameraProperties Class Reference

#include <CameraProperties.h>

Classes

struct  Data
 

Public Member Functions

void setFov (unsigned int iVerticalFov)
 
void setNearClipPlaneDistance (float nearClipPlaneDistance)
 
void setFarClipPlaneDistance (float farClipPlaneDistance)
 
unsigned int getVerticalFov ()
 
float getNearClipPlaneDistance ()
 
float getFarClipPlaneDistance ()
 
CameraMode getCurrentCameraMode ()
 
Data::OrbitalModeData getOrbitalModeProperties ()
 
glm::vec3 getWorldLocation ()
 
glm::mat4x4 getViewMatrix ()
 
glm::mat4x4 getProjectionMatrix ()
 
FrustumgetCameraFrustum ()
 

Private Member Functions

void setRenderTargetSize (unsigned int iRenderTargetWidth, unsigned int iRenderTargetHeight)
 
void makeSureViewMatrixIsUpToDate ()
 
void makeSureProjectionMatrixAndClipPlanesAreUpToDate ()
 
void recalculateFrustum ()
 

Private Attributes

std::pair< std::recursive_mutex, DatamtxData {}
 

Static Private Attributes

static constexpr float floatDelta = 0.00001F
 

Friends

class CameraNode
 
class Renderer
 

Detailed Description

Defines camera settings, base axis, location, modes, etc.

Member Function Documentation

◆ getCameraFrustum()

Frustum * ne::CameraProperties::getCameraFrustum ( )
inline

Returns camera's frustum for fast read-only access.

Warning
Returned frustum may be outdated (does not include changes made during the last frame), generally you would use this function when you know that frustum is updated (contains latest changes), if not sure call getViewMatrix or getProjectionMatrix that will make sure frustum is updated but since you would call a different function this might have a small performance penalty.
Remarks
Do not delete (free) returned pointer.
Returns
Camera's frustum.

◆ getCurrentCameraMode()

CameraMode ne::CameraProperties::getCurrentCameraMode ( )

Returns the current camera mode.

Returns
Camera mode.

◆ getFarClipPlaneDistance()

float ne::CameraProperties::getFarClipPlaneDistance ( )

Returns distance from camera (view) space origin to camera's far clip plane.

Returns
Distance to far clip plane.

◆ getNearClipPlaneDistance()

float ne::CameraProperties::getNearClipPlaneDistance ( )

Returns distance from camera (view) space origin to camera's near clip plane.

Returns
Distance to near clip plane.

◆ getOrbitalModeProperties()

CameraProperties::Data::OrbitalModeData ne::CameraProperties::getOrbitalModeProperties ( )

Returns orbital camera properties.

Returns
Orbital camera properties.

◆ getProjectionMatrix()

glm::mat4x4 ne::CameraProperties::getProjectionMatrix ( )

Returns a matrix that transforms positions from view (camera) space to 2D projection window (homogeneous clip space).

Returns
Projection matrix.

◆ getVerticalFov()

unsigned int ne::CameraProperties::getVerticalFov ( )

Returns vertical field of view of the camera.

Returns
Vertical field of view.

◆ getViewMatrix()

glm::mat4x4 ne::CameraProperties::getViewMatrix ( )

Returns a matrix that transforms positions to view (camera) space.

Returns
View matrix.

◆ getWorldLocation()

glm::vec3 ne::CameraProperties::getWorldLocation ( )

Returns camera's world location.

Returns
Location in world space.

◆ makeSureProjectionMatrixAndClipPlanesAreUpToDate()

void ne::CameraProperties::makeSureProjectionMatrixAndClipPlanesAreUpToDate ( )
private

Recalculates camera's projection matrix and clip plane heights if they need to be updated.

Remarks
This function can ignore the call if there's no need to recalculate this data.

◆ makeSureViewMatrixIsUpToDate()

void ne::CameraProperties::makeSureViewMatrixIsUpToDate ( )
private

Recalculates camera's view matrix if it needs to be updated.

Remarks
This function can ignore the call if there's no need to recalculate view matrix.

◆ recalculateFrustum()

void ne::CameraProperties::recalculateFrustum ( )
private

Recalculates camera's frustum.

Remarks
Called after view or projection data is updated.

◆ setFarClipPlaneDistance()

void ne::CameraProperties::setFarClipPlaneDistance ( float  farClipPlaneDistance)

Sets distance from camera (view) space origin to camera's far clip plane.

Parameters
farClipPlaneDistanceFar Z distance. Should be a positive value.

◆ setFov()

void ne::CameraProperties::setFov ( unsigned int  iVerticalFov)

Sets camera's vertical field of view.

Parameters
iVerticalFovVertical field of view.

◆ setNearClipPlaneDistance()

void ne::CameraProperties::setNearClipPlaneDistance ( float  nearClipPlaneDistance)

Sets distance from camera (view) space origin to camera's near clip plane.

Parameters
nearClipPlaneDistanceNear Z distance. Should be a positive value.

◆ setRenderTargetSize()

void ne::CameraProperties::setRenderTargetSize ( unsigned int  iRenderTargetWidth,
unsigned int  iRenderTargetHeight 
)
private

Sets size of the render target for projection matrix calculations.

Remarks
Does nothing if the specified size is the same as the previous one.
Called by the renderer to set render target size.
Parameters
iRenderTargetWidthWidth of the buffer we are rendering the image to.
iRenderTargetHeightHeight of the buffer we are rendering the image to.

Member Data Documentation

◆ floatDelta

constexpr float ne::CameraProperties::floatDelta = 0.00001F
inlinestaticconstexprprivate

Delta to compare input to zero.

◆ mtxData

std::pair<std::recursive_mutex, Data> ne::CameraProperties::mtxData {}
private

Internal properties.


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