Fixed incorrect threshold calculation for floats.

This commit is contained in:
David Williams 2014-08-18 22:06:44 +02:00
parent e2051ed713
commit c75b0d58ce

View File

@ -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. * 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) DefaultMarchingCubesController(void)
:m_tThreshold(((std::numeric_limits<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2)
{ {
if (std::is_signed<DensityType>())
{
m_tThreshold = DensityType(0);
}
else
{
m_tThreshold = (((std::numeric_limits<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2);
}
} }
/** /**