VERY experimental Nintendo Switch 2 emulator
C++
vector math: add implementation of Length and Normalize
wwylele5ddc3b5a5626
diff --git a/src/common/vector_math.h b/src/common/vector_math.hindex a57d86d880..7ca8e15f56 100644--- a/src/common/vector_math.h+++ b/src/common/vector_math.h@@ -186,6 +186,18 @@ Vec2<T> operator*(const V& f, const Vec2<T>& vec) {typedef Vec2<float> Vec2f;+template <>+inline float Vec2<float>::Length() const {+ return std::sqrt(x * x + y * y);+}++template <>+inline float Vec2<float>::Normalize() {+ float length = Length();+ *this /= length;+ return length;+}+template <typename T>class Vec3 {public:@@ -388,6 +400,13 @@ inline Vec3<float> Vec3<float>::Normalized() const {return *this / Length();}+template <>+inline float Vec3<float>::Normalize() {+ float length = Length();+ *this /= length;+ return length;+}+typedef Vec3<float> Vec3f;template <typename T>