diff options
author | vimene <vincent.menegaux@gmail.com> | 2023-12-09 06:33:39 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2023-12-09 06:33:39 +0100 |
commit | bf39fef7eed69e6d5ecfa272607cbf0fcc53b9a6 (patch) | |
tree | 81ac781a634f7618809d6322e1a2d8b544cbc798 /src/math/vector.cpp | |
parent | 19c3e2b83c3c8b58576050b448f2f35d0687e717 (diff) | |
download | engine-bf39fef7eed69e6d5ecfa272607cbf0fcc53b9a6.tar.gz |
fixed perspective calculations
Diffstat (limited to 'src/math/vector.cpp')
-rw-r--r-- | src/math/vector.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/math/vector.cpp b/src/math/vector.cpp index 36e813d..306fc3d 100644 --- a/src/math/vector.cpp +++ b/src/math/vector.cpp @@ -87,10 +87,6 @@ Vector3 Vector3::round() const { return { std::round(x), std::round(y), std::round(z) }; } -Vector2 Vector3::xy() const { - return { x, y }; -} - Vector3 Vector3::cross(Vector3 other) const { return { y * other.z - z * other.y, @@ -154,12 +150,16 @@ Vector4 Vector4::round() const { return { std::round(x), std::round(y), std::round(z), std::round(w) }; } +Vector2 Vector4::xy() const { + return { x, y }; +} + Vector3 Vector4::xyz() const { return { x, y, z }; } -Vector3 Vector4::div_by_w() const { - return xyz() / w; +Vector4 Vector4::div_by_w() const { + return {x / w, y / w, z / w, w}; } Vector4 engine::math::operator*(float n, Vector4 other) { |