diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 64097731..65814645 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -81,11 +81,14 @@ int main(int argc, char *argv[]) SurfaceMesh mesh; //Create a surface extractor. Comment out one of the following two lines to decide which type gets created. - CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); + //CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); //MarchingCubesSurfaceExtractor< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); //Execute the surface extractor. - surfaceExtractor.execute(); + //surfaceExtractor.execute(); + + DefaultIsQuadNeeded< uint8_t > isQuadNeeded; + mesh = extractCubicSurfaceWithNormals< SimpleVolume, DefaultIsQuadNeeded< uint8_t > >(&volData, volData.getEnclosingRegion(), WrapModes::Border, 0, isQuadNeeded); //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(mesh); diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h index 211734f0..9fc44d7c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h @@ -63,6 +63,15 @@ namespace PolyVox WrapMode m_eWrapMode; typename VolumeType::VoxelType m_tBorderValue; }; + + template + SurfaceMesh extractCubicSurfaceWithNormals(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, IsQuadNeeded isQuadNeeded) + { + SurfaceMesh result; + CubicSurfaceExtractorWithNormals extractor(volData, region, &result, eWrapMode, tBorderValue, isQuadNeeded); + extractor.execute(); + return result; + } } #include "PolyVoxCore/CubicSurfaceExtractorWithNormals.inl"