Allow clamping vectors and colors

This commit is contained in:
Aaron Franke 2021-02-01 00:10:52 -05:00
parent 94bc0bd919
commit 2e13e3ed4a
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
19 changed files with 190 additions and 0 deletions

View file

@ -48,6 +48,13 @@ int Vector3i::max_axis() const {
return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0);
}
Vector3i Vector3i::clamp(const Vector3i &p_min, const Vector3i &p_max) const {
return Vector3i(
CLAMP(x, p_min.x, p_max.x),
CLAMP(y, p_min.y, p_max.y),
CLAMP(z, p_min.z, p_max.z));
}
Vector3i::operator String() const {
return (itos(x) + ", " + itos(y) + ", " + itos(z));
}