Wrapped MarchingCubesSurfaceExtractor with functions (part of unclassing).
This commit is contained in:
@ -77,8 +77,9 @@ int main(int argc, char *argv[])
|
||||
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
||||
createSphereInVolume(volData, 30);
|
||||
|
||||
// Extract the surface for the specified region of the volume.
|
||||
auto mesh = extractCubicSurfaceWithNormals(&volData, volData.getEnclosingRegion());
|
||||
// Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see.
|
||||
//auto mesh = extractCubicSurfaceWithNormals(&volData, volData.getEnclosingRegion());
|
||||
auto mesh = extractMarchingCubesSurface(&volData, volData.getEnclosingRegion());
|
||||
|
||||
//Pass the surface to the OpenGL window
|
||||
openGLWidget.setSurfaceMeshToRender(mesh);
|
||||
|
@ -210,6 +210,22 @@ namespace PolyVox
|
||||
//Our threshold value
|
||||
typename Controller::DensityType m_tThreshold;
|
||||
};
|
||||
|
||||
template< typename VolumeType, typename Controller>
|
||||
SurfaceMesh<PositionMaterialNormal> extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, Controller controller)
|
||||
{
|
||||
SurfaceMesh<PositionMaterialNormal> result;
|
||||
MarchingCubesSurfaceExtractor<VolumeType, Controller> extractor(volData, region, &result, eWrapMode, tBorderValue, controller);
|
||||
extractor.execute();
|
||||
return result;
|
||||
}
|
||||
|
||||
template< typename VolumeType>
|
||||
SurfaceMesh<PositionMaterialNormal> extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType())
|
||||
{
|
||||
DefaultMarchingCubesController<typename VolumeType::VoxelType> controller;
|
||||
return extractMarchingCubesSurface(volData, region, eWrapMode, tBorderValue, controller);
|
||||
}
|
||||
}
|
||||
|
||||
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.inl"
|
||||
|
Reference in New Issue
Block a user