Compile fixes for Linux.

This commit is contained in:
David Williams 2011-05-01 13:56:35 +01:00
parent 3a171e698b
commit 2e2a2c694c
4 changed files with 9 additions and 20 deletions

View File

@ -337,20 +337,11 @@ namespace PolyVox
uint32_t SimpleVolume<VoxelType>::calculateSizeInBytes(void)
{
uint32_t uSizeInBytes = sizeof(SimpleVolume);
uint32_t uSizeOfBlockInBytes = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength * sizeof(VoxelType);
//Memory used by the blocks
typename std::map<Vector3DInt32, LoadedBlock >::iterator i;
for(i = m_pBlocks.begin(); i != m_pBlocks.end(); i++)
{
//Inaccurate - account for rest of loaded block.
uSizeInBytes += i->second.block.calculateSizeInBytes();
}
//Memory used by border data.
if(m_pUncompressedBorderData)
{
uSizeInBytes += m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength * sizeof(VoxelType);
}
//Memory used by the blocks ( + 1 is for border)
uSizeInBytes += uSizeOfBlockInBytes * (m_uNoOfBlocksInVolume + 1);
return uSizeInBytes;
}

View File

@ -126,7 +126,7 @@ namespace PolyVox
template <typename VoxelType>
uint32_t SimpleVolume<VoxelType>::Block::calculateSizeInBytes(void)
{
uint32_t uSizeInBytes = sizeof(Block<VoxelType>);
uint32_t uSizeInBytes = sizeof(Block);
uSizeInBytes += sizeof(VoxelType) * m_uSideLength * m_uSideLength * m_uSideLength;
return uSizeInBytes;
}

View File

@ -58,7 +58,6 @@ namespace PolyVox
// NOTE: These two functions are in the .h file rather than the .inl due to an apparent bug in VC2010.
//See http://stackoverflow.com/questions/1484885/strange-vc-compile-error-c2244 for details.
////////////////////////////////////////////////////////////////////////////////
template< template<typename> class VolumeType, typename VoxelType>
Vector3DFloat computeCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter)
{
uint8_t voxel1nx = volIter.peekVoxel1nx0py0pz().getDensity();
@ -78,7 +77,6 @@ namespace PolyVox
);
}
template< template<typename> class VolumeType, typename VoxelType>
Vector3DFloat computeSobelGradient(const typename VolumeType<VoxelType>::Sampler& volIter)
{
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {

View File

@ -429,14 +429,14 @@ namespace PolyVox
m_sampVolume.setPosition(iXVolSpace,iYVolSpace,iZVolSpace);
const VoxelType v000 = m_sampVolume.getVoxel();
const Vector3DFloat n000 = computeCentralDifferenceGradient<VolumeType, VoxelType>(m_sampVolume);
const Vector3DFloat n000 = computeCentralDifferenceGradient(m_sampVolume);
/* Find the vertices where the surface intersects the cube */
if (edgeTable[iCubeIndex] & 1)
{
m_sampVolume.movePositiveX();
const VoxelType v100 = m_sampVolume.getVoxel();
const Vector3DFloat n100 = computeCentralDifferenceGradient<VolumeType, VoxelType>(m_sampVolume);
const Vector3DFloat n100 = computeCentralDifferenceGradient(m_sampVolume);
//float fInterp = static_cast<float>(v100.getDensity() - VoxelType::getMinDensity()) / static_cast<float>(VoxelType::getMaxDensity() - VoxelType::getMinDensity());
float fInterp = static_cast<float>(VoxelType::getThreshold() - v000.getDensity()) / static_cast<float>(v100.getDensity() - v000.getDensity());
@ -460,7 +460,7 @@ namespace PolyVox
{
m_sampVolume.movePositiveY();
const VoxelType v010 = m_sampVolume.getVoxel();
const Vector3DFloat n010 = computeCentralDifferenceGradient<VolumeType, VoxelType>(m_sampVolume);
const Vector3DFloat n010 = computeCentralDifferenceGradient(m_sampVolume);
float fInterp = static_cast<float>(VoxelType::getThreshold() - v000.getDensity()) / static_cast<float>(v010.getDensity() - v000.getDensity());
//fInterp = 0.5f;
@ -483,7 +483,7 @@ namespace PolyVox
{
m_sampVolume.movePositiveZ();
const VoxelType v001 = m_sampVolume.getVoxel();
const Vector3DFloat n001 = computeCentralDifferenceGradient<VolumeType, VoxelType>(m_sampVolume);
const Vector3DFloat n001 = computeCentralDifferenceGradient(m_sampVolume);
float fInterp = static_cast<float>(VoxelType::getThreshold() - v000.getDensity()) / static_cast<float>(v001.getDensity() - v000.getDensity());
//fInterp = 0.5f;