Tatooine
Public Types | Public Member Functions | List of all members
tatooine::rendering::perspective_camera< Real > Struct Template Reference

Perspective cameras are able to cast rays from one point called 'eye' through an image plane. More...

#include <perspective_camera.h>

Inheritance diagram for tatooine::rendering::perspective_camera< Real >:
[legend]
Collaboration diagram for tatooine::rendering::perspective_camera< Real >:
[legend]

Public Types

using real_type = Real
 
using this_type = perspective_camera< Real >
 
using parent_type = camera_interface< Real >
 
using mat4 = Mat4< Real >
 
using vec3 = Vec3< Real >
 
- Public Types inherited from tatooine::rendering::camera_interface< Real >
using real_type = Real
 
using this_type = camera_interface< Real >
 
using vec2 = Vec2< Real >
 
using vec3 = Vec3< Real >
 
using vec4 = Vec4< Real >
 
using mat4 = Mat4< Real >
 
using ray_type = tatooine::ray< real_type, 3 >
 

Public Member Functions

constexpr perspective_camera (vec3 const &eye, vec3 const &lookat, vec3 const &up, Real const fov, Real const near, Real const far, std::size_t const res_x, std::size_t const res_y)
 
constexpr perspective_camera (vec3 const &eye, vec3 const &lookat, Real fov, Real const near, Real const far, std::size_t const res_x, std::size_t const res_y)
 
constexpr perspective_camera (vec3 const &eye, vec3 const &lookat, Real fov, std::size_t const res_x, std::size_t const res_y)
 
template<typename EyeReal , typename LookatReal , typename UpReal , typename FovReal >
constexpr perspective_camera (vec< EyeReal, 3 > const &eye, vec< LookatReal, 3 > const &lookat, vec< UpReal, 3 > const &up, FovReal const fov, std::size_t const res_x, std::size_t const res_y)
 
 perspective_camera (perspective_camera const &)=default
 
 perspective_camera (perspective_camera &&) noexcept=default
 
auto operator= (perspective_camera const &) -> perspective_camera &=default
 
auto operator= (perspective_camera &&) noexcept -> perspective_camera &=default
 
 ~perspective_camera ()=default
 
auto constexpr set_projection_matrix (Real const fov, Real const near, Real const far) -> void
 
auto constexpr aspect_ratio () const
 
auto constexpr eye () const -> auto
 
auto set_projection_matrix (mat4 const &projection_matrix) -> void
 
- Public Member Functions inherited from tatooine::rendering::camera_interface< Real >
constexpr camera_interface (vec3 const &eye, vec3 const &lookat, vec3 const &up, Vec4< std::size_t > const &viewport)
 
constexpr camera_interface (vec3 const &eye, vec3 const &lookat, vec3 const &up, Vec4< std::size_t > const &viewport, mat4 const &p)
 
virtual ~camera_interface ()=default
 
auto constexpr viewport () const -> auto const &
 Returns number of pixels of plane in x-direction. More...
 
auto constexpr viewport (std::size_t const i) const -> auto const &
 
auto constexpr plane_width () const
 Returns number of pixels of plane in x-direction. More...
 
auto constexpr plane_height () const
 Returns number of pixels of plane in y-direction. More...
 
auto constexpr aspect_ratio () const
 
auto constexpr eye () const -> auto
 
auto constexpr right_direction () const
 
auto constexpr up_direction () const
 
auto constexpr view_direction () const
 
auto constexpr set_viewport_without_update (std::size_t const bottom, std::size_t const left, std::size_t const width, std::size_t const height)
 
auto constexpr set_viewport (std::size_t const bottom, std::size_t const left, std::size_t const width, std::size_t const height)
 
auto constexpr set_resolution_without_update (std::size_t const width, std::size_t const height)
 
auto constexpr set_resolution (std::size_t const width, std::size_t const height)
 
auto set_gl_viewport () const
 
auto constexpr look_at (vec3 const &eye, vec3 const &lookat, vec3 const &up={0, 1, 0}) -> void
 
auto constexpr look_at (vec3 const &eye, arithmetic auto const pitch, arithmetic auto const yaw) -> void
 
auto constexpr transform_matrix () const -> auto const &
 
auto constexpr view_matrix () const
 
auto constexpr projection_matrix () const -> auto const &
 
auto view_projection_matrix () const
 
auto unproject (vec2 const &p) const
 Projects a screen coordinates to world coordinates. More...
 
auto unproject (vec3 const &p) const
 Projects a screen coordinates to world coordinates. More...
 
auto unproject (vec4 p) const
 Projects a homogeneous screen coordinates to world coordinates. More...
 
auto project (vec2 const &p) const
 Projects a world coordinate to screen coordinates. More...
 
auto project (vec3 const &p) const
 Projects a world coordinate to screen coordinates. More...
 
auto project (vec4 p) const
 Projects a homogeneous world coordinate to screen coordinates. More...
 
auto ray (Real const x, Real const y) const -> ray_type
 Gets a ray through plane at pixel with coordinate [x,y]. More...
 

Additional Inherited Members

- Protected Member Functions inherited from tatooine::rendering::camera_interface< Real >
auto set_projection_matrix (mat4 const &projection_matrix) -> void
 

Detailed Description

template<floating_point Real>
struct tatooine::rendering::perspective_camera< Real >

Perspective cameras are able to cast rays from one point called 'eye' through an image plane.

Based on the eye position, a look-at point and a field of view angle the image plane gets constructed. This camera class constructs a right-handed coordinate system.

Member Typedef Documentation

◆ mat4

template<floating_point Real>
using tatooine::rendering::camera_interface< Real >::mat4 = Mat4<Real>

◆ parent_type

template<floating_point Real>
using tatooine::rendering::perspective_camera< Real >::parent_type = camera_interface<Real>

◆ real_type

template<floating_point Real>
using tatooine::rendering::perspective_camera< Real >::real_type = Real

◆ this_type

template<floating_point Real>
using tatooine::rendering::perspective_camera< Real >::this_type = perspective_camera<Real>

◆ vec3

template<floating_point Real>
using tatooine::rendering::camera_interface< Real >::vec3 = Vec3<Real>

Constructor & Destructor Documentation

◆ perspective_camera() [1/6]

template<floating_point Real>
constexpr tatooine::rendering::perspective_camera< Real >::perspective_camera ( vec3 const &  eye,
vec3 const &  lookat,
vec3 const &  up,
Real const  fov,
Real const  near,
Real const  far,
std::size_t const  res_x,
std::size_t const  res_y 
)
inlineconstexpr

Constructor generates bottom left image plane pixel position and pixel offset size.

◆ perspective_camera() [2/6]

template<floating_point Real>
constexpr tatooine::rendering::perspective_camera< Real >::perspective_camera ( vec3 const &  eye,
vec3 const &  lookat,
Real  fov,
Real const  near,
Real const  far,
std::size_t const  res_x,
std::size_t const  res_y 
)
inlineconstexpr

Constructor generates bottom left image plane pixel position and pixel offset size.

◆ perspective_camera() [3/6]

template<floating_point Real>
constexpr tatooine::rendering::perspective_camera< Real >::perspective_camera ( vec3 const &  eye,
vec3 const &  lookat,
Real  fov,
std::size_t const  res_x,
std::size_t const  res_y 
)
inlineconstexpr

Constructor generates bottom left image plane pixel position and pixel offset size.

◆ perspective_camera() [4/6]

template<floating_point Real>
template<typename EyeReal , typename LookatReal , typename UpReal , typename FovReal >
constexpr tatooine::rendering::perspective_camera< Real >::perspective_camera ( vec< EyeReal, 3 > const &  eye,
vec< LookatReal, 3 > const &  lookat,
vec< UpReal, 3 > const &  up,
FovReal const  fov,
std::size_t const  res_x,
std::size_t const  res_y 
)
inlineconstexpr

Constructor generates bottom left image plane pixel position and pixel offset size.

◆ perspective_camera() [5/6]

template<floating_point Real>
tatooine::rendering::perspective_camera< Real >::perspective_camera ( perspective_camera< Real > const &  )
default

◆ perspective_camera() [6/6]

template<floating_point Real>
tatooine::rendering::perspective_camera< Real >::perspective_camera ( perspective_camera< Real > &&  )
defaultnoexcept

◆ ~perspective_camera()

template<floating_point Real>
tatooine::rendering::perspective_camera< Real >::~perspective_camera ( )
default

Member Function Documentation

◆ aspect_ratio()

template<floating_point Real>
auto constexpr tatooine::rendering::camera_interface< Real >::aspect_ratio ( ) const
inlineconstexpr

◆ eye()

template<floating_point Real>
auto constexpr tatooine::rendering::camera_interface< Real >::eye ( ) const -> auto
inlineconstexpr

◆ operator=() [1/2]

template<floating_point Real>
auto tatooine::rendering::perspective_camera< Real >::operator= ( perspective_camera< Real > &&  ) -> perspective_camera &=default
defaultnoexcept

◆ operator=() [2/2]

template<floating_point Real>
auto tatooine::rendering::perspective_camera< Real >::operator= ( perspective_camera< Real > const &  ) -> perspective_camera &=default
default

◆ set_projection_matrix() [1/2]

template<floating_point Real>
auto tatooine::rendering::camera_interface< Real >::set_projection_matrix ( mat4 const &  projection_matrix) -> void
inline

◆ set_projection_matrix() [2/2]

template<floating_point Real>
auto constexpr tatooine::rendering::perspective_camera< Real >::set_projection_matrix ( Real const  fov,
Real const  near,
Real const  far 
) -> void
inlineconstexpr

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