diff --git a/library/bindings/BaseVolume.i b/library/bindings/BaseVolume.i index 448c703a..3ae83f30 100644 --- a/library/bindings/BaseVolume.i +++ b/library/bindings/BaseVolume.i @@ -9,12 +9,4 @@ %include "Density.h" %include "BaseVolume.h" -%template(BaseVolumeDensity8) PolyVox::BaseVolume; - -%template(BaseVolumeMaterial8) PolyVox::BaseVolume; - -%template(BaseVolumeMaterial16) PolyVox::BaseVolume; - -%template(BaseVolumeMaterialDensityPair44) PolyVox::BaseVolume; - -%template(BaseVolumeMaterialDensityPair88) PolyVox::BaseVolume; +VOLUMETYPES(BaseVolume, PolyVox::BaseVolume) diff --git a/library/bindings/PolyVoxCore.i b/library/bindings/PolyVoxCore.i index 456bce9f..36461861 100644 --- a/library/bindings/PolyVoxCore.i +++ b/library/bindings/PolyVoxCore.i @@ -24,6 +24,16 @@ const char* __str__() { } %enddef +//Centralise this to avoid repeating ourselves +//This macro will be called in the volume interface files to define the various volume types. +%define VOLUMETYPES(shortname, class) +%template(shortname ## Density8) class; +%template(shortname ## Material8) class; +%template(shortname ## Material16) class; +%template(shortname ## MaterialDensityPair44) class; +%template(shortname ## MaterialDensityPair88) class; +%enddef + %feature("autodoc", "1"); //This will rename "operator=" to "assign" since Python doesn't have assignment diff --git a/library/bindings/RawVolume.i b/library/bindings/RawVolume.i index 0108fc1a..c7e2af49 100644 --- a/library/bindings/RawVolume.i +++ b/library/bindings/RawVolume.i @@ -9,12 +9,4 @@ %include "Density.h" %include "RawVolume.h" -%template(RawVolumeDensity8) PolyVox::RawVolume; - -%template(RawVolumeMaterial8) PolyVox::RawVolume; - -%template(RawVolumeMaterial16) PolyVox::RawVolume; - -%template(RawVolumeMaterialDensityPair44) PolyVox::RawVolume; - -%template(RawVolumeMaterialDensityPair88) PolyVox::RawVolume; +VOLUMETYPES(RawVolume, PolyVox::RawVolume) diff --git a/library/bindings/SimpleVolume.i b/library/bindings/SimpleVolume.i index dba2d247..35dfdde7 100644 --- a/library/bindings/SimpleVolume.i +++ b/library/bindings/SimpleVolume.i @@ -9,12 +9,4 @@ %include "Density.h" %include "SimpleVolume.h" -%template(SimpleVolumeDensity8) PolyVox::SimpleVolume; - -%template(SimpleVolumeMaterial8) PolyVox::SimpleVolume; - -%template(SimpleVolumeMaterial16) PolyVox::SimpleVolume; - -%template(SimpleVolumeMaterialDensityPair44) PolyVox::SimpleVolume; - -%template(SimpleVolumeMaterialDensityPair88) PolyVox::SimpleVolume; +VOLUMETYPES(SimpleVolume, PolyVox::SimpleVolume)