mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Allow clamping vectors and colors
This commit is contained in:
parent
94bc0bd919
commit
2e13e3ed4a
19 changed files with 190 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue