aboutsummaryrefslogtreecommitdiff
path: root/src/math/mat4.h
blob: 35b1ad2a3560d835b96e9bd0b62646bd8c021ea7 (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
35
#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 scale(Vector3 facs);
        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+() const;
        Matrix4 operator-() const;
        Matrix4 operator+(Matrix4 m) const;
        Matrix4 operator-(Matrix4 m) const;
        Matrix4 operator*(Matrix4 m) const;
        Vector4 operator*(Vector4 v) const;
        std::array<Vector4, 4> to_vecs() const;
};

Matrix4 operator*(float fac, Matrix4 m);

}

#endif // MATH_MAT4_H