Renamed SurfaceExtractionController to MarchingCubesController.

This commit is contained in:
unknown 2012-07-15 17:53:37 +02:00
parent eceb6851c0
commit 9a498bad7b
9 changed files with 39 additions and 28 deletions

View File

@ -62,7 +62,7 @@ SET(CORE_INC_FILES
include/PolyVoxCore/SimpleVolume.inl
include/PolyVoxCore/SimpleVolumeBlock.inl
include/PolyVoxCore/SimpleVolumeSampler.inl
include/PolyVoxCore/SurfaceExtractionController.h
include/PolyVoxCore/MarchingCubesController.h
include/PolyVoxCore/MarchingCubesSurfaceExtractor.h
include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl
include/PolyVoxCore/SurfaceMesh.h

View File

@ -24,7 +24,7 @@ freely, subject to the following restrictions:
#ifndef __PolyVox_Density_H__
#define __PolyVox_Density_H__
#include "PolyVoxCore/SurfaceExtractionController.h" //We'll specialise the controller contained in here
#include "PolyVoxCore/MarchingCubesController.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<uint8_t> Density8;
template <typename Type>
class SurfaceExtractionController< Density<Type> >
class MarchingCubesController< Density<Type> >
{
public:
typedef Type DensityType;
typedef float MaterialType;
SurfaceExtractionController(void)
MarchingCubesController(void)
{
// Default to a threshold value halfway between the min and max possible values.
m_tThreshold = (Density<Type>::getMinDensity() + Density<Type>::getMaxDensity()) / 2;
}
SurfaceExtractionController(DensityType tThreshold)
MarchingCubesController(DensityType tThreshold)
{
m_tThreshold = tThreshold;
}

View File

@ -21,26 +21,26 @@ freely, subject to the following restrictions:
distribution.
*******************************************************************************/
#ifndef __PolyVox_SurfaceExtractionController_H__
#define __PolyVox_SurfaceExtractionController_H__
#ifndef __PolyVox_MarchingCubesController_H__
#define __PolyVox_MarchingCubesController_H__
#include <limits>
namespace PolyVox
{
template<typename VoxelType>
class SurfaceExtractionController
class MarchingCubesController
{
public:
typedef VoxelType DensityType;
typedef float MaterialType;
SurfaceExtractionController(void)
MarchingCubesController(void)
{
m_tThreshold = ((std::numeric_limits<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2;
}
SurfaceExtractionController(DensityType tThreshold)
MarchingCubesController(DensityType tThreshold)
{
m_tThreshold = tThreshold;
}

View File

@ -24,7 +24,7 @@ freely, subject to the following restrictions:
#ifndef __PolyVox_MaterialDensityPair_H__
#define __PolyVox_MaterialDensityPair_H__
#include "PolyVoxCore/SurfaceExtractionController.h" //We'll specialise the controller contained in here
#include "PolyVoxCore/MarchingCubesController.h" //We'll specialise the controller contained in here
#include "PolyVoxCore/Voxel.h"
#include "PolyVoxImpl/TypeDef.h"
@ -115,19 +115,19 @@ namespace PolyVox
};
template <typename Type, uint8_t NoOfMaterialBits, uint8_t NoOfDensityBits>
class SurfaceExtractionController< MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits> >
class MarchingCubesController< MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits> >
{
public:
typedef Type DensityType;
typedef Type MaterialType;
SurfaceExtractionController(void)
MarchingCubesController(void)
{
// Default to a threshold value halfway between the min and max possible values.
m_tThreshold = (MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits>::getMinDensity() + MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits>::getMaxDensity()) / 2;
}
SurfaceExtractionController(DensityType tThreshold)
MarchingCubesController(DensityType tThreshold)
{
m_tThreshold = tThreshold;
}

View File

@ -0,0 +1,7 @@
%module MarchingCubesController
%{
#include "MarchingCubesController.h"
%}
%include "MarchingCubesController.h"

View File

@ -0,0 +1,11 @@
%module MarchingCubesSurfaceExtractor
%{
#include "SimpleVolume.h"
#include "Material.h"
#include "MarchingCubesSurfaceExtractor.h"
%}
%include "SimpleVolume.h"
%include "MarchingCubesSurfaceExtractor.h"
%template(SurfaceExtractorSimpleVolumeDensity8) PolyVox::MarchingCubesSurfaceExtractor<PolyVox::SimpleVolume<PolyVox::Density8> >;

View File

@ -38,7 +38,7 @@ const char* __str__() {
%include "VertexTypes.i"
%include "SurfaceMesh.i"
//%include "SimpleVolumeSampler.i"
%include "SurfaceExtractionController.i"
%include "MarchingCubesController.i"
%include "MarchingCubesSurfaceExtractor.i"
//%include "CubicSurfaceExtractor.i"
//%include "CubicSurfaceExtractorWithNormals.i"

View File

@ -1,7 +0,0 @@
%module SurfaceExtractionController
%{
#include "SurfaceExtractionController.h"
%}
%include "SurfaceExtractionController.h"

View File

@ -34,12 +34,12 @@ using namespace PolyVox;
// Test our ability to modify the behaviour of the MarchingCubesSurfaceExtractor. This simple example only modifies
// the threshold (and actually this can be achieved by passing a parameter to the constructor of the
// DefaultSurfaceExtractionController) but you could implement custom behaviour in the other members
// DefaultMarchingCubesController) but you could implement custom behaviour in the other members
// if you wanted too. Actually, it's not clear if this ability is really useful because I can't think
// what you'd modify apart from the threshold but the ability is at least available. Also, the
// DefaultSurfaceExtractionController is templatised whereas this exmple shows that controllers don't
// DefaultMarchingCubesController is templatised whereas this exmple shows that controllers don't
// have to be.
class CustomSurfaceExtractionController
class CustomMarchingCubesController
{
public:
float convertToDensity(float voxel)
@ -117,7 +117,7 @@ void testForType(SurfaceMesh<PositionMaterialNormal>& result)
}
}
SurfaceExtractionController<VoxelType> controller(50);
MarchingCubesController<VoxelType> controller(50);
MarchingCubesSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, volData.getEnclosingRegion(), &result, controller);
extractor.execute();
}
@ -141,8 +141,8 @@ void testCustomController(SurfaceMesh<PositionMaterialNormal>& result)
}
}
CustomSurfaceExtractionController controller;
MarchingCubesSurfaceExtractor< SimpleVolume<float>, CustomSurfaceExtractionController > extractor(&volData, volData.getEnclosingRegion(), &result, controller);
CustomMarchingCubesController controller;
MarchingCubesSurfaceExtractor< SimpleVolume<float>, CustomMarchingCubesController > extractor(&volData, volData.getEnclosingRegion(), &result, controller);
extractor.execute();
}