From fec1191a731bf638a88b24b6ccb5c5633e90f30a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 May 2012 15:12:30 +0200 Subject: [PATCH] Removed use of template template parameters from CubicSurfaceExtractor. --- .../PolyVoxCore/CubicSurfaceExtractor.h | 6 ++-- .../PolyVoxCore/CubicSurfaceExtractor.inl | 34 +++++++++---------- tests/TestVolumeSubclass.cpp | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h index 1d7f6ea6..86922b54 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h @@ -31,7 +31,7 @@ freely, subject to the following restrictions: namespace PolyVox { - template< template class VolumeType, typename VoxelType> + template class CubicSurfaceExtractor { struct IndexAndMaterial @@ -57,7 +57,7 @@ namespace PolyVox }; public: - CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh* result, bool bMergeQuads = true); + CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh* result, bool bMergeQuads = true); void execute(); @@ -67,7 +67,7 @@ namespace PolyVox bool mergeQuads(Quad& q1, Quad& q2); //The volume data and a sampler to access it. - VolumeType* m_volData; + VolumeType* m_volData; //Information about the region we are currently processing Region m_regSizeInVoxels; diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl index b28b0d0b..5155e034 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl @@ -31,11 +31,11 @@ namespace PolyVox // The vertex position at the center of this group is then going to be used by six quads all with different materials. // One futher note - we can actually have eight quads sharing a vertex position (imagine two 1x1x10 rows of voxels // sharing a common edge) but in this case all eight quads will not have different materials. - template< template class VolumeType, typename VoxelType> - const uint32_t CubicSurfaceExtractor::MaxVerticesPerPosition = 6; + template + const uint32_t CubicSurfaceExtractor::MaxVerticesPerPosition = 6; - template< template class VolumeType, typename VoxelType> - CubicSurfaceExtractor::CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh* result, bool bMergeQuads) + template + CubicSurfaceExtractor::CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh* result, bool bMergeQuads) :m_volData(volData) ,m_regSizeInVoxels(region) ,m_meshCurrent(result) @@ -43,8 +43,8 @@ namespace PolyVox { } - template< template class VolumeType, typename VoxelType> - void CubicSurfaceExtractor::execute() + template + void CubicSurfaceExtractor::execute() { m_meshCurrent->clear(); @@ -70,7 +70,7 @@ namespace PolyVox m_vecQuads[NegativeZ].resize(m_regSizeInVoxels.getUpperCorner().getZ() - m_regSizeInVoxels.getLowerCorner().getZ() + 2); m_vecQuads[PositiveZ].resize(m_regSizeInVoxels.getUpperCorner().getZ() - m_regSizeInVoxels.getLowerCorner().getZ() + 2); - typename VolumeType::Sampler volumeSampler(m_volData); + typename VolumeType::Sampler volumeSampler(m_volData); Quad quad; for(int32_t z = m_regSizeInVoxels.getLowerCorner().getZ(); z <= m_regSizeInVoxels.getUpperCorner().getZ() + 1; z++) @@ -90,10 +90,10 @@ namespace PolyVox volumeSampler.setPosition(x,y,z); - VoxelType currentVoxel = volumeSampler.getVoxel(); + VolumeType::VoxelType currentVoxel = volumeSampler.getVoxel(); bool currentVoxelIsSolid = currentVoxel.getMaterial() != 0; - VoxelType negXVoxel = volumeSampler.peekVoxel1nx0py0pz(); + VolumeType::VoxelType negXVoxel = volumeSampler.peekVoxel1nx0py0pz(); bool negXVoxelIsSolid = negXVoxel.getMaterial() != 0; if((currentVoxelIsSolid != negXVoxelIsSolid) && (finalY == false) && (finalZ == false)) @@ -130,7 +130,7 @@ namespace PolyVox } } - VoxelType negYVoxel = volumeSampler.peekVoxel0px1ny0pz(); + VolumeType::VoxelType negYVoxel = volumeSampler.peekVoxel0px1ny0pz(); bool negYVoxelIsSolid = negYVoxel.getMaterial() != 0; if((currentVoxelIsSolid != negYVoxelIsSolid) && (finalX == false) && (finalZ == false)) @@ -167,7 +167,7 @@ namespace PolyVox } } - VoxelType negZVoxel = volumeSampler.peekVoxel0px0py1nz(); + VolumeType::VoxelType negZVoxel = volumeSampler.peekVoxel0px0py1nz(); bool negZVoxelIsSolid = negZVoxel.getMaterial() != 0; if((currentVoxelIsSolid != negZVoxelIsSolid) && (finalX == false) && (finalY == false)) @@ -243,8 +243,8 @@ namespace PolyVox m_meshCurrent->m_vecLodRecords.push_back(lodRecord); } - template< template class VolumeType, typename VoxelType> - int32_t CubicSurfaceExtractor::addVertex(float fX, float fY, float fZ, uint32_t uMaterialIn, Array<3, IndexAndMaterial>& existingVertices) + template + int32_t CubicSurfaceExtractor::addVertex(float fX, float fY, float fZ, uint32_t uMaterialIn, Array<3, IndexAndMaterial>& existingVertices) { uint32_t uX = static_cast(fX + 0.75f); uint32_t uY = static_cast(fY + 0.75f); @@ -275,8 +275,8 @@ namespace PolyVox return -1; //Should never happen. } - template< template class VolumeType, typename VoxelType> - bool CubicSurfaceExtractor::performQuadMerging(std::list& quads) + template + bool CubicSurfaceExtractor::performQuadMerging(std::list& quads) { bool bDidMerge = false; for(typename std::list::iterator outerIter = quads.begin(); outerIter != quads.end(); outerIter++) @@ -305,8 +305,8 @@ namespace PolyVox return bDidMerge; } - template< template class VolumeType, typename VoxelType> - bool CubicSurfaceExtractor::mergeQuads(Quad& q1, Quad& q2) + template + bool CubicSurfaceExtractor::mergeQuads(Quad& q1, Quad& q2) { //All four vertices of a given quad have the same material, //so just check that the first pair of vertices match. diff --git a/tests/TestVolumeSubclass.cpp b/tests/TestVolumeSubclass.cpp index ef61cbf4..e70afb92 100644 --- a/tests/TestVolumeSubclass.cpp +++ b/tests/TestVolumeSubclass.cpp @@ -130,7 +130,7 @@ void TestVolumeSubclass::testExtractSurface() } SurfaceMesh result; - CubicSurfaceExtractor cubicSurfaceExtractor(&volumeSubclass, volumeSubclass.getEnclosingRegion(), &result); + CubicSurfaceExtractor< VolumeSubclass > cubicSurfaceExtractor(&volumeSubclass, volumeSubclass.getEnclosingRegion(), &result); cubicSurfaceExtractor.execute(); QCOMPARE(result.getNoOfVertices(), static_cast(8));