diff options
author | mattkae <mattkae@protonmail.com> | 2022-01-22 13:57:55 -0500 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2022-01-22 13:57:55 -0500 |
commit | 3f3d1ed1cba61015aa47a6ad9812ae0d30316cc5 (patch) | |
tree | ba6f5d8aa5114de81f331828ef877a6f4ddebfda /shared_cpp/mathlib.cpp | |
parent | 19defa9be56588803bbae0f38e2f271a91b9d690 (diff) |
(mkosarek) Added dots to the spring bodied rectangle
Diffstat (limited to 'shared_cpp/mathlib.cpp')
-rw-r--r-- | shared_cpp/mathlib.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/shared_cpp/mathlib.cpp b/shared_cpp/mathlib.cpp index 5996ba3..c9f2e0d 100644 --- a/shared_cpp/mathlib.cpp +++ b/shared_cpp/mathlib.cpp @@ -234,6 +234,20 @@ Vector4::Vector4(float inX, float inY, float inZ, float inW) { w = inW; } +Vector4::Vector4(Vector2& v) { + x = v.x; + y = v.y; + z = 0; + w = 1; +} + +Vector4::Vector4(Vector3& v) { + x = v.x; + y = v.y; + z = v.z; + w = 1; +} + Vector4 Vector4::fromColor(float r, float g, float b, float a) { float scale = 1.f / 255.f; return { r * scale, g * scale, b * scale, a * scale }; @@ -302,6 +316,20 @@ Vector4 lerp(Vector4 start, Vector4 end, float t) { return (end - start) * t + start; } +void Vector4::operator=(const Vector2& v2) { + x = v2.x; + y = v2.y; + z = 0; + w = 1; +} + +void Vector4::operator=(const Vector3& v2) { + x = v2.x; + y = v2.y; + z = v2.z; + w = 1; +} + Vector4 Vector4::operator+(const Vector4& v2) { return add(v2); } |