Skip to main content

PerspectiveCameraComponent Class Template

Component that stores perspective camera projection parameters. More...

Declaration

template <typename THandle> class helios::engine::scene::components::PerspectiveCameraComponent<THandle> { ... }

Public Constructors Index

template <typename THandle>
PerspectiveCameraComponent (const float fovY, const float aspectRatio, const float zNear=0.1f, const float zFar=1000.0f)

Public Member Functions Index

template <typename THandle>
voidsetPerspective (const float fovY, const float aspectRatio, const float zNear, const float zFar) noexcept

Sets the perspective projection parameters. More...

template <typename THandle>
voidsetZNear (const float zNear) noexcept

Sets the near clipping plane distance. More...

template <typename THandle>
voidsetZFar (const float zFar) noexcept

Sets the far clipping plane distance. More...

template <typename THandle>
voidsetFovY (const float fovY) noexcept

Sets the vertical field of view. More...

template <typename THandle>
voidsetAspectRatio (const float aspectRatio) noexcept

Sets the aspect ratio used by the camera. More...

template <typename THandle>
floatfovY () const noexcept

Gets the current vertical field of view. More...

template <typename THandle>
floataspectRatio () const noexcept

Gets the current aspect ratio. More...

template <typename THandle>
floatzNear () const noexcept

Gets the current near clipping plane distance. More...

template <typename THandle>
floatzFar () const noexcept

Gets the current far clipping plane distance. More...

template <typename THandle>
boolisDirty () const noexcept

Returns whether the component requires projection recomputation. More...

template <typename THandle>
voidclearDirty () noexcept

Clears the dirty flag after dependent systems consumed updates. More...

Private Member Attributes Index

template <typename THandle>
floataspectRatio_ = 1.0f

The aspect ratio of the camera (width/height). More...

template <typename THandle>
floatzNear_ = 0.1f

The near clipping plane distance. More...

template <typename THandle>
floatzFar_ = 1000.0f

The far clipping plane distance. More...

template <typename THandle>
floatfovY_ = radians(90)

The vertical field of view in radians. More...

template <typename THandle>
boolisDirty_ = true

Dirty flag used to signal projection updates. More...

Description

Component that stores perspective camera projection parameters.

Template Parameters
THandle

Owning entity handle type.

Definition at line 23 of file PerspectiveCameraComponent.ixx.

Public Constructors

PerspectiveCameraComponent()

Public Member Functions

aspectRatio()

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::aspectRatio ()
inline noexcept

clearDirty()

template <typename THandle>
void helios::engine::scene::components::PerspectiveCameraComponent< THandle >::clearDirty ()
inline noexcept

Clears the dirty flag after dependent systems consumed updates.

Definition at line 173 of file PerspectiveCameraComponent.ixx.

174 isDirty_ = false;
175 }

fovY()

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::fovY ()
inline noexcept

isDirty()

template <typename THandle>
bool helios::engine::scene::components::PerspectiveCameraComponent< THandle >::isDirty ()
inline noexcept

Returns whether the component requires projection recomputation.

Returns

true when values were changed and not yet consumed.

Definition at line 166 of file PerspectiveCameraComponent.ixx.

167 return isDirty_;
168 }

setAspectRatio()

template <typename THandle>
void helios::engine::scene::components::PerspectiveCameraComponent< THandle >::setAspectRatio (const float aspectRatio)
inline noexcept

Sets the aspect ratio used by the camera.

Parameters
aspectRatio

The new aspect ratio (width/height).

Definition at line 120 of file PerspectiveCameraComponent.ixx.

120 void setAspectRatio(const float aspectRatio) noexcept {
121 aspectRatio_ = aspectRatio;
122 }

Reference helios::engine::scene::components::PerspectiveCameraComponent< THandle >::aspectRatio.

setFovY()

template <typename THandle>
void helios::engine::scene::components::PerspectiveCameraComponent< THandle >::setFovY (const float fovY)
inline noexcept

Sets the vertical field of view.

Parameters
fovY

The new vertical field of view in radians.

Definition at line 110 of file PerspectiveCameraComponent.ixx.

110 void setFovY(const float fovY) noexcept {
111 fovY_ = fovY;
112 isDirty_ = true;
113 }

Reference helios::engine::scene::components::PerspectiveCameraComponent< THandle >::fovY.

setPerspective()

template <typename THandle>
void helios::engine::scene::components::PerspectiveCameraComponent< THandle >::setPerspective (const float fovY, const float aspectRatio, const float zNear, const float zFar)
inline noexcept

Sets the perspective projection parameters.

Parameters
fovY

The vertical field of view in radians.

aspectRatio

The aspect ratio (width/height).

zNear

The near clipping plane distance.

zFar

The far clipping plane distance.

Definition at line 72 of file PerspectiveCameraComponent.ixx.

72 void setPerspective(const float fovY, const float aspectRatio, const float zNear, const float zFar) noexcept {
73 assert(zNear > 0 && "zNear must be positive");
74 assert(zFar > 0 && zFar > zNear && "zFar must be positive and greater than zNear");
75 fovY_ = fovY;
76 aspectRatio_ = aspectRatio;
77 zNear_ = zNear;
78 zFar_ = zFar;
79 isDirty_ = true;
80 }

References helios::engine::scene::components::PerspectiveCameraComponent< THandle >::aspectRatio, helios::engine::scene::components::PerspectiveCameraComponent< THandle >::fovY, helios::engine::scene::registerComponents, helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zFar and helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zNear.

Referenced by helios::engine::scene::components::PerspectiveCameraComponent< THandle >::PerspectiveCameraComponent.

setZFar()

template <typename THandle>
void helios::engine::scene::components::PerspectiveCameraComponent< THandle >::setZFar (const float zFar)
inline noexcept

Sets the far clipping plane distance.

Parameters
zFar

The new far clipping plane distance.

Definition at line 99 of file PerspectiveCameraComponent.ixx.

99 void setZFar(const float zFar) noexcept {
100 assert(zFar > 0 && "zFar must be positive and greater than zNear");
101 zFar_ = zFar;
102 isDirty_ = true;
103 }

References helios::engine::scene::registerComponents and helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zFar.

setZNear()

template <typename THandle>
void helios::engine::scene::components::PerspectiveCameraComponent< THandle >::setZNear (const float zNear)
inline noexcept

Sets the near clipping plane distance.

Parameters
zNear

The new near clipping plane distance.

Definition at line 87 of file PerspectiveCameraComponent.ixx.

87 void setZNear(const float zNear) noexcept {
88 assert(zNear > 0 && "zNear must be positive");
89 zNear_ = zNear;
90
91 isDirty_ = true;
92 }

References helios::engine::scene::registerComponents and helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zNear.

zFar()

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zFar ()
inline noexcept

zNear()

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zNear ()
inline noexcept

Private Member Attributes

aspectRatio_

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::aspectRatio_ = 1.0f

The aspect ratio of the camera (width/height).

Defaults to 1.0.

Definition at line 30 of file PerspectiveCameraComponent.ixx.

30 float aspectRatio_ = 1.0f;

fovY_

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::fovY_ = radians(90)

The vertical field of view in radians.

Defaults to 90 degrees (converted to radians).

Definition at line 51 of file PerspectiveCameraComponent.ixx.

51 float fovY_ = radians(90);

isDirty_

template <typename THandle>
bool helios::engine::scene::components::PerspectiveCameraComponent< THandle >::isDirty_ = true

Dirty flag used to signal projection updates.

Definition at line 56 of file PerspectiveCameraComponent.ixx.

56 bool isDirty_ = true;

zFar_

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zFar_ = 1000.0f

The far clipping plane distance.

Defaults to 1000.0.

Definition at line 44 of file PerspectiveCameraComponent.ixx.

44 float zFar_ = 1000.0f;

zNear_

template <typename THandle>
float helios::engine::scene::components::PerspectiveCameraComponent< THandle >::zNear_ = 0.1f

The near clipping plane distance.

Defaults to 0.1.

Definition at line 37 of file PerspectiveCameraComponent.ixx.

37 float zNear_ = 0.1f;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.