Added support for non-cubic volumes.

This commit is contained in:
David Williams
2009-04-19 22:48:56 +00:00
parent 1f6a3231c1
commit c627c90cd0
9 changed files with 150 additions and 69 deletions

View File

@ -25,7 +25,7 @@ namespace PolyVox
uint16_t volumeDepth = 0x0001 << volumeDepthPower;
//FIXME - need to support non cubic volumes
Volume<uint8_t>* volume = new Volume<uint8_t>(volumeWidth);
Volume<uint8_t>* volume = new Volume<uint8_t>(volumeWidth, volumeHeight, volumeDepth);
//Read data
for(uint16_t z = 0; z < volumeDepth; ++z)
@ -48,9 +48,9 @@ namespace PolyVox
void saveVolumeRaw(std::ostream& stream, Volume<uint8_t>& volume)
{
//Write volume dimensions
uint16_t volumeWidth = volume.getSideLength();
uint16_t volumeHeight = volume.getSideLength();
uint16_t volumeDepth = volume.getSideLength();
uint16_t volumeWidth = volume.getWidth();
uint16_t volumeHeight = volume.getHeight();
uint16_t volumeDepth = volume.getDepth();
uint8_t volumeWidthPower = logBase2(volumeWidth);
uint8_t volumeHeightPower = logBase2(volumeHeight);
@ -93,7 +93,7 @@ namespace PolyVox
uint16_t volumeDepth = 0x0001 << volumeDepthPower;
//FIXME - need to support non cubic volumes
Volume<uint8_t>* volume = new Volume<uint8_t>(volumeWidth);
Volume<uint8_t>* volume = new Volume<uint8_t>(volumeWidth, volumeHeight, volumeDepth);
//Read data
bool firstTime = true;
@ -130,9 +130,9 @@ namespace PolyVox
void saveVolumeRle(std::ostream& stream, Volume<uint8_t>& volume)
{
//Write volume dimensions
uint16_t volumeWidth = volume.getSideLength();
uint16_t volumeHeight = volume.getSideLength();
uint16_t volumeDepth = volume.getSideLength();
uint16_t volumeWidth = volume.getWidth();
uint16_t volumeHeight = volume.getHeight();
uint16_t volumeDepth = volume.getDepth();
uint8_t volumeWidthPower = logBase2(volumeWidth);
uint8_t volumeHeightPower = logBase2(volumeHeight);