Work on Block class.
This commit is contained in:
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
@ -29,9 +30,20 @@ namespace PolyVox
|
||||
//If this is not the case then the output is undefined.
|
||||
uint8 logBase2(uint32 uInput)
|
||||
{
|
||||
//Debug mode error handling
|
||||
assert(uInput != 0);
|
||||
assert(isPowerOf2(uInput));
|
||||
|
||||
//Release mode error handling
|
||||
if(uInput == 0)
|
||||
{
|
||||
throw std::invalid_argument("Cannot compute the log of zero.");
|
||||
}
|
||||
if(!isPowerOf2(uInput))
|
||||
{
|
||||
throw std::invalid_argument("Input must be a power of two in order to compute the log.");
|
||||
}
|
||||
|
||||
uint32 uResult = 0;
|
||||
while( (uInput >> uResult) != 0)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace PolyVox
|
||||
m_uVolumeSideLengthInRegions = volumeData->getSideLength() / m_uRegionSideLength;
|
||||
m_uRegionSideLengthPower = PolyVox::logBase2(m_uRegionSideLength);
|
||||
|
||||
volRegionLastModified = new Block<int32>(m_uRegionSideLengthPower);
|
||||
volRegionLastModified = new Block<int32>(m_uRegionSideLength);
|
||||
}
|
||||
|
||||
VolumeChangeTracker::~VolumeChangeTracker()
|
||||
|
Reference in New Issue
Block a user