diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index da7bedad..ccd05e0c 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) //Extract the surface SurfaceMesh mesh; - CubicSurfaceExtractorWithNormals surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); + CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); surfaceExtractor.execute(); //Pass the surface to the OpenGL window diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h b/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h index 7b016988..e1e7ab19 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h @@ -38,10 +38,12 @@ namespace PolyVox //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// More details to come... //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template + template class BaseVolume { public: + typedef _VoxelType VoxelType; + #ifndef SWIG template class Sampler diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h index e2232e35..7ea0e9b6 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h @@ -31,6 +31,8 @@ freely, subject to the following restrictions: namespace PolyVox { + + //FIXME - Make this a member of CubicSurfaceExtractorWithNormals? template bool defaultIsQuadNeeded(VoxelType from, VoxelType to, float& materialToUse) { @@ -45,20 +47,20 @@ namespace PolyVox } } - template< template class VolumeType, typename VoxelType> + template class CubicSurfaceExtractorWithNormals { public: - CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh* result, polyvox_function funcIsQuadNeededCallback = defaultIsQuadNeeded); + CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh* result, polyvox_function funcIsQuadNeededCallback = defaultIsQuadNeeded); void execute(); private: - polyvox_function m_funcIsQuadNeededCallback; + polyvox_function m_funcIsQuadNeededCallback; //The volume data and a sampler to access it. - VolumeType* m_volData; - typename VolumeType::Sampler m_sampVolume; + VolumeType* m_volData; + typename VolumeType::Sampler m_sampVolume; //The surface patch we are currently filling. SurfaceMesh* m_meshCurrent; diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl index 526d094f..ee4e5fce 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl @@ -23,8 +23,8 @@ freely, subject to the following restrictions: namespace PolyVox { - template< template class VolumeType, typename VoxelType> - CubicSurfaceExtractorWithNormals::CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh* result, polyvox_function funcIsQuadNeededCallback) + template + CubicSurfaceExtractorWithNormals::CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh* result, polyvox_function funcIsQuadNeededCallback) :m_volData(volData) ,m_sampVolume(volData) ,m_meshCurrent(result) @@ -34,8 +34,8 @@ namespace PolyVox assert(m_funcIsQuadNeededCallback); } - template< template class VolumeType, typename VoxelType> - void CubicSurfaceExtractorWithNormals::execute() + template + void CubicSurfaceExtractorWithNormals::execute() { m_meshCurrent->clear(); diff --git a/library/PolyVoxCore/source/SimpleInterface.cpp b/library/PolyVoxCore/source/SimpleInterface.cpp index 9925e5a2..10aa9390 100644 --- a/library/PolyVoxCore/source/SimpleInterface.cpp +++ b/library/PolyVoxCore/source/SimpleInterface.cpp @@ -31,7 +31,7 @@ namespace PolyVox { void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh) { - CubicSurfaceExtractorWithNormals surfaceExtractor(&volume, region, &resultMesh, MaterialDensityPair88::isQuadNeeded); + CubicSurfaceExtractorWithNormals< SimpleVolume > surfaceExtractor(&volume, region, &resultMesh, MaterialDensityPair88::isQuadNeeded); surfaceExtractor.execute(); } diff --git a/tests/TestCubicSurfaceExtractor.cpp b/tests/TestCubicSurfaceExtractor.cpp index 1b289ee1..21b3972d 100644 --- a/tests/TestCubicSurfaceExtractor.cpp +++ b/tests/TestCubicSurfaceExtractor.cpp @@ -94,7 +94,7 @@ void testForType(SurfaceMesh& result) } } - CubicSurfaceExtractorWithNormals extractor(&volData, volData.getEnclosingRegion(), &result, VoxelType::isQuadNeeded); + CubicSurfaceExtractorWithNormals< SimpleVolume > extractor(&volData, volData.getEnclosingRegion(), &result, VoxelType::isQuadNeeded); extractor.execute(); }