Made the parameter of snap and snapped in Vector3 const reference.

This commit is contained in:
Relintai 2023-05-27 11:12:31 +02:00
parent 5cb00f3622
commit 2b24871814
2 changed files with 4 additions and 4 deletions

View File

@ -51,12 +51,12 @@ real_t Vector3::get_axis(int p_axis) const {
return operator[](p_axis);
}
void Vector3::snap(Vector3 p_val) {
void Vector3::snap(const Vector3 &p_val) {
x = Math::stepify(x, p_val.x);
y = Math::stepify(y, p_val.y);
z = Math::stepify(z, p_val.z);
}
Vector3 Vector3::snapped(Vector3 p_val) const {
Vector3 Vector3::snapped(const Vector3 &p_val) const {
Vector3 v = *this;
v.snap(p_val);
return v;

View File

@ -90,8 +90,8 @@ struct _NO_DISCARD_CLASS_ Vector3 {
_FORCE_INLINE_ void zero();
void snap(Vector3 p_val);
Vector3 snapped(Vector3 p_val) const;
void snap(const Vector3 &p_val);
Vector3 snapped(const Vector3 &p_val) const;
void rotate(const Vector3 &p_axis, real_t p_phi);
Vector3 rotated(const Vector3 &p_axis, real_t p_phi) const;