Deprecated constructor.

This commit is contained in:
David Williams 2011-03-21 22:17:00 +00:00
parent 8306be728d
commit c7e452f537
5 changed files with 16 additions and 20 deletions

View File

@ -78,7 +78,7 @@ int main(int argc, char *argv[])
openGLWidget.show(); openGLWidget.show();
//Create an empty volume and then place a sphere in it //Create an empty volume and then place a sphere in it
Volume<MaterialDensityPair44> volData(64, 64, 64); Volume<MaterialDensityPair44> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
createSphereInVolume(volData, 30); createSphereInVolume(volData, 30);
//Extract the surface //Extract the surface

View File

@ -72,7 +72,7 @@ void exampleLog(string message, int severity)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
logHandler = &exampleLog; logHandler = &exampleLog;
Volume<MaterialDensityPair44> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); Volume<MaterialDensityPair44> 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. //Make our volume contain a sphere in the center.
int32_t minPos = 0; int32_t minPos = 0;

View File

@ -146,14 +146,10 @@ namespace PolyVox
bool bPagingEnabled = false, bool bPagingEnabled = false,
uint16_t uBlockSideLength = 32 uint16_t uBlockSideLength = 32
); );
/// Constructor /// Deprecated constructor - do not use.
Volume Volume
( (
int32_t uWidth, int32_t uHeight, int32_t uDepth, int32_t dont_use_this_constructor_1, int32_t dont_use_this_constructor_2, int32_t dont_use_this_constructor_3
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler = 0,
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler = 0,
bool bPagingEnabled = false,
uint16_t uBlockSideLength = 32
); );
/// Destructor /// Destructor
~Volume(); ~Volume();

View File

@ -78,19 +78,19 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
Volume<VoxelType>::Volume Volume<VoxelType>::Volume
( (
int32_t uWidth, int32_t uHeight, int32_t uDepth, int32_t dont_use_this_constructor_1, int32_t dont_use_this_constructor_2, int32_t dont_use_this_constructor_3
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler,
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler,
bool bPagingEnabled,
uint16_t uBlockSideLength
) )
{ {
m_funcDataRequiredHandler = dataRequiredHandler; //In earlier verions of PolyVox the constructor took three values indicating width, height, and depth. However, this
m_funcDataOverflowHandler = dataOverflowHandler; //causes confusion because these three parameters can be interpreted as two function pointers and a block size instead,
m_bPagingEnabled = bPagingEnabled; //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.
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); //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();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -32,7 +32,7 @@ using namespace PolyVox;
void TestVolume::testSize() void TestVolume::testSize()
{ {
const int32_t g_uVolumeSideLength = 128; const int32_t g_uVolumeSideLength = 128;
Volume<uint8_t> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); Volume<uint8_t> 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. //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++) for (int32_t z = 0; z < g_uVolumeSideLength + 1; z++)