2021-09-13 15:53:43 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 12.01.2021.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ENGINE_MATRIX4X4_H
|
|
|
|
#define ENGINE_MATRIX4X4_H
|
|
|
|
|
|
|
|
#include <array>
|
2021-10-28 16:58:02 +03:00
|
|
|
#include "Vec4D.h"
|
2021-10-12 17:12:47 +03:00
|
|
|
#include "Vec3D.h"
|
2021-09-13 15:53:43 +03:00
|
|
|
|
2021-10-12 20:18:56 +03:00
|
|
|
class Matrix4x4 final {
|
2021-09-13 15:53:43 +03:00
|
|
|
private:
|
2021-09-14 13:47:53 +03:00
|
|
|
std::array<std::array<double, 4>, 4> _arr{};
|
2021-09-20 13:54:09 +03:00
|
|
|
|
2021-09-13 15:53:43 +03:00
|
|
|
public:
|
|
|
|
Matrix4x4 () = default;
|
|
|
|
Matrix4x4& operator=(const Matrix4x4& matrix4X4) = default;
|
|
|
|
|
|
|
|
[[nodiscard]] Matrix4x4 operator*(const Matrix4x4& matrix4X4) const;
|
2021-10-28 16:58:02 +03:00
|
|
|
[[nodiscard]] Vec4D operator*(const Vec4D& point4D) const;
|
2021-10-12 17:12:47 +03:00
|
|
|
[[nodiscard]] Vec3D operator*(const Vec3D& vec) const;
|
2021-09-13 15:53:43 +03:00
|
|
|
|
2021-10-29 23:44:37 +03:00
|
|
|
[[nodiscard]] Vec3D x() const;
|
|
|
|
[[nodiscard]] Vec3D y() const;
|
|
|
|
[[nodiscard]] Vec3D z() const;
|
|
|
|
|
2021-09-14 13:47:53 +03:00
|
|
|
// Any useful matrix (static methods)
|
2021-09-13 15:53:43 +03:00
|
|
|
Matrix4x4 static Identity();
|
|
|
|
Matrix4x4 static Zero();
|
|
|
|
Matrix4x4 static Constant (double value);
|
|
|
|
|
2021-10-12 17:12:47 +03:00
|
|
|
Matrix4x4 static Scale(const Vec3D& factor);
|
|
|
|
Matrix4x4 static Translation(const Vec3D& v);
|
|
|
|
Matrix4x4 static Rotation(const Vec3D& r);
|
2021-09-13 15:53:43 +03:00
|
|
|
Matrix4x4 static RotationX (double rx);
|
|
|
|
Matrix4x4 static RotationY (double ry);
|
|
|
|
Matrix4x4 static RotationZ (double rz);
|
2021-10-12 17:12:47 +03:00
|
|
|
Matrix4x4 static Rotation (const Vec3D& v, double rv);
|
2021-09-13 15:53:43 +03:00
|
|
|
|
2021-10-30 11:18:31 +03:00
|
|
|
Matrix4x4 static Model(const Matrix4x4& transformMatrix, const Vec3D &position);
|
2021-10-12 17:12:47 +03:00
|
|
|
Matrix4x4 static View(const Vec3D &left, const Vec3D &up, const Vec3D &lookAt, const Vec3D &eye);
|
2021-09-13 15:53:43 +03:00
|
|
|
Matrix4x4 static Projection (double fov = 90.0, double aspect = 1.0, double ZNear = 1.0, double ZFar = 10.0);
|
|
|
|
Matrix4x4 static ScreenSpace (int width, int height);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //INC_3DZAVR_MATRIX4X4_H
|