Renamed Volume to LargeVolume.

This commit is contained in:
David Williams 2011-04-28 21:21:59 +01:00
parent 96ff5e890a
commit ea309ab15b
46 changed files with 239 additions and 237 deletions

View File

@ -26,14 +26,14 @@ freely, subject to the following restrictions:
#include "MaterialDensityPair.h"
#include "CubicSurfaceExtractorWithNormals.h"
#include "SurfaceMesh.h"
#include "Volume.h"
#include "LargeVolume.h"
#include <QApplication>
//Use the PolyVox namespace
using namespace PolyVox;
void createSphereInVolume(Volume<MaterialDensityPair44>& volData, float fRadius)
void createSphereInVolume(LargeVolume<MaterialDensityPair44>& volData, float fRadius)
{
//This vector hold the position of the center of the volume
Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
openGLWidget.show();
//Create an empty volume and then place a sphere in it
Volume<MaterialDensityPair44> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
LargeVolume<MaterialDensityPair44> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
createSphereInVolume(volData, 30);
//Extract the surface

View File

@ -48,7 +48,7 @@ OpenGLWidget::OpenGLWidget(QWidget *parent)
timer->start(0);
}
void OpenGLWidget::setVolume(PolyVox::Volume<MaterialDensityPair44>* volData)
void OpenGLWidget::setVolume(PolyVox::LargeVolume<MaterialDensityPair44>* volData)
{
//First we free anything from the previous volume (if there was one).
m_mapOpenGLSurfaceMeshes.clear();

View File

@ -29,7 +29,7 @@ freely, subject to the following restrictions:
#include <QGLWidget>
#include <QTimer>
#include "Volume.h"
#include "LargeVolume.h"
#include "SurfaceMesh.h"
#include "PolyVoxImpl/Utility.h"
@ -45,7 +45,7 @@ class OpenGLWidget : public QGLWidget
public:
OpenGLWidget(QWidget *parent);
void setVolume(PolyVox::Volume<PolyVox::MaterialDensityPair44>* volData);
void setVolume(PolyVox::LargeVolume<PolyVox::MaterialDensityPair44>* volData);
void mouseMoveEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent* event);
@ -69,7 +69,7 @@ class OpenGLWidget : public QGLWidget
bool m_bUseOpenGLVertexBufferObjects;
//Creates a volume 128x128x128
PolyVox::Volume<PolyVox::MaterialDensityPair44>* m_volData;
PolyVox::LargeVolume<PolyVox::MaterialDensityPair44>* m_volData;
//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region
std::map<PolyVox::Vector3DUint8, OpenGLSurfaceMesh> m_mapOpenGLSurfaceMeshes;

View File

@ -27,7 +27,7 @@ freely, subject to the following restrictions:
using namespace PolyVox;
void createSphereInVolume(Volume<MaterialDensityPair44>& volData, float fRadius, uint8_t uValue)
void createSphereInVolume(LargeVolume<MaterialDensityPair44>& volData, float fRadius, uint8_t uValue)
{
//This vector hold the position of the center of the volume
Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
@ -55,7 +55,7 @@ void createSphereInVolume(Volume<MaterialDensityPair44>& volData, float fRadius,
}
}
void createCubeInVolume(Volume<MaterialDensityPair44>& volData, Vector3DInt32 lowerCorner, Vector3DInt32 upperCorner, uint8_t uValue)
void createCubeInVolume(LargeVolume<MaterialDensityPair44>& volData, Vector3DInt32 lowerCorner, Vector3DInt32 upperCorner, uint8_t uValue)
{
//This three-level for loop iterates over every voxel between the specified corners
for (int z = lowerCorner.getZ(); z <= upperCorner.getZ(); z++)

View File

@ -25,9 +25,9 @@ freely, subject to the following restrictions:
#define __OpenGLExample_Shapes_H__
#include "PolyVoxForwardDeclarations.h"
#include "Volume.h"
#include "LargeVolume.h"
void createSphereInVolume(PolyVox::Volume<PolyVox::MaterialDensityPair44>& volData, float fRadius, uint8_t uValue);
void createCubeInVolume(PolyVox::Volume<PolyVox::MaterialDensityPair44>& volData, PolyVox::Vector3DInt32 lowerCorner, PolyVox::Vector3DInt32 upperCorner, uint8_t uValue);
void createSphereInVolume(PolyVox::LargeVolume<PolyVox::MaterialDensityPair44>& volData, float fRadius, uint8_t uValue);
void createCubeInVolume(PolyVox::LargeVolume<PolyVox::MaterialDensityPair44>& volData, PolyVox::Vector3DInt32 lowerCorner, PolyVox::Vector3DInt32 upperCorner, uint8_t uValue);
#endif //__OpenGLExample_Shapes_H__

View File

@ -24,7 +24,7 @@ freely, subject to the following restrictions:
#include "Filters.h"
#include "Log.h"
#include "MaterialDensityPair.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "SurfaceMesh.h"
#include "PolyVoxImpl/Utility.h"
@ -72,7 +72,7 @@ void exampleLog(string message, int severity)
int main(int argc, char *argv[])
{
logHandler = &exampleLog;
Volume<MaterialDensityPair44> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1)));
LargeVolume<MaterialDensityPair44> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1)));
//Make our volume contain a sphere in the center.
int32_t minPos = 0;

View File

@ -28,7 +28,7 @@ freely, subject to the following restrictions:
#include "CubicSurfaceExtractorWithNormals.h"
#include "SurfaceExtractor.h"
#include "SurfaceMesh.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "Filters.h"
#include <QApplication>
@ -36,7 +36,7 @@ freely, subject to the following restrictions:
//Use the PolyVox namespace
using namespace PolyVox;
void createPerlinVolumeSlow(Volume<MaterialDensityPair44>& volData)
void createPerlinVolumeSlow(LargeVolume<MaterialDensityPair44>& volData)
{
Perlin perlin(2,8,1,234);
@ -75,7 +75,7 @@ void createPerlinVolumeSlow(Volume<MaterialDensityPair44>& volData)
}
}
/*void createPerlinVolumeFast(Volume<MaterialDensityPair44>& volData)
/*void createPerlinVolumeFast(LargeVolume<MaterialDensityPair44>& volData)
{
Perlin perlin(2,8,1,234);
@ -123,7 +123,7 @@ void createPerlinVolumeSlow(Volume<MaterialDensityPair44>& volData)
}
}*/
void createPerlinTerrain(Volume<MaterialDensityPair44>& volData)
void createPerlinTerrain(LargeVolume<MaterialDensityPair44>& volData)
{
Perlin perlin(2,2,1,234);
@ -159,7 +159,7 @@ void createPerlinTerrain(Volume<MaterialDensityPair44>& volData)
std::cout << std::endl;
}
void createSphereInVolume(Volume<MaterialDensityPair44>& volData, Vector3DFloat v3dVolCenter, float fRadius)
void createSphereInVolume(LargeVolume<MaterialDensityPair44>& volData, Vector3DFloat v3dVolCenter, float fRadius)
{
//This vector hold the position of the center of the volume
//Vector3DFloat v3dVolCenter(volData.getWidth() / 2, volData.getHeight() / 2, volData.getDepth() / 2);
@ -253,8 +253,8 @@ int main(int argc, char *argv[])
//If these lines don't compile, please try commenting them out and using the two lines after
//(you will need Boost for this). If you have to do this then please let us know in the forums as
//we rely on community feedback to keep the Boost version running.
Volume<MaterialDensityPair44> volData(&load, &unload, 256);
//Volume<MaterialDensityPair44> volData(polyvox_bind(&load, polyvox_placeholder_1, polyvox_placeholder_2),
LargeVolume<MaterialDensityPair44> volData(&load, &unload, 256);
//LargeVolume<MaterialDensityPair44> volData(polyvox_bind(&load, polyvox_placeholder_1, polyvox_placeholder_2),
// polyvox_bind(&unload, polyvox_placeholder_1, polyvox_placeholder_2), 256);
volData.setMaxNumberOfBlocksInMemory(4096);
volData.setMaxNumberOfUncompressedBlocks(64);

View File

@ -33,6 +33,9 @@ SET(CORE_INC_FILES
include/Filters.inl
include/GradientEstimators.h
include/GradientEstimators.inl
include/LargeVolume.h
include/LargeVolume.inl
include/LargeVolumeSampler.inl
include/Log.h
include/Material.h
include/MaterialDensityPair.h
@ -51,9 +54,6 @@ SET(CORE_INC_FILES
include/Vector.h
include/Vector.inl
include/VertexTypes.h
include/Volume.h
include/Volume.inl
include/VolumeSampler.inl
include/VoxelFilters.h
)

View File

@ -27,7 +27,7 @@ freely, subject to the following restrictions:
#include "Array.h"
#include "PolyVoxImpl/AStarPathfinderImpl.h"
#include "PolyVoxForwardDeclarations.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "PolyVoxImpl/TypeDef.h"
@ -44,7 +44,7 @@ namespace PolyVox
/// This function provides the default method for checking whether a given voxel
/// is vaid for the path computed by the AStarPathfinder.
template <typename VoxelType>
bool aStarDefaultVoxelValidator(const Volume<VoxelType>* volData, const Vector3DInt32& v3dPos);
bool aStarDefaultVoxelValidator(const LargeVolume<VoxelType>* volData, const Vector3DInt32& v3dPos);
/// Provides a configuration for the AStarPathfinder.
////////////////////////////////////////////////////////////////////////////////
@ -63,14 +63,14 @@ namespace PolyVox
public:
AStarPathfinderParams
(
Volume<VoxelType>* volData,
LargeVolume<VoxelType>* volData,
const Vector3DInt32& v3dStart,
const Vector3DInt32& v3dEnd,
std::list<Vector3DInt32>* listResult,
float fHBias = 1.0,
uint32_t uMaxNoOfNodes = 10000,
Connectivity connectivity = TwentySixConnected,
polyvox_function<bool (const Volume<VoxelType>*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator<VoxelType>,
polyvox_function<bool (const LargeVolume<VoxelType>*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator<VoxelType>,
polyvox_function<void (float)> funcProgressCallback = 0
)
:volume(volData)
@ -86,7 +86,7 @@ namespace PolyVox
}
/// This is the volume through which the AStarPathfinder must find a path.
Volume<VoxelType>* volume;
LargeVolume<VoxelType>* volume;
/// The start point for the pathfinding algorithm.
Vector3DInt32 start;
@ -125,7 +125,7 @@ namespace PolyVox
/// you could check to ensure that the voxel above is empty and the voxel below is solid.
///
/// \sa aStarDefaultVoxelValidator
polyvox_function<bool (const Volume<VoxelType>*, const Vector3DInt32&)> isVoxelValidForPath;
polyvox_function<bool (const LargeVolume<VoxelType>*, const Vector3DInt32&)> isVoxelValidForPath;
/// This function is called by the AStarPathfinder to report on its progress in getting to
/// the goal. The progress is reported by computing the distance from the closest node found

View File

@ -31,7 +31,7 @@ namespace PolyVox
/// \return true is the voxel is valid for the path
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
bool aStarDefaultVoxelValidator(const Volume<VoxelType>* volData, const Vector3DInt32& v3dPos)
bool aStarDefaultVoxelValidator(const LargeVolume<VoxelType>* volData, const Vector3DInt32& v3dPos)
{
//Voxels are considered valid candidates for the path if they are inside the volume...
if(volData->getEnclosingRegion().containsPoint(v3dPos) == false)

View File

@ -25,6 +25,7 @@ freely, subject to the following restrictions:
#define __AmbientOcclusionCalculator_H__
#include "PolyVoxForwardDeclarations.h"
#include "LargeVolume.h"
namespace PolyVox
{
@ -32,15 +33,15 @@ namespace PolyVox
class AmbientOcclusionCalculator
{
public:
AmbientOcclusionCalculator(Volume<VoxelType>* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement);
AmbientOcclusionCalculator(LargeVolume<VoxelType>* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement);
~AmbientOcclusionCalculator();
void execute(void);
private:
Region m_region;
Volume<VoxelType>::Sampler m_sampVolume;
Volume<VoxelType>* m_volInput;
typename LargeVolume<VoxelType>::Sampler m_sampVolume;
LargeVolume<VoxelType>* m_volInput;
Array<3, uint8_t>* m_arrayResult;
float m_fRayLength;

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
#include "Array.h"
#include "Raycast.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "PolyVoxImpl/RandomUnitVectors.h"
#include "PolyVoxImpl/RandomVectors.h"
@ -31,7 +31,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
template <typename VoxelType>
AmbientOcclusionCalculator<VoxelType>::AmbientOcclusionCalculator(Volume<VoxelType>* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement)
AmbientOcclusionCalculator<VoxelType>::AmbientOcclusionCalculator(LargeVolume<VoxelType>* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement)
:m_region(region)
,m_sampVolume(volInput)
,m_volInput(volInput)

View File

@ -32,8 +32,8 @@ namespace PolyVox
template <typename VoxelType>
class ConstVolumeProxy
{
//Volume is a friend so it can call the constructor.
friend class Volume<VoxelType>;
//LargeVolume is a friend so it can call the constructor.
friend class LargeVolume<VoxelType>;
public:
VoxelType getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
{
@ -60,13 +60,13 @@ namespace PolyVox
}
private:
//Private constructor, so client code can't abuse this class.
ConstVolumeProxy(const Volume<VoxelType>& pVolume, const Region& regValid)
ConstVolumeProxy(const LargeVolume<VoxelType>& pVolume, const Region& regValid)
:m_pVolume(pVolume)
,m_regValid(regValid)
{
}
const Volume<VoxelType>& m_pVolume;
const LargeVolume<VoxelType>& m_pVolume;
const Region& m_regValid;
};
}

View File

@ -26,6 +26,7 @@ freely, subject to the following restrictions:
#include "Array.h"
#include "PolyVoxForwardDeclarations.h"
#include "LargeVolume.h"
#include "PolyVoxImpl/TypeDef.h"
@ -41,7 +42,7 @@ namespace PolyVox
class CubicSurfaceExtractor
{
public:
CubicSurfaceExtractor(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterial>* result);
CubicSurfaceExtractor(LargeVolume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterial>* result);
void execute();
@ -49,8 +50,8 @@ namespace PolyVox
private:
//The volume data and a sampler to access it.
Volume<VoxelType>* m_volData;
Volume<VoxelType>::Sampler m_sampVolume;
LargeVolume<VoxelType>* m_volData;
typename LargeVolume<VoxelType>::Sampler m_sampVolume;
//Information about the region we are currently processing
Region m_regSizeInVoxels;

View File

@ -33,7 +33,7 @@ namespace PolyVox
const uint32_t CubicSurfaceExtractor<VoxelType>::MaxQuadsSharingVertex = 4;
template <typename VoxelType>
CubicSurfaceExtractor<VoxelType>::CubicSurfaceExtractor(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterial>* result)
CubicSurfaceExtractor<VoxelType>::CubicSurfaceExtractor(LargeVolume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterial>* result)
:m_volData(volData)
,m_sampVolume(volData)
,m_regSizeInVoxels(region)

View File

@ -25,7 +25,7 @@ freely, subject to the following restrictions:
#define __PolyVox_CubicSurfaceExtractorWithNormals_H__
#include "PolyVoxForwardDeclarations.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "PolyVoxImpl/TypeDef.h"
@ -35,14 +35,14 @@ namespace PolyVox
class CubicSurfaceExtractorWithNormals
{
public:
CubicSurfaceExtractorWithNormals(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result);
CubicSurfaceExtractorWithNormals(LargeVolume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result);
void execute();
private:
//The volume data and a sampler to access it.
Volume<VoxelType>* m_volData;
typename Volume<VoxelType>::Sampler m_sampVolume;
LargeVolume<VoxelType>* m_volData;
typename LargeVolume<VoxelType>::Sampler m_sampVolume;
//The surface patch we are currently filling.
SurfaceMesh<PositionMaterialNormal>* m_meshCurrent;

View File

@ -30,7 +30,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
template <typename VoxelType>
CubicSurfaceExtractorWithNormals<VoxelType>::CubicSurfaceExtractorWithNormals(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
CubicSurfaceExtractorWithNormals<VoxelType>::CubicSurfaceExtractorWithNormals(LargeVolume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
:m_volData(volData)
,m_sampVolume(volData)
,m_regSizeInVoxels(region)

View File

@ -31,7 +31,7 @@ namespace PolyVox
{
///This class represents a voxel storing only a density.
////////////////////////////////////////////////////////////////////////////////
/// In order to perform a surface extraction on a Volume, PolyVox needs the underlying
/// In order to perform a surface extraction on a LargeVolume, PolyVox needs the underlying
/// voxel type to provide both getDensity() and getMaterial() functions. The getDensity()
/// function is used to determine if a voxel is 'solid', and if it is then the getMaterial()
/// funtion is used to determine what material should be assigned to the resulting mesh.

View File

@ -26,12 +26,12 @@ freely, subject to the following restrictions:
#include "Array.h"
#include "Region.h"
#include "Volume.h"
#include "LargeVolume.h"
namespace PolyVox
{
template <typename VoxelType>
void smoothRegion(Volume<VoxelType>& volData, const Region& regionToSmooth);
void smoothRegion(LargeVolume<VoxelType>& volData, const Region& regionToSmooth);
}//namespace PolyVox
#include "Filters.inl"

View File

@ -3,7 +3,7 @@
namespace PolyVox
{
template <typename VoxelType>
void smoothRegion(Volume<VoxelType>& volData, const Region& regionToSmooth)
void smoothRegion(LargeVolume<VoxelType>& volData, const Region& regionToSmooth)
{
Region croppedRegion = regionToSmooth;

View File

@ -26,7 +26,7 @@ freely, subject to the following restrictions:
#ifndef __PolyVox_GradientEstimators_H__
#define __PolyVox_GradientEstimators_H__
#include "Volume.h"
#include "LargeVolume.h"
#include <vector>
@ -42,21 +42,21 @@ namespace PolyVox
};
template <typename VoxelType>
Vector3DFloat computeCentralDifferenceGradient(const typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeCentralDifferenceGradient(const typename LargeVolume<VoxelType>::Sampler& volIter);
template <typename VoxelType>
Vector3DFloat computeSmoothCentralDifferenceGradient(typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeSmoothCentralDifferenceGradient(typename LargeVolume<VoxelType>::Sampler& volIter);
template <typename VoxelType>
Vector3DFloat computeDecimatedCentralDifferenceGradient(typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeDecimatedCentralDifferenceGradient(typename LargeVolume<VoxelType>::Sampler& volIter);
template <typename VoxelType>
Vector3DFloat computeSobelGradient(const typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeSobelGradient(const typename LargeVolume<VoxelType>::Sampler& volIter);
template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeSmoothSobelGradient(typename LargeVolume<VoxelType>::Sampler& volIter);
POLYVOX_API void computeNormalsForVertices(Volume<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API void computeNormalsForVertices(LargeVolume<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(LargeVolume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
}
#include "GradientEstimators.inl"

View File

@ -23,12 +23,12 @@ freely, subject to the following restrictions:
#include "VoxelFilters.h"
#include "Volume.h"
#include "LargeVolume.h"
namespace PolyVox
{
template <typename VoxelType>
Vector3DFloat computeCentralDifferenceGradient(const typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat computeCentralDifferenceGradient(const typename LargeVolume<VoxelType>::Sampler& volIter)
{
//FIXME - bitwise way of doing this?
VoxelType voxel1nx = volIter.peekVoxel1nx0py0pz() > 0 ? 1: 0;
@ -49,7 +49,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename LargeVolume<VoxelType>::Sampler& volIter)
{
const int32_t x = volIter.getPosX();
const int32_t y = volIter.getPosY();
@ -74,7 +74,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeSmoothCentralDifferenceGradient(typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat computeSmoothCentralDifferenceGradient(typename LargeVolume<VoxelType>::Sampler& volIter)
{
int32_t initialX = volIter.getPosX();
int32_t initialY = volIter.getPosY();
@ -105,7 +105,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeSobelGradient(const typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat computeSobelGradient(const typename LargeVolume<VoxelType>::Sampler& 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} } };
@ -188,7 +188,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat computeSmoothSobelGradient(typename LargeVolume<VoxelType>::Sampler& 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} } };

View File

@ -36,42 +36,42 @@ freely, subject to the following restrictions:
namespace PolyVox
{
///The Volume class provides a memory efficient method of storing voxel data while also allowing fast access and modification.
///The LargeVolume class provides a memory efficient method of storing voxel data while also allowing fast access and modification.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// A Volume is essentially a 3D array in which each element (or <i>voxel</i>) is identified by a three dimensional (x,y,z) coordinate.
/// We use the Volume class to store our data in an efficient way, and it is the input to many of the algorithms (such as the surface
/// extractors) which form the heart of PolyVox. The Volume class is templatised so that different types of data can be stored within each voxel.
/// A LargeVolume is essentially a 3D array in which each element (or <i>voxel</i>) is identified by a three dimensional (x,y,z) coordinate.
/// We use the LargeVolume class to store our data in an efficient way, and it is the input to many of the algorithms (such as the surface
/// extractors) which form the heart of PolyVox. The LargeVolume class is templatised so that different types of data can be stored within each voxel.
///
/// <b> Basic usage</b>
/// The following code snippet shows how to construct a volume and demonstrates basic usage:
///
/// \code
/// Volume<Material8> volume(Region(Vector3DInt32(0,0,0), Vector3DInt32(63,127,255)));
/// LargeVolume<Material8> volume(Region(Vector3DInt32(0,0,0), Vector3DInt32(63,127,255)));
/// volume.setVoxelAt(15, 90, 42, Material8(5));
/// std::cout << "Voxel at (15, 90, 42) has value: " << volume.getVoxelAt(15, 90, 42).getMaterial() << std::endl;
/// std::cout << "Width = " << volume.getWidth() << ", Height = " << volume.getHeight() << ", Depth = " << volume.getDepth() << std::endl;
/// \endcode
///
/// In this particular example each voxel in the Volume is of type 'Material8', as specified by the template parameter. This is one of several
/// In this particular example each voxel in the LargeVolume is of type 'Material8', as specified by the template parameter. This is one of several
/// predefined voxel types, and it is also possible to define your own. The Material8 type simply holds an integer value where zero represents
/// empty space and any other value represents a solid material.
///
/// The Volume constructor takes a Region as a parameter. This specifies the valid range of voxels which can be held in the volume, so in this
/// The LargeVolume constructor takes a Region as a parameter. This specifies the valid range of voxels which can be held in the volume, so in this
/// particular case the valid voxel positions are (0,0,0) to (63, 127, 255). Attempts to access voxels outside this range will result is accessing the
/// border value (see getBorderValue() and setBorderValue()). PolyVox also has support for near infinite volumes which will be discussed later.
///
/// Access to individual voxels is provided via the setVoxelAt() and getVoxelAt() member functions. Advanced users may also be interested in
/// the Sampler class for faster read-only access to a large number of voxels.
///
/// Lastly the example prints out some properties of the Volume. Note that the dimentsions getWidth(), getHeight(), and getDepth() are inclusive, such
/// Lastly the example prints out some properties of the LargeVolume. Note that the dimentsions getWidth(), getHeight(), and getDepth() are inclusive, such
/// that the width is 64 when the range of valid x coordinates goes from 0 to 63.
///
/// <b>Data Representaion</b>
/// If stored carelessly, volume data can take up a huge amount of memory. For example, a volume of dimensions 1024x1024x1024 with
/// 1 byte per voxel will require 1GB of memory if stored in an uncompressed form. Natuarally our Volume class is much more efficient
/// 1 byte per voxel will require 1GB of memory if stored in an uncompressed form. Natuarally our LargeVolume class is much more efficient
/// than this and it is worth understanding (at least at a high level) the approach which is used.
///
/// Essentially, the Volume class stores its data as a collection of blocks. Each of these block is much smaller than the whole volume,
/// Essentially, the LargeVolume class stores its data as a collection of blocks. Each of these block is much smaller than the whole volume,
/// for example a typical size might be 32x32x32 voxels (though is is configurable by the user). In this case, a 256x512x1024 volume
/// would contain 8x16x32 = 4096 blocks. The data for each block is stored in a compressed form, which uses only a small amout of
/// memory but it is hard to modify the data. Therefore, before any given voxel can be modified, its corresponding block must be uncompressed.
@ -100,7 +100,7 @@ namespace PolyVox
/// cannot fit in memory, and then returning it back to PolyVox on demand. For example, the user might choose to temporarily store this data
/// on disk or stream it to a remote database.
///
/// You can construct such a Volume as follows:
/// You can construct such a LargeVolume as follows:
///
/// \code
/// void myDataRequiredHandler(const ConstVolumeProxy<MaterialDensityPair44>& volume, const PolyVox::Region& reg)
@ -115,10 +115,10 @@ namespace PolyVox
/// //provides access to the volume data, and the parameter 'reg' indicates which region of the volume you need to store.
/// }
///
/// Volume<Density>volData(&myDataRequiredHandler, &myDataOverflowHandler);
/// LargeVolume<Density>volData(&myDataRequiredHandler, &myDataOverflowHandler);
/// \endcode
///
/// Essentially you are providing an extension to the Volume class - a way for data to be stored once PolyVox has run out of memory for it. Note
/// Essentially you are providing an extension to the LargeVolume class - a way for data to be stored once PolyVox has run out of memory for it. Note
/// that you don't actually have to do anything with the data - you could simply decide that once it gets removed from memory it doesn't matter
/// anymore. But you still need to be ready to then provide something to PolyVox (even if it's just default data) in the event that it is requested.
///
@ -136,18 +136,18 @@ namespace PolyVox
/// is your cache sise is only one. Of course the logic is more complex, but writing code in such a cache-aware manner may be beneficial in some situations.
///
/// <b>Threading</b>
/// The Volume class does not make any guarentees about thread safety. You should ensure that all accesses are performed from the same thread.
/// The LargeVolume class does not make any guarentees about thread safety. You should ensure that all accesses are performed from the same thread.
/// This is true even if you are only reading data from the volume, as concurrently reading from different threads can invalidate the contents
/// of the block cache (amoung other problems).
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
class Volume
class LargeVolume
{
public:
class Sampler
{
public:
Sampler(Volume<VoxelType>* volume);
Sampler(LargeVolume<VoxelType>* volume);
~Sampler();
typename Sampler& operator=(const typename Sampler& rhs) throw();
@ -156,7 +156,7 @@ namespace PolyVox
int32_t getPosY(void) const;
int32_t getPosZ(void) const;
VoxelType getSubSampledVoxel(uint8_t uLevel) const;
const Volume<VoxelType>* getVolume(void) const;
const LargeVolume<VoxelType>* getVolume(void) const;
inline VoxelType getVoxel(void) const;
void setPosition(const Vector3DInt32& v3dNewPos);
@ -203,7 +203,7 @@ namespace PolyVox
private:
//The current volume
Volume<VoxelType>* mVolume;
LargeVolume<VoxelType>* mVolume;
//The current position in the volume
int32_t mXPosInVolume;
@ -232,14 +232,14 @@ namespace PolyVox
public:
/// Constructor for creating a very large paging volume.
Volume
LargeVolume
(
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler,
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler,
uint16_t uBlockSideLength = 32
);
/// Constructor for creating a fixed size volume.
Volume
LargeVolume
(
const Region& regValid,
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler = 0,
@ -248,16 +248,16 @@ namespace PolyVox
uint16_t uBlockSideLength = 32
);
/// Deprecated constructor - do not use.
Volume
LargeVolume
(
int32_t dont_use_this_constructor_1, int32_t dont_use_this_constructor_2, int32_t dont_use_this_constructor_3
);
/// Destructor
~Volume();
~LargeVolume();
/// Gets the value used for voxels which are outside the volume
VoxelType getBorderValue(void) const;
/// Gets a Region representing the extents of the Volume.
/// Gets a Region representing the extents of the LargeVolume.
Region getEnclosingRegion(void) const;
/// Gets the width of the volume in voxels.
int32_t getWidth(void) const;
@ -310,7 +310,7 @@ private:
/// NOTE: accessing ANY voxels outside this region during the process of this function
/// is absolutely unsafe
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> m_funcDataRequiredHandler;
/// gets called when a Region needs to be stored by the user, because Volume will erase it right after
/// gets called when a Region needs to be stored by the user, because LargeVolume will erase it right after
/// this function returns
/// NOTE: accessing ANY voxels outside this region during the process of this function
/// is absolutely unsafe
@ -359,7 +359,7 @@ private:
};
}
#include "Volume.inl"
#include "VolumeSampler.inl"
#include "LargeVolume.inl"
#include "LargeVolumeSampler.inl"
#endif

View File

@ -37,13 +37,13 @@ freely, subject to the following restrictions:
namespace PolyVox
{
////////////////////////////////////////////////////////////////////////////////
/// When construncting a very large volume you need to be prepared to handle the scenario where there is so much data that PolyVox cannot fit it all in memory. When PolyVox runs out of memory, it identifies the least recently used data and hands it back to the application via a callback function. It is then the responsibility of the application to store this data until PolyVox needs it again (as signalled by another callback function). Please see the Volume class documentation for a full description of this process and the required function signatures. If you really don't want to handle these events then you can provide null pointers here, in which case the data will be discarded and/or filled with default values.
/// When construncting a very large volume you need to be prepared to handle the scenario where there is so much data that PolyVox cannot fit it all in memory. When PolyVox runs out of memory, it identifies the least recently used data and hands it back to the application via a callback function. It is then the responsibility of the application to store this data until PolyVox needs it again (as signalled by another callback function). Please see the LargeVolume class documentation for a full description of this process and the required function signatures. If you really don't want to handle these events then you can provide null pointers here, in which case the data will be discarded and/or filled with default values.
/// \param dataRequiredHandler The callback function which will be called when PolyVox tries to use data which is not currently in momory.
/// \param dataOverflowHandler The callback function which will be called when PolyVox has too much data and needs to remove some from memory.
/// \param uBlockSideLength The size of the blocks making up the volume. Small blocks will compress/decompress faster, but there will also be more of them meaning voxel access could be slower.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
Volume<VoxelType>::Volume
LargeVolume<VoxelType>::LargeVolume
(
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler,
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler,
@ -61,7 +61,7 @@ namespace PolyVox
/// Deprecated - do not use this constructor.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
Volume<VoxelType>::Volume
LargeVolume<VoxelType>::LargeVolume
(
int32_t dont_use_this_constructor_1, int32_t dont_use_this_constructor_2, int32_t dont_use_this_constructor_3
)
@ -79,15 +79,15 @@ namespace PolyVox
}
////////////////////////////////////////////////////////////////////////////////
/// This constructor creates a volume with a fixed size which is specified as a parameter. By default this constructor will not enable paging but you can override this if desired. If you do wish to enable paging then you are required to provide the call back function (see the other Volume constructor).
/// This constructor creates a volume with a fixed size which is specified as a parameter. By default this constructor will not enable paging but you can override this if desired. If you do wish to enable paging then you are required to provide the call back function (see the other LargeVolume constructor).
/// \param regValid Specifies the minimum and maximum valid voxel positions.
/// \param dataRequiredHandler The callback function which will be called when PolyVox tries to use data which is not currently in momory.
/// \param dataOverflowHandler The callback function which will be called when PolyVox has too much data and needs to remove some from memory.
/// \param bPagingEnabled Controls whether or not paging is enabled for this Volume.
/// \param bPagingEnabled Controls whether or not paging is enabled for this LargeVolume.
/// \param uBlockSideLength The size of the blocks making up the volume. Small blocks will compress/decompress faster, but there will also be more of them meaning voxel access could be slower.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
Volume<VoxelType>::Volume
LargeVolume<VoxelType>::LargeVolume
(
const Region& regValid,
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataRequiredHandler,
@ -108,7 +108,7 @@ namespace PolyVox
/// Destroys the volume The destructor will call flushAll() to ensure that a paging volume has the chance to save it's data via the dataOverflowHandler() if desired.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
Volume<VoxelType>::~Volume()
LargeVolume<VoxelType>::~LargeVolume()
{
flushAll();
}
@ -119,7 +119,7 @@ namespace PolyVox
/// \return The value used for voxels outside of the volume
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType Volume<VoxelType>::getBorderValue(void) const
VoxelType LargeVolume<VoxelType>::getBorderValue(void) const
{
return *m_pUncompressedBorderData;
}
@ -128,7 +128,7 @@ namespace PolyVox
/// \return A Region representing the extent of the volume.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
Region Volume<VoxelType>::getEnclosingRegion(void) const
Region LargeVolume<VoxelType>::getEnclosingRegion(void) const
{
return m_regValidRegion;
}
@ -138,7 +138,7 @@ namespace PolyVox
/// \sa getHeight(), getDepth()
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
int32_t Volume<VoxelType>::getWidth(void) const
int32_t LargeVolume<VoxelType>::getWidth(void) const
{
return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1;
}
@ -148,7 +148,7 @@ namespace PolyVox
/// \sa getWidth(), getDepth()
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
int32_t Volume<VoxelType>::getHeight(void) const
int32_t LargeVolume<VoxelType>::getHeight(void) const
{
return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1;
}
@ -158,7 +158,7 @@ namespace PolyVox
/// \sa getWidth(), getHeight()
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
int32_t Volume<VoxelType>::getDepth(void) const
int32_t LargeVolume<VoxelType>::getDepth(void) const
{
return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1;
}
@ -169,7 +169,7 @@ namespace PolyVox
/// \sa getLongestSideLength(), getDiagonalLength()
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
int32_t Volume<VoxelType>::getShortestSideLength(void) const
int32_t LargeVolume<VoxelType>::getShortestSideLength(void) const
{
return m_uShortestSideLength;
}
@ -180,7 +180,7 @@ namespace PolyVox
/// \sa getShortestSideLength(), getDiagonalLength()
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
int32_t Volume<VoxelType>::getLongestSideLength(void) const
int32_t LargeVolume<VoxelType>::getLongestSideLength(void) const
{
return m_uLongestSideLength;
}
@ -192,7 +192,7 @@ namespace PolyVox
/// \sa getShortestSideLength(), getLongestSideLength()
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
float Volume<VoxelType>::getDiagonalLength(void) const
float LargeVolume<VoxelType>::getDiagonalLength(void) const
{
return m_fDiagonalLength;
}
@ -204,7 +204,7 @@ namespace PolyVox
/// \return The voxel value
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
VoxelType LargeVolume<VoxelType>::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
{
if(m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)))
{
@ -231,7 +231,7 @@ namespace PolyVox
/// \return The voxel value
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAt(const Vector3DInt32& v3dPos) const
VoxelType LargeVolume<VoxelType>::getVoxelAt(const Vector3DInt32& v3dPos) const
{
return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
}
@ -241,7 +241,7 @@ namespace PolyVox
/// \param bCompressionEnabled Specifies whether compression is enabled.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::setCompressionEnabled(bool bCompressionEnabled)
void LargeVolume<VoxelType>::setCompressionEnabled(bool bCompressionEnabled)
{
//Early out - nothing to do
if(m_bCompressionEnabled == bCompressionEnabled)
@ -267,7 +267,7 @@ namespace PolyVox
/// \param uBlockCacheSize The number of blocks for which uncompressed data can be cached.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::setMaxNumberOfUncompressedBlocks(uint16_t uMaxNumberOfUncompressedBlocks)
void LargeVolume<VoxelType>::setMaxNumberOfUncompressedBlocks(uint16_t uMaxNumberOfUncompressedBlocks)
{
clearBlockCache();
@ -279,7 +279,7 @@ namespace PolyVox
/// \param uMaxBlocks The number of blocks
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::setMaxNumberOfBlocksInMemory(uint16_t uMaxNumberOfBlocksInMemory)
void LargeVolume<VoxelType>::setMaxNumberOfBlocksInMemory(uint16_t uMaxNumberOfBlocksInMemory)
{
if(m_pBlocks.size() > uMaxNumberOfBlocksInMemory)
{
@ -292,7 +292,7 @@ namespace PolyVox
/// \param tBorder The value to use for voxels outside the volume.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::setBorderValue(const VoxelType& tBorder)
void LargeVolume<VoxelType>::setBorderValue(const VoxelType& tBorder)
{
/*Block<VoxelType>* pUncompressedBorderBlock = getUncompressedBlock(&m_pBorderBlock);
return pUncompressedBorderBlock->fill(tBorder);*/
@ -307,7 +307,7 @@ namespace PolyVox
/// \return whether the requested position is inside the volume
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
bool Volume<VoxelType>::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
bool LargeVolume<VoxelType>::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
{
assert(m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)));
@ -333,7 +333,7 @@ namespace PolyVox
/// \return whether the requested position is inside the volume
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
bool Volume<VoxelType>::setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue)
bool LargeVolume<VoxelType>::setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue)
{
return setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue);
}
@ -344,7 +344,7 @@ namespace PolyVox
/// \param regPrefetch The Region of voxels to prefetch into memory.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::prefetch(Region regPrefetch)
void LargeVolume<VoxelType>::prefetch(Region regPrefetch)
{
Vector3DInt32 v3dStart;
for(int i = 0; i < 3; i++)
@ -401,7 +401,7 @@ namespace PolyVox
/// Removes all voxels from memory, and calls dataOverflowHandler() to ensure the application has a chance to store the data.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::flushAll()
void LargeVolume<VoxelType>::flushAll()
{
typename std::map<Vector3DInt32, LoadedBlock >::iterator i;
//Replaced the for loop here as the call to
@ -416,7 +416,7 @@ namespace PolyVox
/// Removes all voxels in the specified Region from memory, and calls dataOverflowHandler() to ensure the application has a chance to store the data. It is possible that there are no voxels loaded in the Region, in which case the function will have no effect.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::flush(Region regFlush)
void LargeVolume<VoxelType>::flush(Region regFlush)
{
Vector3DInt32 v3dStart;
for(int i = 0; i < 3; i++)
@ -458,7 +458,7 @@ namespace PolyVox
///
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::clearBlockCache(void)
void LargeVolume<VoxelType>::clearBlockCache(void)
{
for(uint32_t ct = 0; ct < m_vecUncompressedBlockCache.size(); ct++)
{
@ -471,7 +471,7 @@ namespace PolyVox
/// This function should probably be made internal...
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
void Volume<VoxelType>::resize(const Region& regValidRegion, uint16_t uBlockSideLength)
void LargeVolume<VoxelType>::resize(const Region& regValidRegion, uint16_t uBlockSideLength)
{
//Debug mode validation
assert(uBlockSideLength > 0);
@ -523,7 +523,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::eraseBlock(typename std::map<Vector3DInt32, LoadedBlock >::iterator itBlock) const
void LargeVolume<VoxelType>::eraseBlock(typename std::map<Vector3DInt32, LoadedBlock >::iterator itBlock) const
{
if(m_funcDataOverflowHandler)
{
@ -556,7 +556,7 @@ namespace PolyVox
}
template <typename VoxelType>
bool Volume<VoxelType>::setVoxelAtConst(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const
bool LargeVolume<VoxelType>::setVoxelAtConst(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const
{
//We don't have any range checks in this function because it
//is a private function only called by the ConstVolumeProxy. The
@ -580,7 +580,7 @@ namespace PolyVox
template <typename VoxelType>
Block<VoxelType>* Volume<VoxelType>::getUncompressedBlock(int32_t uBlockX, int32_t uBlockY, int32_t uBlockZ) const
Block<VoxelType>* LargeVolume<VoxelType>::getUncompressedBlock(int32_t uBlockX, int32_t uBlockY, int32_t uBlockZ) const
{
Vector3DInt32 v3dBlockPos(uBlockX, uBlockY, uBlockZ);
@ -695,7 +695,7 @@ namespace PolyVox
/// Note: This function needs reviewing for accuracy...
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
float Volume<VoxelType>::calculateCompressionRatio(void)
float LargeVolume<VoxelType>::calculateCompressionRatio(void)
{
float fRawSize = m_pBlocks.size() * m_uBlockSideLength * m_uBlockSideLength* m_uBlockSideLength * sizeof(VoxelType);
float fCompressedSize = calculateSizeInBytes();
@ -706,9 +706,9 @@ namespace PolyVox
/// Note: This function needs reviewing for accuracy...
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
uint32_t Volume<VoxelType>::calculateSizeInBytes(void)
uint32_t LargeVolume<VoxelType>::calculateSizeInBytes(void)
{
uint32_t uSizeInBytes = sizeof(Volume);
uint32_t uSizeInBytes = sizeof(LargeVolume);
//Memory used by the blocks
typename std::map<Vector3DInt32, LoadedBlock >::iterator i;

View File

@ -22,7 +22,7 @@ freely, subject to the following restrictions:
*******************************************************************************/
#include "PolyVoxImpl/Block.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "Vector.h"
#include "Region.h"
@ -35,18 +35,18 @@ freely, subject to the following restrictions:
namespace PolyVox
{
template <typename VoxelType>
Volume<VoxelType>::Sampler::Sampler(Volume<VoxelType>* volume)
LargeVolume<VoxelType>::Sampler::Sampler(LargeVolume<VoxelType>* volume)
:mVolume(volume)
{
}
template <typename VoxelType>
Volume<VoxelType>::Sampler::~Sampler()
LargeVolume<VoxelType>::Sampler::~Sampler()
{
}
template <typename VoxelType>
typename Volume<VoxelType>::Sampler& Volume<VoxelType>::Sampler::operator=(const typename Volume<VoxelType>::Sampler& rhs) throw()
typename LargeVolume<VoxelType>::Sampler& LargeVolume<VoxelType>::Sampler::operator=(const typename LargeVolume<VoxelType>::Sampler& rhs) throw()
{
if(this == &rhs)
{
@ -61,25 +61,25 @@ namespace PolyVox
}
template <typename VoxelType>
int32_t Volume<VoxelType>::Sampler::getPosX(void) const
int32_t LargeVolume<VoxelType>::Sampler::getPosX(void) const
{
return mXPosInVolume;
}
template <typename VoxelType>
int32_t Volume<VoxelType>::Sampler::getPosY(void) const
int32_t LargeVolume<VoxelType>::Sampler::getPosY(void) const
{
return mYPosInVolume;
}
template <typename VoxelType>
int32_t Volume<VoxelType>::Sampler::getPosZ(void) const
int32_t LargeVolume<VoxelType>::Sampler::getPosZ(void) const
{
return mZPosInVolume;
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const
VoxelType LargeVolume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const
{
if(uLevel == 0)
{
@ -117,25 +117,25 @@ namespace PolyVox
}
template <typename VoxelType>
const Volume<VoxelType>* Volume<VoxelType>::Sampler::getVolume(void) const
const LargeVolume<VoxelType>* LargeVolume<VoxelType>::Sampler::getVolume(void) const
{
return mVolume;
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::getVoxel(void) const
VoxelType LargeVolume<VoxelType>::Sampler::getVoxel(void) const
{
return *mCurrentVoxel;
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::setPosition(const Vector3DInt32& v3dNewPos)
void LargeVolume<VoxelType>::Sampler::setPosition(const Vector3DInt32& v3dNewPos)
{
setPosition(v3dNewPos.getX(), v3dNewPos.getY(), v3dNewPos.getZ());
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos)
void LargeVolume<VoxelType>::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos)
{
mXPosInVolume = xPos;
mYPosInVolume = yPos;
@ -166,7 +166,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::movePositiveX(void)
void LargeVolume<VoxelType>::Sampler::movePositiveX(void)
{
//Note the *pre* increament here
if((++mXPosInVolume) % mVolume->m_uBlockSideLength != 0)
@ -182,7 +182,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::movePositiveY(void)
void LargeVolume<VoxelType>::Sampler::movePositiveY(void)
{
//Note the *pre* increament here
if((++mYPosInVolume) % mVolume->m_uBlockSideLength != 0)
@ -198,7 +198,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::movePositiveZ(void)
void LargeVolume<VoxelType>::Sampler::movePositiveZ(void)
{
//Note the *pre* increament here
if((++mZPosInVolume) % mVolume->m_uBlockSideLength != 0)
@ -214,7 +214,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::moveNegativeX(void)
void LargeVolume<VoxelType>::Sampler::moveNegativeX(void)
{
//Note the *post* decreament here
if((mXPosInVolume--) % mVolume->m_uBlockSideLength != 0)
@ -230,7 +230,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::moveNegativeY(void)
void LargeVolume<VoxelType>::Sampler::moveNegativeY(void)
{
//Note the *post* decreament here
if((mYPosInVolume--) % mVolume->m_uBlockSideLength != 0)
@ -246,7 +246,7 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::Sampler::moveNegativeZ(void)
void LargeVolume<VoxelType>::Sampler::moveNegativeZ(void)
{
//Note the *post* decreament here
if((mZPosInVolume--) % mVolume->m_uBlockSideLength != 0)
@ -262,7 +262,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -272,7 +272,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mYPosInVolume) )
{
@ -282,7 +282,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -292,7 +292,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -302,7 +302,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
{
if( BORDER_LOW(mXPosInVolume) )
{
@ -312,7 +312,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -322,7 +322,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_LOW(mYPosInVolume) )
{
@ -332,7 +332,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) )
{
@ -342,7 +342,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
{
if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -354,7 +354,7 @@ namespace PolyVox
//////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
{
if( BORDER_LOW(mYPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -364,7 +364,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
{
if( BORDER_LOW(mYPosInVolume) )
{
@ -374,7 +374,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
{
if( BORDER_LOW(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -384,7 +384,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
{
if( BORDER_LOW(mZPosInVolume) )
{
@ -394,13 +394,13 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
{
return *mCurrentVoxel;
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
{
if( BORDER_HIGH(mZPosInVolume) )
{
@ -410,7 +410,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
{
if( BORDER_HIGH(mYPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -420,7 +420,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
{
if( BORDER_HIGH(mYPosInVolume) )
{
@ -430,7 +430,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
{
if( BORDER_HIGH(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -442,7 +442,7 @@ namespace PolyVox
//////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -452,7 +452,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mYPosInVolume) )
{
@ -462,7 +462,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -472,7 +472,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -482,7 +482,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
{
if( BORDER_HIGH(mXPosInVolume) )
{
@ -492,7 +492,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{
@ -502,7 +502,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_LOW(mZPosInVolume) )
{
@ -512,7 +512,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) )
{
@ -522,7 +522,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
{
if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) )
{

View File

@ -33,7 +33,7 @@ namespace PolyVox
{
///This class represents a voxel storing only a material.
////////////////////////////////////////////////////////////////////////////////
/// In order to perform a surface extraction on a Volume, PolyVox needs the underlying
/// In order to perform a surface extraction on a LargeVolume, PolyVox needs the underlying
/// voxel type to provide both getDensity() and getMaterial() functions. The getDensity()
/// function is used to determine if a voxel is 'solid', and if it is then the getMaterial()
/// funtion is used to determine what material should be assigned to the resulting mesh.

View File

@ -31,7 +31,7 @@ namespace PolyVox
{
///This class represents a voxel storing only a density.
////////////////////////////////////////////////////////////////////////////////
/// In order to perform a surface extraction on a Volume, PolyVox needs the underlying
/// In order to perform a surface extraction on a LargeVolume, PolyVox needs the underlying
/// voxel type to provide both getDensity() and getMaterial() functions. The getDensity()
/// function is used to determine if a voxel is 'solid', and if it is then the getMaterial()
/// funtion is used to determine what material should be assigned to the resulting mesh.

View File

@ -62,8 +62,8 @@ namespace PolyVox
template <typename VoxelType> class ConstVolumeProxy;
//---------- Volume ----------
template <typename VoxelType> class Volume;
//---------- LargeVolume ----------
template <typename VoxelType> class LargeVolume;
//---------------------------------
//---------- Mesh ----------

View File

@ -45,7 +45,7 @@ namespace PolyVox
};
//Make Sampler a friend
friend class Volume<VoxelType>::Sampler;
friend class LargeVolume<VoxelType>::Sampler;
public:
Block(uint16_t uSideLength = 0);

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
#include "PolyVoxImpl/Utility.h"
#include "Vector.h"
#include "Volume.h"
#include "LargeVolume.h"
#include <cassert>
#include <cstring> //For memcpy

View File

@ -85,7 +85,7 @@ namespace PolyVox
{
public:
///Constructor
Raycast(Volume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result);
Raycast(LargeVolume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result);
///Sets the start position for the ray.
void setStart(const Vector3DFloat& v3dStart);
@ -100,8 +100,8 @@ namespace PolyVox
void doRaycast(float x1, float y1, float z1, float x2, float y2, float z2);
Volume<VoxelType>* m_volData;
Volume<VoxelType>::Sampler m_sampVolume;
LargeVolume<VoxelType>* m_volData;
typename LargeVolume<VoxelType>::Sampler m_sampVolume;
Vector3DFloat m_v3dStart;
Vector3DFloat m_v3dDirection;

View File

@ -31,7 +31,7 @@ namespace PolyVox
/// \param result An instance of RaycastResult in which the result will be stored.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
Raycast<VoxelType>::Raycast(Volume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result)
Raycast<VoxelType>::Raycast(LargeVolume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result)
:m_volData(volData)
,m_sampVolume(volData)
,m_v3dStart(v3dStart)

View File

@ -31,7 +31,7 @@ namespace PolyVox
{
public:
///Constructor
RaycastWithCallback(Volume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function<bool(const Vector3DInt32& position)> funcCallback);
RaycastWithCallback(LargeVolume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function<bool(const Vector3DInt32& position)> funcCallback);
///Sets the start position for the ray.
void setStart(const Vector3DFloat& v3dStart);
@ -46,8 +46,8 @@ namespace PolyVox
void doRaycast(float x1, float y1, float z1, float x2, float y2, float z2);
Volume<VoxelType>* m_volData;
Volume<VoxelType>::Sampler m_sampVolume;
LargeVolume<VoxelType>* m_volData;
typename LargeVolume<VoxelType>::Sampler m_sampVolume;
Vector3DFloat m_v3dStart;
Vector3DFloat m_v3dDirection;

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
template <typename VoxelType>
RaycastWithCallback<VoxelType>::RaycastWithCallback(Volume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function<bool(const Vector3DInt32& position)> funcCallback)
RaycastWithCallback<VoxelType>::RaycastWithCallback(LargeVolume<VoxelType>* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function<bool(const Vector3DInt32& position)> funcCallback)
:m_volData(volData)
,m_sampVolume(volData)
,m_v3dStart(v3dStart)

View File

@ -25,7 +25,7 @@ freely, subject to the following restrictions:
#define __PolyVox_SurfaceExtractor_H__
#include "PolyVoxForwardDeclarations.h"
#include "Volume.h"
#include "LargeVolume.h"
#include "PolyVoxImpl/TypeDef.h"
@ -35,7 +35,7 @@ namespace PolyVox
class SurfaceExtractor
{
public:
SurfaceExtractor(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result);
SurfaceExtractor(LargeVolume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result);
void execute();
@ -54,8 +54,8 @@ namespace PolyVox
Array2DInt32& m_pCurrentVertexIndicesY,
Array2DInt32& m_pCurrentVertexIndicesZ);
Vector3DFloat computeCentralDifferenceGradient(const typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeSobelGradient(const typename Volume<VoxelType>::Sampler& volIter);
Vector3DFloat computeCentralDifferenceGradient(const typename LargeVolume<VoxelType>::Sampler& volIter);
Vector3DFloat computeSobelGradient(const typename LargeVolume<VoxelType>::Sampler& volIter);
//Use the cell bitmasks to generate all the indices needed for that slice
void generateIndicesForSlice(const Array2DUint8& pPreviousBitmask,
@ -67,8 +67,8 @@ namespace PolyVox
const Array2DInt32& m_pCurrentVertexIndicesZ);
//The volume data and a sampler to access it.
Volume<VoxelType>* m_volData;
typename Volume<VoxelType>::Sampler m_sampVolume;
LargeVolume<VoxelType>* m_volData;
typename LargeVolume<VoxelType>::Sampler m_sampVolume;
//Holds a position in volume space.
int32_t iXVolSpace;

View File

@ -30,7 +30,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
template <typename VoxelType>
SurfaceExtractor<VoxelType>::SurfaceExtractor(Volume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
SurfaceExtractor<VoxelType>::SurfaceExtractor(LargeVolume<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
:m_volData(volData)
,m_sampVolume(volData)
,m_regSizeInVoxels(region)
@ -507,7 +507,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat SurfaceExtractor<VoxelType>::computeCentralDifferenceGradient(const typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat SurfaceExtractor<VoxelType>::computeCentralDifferenceGradient(const typename LargeVolume<VoxelType>::Sampler& volIter)
{
uint8_t voxel1nx = volIter.peekVoxel1nx0py0pz().getDensity();
uint8_t voxel1px = volIter.peekVoxel1px0py0pz().getDensity();
@ -527,7 +527,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat SurfaceExtractor<VoxelType>::computeSobelGradient(const typename Volume<VoxelType>::Sampler& volIter)
Vector3DFloat SurfaceExtractor<VoxelType>::computeSobelGradient(const typename LargeVolume<VoxelType>::Sampler& 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} } };

View File

@ -27,11 +27,11 @@ freely, subject to the following restrictions:
#include "PolyVoxForwardDeclarations.h"
#include "PolyVoxImpl/TypeDef.h"
#include "Volume.h"
#include "LargeVolume.h"
namespace PolyVox
{
float computeSmoothedVoxel(Volume<uint8_t>::Sampler& volIter);
float computeSmoothedVoxel(LargeVolume<uint8_t>::Sampler& volIter);
}
#endif

View File

@ -26,13 +26,13 @@ freely, subject to the following restrictions:
#include "VertexTypes.h"
#include "PolyVoxImpl/TypeDef.h"
#include "Volume.h"
#include "LargeVolume.h"
using namespace std;
namespace PolyVox
{
void computeNormalsForVertices(Volume<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod)
void computeNormalsForVertices(LargeVolume<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod)
{
std::vector<PositionMaterialNormal>& vecVertices = mesh.getRawVertexData();
std::vector<PositionMaterialNormal>::iterator iterSurfaceVertex = vecVertices.begin();
@ -41,7 +41,7 @@ namespace PolyVox
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(mesh.m_Region.getLowerCorner());
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
Volume<uint8_t>::Sampler volIter(volumeData);
LargeVolume<uint8_t>::Sampler volIter(volumeData);
//Check all corners are within the volume, allowing a boundary for gradient estimation
bool lowerCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor,2);
@ -63,11 +63,11 @@ namespace PolyVox
}
}
Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod)
Vector3DFloat computeNormal(LargeVolume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod)
{
Vector3DFloat v3dGradient; //To store the result
Volume<uint8_t>::Sampler volIter(volumeData);
LargeVolume<uint8_t>::Sampler volIter(volumeData);
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);

View File

@ -25,7 +25,7 @@ freely, subject to the following restrictions:
namespace PolyVox
{
float computeSmoothedVoxel(Volume<uint8_t>::Sampler& volIter)
float computeSmoothedVoxel(LargeVolume<uint8_t>::Sampler& volIter)
{
assert(volIter.getPosX() >= 1);
assert(volIter.getPosY() >= 1);

View File

@ -42,28 +42,28 @@ namespace PolyVox
// THESE FUNCTIONS ARE DEPRECATED. USE VERSIONED 'loadVolume' AND 'saveVolume' INSTEAD.
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
polyvox_shared_ptr< Volume<VoxelType> > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0);
polyvox_shared_ptr< LargeVolume<VoxelType> > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0);
template <typename VoxelType>
void saveVolumeRaw(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
void saveVolumeRaw(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
template <typename VoxelType>
polyvox_shared_ptr< Volume<VoxelType> > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0);
polyvox_shared_ptr< LargeVolume<VoxelType> > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0);
template <typename VoxelType>
void saveVolumeRle(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
void saveVolumeRle(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
////////////////////////////////////////////////////////////////////////////////
// END OF DEPRECATED FUNCTIONS
////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
bool loadVolume(std::istream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
bool loadVolume(std::istream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
template <typename VoxelType>
bool saveVolume(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
bool saveVolume(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
template <typename VoxelType>
bool loadVersion0(std::istream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
bool loadVersion0(std::istream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
template <typename VoxelType>
bool saveVersion0(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
bool saveVersion0(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener = 0);
}
#include "Serialization.inl"

View File

@ -21,7 +21,7 @@ freely, subject to the following restrictions:
distribution.
*******************************************************************************/
#include "Volume.h"
#include "LargeVolume.h"
#include "PolyVoxImpl/Utility.h"
namespace PolyVox
@ -29,7 +29,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
template <typename VoxelType>
polyvox_shared_ptr< Volume<VoxelType> > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener)
polyvox_shared_ptr< LargeVolume<VoxelType> > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener)
{
assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'loadVolume()' ASAP.
@ -46,7 +46,7 @@ namespace PolyVox
uint16_t volumeDepth = 0x0001 << volumeDepthPower;
//FIXME - need to support non cubic volumes
polyvox_shared_ptr< Volume<VoxelType> > volume(new Volume<VoxelType>(volumeWidth, volumeHeight, volumeDepth));
polyvox_shared_ptr< LargeVolume<VoxelType> > volume(new LargeVolume<VoxelType>(volumeWidth, volumeHeight, volumeDepth));
//Read data
for(uint16_t z = 0; z < volumeDepth; ++z)
@ -80,7 +80,7 @@ namespace PolyVox
}
template <typename VoxelType>
void saveVolumeRaw(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
void saveVolumeRaw(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
{
assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'saveVolume()' ASAP.
@ -98,7 +98,7 @@ namespace PolyVox
stream.write(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//Write data
Volume<VoxelType>::Sampler volIter(&volume);
LargeVolume<VoxelType>::Sampler volIter(&volume);
for(uint16_t z = 0; z < volumeDepth; ++z)
{
//Update progress once per slice.
@ -129,7 +129,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
template <typename VoxelType>
polyvox_shared_ptr< Volume<VoxelType> > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener)
polyvox_shared_ptr< LargeVolume<VoxelType> > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener)
{
assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'loadVolume()' ASAP.
@ -146,7 +146,7 @@ namespace PolyVox
uint16_t volumeDepth = 0x0001 << volumeDepthPower;
//FIXME - need to support non cubic volumes
polyvox_shared_ptr< Volume<VoxelType> > volume(new Volume<VoxelType>(volumeWidth, volumeHeight, volumeDepth));
polyvox_shared_ptr< LargeVolume<VoxelType> > volume(new LargeVolume<VoxelType>(volumeWidth, volumeHeight, volumeDepth));
//Read data
bool firstTime = true;
@ -194,7 +194,7 @@ namespace PolyVox
}
template <typename VoxelType>
void saveVolumeRle(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
void saveVolumeRle(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
{
assert(false); //THIS FUNCTION IS DEPRECATED. REMOVE THIS ASSERT TO CONTINUE, BUT SWITCH TO 'saveVolume()' ASAP.
@ -212,7 +212,7 @@ namespace PolyVox
stream.write(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//Write data
Volume<VoxelType>::Sampler volIter(&volume);
LargeVolume<VoxelType>::Sampler volIter(&volume);
VoxelType current;
uint32_t runLength = 0;
bool firstTime = true;
@ -269,7 +269,7 @@ namespace PolyVox
////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
bool loadVolume(std::istream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
bool loadVolume(std::istream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
{
char pIdentifier[8];
stream.read(pIdentifier, 7);
@ -294,7 +294,7 @@ namespace PolyVox
}
template <typename VoxelType>
bool saveVolume(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
bool saveVolume(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
{
char pIdentifier[] = "PolyVox";
stream.write(pIdentifier, 7);
@ -308,7 +308,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
template <typename VoxelType>
bool loadVersion0(std::istream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
bool loadVersion0(std::istream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
{
//Read volume dimensions
uint16_t volumeWidth = 0;
@ -368,7 +368,7 @@ namespace PolyVox
}
template <typename VoxelType>
bool saveVersion0(std::ostream& stream, Volume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
bool saveVersion0(std::ostream& stream, LargeVolume<VoxelType>& volume, VolumeSerializationProgressListener* progressListener)
{
//Write volume dimensions
uint16_t volumeWidth = volume.getWidth();
@ -380,7 +380,7 @@ namespace PolyVox
stream.write(reinterpret_cast<char*>(&volumeDepth), sizeof(volumeDepth));
//Write data
Volume<VoxelType>::Sampler volIter(&volume);
LargeVolume<VoxelType>::Sampler volIter(&volume);
VoxelType current;
uint32_t runLength = 0;
bool firstTime = true;

View File

@ -37,13 +37,13 @@ namespace PolyVox
{
public:
//Constructors, etc
VolumeChangeTracker(Volume<VoxelType>* volumeDataToSet, uint16_t regionSideLength);
VolumeChangeTracker(LargeVolume<VoxelType>* volumeDataToSet, uint16_t regionSideLength);
~VolumeChangeTracker();
//Getters
int32_t getCurrentTime(void) const;
int32_t getLastModifiedTimeForRegion(uint16_t uX, uint16_t uY, uint16_t uZ);
Volume<VoxelType>* getWrappedVolume(void) const;
LargeVolume<VoxelType>* getWrappedVolume(void) const;
//Setters
void setAllRegionsModified(void);
@ -59,7 +59,7 @@ namespace PolyVox
void incrementCurrentTime(void);
bool m_bIsLocked;
Region m_regLastLocked;
Volume<VoxelType>* volumeData;
LargeVolume<VoxelType>* volumeData;
uint16_t m_uRegionSideLength;
uint8_t m_uRegionSideLengthPower;
@ -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.
Volume<int32_t>* volRegionLastModified;
LargeVolume<int32_t>* volRegionLastModified;
static uint32_t m_uCurrentTime;
};

View File

@ -29,7 +29,7 @@ freely, subject to the following restrictions:
#include "VertexTypes.h"
#include "PolyVoxImpl/Utility.h"
#include "Vector.h"
#include "Volume.h"
#include "LargeVolume.h"
namespace PolyVox
{
@ -40,7 +40,7 @@ namespace PolyVox
// VolumeChangeTracker
//////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VolumeChangeTracker<VoxelType>::VolumeChangeTracker(Volume<VoxelType>* volumeDataToSet, uint16_t regionSideLength)
VolumeChangeTracker<VoxelType>::VolumeChangeTracker(LargeVolume<VoxelType>* volumeDataToSet, uint16_t regionSideLength)
:m_bIsLocked(false)
,volumeData(0)
,m_uRegionSideLength(regionSideLength)
@ -51,7 +51,7 @@ namespace PolyVox
m_uVolumeDepthInRegions = volumeData->getDepth() / m_uRegionSideLength;
m_uRegionSideLengthPower = PolyVox::logBase2(m_uRegionSideLength);
volRegionLastModified = new Volume<int32_t>(m_uVolumeWidthInRegions, m_uVolumeHeightInRegions, m_uVolumeDepthInRegions, 0);
volRegionLastModified = new LargeVolume<int32_t>(m_uVolumeWidthInRegions, m_uVolumeHeightInRegions, m_uVolumeDepthInRegions, 0);
}
template <typename VoxelType>
@ -88,7 +88,7 @@ namespace PolyVox
}
template <typename VoxelType>
Volume<VoxelType>* VolumeChangeTracker<VoxelType>::getWrappedVolume(void) const
LargeVolume<VoxelType>* VolumeChangeTracker<VoxelType>::getWrappedVolume(void) const
{
return volumeData;
}

View File

@ -38,7 +38,7 @@ CREATE_TEST(testvector.h testvector.cpp testvector)
ADD_TEST(VectorLengthTest ${LATEST_TEST} testLength)
ADD_TEST(VectorDotProductTest ${LATEST_TEST} testDotProduct)
# Volume tests
# LargeVolume tests
CREATE_TEST(testvolume.h testvolume.cpp testvolume)
ADD_TEST(VolumeSizeTest ${LATEST_TEST} testSize)

View File

@ -70,7 +70,7 @@ void TestArray::testReadWrite()
QCOMPARE(total, expectedTotal);
/*const PolyVox::uint16_t g_uVolumeSideLength = 128;
Volume<PolyVox::uint8_t> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength);
LargeVolume<PolyVox::uint8_t> volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength);
volData.tidyUpMemory(0);

View File

@ -23,7 +23,7 @@ freely, subject to the following restrictions:
#include "testvolume.h"
#include <Volume.h>
#include <LargeVolume.h>
#include <QtTest>
@ -32,7 +32,7 @@ using namespace PolyVox;
void TestVolume::testSize()
{
const int32_t g_uVolumeSideLength = 128;
Volume<uint8_t> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1)));
LargeVolume<uint8_t> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1)));
for (int32_t z = 0; z < g_uVolumeSideLength; z++)
{