aboutsummaryrefslogtreecommitdiff
path: root/src/math/mat4.h
blob: 66d6cd297ad6de9009d6c0b9e6280752f101ca96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef MATH_MAT4_H
#define MATH_MAT4_H

#include <array>
#include "math/vector.h"

namespace engine::math {

class Matrix4 {
    public:
        static Matrix4 idty();
        static Matrix4 translate(Vector3 v);
        static Matrix4 scale(float fac);
        static Matrix4 rot_x(float a);
        static Matrix4 rot_y(float a);
        static Matrix4 rot_z(float a);
        static Matrix4 projection(float aspect_ratio, float min_z, float max_z);

        std::array<float, 16> values;

        Matrix4 operator+();
        Matrix4 operator-();
        Matrix4 operator+(Matrix4 m);
        Matrix4 operator-(Matrix4 m);
        Matrix4 operator*(Matrix4 m);
        Vector4 operator*(Vector4 v);
        std::array<Vector4, 4> to_vecs();
};

Matrix4 operator*(float fac, Matrix4 m);

}

#endif // MATH_MAT4_H