aboutsummaryrefslogtreecommitdiff
path: root/src/common/math.hpp
blob: de856e891e6a70e11f03e3a270c336e66ad4ef51 (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
60
61
#pragma once


#include <common/defs.hpp>

#include <cstddef>
#include <cstdint>


struct V2ST {
    size_t x;
    size_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 operator/(float scalar);
    V2F32 operator*(float scalar);
    V2F32 operator+(V2F32 other);
};

struct 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 operator/(float scalar);
    V4F32 operator*(float scalar);
};

struct V2I32 {
    int32_t x;
    int32_t y;

    bool operator==(V2I32 other);
};

struct Color {
    float r;
    float g;
    float b;
    float a;
};