From b140e16083d7d4712e8cc0d1945f029b12a887a2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 15 Jul 2012 23:07:00 +0200 Subject: [PATCH] Renamed MarchingCubesController to DefaultMarchingCubesController. --- library/PolyVoxCore/CMakeLists.txt | 2 +- ...ller.h => DefaultMarchingCubesController.h} | 6 +++--- .../PolyVoxCore/include/PolyVoxCore/Density.h | 8 ++++---- .../MarchingCubesSurfaceExtractor.h | 8 ++++---- .../MarchingCubesSurfaceExtractor.inl | 18 +++++++++--------- .../include/PolyVoxCore/MaterialDensityPair.h | 8 ++++---- .../bindings/DefaultMarchingCubesController.i | 7 +++++++ library/bindings/MarchingCubesController.i | 7 ------- library/bindings/PolyVoxCore.i | 2 +- tests/TestSurfaceExtractor.cpp | 2 +- 10 files changed, 34 insertions(+), 34 deletions(-) rename library/PolyVoxCore/include/PolyVoxCore/{MarchingCubesController.h => DefaultMarchingCubesController.h} (93%) create mode 100644 library/bindings/DefaultMarchingCubesController.i delete mode 100644 library/bindings/MarchingCubesController.i diff --git a/library/PolyVoxCore/CMakeLists.txt b/library/PolyVoxCore/CMakeLists.txt index 7c3acf10..8711cc21 100644 --- a/library/PolyVoxCore/CMakeLists.txt +++ b/library/PolyVoxCore/CMakeLists.txt @@ -32,6 +32,7 @@ SET(CORE_INC_FILES include/PolyVoxCore/CubicSurfaceExtractor.inl include/PolyVoxCore/CubicSurfaceExtractorWithNormals.h include/PolyVoxCore/CubicSurfaceExtractorWithNormals.inl + include/PolyVoxCore/DefaultMarchingCubesController.h include/PolyVoxCore/Density.h include/PolyVoxCore/GradientEstimators.h include/PolyVoxCore/GradientEstimators.inl @@ -43,7 +44,6 @@ SET(CORE_INC_FILES include/PolyVoxCore/Log.h include/PolyVoxCore/LowPassFilter.h include/PolyVoxCore/LowPassFilter.inl - include/PolyVoxCore/MarchingCubesController.h include/PolyVoxCore/MarchingCubesSurfaceExtractor.h include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl include/PolyVoxCore/Material.h diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesController.h b/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h similarity index 93% rename from library/PolyVoxCore/include/PolyVoxCore/MarchingCubesController.h rename to library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h index 68b6b090..2ab7abcc 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesController.h +++ b/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h @@ -29,18 +29,18 @@ freely, subject to the following restrictions: namespace PolyVox { template - class MarchingCubesController + class DefaultMarchingCubesController { public: typedef VoxelType DensityType; typedef float MaterialType; - MarchingCubesController(void) + DefaultMarchingCubesController(void) { m_tThreshold = ((std::numeric_limits::min)() + (std::numeric_limits::max)()) / 2; } - MarchingCubesController(DensityType tThreshold) + DefaultMarchingCubesController(DensityType tThreshold) { m_tThreshold = tThreshold; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/Density.h b/library/PolyVoxCore/include/PolyVoxCore/Density.h index e1d92e42..b5b8f8e2 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Density.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Density.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Density_H__ #define __PolyVox_Density_H__ -#include "PolyVoxCore/MarchingCubesController.h" //We'll specialise the controller contained in here +#include "PolyVoxCore/DefaultMarchingCubesController.h" //We'll specialise the controller contained in here #include "PolyVoxCore/Voxel.h" #include "PolyVoxImpl/TypeDef.h" @@ -103,19 +103,19 @@ namespace PolyVox typedef Density Density8; template - class MarchingCubesController< Density > + class DefaultMarchingCubesController< Density > { public: typedef Type DensityType; typedef float MaterialType; - MarchingCubesController(void) + DefaultMarchingCubesController(void) { // Default to a threshold value halfway between the min and max possible values. m_tThreshold = (Density::getMinDensity() + Density::getMaxDensity()) / 2; } - MarchingCubesController(DensityType tThreshold) + DefaultMarchingCubesController(DensityType tThreshold) { m_tThreshold = tThreshold; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h index 3daa6dae..7636e50a 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h +++ b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h @@ -29,11 +29,11 @@ freely, subject to the following restrictions: #include "PolyVoxCore/Array.h" #include "PolyVoxCore/SurfaceMesh.h" -#include "PolyVoxCore/MarchingCubesController.h" +#include "PolyVoxCore/DefaultMarchingCubesController.h" namespace PolyVox { - template< typename VolumeType, typename Controller = MarchingCubesController > + template< typename VolumeType, typename Controller = DefaultMarchingCubesController > class MarchingCubesSurfaceExtractor { public: @@ -209,10 +209,10 @@ namespace PolyVox //Our threshold value //typename VoxelTypeTraits::DensityType m_tThreshold; - typename MarchingCubesController::DensityType m_tThreshold; + typename DefaultMarchingCubesController::DensityType m_tThreshold; //Used to convert arbitrary voxel types in densities and materials. - //MarchingCubesController m_controller; + //DefaultMarchingCubesController m_controller; Controller m_controller; }; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl index a99b8590..01c1b455 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 MarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); - typename MarchingCubesController::MaterialType uMaterial100 = m_controller.convertToMaterial(v100); - typename MarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100); + typename DefaultMarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); + typename DefaultMarchingCubesController::MaterialType uMaterial100 = m_controller.convertToMaterial(v100); + typename DefaultMarchingCubesController::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 MarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); - typename MarchingCubesController::MaterialType uMaterial010 = m_controller.convertToMaterial(v010); - typename MarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial010); + typename DefaultMarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); + typename DefaultMarchingCubesController::MaterialType uMaterial010 = m_controller.convertToMaterial(v010); + typename DefaultMarchingCubesController::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 MarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); - typename MarchingCubesController::MaterialType uMaterial001 = m_controller.convertToMaterial(v001); - typename MarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001); + typename DefaultMarchingCubesController::MaterialType uMaterial000 = m_controller.convertToMaterial(v000); + typename DefaultMarchingCubesController::MaterialType uMaterial001 = m_controller.convertToMaterial(v001); + typename DefaultMarchingCubesController::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001); PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast(uMaterial)); uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex); diff --git a/library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h b/library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h index 58d53659..fb83b103 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h +++ b/library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_MaterialDensityPair_H__ #define __PolyVox_MaterialDensityPair_H__ -#include "PolyVoxCore/MarchingCubesController.h" //We'll specialise the controller contained in here +#include "PolyVoxCore/DefaultMarchingCubesController.h" //We'll specialise the controller contained in here #include "PolyVoxCore/Voxel.h" #include "PolyVoxImpl/TypeDef.h" @@ -115,19 +115,19 @@ namespace PolyVox }; template - class MarchingCubesController< MaterialDensityPair > + class DefaultMarchingCubesController< MaterialDensityPair > { public: typedef Type DensityType; typedef Type MaterialType; - MarchingCubesController(void) + DefaultMarchingCubesController(void) { // Default to a threshold value halfway between the min and max possible values. m_tThreshold = (MaterialDensityPair::getMinDensity() + MaterialDensityPair::getMaxDensity()) / 2; } - MarchingCubesController(DensityType tThreshold) + DefaultMarchingCubesController(DensityType tThreshold) { m_tThreshold = tThreshold; } diff --git a/library/bindings/DefaultMarchingCubesController.i b/library/bindings/DefaultMarchingCubesController.i new file mode 100644 index 00000000..55ee8537 --- /dev/null +++ b/library/bindings/DefaultMarchingCubesController.i @@ -0,0 +1,7 @@ +%module DefaultMarchingCubesController +%{ +#include "DefaultMarchingCubesController.h" +%} + +%include "DefaultMarchingCubesController.h" + diff --git a/library/bindings/MarchingCubesController.i b/library/bindings/MarchingCubesController.i deleted file mode 100644 index ffe2c253..00000000 --- a/library/bindings/MarchingCubesController.i +++ /dev/null @@ -1,7 +0,0 @@ -%module MarchingCubesController -%{ -#include "MarchingCubesController.h" -%} - -%include "MarchingCubesController.h" - diff --git a/library/bindings/PolyVoxCore.i b/library/bindings/PolyVoxCore.i index 5b87b333..c2f0feb3 100644 --- a/library/bindings/PolyVoxCore.i +++ b/library/bindings/PolyVoxCore.i @@ -27,6 +27,7 @@ const char* __str__() { %include "stdint.i" %include "std_vector.i" %include "Vector.i" +%include "DefaultMarchingCubesController.i" %include "Density.i" %include "Material.i" %include "MaterialDensityPair.i" @@ -38,7 +39,6 @@ const char* __str__() { %include "VertexTypes.i" %include "SurfaceMesh.i" //%include "SimpleVolumeSampler.i" -%include "MarchingCubesController.i" %include "MarchingCubesSurfaceExtractor.i" //%include "CubicSurfaceExtractor.i" //%include "CubicSurfaceExtractorWithNormals.i" diff --git a/tests/TestSurfaceExtractor.cpp b/tests/TestSurfaceExtractor.cpp index a9b98034..017003d5 100644 --- a/tests/TestSurfaceExtractor.cpp +++ b/tests/TestSurfaceExtractor.cpp @@ -117,7 +117,7 @@ void testForType(SurfaceMesh& result) } } - MarchingCubesController controller(50); + DefaultMarchingCubesController controller(50); MarchingCubesSurfaceExtractor< SimpleVolume > extractor(&volData, volData.getEnclosingRegion(), &result, controller); extractor.execute(); }