Renamed extractXxxSurface() to extractXxxMesh()
This commit is contained in:
parent
f8ce3a5f3d
commit
ab741583e4
@ -77,12 +77,12 @@ int main(int argc, char *argv[])
|
|||||||
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
||||||
createSphereInVolume(volData, 30);
|
createSphereInVolume(volData, 30);
|
||||||
|
|
||||||
// Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see.
|
// 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 = extractCubicSurface(&volData, volData.getEnclosingRegion());
|
auto mesh = extractCubicMesh(&volData, volData.getEnclosingRegion());
|
||||||
//auto mesh = extractMarchingCubesSurface(&volData, volData.getEnclosingRegion());
|
//auto mesh = extractMarchingCubesMesh(&volData, volData.getEnclosingRegion());
|
||||||
|
|
||||||
//auto mesh = extractCubicSurface(&volData, PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(31, 31, 31)));
|
//auto mesh = extractCubicMesh(&volData, PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(31, 31, 31)));
|
||||||
//auto mesh2 = extractCubicSurface(&volData, PolyVox::Region(Vector3DInt32(32, 32, 32), Vector3DInt32(63, 63, 63)));
|
//auto mesh2 = extractCubicMesh(&volData, PolyVox::Region(Vector3DInt32(32, 32, 32), Vector3DInt32(63, 63, 63)));
|
||||||
|
|
||||||
//Pass the surface to the OpenGL window
|
//Pass the surface to the OpenGL window
|
||||||
openGLWidget.setSurfaceMeshToRender(mesh);
|
openGLWidget.setSurfaceMeshToRender(mesh);
|
||||||
|
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
|||||||
std::cout << "Compression ratio: 1 to " << (1.0/(volData.calculateCompressionRatio())) << std::endl;
|
std::cout << "Compression ratio: 1 to " << (1.0/(volData.calculateCompressionRatio())) << std::endl;
|
||||||
|
|
||||||
//Extract the surface
|
//Extract the surface
|
||||||
auto mesh = extractCubicSurface(&volData, reg);
|
auto mesh = extractCubicMesh(&volData, reg);
|
||||||
std::cout << "#vertices: " << mesh.getNoOfVertices() << std::endl;
|
std::cout << "#vertices: " << mesh.getNoOfVertices() << std::endl;
|
||||||
|
|
||||||
//Pass the surface to the OpenGL window
|
//Pass the surface to the OpenGL window
|
||||||
|
@ -90,11 +90,11 @@ int main(int argc, char *argv[])
|
|||||||
volumeResampler.execute();
|
volumeResampler.execute();
|
||||||
|
|
||||||
//Extract the surface
|
//Extract the surface
|
||||||
auto meshLowLOD = extractMarchingCubesSurface(&volDataLowLOD, volDataLowLOD.getEnclosingRegion());
|
auto meshLowLOD = extractMarchingCubesMesh(&volDataLowLOD, volDataLowLOD.getEnclosingRegion());
|
||||||
meshLowLOD.scaleVertices(/*2.0f*/63.0f / 31.0f);
|
meshLowLOD.scaleVertices(/*2.0f*/63.0f / 31.0f);
|
||||||
|
|
||||||
//Extract the surface
|
//Extract the surface
|
||||||
auto meshHighLOD = extractMarchingCubesSurface(&volData, PolyVox::Region(Vector3DInt32(30, 0, 0), Vector3DInt32(63, 63, 63)));
|
auto meshHighLOD = extractMarchingCubesMesh(&volData, PolyVox::Region(Vector3DInt32(30, 0, 0), Vector3DInt32(63, 63, 63)));
|
||||||
meshHighLOD.translateVertices(Vector3DFloat(30, 0, 0));
|
meshHighLOD.translateVertices(Vector3DFloat(30, 0, 0));
|
||||||
|
|
||||||
//Pass the surface to the OpenGL window
|
//Pass the surface to the OpenGL window
|
||||||
|
@ -159,7 +159,7 @@ namespace PolyVox
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename VolumeType, typename IsQuadNeeded>
|
template<typename VolumeType, typename IsQuadNeeded>
|
||||||
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > extractCubicSurface(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, bool bMergeQuads, IsQuadNeeded isQuadNeeded)
|
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > extractCubicMesh(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, bool bMergeQuads, IsQuadNeeded isQuadNeeded)
|
||||||
{
|
{
|
||||||
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > result;
|
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > result;
|
||||||
CubicSurfaceExtractor<VolumeType, IsQuadNeeded> extractor(volData, region, &result, eWrapMode, tBorderValue, bMergeQuads, isQuadNeeded);
|
CubicSurfaceExtractor<VolumeType, IsQuadNeeded> extractor(volData, region, &result, eWrapMode, tBorderValue, bMergeQuads, isQuadNeeded);
|
||||||
@ -171,13 +171,13 @@ namespace PolyVox
|
|||||||
// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template
|
// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template
|
||||||
// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?
|
// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > extractCubicSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), bool bMergeQuads = true)
|
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > extractCubicMesh(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), bool bMergeQuads = true)
|
||||||
#else
|
#else
|
||||||
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > extractCubicSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), bool bMergeQuads = true)
|
SurfaceMesh<CubicVertex<typename VolumeType::VoxelType> > extractCubicMesh(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), bool bMergeQuads = true)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DefaultIsQuadNeeded<typename VolumeType::VoxelType> isQuadNeeded;
|
DefaultIsQuadNeeded<typename VolumeType::VoxelType> isQuadNeeded;
|
||||||
return extractCubicSurface<VolumeType, DefaultIsQuadNeeded<typename VolumeType::VoxelType> >(volData, region, eWrapMode, tBorderValue, bMergeQuads, isQuadNeeded);
|
return extractCubicMesh<VolumeType, DefaultIsQuadNeeded<typename VolumeType::VoxelType> >(volData, region, eWrapMode, tBorderValue, bMergeQuads, isQuadNeeded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ namespace PolyVox
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< typename VolumeType, typename Controller>
|
template< typename VolumeType, typename Controller>
|
||||||
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, Controller controller)
|
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > extractMarchingCubesMesh(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, Controller controller)
|
||||||
{
|
{
|
||||||
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > result;
|
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > result;
|
||||||
MarchingCubesSurfaceExtractor<VolumeType, Controller> extractor(volData, region, &result, eWrapMode, tBorderValue, controller);
|
MarchingCubesSurfaceExtractor<VolumeType, Controller> extractor(volData, region, &result, eWrapMode, tBorderValue, controller);
|
||||||
@ -224,13 +224,13 @@ namespace PolyVox
|
|||||||
// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template
|
// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template
|
||||||
// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?
|
// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType())
|
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > extractMarchingCubesMesh(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType())
|
||||||
#else
|
#else
|
||||||
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType())
|
SurfaceMesh<MarchingCubesVertex<typename VolumeType::VoxelType> > extractMarchingCubesMesh(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DefaultMarchingCubesController<typename VolumeType::VoxelType> controller;
|
DefaultMarchingCubesController<typename VolumeType::VoxelType> controller;
|
||||||
return extractMarchingCubesSurface(volData, region, eWrapMode, tBorderValue, controller);
|
return extractMarchingCubesMesh(volData, region, eWrapMode, tBorderValue, controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ uint32_t testForType(void)
|
|||||||
{
|
{
|
||||||
Region regionToExtract(x, y, z, x + uRegionSideLength - 1, y + uRegionSideLength - 1, z + uRegionSideLength - 1);
|
Region regionToExtract(x, y, z, x + uRegionSideLength - 1, y + uRegionSideLength - 1, z + uRegionSideLength - 1);
|
||||||
|
|
||||||
auto result = extractCubicSurface(&volData, regionToExtract);
|
auto result = extractCubicMesh(&volData, regionToExtract);
|
||||||
|
|
||||||
uTotalVertices += result.getNoOfVertices();
|
uTotalVertices += result.getNoOfVertices();
|
||||||
uTotalIndices += result.getNoOfIndices();
|
uTotalIndices += result.getNoOfIndices();
|
||||||
|
@ -128,7 +128,7 @@ SurfaceMesh<MarchingCubesVertex<VoxelType> > testForType(void) //I think we coul
|
|||||||
DefaultMarchingCubesController<VoxelType> controller;
|
DefaultMarchingCubesController<VoxelType> controller;
|
||||||
controller.setThreshold(50);
|
controller.setThreshold(50);
|
||||||
|
|
||||||
auto result = extractMarchingCubesSurface(&volData, volData.getEnclosingRegion(), WrapModes::Border, VoxelType(), controller);
|
auto result = extractMarchingCubesMesh(&volData, volData.getEnclosingRegion(), WrapModes::Border, VoxelType(), controller);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void TestVolumeSubclass::testExtractSurface()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = extractCubicSurface(&volumeSubclass, volumeSubclass.getEnclosingRegion());
|
auto result = extractCubicMesh(&volumeSubclass, volumeSubclass.getEnclosingRegion());
|
||||||
|
|
||||||
QCOMPARE(result.getNoOfVertices(), static_cast<uint32_t>(8));
|
QCOMPARE(result.getNoOfVertices(), static_cast<uint32_t>(8));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user