From c75b0d58ce96e310ca10435d251cc4ed2a657ff0 Mon Sep 17 00:00:00 2001 From: David Williams Date: Mon, 18 Aug 2014 22:06:44 +0200 Subject: [PATCH] Fixed incorrect threshold calculation for floats. --- .../PolyVoxCore/DefaultMarchingCubesController.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h b/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h index 6a7aaa22..2d1b6144 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h +++ b/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h @@ -75,8 +75,15 @@ namespace PolyVox * if the voxel type is 'float' then the representable range is -FLT_MAX to FLT_MAX and the threshold will be set to zero. */ DefaultMarchingCubesController(void) - :m_tThreshold(((std::numeric_limits::min)() + (std::numeric_limits::max)()) / 2) - { + { + if (std::is_signed()) + { + m_tThreshold = DensityType(0); + } + else + { + m_tThreshold = (((std::numeric_limits::min)() + (std::numeric_limits::max)()) / 2); + } } /**