aboutsummaryrefslogtreecommitdiff
path: root/src/math/vector.h
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2025-01-02 13:25:14 +0100
committervimene <vincent.menegaux@gmail.com>2025-01-02 13:25:14 +0100
commit26b4b82a7be2c029491f3009b66b3cbf8db5d93c (patch)
treeddc247a0600b5933185677212f158ebea5a87530 /src/math/vector.h
parent9fdb5881d46f5d80626f961f9c9f133cc25dab70 (diff)
downloadengine-26b4b82a7be2c029491f3009b66b3cbf8db5d93c.tar.gz
various improvements
- cleaned up the computation of the camera's matrix - changed VertexData to being a struct which transmit data between the "vertex shader" and the "fragment shader" - started working on keyboard and mouse controls - added fov (field of view) - changed quaternion to euler angles conversion, from zyx to zxy - fixed computations of z coordinates in triangle rendering - improved naming in the triangle rasterizer
Diffstat (limited to 'src/math/vector.h')
-rw-r--r--src/math/vector.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/math/vector.h b/src/math/vector.h
index b26c5fe..d755c89 100644
--- a/src/math/vector.h
+++ b/src/math/vector.h
@@ -101,6 +101,13 @@ struct Vector3 {
return *this + (-other);
}
+ constexpr Vector3 operator+=(const Vector3& other) & {
+ x += other.x;
+ y += other.y;
+ z += other.z;
+ return *this;
+ }
+
constexpr Vector3 round() {
return { std::round(x), std::round(y), std::round(z) };
}