Made sure all Thermite stuff is in the Thermite namespace.

This commit is contained in:
David Williams 2009-06-19 21:02:44 +00:00
parent bf26f9c89a
commit a91ff9a10f

View File

@ -30,18 +30,31 @@ namespace PolyVox
//Read data //Read data
for(uint16_t z = 0; z < volumeDepth; ++z) for(uint16_t z = 0; z < volumeDepth; ++z)
{ {
//Update progress once per slice.
if(pCallback)
{
float fProgress = static_cast<float>(z) / static_cast<float>(volumeDepth);
pCallback(fProgress);
}
for(uint16_t y = 0; y < volumeHeight; ++y) for(uint16_t y = 0; y < volumeHeight; ++y)
{ {
for(uint16_t x = 0; x < volumeWidth; ++x) for(uint16_t x = 0; x < volumeWidth; ++x)
{ {
uint8_t value = 0; uint8_t value = 0;
stream.read(reinterpret_cast<char*>(&value), sizeof(value)); stream.read(reinterpret_cast<char*>(&value), sizeof(value));
volume->setVoxelAt(x,y,z,value); volume->setVoxelAt(x,y,z,value);
} }
} }
} }
//Finished
if(pCallback)
{
pCallback(1.0f);
}
return volume; return volume;
} }
@ -64,6 +77,13 @@ namespace PolyVox
VolumeSampler<uint8_t> volIter(&volume); VolumeSampler<uint8_t> volIter(&volume);
for(uint16_t z = 0; z < volumeDepth; ++z) for(uint16_t z = 0; z < volumeDepth; ++z)
{ {
//Update progress once per slice.
if(pCallback)
{
float fProgress = static_cast<float>(z) / static_cast<float>(volumeDepth);
pCallback(fProgress);
}
for(uint16_t y = 0; y < volumeHeight; ++y) for(uint16_t y = 0; y < volumeHeight; ++y)
{ {
for(uint16_t x = 0; x < volumeWidth; ++x) for(uint16_t x = 0; x < volumeWidth; ++x)
@ -74,6 +94,12 @@ namespace PolyVox
} }
} }
} }
//Finished
if(pCallback)
{
pCallback(1.0f);
}
} }
//Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller. //Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller.
@ -136,6 +162,7 @@ namespace PolyVox
{ {
pCallback(1.0f); pCallback(1.0f);
} }
return volume; return volume;
} }
@ -161,6 +188,13 @@ namespace PolyVox
bool firstTime = true; bool firstTime = true;
for(uint16_t z = 0; z < volumeDepth; ++z) for(uint16_t z = 0; z < volumeDepth; ++z)
{ {
//Update progress once per slice.
if(pCallback)
{
float fProgress = static_cast<float>(z) / static_cast<float>(volumeDepth);
pCallback(fProgress);
}
for(uint16_t y = 0; y < volumeHeight; ++y) for(uint16_t y = 0; y < volumeHeight; ++y)
{ {
for(uint16_t x = 0; x < volumeWidth; ++x) for(uint16_t x = 0; x < volumeWidth; ++x)
@ -192,5 +226,11 @@ namespace PolyVox
} }
stream.write(reinterpret_cast<char*>(&current), sizeof(current)); stream.write(reinterpret_cast<char*>(&current), sizeof(current));
stream.write(reinterpret_cast<char*>(&runLength), sizeof(runLength)); stream.write(reinterpret_cast<char*>(&runLength), sizeof(runLength));
//Finished
if(pCallback)
{
pCallback(1.0f);
}
} }
} }