Added initial loading progress dialog.
This commit is contained in:
parent
b4d9351f1b
commit
5e2b8156c9
@ -33,7 +33,7 @@ namespace PolyVox
|
||||
POLYVOXUTIL_API Volume<uint8_t>* loadVolumeRaw(std::istream& stream);
|
||||
POLYVOXUTIL_API void saveVolumeRaw(std::ostream& stream, Volume<uint8_t>& volume);
|
||||
|
||||
POLYVOXUTIL_API Volume<uint8_t>* loadVolumeRle(std::istream& stream);
|
||||
POLYVOXUTIL_API Volume<uint8_t>* loadVolumeRle(std::istream& stream, void (*pCallback)(float) = 0);
|
||||
POLYVOXUTIL_API void saveVolumeRle(std::ostream& stream, Volume<uint8_t>& volume);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace PolyVox
|
||||
|
||||
//Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller.
|
||||
//FIXME - think about pointer ownership issues. Or could return volume by value if the copy constructor is shallow
|
||||
Volume<uint8_t>* loadVolumeRle(istream& stream)
|
||||
Volume<uint8_t>* loadVolumeRle(istream& stream, void (*pCallback)(float))
|
||||
{
|
||||
//Read volume dimensions
|
||||
uint8_t volumeWidthPower = 0;
|
||||
@ -103,6 +103,13 @@ namespace PolyVox
|
||||
stream.read(reinterpret_cast<char*>(&runLength), sizeof(runLength));
|
||||
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 x = 0; x < volumeWidth; ++x)
|
||||
@ -124,6 +131,11 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
//Finished
|
||||
if(pCallback)
|
||||
{
|
||||
pCallback(1.0f);
|
||||
}
|
||||
return volume;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user