Renamed BlockVolume to Volume.
Renamed BlockVolumeIterator to VolumeIterator.
This commit is contained in:
parent
1dcec5bd3b
commit
d951f4d3b0
@ -2,7 +2,7 @@
|
||||
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(BlockVolume<uint8>& volData, float fRadius, uint8 uValue)
|
||||
void createSphereInVolume(Volume<uint8>& volData, float fRadius, uint8 uValue)
|
||||
{
|
||||
//This vector hold the position of the center of the volume
|
||||
Vector3DFloat v3dVolCenter(volData.getSideLength() / 2, volData.getSideLength() / 2, volData.getSideLength() / 2);
|
||||
@ -30,7 +30,7 @@ void createSphereInVolume(BlockVolume<uint8>& volData, float fRadius, uint8 uVal
|
||||
}
|
||||
}
|
||||
|
||||
void createCubeInVolume(BlockVolume<uint8>& volData, Vector3DUint16 lowerCorner, Vector3DUint16 upperCorner, uint8 uValue)
|
||||
void createCubeInVolume(Volume<uint8>& volData, Vector3DUint16 lowerCorner, Vector3DUint16 upperCorner, uint8 uValue)
|
||||
{
|
||||
//This three-level for loop iterates over every voxel between the specified corners
|
||||
for (int z = lowerCorner.getZ(); z <= upperCorner.getZ(); z++)
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef __OpenGLExample_Shapes_H__
|
||||
#define __OpenGLExample_Shapes_H__
|
||||
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
|
||||
void createSphereInVolume(PolyVox::BlockVolume<PolyVox::uint8>& volData, float fRadius, PolyVox::uint8 uValue);
|
||||
void createCubeInVolume(PolyVox::BlockVolume<PolyVox::uint8>& volData, PolyVox::Vector3DUint16 lowerCorner, PolyVox::Vector3DUint16 upperCorner, PolyVox::uint8 uValue);
|
||||
void createSphereInVolume(PolyVox::Volume<PolyVox::uint8>& volData, float fRadius, PolyVox::uint8 uValue);
|
||||
void createCubeInVolume(PolyVox::Volume<PolyVox::uint8>& volData, PolyVox::Vector3DUint16 lowerCorner, PolyVox::Vector3DUint16 upperCorner, PolyVox::uint8 uValue);
|
||||
|
||||
#endif //__OpenGLExample_Shapes_H__
|
@ -1,4 +1,4 @@
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/SurfaceExtractors.h"
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
@ -42,7 +42,7 @@ int g_frameCounter = 0;
|
||||
bool g_bUseOpenGLVertexBufferObjects;
|
||||
|
||||
//Creates a volume 128x128x128
|
||||
BlockVolume<uint8> g_volData(logBase2(g_uVolumeSideLength));
|
||||
Volume<uint8> g_volData(logBase2(g_uVolumeSideLength));
|
||||
|
||||
//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region
|
||||
OpenGLSurfacePatch g_openGLSurfacePatches[g_uVolumeSideLengthInRegions][g_uVolumeSideLengthInRegions][g_uVolumeSideLengthInRegions];
|
||||
|
@ -24,10 +24,6 @@ SET(CORE_SRC_FILES
|
||||
SET(CORE_INC_FILES
|
||||
include/PolyVoxCore/Block.h
|
||||
include/PolyVoxCore/Block.inl
|
||||
include/PolyVoxCore/BlockVolume.h
|
||||
include/PolyVoxCore/BlockVolume.inl
|
||||
include/PolyVoxCore/BlockVolumeIterator.h
|
||||
include/PolyVoxCore/BlockVolumeIterator.inl
|
||||
include/PolyVoxCore/Constants.h
|
||||
include/PolyVoxCore/Enums.h
|
||||
include/PolyVoxCore/GradientEstimators.h
|
||||
@ -44,6 +40,10 @@ SET(CORE_INC_FILES
|
||||
include/PolyVoxCore/Utility.h
|
||||
include/PolyVoxCore/Vector.h
|
||||
include/PolyVoxCore/Vector.inl
|
||||
include/PolyVoxCore/Volume.h
|
||||
include/PolyVoxCore/Volume.inl
|
||||
include/PolyVoxCore/VolumeIterator.h
|
||||
include/PolyVoxCore/VolumeIterator.inl
|
||||
include/PolyVoxCore/VoxelFilters.h
|
||||
)
|
||||
|
||||
|
@ -33,8 +33,8 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
class Block
|
||||
{
|
||||
//Make BlockVolumeIterator a friend
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
//Make VolumeIterator a friend
|
||||
friend class VolumeIterator<VoxelType>;
|
||||
public:
|
||||
Block(uint8 uSideLengthPower);
|
||||
Block(const Block& rhs);
|
||||
|
@ -22,28 +22,28 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#ifndef __PolyVox_GradientEstimators_H__
|
||||
#define __PolyVox_GradientEstimators_H__
|
||||
|
||||
#include "BlockVolumeIterator.h"
|
||||
#include "VolumeIterator.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter);
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter);
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeDecimatedCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeDecimatedCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter);
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeSobelGradient(const VolumeIterator<VoxelType>& volIter);
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothSobelGradient(BlockVolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeSmoothSobelGradient(VolumeIterator<VoxelType>& volIter);
|
||||
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeNormal(BlockVolume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API void computeNormalsForVertices(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeNormal(Volume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
|
||||
}
|
||||
|
||||
#include "GradientEstimators.inl"
|
||||
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
//FIXME - bitwise way of doing this?
|
||||
VoxelType voxel1nx = volIter.peekVoxel1nx0py0pz() > 0 ? 1: 0;
|
||||
@ -45,7 +45,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeDecimatedCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeDecimatedCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
const uint16 x = volIter.getPosX();
|
||||
const uint16 y = volIter.getPosY();
|
||||
@ -70,7 +70,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
uint16 initialX = volIter.getPosX();
|
||||
uint16 initialY = volIter.getPosY();
|
||||
@ -101,7 +101,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeSobelGradient(const VolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
|
||||
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
|
||||
@ -184,7 +184,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothSobelGradient(BlockVolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeSmoothSobelGradient(VolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
|
||||
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
|
||||
|
@ -29,11 +29,11 @@ namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType> class Block;
|
||||
|
||||
//---------- BlockVolume ----------
|
||||
template <typename VoxelType> class BlockVolume;
|
||||
typedef BlockVolume<float> FloatBlockVolume;
|
||||
typedef BlockVolume<uint8> UInt8BlockVolume;
|
||||
typedef BlockVolume<uint16> UInt16BlockVolume;
|
||||
//---------- Volume ----------
|
||||
template <typename VoxelType> class Volume;
|
||||
typedef Volume<float> FloatVolume;
|
||||
typedef Volume<uint8> UInt8Volume;
|
||||
typedef Volume<uint16> UInt16Volume;
|
||||
//---------------------------------
|
||||
|
||||
class IndexedSurfacePatch;
|
||||
@ -53,7 +53,7 @@ namespace PolyVox
|
||||
typedef Vector<3,uint32> Vector3DUint32;
|
||||
//----------------------------
|
||||
|
||||
template <typename VoxelType> class BlockVolumeIterator;
|
||||
template <typename VoxelType> class VolumeIterator;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -34,11 +34,11 @@ namespace PolyVox
|
||||
{
|
||||
uint32 getDecimatedIndex(uint32 x, uint32 y);
|
||||
|
||||
void extractDecimatedSurfaceImpl(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
uint32 computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
|
||||
uint32 computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
|
||||
void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[]);
|
||||
void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
|
||||
void extractDecimatedSurfaceImpl(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
uint32 computeInitialDecimatedBitmaskForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
|
||||
uint32 computeDecimatedBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
|
||||
void generateDecimatedIndicesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[]);
|
||||
void generateDecimatedVerticesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -32,12 +32,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void extractFastSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
void extractFastSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
uint32 getIndex(uint32 x, uint32 y);
|
||||
uint32 computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
|
||||
uint32 computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
|
||||
void generateRoughIndicesForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[]);
|
||||
void generateRoughVerticesForSlice(BlockVolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
|
||||
uint32 computeInitialRoughBitmaskForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
|
||||
uint32 computeRoughBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
|
||||
void generateRoughIndicesForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[]);
|
||||
void generateRoughVerticesForSlice(VolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void extractReferenceSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
void extractReferenceSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
int32 getIndexFor(const Vector3DFloat& pos, int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
|
||||
void setIndexFor(const Vector3DFloat& pos, int32 newIndex, int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void smoothRegionGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp);
|
||||
POLYVOX_API void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val);
|
||||
POLYVOX_API void smoothRegionGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp);
|
||||
POLYVOX_API void adjustDecimatedGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val);
|
||||
}
|
||||
|
||||
#endif
|
@ -34,8 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void extractSurface(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void extractReferenceSurface(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void extractSurface(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void extractReferenceSurface(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
******************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef __PolyVox_BlockVolume_H__
|
||||
#define __PolyVox_BlockVolume_H__
|
||||
#ifndef __PolyVox_Volume_H__
|
||||
#define __PolyVox_Volume_H__
|
||||
|
||||
#pragma region Headers
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
@ -33,17 +33,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
class BlockVolume
|
||||
class Volume
|
||||
{
|
||||
//Make BlockVolumeIterator a friend
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
//Make VolumeIterator a friend
|
||||
friend class VolumeIterator<VoxelType>;
|
||||
|
||||
public:
|
||||
BlockVolume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower = 5);
|
||||
BlockVolume(const BlockVolume& rhs);
|
||||
~BlockVolume();
|
||||
Volume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower = 5);
|
||||
Volume(const Volume& rhs);
|
||||
~Volume();
|
||||
|
||||
BlockVolume& operator=(const BlockVolume& rhs);
|
||||
Volume& operator=(const Volume& rhs);
|
||||
|
||||
Region getEnclosingRegion(void) const;
|
||||
uint16 getSideLength(void) const;
|
||||
@ -55,10 +55,10 @@ namespace PolyVox
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, uint16 boundary) const;
|
||||
BlockVolumeIterator<VoxelType> firstVoxel(void);
|
||||
VolumeIterator<VoxelType> firstVoxel(void);
|
||||
void idle(uint32 uAmount);
|
||||
bool isRegionHomogenous(const Region& region);
|
||||
BlockVolumeIterator<VoxelType> lastVoxel(void);
|
||||
VolumeIterator<VoxelType> lastVoxel(void);
|
||||
|
||||
private:
|
||||
Block<VoxelType>* getHomogenousBlock(VoxelType tHomogenousValue) const;
|
||||
@ -80,11 +80,11 @@ namespace PolyVox
|
||||
};
|
||||
|
||||
//Some handy typedefs
|
||||
typedef BlockVolume<float> FloatBlockVolume;
|
||||
typedef BlockVolume<uint8> UInt8BlockVolume;
|
||||
typedef BlockVolume<uint16> UInt16BlockVolume;
|
||||
typedef Volume<float> FloatVolume;
|
||||
typedef Volume<uint8> UInt8Volume;
|
||||
typedef Volume<uint16> UInt16Volume;
|
||||
}
|
||||
|
||||
#include "BlockVolume.inl"
|
||||
#include "Volume.inl"
|
||||
|
||||
#endif
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#pragma region Headers
|
||||
#include "Block.h"
|
||||
#include "BlockVolumeIterator.h"
|
||||
#include "VolumeIterator.h"
|
||||
#include "Region.h"
|
||||
#include "Vector.h"
|
||||
|
||||
@ -33,7 +33,7 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>::BlockVolume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower)
|
||||
Volume<VoxelType>::Volume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower)
|
||||
:m_pBlocks(0)
|
||||
{
|
||||
//Check the volume size is sensible. This corresponds to a side length of 65536 voxels
|
||||
@ -71,13 +71,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>::BlockVolume(const BlockVolume<VoxelType>& rhs)
|
||||
Volume<VoxelType>::Volume(const Volume<VoxelType>& rhs)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>::~BlockVolume()
|
||||
Volume<VoxelType>::~Volume()
|
||||
{
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
@ -88,7 +88,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Operators
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>& BlockVolume<VoxelType>::operator=(const BlockVolume& rhs)
|
||||
Volume<VoxelType>& Volume<VoxelType>::operator=(const Volume& rhs)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
@ -122,19 +122,19 @@ namespace PolyVox
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
Region BlockVolume<VoxelType>::getEnclosingRegion(void) const
|
||||
Region Volume<VoxelType>::getEnclosingRegion(void) const
|
||||
{
|
||||
return Region(Vector3DInt32(0,0,0), Vector3DInt32(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1));
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
uint16 BlockVolume<VoxelType>::getSideLength(void) const
|
||||
uint16 Volume<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolume<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
|
||||
VoxelType Volume<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
|
||||
{
|
||||
assert(uXPos < getSideLength());
|
||||
assert(uYPos < getSideLength());
|
||||
@ -159,7 +159,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
|
||||
VoxelType Volume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
|
||||
{
|
||||
assert(v3dPos.getX() < m_uSideLength);
|
||||
assert(v3dPos.getY() < m_uSideLength);
|
||||
@ -171,7 +171,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Setters
|
||||
template <typename VoxelType>
|
||||
void BlockVolume<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
|
||||
void Volume<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
|
||||
{
|
||||
const uint16 blockX = uXPos >> m_uBlockSideLengthPower;
|
||||
const uint16 blockY = uYPos >> m_uBlockSideLengthPower;
|
||||
@ -207,7 +207,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolume<VoxelType>::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue)
|
||||
void Volume<VoxelType>::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue)
|
||||
{
|
||||
setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue);
|
||||
}
|
||||
@ -215,7 +215,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Other
|
||||
template <typename VoxelType>
|
||||
bool BlockVolume<VoxelType>::containsPoint(const Vector3DFloat& pos, float boundary) const
|
||||
bool Volume<VoxelType>::containsPoint(const Vector3DFloat& pos, float boundary) const
|
||||
{
|
||||
return (pos.getX() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getY() <= m_uSideLength - 1 - boundary)
|
||||
@ -226,7 +226,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, uint16 boundary) const
|
||||
bool Volume<VoxelType>::containsPoint(const Vector3DInt32& pos, uint16 boundary) const
|
||||
{
|
||||
return (pos.getX() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getY() <= m_uSideLength - 1 - boundary)
|
||||
@ -237,22 +237,22 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::firstVoxel(void)
|
||||
VolumeIterator<VoxelType> Volume<VoxelType>::firstVoxel(void)
|
||||
{
|
||||
BlockVolumeIterator<VoxelType> iter(*this);
|
||||
VolumeIterator<VoxelType> iter(*this);
|
||||
iter.setPosition(0,0,0);
|
||||
return iter;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolume<VoxelType>::idle(uint32 uAmount)
|
||||
void Volume<VoxelType>::idle(uint32 uAmount)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolume<VoxelType>::isRegionHomogenous(const Region& region)
|
||||
bool Volume<VoxelType>::isRegionHomogenous(const Region& region)
|
||||
{
|
||||
BlockVolumeIterator<VoxelType> iter(*this);
|
||||
VolumeIterator<VoxelType> iter(*this);
|
||||
iter.setValidRegion(region);
|
||||
iter.setPosition(static_cast<Vector3DInt16>(region.getLowerCorner()));
|
||||
|
||||
@ -272,9 +272,9 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::lastVoxel(void)
|
||||
VolumeIterator<VoxelType> Volume<VoxelType>::lastVoxel(void)
|
||||
{
|
||||
BlockVolumeIterator<VoxelType> iter(*this);
|
||||
VolumeIterator<VoxelType> iter(*this);
|
||||
iter.setPosition(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1);
|
||||
return iter;
|
||||
}
|
||||
@ -282,7 +282,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Private Implementation
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>* BlockVolume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
|
||||
Block<VoxelType>* Volume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
|
||||
{
|
||||
typename std::map<VoxelType, Block<VoxelType>*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue);
|
||||
if(iterResult == m_pHomogenousBlocks.end())
|
@ -31,23 +31,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
class BlockVolumeIterator
|
||||
class VolumeIterator
|
||||
{
|
||||
public:
|
||||
BlockVolumeIterator(BlockVolume<VoxelType>& volume);
|
||||
~BlockVolumeIterator();
|
||||
VolumeIterator(Volume<VoxelType>& volume);
|
||||
~VolumeIterator();
|
||||
|
||||
bool operator==(const BlockVolumeIterator& rhs);
|
||||
bool operator<(const BlockVolumeIterator& rhs);
|
||||
bool operator>(const BlockVolumeIterator& rhs);
|
||||
bool operator<=(const BlockVolumeIterator& rhs);
|
||||
bool operator>=(const BlockVolumeIterator& rhs);
|
||||
bool operator==(const VolumeIterator& rhs);
|
||||
bool operator<(const VolumeIterator& rhs);
|
||||
bool operator>(const VolumeIterator& rhs);
|
||||
bool operator<=(const VolumeIterator& rhs);
|
||||
bool operator>=(const VolumeIterator& rhs);
|
||||
|
||||
uint16 getPosX(void) const;
|
||||
uint16 getPosY(void) const;
|
||||
uint16 getPosZ(void) const;
|
||||
VoxelType getSubSampledVoxel(uint8 uLevel) const;
|
||||
const BlockVolume<VoxelType>& getVolume(void) const;
|
||||
const Volume<VoxelType>& getVolume(void) const;
|
||||
VoxelType getVoxel(void) const;
|
||||
|
||||
void setPosition(const Vector3DInt16& v3dNewPos);
|
||||
@ -92,7 +92,7 @@ namespace PolyVox
|
||||
private:
|
||||
|
||||
//The current volume
|
||||
BlockVolume<VoxelType>& mVolume;
|
||||
Volume<VoxelType>& mVolume;
|
||||
|
||||
//The current position in the volume
|
||||
uint16 mXPosInVolume;
|
||||
@ -132,6 +132,6 @@ namespace PolyVox
|
||||
};
|
||||
}
|
||||
|
||||
#include "BlockVolumeIterator.inl"
|
||||
#include "VolumeIterator.inl"
|
||||
|
||||
#endif
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#pragma region Headers
|
||||
#include "Block.h"
|
||||
#include "BlockVolume.h"
|
||||
#include "Volume.h"
|
||||
#include "Vector.h"
|
||||
#include "Region.h"
|
||||
|
||||
@ -32,20 +32,20 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
BlockVolumeIterator<VoxelType>::BlockVolumeIterator(BlockVolume<VoxelType>& volume)
|
||||
VolumeIterator<VoxelType>::VolumeIterator(Volume<VoxelType>& volume)
|
||||
:mVolume(volume)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
BlockVolumeIterator<VoxelType>::~BlockVolumeIterator()
|
||||
VolumeIterator<VoxelType>::~VolumeIterator()
|
||||
{
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Operators
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::operator==(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
bool VolumeIterator<VoxelType>::operator==(const VolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
//We could just check whether the two mCurrentVoxel pointers are equal, but this may not
|
||||
//be safe in the future if we decide to allow blocks to be shared between volumes
|
||||
@ -62,7 +62,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::operator<(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
bool VolumeIterator<VoxelType>::operator<(const VolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
|
||||
@ -85,21 +85,21 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::operator>(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
bool VolumeIterator<VoxelType>::operator>(const VolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
return (rhs < *this);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::operator<=(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
bool VolumeIterator<VoxelType>::operator<=(const VolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
return (rhs > *this);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::operator>=(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
bool VolumeIterator<VoxelType>::operator>=(const VolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
return (rhs < *this);
|
||||
@ -108,25 +108,25 @@ namespace PolyVox
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
uint16 BlockVolumeIterator<VoxelType>::getPosX(void) const
|
||||
uint16 VolumeIterator<VoxelType>::getPosX(void) const
|
||||
{
|
||||
return mXPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
uint16 BlockVolumeIterator<VoxelType>::getPosY(void) const
|
||||
uint16 VolumeIterator<VoxelType>::getPosY(void) const
|
||||
{
|
||||
return mYPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
uint16 BlockVolumeIterator<VoxelType>::getPosZ(void) const
|
||||
uint16 VolumeIterator<VoxelType>::getPosZ(void) const
|
||||
{
|
||||
return mZPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getSubSampledVoxel(uint8 uLevel) const
|
||||
VoxelType VolumeIterator<VoxelType>::getSubSampledVoxel(uint8 uLevel) const
|
||||
{
|
||||
if(uLevel == 0)
|
||||
{
|
||||
@ -164,13 +164,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
const BlockVolume<VoxelType>& BlockVolumeIterator<VoxelType>::getVolume(void) const
|
||||
const Volume<VoxelType>& VolumeIterator<VoxelType>::getVolume(void) const
|
||||
{
|
||||
return mVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getVoxel(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::getVoxel(void) const
|
||||
{
|
||||
return *mCurrentVoxel;
|
||||
}
|
||||
@ -178,13 +178,13 @@ namespace PolyVox
|
||||
|
||||
#pragma region Setters
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setPosition(const Vector3DInt16& v3dNewPos)
|
||||
void VolumeIterator<VoxelType>::setPosition(const Vector3DInt16& v3dNewPos)
|
||||
{
|
||||
setPosition(v3dNewPos.getX(), v3dNewPos.getY(), v3dNewPos.getZ());
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setPosition(uint16 xPos, uint16 yPos, uint16 zPos)
|
||||
void VolumeIterator<VoxelType>::setPosition(uint16 xPos, uint16 yPos, uint16 zPos)
|
||||
{
|
||||
mXPosInVolume = xPos;
|
||||
mYPosInVolume = yPos;
|
||||
@ -211,13 +211,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setValidRegion(const Region& region)
|
||||
void VolumeIterator<VoxelType>::setValidRegion(const Region& region)
|
||||
{
|
||||
setValidRegion(region.getLowerCorner().getX(),region.getLowerCorner().getY(),region.getLowerCorner().getZ(),region.getUpperCorner().getX(),region.getUpperCorner().getY(),region.getUpperCorner().getZ());
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast)
|
||||
void VolumeIterator<VoxelType>::setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast)
|
||||
{
|
||||
mXRegionFirst = xFirst;
|
||||
mYRegionFirst = yFirst;
|
||||
@ -239,13 +239,13 @@ namespace PolyVox
|
||||
|
||||
#pragma region Other
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::isValidForRegion(void) const
|
||||
bool VolumeIterator<VoxelType>::isValidForRegion(void) const
|
||||
{
|
||||
return mIsValidForRegion;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::moveForwardInRegionFast(void)
|
||||
void VolumeIterator<VoxelType>::moveForwardInRegionFast(void)
|
||||
{
|
||||
mXPosInBlock++;
|
||||
mCurrentVoxel++;
|
||||
@ -331,7 +331,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolumeIterator<VoxelType>::moveForwardInRegionXYZ(void)
|
||||
bool VolumeIterator<VoxelType>::moveForwardInRegionXYZ(void)
|
||||
{
|
||||
if(mXPosInVolume < mXRegionLast)
|
||||
{
|
||||
@ -386,7 +386,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Peekers
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -396,7 +396,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -406,7 +406,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -416,7 +416,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -426,7 +426,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -436,7 +436,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -446,7 +446,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -456,7 +456,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -466,7 +466,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -478,7 +478,7 @@ namespace PolyVox
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny1nz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -488,7 +488,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny0pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -498,7 +498,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny1pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -508,7 +508,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py1nz(void) const
|
||||
{
|
||||
if((mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -518,13 +518,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py0pz(void) const
|
||||
{
|
||||
return *mCurrentVoxel;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py1pz(void) const
|
||||
{
|
||||
if((mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -534,7 +534,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py1nz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -544,7 +544,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py0pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -554,7 +554,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py1pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -566,7 +566,7 @@ namespace PolyVox
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -576,7 +576,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -586,7 +586,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -596,7 +596,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -606,7 +606,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -616,7 +616,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -626,7 +626,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py1nz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -636,7 +636,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py0pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -646,7 +646,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py1pz(void) const
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<uint8>& volIter);
|
||||
float computeSmoothedVoxel(VolumeIterator<uint8>& volIter);
|
||||
}
|
||||
|
||||
#endif
|
@ -31,11 +31,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API BlockVolume<uint8>* loadVolumeRaw(std::istream& stream);
|
||||
POLYVOX_API void saveVolumeRaw(std::ostream& stream, BlockVolume<uint8>& volume);
|
||||
POLYVOX_API Volume<uint8>* loadVolumeRaw(std::istream& stream);
|
||||
POLYVOX_API void saveVolumeRaw(std::ostream& stream, Volume<uint8>& volume);
|
||||
|
||||
POLYVOX_API BlockVolume<uint8>* loadVolumeRle(std::istream& stream);
|
||||
POLYVOX_API void saveVolumeRle(std::ostream& stream, BlockVolume<uint8>& volume);
|
||||
POLYVOX_API Volume<uint8>* loadVolumeRle(std::istream& stream);
|
||||
POLYVOX_API void saveVolumeRle(std::ostream& stream, Volume<uint8>& volume);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -44,14 +44,14 @@ namespace PolyVox
|
||||
Region getEnclosingRegion(void) const;
|
||||
int32 getLastModifiedTimeForRegion(uint16 uX, uint16 uY, uint16 uZ);
|
||||
uint16 getSideLength(void);
|
||||
BlockVolume<uint8>* getVolumeData(void) const;
|
||||
Volume<uint8>* getVolumeData(void) const;
|
||||
uint8 getVoxelAt(const Vector3DUint16& pos);
|
||||
uint8 getVoxelAt(uint16 uX, uint16 uY, uint16 uZ);
|
||||
|
||||
//Setters
|
||||
void setAllRegionsModified(void);
|
||||
void setLockedVoxelAt(uint16 x, uint16 y, uint16 z, uint8 value);
|
||||
void setVolumeData(BlockVolume<uint8>* volumeDataToSet);
|
||||
void setVolumeData(Volume<uint8>* volumeDataToSet);
|
||||
void setVoxelAt(uint16 x, uint16 y, uint16 z, uint8 value);
|
||||
|
||||
//Others
|
||||
@ -62,7 +62,7 @@ namespace PolyVox
|
||||
private:
|
||||
bool m_bIsLocked;
|
||||
Region m_regLastLocked;
|
||||
BlockVolume<uint8>* volumeData;
|
||||
Volume<uint8>* volumeData;
|
||||
|
||||
//It's not what the block class was designed for, but it
|
||||
//provides a handy way of storing a 3D grid of values.
|
||||
|
@ -8,7 +8,7 @@ using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod)
|
||||
POLYVOX_API void computeNormalsForVertices(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod)
|
||||
{
|
||||
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData();
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
@ -17,7 +17,7 @@ namespace PolyVox
|
||||
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
|
||||
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
//Check all corners are within the volume, allowing a boundary for gradient estimation
|
||||
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,2);
|
||||
@ -39,11 +39,11 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
Vector3DFloat computeNormal(BlockVolume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod)
|
||||
Vector3DFloat computeNormal(Volume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod)
|
||||
{
|
||||
Vector3DFloat v3dGradient; //To store the result
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
|
@ -21,12 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "PolyVoxCore/PolyVoxImpl/DecimatedSurfaceExtractor.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
#include "PolyVoxCore/GradientEstimators.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/Region.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -39,7 +39,7 @@ namespace PolyVox
|
||||
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
|
||||
}
|
||||
|
||||
void extractDecimatedSurfaceImpl(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractDecimatedSurfaceImpl(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
singleMaterialPatch->clear();
|
||||
|
||||
@ -73,7 +73,7 @@ namespace PolyVox
|
||||
regSlice0.setUpperCorner(v3dUpperCorner);
|
||||
|
||||
//Iterator to access the volume data
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
//Compute bitmask for initial slice
|
||||
uint32 uNoOfNonEmptyCellsForSlice0 = computeInitialDecimatedBitmaskForSlice(volIter, uLevel, regSlice0, offset, bitmask0);
|
||||
@ -128,7 +128,7 @@ namespace PolyVox
|
||||
}*/
|
||||
}
|
||||
|
||||
uint32 computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
|
||||
uint32 computeInitialDecimatedBitmaskForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
|
||||
{
|
||||
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
uint32 uNoOfNonEmptyCells = 0;
|
||||
@ -297,7 +297,7 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
uint32 computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
|
||||
uint32 computeDecimatedBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
|
||||
{
|
||||
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
uint32 uNoOfNonEmptyCells = 0;
|
||||
@ -423,7 +423,7 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
|
||||
void generateDecimatedVerticesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
|
||||
{
|
||||
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
|
||||
@ -494,7 +494,7 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
|
||||
void generateDecimatedIndicesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
|
||||
{
|
||||
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
uint32 indlist[12];
|
||||
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "PolyVoxCore/PolyVoxImpl/FastSurfaceExtractor.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/SurfaceVertex.h"
|
||||
@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
|
||||
void extractFastSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractFastSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
singleMaterialPatch->clear();
|
||||
|
||||
@ -59,7 +59,7 @@ namespace PolyVox
|
||||
regSlice0.setUpperCorner(Vector3DInt32(regSlice0.getUpperCorner().getX(),regSlice0.getUpperCorner().getY(),regSlice0.getLowerCorner().getZ()));
|
||||
|
||||
//Iterator to access the volume data
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
//Compute bitmask for initial slice
|
||||
uint32 uNoOfNonEmptyCellsForSlice0 = computeInitialRoughBitmaskForSlice(volIter, regSlice0, offset, bitmask0);
|
||||
@ -110,7 +110,7 @@ namespace PolyVox
|
||||
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
|
||||
}
|
||||
|
||||
uint32 computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
|
||||
uint32 computeInitialRoughBitmaskForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
|
||||
{
|
||||
uint32 uNoOfNonEmptyCells = 0;
|
||||
|
||||
@ -260,7 +260,7 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
uint32 computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
|
||||
uint32 computeRoughBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
|
||||
{
|
||||
uint32 uNoOfNonEmptyCells = 0;
|
||||
|
||||
@ -376,7 +376,7 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
void generateRoughVerticesForSlice(BlockVolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
|
||||
void generateRoughVerticesForSlice(VolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
|
||||
{
|
||||
//Iterate over each cell in the region
|
||||
volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ());
|
||||
@ -443,7 +443,7 @@ namespace PolyVox
|
||||
}while(volIter.moveForwardInRegionXYZ());//For each cell
|
||||
}
|
||||
|
||||
void generateRoughIndicesForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
|
||||
void generateRoughIndicesForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
|
||||
{
|
||||
uint32 indlist[12];
|
||||
|
||||
|
@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "PolyVoxCore/PolyVoxImpl/ReferenceSurfaceExtractor.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/Region.h"
|
||||
@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void extractReferenceSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractReferenceSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
static int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
@ -54,7 +54,7 @@ namespace PolyVox
|
||||
Vector3DFloat vertlist[12];
|
||||
Vector3DFloat normlist[12];
|
||||
uint8 vertMaterials[12];
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
volIter.setValidRegion(region);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "PolyVoxCore/SurfaceAdjusters.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
#include "PolyVoxCore/GradientEstimators.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
@ -12,12 +12,12 @@ using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void smoothRegionGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp)
|
||||
void smoothRegionGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp)
|
||||
{
|
||||
const uint8 uSmoothingFactor = 2;
|
||||
const float fThreshold = 0.5f;
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData();
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
@ -76,9 +76,9 @@ namespace PolyVox
|
||||
} //while(iterSurfaceVertex != vecVertices.end())
|
||||
}
|
||||
|
||||
void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val)
|
||||
void adjustDecimatedGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val)
|
||||
{
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData();
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
@ -87,7 +87,7 @@ namespace PolyVox
|
||||
Vector3DFloat v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
|
||||
Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
//Check all corners are within the volume, allowing a boundary for gradient estimation
|
||||
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,1);
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "PolyVoxCore/SurfaceExtractors.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
#include "PolyVoxCore/GradientEstimators.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/Region.h"
|
||||
#include "PolyVoxCore/SurfaceAdjusters.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
|
||||
#include "PolyVoxCore/PolyVoxImpl/DecimatedSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/PolyVoxImpl/FastSurfaceExtractor.h"
|
||||
@ -18,7 +18,7 @@ using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void extractSurface(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractSurface(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
if(uLevel == 0)
|
||||
{
|
||||
@ -32,7 +32,7 @@ namespace PolyVox
|
||||
singleMaterialPatch->m_v3dRegionPosition = region.getLowerCorner();
|
||||
}
|
||||
|
||||
void extractReferenceSurface(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractReferenceSurface(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
extractReferenceSurfaceImpl(volumeData, region, singleMaterialPatch);
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "PolyVoxCore/VoxelFilters.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<uint8>& volIter)
|
||||
float computeSmoothedVoxel(VolumeIterator<uint8>& volIter)
|
||||
{
|
||||
assert(volIter.getPosX() >= 1);
|
||||
assert(volIter.getPosY() >= 1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "PolyVoxUtil/Serialization.h"
|
||||
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
|
||||
using namespace std;
|
||||
@ -10,7 +10,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
|
||||
BlockVolume<uint8>* loadVolumeRaw(istream& stream)
|
||||
Volume<uint8>* loadVolumeRaw(istream& stream)
|
||||
{
|
||||
//Read volume dimensions
|
||||
uint8 volumeWidthPower = 0;
|
||||
@ -21,7 +21,7 @@ namespace PolyVox
|
||||
stream.read(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
|
||||
|
||||
//FIXME - need to support non cubic volumes
|
||||
BlockVolume<uint8>* volume = new BlockVolume<uint8>(volumeWidthPower);
|
||||
Volume<uint8>* volume = new Volume<uint8>(volumeWidthPower);
|
||||
|
||||
uint16 volumeWidth = 0x0001 << volumeWidthPower;
|
||||
uint16 volumeHeight = 0x0001 << volumeHeightPower;
|
||||
@ -45,7 +45,7 @@ namespace PolyVox
|
||||
return volume;
|
||||
}
|
||||
|
||||
void saveVolumeRaw(std::ostream& stream, BlockVolume<uint8>& volume)
|
||||
void saveVolumeRaw(std::ostream& stream, Volume<uint8>& volume)
|
||||
{
|
||||
//Write volume dimensions
|
||||
uint16 volumeWidth = volume.getSideLength();
|
||||
@ -61,7 +61,7 @@ namespace PolyVox
|
||||
stream.write(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
|
||||
|
||||
//Write data
|
||||
BlockVolumeIterator<uint8> volIter(volume);
|
||||
VolumeIterator<uint8> volIter(volume);
|
||||
for(uint16 z = 0; z < volumeDepth; ++z)
|
||||
{
|
||||
for(uint16 y = 0; y < volumeHeight; ++y)
|
||||
@ -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
|
||||
BlockVolume<uint8>* loadVolumeRle(istream& stream)
|
||||
Volume<uint8>* loadVolumeRle(istream& stream)
|
||||
{
|
||||
//Read volume dimensions
|
||||
uint8 volumeWidthPower = 0;
|
||||
@ -89,7 +89,7 @@ namespace PolyVox
|
||||
stream.read(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
|
||||
|
||||
//FIXME - need to support non cubic volumes
|
||||
BlockVolume<uint8>* volume = new BlockVolume<uint8>(volumeWidthPower);
|
||||
Volume<uint8>* volume = new Volume<uint8>(volumeWidthPower);
|
||||
|
||||
uint16 volumeWidth = 0x0001 << volumeWidthPower;
|
||||
uint16 volumeHeight = 0x0001 << volumeHeightPower;
|
||||
@ -127,7 +127,7 @@ namespace PolyVox
|
||||
return volume;
|
||||
}
|
||||
|
||||
void saveVolumeRle(std::ostream& stream, BlockVolume<uint8>& volume)
|
||||
void saveVolumeRle(std::ostream& stream, Volume<uint8>& volume)
|
||||
{
|
||||
//Write volume dimensions
|
||||
uint16 volumeWidth = volume.getSideLength();
|
||||
@ -143,7 +143,7 @@ namespace PolyVox
|
||||
stream.write(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
|
||||
|
||||
//Write data
|
||||
BlockVolumeIterator<uint8> volIter(volume);
|
||||
VolumeIterator<uint8> volIter(volume);
|
||||
uint8 current = 0;
|
||||
uint32 runLength = 0;
|
||||
bool firstTime = true;
|
||||
|
@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxCore/SurfaceVertex.h"
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
#include "PolyVoxCore/Vector.h"
|
||||
#include "PolyVoxCore/BlockVolume.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/Volume.h"
|
||||
#include "PolyVoxCore/VolumeIterator.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -50,7 +50,7 @@ namespace PolyVox
|
||||
{
|
||||
}
|
||||
|
||||
void VolumeChangeTracker::setVolumeData(BlockVolume<uint8>* volumeDataToSet)
|
||||
void VolumeChangeTracker::setVolumeData(Volume<uint8>* volumeDataToSet)
|
||||
{
|
||||
volumeData = volumeDataToSet;
|
||||
volRegionLastModified = new Block<int32>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS));
|
||||
@ -102,12 +102,12 @@ namespace PolyVox
|
||||
assert(uY < volumeData->getSideLength());
|
||||
assert(uZ < volumeData->getSideLength());
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
VolumeIterator<uint8> volIter(*volumeData);
|
||||
volIter.setPosition(uX,uY,uZ);
|
||||
return volIter.getVoxel();
|
||||
}
|
||||
|
||||
BlockVolume<uint8>* VolumeChangeTracker::getVolumeData(void) const
|
||||
Volume<uint8>* VolumeChangeTracker::getVolumeData(void) const
|
||||
{
|
||||
return volumeData;
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace PolyVox
|
||||
{
|
||||
++m_iCurrentTime;
|
||||
//FIXME - rather than creating a iterator each time we should have one stored
|
||||
//BlockVolumeIterator<uint8> iterVol(*volumeData);
|
||||
//VolumeIterator<uint8> iterVol(*volumeData);
|
||||
/*iterVol.setPosition(x,y,z);
|
||||
iterVol.setVoxel(value);*/
|
||||
|
||||
@ -166,7 +166,7 @@ namespace PolyVox
|
||||
assert(m_bIsLocked);
|
||||
|
||||
//FIXME - rather than creating a iterator each time we should have one stored
|
||||
/*BlockVolumeIterator<uint8> iterVol(*volumeData);
|
||||
/*VolumeIterator<uint8> iterVol(*volumeData);
|
||||
iterVol.setPosition(x,y,z);
|
||||
iterVol.setVoxel(value);*/
|
||||
volumeData->setVoxelAt(x,y,z,value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user