diff --git a/engine/inc/math/vec4.hpp b/engine/inc/math/vec4.hpp index 458ee76..29cbf42 100644 --- a/engine/inc/math/vec4.hpp +++ b/engine/inc/math/vec4.hpp @@ -87,6 +87,8 @@ class Vec4 { /** Normalize vector */ void normalize(); + Vec4 getNormalized() const; + /** Returns distance between two vectors */ float distanceTo(const Vec4& v) const; diff --git a/engine/src/math/vec4.cpp b/engine/src/math/vec4.cpp index b73b153..559edf0 100644 --- a/engine/src/math/vec4.cpp +++ b/engine/src/math/vec4.cpp @@ -228,6 +228,12 @@ void Vec4::normalize() { : "r"(this->xyzw)); } +Vec4 Vec4::getNormalized() const { + Vec4 result(*this); + result.normalize(); + return result; +} + float Vec4::distanceTo(const Vec4& v) const { float result; asm volatile(