Integrating new Region class with algorithms.
This commit is contained in:
@ -45,6 +45,7 @@ namespace PolyVox
|
||||
|
||||
BlockVolume& operator=(const BlockVolume& rhs);
|
||||
|
||||
Region getEnclosingRegion(void);
|
||||
boost::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const;
|
||||
VoxelType getVoxelAt(const Vector3DUint16& v3dPos) const;
|
||||
|
@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#pragma region Headers
|
||||
#include "Block.h"
|
||||
#include "Region.h"
|
||||
#include "Vector.h"
|
||||
|
||||
#include <cassert>
|
||||
@ -119,6 +120,12 @@ namespace PolyVox
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
Region BlockVolume<VoxelType>::getEnclosingRegion(void)
|
||||
{
|
||||
return Region(Vector3DInt32(0,0,0), Vector3DInt32(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1));
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t BlockVolume<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
|
@ -42,6 +42,7 @@ namespace PolyVox
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, boost::uint8_t boundary) const;
|
||||
void cropTo(const Region& other);
|
||||
|
||||
private:
|
||||
Vector3DInt32 m_v3dLowerCorner;
|
||||
|
@ -30,10 +30,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void generateRoughMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, boost::uint16_t regionX, boost::uint16_t regionY, boost::uint16_t regionZ, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch);
|
||||
void generateRoughMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch);
|
||||
Vector3DFloat computeNormal(BlockVolume<boost::uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
|
||||
void generateSmoothMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, boost::uint16_t regionX, boost::uint16_t regionY, boost::uint16_t regionZ, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch);
|
||||
void generateSmoothMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch);
|
||||
Vector3DFloat computeSmoothNormal(BlockVolume<boost::uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace PolyVox
|
||||
VoxelType getVoxel(void) const;
|
||||
|
||||
void setPosition(boost::uint16_t xPos, boost::uint16_t yPos, boost::uint16_t zPos);
|
||||
void setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast);
|
||||
void setValidRegion(const Region& region);
|
||||
void setVoxel(VoxelType tValue);
|
||||
|
||||
bool isValidForRegion(void) const;
|
||||
|
@ -190,15 +190,15 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void VolumeIterator<VoxelType>::setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast)
|
||||
void VolumeIterator<VoxelType>::setValidRegion(const Region& region)
|
||||
{
|
||||
mXRegionFirst = xFirst;
|
||||
mYRegionFirst = yFirst;
|
||||
mZRegionFirst = zFirst;
|
||||
mXRegionFirst = region.getLowerCorner().x();
|
||||
mYRegionFirst = region.getLowerCorner().y();
|
||||
mZRegionFirst = region.getLowerCorner().z();
|
||||
|
||||
mXRegionLast = xLast;
|
||||
mYRegionLast = yLast;
|
||||
mZRegionLast = zLast;
|
||||
mXRegionLast = region.getUpperCorner().x();
|
||||
mYRegionLast = region.getUpperCorner().y();
|
||||
mZRegionLast = region.getUpperCorner().z();
|
||||
|
||||
mXRegionFirstBlock = mXRegionFirst >> mVolume.m_uBlockSideLengthPower;
|
||||
mYRegionFirstBlock = mYRegionFirst >> mVolume.m_uBlockSideLengthPower;
|
||||
|
Reference in New Issue
Block a user