More validation of block sizes.
This commit is contained in:
		| @@ -177,12 +177,18 @@ namespace PolyVox | ||||
| 	void SimpleVolume<VoxelType>::resize(const Region& regValidRegion, uint16_t uBlockSideLength) | ||||
| 	{ | ||||
| 		//Debug mode validation | ||||
| 		assert(uBlockSideLength > 0); | ||||
| 		assert(uBlockSideLength >= 8); | ||||
| 		assert(uBlockSideLength <= 256); | ||||
| 		assert(isPowerOf2(uBlockSideLength)); | ||||
| 		 | ||||
| 		//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)) | ||||
| 		{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user