From 462295cf8b47ebded06bb00a001929b225db39f4 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 16 Oct 2011 23:03:04 +0100 Subject: [PATCH] Switched BasicExample back to 'advanced' API (not SimpleInterface). --- examples/Basic/main.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 944a17e3..5674948c 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -23,14 +23,17 @@ freely, subject to the following restrictions: #include "OpenGLWidget.h" -#include "PolyVoxCore/SimpleInterface.h" +#include "PolyVoxCore/MaterialDensityPair.h" +#include "PolyVoxCore/CubicSurfaceExtractorWithNormals.h" +#include "PolyVoxCore/SurfaceMesh.h" +#include "PolyVoxCore/SimpleVolume.h" #include //Use the PolyVox namespace using namespace PolyVox; -void createSphereInVolume(Volume& volData, float fRadius) +void createSphereInVolume(SimpleVolume& 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); @@ -51,10 +54,10 @@ void createSphereInVolume(Volume& volData, float fRadius) if(fDistToCenter <= fRadius) { //Our new density value - uint8_t uDensity = MaterialDensityPair88::getMaxDensity(); + uint8_t uDensity = MaterialDensityPair44::getMaxDensity(); //Get the old voxel - MaterialDensityPair88 voxel = volData.getVoxelAt(x,y,z); + MaterialDensityPair44 voxel = volData.getVoxelAt(x,y,z); //Modify the density voxel.setDensity(uDensity); @@ -75,14 +78,13 @@ int main(int argc, char *argv[]) openGLWidget.show(); //Create an empty volume and then place a sphere in it - Volume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); + SimpleVolume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); createSphereInVolume(volData, 30); //Extract the surface - Mesh mesh; - //CubicSurfaceExtractorWithNormals surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); - //surfaceExtractor.execute(); - extractCubicMesh(volData, volData.getEnclosingRegion(), mesh); + SurfaceMesh mesh; + CubicSurfaceExtractorWithNormals surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); + surfaceExtractor.execute(); //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(mesh);