Changed interface to SurfaceExtractor.

This commit is contained in:
David Williams
2010-08-21 20:14:40 +00:00
parent 854c8b6fa4
commit 85e5a27457
5 changed files with 27 additions and 23 deletions

View File

@ -82,11 +82,12 @@ int main(int argc, char *argv[])
createSphereInVolume(volData, 30);
//Extract the surface
SurfaceExtractor<MaterialDensityPair44> surfaceExtractor(volData);
shared_ptr<SurfaceMesh> surface = surfaceExtractor.extractSurfaceForRegion(volData.getEnclosingRegion());
SurfaceMesh mesh;
SurfaceExtractor<MaterialDensityPair44> surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
surfaceExtractor.execute();
//Pass the surface to the OpenGL window
openGLWidget.setSurfaceMeshToRender(*surface);
openGLWidget.setSurfaceMeshToRender(mesh);
//Run the message pump.
return app.exec();

View File

@ -63,8 +63,6 @@ void OpenGLWidget::setVolume(PolyVox::Volume<MaterialDensityPair44>* volData)
m_uVolumeHeightInRegions = volData->getHeight() / m_uRegionSideLength;
m_uVolumeDepthInRegions = volData->getDepth() / m_uRegionSideLength;
SurfaceExtractor<MaterialDensityPair44> surfaceExtractor(*volData);
//Our volume is broken down into cuboid regions, and we create one mesh for each region.
//This three-level for loop iterates over each region.
for(uint16_t uRegionZ = 0; uRegionZ < m_uVolumeDepthInRegions; ++uRegionZ)
@ -90,7 +88,10 @@ void OpenGLWidget::setVolume(PolyVox::Volume<MaterialDensityPair44>* volData)
//Extract the surface for this region
//extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), meshCurrent);
shared_ptr<SurfaceMesh> mesh = surfaceExtractor.extractSurfaceForRegion(PolyVox::Region(regLowerCorner, regUpperCorner));
shared_ptr<SurfaceMesh> mesh(new SurfaceMesh);
SurfaceExtractor<MaterialDensityPair44> surfaceExtractor(volData, PolyVox::Region(regLowerCorner, regUpperCorner), mesh.get());
surfaceExtractor.execute();
//computeNormalsForVertices(m_volData, *(mesh.get()), SOBEL_SMOOTHED);
//*meshCurrent = getSmoothedSurface(*meshCurrent);