diff --git a/libs/image/src/ImageSampler.cpp b/libs/image/src/ImageSampler.cpp index d922e505bc..cf5e521b18 100644 --- a/libs/image/src/ImageSampler.cpp +++ b/libs/image/src/ImageSampler.cpp @@ -32,14 +32,14 @@ using namespace image; namespace { +using namespace filament::math; + struct FilterFunction { float (*fn)(float) = nullptr; float boundingRadius = 1; bool rejectExternalSamples = true; }; -constexpr float M_PIf = float(filament::math::F_PI); - const FilterFunction Box { .fn = [](float t) { return t <= 0.5f ? 1.0f : 0.0f; }, .boundingRadius = 1 @@ -50,7 +50,7 @@ const FilterFunction Nearest { Box.fn, 0.0f }; const FilterFunction Gaussian { .fn = [](float t) { if (t >= 2.0) return 0.0f; - const float scale = 1.0f / std::sqrt(0.5f * M_PIf); + const float scale = 1.0f / std::sqrt(0.5f * f::PI); return std::exp(-2.0f * t * t) * scale; }, .boundingRadius = 2 @@ -86,7 +86,7 @@ const FilterFunction Mitchell { // Not bothering with a fast approximation since we cache results for each row. float sinc(float t) { if (t <= 0.00001f) return 1.0f; - return std::sin(M_PIf * t) / (M_PIf * t); + return std::sin(f::PI * t) / (f::PI * t); } const FilterFunction Lanczos {