summaryrefslogtreecommitdiffstats
path: root/src/math/Vector.h
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2020-03-28 15:02:44 +0100
committerFire-Head <Fire-Head@users.noreply.github.com>2020-03-28 15:02:44 +0100
commit3366cd0ff80c7770ef280858992b7c707f0890d2 (patch)
tree1075a403ebeafc73f7c4eddf671d72d761921f10 /src/math/Vector.h
parentMerge pull request #356 from blingu/master (diff)
downloadre3-3366cd0ff80c7770ef280858992b7c707f0890d2.tar
re3-3366cd0ff80c7770ef280858992b7c707f0890d2.tar.gz
re3-3366cd0ff80c7770ef280858992b7c707f0890d2.tar.bz2
re3-3366cd0ff80c7770ef280858992b7c707f0890d2.tar.lz
re3-3366cd0ff80c7770ef280858992b7c707f0890d2.tar.xz
re3-3366cd0ff80c7770ef280858992b7c707f0890d2.tar.zst
re3-3366cd0ff80c7770ef280858992b7c707f0890d2.zip
Diffstat (limited to 'src/math/Vector.h')
-rw-r--r--src/math/Vector.h8
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;