aboutsummaryrefslogtreecommitdiff
path: root/src/basic/math.hpp
blob: 0f211810411d7b7b0968d82c54a648883e3762d5 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include <basic/defs.hpp>

struct V2ST {
    size_t x;
    size_t y;

    V2ST() = default;
    V2ST(size_t x, size_t y);
    V2ST(int32_t x, int32_t y);
    bool operator==(V2ST &b);
    bool operator==(const V2ST& other) const {
        return x == other.x && y == other.y;
    }
};

struct V2F32 {
    float x;
    float y;

    V2F32() = default;
    V2F32(float x, float y);
    V2F32 operator/(float scalar);
    V2F32 operator*(float scalar);
    V2F32 operator+(V2F32 other);
};

struct V3F32 {
    float x;
    float y;
    float z;

    V3F32() = default;
    V3F32(float x, float y, float z);
    V3F32 operator/(float scalar);
    V3F32 operator*(float scalar);
};

struct V4F32 {
    float x;
    float y;
    float z;
    float w;

    V4F32() = default;
    V4F32 (float x, float y, float z, float w);
    V4F32 operator/(float scalar);
    V4F32 operator*(float scalar);
};

struct V2I32 {
    int32_t x;
    int32_t y;

    V2I32() = default;
    V2I32 (int32_t x, int32_t y);
    bool operator==(V2I32 other);
};