From 3f3d1ed1cba61015aa47a6ad9812ae0d30316cc5 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sat, 22 Jan 2022 13:57:55 -0500 Subject: (mkosarek) Added dots to the spring bodied rectangle --- shared_cpp/mathlib.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'shared_cpp/mathlib.cpp') 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); } -- cgit v1.2.1