Antkeeper  0.0.1
Public Types | Public Member Functions | List of all members
scene::camera Class Reference

#include <camera.hpp>

Inheritance diagram for scene::camera:
scene::object< camera > scene::object_base

Public Types

using view_frustum_type = geom::view_frustum< float >
 Camera view frustum type. More...
 
- Public Types inherited from scene::object_base
using vector_type = math::fvec3
 
using quaternion_type = math::fquat
 
using transform_type = math::transform< float >
 
using aabb_type = geom::box< float >
 

Public Member Functions

geom::ray< float, 3 > pick (const math::fvec2 &ndc) const
 Constructs a picking ray from normalized device coordinates (NDC). More...
 
math::fvec3 project (const math::fvec3 &object, const math::fvec4 &viewport) const
 Maps object coordinates to window coordinates. More...
 
math::fvec3 unproject (const math::fvec3 &window, const math::fvec4 &viewport) const
 Maps window coordinates to object coordinates. More...
 
void set_perspective (float vertical_fov, float aspect_ratio, float near, float far=std::numeric_limits< float >::infinity())
 Sets the camera's projection matrix using perspective projection. More...
 
void set_vertical_fov (float vertical_fov)
 Sets the camera's vertical field of view. More...
 
void set_aspect_ratio (float aspect_ratio)
 Sets the camera's aspect ratio. More...
 
void set_orthographic (float clip_left, float clip_right, float clip_bottom, float clip_top, float clip_near, float clip_far)
 Sets the camera's projection matrix using orthographic projection. More...
 
void set_exposure_value (float ev100)
 Sets the camera's ISO 100 exposure value. More...
 
void set_compositor (render::compositor *compositor) noexcept
 Sets the camera's compositor. More...
 
void set_composite_index (int index) noexcept
 Sets the composite index of the camera. More...
 
constexpr int get_composite_index () const noexcept
 Returns the composite index of the camera. More...
 
constexpr const aabb_typeget_bounds () const noexcept override
 Returns the bounds of the object. More...
 
constexpr bool is_orthographic () const noexcept
 Returns true if the camera uses an orthographic projection matrix, false otherwise. More...
 
constexpr float get_clip_left () const noexcept
 Returns the signed distance to the camera's left clipping plane. More...
 
constexpr float get_clip_right () const noexcept
 Returns the signed distance to the camera's right clipping plane. More...
 
constexpr float get_clip_bottom () const noexcept
 Returns the signed distance to the camera's bottom clipping plane. More...
 
constexpr float get_clip_top () const noexcept
 Returns the signed distance to the camera's top clipping plane. More...
 
constexpr float get_clip_near () const noexcept
 Returns the signed distance to the camera's near clipping plane. More...
 
constexpr float get_clip_far () const noexcept
 Returns the signed distance to the camera's far clipping plane. More...
 
constexpr float get_vertical_fov () const noexcept
 Returns the camera's vertical field of view, in radians. More...
 
constexpr float get_aspect_ratio () const noexcept
 Returns the camera's aspect ratio. More...
 
constexpr float get_exposure_value () const noexcept
 Returns the camera's ISO 100 exposure value. More...
 
constexpr float get_exposure_normalization () const noexcept
 Returns the camera's exposure normalization factor. More...
 
constexpr const math::fmat4get_view () const noexcept
 Returns the camera's view matrix. More...
 
constexpr const math::fmat4get_inv_view () const noexcept
 Returns the inverse of the camera's view matrix. More...
 
constexpr const math::fmat4get_projection () const noexcept
 Returns the camera's projection matrix. More...
 
constexpr const math::fmat4get_inv_projection () const noexcept
 Returns the inverse of the camera's projection matrix. More...
 
constexpr const math::fmat4get_view_projection () const noexcept
 Returns the camera's view-projection matrix. More...
 
constexpr const math::fmat4get_inv_view_projection () const noexcept
 Returns the inverse of the camera's view-projection matrix. More...
 
constexpr const math::fvec3get_forward () const noexcept
 Returns the camera's forward vector. More...
 
constexpr const math::fvec3get_up () const noexcept
 Returns the camera's up vector. More...
 
constexpr const view_frustum_typeget_view_frustum () const noexcept
 Returns the camera's view frustum. More...
 
constexpr const render::compositorget_compositor () const noexcept
 Returns the camera's compositor. More...
 
constexpr render::compositorget_compositor () noexcept
 Returns the camera's compositor. More...
 
- Public Member Functions inherited from scene::object< camera >
const std::size_t get_object_type_id () const noexcept final
 Returns the type ID for this scene object type. More...
 
- Public Member Functions inherited from scene::object_base
virtual void render (render::context &ctx) const
 Adds render operations to a render context. More...
 
void look_at (const vector_type &position, const vector_type &target, const vector_type &up)
 
constexpr void set_layer_mask (std::uint32_t mask) noexcept
 Sets the layer mask of the object. More...
 
void set_transform (const transform_type &transform)
 Sets the transform of the object. More...
 
void set_translation (const vector_type &translation)
 Sets the translation of the object. More...
 
void set_rotation (const quaternion_type &rotation)
 Sets the rotation of the object. More...
 
constexpr std::uint32_t get_layer_mask () const noexcept
 Returns the layer mask of the object. More...
 
constexpr const transform_typeget_transform () const noexcept
 Returns the transform of the object. More...
 
constexpr const vector_typeget_translation () const noexcept
 Returns the translation of the object. More...
 
constexpr const quaternion_typeget_rotation () const noexcept
 Returns the rotation of the object. More...
 
constexpr const vector_typeget_scale () const noexcept
 Returns the scale of the object. More...
 
void set_scale (const vector_type &scale)
 Sets the scale of the object. More...
 
void set_scale (float scale)
 Sets the scale of the object. More...
 

Additional Inherited Members

- Static Public Attributes inherited from scene::object< camera >
static const std::atomic< std::size_t > object_type_id
 Unique type ID for this scene object type. More...
 
- Static Protected Member Functions inherited from scene::object_base
static std::size_t next_object_type_id ()
 
- Protected Attributes inherited from scene::object_base
std::uint32_t m_layer_mask {1}
 
transform_type m_transform {transform_type::identity()}
 

Detailed Description

Definition at line 35 of file camera.hpp.

Member Typedef Documentation

◆ view_frustum_type

Camera view frustum type.

Definition at line 39 of file camera.hpp.

Member Function Documentation

◆ get_aspect_ratio()

constexpr float scene::camera::get_aspect_ratio ( ) const
inlineconstexprnoexcept

Returns the camera's aspect ratio.

Definition at line 205 of file camera.hpp.

◆ get_bounds()

constexpr const aabb_type& scene::camera::get_bounds ( ) const
inlineconstexproverridevirtualnoexcept

Returns the bounds of the object.

Implements scene::object_base.

Definition at line 151 of file camera.hpp.

◆ get_clip_bottom()

constexpr float scene::camera::get_clip_bottom ( ) const
inlineconstexprnoexcept

Returns the signed distance to the camera's bottom clipping plane.

Definition at line 175 of file camera.hpp.

◆ get_clip_far()

constexpr float scene::camera::get_clip_far ( ) const
inlineconstexprnoexcept

Returns the signed distance to the camera's far clipping plane.

Definition at line 193 of file camera.hpp.

◆ get_clip_left()

constexpr float scene::camera::get_clip_left ( ) const
inlineconstexprnoexcept

Returns the signed distance to the camera's left clipping plane.

Definition at line 163 of file camera.hpp.

◆ get_clip_near()

constexpr float scene::camera::get_clip_near ( ) const
inlineconstexprnoexcept

Returns the signed distance to the camera's near clipping plane.

Definition at line 187 of file camera.hpp.

◆ get_clip_right()

constexpr float scene::camera::get_clip_right ( ) const
inlineconstexprnoexcept

Returns the signed distance to the camera's right clipping plane.

Definition at line 169 of file camera.hpp.

◆ get_clip_top()

constexpr float scene::camera::get_clip_top ( ) const
inlineconstexprnoexcept

Returns the signed distance to the camera's top clipping plane.

Definition at line 181 of file camera.hpp.

◆ get_composite_index()

constexpr int scene::camera::get_composite_index ( ) const
inlineconstexprnoexcept

Returns the composite index of the camera.

Definition at line 146 of file camera.hpp.

◆ get_compositor() [1/2]

constexpr const render::compositor* scene::camera::get_compositor ( ) const
inlineconstexprnoexcept

Returns the camera's compositor.

Definition at line 135 of file camera.hpp.

◆ get_compositor() [2/2]

constexpr render::compositor* scene::camera::get_compositor ( )
inlineconstexprnoexcept

Returns the camera's compositor.

Definition at line 139 of file camera.hpp.

◆ get_exposure_normalization()

constexpr float scene::camera::get_exposure_normalization ( ) const
inlineconstexprnoexcept

Returns the camera's exposure normalization factor.

Definition at line 217 of file camera.hpp.

◆ get_exposure_value()

constexpr float scene::camera::get_exposure_value ( ) const
inlineconstexprnoexcept

Returns the camera's ISO 100 exposure value.

Definition at line 211 of file camera.hpp.

◆ get_forward()

constexpr const math::fvec3& scene::camera::get_forward ( ) const
inlineconstexprnoexcept

Returns the camera's forward vector.

Definition at line 259 of file camera.hpp.

◆ get_inv_projection()

constexpr const math::fmat4& scene::camera::get_inv_projection ( ) const
inlineconstexprnoexcept

Returns the inverse of the camera's projection matrix.

Definition at line 241 of file camera.hpp.

◆ get_inv_view()

constexpr const math::fmat4& scene::camera::get_inv_view ( ) const
inlineconstexprnoexcept

Returns the inverse of the camera's view matrix.

Definition at line 229 of file camera.hpp.

◆ get_inv_view_projection()

constexpr const math::fmat4& scene::camera::get_inv_view_projection ( ) const
inlineconstexprnoexcept

Returns the inverse of the camera's view-projection matrix.

Definition at line 253 of file camera.hpp.

◆ get_projection()

constexpr const math::fmat4& scene::camera::get_projection ( ) const
inlineconstexprnoexcept

Returns the camera's projection matrix.

Definition at line 235 of file camera.hpp.

◆ get_up()

constexpr const math::fvec3& scene::camera::get_up ( ) const
inlineconstexprnoexcept

Returns the camera's up vector.

Definition at line 265 of file camera.hpp.

◆ get_vertical_fov()

constexpr float scene::camera::get_vertical_fov ( ) const
inlineconstexprnoexcept

Returns the camera's vertical field of view, in radians.

Definition at line 199 of file camera.hpp.

◆ get_view()

constexpr const math::fmat4& scene::camera::get_view ( ) const
inlineconstexprnoexcept

Returns the camera's view matrix.

Definition at line 223 of file camera.hpp.

◆ get_view_frustum()

constexpr const view_frustum_type& scene::camera::get_view_frustum ( ) const
inlineconstexprnoexcept

Returns the camera's view frustum.

Definition at line 271 of file camera.hpp.

◆ get_view_projection()

constexpr const math::fmat4& scene::camera::get_view_projection ( ) const
inlineconstexprnoexcept

Returns the camera's view-projection matrix.

Definition at line 247 of file camera.hpp.

◆ is_orthographic()

constexpr bool scene::camera::is_orthographic ( ) const
inlineconstexprnoexcept

Returns true if the camera uses an orthographic projection matrix, false otherwise.

Definition at line 157 of file camera.hpp.

◆ pick()

geom::ray< float, 3 > scene::camera::pick ( const math::fvec2 ndc) const

Constructs a picking ray from normalized device coordinates (NDC).

Parameters
ndcNDC coordinates.
Returns
Picking ray.

Definition at line 26 of file camera.cpp.

◆ project()

math::fvec3 scene::camera::project ( const math::fvec3 object,
const math::fvec4 viewport 
) const

Maps object coordinates to window coordinates.

Parameters
objectObject coordinates.
viewportVector containing the x, y, w, and h of the viewport.
Returns
Projected window coordinates.

Definition at line 35 of file camera.cpp.

◆ set_aspect_ratio()

void scene::camera::set_aspect_ratio ( float  aspect_ratio)

Sets the camera's aspect ratio.

Parameters
aspect_ratioAspect ratio.

Definition at line 98 of file camera.cpp.

◆ set_composite_index()

void scene::camera::set_composite_index ( int  index)
inlinenoexcept

Sets the composite index of the camera.

Parameters
indexComposite index.

Definition at line 126 of file camera.hpp.

◆ set_compositor()

void scene::camera::set_compositor ( render::compositor compositor)
inlinenoexcept

Sets the camera's compositor.

Parameters
compositorCompositor.

Definition at line 116 of file camera.hpp.

◆ set_exposure_value()

void scene::camera::set_exposure_value ( float  ev100)

Sets the camera's ISO 100 exposure value.

Parameters
ev100ISO 100 exposure value.

Definition at line 130 of file camera.cpp.

◆ set_orthographic()

void scene::camera::set_orthographic ( float  clip_left,
float  clip_right,
float  clip_bottom,
float  clip_top,
float  clip_near,
float  clip_far 
)

Sets the camera's projection matrix using orthographic projection.

Parameters
clip_leftSigned distance to left clipping plane.
clip_rightSigned distance to right clipping plane.
clip_bottomSigned distance to bottom clipping plane.
clip_topSigned distance to top clipping plane.
clip_nearSigned distance to near clipping plane.
clip_farSigned distance to far clipping plane.

Definition at line 106 of file camera.cpp.

◆ set_perspective()

void scene::camera::set_perspective ( float  vertical_fov,
float  aspect_ratio,
float  near,
float  far = std::numeric_limits<float>::infinity() 
)

Sets the camera's projection matrix using perspective projection.

Parameters
vertical_fovVertical field of view, in radians.
aspect_ratioAspect ratio.
nearDistance to near clipping plane.
farDistance to far clipping plane.

Definition at line 61 of file camera.cpp.

◆ set_vertical_fov()

void scene::camera::set_vertical_fov ( float  vertical_fov)

Sets the camera's vertical field of view.

Parameters
vertical_fovVertical field of view, in radians.

Definition at line 90 of file camera.cpp.

◆ unproject()

math::fvec3 scene::camera::unproject ( const math::fvec3 window,
const math::fvec4 viewport 
) const

Maps window coordinates to object coordinates.

Parameters
windowWindow coordinates.
viewportVector containing the x, y, w, and h of the viewport.
Returns
Unprojected object coordinates.

Definition at line 46 of file camera.cpp.


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