From 67ec0d2db81b426e3511242fbe62041d34aed3af Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 5 Mar 2014 15:41:16 +0100 Subject: [PATCH 01/10] Initial function wrapper around CubicSurfaceExtractorWithNormals. --- examples/Basic/main.cpp | 7 +++++-- .../PolyVoxCore/CubicSurfaceExtractorWithNormals.h | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 64097731..65814645 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -81,11 +81,14 @@ int main(int argc, char *argv[]) SurfaceMesh mesh; //Create a surface extractor. Comment out one of the following two lines to decide which type gets created. - CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); + //CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); //MarchingCubesSurfaceExtractor< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); //Execute the surface extractor. - surfaceExtractor.execute(); + //surfaceExtractor.execute(); + + DefaultIsQuadNeeded< uint8_t > isQuadNeeded; + mesh = extractCubicSurfaceWithNormals< SimpleVolume, DefaultIsQuadNeeded< uint8_t > >(&volData, volData.getEnclosingRegion(), WrapModes::Border, 0, isQuadNeeded); //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(mesh); diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h index 211734f0..9fc44d7c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h @@ -63,6 +63,15 @@ namespace PolyVox WrapMode m_eWrapMode; typename VolumeType::VoxelType m_tBorderValue; }; + + template + SurfaceMesh extractCubicSurfaceWithNormals(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, IsQuadNeeded isQuadNeeded) + { + SurfaceMesh result; + CubicSurfaceExtractorWithNormals extractor(volData, region, &result, eWrapMode, tBorderValue, isQuadNeeded); + extractor.execute(); + return result; + } } #include "PolyVoxCore/CubicSurfaceExtractorWithNormals.inl" From 0755961750fdf01d306a1382d76053fad768b88c Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 5 Mar 2014 15:50:17 +0100 Subject: [PATCH 02/10] Added support for default parameters. --- examples/Basic/main.cpp | 4 ++-- .../include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 65814645..a7460ce1 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -87,8 +87,8 @@ int main(int argc, char *argv[]) //Execute the surface extractor. //surfaceExtractor.execute(); - DefaultIsQuadNeeded< uint8_t > isQuadNeeded; - mesh = extractCubicSurfaceWithNormals< SimpleVolume, DefaultIsQuadNeeded< uint8_t > >(&volData, volData.getEnclosingRegion(), WrapModes::Border, 0, isQuadNeeded); + //DefaultIsQuadNeeded< uint8_t > isQuadNeeded; + mesh = extractCubicSurfaceWithNormals< SimpleVolume >(&volData, volData.getEnclosingRegion()); //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(mesh); diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h index 9fc44d7c..ae605cd2 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h @@ -72,6 +72,13 @@ namespace PolyVox extractor.execute(); return result; } + + template + SurfaceMesh extractCubicSurfaceWithNormals(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType()) + { + DefaultIsQuadNeeded isQuadNeeded; + return extractCubicSurfaceWithNormals >(volData, region, eWrapMode, tBorderValue, isQuadNeeded); + } } #include "PolyVoxCore/CubicSurfaceExtractorWithNormals.inl" From 529e97f71edf21ecd90abb6445b4734de62be034 Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 5 Mar 2014 15:58:33 +0100 Subject: [PATCH 03/10] Added use of auto for determining mesh type. --- examples/Basic/main.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index a7460ce1..2e17d32a 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -77,18 +77,8 @@ int main(int argc, char *argv[]) SimpleVolume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); createSphereInVolume(volData, 30); - //A mesh object to hold the result of surface extraction - SurfaceMesh mesh; - - //Create a surface extractor. Comment out one of the following two lines to decide which type gets created. - //CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); - //MarchingCubesSurfaceExtractor< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); - - //Execute the surface extractor. - //surfaceExtractor.execute(); - - //DefaultIsQuadNeeded< uint8_t > isQuadNeeded; - mesh = extractCubicSurfaceWithNormals< SimpleVolume >(&volData, volData.getEnclosingRegion()); + // Extract the surface for the specified region of the volume. + auto mesh = extractCubicSurfaceWithNormals(&volData, volData.getEnclosingRegion()); //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(mesh); From acbfb184b878aac4c4419064783909e1f6be6fbf Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 5 Mar 2014 16:30:54 +0100 Subject: [PATCH 04/10] Wrapped MarchingCubesSurfaceExtractor with functions (part of unclassing). --- examples/Basic/main.cpp | 5 +++-- .../PolyVoxCore/MarchingCubesSurfaceExtractor.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index 2e17d32a..4cd45bab 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -77,8 +77,9 @@ int main(int argc, char *argv[]) SimpleVolume volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63))); createSphereInVolume(volData, 30); - // Extract the surface for the specified region of the volume. - auto mesh = extractCubicSurfaceWithNormals(&volData, volData.getEnclosingRegion()); + // Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see. + //auto mesh = extractCubicSurfaceWithNormals(&volData, volData.getEnclosingRegion()); + auto mesh = extractMarchingCubesSurface(&volData, volData.getEnclosingRegion()); //Pass the surface to the OpenGL window openGLWidget.setSurfaceMeshToRender(mesh); diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h index 31803437..2603641a 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h @@ -210,6 +210,22 @@ namespace PolyVox //Our threshold value typename Controller::DensityType m_tThreshold; }; + + template< typename VolumeType, typename Controller> + SurfaceMesh extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, Controller controller) + { + SurfaceMesh result; + MarchingCubesSurfaceExtractor extractor(volData, region, &result, eWrapMode, tBorderValue, controller); + extractor.execute(); + return result; + } + + template< typename VolumeType> + SurfaceMesh extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType()) + { + DefaultMarchingCubesController controller; + return extractMarchingCubesSurface(volData, region, eWrapMode, tBorderValue, controller); + } } #include "PolyVoxCore/MarchingCubesSurfaceExtractor.inl" From d8bcd09d9b0a875a0f26eaee56fa25c5c8951e0a Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 5 Mar 2014 16:47:51 +0100 Subject: [PATCH 05/10] Compile fixes for GCC. --- .../include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h | 6 ++++++ .../include/PolyVoxCore/MarchingCubesSurfaceExtractor.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h index ae605cd2..2162b450 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h @@ -74,7 +74,13 @@ namespace PolyVox } template + // This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template + // Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC? +#if defined(_MSC_VER) SurfaceMesh extractCubicSurfaceWithNormals(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType()) +#else + SurfaceMesh extractCubicSurfaceWithNormals(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType()) +#endif { DefaultIsQuadNeeded isQuadNeeded; return extractCubicSurfaceWithNormals >(volData, region, eWrapMode, tBorderValue, isQuadNeeded); diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h index 2603641a..513b02e0 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h @@ -221,7 +221,13 @@ namespace PolyVox } template< typename VolumeType> + // This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template + // Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC? +#if defined(_MSC_VER) SurfaceMesh extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType()) +#else + SurfaceMesh extractMarchingCubesSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType()) +#endif { DefaultMarchingCubesController controller; return extractMarchingCubesSurface(volData, region, eWrapMode, tBorderValue, controller); From 0bbb6489253f51dc7fa4a00b5836460e4b201750 Mon Sep 17 00:00:00 2001 From: David Williams Date: Fri, 7 Mar 2014 16:08:20 +0100 Subject: [PATCH 06/10] Added functions around CubicSurfaceExtractor. --- .../PolyVoxCore/CubicSurfaceExtractor.h | 22 +++++++++++++++++++ tests/TestCubicSurfaceExtractor.cpp | 5 ++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h index a225a3b5..443a2984 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h @@ -157,6 +157,28 @@ namespace PolyVox WrapMode m_eWrapMode; typename VolumeType::VoxelType m_tBorderValue; }; + + template + SurfaceMesh extractCubicSurface(VolumeType* volData, Region region, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, bool bMergeQuads, IsQuadNeeded isQuadNeeded) + { + SurfaceMesh result; + CubicSurfaceExtractor extractor(volData, region, &result, eWrapMode, tBorderValue, bMergeQuads, isQuadNeeded); + extractor.execute(); + return result; + } + + template + // This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template + // Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC? +#if defined(_MSC_VER) + SurfaceMesh extractCubicSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), bool bMergeQuads = true) +#else + SurfaceMesh extractCubicSurface(VolumeType* volData, Region region, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), bool bMergeQuads = true) +#endif + { + DefaultIsQuadNeeded isQuadNeeded; + return extractCubicSurface >(volData, region, eWrapMode, tBorderValue, bMergeQuads, isQuadNeeded); + } } #include "PolyVoxCore/CubicSurfaceExtractor.inl" diff --git a/tests/TestCubicSurfaceExtractor.cpp b/tests/TestCubicSurfaceExtractor.cpp index 45919e85..319816d9 100644 --- a/tests/TestCubicSurfaceExtractor.cpp +++ b/tests/TestCubicSurfaceExtractor.cpp @@ -106,10 +106,9 @@ uint32_t testForType(void) { for (int32_t x = 0; x < uVolumeSideLength; x += uRegionSideLength) { - SurfaceMesh result; Region regionToExtract(x, y, z, x + uRegionSideLength - 1, y + uRegionSideLength - 1, z + uRegionSideLength - 1); - CubicSurfaceExtractor< SimpleVolume > extractor(&volData, regionToExtract, &result); - extractor.execute(); + + auto result = extractCubicSurface(&volData, regionToExtract); uTotalVertices += result.getNoOfVertices(); uTotalIndices += result.getNoOfIndices(); From e52e9e373e1a2c62158df3bd610ab9142b4bcb4e Mon Sep 17 00:00:00 2001 From: David Williams Date: Fri, 7 Mar 2014 16:25:24 +0100 Subject: [PATCH 07/10] Switched test to use unclassed function. --- tests/TestVolumeSubclass.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/TestVolumeSubclass.cpp b/tests/TestVolumeSubclass.cpp index 91a619b4..d4f20825 100644 --- a/tests/TestVolumeSubclass.cpp +++ b/tests/TestVolumeSubclass.cpp @@ -184,9 +184,7 @@ void TestVolumeSubclass::testExtractSurface() } } - SurfaceMesh result; - CubicSurfaceExtractor< VolumeSubclass > cubicSurfaceExtractor(&volumeSubclass, volumeSubclass.getEnclosingRegion(), &result); - cubicSurfaceExtractor.execute(); + auto result = extractCubicSurface(&volumeSubclass, volumeSubclass.getEnclosingRegion()); QCOMPARE(result.getNoOfVertices(), static_cast(8)); } From 347028199c4fe65ca41904b27327d3f173b3eb04 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 11 May 2014 16:27:38 +0200 Subject: [PATCH 08/10] Paging example now also uses free-function surface extractor. --- examples/Paging/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index 27236afd..64b2e9c6 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -186,11 +186,7 @@ int main(int argc, char *argv[]) std::cout << "Compression ratio: 1 to " << (1.0/(volData.calculateCompressionRatio())) << std::endl; //Extract the surface - SurfaceMesh mesh; - CubicSurfaceExtractorWithNormals< LargeVolume > surfaceExtractor(&volData, reg, &mesh); - //MarchingCubesSurfaceExtractor< LargeVolume > surfaceExtractor(&volData, reg, &mesh); - //CubicSurfaceExtractorWithNormals surfaceExtractor(&volData, reg, &mesh); - surfaceExtractor.execute(); + auto mesh = extractMarchingCubesSurface(&volData, reg); std::cout << "#vertices: " << mesh.getNoOfVertices() << std::endl; //Pass the surface to the OpenGL window From 95a3e2e9ce18ef4693529d076ef512e1741bacea Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 11 May 2014 16:29:51 +0200 Subject: [PATCH 09/10] Smooth LOD example now uses free function surface extractor. --- examples/SmoothLOD/main.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/SmoothLOD/main.cpp b/examples/SmoothLOD/main.cpp index 9b8f6f78..ba6a9f03 100644 --- a/examples/SmoothLOD/main.cpp +++ b/examples/SmoothLOD/main.cpp @@ -90,15 +90,11 @@ int main(int argc, char *argv[]) volumeResampler.execute(); //Extract the surface - SurfaceMesh meshLowLOD; - MarchingCubesSurfaceExtractor< RawVolume > surfaceExtractor(&volDataLowLOD, volDataLowLOD.getEnclosingRegion(), &meshLowLOD); - surfaceExtractor.execute(); + auto meshLowLOD = extractMarchingCubesSurface(&volDataLowLOD, volDataLowLOD.getEnclosingRegion()); meshLowLOD.scaleVertices(/*2.0f*/63.0f / 31.0f); //Extract the surface - SurfaceMesh meshHighLOD; - MarchingCubesSurfaceExtractor< SimpleVolume > surfaceExtractorHigh(&volData, PolyVox::Region(Vector3DInt32(30,0,0), Vector3DInt32(63, 63, 63)), &meshHighLOD); - surfaceExtractorHigh.execute(); + auto meshHighLOD = extractMarchingCubesSurface(&volData, PolyVox::Region(Vector3DInt32(30, 0, 0), Vector3DInt32(63, 63, 63))); meshHighLOD.translateVertices(Vector3DFloat(30, 0, 0)); //Pass the surface to the OpenGL window From 217aa937208b5b0871cc80c04116e2067f528006 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 11 May 2014 16:41:52 +0200 Subject: [PATCH 10/10] Test now uses free-function surface extractor. --- tests/TestSurfaceExtractor.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/TestSurfaceExtractor.cpp b/tests/TestSurfaceExtractor.cpp index 796f3b2c..ac146751 100644 --- a/tests/TestSurfaceExtractor.cpp +++ b/tests/TestSurfaceExtractor.cpp @@ -102,7 +102,7 @@ void writeMaterialValueToVoxel(int valueToWrite, MaterialDensityPair88& voxel) // Runs the surface extractor for a given type. template -void testForType(SurfaceMesh& result) +SurfaceMesh testForType(void) //I think we could avoid specifying this return type by using auto/decltype? { const int32_t uVolumeSideLength = 32; @@ -127,8 +127,10 @@ void testForType(SurfaceMesh& result) DefaultMarchingCubesController controller; controller.setThreshold(50); - MarchingCubesSurfaceExtractor< SimpleVolume > extractor(&volData, volData.getEnclosingRegion(), &result, WrapModes::Border, VoxelType(), controller); - extractor.execute(); + + auto result = extractMarchingCubesSurface(&volData, volData.getEnclosingRegion(), WrapModes::Border, VoxelType(), controller); + + return result; } void testCustomController(SurfaceMesh& result) @@ -167,53 +169,53 @@ void TestSurfaceExtractor::testExecute() //Run the test for various voxel types. QBENCHMARK { - testForType(mesh); + mesh = testForType(); } QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial); - testForType(mesh); + mesh = testForType(); QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices); QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices); QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fExpectedMaterial);