Fix SWIG bindings

The bindings now compile and in Python a mesh can be extracted from a volume.
The only extractor currently bound is SurfaceExtractor<SimpleVolume, Material8>.

The bindings are still commented out in library/CMakeLists.txt by default.
This commit is contained in:
Matt Williams 2011-06-07 20:33:01 +02:00
parent 72adbaa5a7
commit acd3c3c791
4 changed files with 27 additions and 6 deletions

View File

@ -31,9 +31,9 @@ else()
endif() endif()
endif() endif()
#add_subdirectory(bindings)
add_subdirectory(PolyVoxCore) add_subdirectory(PolyVoxCore)
add_subdirectory(PolyVoxUtil) add_subdirectory(PolyVoxUtil)
#add_subdirectory(bindings)
#Set up install paths e.g. for PolyVoxConfig.cmake #Set up install paths e.g. for PolyVoxConfig.cmake
if(WIN32) if(WIN32)

View File

@ -36,6 +36,7 @@ namespace PolyVox
class SimpleVolume class SimpleVolume
{ {
public: public:
#ifndef SWIG
class Block class Block
{ {
//Make Sampler a friend //Make Sampler a friend
@ -129,6 +130,7 @@ namespace PolyVox
//Other current position information //Other current position information
VoxelType* mCurrentVoxel; VoxelType* mCurrentVoxel;
}; };
#endif
public: public:
/// Constructor for creating a fixed size volume. /// Constructor for creating a fixed size volume.

View File

@ -27,8 +27,8 @@
//%include "Array.i" //%include "Array.i"
%include "VertexTypes.i" %include "VertexTypes.i"
%include "SurfaceMesh.i" %include "SurfaceMesh.i"
%include "SimpleVolumeSampler.i" //%include "SimpleVolumeSampler.i"
%include "SurfaceExtractor.i" %include "SurfaceExtractor.i"
%include "CubicSurfaceExtractor.i" //%include "CubicSurfaceExtractor.i"
%include "CubicSurfaceExtractorWithNormals.i" //%include "CubicSurfaceExtractorWithNormals.i"
//%include "MeshDecimator.i" //%include "MeshDecimator.i"

View File

@ -2,10 +2,29 @@
%{ %{
#include "SimpleVolume.h" #include "SimpleVolume.h"
#include "SurfaceExtractor.h" #include "SurfaceExtractor.h"
#include "PolyVoxCore/Material.h"
namespace PolyVox
{
class SurfaceExtractorSimpleVolumeMaterial8 : public SurfaceExtractor<SimpleVolume, Material8>
{
public:
SurfaceExtractorSimpleVolumeMaterial8(SimpleVolume<Material8>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
: SurfaceExtractor<SimpleVolume, Material8>(volData, region, result) {}
void execute() { SurfaceExtractor<SimpleVolume, Material8>::execute(); }
};
};
%} %}
%include "SimpleVolume.h" %include "SimpleVolume.h"
%include "SurfaceExtractor.h" %include "SurfaceExtractor.h"
%template(SurfaceExtractorMaterial8) PolyVox::SurfaceExtractor<PolyVox::Material8>; namespace PolyVox
%template(SurfaceExtractorDensity8) PolyVox::SurfaceExtractor<PolyVox::Density8>; {
class SurfaceExtractorSimpleVolumeMaterial8 : public SurfaceExtractor<SimpleVolume, Material8>
{
public:
SurfaceExtractorSimpleVolumeMaterial8(SimpleVolume<Material8>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result);
void execute();
};
};