Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
trs.hpp
1#ifndef TOPAZ_CORE_TRS_HPP
2#define TOPAZ_CORE_TRS_HPP
3#include "tz/core/vector.hpp"
4#include "tz/core/quaternion.hpp"
5#include "tz/core/matrix.hpp"
6
7namespace tz
8{
29 tz::m4f matrix_ortho(float left, float right, float top, float bottom, float near, float far);
34 tz::m4f matrix_persp(float fov, float aspect_ratio, float near, float far);
39 tz::m4f matrix_persp_nofar(float fov, float aspect_ratio, float near);
40
45 struct trs
46 {
53
55 trs lerp(const trs& rhs, float factor) const;
57 m4f matrix() const;
59 static trs from_matrix(m4f mat);
60
62 trs inverse() const;
64 trs combine(const trs& rhs);
65
66 bool operator==(const trs& rhs) const = default;
67 };
68}
69
70#endif // TOPAZ_CORE_TRS_HPP
tz::m4f matrix_persp_nofar(float fov, float aspect_ratio, float near)
Create a perspective projection matrix with an infinitely-distant far plane.
tz::m4f matrix_persp(float fov, float aspect_ratio, float near, float far)
Create a perspective projection matrix.
tz::m4f matrix_ortho(float left, float right, float top, float bottom, float near, float far)
Create an orthographic projection matrix.
tz::m4f matrix_scale(tz::v3f scale)
Create a matrix that performs the given scale in 3D space.
tz::m4f matrix_translate(tz::v3f translate)
Create a matrix that performs the given translation in 3D space.
Represents the generic matrix.
Definition matrix.hpp:16
Quaternion. Represents a rotation in 3D space.
Definition quaternion.hpp:13
static quat iden()
Retrieve the identity quaternion, that is - represents no transformation.
Definition quaternion.hpp:15
Encapsulates a combination of a Translation, Rotation, and Scale in 3D space.
Definition trs.hpp:46
tz::v3f scale
Scale Component.
Definition trs.hpp:52
tz::quat rotate
Rotation Component.
Definition trs.hpp:50
tz::v3f translate
Translation Component.
Definition trs.hpp:48
trs lerp(const trs &rhs, float factor) const
Linearly interpolate between this transform and another based on a factor, and return that result.
trs combine(const trs &rhs)
Combine one transform with another, and return the result.
m4f matrix() const
Create a matrix that performs an identical transformation.
static trs from_matrix(m4f mat)
Create a new TRS that performs the identical transformation to the given matrix.
trs inverse() const
Return an inverse transform that does the exact opposite (such that multiplying a transform by its in...
static constexpr vector< float, N > zero()
Definition vector.hpp:26
static constexpr vector< float, N > filled(float t)
Definition vector.hpp:32