From db81e1bc3f751e4d142ce1cbb5d565b05c73510b Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 15 Oct 2011 00:01:17 +0100 Subject: [PATCH] Work on simple interface. --- examples/Basic/main.cpp | 6 +++--- .../include/PolyVoxCore/SimpleInterface.h | 20 ++++++------------- .../PolyVoxCore/source/SimpleInterface.cpp | 10 ++++++++-- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 04f9c3b6..944a17e3 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -30,7 +30,7 @@ freely, subject to the following restrictions: //Use the PolyVox namespace using namespace PolyVox; -void createSphereInVolume(BasicVolume& volData, float fRadius) +void createSphereInVolume(Volume& volData, float fRadius) { //This vector hold the position of the center of the volume Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2); @@ -75,11 +75,11 @@ int main(int argc, char *argv[]) openGLWidget.show(); //Create an empty volume and then place a sphere in it - BasicVolume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); + Volume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); createSphereInVolume(volData, 30); //Extract the surface - BasicMesh mesh; + Mesh mesh; //CubicSurfaceExtractorWithNormals surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); //surfaceExtractor.execute(); extractCubicMesh(volData, volData.getEnclosingRegion(), mesh); diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleInterface.h b/library/PolyVoxCore/include/PolyVoxCore/SimpleInterface.h index eb8123b2..ff5ac761 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleInterface.h +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleInterface.h @@ -24,28 +24,20 @@ freely, subject to the following restrictions: #ifndef __PolyVox_SimpleInterface_H__ #define __PolyVox_SimpleInterface_H__ -//Available voxel types -#include "PolyVoxCore\Density.h" -#include "PolyVoxCore\Material.h" -#include "PolyVoxCore\MaterialDensityPair.h" - -//Available volumes -#include "PolyVoxCore\LargeVolume.h" -#include "PolyVoxCore\RawVolume.h" -#include "PolyVoxCore\SimpleVolume.h" - -//Available extractors #include "PolyVoxCore\CubicSurfaceExtractorWithNormals.h" +#include "PolyVoxCore\MaterialDensityPair.h" +#include "PolyVoxCore\SimpleVolume.h" #include "PolyVoxCore\SurfaceExtractor.h" namespace PolyVox { //The PolyVox simple interface only exposes one voxel type and one volume type. But if you like you can //adjust these typedefs and rebuild the library in order to modify which one volume and voxel is exposed. - typedef SimpleVolume BasicVolume; - typedef SurfaceMesh BasicMesh; + typedef SimpleVolume Volume; + typedef SurfaceMesh Mesh; - void extractCubicMesh(BasicVolume& volume, const Region& region, BasicMesh& resultMesh); + void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh); + void extractSmoothMesh(Volume& volume, const Region& region, Mesh& resultMesh); } diff --git a/library/PolyVoxCore/source/SimpleInterface.cpp b/library/PolyVoxCore/source/SimpleInterface.cpp index 2a863928..710aa3e4 100644 --- a/library/PolyVoxCore/source/SimpleInterface.cpp +++ b/library/PolyVoxCore/source/SimpleInterface.cpp @@ -18,16 +18,22 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source - distribution. + distribution. *******************************************************************************/ #include "PolyVoxCore\SimpleInterface.h" namespace PolyVox { - void extractCubicMesh(BasicVolume& volume, const Region& region, BasicMesh& resultMesh) + void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh) { CubicSurfaceExtractorWithNormals surfaceExtractor(&volume, region, &resultMesh); surfaceExtractor.execute(); } + + void extractSmoothMesh(Volume& volume, const Region& region, Mesh& resultMesh) + { + SurfaceExtractor surfaceExtractor(&volume, region, &resultMesh); + surfaceExtractor.execute(); + } }