GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::graphics::Camera3D Class Reference

Combined view-projection matrix, defining a 3D perspective to render from. More...

#include <GREM/graphics_3d/Camera3D.hpp>

Classes

struct  Parameters
 Struct of shader parameters representing the state of a Camera3D. More...

Public Types

using ParameterBuffer = UniformBuffer<Parameters, "Camera3DParameters">
 Shader buffer for 3D camera parameters.

Public Member Functions

 Camera3D (Device &device, const Projection3D &projection=mat4{1.0f}, const View3D &view=mat4{1.0f}, const Camera3DOptions &options={})
 Construct a camera.
void setProjection (const Projection3D &newProjection)
 Set the projection of the camera.
void setView (const View3D &newView)
 Set the view of the camera.
void setOptions (const Camera3DOptions &newOptions)
 Set the configuration options of the camera.
void setProjectionAndView (const Projection3D &newProjection, const View3D &newView)
 Set both the projection and view of the camera.
void setViewAndOptions (const View3D &newView, const Camera3DOptions &newOptions)
 Set both the view and configuration options of the camera.
void setProjectionAndViewAndOptions (const Projection3D &newProjection, const View3D &newView, const Camera3DOptions &newOptions)
 Set both the projection and view of the camera, as well as its configuration options.
const ParameterBuffer & getParameterBuffer () const noexcept
 Get the parameter buffer of the camera.
const mat4 & getProjectionMatrix () const noexcept
 Get the projection matrix of the camera.
const mat4 & getViewMatrix () const noexcept
 Get the view matrix of the camera.
Camera3DOptions getOptions () const noexcept
 Get the configuration options of the camera.

Detailed Description

Combined view-projection matrix, defining a 3D perspective to render from.

Member Typedef Documentation

◆ ParameterBuffer

Shader buffer for 3D camera parameters.

Constructor & Destructor Documentation

◆ Camera3D()

grem::graphics::Camera3D::Camera3D ( Device & device,
const Projection3D & projection = mat4{1.0f},
const View3D & view = mat4{1.0f},
const Camera3DOptions & options = {} )
inlineexplicit

Construct a camera.

Parameters
devicedevice to create the camera for. Must outlive the camera.
projectionprojection matrix or configuration options for the camera projection, see Projection3D.
viewview matrix or configuration options for the camera view, see View3D.
optionscamera options, see Camera3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

Member Function Documentation

◆ setProjection()

void grem::graphics::Camera3D::setProjection ( const Projection3D & newProjection)
inline

Set the projection of the camera.

Parameters
newProjectionnew projection matrix or configuration options for the camera projection, see Projection3D.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ setView()

void grem::graphics::Camera3D::setView ( const View3D & newView)
inline

Set the view of the camera.

Parameters
newViewnew view matrix or configuration options for the camera view, see View3D.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ setOptions()

void grem::graphics::Camera3D::setOptions ( const Camera3DOptions & newOptions)
inline

Set the configuration options of the camera.

Parameters
newOptionsnew configuration options, see Camera3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ setProjectionAndView()

void grem::graphics::Camera3D::setProjectionAndView ( const Projection3D & newProjection,
const View3D & newView )
inline

Set both the projection and view of the camera.

Parameters
newProjectionnew projection matrix or configuration options for the camera projection, see Projection3D.
newViewnew view matrix or configuration options for the camera view, see View3D.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ setViewAndOptions()

void grem::graphics::Camera3D::setViewAndOptions ( const View3D & newView,
const Camera3DOptions & newOptions )
inline

Set both the view and configuration options of the camera.

Parameters
newViewnew view matrix or configuration options for the camera view, see View3D.
newOptionsnew configuration options, see Camera3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ setProjectionAndViewAndOptions()

void grem::graphics::Camera3D::setProjectionAndViewAndOptions ( const Projection3D & newProjection,
const View3D & newView,
const Camera3DOptions & newOptions )
inline

Set both the projection and view of the camera, as well as its configuration options.

Parameters
newProjectionnew projection matrix or configuration options for the camera projection, see Projection3D.
newViewnew view matrix or configuration options for the camera view, see View3D.
newOptionsnew configuration options, see Camera3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ getParameterBuffer()

const ParameterBuffer & grem::graphics::Camera3D::getParameterBuffer ( ) const
inlinenodiscardnoexcept

Get the parameter buffer of the camera.

Returns
a read-only reference to the camera's parameter buffer.

◆ getProjectionMatrix()

const mat4 & grem::graphics::Camera3D::getProjectionMatrix ( ) const
inlinenodiscardnoexcept

Get the projection matrix of the camera.

Returns
a read-only reference to the camera's current projection matrix.

◆ getViewMatrix()

const mat4 & grem::graphics::Camera3D::getViewMatrix ( ) const
inlinenodiscardnoexcept

Get the view matrix of the camera.

Returns
a read-only reference to the camera's current view matrix.

◆ getOptions()

Camera3DOptions grem::graphics::Camera3D::getOptions ( ) const
inlinenodiscardnoexcept

Get the configuration options of the camera.

Returns
the camera's current options.

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