Minor Optimization to Occlusion Culling

This commit is contained in:
Rudolph Bester 2025-07-12 20:54:53 +02:00
parent c81fd6c512
commit 56e04635a7
5 changed files with 32 additions and 47 deletions

View file

@ -45,20 +45,6 @@ Vector3 Vector3::rotated(const Vector3 &p_axis, real_t p_angle) const {
return r;
}
Vector3 Vector3::clamp(const Vector3 &p_min, const Vector3 &p_max) const {
return Vector3(
CLAMP(x, p_min.x, p_max.x),
CLAMP(y, p_min.y, p_max.y),
CLAMP(z, p_min.z, p_max.z));
}
Vector3 Vector3::clampf(real_t p_min, real_t p_max) const {
return Vector3(
CLAMP(x, p_min, p_max),
CLAMP(y, p_min, p_max),
CLAMP(z, p_min, p_max));
}
void Vector3::snap(const Vector3 &p_step) {
x = Math::snapped(x, p_step.x);
y = Math::snapped(y, p_step.y);

View file

@ -93,6 +93,20 @@ struct [[nodiscard]] Vector3 {
return Vector3(MAX(x, p_scalar), MAX(y, p_scalar), MAX(z, p_scalar));
}
Vector3 clamp(const Vector3 &p_min, const Vector3 &p_max) const {
return Vector3(
CLAMP(x, p_min.x, p_max.x),
CLAMP(y, p_min.y, p_max.y),
CLAMP(z, p_min.z, p_max.z));
}
Vector3 clampf(real_t p_min, real_t p_max) const {
return Vector3(
CLAMP(x, p_min, p_max),
CLAMP(y, p_min, p_max),
CLAMP(z, p_min, p_max));
}
_FORCE_INLINE_ real_t length() const;
_FORCE_INLINE_ real_t length_squared() const;
@ -138,8 +152,6 @@ struct [[nodiscard]] Vector3 {
_FORCE_INLINE_ Vector3 sign() const;
_FORCE_INLINE_ Vector3 ceil() const;
_FORCE_INLINE_ Vector3 round() const;
Vector3 clamp(const Vector3 &p_min, const Vector3 &p_max) const;
Vector3 clampf(real_t p_min, real_t p_max) const;
_FORCE_INLINE_ real_t distance_to(const Vector3 &p_to) const;
_FORCE_INLINE_ real_t distance_squared_to(const Vector3 &p_to) const;