diff --git a/SHADE_Engine/src/Math/Vector/SHVec2.cpp b/SHADE_Engine/src/Math/Vector/SHVec2.cpp index 2d2eafd2..545492cb 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec2.cpp +++ b/SHADE_Engine/src/Math/Vector/SHVec2.cpp @@ -165,7 +165,7 @@ namespace SHADE return XMVector2NotEqual(V1, V2); } - float SHVec2::operator[](int index) + float& SHVec2::operator[](int index) { if (index >= SIZE || index < 0) throw std::invalid_argument("Index out of range!"); @@ -174,11 +174,10 @@ namespace SHADE { case 0: return x; case 1: return y; - default: return 0.0f; } } - float SHVec2::operator[](size_t index) + float& SHVec2::operator[](size_t index) { if (index >= SIZE) throw std::invalid_argument("Index out of range!"); @@ -187,7 +186,6 @@ namespace SHADE { case 0: return x; case 1: return y; - default: return 0.0f; } } @@ -200,7 +198,6 @@ namespace SHADE { case 0: return x; case 1: return y; - default: return 0.0f; } } @@ -213,7 +210,6 @@ namespace SHADE { case 0: return x; case 1: return y; - default: return 0.0f; } } diff --git a/SHADE_Engine/src/Math/Vector/SHVec2.h b/SHADE_Engine/src/Math/Vector/SHVec2.h index 3e6287aa..17642126 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec2.h +++ b/SHADE_Engine/src/Math/Vector/SHVec2.h @@ -81,8 +81,8 @@ namespace SHADE [[nodiscard]] bool operator== (const SHVec2& rhs) const noexcept; [[nodiscard]] bool operator!= (const SHVec2& rhs) const noexcept; - [[nodiscard]] float operator[] (int index); - [[nodiscard]] float operator[] (size_t index); + [[nodiscard]] float& operator[] (int index); + [[nodiscard]] float& operator[] (size_t index); [[nodiscard]] float operator[] (int index) const; [[nodiscard]] float operator[] (size_t index) const; diff --git a/SHADE_Engine/src/Math/Vector/SHVec3.cpp b/SHADE_Engine/src/Math/Vector/SHVec3.cpp index 194f7964..1bcb47b3 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec3.cpp +++ b/SHADE_Engine/src/Math/Vector/SHVec3.cpp @@ -171,7 +171,7 @@ namespace SHADE return XMVector3NotEqual(V1, V2); } - float SHVec3::operator[](int index) + float& SHVec3::operator[](int index) { if (index >= SIZE || index < 0) throw std::invalid_argument("Index out of range!"); @@ -181,11 +181,10 @@ namespace SHADE case 0: return x; case 1: return y; case 2: return z; - default: return 0.0f; } } - float SHVec3::operator[](size_t index) + float& SHVec3::operator[](size_t index) { if (index >= SIZE) throw std::invalid_argument("Index out of range!"); @@ -195,7 +194,6 @@ namespace SHADE case 0: return x; case 1: return y; case 2: return z; - default: return 0.0f; } } @@ -209,7 +207,6 @@ namespace SHADE case 0: return x; case 1: return y; case 2: return z; - default: return 0.0f; } } @@ -223,7 +220,6 @@ namespace SHADE case 0: return x; case 1: return y; case 2: return z; - default: return 0.0f; } } diff --git a/SHADE_Engine/src/Math/Vector/SHVec3.h b/SHADE_Engine/src/Math/Vector/SHVec3.h index 476d7b0f..cc0e043e 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec3.h +++ b/SHADE_Engine/src/Math/Vector/SHVec3.h @@ -86,8 +86,8 @@ namespace SHADE [[nodiscard]] bool operator== (const SHVec3& rhs) const noexcept; [[nodiscard]] bool operator!= (const SHVec3& rhs) const noexcept; - [[nodiscard]] float operator[] (int index); - [[nodiscard]] float operator[] (size_t index); + [[nodiscard]] float& operator[] (int index); + [[nodiscard]] float& operator[] (size_t index); [[nodiscard]] float operator[] (int index) const; [[nodiscard]] float operator[] (size_t index) const; diff --git a/SHADE_Engine/src/Math/Vector/SHVec4.cpp b/SHADE_Engine/src/Math/Vector/SHVec4.cpp index 5d75af33..d1c87865 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec4.cpp +++ b/SHADE_Engine/src/Math/Vector/SHVec4.cpp @@ -161,7 +161,7 @@ namespace SHADE return XMVector4NotEqual(V1, V2); } - float SHVec4::operator[](int index) + float& SHVec4::operator[](int index) { if (index >= SIZE || index < 0) throw std::invalid_argument("Index out of range!"); @@ -172,11 +172,10 @@ namespace SHADE case 1: return y; case 2: return z; case 3: return w; - default: return 0.0f; } } - float SHVec4::operator[](size_t index) + float& SHVec4::operator[](size_t index) { if (index >= SIZE) throw std::invalid_argument("Index out of range!"); @@ -187,7 +186,6 @@ namespace SHADE case 1: return y; case 2: return z; case 3: return w; - default: return 0.0f; } } @@ -202,7 +200,6 @@ namespace SHADE case 1: return y; case 2: return z; case 3: return w; - default: return 0.0f; } } @@ -217,7 +214,6 @@ namespace SHADE case 1: return y; case 2: return z; case 3: return w; - default: return 0.0f; } } diff --git a/SHADE_Engine/src/Math/Vector/SHVec4.h b/SHADE_Engine/src/Math/Vector/SHVec4.h index a4a5208a..59038065 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec4.h +++ b/SHADE_Engine/src/Math/Vector/SHVec4.h @@ -80,8 +80,8 @@ namespace SHADE [[nodiscard]] bool operator== (const SHVec4& rhs) const noexcept; [[nodiscard]] bool operator!= (const SHVec4& rhs) const noexcept; - [[nodiscard]] float operator[] (int index); - [[nodiscard]] float operator[] (size_t index); + [[nodiscard]] float& operator[] (int index); + [[nodiscard]] float& operator[] (size_t index); [[nodiscard]] float operator[] (int index) const; [[nodiscard]] float operator[] (size_t index) const;