2#include <engine/engine_export.h>
248 std::uint32_t currentSubpixelIndex,
249 std::uint32_t temporalAASamples);
303 auto viewport_to_ray(
const math::vec2&
point, math::vec3& vec_ray_start, math::vec3& vec_ray_dir)
const -> bool;
327 const math::vec3& axis_origin,
328 math::vec3& position_out,
329 math::vec3& major_axis_out)
const -> bool;
342 const math::vec3& axis_origin,
343 const math::vec3& align_normal,
344 math::vec3& position_out,
345 math::vec3& major_axis_out)
const -> bool;
407 const math::vec3& reference_position,
416 void look_at(
const math::vec3& eye,
const math::vec3& at);
425 void look_at(
const math::vec3& eye,
const math::vec3& at,
const math::vec3& vUp);
Storage for frustum planes / values and wraps up common functionality.
Class representing a camera. Contains functionality for manipulating and updating a camera....
auto get_view_projection_relative() const -> math::transform
auto get_far_clip() const -> float
Retrieves the distance from the camera to the far clip plane.
float far_clip_
Far clip plane Distance.
auto get_fov() const -> float
Retrieves the current field of view angle in degrees.
auto classify_obb(const math::bbox &bounds, const math::transform &t) const -> math::volume_query
Determines if the specified OBB is within the frustum.
auto viewport_to_major_axis(const math::vec2 &point, const math::vec3 &axis_origin, math::vec3 &position_out, math::vec3 &major_axis_out) const -> bool
Converts a screen position into a world space intersection point on a major axis plane.
auto viewport_to_world(const math::vec2 &point, const math::plane &plane, math::vec3 &position_out, bool clip) const -> bool
Converts a screen position into a world space position on the specified plane.
auto viewport_to_ray(const math::vec2 &point, math::vec3 &vec_ray_start, math::vec3 &vec_ray_dir) const -> bool
Converts the specified screen position into a ray origin and direction vector.
auto get_prev_view_projection() const -> math::transform
Retrieves the previous view matrix.
auto test_obb(const math::bbox &bounds, const math::transform &t) const -> bool
Tests if the specified OBB is within the frustum.
auto get_prev_view_relative() const -> const math::transform &
void set_fov(float degrees)
Sets the field of view angle of this camera (perspective only).
auto get_projection_mode() const -> projection_mode
Retrieves the current projection mode for this camera.
void look_at(const math::vec3 &eye, const math::vec3 &at)
Sets the camera to look at a specified target.
void set_orthographic_size(float size)
Sets the half of the vertical size of the viewing volume in world units.
bool aspect_locked_
Should the aspect ratio be automatically updated by the render driver?
math::transform view_relative_
math::frustum clipping_volume_
The near clipping volume (area of space between the camera position and the near plane).
auto get_ppu() const -> float
Retrieves the pixels per unit (PPU).
auto get_viewport_size() const -> const usize32_t &
Retrieves the size of the viewport.
auto x_unit_axis() const -> math::vec3
Retrieves the x-axis unit vector of the camera's local coordinate system.
projection_mode projection_mode_
The type of projection currently selected for this camera.
bool view_dirty_
View matrix dirty ?
auto get_projection() const -> const math::transform &
Retrieves the current projection matrix.
auto get_clipping_volume() const -> const math::frustum &
Retrieves the frustum representing the space between the camera position and its near plane.
auto get_zoom_factor() const -> float
Retrieves the zoom factor.
math::frustum frustum_
Details regarding the camera frustum.
float aspect_ratio_
The aspect ratio used to generate the correct horizontal degrees (perspective only)
auto get_local_bounding_box() -> math::bbox
Retrieves the bounding box of this object.
static auto get_face_camera(std::uint32_t face, const math::transform &transform) -> camera
Retrieves a camera for one of six cube faces.
void touch()
Marks the camera as modified.
float near_clip_
Near clip plane Distance.
bool projection_dirty_
Projection matrix dirty ?
auto get_view() const -> const math::transform &
Retrieves the current view matrix.
math::transform view_inverse_relative_
void set_aa_data(const usize32_t &viewportSize, std::uint32_t currentSubpixelIndex, std::uint32_t temporalAASamples)
Sets the current jitter value for temporal anti-aliasing.
math::transform projection_
Cached projection matrix.
float ortho_size_
camera's half-size when in orthographic mode.
math::transform last_view_
Cached "previous" view matrix.
auto test_aabb(const math::bbox &bounds) const -> bool
Tests if the specified AABB is within the frustum.
void set_viewport_pos(const upoint32_t &viewportPos)
Sets the position of the viewport.
auto test_billboard(float size, const math::transform &t) const -> bool
math::transform view_
Cached view matrix.
bool frustum_dirty_
Are the frustum planes dirty ?
void set_projection_mode(projection_mode mode)
Sets the current projection mode for this camera (i.e. orthographic or perspective).
auto estimate_zoom_factor(const math::plane &plane) const -> float
Estimates the zoom factor based on the specified plane.
math::vec4 aa_data_
Anti-aliasing data.
auto get_prev_view_projection_relative() const -> math::transform
auto is_aspect_locked() const -> bool
Determines if the aspect ratio is currently being updated by the render driver.
void set_far_clip(float distance)
Sets the far plane distance.
auto estimate_pick_tolerance(float pixel_tolerance, const math::vec3 &reference_position, const math::transform &object_transform) const -> math::vec3
Estimates the pick tolerance based on the pixel tolerance and reference position.
bool frustum_locked_
Is the frustum locked?
auto y_unit_axis() const -> math::vec3
Retrieves the y-axis unit vector of the camera's local coordinate system.
auto get_view_relative() const -> const math::transform &
auto is_frustum_locked() const -> bool
Checks if the frustum is currently locked.
auto z_unit_axis() const -> math::vec3
Retrieves the z-axis unit vector of the camera's local coordinate system.
math::transform last_view_relative_
auto viewport_to_camera(const math::vec3 &point, math::vec3 &position_out) const -> bool
Converts a screen position into a camera space position at the near plane.
void set_aspect_ratio(float aspect, bool locked=false)
Sets the aspect ratio to be used for generating the horizontal FOV angle (perspective only).
auto get_prev_view() const -> const math::transform &
void lock_frustum(bool locked)
Locks or unlocks the frustum.
float fov_
Vertical degrees angle (perspective only).
auto get_view_inverse() const -> const math::transform &
auto get_position() const -> const math::vec3 &
Retrieves the current position of the camera.
auto world_to_viewport(const math::vec3 &pos) const -> math::vec3
Transforms a point from world space into screen space.
auto classify_aabb(const math::bbox &bounds) const -> math::volume_query
Determines if the specified AABB falls within the frustum.
auto get_aspect_ratio() const -> float
Retrieves the aspect ratio used to generate the horizontal FOV angle.
upoint32_t viewport_pos_
Viewport position.
auto get_ortho_size() const -> float
Retrieves the orthographic size.
bool aspect_dirty_
Has the aspect ratio changed?
usize32_t viewport_size_
Viewport size.
auto get_viewport_pos() const -> const upoint32_t &
Retrieves the position of the viewport.
auto get_view_projection() const -> math::transform
Retrieves the current view-projection matrix.
auto get_prev_projection() const -> const math::transform &
void record_current_matrices()
Makes a copy of the current view and projection matrices before they are changed.
math::transform last_projection_
Cached "previous" projection matrix.
void set_viewport_size(const usize32_t &viewportSize)
Sets the size of the viewport.
void set_near_clip(float distance)
Sets the near plane distance.
math::transform view_inverse_
auto get_view_inverse_relative() const -> const math::transform &
auto get_frustum() const -> const math::frustum &
Retrieves the current camera object frustum.
auto get_aa_data() const -> const math::vec4 &
Retrieves the anti-aliasing data.
auto get_near_clip() const -> float
Retrieves the distance from the camera to the near clip plane.
transform_t< float > transform
projection_mode
Enum representing the projection mode of a camera.
Storage for box vector values and wraps up common functionality.
Storage for infinite plane.
Structure for storing camera related context.
rtti::context ctx
RTTI context for the camera.