Antkeeper
0.0.1
|
#include <camera.hpp>
Public Types | |
using | view_frustum_type = geom::view_frustum< float > |
Camera view frustum type. More... | |
![]() | |
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_type & | get_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::fmat4 & | get_view () const noexcept |
Returns the camera's view matrix. More... | |
constexpr const math::fmat4 & | get_inv_view () const noexcept |
Returns the inverse of the camera's view matrix. More... | |
constexpr const math::fmat4 & | get_projection () const noexcept |
Returns the camera's projection matrix. More... | |
constexpr const math::fmat4 & | get_inv_projection () const noexcept |
Returns the inverse of the camera's projection matrix. More... | |
constexpr const math::fmat4 & | get_view_projection () const noexcept |
Returns the camera's view-projection matrix. More... | |
constexpr const math::fmat4 & | get_inv_view_projection () const noexcept |
Returns the inverse of the camera's view-projection matrix. More... | |
constexpr const math::fvec3 & | get_forward () const noexcept |
Returns the camera's forward vector. More... | |
constexpr const math::fvec3 & | get_up () const noexcept |
Returns the camera's up vector. More... | |
constexpr const view_frustum_type & | get_view_frustum () const noexcept |
Returns the camera's view frustum. More... | |
constexpr const render::compositor * | get_compositor () const noexcept |
Returns the camera's compositor. More... | |
constexpr render::compositor * | get_compositor () noexcept |
Returns the camera's compositor. More... | |
![]() | |
const std::size_t | get_object_type_id () const noexcept final |
Returns the type ID for this scene object type. More... | |
![]() | |
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_type & | get_transform () const noexcept |
Returns the transform of the object. More... | |
constexpr const vector_type & | get_translation () const noexcept |
Returns the translation of the object. More... | |
constexpr const quaternion_type & | get_rotation () const noexcept |
Returns the rotation of the object. More... | |
constexpr const vector_type & | get_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 const std::atomic< std::size_t > | object_type_id |
Unique type ID for this scene object type. More... | |
![]() | |
static std::size_t | next_object_type_id () |
![]() | |
std::uint32_t | m_layer_mask {1} |
transform_type | m_transform {transform_type::identity()} |
Definition at line 35 of file camera.hpp.
using scene::camera::view_frustum_type = geom::view_frustum<float> |
Camera view frustum type.
Definition at line 39 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's aspect ratio.
Definition at line 205 of file camera.hpp.
|
inlineconstexproverridevirtualnoexcept |
Returns the bounds of the object.
Implements scene::object_base.
Definition at line 151 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the signed distance to the camera's bottom clipping plane.
Definition at line 175 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the signed distance to the camera's far clipping plane.
Definition at line 193 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the signed distance to the camera's left clipping plane.
Definition at line 163 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the signed distance to the camera's near clipping plane.
Definition at line 187 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the signed distance to the camera's right clipping plane.
Definition at line 169 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the signed distance to the camera's top clipping plane.
Definition at line 181 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the composite index of the camera.
Definition at line 146 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's compositor.
Definition at line 135 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's compositor.
Definition at line 139 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's exposure normalization factor.
Definition at line 217 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's ISO 100 exposure value.
Definition at line 211 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's forward vector.
Definition at line 259 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the inverse of the camera's projection matrix.
Definition at line 241 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the inverse of the camera's view matrix.
Definition at line 229 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the inverse of the camera's view-projection matrix.
Definition at line 253 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's projection matrix.
Definition at line 235 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's up vector.
Definition at line 265 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's vertical field of view, in radians.
Definition at line 199 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's view matrix.
Definition at line 223 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's view frustum.
Definition at line 271 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns the camera's view-projection matrix.
Definition at line 247 of file camera.hpp.
|
inlineconstexprnoexcept |
Returns true
if the camera uses an orthographic projection matrix, false
otherwise.
Definition at line 157 of file camera.hpp.
geom::ray< float, 3 > scene::camera::pick | ( | const math::fvec2 & | ndc | ) | const |
Constructs a picking ray from normalized device coordinates (NDC).
ndc | NDC coordinates. |
Definition at line 26 of file camera.cpp.
math::fvec3 scene::camera::project | ( | const math::fvec3 & | object, |
const math::fvec4 & | viewport | ||
) | const |
Maps object coordinates to window coordinates.
object | Object coordinates. |
viewport | Vector containing the x , y , w , and h of the viewport. |
Definition at line 35 of file camera.cpp.
void scene::camera::set_aspect_ratio | ( | float | aspect_ratio | ) |
Sets the camera's aspect ratio.
aspect_ratio | Aspect ratio. |
Definition at line 98 of file camera.cpp.
|
inlinenoexcept |
Sets the composite index of the camera.
index | Composite index. |
Definition at line 126 of file camera.hpp.
|
inlinenoexcept |
Sets the camera's compositor.
compositor | Compositor. |
Definition at line 116 of file camera.hpp.
void scene::camera::set_exposure_value | ( | float | ev100 | ) |
Sets the camera's ISO 100 exposure value.
ev100 | ISO 100 exposure value. |
Definition at line 130 of file camera.cpp.
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.
clip_left | Signed distance to left clipping plane. |
clip_right | Signed distance to right clipping plane. |
clip_bottom | Signed distance to bottom clipping plane. |
clip_top | Signed distance to top clipping plane. |
clip_near | Signed distance to near clipping plane. |
clip_far | Signed distance to far clipping plane. |
Definition at line 106 of file camera.cpp.
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.
vertical_fov | Vertical field of view, in radians. |
aspect_ratio | Aspect ratio. |
near | Distance to near clipping plane. |
far | Distance to far clipping plane. |
Definition at line 61 of file camera.cpp.
void scene::camera::set_vertical_fov | ( | float | vertical_fov | ) |
Sets the camera's vertical field of view.
vertical_fov | Vertical field of view, in radians. |
Definition at line 90 of file camera.cpp.
math::fvec3 scene::camera::unproject | ( | const math::fvec3 & | window, |
const math::fvec4 & | viewport | ||
) | const |
Maps window coordinates to object coordinates.
window | Window coordinates. |
viewport | Vector containing the x , y , w , and h of the viewport. |
Definition at line 46 of file camera.cpp.