Renamed vertex classes to the far more meaningful 'CubicVertex' and 'MarchingCubesVertex'. The old names didn't make much sense, even less so now they are templatized.

This commit is contained in:
David Williams
2014-05-11 15:17:59 +02:00
parent ae87dbee77
commit 573c36db87
24 changed files with 147 additions and 126 deletions

View File

@ -106,7 +106,7 @@ uint32_t testForType(void)
{
for (int32_t x = 0; x < uVolumeSideLength; x += uRegionSideLength)
{
SurfaceMesh<PositionMaterialNormal<VoxelType> > result;
SurfaceMesh<CubicVertex<VoxelType> > result;
Region regionToExtract(x, y, z, x + uRegionSideLength - 1, y + uRegionSideLength - 1, z + uRegionSideLength - 1);
CubicSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, regionToExtract, &result);
extractor.execute();
@ -131,7 +131,7 @@ void TestCubicSurfaceExtractor::testExecute()
const static uint32_t uIndexToCheck = 2000;
const static uint32_t uExpectedIndex = 1334;
SurfaceMesh<PositionMaterialNormal> mesh;*/
SurfaceMesh<CubicVertex> mesh;*/
/*testForType<int8_t>(mesh);
QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices);

View File

@ -102,7 +102,7 @@ void writeMaterialValueToVoxel(int valueToWrite, MaterialDensityPair88& voxel)
// Runs the surface extractor for a given type.
template <typename VoxelType>
void testForType(SurfaceMesh<PositionMaterialNormal<VoxelType> >& result)
void testForType(SurfaceMesh<MarchingCubesVertex<VoxelType> >& result)
{
const int32_t uVolumeSideLength = 32;
@ -131,7 +131,7 @@ void testForType(SurfaceMesh<PositionMaterialNormal<VoxelType> >& result)
extractor.execute();
}
void testCustomController(SurfaceMesh<PositionMaterialNormal<float> >& result)
void testCustomController(SurfaceMesh<MarchingCubesVertex<float> >& result)
{
const int32_t uVolumeSideLength = 32;
@ -163,7 +163,7 @@ void TestSurfaceExtractor::testExecute()
const static float fExpectedMaterial = 42.0f;
const static float fNoMaterial = 1.0f;
SurfaceMesh<PositionMaterialNormal<int8_t> > int8Mesh;
SurfaceMesh<MarchingCubesVertex<int8_t> > int8Mesh;
//Run the test for various voxel types.
QBENCHMARK {
testForType<int8_t>(int8Mesh);
@ -172,55 +172,55 @@ void TestSurfaceExtractor::testExecute()
QCOMPARE(int8Mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(int8Mesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<int8_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<uint8_t> > uint8Mesh;
SurfaceMesh<MarchingCubesVertex<uint8_t> > uint8Mesh;
testForType<uint8_t>(uint8Mesh);
QCOMPARE(uint8Mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(uint8Mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(uint8Mesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<uint8_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<int16_t> > int16Mesh;
SurfaceMesh<MarchingCubesVertex<int16_t> > int16Mesh;
testForType<int16_t>(int16Mesh);
QCOMPARE(int16Mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(int16Mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(int16Mesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<int16_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<uint16_t> > uint16Mesh;
SurfaceMesh<MarchingCubesVertex<uint16_t> > uint16Mesh;
testForType<uint16_t>(uint16Mesh);
QCOMPARE(uint16Mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(uint16Mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(uint16Mesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<uint16_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<int32_t> > int32Mesh;
SurfaceMesh<MarchingCubesVertex<int32_t> > int32Mesh;
testForType<int32_t>(int32Mesh);
QCOMPARE(int32Mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(int32Mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(int32Mesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<int32_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<uint32_t> > uint32Mesh;
SurfaceMesh<MarchingCubesVertex<uint32_t> > uint32Mesh;
testForType<uint32_t>(uint32Mesh);
QCOMPARE(uint32Mesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(uint32Mesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(uint32Mesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<uint32_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<float> > floatMesh;
SurfaceMesh<MarchingCubesVertex<float> > floatMesh;
testForType<float>(floatMesh);
QCOMPARE(floatMesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(floatMesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(floatMesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial);
SurfaceMesh<PositionMaterialNormal<double> > doubleMesh;
SurfaceMesh<MarchingCubesVertex<double> > doubleMesh;
testForType<double>(doubleMesh);
QCOMPARE(doubleMesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(doubleMesh.getNoOfIndices(), uExpectedIndices);
QCOMPARE(doubleMesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<double>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<Density8> > densityMesh;
SurfaceMesh<MarchingCubesVertex<Density8> > densityMesh;
testForType<Density8>(densityMesh);
QCOMPARE(densityMesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(densityMesh.getNoOfIndices(), uExpectedIndices);
//QCOMPARE(densityMesh.getVertices()[uMaterialToCheck].getMaterial(), static_cast<uint8_t>(fNoMaterial));
SurfaceMesh<PositionMaterialNormal<MaterialDensityPair88> > materialDensityMesh;
SurfaceMesh<MarchingCubesVertex<MaterialDensityPair88> > materialDensityMesh;
testForType<MaterialDensityPair88>(materialDensityMesh);
QCOMPARE(materialDensityMesh.getNoOfVertices(), uExpectedVertices);
QCOMPARE(materialDensityMesh.getNoOfIndices(), uExpectedIndices);

View File

@ -184,7 +184,7 @@ void TestVolumeSubclass::testExtractSurface()
}
}
SurfaceMesh<PositionMaterialNormal<Material8> > result;
SurfaceMesh<CubicVertex<Material8> > result;
CubicSurfaceExtractor< VolumeSubclass<Material8> > cubicSurfaceExtractor(&volumeSubclass, volumeSubclass.getEnclosingRegion(), &result);
cubicSurfaceExtractor.execute();