summaryrefslogtreecommitdiffstats
path: root/src/math/Vector.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-03-28 16:47:20 +0100
committerGitHub <noreply@github.com>2020-03-28 16:47:20 +0100
commita58bceb1a736dd76fbdaee8747276fe755755d1a (patch)
treedae35ada030479401faa42b0d518e460c1635406 /src/math/Vector.h
parentCCam fix (diff)
parentWaterCannon uv macros (diff)
downloadre3-a58bceb1a736dd76fbdaee8747276fe755755d1a.tar
re3-a58bceb1a736dd76fbdaee8747276fe755755d1a.tar.gz
re3-a58bceb1a736dd76fbdaee8747276fe755755d1a.tar.bz2
re3-a58bceb1a736dd76fbdaee8747276fe755755d1a.tar.lz
re3-a58bceb1a736dd76fbdaee8747276fe755755d1a.tar.xz
re3-a58bceb1a736dd76fbdaee8747276fe755755d1a.tar.zst
re3-a58bceb1a736dd76fbdaee8747276fe755755d1a.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;