From ad5cc799a4a649f155c3c9de6cc9d5cd856bc222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Mon, 22 Aug 2022 20:30:45 -0700 Subject: [PATCH] Added numeric min/max for type. --- examples/18-ibl/ibl.cpp | 6 +++--- examples/28-wireframe/wireframe.cpp | 6 +++--- examples/37-gpudrivenrendering/gpudrivenrendering.cpp | 6 +++--- examples/common/example-glue.cpp | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/18-ibl/ibl.cpp b/examples/18-ibl/ibl.cpp index ee7d7b5ef..1a98c16d9 100644 --- a/examples/18-ibl/ibl.cpp +++ b/examples/18-ibl/ibl.cpp @@ -213,7 +213,7 @@ struct Camera const bx::Vec3 toTarget = bx::sub(m_target.dest, m_pos.dest); const float toTargetLen = bx::length(toTarget); - const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatMin); + const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatSmallest); const bx::Vec3 toTargetNorm = bx::mul(toTarget, invToTargetLen); float delta = toTargetLen * _dz; @@ -235,7 +235,7 @@ struct Camera const bx::Vec3 toPos = bx::sub(m_pos.curr, m_target.curr); const float toPosLen = bx::length(toPos); - const float invToPosLen = 1.0f / (toPosLen + bx::kFloatMin); + const float invToPosLen = 1.0f / (toPosLen + bx::kFloatSmallest); const bx::Vec3 toPosNorm = bx::mul(toPos, invToPosLen); float ll[2]; @@ -265,7 +265,7 @@ struct Camera { const bx::Vec3 toTarget = bx::sub(m_target.curr, m_pos.curr); const float toTargetLen = bx::length(toTarget); - const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatMin); + const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatSmallest); const bx::Vec3 toTargetNorm = bx::mul(toTarget, invToTargetLen); const bx::Vec3 right = bx::normalize(bx::cross({ 0.0f, 1.0f, 0.0f }, toTargetNorm) ); diff --git a/examples/28-wireframe/wireframe.cpp b/examples/28-wireframe/wireframe.cpp index c689db042..d7e39bbba 100644 --- a/examples/28-wireframe/wireframe.cpp +++ b/examples/28-wireframe/wireframe.cpp @@ -57,7 +57,7 @@ struct Camera const bx::Vec3 toTarget = bx::sub(m_target.dest, m_pos.dest); const float toTargetLen = bx::length(toTarget); - const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatMin); + const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatSmallest); const bx::Vec3 toTargetNorm = bx::mul(toTarget, invToTargetLen); float delta = toTargetLen * _dz; @@ -79,7 +79,7 @@ struct Camera const bx::Vec3 toPos = bx::sub(m_pos.curr, m_target.curr); const float toPosLen = bx::length(toPos); - const float invToPosLen = 1.0f / (toPosLen + bx::kFloatMin); + const float invToPosLen = 1.0f / (toPosLen + bx::kFloatSmallest); const bx::Vec3 toPosNorm = bx::mul(toPos, invToPosLen); float ll[2]; @@ -109,7 +109,7 @@ struct Camera { const bx::Vec3 toTarget = bx::sub(m_target.curr, m_pos.curr); const float toTargetLen = bx::length(toTarget); - const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatMin); + const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatSmallest); const bx::Vec3 toTargetNorm = bx::mul(toTarget, invToTargetLen); const bx::Vec3 right = bx::normalize(bx::cross({ 0.0f, 1.0f, 0.0f }, toTargetNorm) ); diff --git a/examples/37-gpudrivenrendering/gpudrivenrendering.cpp b/examples/37-gpudrivenrendering/gpudrivenrendering.cpp index 1653c8a21..7e338d1ff 100644 --- a/examples/37-gpudrivenrendering/gpudrivenrendering.cpp +++ b/examples/37-gpudrivenrendering/gpudrivenrendering.cpp @@ -61,7 +61,7 @@ struct Camera const bx::Vec3 toTarget = bx::sub(m_target.dest, m_pos.dest); const float toTargetLen = bx::length(toTarget); - const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatMin); + const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatSmallest); const bx::Vec3 toTargetNorm = bx::mul(toTarget, invToTargetLen); float delta = toTargetLen * _dz; @@ -83,7 +83,7 @@ struct Camera const bx::Vec3 toPos = bx::sub(m_pos.curr, m_target.curr); const float toPosLen = bx::length(toPos); - const float invToPosLen = 1.0f / (toPosLen + bx::kFloatMin); + const float invToPosLen = 1.0f / (toPosLen + bx::kFloatSmallest); const bx::Vec3 toPosNorm = bx::mul(toPos, invToPosLen); float ll[2]; @@ -113,7 +113,7 @@ struct Camera { const bx::Vec3 toTarget = bx::sub(m_target.curr, m_pos.curr); const float toTargetLen = bx::length(toTarget); - const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatMin); + const float invToTargetLen = 1.0f / (toTargetLen + bx::kFloatSmallest); const bx::Vec3 toTargetNorm = bx::mul(toTarget, invToTargetLen); const bx::Vec3 right = bx::normalize(bx::cross({ 0.0f, 1.0f, 0.0f }, toTargetNorm) ); diff --git a/examples/common/example-glue.cpp b/examples/common/example-glue.cpp index fd7606351..74ff3719f 100644 --- a/examples/common/example-glue.cpp +++ b/examples/common/example-glue.cpp @@ -35,9 +35,9 @@ struct SampleData m_values[m_offset] = value; m_offset = (m_offset+1) % kNumSamples; - float min = bx::kFloatMax; - float max = -bx::kFloatMax; - float avg = 0.0f; + float min = bx::max(); + float max = bx::min(); + float avg = 0.0f; for (uint32_t ii = 0; ii < kNumSamples; ++ii) {