diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index f4f984a3..f689eafb 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -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 //Use the PolyVox namespace using namespace PolyVox; -void createSphereInVolume(Volume& volData, float fRadius) +void createSphereInVolume(LargeVolume& 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 volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); + LargeVolume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); createSphereInVolume(volData, 30); //Extract the surface diff --git a/examples/OpenGL/OpenGLWidget.cpp b/examples/OpenGL/OpenGLWidget.cpp index 63192bc6..1c8496bd 100644 --- a/examples/OpenGL/OpenGLWidget.cpp +++ b/examples/OpenGL/OpenGLWidget.cpp @@ -48,7 +48,7 @@ OpenGLWidget::OpenGLWidget(QWidget *parent) timer->start(0); } -void OpenGLWidget::setVolume(PolyVox::Volume* volData) +void OpenGLWidget::setVolume(PolyVox::LargeVolume* volData) { //First we free anything from the previous volume (if there was one). m_mapOpenGLSurfaceMeshes.clear(); diff --git a/examples/OpenGL/OpenGLWidget.h b/examples/OpenGL/OpenGLWidget.h index 21829d06..959bb506 100644 --- a/examples/OpenGL/OpenGLWidget.h +++ b/examples/OpenGL/OpenGLWidget.h @@ -29,7 +29,7 @@ freely, subject to the following restrictions: #include #include -#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* volData); + void setVolume(PolyVox::LargeVolume* 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* m_volData; + PolyVox::LargeVolume* m_volData; //Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region std::map m_mapOpenGLSurfaceMeshes; diff --git a/examples/OpenGL/Shapes.cpp b/examples/OpenGL/Shapes.cpp index 023f2d54..be2939e8 100644 --- a/examples/OpenGL/Shapes.cpp +++ b/examples/OpenGL/Shapes.cpp @@ -27,7 +27,7 @@ freely, subject to the following restrictions: using namespace PolyVox; -void createSphereInVolume(Volume& volData, float fRadius, uint8_t uValue) +void createSphereInVolume(LargeVolume& 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& volData, float fRadius, } } -void createCubeInVolume(Volume& volData, Vector3DInt32 lowerCorner, Vector3DInt32 upperCorner, uint8_t uValue) +void createCubeInVolume(LargeVolume& 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++) diff --git a/examples/OpenGL/Shapes.h b/examples/OpenGL/Shapes.h index e953c654..000478ce 100644 --- a/examples/OpenGL/Shapes.h +++ b/examples/OpenGL/Shapes.h @@ -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& volData, float fRadius, uint8_t uValue); -void createCubeInVolume(PolyVox::Volume& volData, PolyVox::Vector3DInt32 lowerCorner, PolyVox::Vector3DInt32 upperCorner, uint8_t uValue); +void createSphereInVolume(PolyVox::LargeVolume& volData, float fRadius, uint8_t uValue); +void createCubeInVolume(PolyVox::LargeVolume& volData, PolyVox::Vector3DInt32 lowerCorner, PolyVox::Vector3DInt32 upperCorner, uint8_t uValue); #endif //__OpenGLExample_Shapes_H__ \ No newline at end of file diff --git a/examples/OpenGL/main.cpp b/examples/OpenGL/main.cpp index 63a46c71..68c1c708 100644 --- a/examples/OpenGL/main.cpp +++ b/examples/OpenGL/main.cpp @@ -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 volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1))); + LargeVolume 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; diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index 0a9509bc..8accfa19 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -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 @@ -36,7 +36,7 @@ freely, subject to the following restrictions: //Use the PolyVox namespace using namespace PolyVox; -void createPerlinVolumeSlow(Volume& volData) +void createPerlinVolumeSlow(LargeVolume& volData) { Perlin perlin(2,8,1,234); @@ -75,7 +75,7 @@ void createPerlinVolumeSlow(Volume& volData) } } -/*void createPerlinVolumeFast(Volume& volData) +/*void createPerlinVolumeFast(LargeVolume& volData) { Perlin perlin(2,8,1,234); @@ -123,7 +123,7 @@ void createPerlinVolumeSlow(Volume& volData) } }*/ -void createPerlinTerrain(Volume& volData) +void createPerlinTerrain(LargeVolume& volData) { Perlin perlin(2,2,1,234); @@ -159,7 +159,7 @@ void createPerlinTerrain(Volume& volData) std::cout << std::endl; } -void createSphereInVolume(Volume& volData, Vector3DFloat v3dVolCenter, float fRadius) +void createSphereInVolume(LargeVolume& 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 volData(&load, &unload, 256); - //Volume volData(polyvox_bind(&load, polyvox_placeholder_1, polyvox_placeholder_2), + LargeVolume volData(&load, &unload, 256); + //LargeVolume 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); diff --git a/library/PolyVoxCore/CMakeLists.txt b/library/PolyVoxCore/CMakeLists.txt index 0051b069..32cb02b3 100644 --- a/library/PolyVoxCore/CMakeLists.txt +++ b/library/PolyVoxCore/CMakeLists.txt @@ -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 ) diff --git a/library/PolyVoxCore/include/AStarPathfinder.h b/library/PolyVoxCore/include/AStarPathfinder.h index 8a04b5f2..03fd4da2 100644 --- a/library/PolyVoxCore/include/AStarPathfinder.h +++ b/library/PolyVoxCore/include/AStarPathfinder.h @@ -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 - bool aStarDefaultVoxelValidator(const Volume* volData, const Vector3DInt32& v3dPos); + bool aStarDefaultVoxelValidator(const LargeVolume* volData, const Vector3DInt32& v3dPos); /// Provides a configuration for the AStarPathfinder. //////////////////////////////////////////////////////////////////////////////// @@ -63,14 +63,14 @@ namespace PolyVox public: AStarPathfinderParams ( - Volume* volData, + LargeVolume* volData, const Vector3DInt32& v3dStart, const Vector3DInt32& v3dEnd, std::list* listResult, float fHBias = 1.0, uint32_t uMaxNoOfNodes = 10000, Connectivity connectivity = TwentySixConnected, - polyvox_function*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator, + polyvox_function*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator, polyvox_function funcProgressCallback = 0 ) :volume(volData) @@ -86,7 +86,7 @@ namespace PolyVox } /// This is the volume through which the AStarPathfinder must find a path. - Volume* volume; + LargeVolume* 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*, const Vector3DInt32&)> isVoxelValidForPath; + polyvox_function*, 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 diff --git a/library/PolyVoxCore/include/AStarPathfinder.inl b/library/PolyVoxCore/include/AStarPathfinder.inl index 1e2076e7..fc9bbf27 100644 --- a/library/PolyVoxCore/include/AStarPathfinder.inl +++ b/library/PolyVoxCore/include/AStarPathfinder.inl @@ -31,7 +31,7 @@ namespace PolyVox /// \return true is the voxel is valid for the path //////////////////////////////////////////////////////////////////////////////// template - bool aStarDefaultVoxelValidator(const Volume* volData, const Vector3DInt32& v3dPos) + bool aStarDefaultVoxelValidator(const LargeVolume* volData, const Vector3DInt32& v3dPos) { //Voxels are considered valid candidates for the path if they are inside the volume... if(volData->getEnclosingRegion().containsPoint(v3dPos) == false) diff --git a/library/PolyVoxCore/include/AmbientOcclusionCalculator.h b/library/PolyVoxCore/include/AmbientOcclusionCalculator.h index 81a6aa71..07b6411d 100644 --- a/library/PolyVoxCore/include/AmbientOcclusionCalculator.h +++ b/library/PolyVoxCore/include/AmbientOcclusionCalculator.h @@ -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* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement); + AmbientOcclusionCalculator(LargeVolume* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement); ~AmbientOcclusionCalculator(); void execute(void); private: Region m_region; - Volume::Sampler m_sampVolume; - Volume* m_volInput; + typename LargeVolume::Sampler m_sampVolume; + LargeVolume* m_volInput; Array<3, uint8_t>* m_arrayResult; float m_fRayLength; diff --git a/library/PolyVoxCore/include/AmbientOcclusionCalculator.inl b/library/PolyVoxCore/include/AmbientOcclusionCalculator.inl index 7ac59d56..0e4e76b0 100644 --- a/library/PolyVoxCore/include/AmbientOcclusionCalculator.inl +++ b/library/PolyVoxCore/include/AmbientOcclusionCalculator.inl @@ -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 - AmbientOcclusionCalculator::AmbientOcclusionCalculator(Volume* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement) + AmbientOcclusionCalculator::AmbientOcclusionCalculator(LargeVolume* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement) :m_region(region) ,m_sampVolume(volInput) ,m_volInput(volInput) diff --git a/library/PolyVoxCore/include/ConstVolumeProxy.h b/library/PolyVoxCore/include/ConstVolumeProxy.h index e96e6d59..c1b64260 100644 --- a/library/PolyVoxCore/include/ConstVolumeProxy.h +++ b/library/PolyVoxCore/include/ConstVolumeProxy.h @@ -32,8 +32,8 @@ namespace PolyVox template class ConstVolumeProxy { - //Volume is a friend so it can call the constructor. - friend class Volume; + //LargeVolume is a friend so it can call the constructor. + friend class LargeVolume; 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& pVolume, const Region& regValid) + ConstVolumeProxy(const LargeVolume& pVolume, const Region& regValid) :m_pVolume(pVolume) ,m_regValid(regValid) { } - const Volume& m_pVolume; + const LargeVolume& m_pVolume; const Region& m_regValid; }; } diff --git a/library/PolyVoxCore/include/CubicSurfaceExtractor.h b/library/PolyVoxCore/include/CubicSurfaceExtractor.h index 43d8c1d8..9407711d 100644 --- a/library/PolyVoxCore/include/CubicSurfaceExtractor.h +++ b/library/PolyVoxCore/include/CubicSurfaceExtractor.h @@ -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* volData, Region region, SurfaceMesh* result); + CubicSurfaceExtractor(LargeVolume* volData, Region region, SurfaceMesh* result); void execute(); @@ -49,8 +50,8 @@ namespace PolyVox private: //The volume data and a sampler to access it. - Volume* m_volData; - Volume::Sampler m_sampVolume; + LargeVolume* m_volData; + typename LargeVolume::Sampler m_sampVolume; //Information about the region we are currently processing Region m_regSizeInVoxels; diff --git a/library/PolyVoxCore/include/CubicSurfaceExtractor.inl b/library/PolyVoxCore/include/CubicSurfaceExtractor.inl index a9a65d0a..e83d3d74 100644 --- a/library/PolyVoxCore/include/CubicSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/CubicSurfaceExtractor.inl @@ -33,7 +33,7 @@ namespace PolyVox const uint32_t CubicSurfaceExtractor::MaxQuadsSharingVertex = 4; template - CubicSurfaceExtractor::CubicSurfaceExtractor(Volume* volData, Region region, SurfaceMesh* result) + CubicSurfaceExtractor::CubicSurfaceExtractor(LargeVolume* volData, Region region, SurfaceMesh* result) :m_volData(volData) ,m_sampVolume(volData) ,m_regSizeInVoxels(region) diff --git a/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.h b/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.h index 704645b9..fc51bdac 100644 --- a/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.h +++ b/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.h @@ -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* volData, Region region, SurfaceMesh* result); + CubicSurfaceExtractorWithNormals(LargeVolume* volData, Region region, SurfaceMesh* result); void execute(); private: //The volume data and a sampler to access it. - Volume* m_volData; - typename Volume::Sampler m_sampVolume; + LargeVolume* m_volData; + typename LargeVolume::Sampler m_sampVolume; //The surface patch we are currently filling. SurfaceMesh* m_meshCurrent; diff --git a/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.inl b/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.inl index c1c74867..f6e8c0de 100644 --- a/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.inl +++ b/library/PolyVoxCore/include/CubicSurfaceExtractorWithNormals.inl @@ -30,7 +30,7 @@ freely, subject to the following restrictions: namespace PolyVox { template - CubicSurfaceExtractorWithNormals::CubicSurfaceExtractorWithNormals(Volume* volData, Region region, SurfaceMesh* result) + CubicSurfaceExtractorWithNormals::CubicSurfaceExtractorWithNormals(LargeVolume* volData, Region region, SurfaceMesh* result) :m_volData(volData) ,m_sampVolume(volData) ,m_regSizeInVoxels(region) diff --git a/library/PolyVoxCore/include/Density.h b/library/PolyVoxCore/include/Density.h index 69322c12..3a40708a 100644 --- a/library/PolyVoxCore/include/Density.h +++ b/library/PolyVoxCore/include/Density.h @@ -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. diff --git a/library/PolyVoxCore/include/Filters.h b/library/PolyVoxCore/include/Filters.h index 409f8bee..e10ac579 100644 --- a/library/PolyVoxCore/include/Filters.h +++ b/library/PolyVoxCore/include/Filters.h @@ -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 - void smoothRegion(Volume& volData, const Region& regionToSmooth); + void smoothRegion(LargeVolume& volData, const Region& regionToSmooth); }//namespace PolyVox #include "Filters.inl" diff --git a/library/PolyVoxCore/include/Filters.inl b/library/PolyVoxCore/include/Filters.inl index 4ec87956..b21be87b 100644 --- a/library/PolyVoxCore/include/Filters.inl +++ b/library/PolyVoxCore/include/Filters.inl @@ -3,7 +3,7 @@ namespace PolyVox { template - void smoothRegion(Volume& volData, const Region& regionToSmooth) + void smoothRegion(LargeVolume& volData, const Region& regionToSmooth) { Region croppedRegion = regionToSmooth; diff --git a/library/PolyVoxCore/include/GradientEstimators.h b/library/PolyVoxCore/include/GradientEstimators.h index 36cf5e03..41aeb10b 100644 --- a/library/PolyVoxCore/include/GradientEstimators.h +++ b/library/PolyVoxCore/include/GradientEstimators.h @@ -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 @@ -42,21 +42,21 @@ namespace PolyVox }; template - Vector3DFloat computeCentralDifferenceGradient(const typename Volume::Sampler& volIter); + Vector3DFloat computeCentralDifferenceGradient(const typename LargeVolume::Sampler& volIter); template - Vector3DFloat computeSmoothCentralDifferenceGradient(typename Volume::Sampler& volIter); + Vector3DFloat computeSmoothCentralDifferenceGradient(typename LargeVolume::Sampler& volIter); template - Vector3DFloat computeDecimatedCentralDifferenceGradient(typename Volume::Sampler& volIter); + Vector3DFloat computeDecimatedCentralDifferenceGradient(typename LargeVolume::Sampler& volIter); template - Vector3DFloat computeSobelGradient(const typename Volume::Sampler& volIter); + Vector3DFloat computeSobelGradient(const typename LargeVolume::Sampler& volIter); template - Vector3DFloat computeSmoothSobelGradient(typename Volume::Sampler& volIter); + Vector3DFloat computeSmoothSobelGradient(typename LargeVolume::Sampler& volIter); - POLYVOX_API void computeNormalsForVertices(Volume* volumeData, SurfaceMesh& mesh, NormalGenerationMethod normalGenerationMethod); - POLYVOX_API Vector3DFloat computeNormal(Volume* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod); + POLYVOX_API void computeNormalsForVertices(LargeVolume* volumeData, SurfaceMesh& mesh, NormalGenerationMethod normalGenerationMethod); + POLYVOX_API Vector3DFloat computeNormal(LargeVolume* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod); } #include "GradientEstimators.inl" diff --git a/library/PolyVoxCore/include/GradientEstimators.inl b/library/PolyVoxCore/include/GradientEstimators.inl index d0dbb16c..de687269 100644 --- a/library/PolyVoxCore/include/GradientEstimators.inl +++ b/library/PolyVoxCore/include/GradientEstimators.inl @@ -23,12 +23,12 @@ freely, subject to the following restrictions: #include "VoxelFilters.h" -#include "Volume.h" +#include "LargeVolume.h" namespace PolyVox { template - Vector3DFloat computeCentralDifferenceGradient(const typename Volume::Sampler& volIter) + Vector3DFloat computeCentralDifferenceGradient(const typename LargeVolume::Sampler& volIter) { //FIXME - bitwise way of doing this? VoxelType voxel1nx = volIter.peekVoxel1nx0py0pz() > 0 ? 1: 0; @@ -49,7 +49,7 @@ namespace PolyVox } template - Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename Volume::Sampler& volIter) + Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename LargeVolume::Sampler& volIter) { const int32_t x = volIter.getPosX(); const int32_t y = volIter.getPosY(); @@ -74,7 +74,7 @@ namespace PolyVox } template - Vector3DFloat computeSmoothCentralDifferenceGradient(typename Volume::Sampler& volIter) + Vector3DFloat computeSmoothCentralDifferenceGradient(typename LargeVolume::Sampler& volIter) { int32_t initialX = volIter.getPosX(); int32_t initialY = volIter.getPosY(); @@ -105,7 +105,7 @@ namespace PolyVox } template - Vector3DFloat computeSobelGradient(const typename Volume::Sampler& volIter) + Vector3DFloat computeSobelGradient(const typename LargeVolume::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 - Vector3DFloat computeSmoothSobelGradient(typename Volume::Sampler& volIter) + Vector3DFloat computeSmoothSobelGradient(typename LargeVolume::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} } }; diff --git a/library/PolyVoxCore/include/Volume.h b/library/PolyVoxCore/include/LargeVolume.h similarity index 87% rename from library/PolyVoxCore/include/Volume.h rename to library/PolyVoxCore/include/LargeVolume.h index e2183b68..e741c34e 100644 --- a/library/PolyVoxCore/include/Volume.h +++ b/library/PolyVoxCore/include/LargeVolume.h @@ -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 voxel) 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 voxel) 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. /// /// Basic usage /// The following code snippet shows how to construct a volume and demonstrates basic usage: /// /// \code - /// Volume volume(Region(Vector3DInt32(0,0,0), Vector3DInt32(63,127,255))); + /// LargeVolume 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. /// /// Data Representaion /// 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& 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. /// } /// - /// VolumevolData(&myDataRequiredHandler, &myDataOverflowHandler); + /// LargeVolumevolData(&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. /// /// Threading - /// 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 - class Volume + class LargeVolume { public: class Sampler { public: - Sampler(Volume* volume); + Sampler(LargeVolume* 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* getVolume(void) const; + const LargeVolume* getVolume(void) const; inline VoxelType getVoxel(void) const; void setPosition(const Vector3DInt32& v3dNewPos); @@ -203,7 +203,7 @@ namespace PolyVox private: //The current volume - Volume* mVolume; + LargeVolume* 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&, const Region&)> dataRequiredHandler, polyvox_function&, const Region&)> dataOverflowHandler, uint16_t uBlockSideLength = 32 ); /// Constructor for creating a fixed size volume. - Volume + LargeVolume ( const Region& regValid, polyvox_function&, 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&, 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 diff --git a/library/PolyVoxCore/include/Volume.inl b/library/PolyVoxCore/include/LargeVolume.inl similarity index 90% rename from library/PolyVoxCore/include/Volume.inl rename to library/PolyVoxCore/include/LargeVolume.inl index bf35634a..0c4e450d 100644 --- a/library/PolyVoxCore/include/Volume.inl +++ b/library/PolyVoxCore/include/LargeVolume.inl @@ -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 - Volume::Volume + LargeVolume::LargeVolume ( polyvox_function&, const Region&)> dataRequiredHandler, polyvox_function&, const Region&)> dataOverflowHandler, @@ -61,7 +61,7 @@ namespace PolyVox /// Deprecated - do not use this constructor. //////////////////////////////////////////////////////////////////////////////// template - Volume::Volume + LargeVolume::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 - Volume::Volume + LargeVolume::LargeVolume ( const Region& regValid, polyvox_function&, 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 - Volume::~Volume() + LargeVolume::~LargeVolume() { flushAll(); } @@ -119,7 +119,7 @@ namespace PolyVox /// \return The value used for voxels outside of the volume //////////////////////////////////////////////////////////////////////////////// template - VoxelType Volume::getBorderValue(void) const + VoxelType LargeVolume::getBorderValue(void) const { return *m_pUncompressedBorderData; } @@ -128,7 +128,7 @@ namespace PolyVox /// \return A Region representing the extent of the volume. //////////////////////////////////////////////////////////////////////////////// template - Region Volume::getEnclosingRegion(void) const + Region LargeVolume::getEnclosingRegion(void) const { return m_regValidRegion; } @@ -138,7 +138,7 @@ namespace PolyVox /// \sa getHeight(), getDepth() //////////////////////////////////////////////////////////////////////////////// template - int32_t Volume::getWidth(void) const + int32_t LargeVolume::getWidth(void) const { return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1; } @@ -148,7 +148,7 @@ namespace PolyVox /// \sa getWidth(), getDepth() //////////////////////////////////////////////////////////////////////////////// template - int32_t Volume::getHeight(void) const + int32_t LargeVolume::getHeight(void) const { return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1; } @@ -158,7 +158,7 @@ namespace PolyVox /// \sa getWidth(), getHeight() //////////////////////////////////////////////////////////////////////////////// template - int32_t Volume::getDepth(void) const + int32_t LargeVolume::getDepth(void) const { return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1; } @@ -169,7 +169,7 @@ namespace PolyVox /// \sa getLongestSideLength(), getDiagonalLength() //////////////////////////////////////////////////////////////////////////////// template - int32_t Volume::getShortestSideLength(void) const + int32_t LargeVolume::getShortestSideLength(void) const { return m_uShortestSideLength; } @@ -180,7 +180,7 @@ namespace PolyVox /// \sa getShortestSideLength(), getDiagonalLength() //////////////////////////////////////////////////////////////////////////////// template - int32_t Volume::getLongestSideLength(void) const + int32_t LargeVolume::getLongestSideLength(void) const { return m_uLongestSideLength; } @@ -192,7 +192,7 @@ namespace PolyVox /// \sa getShortestSideLength(), getLongestSideLength() //////////////////////////////////////////////////////////////////////////////// template - float Volume::getDiagonalLength(void) const + float LargeVolume::getDiagonalLength(void) const { return m_fDiagonalLength; } @@ -204,7 +204,7 @@ namespace PolyVox /// \return The voxel value //////////////////////////////////////////////////////////////////////////////// template - VoxelType Volume::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const + VoxelType LargeVolume::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 - VoxelType Volume::getVoxelAt(const Vector3DInt32& v3dPos) const + VoxelType LargeVolume::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 - void Volume::setCompressionEnabled(bool bCompressionEnabled) + void LargeVolume::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 - void Volume::setMaxNumberOfUncompressedBlocks(uint16_t uMaxNumberOfUncompressedBlocks) + void LargeVolume::setMaxNumberOfUncompressedBlocks(uint16_t uMaxNumberOfUncompressedBlocks) { clearBlockCache(); @@ -279,7 +279,7 @@ namespace PolyVox /// \param uMaxBlocks The number of blocks //////////////////////////////////////////////////////////////////////////////// template - void Volume::setMaxNumberOfBlocksInMemory(uint16_t uMaxNumberOfBlocksInMemory) + void LargeVolume::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 - void Volume::setBorderValue(const VoxelType& tBorder) + void LargeVolume::setBorderValue(const VoxelType& tBorder) { /*Block* pUncompressedBorderBlock = getUncompressedBlock(&m_pBorderBlock); return pUncompressedBorderBlock->fill(tBorder);*/ @@ -307,7 +307,7 @@ namespace PolyVox /// \return whether the requested position is inside the volume //////////////////////////////////////////////////////////////////////////////// template - bool Volume::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) + bool LargeVolume::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 - bool Volume::setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue) + bool LargeVolume::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 - void Volume::prefetch(Region regPrefetch) + void LargeVolume::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 - void Volume::flushAll() + void LargeVolume::flushAll() { typename std::map::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 - void Volume::flush(Region regFlush) + void LargeVolume::flush(Region regFlush) { Vector3DInt32 v3dStart; for(int i = 0; i < 3; i++) @@ -458,7 +458,7 @@ namespace PolyVox /// //////////////////////////////////////////////////////////////////////////////// template - void Volume::clearBlockCache(void) + void LargeVolume::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 - void Volume::resize(const Region& regValidRegion, uint16_t uBlockSideLength) + void LargeVolume::resize(const Region& regValidRegion, uint16_t uBlockSideLength) { //Debug mode validation assert(uBlockSideLength > 0); @@ -523,7 +523,7 @@ namespace PolyVox } template - void Volume::eraseBlock(typename std::map::iterator itBlock) const + void LargeVolume::eraseBlock(typename std::map::iterator itBlock) const { if(m_funcDataOverflowHandler) { @@ -556,7 +556,7 @@ namespace PolyVox } template - bool Volume::setVoxelAtConst(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const + bool LargeVolume::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 - Block* Volume::getUncompressedBlock(int32_t uBlockX, int32_t uBlockY, int32_t uBlockZ) const + Block* LargeVolume::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 - float Volume::calculateCompressionRatio(void) + float LargeVolume::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 - uint32_t Volume::calculateSizeInBytes(void) + uint32_t LargeVolume::calculateSizeInBytes(void) { - uint32_t uSizeInBytes = sizeof(Volume); + uint32_t uSizeInBytes = sizeof(LargeVolume); //Memory used by the blocks typename std::map::iterator i; diff --git a/library/PolyVoxCore/include/VolumeSampler.inl b/library/PolyVoxCore/include/LargeVolumeSampler.inl similarity index 79% rename from library/PolyVoxCore/include/VolumeSampler.inl rename to library/PolyVoxCore/include/LargeVolumeSampler.inl index 81750a4d..44bc124e 100644 --- a/library/PolyVoxCore/include/VolumeSampler.inl +++ b/library/PolyVoxCore/include/LargeVolumeSampler.inl @@ -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 - Volume::Sampler::Sampler(Volume* volume) + LargeVolume::Sampler::Sampler(LargeVolume* volume) :mVolume(volume) { } template - Volume::Sampler::~Sampler() + LargeVolume::Sampler::~Sampler() { } template - typename Volume::Sampler& Volume::Sampler::operator=(const typename Volume::Sampler& rhs) throw() + typename LargeVolume::Sampler& LargeVolume::Sampler::operator=(const typename LargeVolume::Sampler& rhs) throw() { if(this == &rhs) { @@ -61,25 +61,25 @@ namespace PolyVox } template - int32_t Volume::Sampler::getPosX(void) const + int32_t LargeVolume::Sampler::getPosX(void) const { return mXPosInVolume; } template - int32_t Volume::Sampler::getPosY(void) const + int32_t LargeVolume::Sampler::getPosY(void) const { return mYPosInVolume; } template - int32_t Volume::Sampler::getPosZ(void) const + int32_t LargeVolume::Sampler::getPosZ(void) const { return mZPosInVolume; } template - VoxelType Volume::Sampler::getSubSampledVoxel(uint8_t uLevel) const + VoxelType LargeVolume::Sampler::getSubSampledVoxel(uint8_t uLevel) const { if(uLevel == 0) { @@ -117,25 +117,25 @@ namespace PolyVox } template - const Volume* Volume::Sampler::getVolume(void) const + const LargeVolume* LargeVolume::Sampler::getVolume(void) const { return mVolume; } template - VoxelType Volume::Sampler::getVoxel(void) const + VoxelType LargeVolume::Sampler::getVoxel(void) const { return *mCurrentVoxel; } template - void Volume::Sampler::setPosition(const Vector3DInt32& v3dNewPos) + void LargeVolume::Sampler::setPosition(const Vector3DInt32& v3dNewPos) { setPosition(v3dNewPos.getX(), v3dNewPos.getY(), v3dNewPos.getZ()); } template - void Volume::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos) + void LargeVolume::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos) { mXPosInVolume = xPos; mYPosInVolume = yPos; @@ -166,7 +166,7 @@ namespace PolyVox } template - void Volume::Sampler::movePositiveX(void) + void LargeVolume::Sampler::movePositiveX(void) { //Note the *pre* increament here if((++mXPosInVolume) % mVolume->m_uBlockSideLength != 0) @@ -182,7 +182,7 @@ namespace PolyVox } template - void Volume::Sampler::movePositiveY(void) + void LargeVolume::Sampler::movePositiveY(void) { //Note the *pre* increament here if((++mYPosInVolume) % mVolume->m_uBlockSideLength != 0) @@ -198,7 +198,7 @@ namespace PolyVox } template - void Volume::Sampler::movePositiveZ(void) + void LargeVolume::Sampler::movePositiveZ(void) { //Note the *pre* increament here if((++mZPosInVolume) % mVolume->m_uBlockSideLength != 0) @@ -214,7 +214,7 @@ namespace PolyVox } template - void Volume::Sampler::moveNegativeX(void) + void LargeVolume::Sampler::moveNegativeX(void) { //Note the *post* decreament here if((mXPosInVolume--) % mVolume->m_uBlockSideLength != 0) @@ -230,7 +230,7 @@ namespace PolyVox } template - void Volume::Sampler::moveNegativeY(void) + void LargeVolume::Sampler::moveNegativeY(void) { //Note the *post* decreament here if((mYPosInVolume--) % mVolume->m_uBlockSideLength != 0) @@ -246,7 +246,7 @@ namespace PolyVox } template - void Volume::Sampler::moveNegativeZ(void) + void LargeVolume::Sampler::moveNegativeZ(void) { //Note the *post* decreament here if((mZPosInVolume--) % mVolume->m_uBlockSideLength != 0) @@ -262,7 +262,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx1ny1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx1ny1nz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -272,7 +272,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx1ny0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx1ny0pz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mYPosInVolume) ) { @@ -282,7 +282,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx1ny1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx1ny1pz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -292,7 +292,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx0py1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx0py1nz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -302,7 +302,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx0py0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx0py0pz(void) const { if( BORDER_LOW(mXPosInVolume) ) { @@ -312,7 +312,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx0py1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx0py1pz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -322,7 +322,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx1py1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx1py1nz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_LOW(mYPosInVolume) ) { @@ -332,7 +332,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx1py0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx1py0pz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) ) { @@ -342,7 +342,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1nx1py1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1nx1py1pz(void) const { if( BORDER_LOW(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -354,7 +354,7 @@ namespace PolyVox ////////////////////////////////////////////////////////////////////////// template - VoxelType Volume::Sampler::peekVoxel0px1ny1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px1ny1nz(void) const { if( BORDER_LOW(mYPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -364,7 +364,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px1ny0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px1ny0pz(void) const { if( BORDER_LOW(mYPosInVolume) ) { @@ -374,7 +374,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px1ny1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px1ny1pz(void) const { if( BORDER_LOW(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -384,7 +384,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px0py1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px0py1nz(void) const { if( BORDER_LOW(mZPosInVolume) ) { @@ -394,13 +394,13 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px0py0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px0py0pz(void) const { return *mCurrentVoxel; } template - VoxelType Volume::Sampler::peekVoxel0px0py1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px0py1pz(void) const { if( BORDER_HIGH(mZPosInVolume) ) { @@ -410,7 +410,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px1py1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px1py1nz(void) const { if( BORDER_HIGH(mYPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -420,7 +420,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px1py0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px1py0pz(void) const { if( BORDER_HIGH(mYPosInVolume) ) { @@ -430,7 +430,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel0px1py1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel0px1py1pz(void) const { if( BORDER_HIGH(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -442,7 +442,7 @@ namespace PolyVox ////////////////////////////////////////////////////////////////////////// template - VoxelType Volume::Sampler::peekVoxel1px1ny1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px1ny1nz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -452,7 +452,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px1ny0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px1ny0pz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mYPosInVolume) ) { @@ -462,7 +462,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px1ny1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px1ny1pz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -472,7 +472,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px0py1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px0py1nz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -482,7 +482,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px0py0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px0py0pz(void) const { if( BORDER_HIGH(mXPosInVolume) ) { @@ -492,7 +492,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px0py1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px0py1pz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { @@ -502,7 +502,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px1py1nz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px1py1nz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_LOW(mZPosInVolume) ) { @@ -512,7 +512,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px1py0pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px1py0pz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) ) { @@ -522,7 +522,7 @@ namespace PolyVox } template - VoxelType Volume::Sampler::peekVoxel1px1py1pz(void) const + VoxelType LargeVolume::Sampler::peekVoxel1px1py1pz(void) const { if( BORDER_HIGH(mXPosInVolume) && BORDER_HIGH(mYPosInVolume) && BORDER_HIGH(mZPosInVolume) ) { diff --git a/library/PolyVoxCore/include/Material.h b/library/PolyVoxCore/include/Material.h index ba6bc3e6..9e5131ef 100644 --- a/library/PolyVoxCore/include/Material.h +++ b/library/PolyVoxCore/include/Material.h @@ -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. diff --git a/library/PolyVoxCore/include/MaterialDensityPair.h b/library/PolyVoxCore/include/MaterialDensityPair.h index e0f38e4a..ff6adc03 100644 --- a/library/PolyVoxCore/include/MaterialDensityPair.h +++ b/library/PolyVoxCore/include/MaterialDensityPair.h @@ -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. diff --git a/library/PolyVoxCore/include/PolyVoxForwardDeclarations.h b/library/PolyVoxCore/include/PolyVoxForwardDeclarations.h index c98d32de..8d0bc5aa 100644 --- a/library/PolyVoxCore/include/PolyVoxForwardDeclarations.h +++ b/library/PolyVoxCore/include/PolyVoxForwardDeclarations.h @@ -62,8 +62,8 @@ namespace PolyVox template class ConstVolumeProxy; - //---------- Volume ---------- - template class Volume; + //---------- LargeVolume ---------- + template class LargeVolume; //--------------------------------- //---------- Mesh ---------- diff --git a/library/PolyVoxCore/include/PolyVoxImpl/Block.h b/library/PolyVoxCore/include/PolyVoxImpl/Block.h index 72a6ac72..0a9a013f 100644 --- a/library/PolyVoxCore/include/PolyVoxImpl/Block.h +++ b/library/PolyVoxCore/include/PolyVoxImpl/Block.h @@ -45,7 +45,7 @@ namespace PolyVox }; //Make Sampler a friend - friend class Volume::Sampler; + friend class LargeVolume::Sampler; public: Block(uint16_t uSideLength = 0); diff --git a/library/PolyVoxCore/include/PolyVoxImpl/Block.inl b/library/PolyVoxCore/include/PolyVoxImpl/Block.inl index 2ff6ec12..9c0e9f79 100644 --- a/library/PolyVoxCore/include/PolyVoxImpl/Block.inl +++ b/library/PolyVoxCore/include/PolyVoxImpl/Block.inl @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "PolyVoxImpl/Utility.h" #include "Vector.h" -#include "Volume.h" +#include "LargeVolume.h" #include #include //For memcpy diff --git a/library/PolyVoxCore/include/Raycast.h b/library/PolyVoxCore/include/Raycast.h index 5abea58f..3c43da85 100644 --- a/library/PolyVoxCore/include/Raycast.h +++ b/library/PolyVoxCore/include/Raycast.h @@ -85,7 +85,7 @@ namespace PolyVox { public: ///Constructor - Raycast(Volume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result); + Raycast(LargeVolume* 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* m_volData; - Volume::Sampler m_sampVolume; + LargeVolume* m_volData; + typename LargeVolume::Sampler m_sampVolume; Vector3DFloat m_v3dStart; Vector3DFloat m_v3dDirection; diff --git a/library/PolyVoxCore/include/Raycast.inl b/library/PolyVoxCore/include/Raycast.inl index d108e66b..d0eb30be 100644 --- a/library/PolyVoxCore/include/Raycast.inl +++ b/library/PolyVoxCore/include/Raycast.inl @@ -31,7 +31,7 @@ namespace PolyVox /// \param result An instance of RaycastResult in which the result will be stored. //////////////////////////////////////////////////////////////////////////////// template - Raycast::Raycast(Volume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result) + Raycast::Raycast(LargeVolume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, RaycastResult& result) :m_volData(volData) ,m_sampVolume(volData) ,m_v3dStart(v3dStart) diff --git a/library/PolyVoxCore/include/RaycastWithCallback.h b/library/PolyVoxCore/include/RaycastWithCallback.h index 3d617799..40b3a7d0 100644 --- a/library/PolyVoxCore/include/RaycastWithCallback.h +++ b/library/PolyVoxCore/include/RaycastWithCallback.h @@ -31,7 +31,7 @@ namespace PolyVox { public: ///Constructor - RaycastWithCallback(Volume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function funcCallback); + RaycastWithCallback(LargeVolume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function 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* m_volData; - Volume::Sampler m_sampVolume; + LargeVolume* m_volData; + typename LargeVolume::Sampler m_sampVolume; Vector3DFloat m_v3dStart; Vector3DFloat m_v3dDirection; diff --git a/library/PolyVoxCore/include/RaycastWithCallback.inl b/library/PolyVoxCore/include/RaycastWithCallback.inl index 106137d0..166cb3b9 100644 --- a/library/PolyVoxCore/include/RaycastWithCallback.inl +++ b/library/PolyVoxCore/include/RaycastWithCallback.inl @@ -23,7 +23,7 @@ freely, subject to the following restrictions: namespace PolyVox { template - RaycastWithCallback::RaycastWithCallback(Volume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function funcCallback) + RaycastWithCallback::RaycastWithCallback(LargeVolume* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirection, polyvox_function funcCallback) :m_volData(volData) ,m_sampVolume(volData) ,m_v3dStart(v3dStart) diff --git a/library/PolyVoxCore/include/SurfaceExtractor.h b/library/PolyVoxCore/include/SurfaceExtractor.h index 560b6316..86fa4018 100644 --- a/library/PolyVoxCore/include/SurfaceExtractor.h +++ b/library/PolyVoxCore/include/SurfaceExtractor.h @@ -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* volData, Region region, SurfaceMesh* result); + SurfaceExtractor(LargeVolume* volData, Region region, SurfaceMesh* result); void execute(); @@ -54,8 +54,8 @@ namespace PolyVox Array2DInt32& m_pCurrentVertexIndicesY, Array2DInt32& m_pCurrentVertexIndicesZ); - Vector3DFloat computeCentralDifferenceGradient(const typename Volume::Sampler& volIter); - Vector3DFloat computeSobelGradient(const typename Volume::Sampler& volIter); + Vector3DFloat computeCentralDifferenceGradient(const typename LargeVolume::Sampler& volIter); + Vector3DFloat computeSobelGradient(const typename LargeVolume::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* m_volData; - typename Volume::Sampler m_sampVolume; + LargeVolume* m_volData; + typename LargeVolume::Sampler m_sampVolume; //Holds a position in volume space. int32_t iXVolSpace; diff --git a/library/PolyVoxCore/include/SurfaceExtractor.inl b/library/PolyVoxCore/include/SurfaceExtractor.inl index 7f9bff5a..6c3f6087 100644 --- a/library/PolyVoxCore/include/SurfaceExtractor.inl +++ b/library/PolyVoxCore/include/SurfaceExtractor.inl @@ -30,7 +30,7 @@ freely, subject to the following restrictions: namespace PolyVox { template - SurfaceExtractor::SurfaceExtractor(Volume* volData, Region region, SurfaceMesh* result) + SurfaceExtractor::SurfaceExtractor(LargeVolume* volData, Region region, SurfaceMesh* result) :m_volData(volData) ,m_sampVolume(volData) ,m_regSizeInVoxels(region) @@ -507,7 +507,7 @@ namespace PolyVox } template - Vector3DFloat SurfaceExtractor::computeCentralDifferenceGradient(const typename Volume::Sampler& volIter) + Vector3DFloat SurfaceExtractor::computeCentralDifferenceGradient(const typename LargeVolume::Sampler& volIter) { uint8_t voxel1nx = volIter.peekVoxel1nx0py0pz().getDensity(); uint8_t voxel1px = volIter.peekVoxel1px0py0pz().getDensity(); @@ -527,7 +527,7 @@ namespace PolyVox } template - Vector3DFloat SurfaceExtractor::computeSobelGradient(const typename Volume::Sampler& volIter) + Vector3DFloat SurfaceExtractor::computeSobelGradient(const typename LargeVolume::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} } }; diff --git a/library/PolyVoxCore/include/VoxelFilters.h b/library/PolyVoxCore/include/VoxelFilters.h index c518cce7..ffedc89b 100644 --- a/library/PolyVoxCore/include/VoxelFilters.h +++ b/library/PolyVoxCore/include/VoxelFilters.h @@ -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::Sampler& volIter); + float computeSmoothedVoxel(LargeVolume::Sampler& volIter); } #endif \ No newline at end of file diff --git a/library/PolyVoxCore/source/GradientEstimators.cpp b/library/PolyVoxCore/source/GradientEstimators.cpp index 3fb786f9..b33ffb50 100644 --- a/library/PolyVoxCore/source/GradientEstimators.cpp +++ b/library/PolyVoxCore/source/GradientEstimators.cpp @@ -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* volumeData, SurfaceMesh& mesh, NormalGenerationMethod normalGenerationMethod) + void computeNormalsForVertices(LargeVolume* volumeData, SurfaceMesh& mesh, NormalGenerationMethod normalGenerationMethod) { std::vector& vecVertices = mesh.getRawVertexData(); std::vector::iterator iterSurfaceVertex = vecVertices.begin(); @@ -41,7 +41,7 @@ namespace PolyVox const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast(mesh.m_Region.getLowerCorner()); const Vector3DInt32 v3dFloor = static_cast(v3dPos); - Volume::Sampler volIter(volumeData); + LargeVolume::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* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod) + Vector3DFloat computeNormal(LargeVolume* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod) { Vector3DFloat v3dGradient; //To store the result - Volume::Sampler volIter(volumeData); + LargeVolume::Sampler volIter(volumeData); const Vector3DInt32 v3dFloor = static_cast(v3dPos); diff --git a/library/PolyVoxCore/source/VoxelFilters.cpp b/library/PolyVoxCore/source/VoxelFilters.cpp index 66de7fab..e6dd8505 100644 --- a/library/PolyVoxCore/source/VoxelFilters.cpp +++ b/library/PolyVoxCore/source/VoxelFilters.cpp @@ -25,7 +25,7 @@ freely, subject to the following restrictions: namespace PolyVox { - float computeSmoothedVoxel(Volume::Sampler& volIter) + float computeSmoothedVoxel(LargeVolume::Sampler& volIter) { assert(volIter.getPosX() >= 1); assert(volIter.getPosY() >= 1); diff --git a/library/PolyVoxUtil/include/Serialization.h b/library/PolyVoxUtil/include/Serialization.h index 8aa76383..ee5894ca 100644 --- a/library/PolyVoxUtil/include/Serialization.h +++ b/library/PolyVoxUtil/include/Serialization.h @@ -42,28 +42,28 @@ namespace PolyVox // THESE FUNCTIONS ARE DEPRECATED. USE VERSIONED 'loadVolume' AND 'saveVolume' INSTEAD. //////////////////////////////////////////////////////////////////////////////// template - polyvox_shared_ptr< Volume > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); + polyvox_shared_ptr< LargeVolume > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); template - void saveVolumeRaw(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener = 0); + void saveVolumeRaw(std::ostream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener = 0); template - polyvox_shared_ptr< Volume > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); + polyvox_shared_ptr< LargeVolume > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener = 0); template - void saveVolumeRle(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener = 0); + void saveVolumeRle(std::ostream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener = 0); //////////////////////////////////////////////////////////////////////////////// // END OF DEPRECATED FUNCTIONS //////////////////////////////////////////////////////////////////////////////// template - bool loadVolume(std::istream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener = 0); + bool loadVolume(std::istream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener = 0); template - bool saveVolume(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener = 0); + bool saveVolume(std::ostream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener = 0); template - bool loadVersion0(std::istream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener = 0); + bool loadVersion0(std::istream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener = 0); template - bool saveVersion0(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener = 0); + bool saveVersion0(std::ostream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener = 0); } #include "Serialization.inl" diff --git a/library/PolyVoxUtil/include/Serialization.inl b/library/PolyVoxUtil/include/Serialization.inl index 8f503ad0..34d10e18 100644 --- a/library/PolyVoxUtil/include/Serialization.inl +++ b/library/PolyVoxUtil/include/Serialization.inl @@ -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 - polyvox_shared_ptr< Volume > loadVolumeRaw(std::istream& stream, VolumeSerializationProgressListener* progressListener) + polyvox_shared_ptr< LargeVolume > 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 > volume(new Volume(volumeWidth, volumeHeight, volumeDepth)); + polyvox_shared_ptr< LargeVolume > volume(new LargeVolume(volumeWidth, volumeHeight, volumeDepth)); //Read data for(uint16_t z = 0; z < volumeDepth; ++z) @@ -80,7 +80,7 @@ namespace PolyVox } template - void saveVolumeRaw(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener) + void saveVolumeRaw(std::ostream& stream, LargeVolume& 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(&volumeDepthPower), sizeof(volumeDepthPower)); //Write data - Volume::Sampler volIter(&volume); + LargeVolume::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 - polyvox_shared_ptr< Volume > loadVolumeRle(std::istream& stream, VolumeSerializationProgressListener* progressListener) + polyvox_shared_ptr< LargeVolume > 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 > volume(new Volume(volumeWidth, volumeHeight, volumeDepth)); + polyvox_shared_ptr< LargeVolume > volume(new LargeVolume(volumeWidth, volumeHeight, volumeDepth)); //Read data bool firstTime = true; @@ -194,7 +194,7 @@ namespace PolyVox } template - void saveVolumeRle(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener) + void saveVolumeRle(std::ostream& stream, LargeVolume& 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(&volumeDepthPower), sizeof(volumeDepthPower)); //Write data - Volume::Sampler volIter(&volume); + LargeVolume::Sampler volIter(&volume); VoxelType current; uint32_t runLength = 0; bool firstTime = true; @@ -269,7 +269,7 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////////////////////////// template - bool loadVolume(std::istream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener) + bool loadVolume(std::istream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener) { char pIdentifier[8]; stream.read(pIdentifier, 7); @@ -294,7 +294,7 @@ namespace PolyVox } template - bool saveVolume(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener) + bool saveVolume(std::ostream& stream, LargeVolume& 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 - bool loadVersion0(std::istream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener) + bool loadVersion0(std::istream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener) { //Read volume dimensions uint16_t volumeWidth = 0; @@ -368,7 +368,7 @@ namespace PolyVox } template - bool saveVersion0(std::ostream& stream, Volume& volume, VolumeSerializationProgressListener* progressListener) + bool saveVersion0(std::ostream& stream, LargeVolume& volume, VolumeSerializationProgressListener* progressListener) { //Write volume dimensions uint16_t volumeWidth = volume.getWidth(); @@ -380,7 +380,7 @@ namespace PolyVox stream.write(reinterpret_cast(&volumeDepth), sizeof(volumeDepth)); //Write data - Volume::Sampler volIter(&volume); + LargeVolume::Sampler volIter(&volume); VoxelType current; uint32_t runLength = 0; bool firstTime = true; diff --git a/library/PolyVoxUtil/include/VolumeChangeTracker.h b/library/PolyVoxUtil/include/VolumeChangeTracker.h index d2ccb5a9..d127ea84 100644 --- a/library/PolyVoxUtil/include/VolumeChangeTracker.h +++ b/library/PolyVoxUtil/include/VolumeChangeTracker.h @@ -37,13 +37,13 @@ namespace PolyVox { public: //Constructors, etc - VolumeChangeTracker(Volume* volumeDataToSet, uint16_t regionSideLength); + VolumeChangeTracker(LargeVolume* volumeDataToSet, uint16_t regionSideLength); ~VolumeChangeTracker(); //Getters int32_t getCurrentTime(void) const; int32_t getLastModifiedTimeForRegion(uint16_t uX, uint16_t uY, uint16_t uZ); - Volume* getWrappedVolume(void) const; + LargeVolume* getWrappedVolume(void) const; //Setters void setAllRegionsModified(void); @@ -59,7 +59,7 @@ namespace PolyVox void incrementCurrentTime(void); bool m_bIsLocked; Region m_regLastLocked; - Volume* volumeData; + LargeVolume* 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* volRegionLastModified; + LargeVolume* volRegionLastModified; static uint32_t m_uCurrentTime; }; diff --git a/library/PolyVoxUtil/include/VolumeChangeTracker.inl b/library/PolyVoxUtil/include/VolumeChangeTracker.inl index 8a8a897f..f5949bb0 100644 --- a/library/PolyVoxUtil/include/VolumeChangeTracker.inl +++ b/library/PolyVoxUtil/include/VolumeChangeTracker.inl @@ -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 - VolumeChangeTracker::VolumeChangeTracker(Volume* volumeDataToSet, uint16_t regionSideLength) + VolumeChangeTracker::VolumeChangeTracker(LargeVolume* 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(m_uVolumeWidthInRegions, m_uVolumeHeightInRegions, m_uVolumeDepthInRegions, 0); + volRegionLastModified = new LargeVolume(m_uVolumeWidthInRegions, m_uVolumeHeightInRegions, m_uVolumeDepthInRegions, 0); } template @@ -88,7 +88,7 @@ namespace PolyVox } template - Volume* VolumeChangeTracker::getWrappedVolume(void) const + LargeVolume* VolumeChangeTracker::getWrappedVolume(void) const { return volumeData; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0661e4b0..d911fcd2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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) diff --git a/tests/TestArray.cpp b/tests/TestArray.cpp index fae1bea6..45550c13 100644 --- a/tests/TestArray.cpp +++ b/tests/TestArray.cpp @@ -70,7 +70,7 @@ void TestArray::testReadWrite() QCOMPARE(total, expectedTotal); /*const PolyVox::uint16_t g_uVolumeSideLength = 128; - Volume volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); + LargeVolume volData(g_uVolumeSideLength, g_uVolumeSideLength, g_uVolumeSideLength); volData.tidyUpMemory(0); diff --git a/tests/testvolume.cpp b/tests/testvolume.cpp index aefe9af7..5c2f2758 100644 --- a/tests/testvolume.cpp +++ b/tests/testvolume.cpp @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "testvolume.h" -#include +#include #include @@ -32,7 +32,7 @@ using namespace PolyVox; void TestVolume::testSize() { const int32_t g_uVolumeSideLength = 128; - Volume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1))); + LargeVolume 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++) {