Catos Engine (Source) 0.0.1
Lightweight Game engine
Loading...
Searching...
No Matches
vecs.h
Go to the documentation of this file.
1//
2// Created by allos on 5/16/2024.
3//
4
5#ifndef CATOS_MATH_H
6#define CATOS_MATH_H
7
8#include <glm/glm.hpp>
9
10namespace catos::math {
11
12
13 struct Vector2 {
14
15 float x, y;
16
18 return (this->x == b.x && this->y == b.y);
19 }
20
21 bool operator==(glm::vec2& b) {
22 return (this->x == b.x && this->y == b.y);
23 }
24
25 void operator+(Vector2& b) {
26 this->x += b.x;
27 this->y += b.y;
28 }
29
30 void operator+(glm::vec2& b) {
31 this->x += b.x;
32 this->y += b.y;
33 }
34 };
35
36
37 struct Vector3 {
38
39 float x, y, z;
40
41 bool operator==(Vector3 &b) const {
42 return (this->x == b.x && this->y == b.y && this->z == b.z);
43 }
44
45 Vector3& operator=(float val) {
46 this->x = val;
47 this->y = val;
48 this->z = val;
49 return *this;
50 }
51
52
54 this->x += b.x;
55 this->y += b.y;
56 this->z += b.z;
57 }
58
59
60 };
61
62 struct Quaternion {
63
64 float x, y, z, w;
65
66 bool operator==(Quaternion &b) const {
67 return (this->x == b.x && this->y == b.y && this->z == b.z && this->w == b.w);
68 }
69
70 Quaternion& operator=(float val) {
71 this->x = val;
72 this->y = val;
73 this->z = val;
74 this->w = val;
75 return *this;
76 }
77
79 this->x += b.x;
80 this->y += b.y;
81 this->z += b.z;
82 this->w += b.z;
83 }
84
85 void sIdentity() {
86 w = 1;
87 }
88
89 };
90
91}
92
93
94
95#endif //CATOS_MATH_H
Definition vecs.h:10
Definition vecs.h:13
void operator+(Vector2 &b)
Definition vecs.h:25
float x
Definition vecs.h:15
bool operator==(Vector2 &b)
Definition vecs.h:17
float y
Definition vecs.h:15
bool operator==(glm::vec2 &b)
Definition vecs.h:21
void operator+(glm::vec2 &b)
Definition vecs.h:30
Definition vecs.h:37
float z
Definition vecs.h:39
float y
Definition vecs.h:39
float x
Definition vecs.h:39
Vector3 & operator=(float val)
Definition vecs.h:45
void operator+=(Vector3 &b)
Definition vecs.h:53
bool operator==(Vector3 &b) const
Definition vecs.h:41
Definition vecs.h:62
bool operator==(Quaternion &b) const
Definition vecs.h:66
void operator+(Quaternion &b)
Definition vecs.h:78
void sIdentity()
Definition vecs.h:85
float y
Definition vecs.h:64
float w
Definition vecs.h:64
float x
Definition vecs.h:64
float z
Definition vecs.h:64
Quaternion & operator=(float val)
Definition vecs.h:70