Work on Volume class.

This commit is contained in:
David Williams
2009-03-24 22:29:39 +00:00
parent d191902db3
commit 5955a29a46
6 changed files with 34 additions and 21 deletions

View File

@ -30,11 +30,11 @@ namespace PolyVox
//If this is not the case then the output is undefined.
uint8 logBase2(uint32 uInput)
{
//Debug mode error handling
//Debug mode validation
assert(uInput != 0);
assert(isPowerOf2(uInput));
//Release mode error handling
//Release mode validation
if(uInput == 0)
{
throw std::invalid_argument("Cannot compute the log of zero.");

View File

@ -19,14 +19,14 @@ namespace PolyVox
stream.read(reinterpret_cast<char*>(&volumeWidthPower), sizeof(volumeWidthPower));
stream.read(reinterpret_cast<char*>(&volumeHeightPower), sizeof(volumeHeightPower));
stream.read(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//FIXME - need to support non cubic volumes
Volume<uint8>* volume = new Volume<uint8>(volumeWidthPower);
uint16 volumeWidth = 0x0001 << volumeWidthPower;
uint16 volumeHeight = 0x0001 << volumeHeightPower;
uint16 volumeDepth = 0x0001 << volumeDepthPower;
//FIXME - need to support non cubic volumes
Volume<uint8>* volume = new Volume<uint8>(volumeWidth);
//Read data
for(uint16 z = 0; z < volumeDepth; ++z)
{
@ -87,14 +87,14 @@ namespace PolyVox
stream.read(reinterpret_cast<char*>(&volumeWidthPower), sizeof(volumeWidthPower));
stream.read(reinterpret_cast<char*>(&volumeHeightPower), sizeof(volumeHeightPower));
stream.read(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//FIXME - need to support non cubic volumes
Volume<uint8>* volume = new Volume<uint8>(volumeWidthPower);
uint16 volumeWidth = 0x0001 << volumeWidthPower;
uint16 volumeHeight = 0x0001 << volumeHeightPower;
uint16 volumeDepth = 0x0001 << volumeDepthPower;
//FIXME - need to support non cubic volumes
Volume<uint8>* volume = new Volume<uint8>(volumeWidth);
//Read data
bool firstTime = true;
uint32 runLength = 0;