diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h index 7636e50a..1943a771 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h @@ -208,11 +208,9 @@ namespace PolyVox Region m_regSliceCurrent; //Our threshold value - //typename VoxelTypeTraits::DensityType m_tThreshold; - typename DefaultMarchingCubesController::DensityType m_tThreshold; + typename Controller::DensityType m_tThreshold; //Used to convert arbitrary voxel types in densities and materials. - //DefaultMarchingCubesController m_controller; Controller m_controller; }; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl index 01c1b455..52741703 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl @@ -444,9 +444,9 @@ namespace PolyVox //Choose one of the two materials to use for the vertex (we don't interpolate as interpolation of //material IDs does not make sense). We take the largest, so that if we are working on a material-only //volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component. - typename DefaultMarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); - typename DefaultMarchingCubesController::MaterialType uMaterial100 = m_controller.convertToMaterial(v100); - typename DefaultMarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100); + typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); + typename Controller::MaterialType uMaterial100 = m_controller.convertToMaterial(v100); + typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100); PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast(uMaterial)); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex); @@ -470,9 +470,9 @@ namespace PolyVox //Choose one of the two materials to use for the vertex (we don't interpolate as interpolation of //material IDs does not make sense). We take the largest, so that if we are working on a material-only //volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component. - typename DefaultMarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); - typename DefaultMarchingCubesController::MaterialType uMaterial010 = m_controller.convertToMaterial(v010); - typename DefaultMarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial010); + typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); + typename Controller::MaterialType uMaterial010 = m_controller.convertToMaterial(v010); + typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial010); PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast(uMaterial)); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex); @@ -496,9 +496,9 @@ namespace PolyVox //Choose one of the two materials to use for the vertex (we don't interpolate as interpolation of //material IDs does not make sense). We take the largest, so that if we are working on a material-only //volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component. - typename DefaultMarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); - typename DefaultMarchingCubesController::MaterialType uMaterial001 = m_controller.convertToMaterial(v001); - typename DefaultMarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001); + typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); + typename Controller::MaterialType uMaterial001 = m_controller.convertToMaterial(v001); + typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001); PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast(uMaterial)); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex); diff --git a/tests/TestSurfaceExtractor.cpp b/tests/TestSurfaceExtractor.cpp index 017003d5..fdc6c595 100644 --- a/tests/TestSurfaceExtractor.cpp +++ b/tests/TestSurfaceExtractor.cpp @@ -42,6 +42,9 @@ using namespace PolyVox; class CustomMarchingCubesController { public: + typedef float DensityType; + typedef float MaterialType; + float convertToDensity(float voxel) { return voxel;