Renamed Block to BlockData. Introduced new Block class which can be shared.
This commit is contained in:
parent
a9ab2f2d4d
commit
fab64488ee
@ -17,8 +17,8 @@ SET(CORE_SRC_FILES
|
||||
|
||||
#Projects headers files
|
||||
SET(CORE_INC_FILES
|
||||
include/PolyVoxCore/Block.h
|
||||
include/PolyVoxCore/Block.inl
|
||||
include/PolyVoxCore/BlockData.h
|
||||
include/PolyVoxCore/BlockData.inl
|
||||
include/PolyVoxCore/Constants.h
|
||||
include/PolyVoxCore/Enums.h
|
||||
include/PolyVoxCore/GradientEstimators.h
|
||||
|
@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
******************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef __PolyVox_Block_H__
|
||||
#define __PolyVox_Block_H__
|
||||
#ifndef __PolyVox_BlockData_H__
|
||||
#define __PolyVox_BlockData_H__
|
||||
|
||||
#pragma region Headers
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
@ -31,16 +31,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
class Block
|
||||
class BlockData
|
||||
{
|
||||
//Make VolumeIterator a friend
|
||||
friend class VolumeIterator<VoxelType>;
|
||||
public:
|
||||
Block(uint8 uSideLength);
|
||||
Block(const Block& rhs);
|
||||
~Block();
|
||||
BlockData(uint8 uSideLength);
|
||||
BlockData(const BlockData& rhs);
|
||||
~BlockData();
|
||||
|
||||
Block& operator=(const Block& rhs);
|
||||
BlockData& operator=(const BlockData& rhs);
|
||||
|
||||
uint16 getSideLength(void) const;
|
||||
VoxelType getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const;
|
||||
@ -52,12 +52,12 @@ namespace PolyVox
|
||||
void fill(VoxelType tValue);
|
||||
|
||||
private:
|
||||
uint8 m_uSideLengthPower;
|
||||
uint16 m_uSideLength;
|
||||
uint8 m_uSideLengthPower;
|
||||
VoxelType* m_tData;
|
||||
};
|
||||
}
|
||||
|
||||
#include "Block.inl"
|
||||
#include "BlockData.inl"
|
||||
|
||||
#endif
|
@ -31,7 +31,7 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>::Block(uint8 uSideLength)
|
||||
BlockData<VoxelType>::BlockData(uint8 uSideLength)
|
||||
:m_tData(0)
|
||||
{
|
||||
//Debug mode validation
|
||||
@ -40,7 +40,7 @@ namespace PolyVox
|
||||
//Release mode validation
|
||||
if(!isPowerOf2(uSideLength))
|
||||
{
|
||||
throw std::invalid_argument("Block side length must be a power of two.");
|
||||
throw std::invalid_argument("BlockData side length must be a power of two.");
|
||||
}
|
||||
|
||||
//Compute the side length
|
||||
@ -53,13 +53,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>::Block(const Block<VoxelType>& rhs)
|
||||
BlockData<VoxelType>::BlockData(const BlockData<VoxelType>& rhs)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>::~Block()
|
||||
BlockData<VoxelType>::~BlockData()
|
||||
{
|
||||
delete[] m_tData;
|
||||
m_tData = 0;
|
||||
@ -68,26 +68,30 @@ namespace PolyVox
|
||||
|
||||
#pragma region Operators
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>& Block<VoxelType>::operator=(const Block<VoxelType>& rhs)
|
||||
BlockData<VoxelType>& BlockData<VoxelType>::operator=(const BlockData<VoxelType>& rhs)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
m_uSideLength = rhs.m_uSideLength;
|
||||
m_uSideLengthPower = rhs.m_uSideLengthPower;
|
||||
memcpy(m_tData, rhs.m_tData, m_uSideLength * m_uSideLength * m_uSideLength);
|
||||
|
||||
return *this;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
uint16 Block<VoxelType>::getSideLength(void) const
|
||||
uint16 BlockData<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType Block<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
|
||||
VoxelType BlockData<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
|
||||
{
|
||||
assert(uXPos < m_uSideLength);
|
||||
assert(uYPos < m_uSideLength);
|
||||
@ -102,7 +106,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType Block<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
|
||||
VoxelType BlockData<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
|
||||
{
|
||||
return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
|
||||
}
|
||||
@ -110,7 +114,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Setters
|
||||
template <typename VoxelType>
|
||||
void Block<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
|
||||
void BlockData<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
|
||||
{
|
||||
assert(uXPos < m_uSideLength);
|
||||
assert(uYPos < m_uSideLength);
|
||||
@ -125,7 +129,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void Block<VoxelType>::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue)
|
||||
void BlockData<VoxelType>::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue)
|
||||
{
|
||||
setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue);
|
||||
}
|
||||
@ -133,7 +137,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Other
|
||||
template <typename VoxelType>
|
||||
void Block<VoxelType>::fill(VoxelType tValue)
|
||||
void BlockData<VoxelType>::fill(VoxelType tValue)
|
||||
{
|
||||
memset(m_tData, tValue, m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType));
|
||||
}
|
@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType> class Block;
|
||||
template <typename VoxelType> class BlockData;
|
||||
|
||||
//---------- Volume ----------
|
||||
template <typename VoxelType> class Volume;
|
||||
|
@ -32,6 +32,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
class Block
|
||||
{
|
||||
public:
|
||||
BlockData<VoxelType>* m_pBlockData;
|
||||
VoxelType m_pHomogenousValue;
|
||||
bool m_pIsShared;
|
||||
bool m_pIsPotentiallySharable;
|
||||
};
|
||||
|
||||
template <typename VoxelType>
|
||||
class Volume
|
||||
{
|
||||
@ -53,21 +63,20 @@ namespace PolyVox
|
||||
void setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue);
|
||||
void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue);
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, uint16 boundary) const;
|
||||
VolumeIterator<VoxelType> firstVoxel(void);
|
||||
void idle(uint32 uAmount);
|
||||
bool isRegionHomogenous(const Region& region);
|
||||
VolumeIterator<VoxelType> lastVoxel(void);
|
||||
|
||||
private:
|
||||
Block<VoxelType>* getHomogenousBlock(VoxelType tHomogenousValue) const;
|
||||
BlockData<VoxelType>* getHomogenousBlock(VoxelType tHomogenousValue) const;
|
||||
|
||||
Block<VoxelType>** m_pBlocks;
|
||||
bool* m_pIsShared;
|
||||
bool* m_pIsPotentiallySharable;
|
||||
VoxelType* m_pHomogenousValue;
|
||||
mutable std::map<VoxelType, Block<VoxelType>*> m_pHomogenousBlocks;
|
||||
//Block<VoxelType>** m_pBlocks;
|
||||
//bool* m_pIsShared;
|
||||
//bool* m_pIsPotentiallySharable;
|
||||
//VoxelType* m_pHomogenousValue;
|
||||
Block<VoxelType>* m_pBlocks;
|
||||
mutable std::map<VoxelType, BlockData<VoxelType>*> m_pHomogenousBlocks;
|
||||
|
||||
uint32 m_uNoOfBlocksInVolume;
|
||||
uint16 m_uSideLengthInBlocks;
|
||||
|
@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Headers
|
||||
#include "Block.h"
|
||||
#include "BlockData.h"
|
||||
#include "VolumeIterator.h"
|
||||
#include "Region.h"
|
||||
#include "Vector.h"
|
||||
@ -70,7 +70,7 @@ namespace PolyVox
|
||||
m_uNoOfBlocksInVolume = m_uSideLengthInBlocks * m_uSideLengthInBlocks * m_uSideLengthInBlocks;
|
||||
|
||||
//Create the blocks
|
||||
m_pBlocks = new Block<VoxelType>*[m_uNoOfBlocksInVolume];
|
||||
/*m_pBlocks = new Block<VoxelType>*[m_uNoOfBlocksInVolume];
|
||||
m_pIsShared = new bool[m_uNoOfBlocksInVolume];
|
||||
m_pIsPotentiallySharable = new bool[m_uNoOfBlocksInVolume];
|
||||
m_pHomogenousValue = new VoxelType[m_uNoOfBlocksInVolume];
|
||||
@ -80,6 +80,15 @@ namespace PolyVox
|
||||
m_pIsShared[i] = true;
|
||||
m_pIsPotentiallySharable[i] = false;
|
||||
m_pHomogenousValue[i] = 0;
|
||||
}*/
|
||||
|
||||
m_pBlocks = new Block<VoxelType>[m_uNoOfBlocksInVolume];
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
m_pBlocks[i].m_pBlockData = getHomogenousBlock(0);
|
||||
m_pBlocks[i].m_pIsShared = true;
|
||||
m_pBlocks[i].m_pIsPotentiallySharable = false;
|
||||
m_pBlocks[i].m_pHomogenousValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,8 +103,16 @@ namespace PolyVox
|
||||
{
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
delete m_pBlocks[i];
|
||||
if(m_pBlocks[i].m_pIsShared == false)
|
||||
{
|
||||
delete m_pBlocks[i].m_pBlockData;
|
||||
m_pBlocks[i].m_pBlockData = 0;
|
||||
}
|
||||
}
|
||||
delete[] m_pBlocks;
|
||||
/*delete[] m_pIsShared;
|
||||
delete[] m_pIsPotentiallySharable;
|
||||
delete[] m_pHomogenousValue;*/
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@ -103,33 +120,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
Volume<VoxelType>& Volume<VoxelType>::operator=(const Volume& rhs)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*for(uint16 i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||
{
|
||||
//FIXME - Add checking...
|
||||
m_pBlocks[i] = SharedPtr<Block>(new Block);
|
||||
}*/
|
||||
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
//I think this is OK... If a block is in the homogeneous array it's ref count will be greater
|
||||
//than 1 as there will be the pointer in the volume and the pointer in the static homogeneous array.
|
||||
/*if(rhs.m_pBlocks[i].unique())
|
||||
{
|
||||
m_pBlocks[i] = SharedPtr<Block>(new Block(*(rhs.m_pBlocks[i])));
|
||||
}
|
||||
else
|
||||
{*/
|
||||
//we have a block in the homogeneous array - just copy the pointer.
|
||||
m_pBlocks[i] = rhs.m_pBlocks[i];
|
||||
//}
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@ -161,12 +152,12 @@ namespace PolyVox
|
||||
const uint16 yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
|
||||
const uint16 zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
|
||||
|
||||
const Block<VoxelType>* block = m_pBlocks
|
||||
const BlockData<VoxelType>* block = m_pBlocks
|
||||
[
|
||||
blockX +
|
||||
blockY * m_uSideLengthInBlocks +
|
||||
blockZ * m_uSideLengthInBlocks * m_uSideLengthInBlocks
|
||||
];
|
||||
].m_pBlockData;
|
||||
|
||||
return block->getVoxelAt(xOffset,yOffset,zOffset);
|
||||
}
|
||||
@ -199,23 +190,24 @@ namespace PolyVox
|
||||
blockY * m_uSideLengthInBlocks +
|
||||
blockZ * m_uSideLengthInBlocks * m_uSideLengthInBlocks;
|
||||
|
||||
const bool bIsShared = m_pIsShared[uBlockIndex];
|
||||
const VoxelType tHomogenousValue = m_pHomogenousValue[uBlockIndex];
|
||||
const bool bIsShared = m_pBlocks[uBlockIndex].m_pIsShared;
|
||||
if(bIsShared)
|
||||
{
|
||||
const VoxelType tHomogenousValue = m_pBlocks[uBlockIndex].m_pHomogenousValue;
|
||||
if(tHomogenousValue != tValue)
|
||||
{
|
||||
m_pBlocks[uBlockIndex] = new Block<VoxelType>(m_uBlockSideLength);
|
||||
m_pIsShared[uBlockIndex] = false;
|
||||
m_pBlocks[uBlockIndex]->fill(tHomogenousValue);
|
||||
m_pBlocks[uBlockIndex]->setVoxelAt(xOffset,yOffset,zOffset, tValue);
|
||||
m_pBlocks[uBlockIndex].m_pBlockData = new BlockData<VoxelType>(m_uBlockSideLength);
|
||||
m_pBlocks[uBlockIndex].m_pIsShared = false;
|
||||
m_pBlocks[uBlockIndex].m_pBlockData->fill(tHomogenousValue);
|
||||
m_pBlocks[uBlockIndex].m_pBlockData->setVoxelAt(xOffset,yOffset,zOffset, tValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//There is a chance that setting this voxel makes the block homogenous and therefore shareable.
|
||||
m_pIsPotentiallySharable[uBlockIndex] = true;
|
||||
m_pBlocks[uBlockIndex]->setVoxelAt(xOffset,yOffset,zOffset, tValue);
|
||||
{
|
||||
m_pBlocks[uBlockIndex].m_pBlockData->setVoxelAt(xOffset,yOffset,zOffset, tValue);
|
||||
//There is a chance that setting this voxel makes the block homogenous and therefore shareable. But checking
|
||||
//this will take some time, so for now just set a flag.
|
||||
m_pBlocks[uBlockIndex].m_pIsPotentiallySharable = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,28 +219,6 @@ namespace PolyVox
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Other
|
||||
template <typename VoxelType>
|
||||
bool Volume<VoxelType>::containsPoint(const Vector3DFloat& pos, float boundary) const
|
||||
{
|
||||
return (pos.getX() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getY() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getZ() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getX() >= boundary)
|
||||
&& (pos.getY() >= boundary)
|
||||
&& (pos.getZ() >= boundary);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool Volume<VoxelType>::containsPoint(const Vector3DInt32& pos, uint16 boundary) const
|
||||
{
|
||||
return (pos.getX() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getY() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getZ() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getX() >= boundary)
|
||||
&& (pos.getY() >= boundary)
|
||||
&& (pos.getZ() >= boundary);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VolumeIterator<VoxelType> Volume<VoxelType>::firstVoxel(void)
|
||||
{
|
||||
@ -295,17 +265,17 @@ namespace PolyVox
|
||||
|
||||
#pragma region Private Implementation
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>* Volume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
|
||||
BlockData<VoxelType>* Volume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
|
||||
{
|
||||
typename std::map<VoxelType, Block<VoxelType>*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue);
|
||||
typename std::map<VoxelType, BlockData<VoxelType>*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue);
|
||||
if(iterResult == m_pHomogenousBlocks.end())
|
||||
{
|
||||
Block<VoxelType>* pBlock = new Block<VoxelType>(m_uBlockSideLength);
|
||||
BlockData<VoxelType>* pBlock = new BlockData<VoxelType>(m_uBlockSideLength);
|
||||
pBlock->fill(tHomogenousValue);
|
||||
m_pHomogenousBlocks.insert(std::make_pair(tHomogenousValue, pBlock));
|
||||
return pBlock;
|
||||
}
|
||||
return iterResult->second;
|
||||
return iterResult->second;
|
||||
}
|
||||
#pragma endregion
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Headers
|
||||
#include "Block.h"
|
||||
#include "BlockData.h"
|
||||
#include "Volume.h"
|
||||
#include "Vector.h"
|
||||
#include "Region.h"
|
||||
@ -201,7 +201,7 @@ namespace PolyVox
|
||||
mBlockIndexInVolume = mXBlock +
|
||||
mYBlock * mVolume.m_uSideLengthInBlocks +
|
||||
mZBlock * mVolume.m_uSideLengthInBlocks * mVolume.m_uSideLengthInBlocks;
|
||||
Block<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
BlockData<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume].m_pBlockData;
|
||||
|
||||
mVoxelIndexInBlock = mXPosInBlock +
|
||||
mYPosInBlock * mVolume.m_uBlockSideLength +
|
||||
@ -257,7 +257,7 @@ namespace PolyVox
|
||||
mVoxelIndexInBlock = mXPosInBlock +
|
||||
mYPosInBlock * mVolume.m_uBlockSideLength +
|
||||
mZPosInBlock * mVolume.m_uBlockSideLength * mVolume.m_uBlockSideLength;
|
||||
Block<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
BlockData<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
mCurrentVoxel = currentBlock->m_tData + mVoxelIndexInBlock;
|
||||
|
||||
mYPosInBlock++;
|
||||
@ -270,7 +270,7 @@ namespace PolyVox
|
||||
mVoxelIndexInBlock = mXPosInBlock +
|
||||
mYPosInBlock * mVolume.m_uBlockSideLength +
|
||||
mZPosInBlock * mVolume.m_uBlockSideLength * mVolume.m_uBlockSideLength;
|
||||
Block<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
BlockData<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
mCurrentVoxel = currentBlock->m_tData + mVoxelIndexInBlock;
|
||||
|
||||
mZPosInBlock++;
|
||||
@ -309,7 +309,7 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
Block<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
BlockData<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
//mCurrentBlock = mVolume->m_pBlocks[mBlockIndexInVolume];
|
||||
|
||||
mXPosInVolume = (std::max)(mXRegionFirst,uint16(mXBlock * mVolume.m_uBlockSideLength));
|
||||
|
@ -70,7 +70,7 @@ namespace PolyVox
|
||||
|
||||
//It's not what the block class was designed for, but it
|
||||
//provides a handy way of storing a 3D grid of values.
|
||||
Block<int32>* volRegionLastModified;
|
||||
BlockData<int32>* volRegionLastModified;
|
||||
|
||||
static int32 m_iCurrentTime;
|
||||
};
|
||||
|
@ -20,8 +20,8 @@ namespace PolyVox
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
//Check all corners are within the volume, allowing a boundary for gradient estimation
|
||||
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,2);
|
||||
bool upperCornerInside = volumeData->containsPoint(v3dFloor+Vector3DInt32(1,1,1),2);
|
||||
bool lowerCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor,2);
|
||||
bool upperCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor+Vector3DInt32(1,1,1),2);
|
||||
|
||||
if(lowerCornerInside && upperCornerInside) //If this test fails the vertex will be left as it was
|
||||
{
|
||||
|
@ -30,8 +30,8 @@ namespace PolyVox
|
||||
const Vector3DFloat& v3dRem = v3dPos - static_cast<Vector3DFloat>(v3dFloor);
|
||||
|
||||
//Check all corners are within the volume, allowing a boundary for gradient estimation
|
||||
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,2);
|
||||
bool upperCornerInside = volumeData->containsPoint(v3dFloor+Vector3DInt32(1,1,1),2);
|
||||
bool lowerCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor,2);
|
||||
bool upperCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor+Vector3DInt32(1,1,1),2);
|
||||
|
||||
if(lowerCornerInside && upperCornerInside) //If this test fails the vertex will be left as it was
|
||||
{
|
||||
@ -90,8 +90,8 @@ namespace PolyVox
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
//Check all corners are within the volume, allowing a boundary for gradient estimation
|
||||
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,1);
|
||||
bool upperCornerInside = volumeData->containsPoint(v3dFloor+Vector3DInt32(1,1,1),1);
|
||||
bool lowerCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor,1);
|
||||
bool upperCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor+Vector3DInt32(1,1,1),1);
|
||||
|
||||
if(lowerCornerInside && upperCornerInside) //If this test fails the vertex will be left as it was
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace PolyVox
|
||||
m_uVolumeSideLengthInRegions = volumeData->getSideLength() / m_uRegionSideLength;
|
||||
m_uRegionSideLengthPower = PolyVox::logBase2(m_uRegionSideLength);
|
||||
|
||||
volRegionLastModified = new Block<int32>(m_uRegionSideLength);
|
||||
volRegionLastModified = new BlockData<int32>(m_uRegionSideLength);
|
||||
}
|
||||
|
||||
VolumeChangeTracker::~VolumeChangeTracker()
|
||||
|
Loading…
x
Reference in New Issue
Block a user