More work on exposing wrap modes to marching cubes.

This commit is contained in:
Daviw Williams 2012-12-14 15:25:21 +01:00
parent c06bfa9c09
commit ca45d49e0c
4 changed files with 28 additions and 7 deletions

View File

@ -77,10 +77,10 @@ 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<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2;
m_eWrapMode = WrapModes::Border;
m_tBorder = 0;
:m_tThreshold(((std::numeric_limits<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2)
,m_eWrapMode(WrapModes::Border)
,m_tBorder(VoxelType(0))
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -89,12 +89,12 @@ namespace PolyVox
/// This version of the constructor allows you to set some custom parameters
/// \param tThreshold The threshold to use.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DefaultMarchingCubesController(DensityType tThreshold)
/*DefaultMarchingCubesController(DensityType tThreshold)
{
m_tThreshold = tThreshold;
m_eWrapMode = WrapModes::Border;
m_tBorder = 0;
}
}*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Converts the underlying voxel type into a density value.
@ -135,6 +135,16 @@ namespace PolyVox
return m_eWrapMode;
}
VoxelType getBorderValue(void)
{
return m_tBorder;
}
void setThreshold(DensityType tThreshold)
{
m_tThreshold = tThreshold;
}
void setWrapMode(WrapMode eWrapMode, VoxelType tBorder = VoxelType(0))
{
m_eWrapMode = eWrapMode;

View File

@ -184,6 +184,11 @@ namespace PolyVox
return m_eWrapMode;
}
void setThreshold(DensityType tThreshold)
{
m_tThreshold = tThreshold;
}
void setWrapMode(WrapMode eWrapMode)
{
m_eWrapMode = eWrapMode;

View File

@ -148,6 +148,11 @@ namespace PolyVox
return m_eWrapMode;
}
void setThreshold(DensityType tThreshold)
{
m_tThreshold = tThreshold;
}
void setWrapMode(WrapMode eWrapMode)
{
m_eWrapMode = eWrapMode;

View File

@ -127,7 +127,8 @@ void testForType(SurfaceMesh<PositionMaterialNormal>& result)
}
}
DefaultMarchingCubesController<VoxelType> controller(50);
DefaultMarchingCubesController<VoxelType> controller;
controller.setThreshold(50);
MarchingCubesSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, volData.getEnclosingRegion(), &result, controller);
extractor.execute();
}