28 #ifndef BERSERK_UTILS3d_H
29 #define BERSERK_UTILS3d_H
72 return {scale[0], 0, 0, 0,
87 return {1, 0, 0, t.
values[0],
131 auto oneMinC = 1 - c;
135 c + Ax[0] * Ax[0] * oneMinC,
136 Ax[0] * Ax[1] * oneMinC - Ax[2] * s,
137 Ax[0] * Ax[2] * oneMinC + Ax[1] * s,
141 Ax[1] * Ax[0] * oneMinC + Ax[2] * s,
142 c + Ax[1] * Ax[1] * oneMinC,
143 Ax[1] * Ax[2] * oneMinC - Ax[0] * s,
147 Ax[2] * Ax[0] * oneMinC - Ax[1] * s,
148 Ax[2] * Ax[1] * oneMinC + Ax[0] * s,
149 c + Ax[2] * Ax[2] * oneMinC,
173 auto Z = (-direction).Normalized();
180 0.0f, 0.0f, 0.0f, 1.0f};
202 return {ctg_angle / aspect, 0.0f, 0.0f, 0.0f,
203 0.0f, ctg_angle, 0.0f, 0.0f,
204 0.0f, 0.0f, (far + near) / (near - far), (2 * far * near) / (near - far),
205 0.0f, 0.0f, -1.0f, 0.0f};
220 return {2.0f / (right - left), 0.0f, 0.0f, (right + left) / (left - right),
221 0.0f, 2.0f / (top - bottom), 0.0f, (top + bottom) / (bottom - top),
222 0.0f, 0.0f, 2.0f / (far - near), (far + near) / (near - far),
223 0.0f, 0.0f, 0.0f, 1.0f};
#define BRK_NS_END
Definition: Config.hpp:48
3d space math utils
Definition: MathUtils3d.hpp:44
static Mat4x4f RotateY(float angleRad)
Clockwise around axis rotation.
Definition: MathUtils3d.hpp:105
static Mat4x4f Perspective(float fov, float aspect, float near, float far)
Perspective projection.
Definition: MathUtils3d.hpp:199
static Mat4x4f RotateX(float angleRad)
Clockwise around axis rotation.
Definition: MathUtils3d.hpp:94
static void SetTranslation(Mat4x4f &m, const Vec3f &t)
Set translation column of matrix m to vec t.
Definition: MathUtils3d.hpp:79
static Mat4x4f Orthographic(float left, float right, float bottom, float top, float near, float far)
Orthographic projection.
Definition: MathUtils3d.hpp:219
static Mat4x4f IdentityMatrix()
Identity matrix e.
Definition: MathUtils3d.hpp:57
static Mat4x4f Scale(const Vec3f &scale)
Definition: MathUtils3d.hpp:71
static Mat4x4f LookAt(const Vec3f &eye, const Vec3f &direction, const Vec3f &up)
Look at view matrix for camera (in OpenGL style)
Definition: MathUtils3d.hpp:172
static void SetScale(Mat4x4f &m, const Vec3f &scale)
Set scale elements.
Definition: MathUtils3d.hpp:65
static Mat4x4f Rotate(const Vec3f &axis, float angleRad)
Clockwise rotation around an arbitrary axis.
Definition: MathUtils3d.hpp:127
static Mat4x4f Translate(const Vec3f &t)
Translation in the direction of vec t.
Definition: MathUtils3d.hpp:86
static Mat4x4f RotateZ(float angleRad)
Clockwise around axis rotation.
Definition: MathUtils3d.hpp:116
static TVecN< float, 3 > Multiply(const Mat4x4f &m, const TVecN< float, 3 > &v)
Definition: MathUtils3d.hpp:46
static float Tan(float a)
Definition: MathUtils.hpp:94
static float Cos(float a)
Definition: MathUtils.hpp:91
static float Sin(float a)
Definition: MathUtils.hpp:88
T values[M *N]
Definition: TMatMxN.hpp:377
static TVecN Cross(const TVecN &a, const TVecN &b)
Definition: TVecN.hpp:375
TVecN Normalized() const
Definition: TVecN.hpp:520
T values[N]
Definition: TVecN.hpp:595
static float Dot(const TVecN &a, const TVecN &b)
Definition: TVecN.hpp:354
Definition: GLDevice.cpp:46