diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-06 18:26:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-06 18:26:04 +0200 |
commit | b991fd9766c77354454c76c906f7806680605500 (patch) | |
tree | f7425645eb83088646a72b713cd08a665947650e /src/math/Vector.h | |
parent | Implement Init for Stats (diff) | |
parent | fixed look behind bug (diff) | |
download | re3-b991fd9766c77354454c76c906f7806680605500.tar re3-b991fd9766c77354454c76c906f7806680605500.tar.gz re3-b991fd9766c77354454c76c906f7806680605500.tar.bz2 re3-b991fd9766c77354454c76c906f7806680605500.tar.lz re3-b991fd9766c77354454c76c906f7806680605500.tar.xz re3-b991fd9766c77354454c76c906f7806680605500.tar.zst re3-b991fd9766c77354454c76c906f7806680605500.zip |
Diffstat (limited to 'src/math/Vector.h')
-rw-r--r-- | src/math/Vector.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h index cd436123..6f544ada 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -38,6 +38,14 @@ public: }else x = 1.0f; } + + void Normalise(float norm) { + float sq = MagnitudeSqr(); + float invsqrt = RecipSqrt(norm, sq); + x *= invsqrt; + y *= invsqrt; + z *= invsqrt; + } const CVector &operator+=(CVector const &right) { x += right.x; |