diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 51dd24e4..6517dea8 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) openGLWidget.show(); //Create an empty volume and then place a sphere in it - Volume volData(64, 64, 64); + Volume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); createSphereInVolume(volData, 30); //Extract the surface diff --git a/examples/OpenGL/main.cpp b/examples/OpenGL/main.cpp index 7e5e8fab..c5e656f6 100644 --- a/examples/OpenGL/main.cpp +++ b/examples/OpenGL/main.cpp @@ -72,7 +72,7 @@ void exampleLog(string message, int severity) int main(int argc, char *argv[]) { logHandler = &exampleLog; - Volume volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); + Volume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1))); //Make our volume contain a sphere in the center. int32_t minPos = 0; diff --git a/library/PolyVoxCore/include/Volume.h b/library/PolyVoxCore/include/Volume.h index 71eb31d3..1c1af008 100644 --- a/library/PolyVoxCore/include/Volume.h +++ b/library/PolyVoxCore/include/Volume.h @@ -146,14 +146,10 @@ namespace PolyVox bool bPagingEnabled = false, uint16_t uBlockSideLength = 32 ); - /// Constructor + /// Deprecated constructor - do not use. Volume ( - int32_t uWidth, int32_t uHeight, int32_t uDepth, - polyvox_function&, const Region&)> dataRequiredHandler = 0, - polyvox_function&, const Region&)> dataOverflowHandler = 0, - bool bPagingEnabled = false, - uint16_t uBlockSideLength = 32 + int32_t dont_use_this_constructor_1, int32_t dont_use_this_constructor_2, int32_t dont_use_this_constructor_3 ); /// Destructor ~Volume(); diff --git a/library/PolyVoxCore/include/Volume.inl b/library/PolyVoxCore/include/Volume.inl index cf3c0188..90e1fb20 100644 --- a/library/PolyVoxCore/include/Volume.inl +++ b/library/PolyVoxCore/include/Volume.inl @@ -78,19 +78,19 @@ namespace PolyVox template Volume::Volume ( - int32_t uWidth, int32_t uHeight, int32_t uDepth, - polyvox_function&, const Region&)> dataRequiredHandler, - polyvox_function&, const Region&)> dataOverflowHandler, - bool bPagingEnabled, - uint16_t uBlockSideLength + int32_t dont_use_this_constructor_1, int32_t dont_use_this_constructor_2, int32_t dont_use_this_constructor_3 ) { - m_funcDataRequiredHandler = dataRequiredHandler; - m_funcDataOverflowHandler = dataOverflowHandler; - m_bPagingEnabled = bPagingEnabled; - - Region regValid(Vector3DInt32(0,0,0), Vector3DInt32(uWidth - 1,uHeight - 1,uDepth - 1)); - resize(Region(Vector3DInt32(0,0,0), Vector3DInt32(uWidth - 1,uHeight - 1,uDepth - 1)), uBlockSideLength); + //In earlier verions of PolyVox the constructor took three values indicating width, height, and depth. However, this + //causes confusion because these three parameters can be interpreted as two function pointers and a block size instead, + //hence calling a different constructor. And simply removing this constructor will cause confusion because existing + //code with three parameters will then always resolve to the constructor with two function pointers and a block size. + // + //Eventually this constructor will be removed, it's just here to make people change their code to the new version. + // + //IF YOU HIT THIS ASSERT/ABORT, CHANGE YOUR CODE TO USE THE CONSTRUCTOR TAKING A 'Region' INSTEAD. + assert(false); + abort(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/tests/testvolume.cpp b/tests/testvolume.cpp index 39ea2b41..06375c7a 100644 --- a/tests/testvolume.cpp +++ b/tests/testvolume.cpp @@ -32,7 +32,7 @@ using namespace PolyVox; void TestVolume::testSize() { const int32_t g_uVolumeSideLength = 128; - Volume volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); + Volume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1))); //Note: Deliberatly go past each edge by one to test if the bounds checking works. for (int32_t z = 0; z < g_uVolumeSideLength + 1; z++)