diff --git a/include/Nazara/Math/Algorithm.hpp b/include/Nazara/Math/Algorithm.hpp index 44b2a3f1b..9cd10ef59 100644 --- a/include/Nazara/Math/Algorithm.hpp +++ b/include/Nazara/Math/Algorithm.hpp @@ -20,6 +20,10 @@ #define M_SQRT2 1.4142135623730950488016887 #endif +#ifndef M_SQRT3 +#define M_SQRT3 1.7320508075688772935274463 +#endif + template T NzApproach(T value, T objective, T increment); template constexpr T NzClamp(T value, T min, T max); template T NzCountBits(T value); diff --git a/src/Nazara/Graphics/Light.cpp b/src/Nazara/Graphics/Light.cpp index 150aa4c5d..ce1b5f2bb 100644 --- a/src/Nazara/Graphics/Light.cpp +++ b/src/Nazara/Graphics/Light.cpp @@ -194,7 +194,7 @@ void NzLight::MakeBoundingVolume() const case nzLightType_Point: { - NzVector3f radius(m_radius); ///FIXME: Incorrect + NzVector3f radius(m_radius * M_SQRT3); m_boundingVolume.Set(-radius, radius); break; } diff --git a/src/Nazara/Physics/Geom.cpp b/src/Nazara/Physics/Geom.cpp index 77952dfef..188df7d25 100644 --- a/src/Nazara/Physics/Geom.cpp +++ b/src/Nazara/Physics/Geom.cpp @@ -400,7 +400,7 @@ m_radius(radius) NzBoxf NzSphereGeom::ComputeAABB(const NzMatrix4f& offsetMatrix, const NzVector3f& scale) const { - NzVector3f size(m_radius * scale); + NzVector3f size(m_radius * M_SQRT3 * scale); NzVector3f position(offsetMatrix.GetTranslation()); return NzBoxf(position - size, position + size);