Work on tests.
This commit is contained in:
parent
4b3c8a1648
commit
11845c1d31
@ -100,7 +100,7 @@ void writeMaterialValueToVoxel(int valueToWrite, MaterialDensityPair88& voxel)
|
||||
voxel.setMaterial(valueToWrite);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
/*template <typename VoxelType>
|
||||
SimpleVolume<VoxelType>* createAndFillVolume(void)
|
||||
{
|
||||
const int32_t uVolumeSideLength = 32;
|
||||
@ -125,19 +125,37 @@ SimpleVolume<VoxelType>* createAndFillVolume(void)
|
||||
}
|
||||
|
||||
return volData;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Runs the surface extractor for a given type.
|
||||
template <typename VoxelType>
|
||||
Mesh<MarchingCubesVertex<VoxelType> > testForType(void) //I think we could avoid specifying this return type by using auto/decltype?
|
||||
{
|
||||
const int32_t uVolumeSideLength = 32;
|
||||
|
||||
//Create empty volume
|
||||
SimpleVolume<VoxelType>* volData = createAndFillVolume<VoxelType>();
|
||||
SimpleVolume<VoxelType> 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++)
|
||||
{
|
||||
for (int32_t x = 0; x < uVolumeSideLength; x++)
|
||||
{
|
||||
VoxelType voxelValue;
|
||||
//Create a density field which changes throughout the volume.
|
||||
writeDensityValueToVoxel<VoxelType>(x + y + z, voxelValue);
|
||||
//Two different materials in two halves of the volume
|
||||
writeMaterialValueToVoxel<VoxelType>(z > uVolumeSideLength / 2 ? 42 : 79, voxelValue);
|
||||
volData.setVoxelAt(x, y, z, voxelValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DefaultMarchingCubesController<VoxelType> controller;
|
||||
controller.setThreshold(50);
|
||||
|
||||
auto result = extractMarchingCubesMesh(volData, volData->getEnclosingRegion(), WrapModes::Border, VoxelType(), controller);
|
||||
auto result = extractMarchingCubesMesh(&volData, volData.getEnclosingRegion(), WrapModes::Border, VoxelType(), controller);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -233,12 +251,12 @@ void TestSurfaceExtractor::testExecute()
|
||||
QCOMPARE(floatMesh.getNoOfIndices(), uExpectedIndices);
|
||||
QCOMPARE(floatMesh.getVertices()[uMaterialToCheck].data, fExpectedData);*/
|
||||
|
||||
auto uintVol = createAndFillVolume<uint8_t>();
|
||||
/*auto uintVol = createAndFillVolume<uint8_t>();
|
||||
auto uintMesh = extractMarchingCubesMesh(uintVol, uintVol->getEnclosingRegion());
|
||||
QCOMPARE(uintMesh.getNoOfVertices(), uExpectedVertices);
|
||||
QCOMPARE(uintMesh.getNoOfIndices(), uExpectedIndices);
|
||||
QCOMPARE(uintMesh.getNoOfIndices(), uExpectedIndices);*/
|
||||
//QCOMPARE(uintMesh.getVertices()[uMaterialToCheck].data, static_cast<uint8_t>(fExpectedData));
|
||||
std::cout << uintMesh.getVertices()[uMaterialToCheck].data << std::endl;
|
||||
//std::cout << uintMesh.getVertices()[uMaterialToCheck].data << std::endl;
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestSurfaceExtractor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user