summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-11-23 12:33:04 +0100
committerMattes D <github@xoft.cz>2014-11-23 12:33:04 +0100
commite9797c6a2a78d1caedc6cc2b6620b34e18a8b41f (patch)
tree2aabeb2ff85f9d8951b9837e132e4dabed9d6108 /src/Vector3.h
parentcWorld: Changed generator defaults. (diff)
parentMerge pull request #1612 from p-mcgowan/pigsIntoZombiePigmenOnLightning (diff)
downloadcuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.tar
cuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.tar.gz
cuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.tar.bz2
cuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.tar.lz
cuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.tar.xz
cuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.tar.zst
cuberite-e9797c6a2a78d1caedc6cc2b6620b34e18a8b41f.zip
Diffstat (limited to 'src/Vector3.h')
-rw-r--r--src/Vector3.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index 1854e42e3..1e4a1f5d9 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -93,6 +93,21 @@ public:
return x * a_Rhs.x + y * a_Rhs.y + z * a_Rhs.z;
}
+ inline void abs()
+ {
+ x = (x < 0) ? -x : x;
+ y = (y < 0) ? -y : y;
+ z = (z < 0) ? -z : z;
+ }
+
+ // We can't use a capital letter, because we wouldn't be able to call the normal Clamp function.
+ inline void clamp(T a_Min, T a_Max)
+ {
+ x = Clamp(x, a_Min, a_Max);
+ y = Clamp(y, a_Min, a_Max);
+ z = Clamp(z, a_Min, a_Max);
+ }
+
inline Vector3<T> Cross(const Vector3<T> & a_Rhs) const
{
return Vector3<T>(