summaryrefslogtreecommitdiffstats
path: root/core/math/vector4i.cpp
diff options
context:
space:
mode:
authorVolTer <mew.pur.pur@abv.bg>2022-09-24 14:20:06 +0200
committerVolTer <mew.pur.pur@abv.bg>2022-11-19 06:18:55 +0100
commite26f0906f229f237ad22d5b1986c1669b354b791 (patch)
tree81736e67b8393ef0f9fadce2eb29905c25125f32 /core/math/vector4i.cpp
parenta1bc636098c91ed47a8d9a23e07a4c85b64c1884 (diff)
downloadredot-engine-e26f0906f229f237ad22d5b1986c1669b354b791.tar.gz
Implement snappedi, snappedf, and Vector[2/3/4]i.snapped
Diffstat (limited to 'core/math/vector4i.cpp')
-rw-r--r--core/math/vector4i.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/math/vector4i.cpp b/core/math/vector4i.cpp
index 77f6fbd5b7..e906ab45ad 100644
--- a/core/math/vector4i.cpp
+++ b/core/math/vector4i.cpp
@@ -65,6 +65,14 @@ Vector4i Vector4i::clamp(const Vector4i &p_min, const Vector4i &p_max) const {
CLAMP(w, p_min.w, p_max.w));
}
+Vector4i Vector4i::snapped(const Vector4i &p_step) const {
+ return Vector4i(
+ Math::snapped(x, p_step.x),
+ Math::snapped(y, p_step.y),
+ Math::snapped(z, p_step.z),
+ Math::snapped(w, p_step.w));
+}
+
Vector4i::operator String() const {
return "(" + itos(x) + ", " + itos(y) + ", " + itos(z) + ", " + itos(w) + ")";
}