shooter/engine/Matrix4x4.h

44 lines
1.3 KiB
C
Raw Normal View History

2021-09-13 15:53:43 +03:00
//
// Created by Иван Ильин on 12.01.2021.
//
#ifndef ENGINE_MATRIX4X4_H
#define ENGINE_MATRIX4X4_H
#include <array>
#include "Point4D.h"
#include "Vec3D.h"
2021-09-13 15:53:43 +03:00
class Matrix4x4 final {
2021-09-13 15:53:43 +03:00
private:
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;
[[nodiscard]] Point4D operator*(const Point4D& point4D) const;
[[nodiscard]] Vec3D operator*(const Vec3D& vec) const;
2021-09-13 15:53:43 +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);
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);
Matrix4x4 static Rotation (const Vec3D& v, double rv);
2021-09-13 15:53:43 +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