Added compatibility mode.
This commit is contained in:
parent
03a713867f
commit
3c34d401fc
@ -511,11 +511,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//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(256, 256, 256);
|
Volume<MaterialDensityPair44> volData(256, 256, 256);
|
||||||
|
volData.useCompatibilityMode();
|
||||||
//createSphereInVolume(volData, 30);
|
//createSphereInVolume(volData, 30);
|
||||||
createPerlinTerrain(volData);
|
createPerlinTerrain(volData);
|
||||||
//createPerlinVolumeSlow(volData);
|
//createPerlinVolumeSlow(volData);
|
||||||
std::cout << "Memory usage: " << volData.calculateSizeInBytes() << std::endl;
|
std::cout << "Memory usage: " << volData.calculateSizeInBytes() << std::endl;
|
||||||
volData.setBlockCacheSize(8);
|
//volData.setBlockCacheSize(8);
|
||||||
std::cout << "Memory usage: " << volData.calculateSizeInBytes() << std::endl;
|
std::cout << "Memory usage: " << volData.calculateSizeInBytes() << std::endl;
|
||||||
std::cout << "Compression ratio: " << volData.calculateCompressionRatio() << std::endl;
|
std::cout << "Compression ratio: " << volData.calculateCompressionRatio() << std::endl;
|
||||||
|
|
||||||
|
@ -159,6 +159,7 @@ namespace PolyVox
|
|||||||
void clearBlockCache(void);
|
void clearBlockCache(void);
|
||||||
float calculateCompressionRatio(void);
|
float calculateCompressionRatio(void);
|
||||||
uint32_t calculateSizeInBytes(void);
|
uint32_t calculateSizeInBytes(void);
|
||||||
|
void useCompatibilityMode(void);
|
||||||
/// Resizes the volume to the specified dimensions
|
/// Resizes the volume to the specified dimensions
|
||||||
void resize(uint16_t uWidth, uint16_t uHeight, uint16_t uDepth, uint16_t uBlockSideLength = 32);
|
void resize(uint16_t uWidth, uint16_t uHeight, uint16_t uDepth, uint16_t uBlockSideLength = 32);
|
||||||
|
|
||||||
|
@ -463,4 +463,21 @@ namespace PolyVox
|
|||||||
|
|
||||||
return uSizeInBytes;
|
return uSizeInBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename VoxelType>
|
||||||
|
void Volume<VoxelType>::useCompatibilityMode(void)
|
||||||
|
{
|
||||||
|
setBlockCacheSize(m_uNoOfBlocksInVolume * 2); //Times two gives space to spare
|
||||||
|
|
||||||
|
for(uint32_t z = 0; z < m_uDepthInBlocks; z++)
|
||||||
|
{
|
||||||
|
for(uint32_t y = 0; y < m_uHeightInBlocks; y++)
|
||||||
|
{
|
||||||
|
for(uint32_t x = 0; x < m_uWidthInBlocks; x++)
|
||||||
|
{
|
||||||
|
getUncompressedBlock(x,y,z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user