summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-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;