Replaced LargeVolume and SimpleVolume with PagedVolume in tests and examples.
This commit is contained in:
parent
f95cc6bfca
commit
db2e62d2a8
@ -26,14 +26,14 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/Mesh.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
//Use the PolyVox namespace
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(SimpleVolume<uint8_t>& volData, float fRadius)
|
||||
void createSphereInVolume(PagedVolume<uint8_t>& 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);
|
||||
@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
||||
openGLWidget.show();
|
||||
|
||||
//Create an empty volume and then place a sphere in it
|
||||
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
||||
PagedVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(63, 63, 63)));
|
||||
createSphereInVolume(volData, 30);
|
||||
|
||||
// Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see.
|
||||
|
@ -26,14 +26,14 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/Mesh.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
//Use the PolyVox namespace
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(SimpleVolume<uint8_t>& volData, float fRadius)
|
||||
void createSphereInVolume(PagedVolume<uint8_t>& 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);
|
||||
@ -145,7 +145,7 @@ int main(int argc, char *argv[])
|
||||
openGLWidget.setShader(shader);
|
||||
|
||||
//Create an empty volume and then place a sphere in it
|
||||
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
||||
PagedVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(63, 63, 63)));
|
||||
createSphereInVolume(volData, 30);
|
||||
|
||||
// Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see.
|
||||
|
@ -27,7 +27,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(LargeVolume<MaterialDensityPair88>& volData, float fRadius, uint8_t uValue)
|
||||
void createSphereInVolume(PagedVolume<MaterialDensityPair88>& volData, float fRadius, uint8_t uValue)
|
||||
{
|
||||
//This vector hold the position of the center of the volume
|
||||
Vector3DInt32 v3dVolCenter = (volData.getEnclosingRegion().getUpperCorner() - volData.getEnclosingRegion().getLowerCorner()) / static_cast<int32_t>(2);
|
||||
@ -55,7 +55,7 @@ void createSphereInVolume(LargeVolume<MaterialDensityPair88>& volData, float fRa
|
||||
}
|
||||
}
|
||||
|
||||
void createCubeInVolume(LargeVolume<MaterialDensityPair88>& volData, Vector3DInt32 lowerCorner, Vector3DInt32 upperCorner, uint8_t uValue)
|
||||
void createCubeInVolume(PagedVolume<MaterialDensityPair88>& volData, Vector3DInt32 lowerCorner, Vector3DInt32 upperCorner, uint8_t uValue)
|
||||
{
|
||||
uint8_t maxDen = MaterialDensityPair88::getMaxDensity();
|
||||
uint8_t minDen = MaterialDensityPair88::getMinDensity();
|
||||
|
@ -24,7 +24,7 @@ freely, subject to the following restrictions:
|
||||
#ifndef __OpenGLExample_Shapes_H__
|
||||
#define __OpenGLExample_Shapes_H__
|
||||
|
||||
#include "PolyVoxCore/LargeVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
#include "PolyVoxCore/MaterialDensityPair.h"
|
||||
|
||||
void createSphereInVolume(PolyVox::LargeVolume<PolyVox::MaterialDensityPair88>& volData, float fRadius, uint8_t uValue);
|
||||
|
@ -24,7 +24,6 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/FilePager.h"
|
||||
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/MaterialDensityPair.h"
|
||||
#include "PolyVoxCore/LargeVolume.h"
|
||||
#include "PolyVoxCore/LowPassFilter.h"
|
||||
#include "PolyVoxCore/RawVolume.h"
|
||||
#include "PolyVoxCore/Mesh.h"
|
||||
@ -51,7 +50,7 @@ const int32_t g_uVolumeSideLength = 128;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FilePager<MaterialDensityPair88>* pager = new FilePager<MaterialDensityPair88>(".");
|
||||
LargeVolume<MaterialDensityPair88> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(g_uVolumeSideLength - 1, g_uVolumeSideLength - 1, g_uVolumeSideLength - 1)), pager);
|
||||
PagedVolume<MaterialDensityPair88> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(g_uVolumeSideLength - 1, g_uVolumeSideLength - 1, g_uVolumeSideLength - 1)), pager);
|
||||
|
||||
//Make our volume contain a sphere in the center.
|
||||
int32_t minPos = 0;
|
||||
|
@ -35,7 +35,7 @@ freely, subject to the following restrictions:
|
||||
//Use the PolyVox namespace
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(LargeVolume<MaterialDensityPair44>& volData, Vector3DFloat v3dVolCenter, float fRadius)
|
||||
void createSphereInVolume(PagedVolume<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);
|
||||
@ -147,7 +147,7 @@ int main(int argc, char *argv[])
|
||||
openGLWidget.show();
|
||||
|
||||
PerlinNoisePager* pager = new PerlinNoisePager();
|
||||
LargeVolume<MaterialDensityPair44> volData(PolyVox::Region::MaxRegion, pager, 64);
|
||||
PagedVolume<MaterialDensityPair44> volData(PolyVox::Region::MaxRegion, pager, 64);
|
||||
volData.setMemoryUsageLimit(8 * 1024 * 1024); // 8Mb
|
||||
|
||||
//createSphereInVolume(volData, 30);
|
||||
|
@ -27,7 +27,7 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h"
|
||||
#include "PolyVoxCore/Mesh.h"
|
||||
#include "PolyVoxCore/RawVolume.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
#include "PolyVoxCore/VolumeResampler.h"
|
||||
|
||||
#include <QApplication>
|
||||
@ -35,7 +35,7 @@ freely, subject to the following restrictions:
|
||||
//Use the PolyVox namespace
|
||||
using namespace PolyVox;
|
||||
|
||||
void createSphereInVolume(SimpleVolume<uint8_t>& volData, float fRadius)
|
||||
void createSphereInVolume(PagedVolume<uint8_t>& 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);
|
||||
@ -76,17 +76,17 @@ int main(int argc, char *argv[])
|
||||
openGLWidget.show();
|
||||
|
||||
//Create an empty volume and then place a sphere in it
|
||||
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
|
||||
PagedVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(63, 63, 63)));
|
||||
createSphereInVolume(volData, 28);
|
||||
|
||||
//Smooth the data - should reimplement this using LowPassFilter
|
||||
//smoothRegion<SimpleVolume, Density8>(volData, volData.getEnclosingRegion());
|
||||
//smoothRegion<SimpleVolume, Density8>(volData, volData.getEnclosingRegion());
|
||||
//smoothRegion<SimpleVolume, Density8>(volData, volData.getEnclosingRegion());
|
||||
//smoothRegion<PagedVolume, Density8>(volData, volData.getEnclosingRegion());
|
||||
//smoothRegion<PagedVolume, Density8>(volData, volData.getEnclosingRegion());
|
||||
//smoothRegion<PagedVolume, Density8>(volData, volData.getEnclosingRegion());
|
||||
|
||||
RawVolume<uint8_t> volDataLowLOD(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(15, 31, 31)));
|
||||
|
||||
VolumeResampler< SimpleVolume<uint8_t>, RawVolume<uint8_t> > volumeResampler(&volData, PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(31, 63, 63)), &volDataLowLOD, volDataLowLOD.getEnclosingRegion());
|
||||
VolumeResampler< PagedVolume<uint8_t>, RawVolume<uint8_t> > volumeResampler(&volData, PolyVox::Region(Vector3DInt32(0, 0, 0), Vector3DInt32(31, 63, 63)), &volDataLowLOD, volDataLowLOD.getEnclosingRegion());
|
||||
volumeResampler.execute();
|
||||
|
||||
//Extract the surface
|
||||
|
@ -33,7 +33,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
//These two should not be here!
|
||||
#include "PolyVoxCore/Material.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -53,7 +53,7 @@ namespace PolyVox
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(const SimpleVolume<uint8_t>::Sampler& sampler)
|
||||
bool operator()(const PagedVolume<uint8_t>::Sampler& sampler)
|
||||
{
|
||||
uint8_t sample = sampler.getVoxel();
|
||||
bool func = mIsVoxelTransparentCallback(sample);
|
||||
|
@ -32,7 +32,7 @@ freely, subject to the following restrictions:
|
||||
namespace PolyVox
|
||||
{
|
||||
/// The BaseVolume class provides common functionality and an interface for other volume classes to implement. You should not try to create an instance of this
|
||||
/// class directly. Instead you should use RawVolume, SimpleVolume, or PagedVolume.
|
||||
/// class directly. Instead you should use RawVolume or PagedVolume.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// More details to come...
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -26,7 +26,7 @@ namespace PolyVox
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// This is protected because you should never create a BaseVolume directly, you should instead use one of the derived classes.
|
||||
///
|
||||
/// \sa RawVolume, SimpleVolume, PagedVolume
|
||||
/// \sa RawVolume, PagedVolume
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
template <typename VoxelType>
|
||||
BaseVolume<VoxelType>::BaseVolume(const Region& regValid)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __PolyVox_SimpleVolume_H__
|
||||
#define __PolyVox_SimpleVolume_H__
|
||||
|
||||
#pragma message("WARNING - The LargeVolume class has been replaced by PagedVolume. Please use that instead.")
|
||||
#pragma message("WARNING - The SimpleVolume class has been replaced by PagedVolume. Please use that instead.")
|
||||
|
||||
#include "PagedVolume.h"
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
@ -24,7 +24,7 @@ freely, subject to the following restrictions:
|
||||
#include "TestAmbientOcclusionGenerator.h"
|
||||
|
||||
#include "PolyVoxCore/AmbientOcclusionCalculator.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
@ -49,7 +49,7 @@ void TestAmbientOcclusionGenerator::testExecute()
|
||||
const int32_t g_uVolumeSideLength = 64;
|
||||
|
||||
//Create empty volume
|
||||
SimpleVolume<uint8_t> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1)));
|
||||
PagedVolume<uint8_t> volData(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(g_uVolumeSideLength - 1, g_uVolumeSideLength - 1, g_uVolumeSideLength - 1)));
|
||||
|
||||
//Create two solid walls at opposite sides of the volume
|
||||
for (int32_t z = 0; z < g_uVolumeSideLength; z++)
|
||||
|
@ -27,7 +27,7 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/Material.h"
|
||||
#include "PolyVoxCore/MaterialDensityPair.h"
|
||||
#include "PolyVoxCore/RawVolume.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
||||
|
||||
#include <QtTest>
|
||||
@ -128,26 +128,26 @@ VolumeType* createAndFillVolumeRealistic(int32_t iVolumeSideLength)
|
||||
void TestCubicSurfaceExtractor::testBehaviour()
|
||||
{
|
||||
// Test with default mesh and contoller types.
|
||||
auto uint8Vol = createAndFillVolumeWithNoise< SimpleVolume<uint8_t> >(32, 0, 2);
|
||||
auto uint8Vol = createAndFillVolumeWithNoise< PagedVolume<uint8_t> >(32, 0, 2);
|
||||
auto uint8Mesh = extractCubicMesh(uint8Vol, uint8Vol->getEnclosingRegion());
|
||||
QCOMPARE(uint8Mesh.getNoOfVertices(), uint32_t(57687));
|
||||
QCOMPARE(uint8Mesh.getNoOfIndices(), uint32_t(216234));
|
||||
|
||||
// Test with default mesh type but user-provided controller.
|
||||
auto int8Vol = createAndFillVolumeWithNoise< SimpleVolume<int8_t> >(32, 0, 2);
|
||||
auto int8Vol = createAndFillVolumeWithNoise< PagedVolume<int8_t> >(32, 0, 2);
|
||||
auto int8Mesh = extractCubicMesh(int8Vol, int8Vol->getEnclosingRegion(), CustomIsQuadNeeded<int8_t>());
|
||||
QCOMPARE(int8Mesh.getNoOfVertices(), uint32_t(29027));
|
||||
QCOMPARE(int8Mesh.getNoOfIndices(), uint32_t(178356));
|
||||
|
||||
// Test with default controller but user-provided mesh.
|
||||
auto uint32Vol = createAndFillVolumeWithNoise< SimpleVolume<uint32_t> >(32, 0, 2);
|
||||
auto uint32Vol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(32, 0, 2);
|
||||
Mesh< CubicVertex< uint32_t >, uint16_t > uint32Mesh;
|
||||
extractCubicMeshCustom(uint32Vol, uint32Vol->getEnclosingRegion(), &uint32Mesh);
|
||||
QCOMPARE(uint32Mesh.getNoOfVertices(), uint16_t(57687));
|
||||
QCOMPARE(uint32Mesh.getNoOfIndices(), uint32_t(216234));
|
||||
|
||||
// Test with both mesh and controller being provided by the user.
|
||||
auto int32Vol = createAndFillVolumeWithNoise< SimpleVolume<int32_t> >(32, 0, 2);
|
||||
auto int32Vol = createAndFillVolumeWithNoise< PagedVolume<int32_t> >(32, 0, 2);
|
||||
Mesh< CubicVertex< int32_t >, uint16_t > int32Mesh;
|
||||
extractCubicMeshCustom(int32Vol, int32Vol->getEnclosingRegion(), &int32Mesh, CustomIsQuadNeeded<int32_t>());
|
||||
QCOMPARE(int32Mesh.getNoOfVertices(), uint16_t(29027));
|
||||
@ -156,7 +156,7 @@ void TestCubicSurfaceExtractor::testBehaviour()
|
||||
|
||||
void TestCubicSurfaceExtractor::testEmptyVolumePerformance()
|
||||
{
|
||||
auto emptyVol = createAndFillVolumeWithNoise< SimpleVolume<uint32_t> >(128, 0, 0);
|
||||
auto emptyVol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(128, 0, 0);
|
||||
Mesh< CubicVertex< uint32_t >, uint16_t > emptyMesh;
|
||||
QBENCHMARK{ extractCubicMeshCustom(emptyVol, Region(32, 32, 32, 63, 63, 63), &emptyMesh); }
|
||||
QCOMPARE(emptyMesh.getNoOfVertices(), uint16_t(0));
|
||||
@ -164,7 +164,7 @@ void TestCubicSurfaceExtractor::testEmptyVolumePerformance()
|
||||
|
||||
void TestCubicSurfaceExtractor::testRealisticVolumePerformance()
|
||||
{
|
||||
auto realisticVol = createAndFillVolumeRealistic< SimpleVolume<uint32_t> >(128);
|
||||
auto realisticVol = createAndFillVolumeRealistic< PagedVolume<uint32_t> >(128);
|
||||
Mesh< CubicVertex< uint32_t >, uint16_t > realisticMesh;
|
||||
QBENCHMARK{ extractCubicMeshCustom(realisticVol, Region(32, 32, 32, 63, 63, 63), &realisticMesh); }
|
||||
QCOMPARE(realisticMesh.getNoOfVertices(), uint16_t(2176));
|
||||
@ -172,7 +172,7 @@ void TestCubicSurfaceExtractor::testRealisticVolumePerformance()
|
||||
|
||||
void TestCubicSurfaceExtractor::testNoiseVolumePerformance()
|
||||
{
|
||||
auto noiseVol = createAndFillVolumeWithNoise< SimpleVolume<uint32_t> >(128, 0, 2);
|
||||
auto noiseVol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(128, 0, 2);
|
||||
Mesh< CubicVertex< uint32_t >, uint16_t > noiseMesh;
|
||||
QBENCHMARK{ extractCubicMeshCustom(noiseVol, Region(32, 32, 32, 63, 63, 63), &noiseMesh); }
|
||||
QCOMPARE(noiseMesh.getNoOfVertices(), uint16_t(57729));
|
||||
|
@ -24,7 +24,7 @@ freely, subject to the following restrictions:
|
||||
#include "TestPicking.h"
|
||||
|
||||
#include "PolyVoxCore/Picking.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
@ -34,7 +34,7 @@ void TestPicking::testExecute()
|
||||
{
|
||||
const int32_t uVolumeSideLength = 32;
|
||||
|
||||
SimpleVolume<int8_t> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1)));
|
||||
PagedVolume<int8_t> volData(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(uVolumeSideLength - 1, uVolumeSideLength - 1, uVolumeSideLength - 1)));
|
||||
for (int32_t z = 0; z < uVolumeSideLength; z++)
|
||||
{
|
||||
for (int32_t y = 0; y < uVolumeSideLength; y++)
|
||||
|
@ -25,7 +25,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
#include "PolyVoxCore/Density.h"
|
||||
#include "PolyVoxCore/Raycast.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
|
||||
#include "PolyVoxCore/Impl/RandomUnitVectors.h"
|
||||
|
||||
@ -47,7 +47,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(const SimpleVolume<int8_t>::Sampler& sampler)
|
||||
bool operator()(const PagedVolume<int8_t>::Sampler& sampler)
|
||||
{
|
||||
m_uVoxelsTouched++;
|
||||
|
||||
@ -73,7 +73,7 @@ void TestRaycast::testExecute()
|
||||
const int32_t uVolumeSideLength = 32;
|
||||
|
||||
//Create a hollow volume, with solid sides on x and y but with open ends in z.
|
||||
SimpleVolume<int8_t> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1)));
|
||||
PagedVolume<int8_t> volData(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(uVolumeSideLength - 1, uVolumeSideLength - 1, uVolumeSideLength - 1)));
|
||||
for (int32_t z = 0; z < uVolumeSideLength; z++)
|
||||
{
|
||||
for (int32_t y = 0; y < uVolumeSideLength; y++)
|
||||
|
@ -27,8 +27,7 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/FilePager.h"
|
||||
#include "PolyVoxCore/MaterialDensityPair.h"
|
||||
#include "PolyVoxCore/RawVolume.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/LargeVolume.h"
|
||||
#include "PolyVoxCore/PagedVolume.h"
|
||||
#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h"
|
||||
|
||||
#include <QtTest>
|
||||
@ -173,7 +172,7 @@ void TestSurfaceExtractor::testBehaviour()
|
||||
// Of course, the use of a custom controller will also make a significant diference, but this probably does need investigating further in the future.
|
||||
|
||||
// This basic test just uses the default controller and automatically generates a mesh of the appropriate type.
|
||||
auto uintVol = createAndFillVolume< LargeVolume<uint8_t> >();
|
||||
auto uintVol = createAndFillVolume< PagedVolume<uint8_t> >();
|
||||
auto uintMesh = extractMarchingCubesMesh(uintVol, uintVol->getEnclosingRegion());
|
||||
QCOMPARE(uintMesh.getNoOfVertices(), uint32_t(12096)); // Verifies size of mesh and that we have 32-bit indices
|
||||
QCOMPARE(uintMesh.getNoOfIndices(), uint32_t(35157)); // Verifies size of mesh
|
||||
@ -181,7 +180,7 @@ void TestSurfaceExtractor::testBehaviour()
|
||||
QCOMPARE(uintMesh.getVertex(100).data, uint8_t(1)); // Not really meaningful for a primative type
|
||||
|
||||
// This test makes use of a custom controller
|
||||
auto floatVol = createAndFillVolume< LargeVolume<float> >();
|
||||
auto floatVol = createAndFillVolume< PagedVolume<float> >();
|
||||
CustomMarchingCubesController floatCustomController;
|
||||
auto floatMesh = extractMarchingCubesMesh(floatVol, floatVol->getEnclosingRegion(), floatCustomController);
|
||||
QCOMPARE(floatMesh.getNoOfVertices(), uint32_t(16113)); // Verifies size of mesh and that we have 32-bit indices
|
||||
@ -191,7 +190,7 @@ void TestSurfaceExtractor::testBehaviour()
|
||||
|
||||
// This test makes use of a user provided mesh. It uses the default controller, but we have to explicitly provide this because C++ won't let us
|
||||
// use a default for the second-to-last parameter but noot use a default for the last parameter.
|
||||
auto intVol = createAndFillVolume< LargeVolume<int8_t> >();
|
||||
auto intVol = createAndFillVolume< PagedVolume<int8_t> >();
|
||||
Mesh< MarchingCubesVertex< int8_t >, uint16_t > intMesh;
|
||||
extractMarchingCubesMeshCustom(intVol, intVol->getEnclosingRegion(), &intMesh);
|
||||
QCOMPARE(intMesh.getNoOfVertices(), uint16_t(11718)); // Verifies size of mesh and that we have 16-bit indices
|
||||
@ -200,7 +199,7 @@ void TestSurfaceExtractor::testBehaviour()
|
||||
QCOMPARE(intMesh.getVertex(100).data, int8_t(1)); // Not really meaningful for a primative type
|
||||
|
||||
// This test makes use of a user-provided mesh and also a custom controller.
|
||||
auto doubleVol = createAndFillVolume< LargeVolume<double> >();
|
||||
auto doubleVol = createAndFillVolume< PagedVolume<double> >();
|
||||
CustomMarchingCubesController doubleCustomController;
|
||||
Mesh< MarchingCubesVertex< double >, uint16_t > doubleMesh;
|
||||
extractMarchingCubesMeshCustom(doubleVol, doubleVol->getEnclosingRegion(), &doubleMesh, doubleCustomController);
|
||||
@ -210,7 +209,7 @@ void TestSurfaceExtractor::testBehaviour()
|
||||
QCOMPARE(doubleMesh.getVertex(100).data, double(1.0f)); // Not really meaningful for a primative type
|
||||
|
||||
// This test ensures the extractor works on a non-primitive voxel type.
|
||||
auto materialVol = createAndFillVolume< LargeVolume<MaterialDensityPair88> >();
|
||||
auto materialVol = createAndFillVolume< PagedVolume<MaterialDensityPair88> >();
|
||||
auto materialMesh = extractMarchingCubesMesh(materialVol, materialVol->getEnclosingRegion());
|
||||
QCOMPARE(materialMesh.getNoOfVertices(), uint32_t(12096)); // Verifies size of mesh and that we have 32-bit indices
|
||||
QCOMPARE(materialMesh.getNoOfIndices(), uint32_t(35157)); // Verifies size of mesh
|
||||
@ -220,7 +219,7 @@ void TestSurfaceExtractor::testBehaviour()
|
||||
|
||||
void TestSurfaceExtractor::testEmptyVolumePerformance()
|
||||
{
|
||||
auto emptyVol = createAndFillVolumeWithNoise< LargeVolume<float> >(128, -2.0f, -1.0f);
|
||||
auto emptyVol = createAndFillVolumeWithNoise< PagedVolume<float> >(128, -2.0f, -1.0f);
|
||||
Mesh< MarchingCubesVertex< float >, uint16_t > emptyMesh;
|
||||
QBENCHMARK{ extractMarchingCubesMeshCustom(emptyVol, Region(32, 32, 32, 63, 63, 63), &emptyMesh); }
|
||||
QCOMPARE(emptyMesh.getNoOfVertices(), uint16_t(0));
|
||||
@ -228,7 +227,7 @@ void TestSurfaceExtractor::testEmptyVolumePerformance()
|
||||
|
||||
void TestSurfaceExtractor::testNoiseVolumePerformance()
|
||||
{
|
||||
auto noiseVol = createAndFillVolumeWithNoise< LargeVolume<float> >(128, -1.0f, 1.0f);
|
||||
auto noiseVol = createAndFillVolumeWithNoise< PagedVolume<float> >(128, -1.0f, 1.0f);
|
||||
Mesh< MarchingCubesVertex< float >, uint16_t > noiseMesh;
|
||||
QBENCHMARK{ extractMarchingCubesMeshCustom(noiseVol, Region(32, 32, 32, 63, 63, 63), &noiseMesh); }
|
||||
QCOMPARE(noiseMesh.getNoOfVertices(), uint16_t(48967));
|
||||
|
@ -110,7 +110,7 @@ int32_t testSamplersWithWrappingForwards(VolumeType* volume, int lowXOffset, int
|
||||
xSampler = ySampler;
|
||||
for(int x = volume->getEnclosingRegion().getLowerX() + lowXOffset; x <= volume->getEnclosingRegion().getUpperX() + highXOffset; x++)
|
||||
{
|
||||
xSampler.setPosition(x, y, z); // HACK - Accessing a volume through multiple samplers currently breaks the LargeVolume.
|
||||
xSampler.setPosition(x, y, z); // HACK - Accessing a volume through multiple samplers currently breaks the PagedVolume.
|
||||
|
||||
result = cantorTupleFunction(result, xSampler.peekVoxel1nx1ny1nz());
|
||||
result = cantorTupleFunction(result, xSampler.peekVoxel0px1ny1nz());
|
||||
@ -223,7 +223,7 @@ int32_t testSamplersWithWrappingBackwards(VolumeType* volume, int lowXOffset, in
|
||||
xSampler = ySampler;
|
||||
for(int x = volume->getEnclosingRegion().getUpperX() + highXOffset; x >= volume->getEnclosingRegion().getLowerX() + lowXOffset; x--)
|
||||
{
|
||||
xSampler.setPosition(x, y, z); // HACK - Accessing a volume through multiple samplers currently breaks the LargeVolume.
|
||||
xSampler.setPosition(x, y, z); // HACK - Accessing a volume through multiple samplers currently breaks the PagedVolume.
|
||||
|
||||
result = cantorTupleFunction(result, xSampler.peekVoxel1nx1ny1nz());
|
||||
result = cantorTupleFunction(result, xSampler.peekVoxel0px1ny1nz());
|
||||
@ -273,7 +273,7 @@ TestVolume::TestVolume()
|
||||
|
||||
//Create the volumes
|
||||
m_pRawVolume = new RawVolume<int32_t>(region);
|
||||
m_pPagedVolume = new LargeVolume<int32_t>(region, m_pFilePager, 32);
|
||||
m_pPagedVolume = new PagedVolume<int32_t>(region, m_pFilePager, 32);
|
||||
|
||||
m_pPagedVolume->setMemoryUsageLimit(1 * 1024 * 1024);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user