Unravel Engine C++ Reference
Loading...
Searching...
No Matches
math Namespace Reference

Namespaces

namespace  detail
 
namespace  volume_geometry_point
 
namespace  volume_plane
 

Classes

class  bbox
 Storage for box vector values and wraps up common functionality. More...
 
class  bsphere
 Provides storage for common representation of spherical bounding volume, and wraps up common functionality. More...
 
struct  color
 
class  frustum
 Storage for frustum planes / values and wraps up common functionality. More...
 
class  gradient
 
struct  gradient_point
 
struct  plane
 Storage for infinite plane. More...
 
class  transform_t
 General purpose transformation class designed to maintain each component of the transformation separate (translation, rotation, scale and shear) whilst providing much of the same functionality provided by standard matrices. More...
 

Typedefs

using transform = transform_t<float>
 

Enumerations

enum class  gradient_interpolation_mode_t { linear , constant }
 
enum class  volume_query { inside = 0 , outside , intersect }
 
enum class  plane_query { front = 0 , back , on , spanning }
 

Functions

template<>
auto gradient_lerp (const vec4 &start, const vec4 &end, float progress) -> vec4
 
template<>
auto gradient_lerp (const vec3 &start, const vec3 &end, float progress) -> vec3
 
template<>
auto gradient_lerp (const vec2 &start, const vec2 &end, float progress) -> vec2
 
template<>
auto gradient_lerp (const float &start, const float &end, float progress) -> float
 
template<>
auto gradient_lerp (const color &start, const color &end, float progress) -> color
 
auto to_string (gradient_interpolation_mode_t mode) -> std::string
 
auto interpolation_mode_from_string (const std::string &mode) -> gradient_interpolation_mode_t
 
template<typename T >
auto gradient_lerp (const T &start, const T &end, float progress) -> T
 
template<typename T >
auto operator< (const gradient_point< T > &lhs, const gradient_point< T > &rhs) noexcept -> bool
 
template<typename T >
auto operator== (const gradient_point< T > &lhs, const gradient_point< T > &rhs) noexcept -> bool
 
bool is_negative_float (const float &A)
 
template<typename T >
square (const T &t)
 
bool compute_projected_sphere_shaft (float light_x, float light_z, float radius, const glm::mat4 &proj, const glm::vec3 &axis, float axis_sign, std::int32_t &in_out_min_x, std::int32_t &in_out_max_x)
 
std::uint32_t compute_projected_sphere_rect (std::int32_t &left, std::int32_t &right, std::int32_t &top, std::int32_t &bottom, const glm::vec3 &sphere_center, float radius, const glm::vec3 &view_origin, const glm::mat4 &view, const glm::mat4 &proj)
 
float halton (std::uint32_t Index, std::uint32_t Base)
 
std::uint32_t power_of_n_round_down (std::uint32_t val, std::uint32_t n)
 
template<typename T , qualifier Q>
GLM_FUNC_QUALIFIER mat< 4, 4, T, Q > recompose_impl (vec< 3, T, Q > const &scale, qua< T, Q > const &orientation, vec< 3, T, Q > const &translation, vec< 3, T, Q > const &skew, vec< 4, T, Q > const &perspective)
 
template<typename T , qualifier Q>
GLM_FUNC_QUALIFIER void glm_recompose (mat< 4, 4, T, Q > &model_matrix, vec< 3, T, Q > const &in_scale, qua< T, Q > const &in_orientation, vec< 3, T, Q > const &in_translation, vec< 3, T, Q > const &in_skew, vec< 4, T, Q > const &in_perspective)
 
template<typename T , qualifier Q>
GLM_FUNC_QUALIFIER bool glm_decompose (mat< 4, 4, T, Q > const &ModelMatrix, vec< 3, T, Q > &Scale, qua< T, Q > &Orientation, vec< 3, T, Q > &Translation, vec< 3, T, Q > &Skew, vec< 4, T, Q > &Perspective)
 
auto operator* (float s, const plane &p) -> plane
 Scalar multiplication for a plane.
 
template<typename T , precision Q>
auto inverse (transform_t< T, Q > const &t) noexcept -> transform_t< T, Q >
 
template<typename T , precision Q>
auto transpose (transform_t< T, Q > const &t) noexcept -> transform_t< T, Q >
 
template<typename T >
TRANSFORM_INLINE auto to_string (const T &v) -> std::string
 
template<>
auto gradient_lerp (const frange_t &start, const frange_t &end, float progress) -> frange_t
 

Typedef Documentation

◆ transform

using math::transform = transform_t<float>

Definition at line 1510 of file transform.hpp.

Enumeration Type Documentation

◆ gradient_interpolation_mode_t

Enumerator
linear 
constant 

Definition at line 21 of file gradient.h.

◆ plane_query

enum class math::plane_query
strong
Enumerator
front 
back 
on 
spanning 

Definition at line 19 of file math_types.h.

◆ volume_query

enum class math::volume_query
strong
Enumerator
inside 
outside 
intersect 

Definition at line 12 of file math_types.h.

Function Documentation

◆ compute_projected_sphere_rect()

std::uint32_t math::compute_projected_sphere_rect ( std::int32_t & left,
std::int32_t & right,
std::int32_t & top,
std::int32_t & bottom,
const glm::vec3 & sphere_center,
float radius,
const glm::vec3 & view_origin,
const glm::mat4 & view,
const glm::mat4 & proj )
inline

Definition at line 225 of file math.h.

◆ compute_projected_sphere_shaft()

bool math::compute_projected_sphere_shaft ( float light_x,
float light_z,
float radius,
const glm::mat4 & proj,
const glm::vec3 & axis,
float axis_sign,
std::int32_t & in_out_min_x,
std::int32_t & in_out_max_x )
inline

Compute the screen bounds of a point light along one axis. Based on http://www.gamasutra.com/features/20021011/lengyel_06.htm and http://sourceforge.net/mailarchive/message.php?msg_id=10501105

Definition at line 162 of file math.h.

◆ glm_decompose()

template<typename T , qualifier Q>
GLM_FUNC_QUALIFIER bool math::glm_decompose ( mat< 4, 4, T, Q > const & ModelMatrix,
vec< 3, T, Q > & Scale,
qua< T, Q > & Orientation,
vec< 3, T, Q > & Translation,
vec< 3, T, Q > & Skew,
vec< 4, T, Q > & Perspective )

IMPORTANT!!! Do not return here. Instaed use the modified length_impl function to handle zero lenght scales

Definition at line 130 of file matrix_recompose.hpp.

◆ glm_recompose()

template<typename T , qualifier Q>
GLM_FUNC_QUALIFIER void math::glm_recompose ( mat< 4, 4, T, Q > & model_matrix,
vec< 3, T, Q > const & in_scale,
qua< T, Q > const & in_orientation,
vec< 3, T, Q > const & in_translation,
vec< 3, T, Q > const & in_skew,
vec< 4, T, Q > const & in_perspective )

Definition at line 116 of file matrix_recompose.hpp.

◆ gradient_lerp() [1/7]

template<>
auto math::gradient_lerp ( const color & start,
const color & end,
float progress ) -> color

Definition at line 33 of file gradient.cpp.

◆ gradient_lerp() [2/7]

template<>
auto math::gradient_lerp ( const float & start,
const float & end,
float progress ) -> float

Definition at line 27 of file gradient.cpp.

◆ gradient_lerp() [3/7]

template<>
auto math::gradient_lerp ( const frange_t & start,
const frange_t & end,
float progress ) -> frange_t

Definition at line 12 of file particle_emitter_component.cpp.

◆ gradient_lerp() [4/7]

template<typename T >
auto math::gradient_lerp ( const T & start,
const T & end,
float progress ) -> T

◆ gradient_lerp() [5/7]

template<>
auto math::gradient_lerp ( const vec2 & start,
const vec2 & end,
float progress ) -> vec2

Definition at line 20 of file gradient.cpp.

◆ gradient_lerp() [6/7]

template<>
auto math::gradient_lerp ( const vec3 & start,
const vec3 & end,
float progress ) -> vec3

Definition at line 14 of file gradient.cpp.

◆ gradient_lerp() [7/7]

template<>
auto math::gradient_lerp ( const vec4 & start,
const vec4 & end,
float progress ) -> vec4

Definition at line 8 of file gradient.cpp.

◆ halton()

float math::halton ( std::uint32_t Index,
std::uint32_t Base )
inline

Definition at line 258 of file math.h.

◆ interpolation_mode_from_string()

auto math::interpolation_mode_from_string ( const std::string & mode) -> gradient_interpolation_mode_t

Definition at line 50 of file gradient.cpp.

◆ inverse()

template<typename T , precision Q>
auto math::inverse ( transform_t< T, Q > const & t) -> transform_t<T, Q>
noexcept

Definition at line 729 of file transform.hpp.

◆ is_negative_float()

bool math::is_negative_float ( const float & A)
inline

Compute the screen bounds of a point light along one axis. Based on http://www.gamasutra.com/features/20021011/lengyel_06.htm and http://sourceforge.net/mailarchive/message.php?msg_id=10501105

Definition at line 141 of file math.h.

◆ operator*()

auto math::operator* ( float s,
const plane & p ) -> plane
inline

Scalar multiplication for a plane.

Multiplies each component of the plane by a scalar value.

Parameters
sScalar value to multiply by.
pThe plane to be multiplied.
Returns
A new plane with each component multiplied by the scalar value.

Definition at line 255 of file plane.h.

◆ operator<()

template<typename T >
auto math::operator< ( const gradient_point< T > & lhs,
const gradient_point< T > & rhs ) -> bool
inlinenoexcept

Definition at line 35 of file gradient.h.

◆ operator==()

template<typename T >
auto math::operator== ( const gradient_point< T > & lhs,
const gradient_point< T > & rhs ) -> bool
inlinenoexcept

Definition at line 41 of file gradient.h.

◆ power_of_n_round_down()

std::uint32_t math::power_of_n_round_down ( std::uint32_t val,
std::uint32_t n )
inline

Definition at line 272 of file math.h.

◆ recompose_impl()

template<typename T , qualifier Q>
GLM_FUNC_QUALIFIER mat< 4, 4, T, Q > math::recompose_impl ( vec< 3, T, Q > const & scale,
qua< T, Q > const & orientation,
vec< 3, T, Q > const & translation,
vec< 3, T, Q > const & skew,
vec< 4, T, Q > const & perspective )

Definition at line 73 of file matrix_recompose.hpp.

◆ square()

template<typename T >
T math::square ( const T & t)
inline

Definition at line 152 of file math.h.

◆ to_string() [1/2]

template<typename T >
TRANSFORM_INLINE auto math::to_string ( const T & v) -> std::string

Definition at line 1515 of file transform.hpp.

◆ to_string() [2/2]

auto math::to_string ( gradient_interpolation_mode_t mode) -> std::string

Definition at line 37 of file gradient.cpp.

◆ transpose()

template<typename T , precision Q>
auto math::transpose ( transform_t< T, Q > const & t) -> transform_t<T, Q>
noexcept

Definition at line 736 of file transform.hpp.