More validation of block sizes.
This commit is contained in:
parent
e7f7e980b4
commit
15cd5d90f4
@ -177,12 +177,18 @@ namespace PolyVox
|
|||||||
void SimpleVolume<VoxelType>::resize(const Region& regValidRegion, uint16_t uBlockSideLength)
|
void SimpleVolume<VoxelType>::resize(const Region& regValidRegion, uint16_t uBlockSideLength)
|
||||||
{
|
{
|
||||||
//Debug mode validation
|
//Debug mode validation
|
||||||
assert(uBlockSideLength > 0);
|
assert(uBlockSideLength >= 8);
|
||||||
|
assert(uBlockSideLength <= 256);
|
||||||
|
assert(isPowerOf2(uBlockSideLength));
|
||||||
|
|
||||||
//Release mode validation
|
//Release mode validation
|
||||||
if(uBlockSideLength == 0)
|
if(uBlockSideLength < 8)
|
||||||
{
|
{
|
||||||
throw std::invalid_argument("Block side length cannot be zero.");
|
throw std::invalid_argument("Block side length should be at least 8");
|
||||||
|
}
|
||||||
|
if(uBlockSideLength > 256)
|
||||||
|
{
|
||||||
|
throw std::invalid_argument("Block side length should not be more than 256");
|
||||||
}
|
}
|
||||||
if(!isPowerOf2(uBlockSideLength))
|
if(!isPowerOf2(uBlockSideLength))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user