From 79cc521666f550af2a5e6b71ee516b296b68a9fe Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Mon, 26 Nov 2012 13:58:51 +0000 Subject: [PATCH] Remove Density and Material tyes from bindings We now only have the bindings for (u)int{8,16,32}_t and float. This will hopefully simplify things. --- library/bindings/BaseVolume.i | 4 ---- library/bindings/Density.i | 9 --------- library/bindings/LargeVolume.i | 4 ---- library/bindings/Material.i | 10 ---------- library/bindings/MaterialDensityPair.i | 9 --------- library/bindings/PolyVoxCore.i | 27 +++++++++++++------------- library/bindings/RawVolume.i | 4 ---- library/bindings/Raycast.i | 5 ++--- library/bindings/SimpleVolume.i | 4 ---- tests/TestRaycast.py | 8 ++++---- tests/TestSurfaceExtractor.py | 6 +++--- 11 files changed, 23 insertions(+), 67 deletions(-) delete mode 100644 library/bindings/Density.i delete mode 100644 library/bindings/Material.i delete mode 100644 library/bindings/MaterialDensityPair.i diff --git a/library/bindings/BaseVolume.i b/library/bindings/BaseVolume.i index 4cdba718..e9afc1ba 100644 --- a/library/bindings/BaseVolume.i +++ b/library/bindings/BaseVolume.i @@ -1,12 +1,8 @@ %module SimpleVolume %{ -#include "Material.h" -#include "Density.h" #include "BaseVolume.h" %} -%include "Material.h" -%include "Density.h" %include "BaseVolume.h" VOLUMETYPES(BaseVolume) diff --git a/library/bindings/Density.i b/library/bindings/Density.i deleted file mode 100644 index 58819de3..00000000 --- a/library/bindings/Density.i +++ /dev/null @@ -1,9 +0,0 @@ -%module Density -%{ -#include "Density.h" -%} - -%include "MarchingCubesSurfaceExtractor.h" -%include "Density.h" - -%template(Density8) PolyVox::Density; diff --git a/library/bindings/LargeVolume.i b/library/bindings/LargeVolume.i index 58b80050..ec3ede58 100644 --- a/library/bindings/LargeVolume.i +++ b/library/bindings/LargeVolume.i @@ -1,12 +1,8 @@ %module LargeVolume %{ -#include "Material.h" -#include "Density.h" #include "LargeVolume.h" %} -%include "Material.h" -%include "Density.h" %include "LargeVolume.h" VOLUMETYPES(LargeVolume) diff --git a/library/bindings/Material.i b/library/bindings/Material.i deleted file mode 100644 index 413fc49f..00000000 --- a/library/bindings/Material.i +++ /dev/null @@ -1,10 +0,0 @@ -%module Material -%{ -#include "Material.h" -%} - -%include "DefaultIsQuadNeeded.h" -%include "Material.h" - -%template(Material8) PolyVox::Material; -%template(Material16) PolyVox::Material; diff --git a/library/bindings/MaterialDensityPair.i b/library/bindings/MaterialDensityPair.i deleted file mode 100644 index 6e7874f5..00000000 --- a/library/bindings/MaterialDensityPair.i +++ /dev/null @@ -1,9 +0,0 @@ -%module MaterialDensityPair -%{ -#include "MaterialDensityPair.h" -%} - -%include "MaterialDensityPair.h" - -%template(MaterialDensityPair44) PolyVox::MaterialDensityPair; -%template(MaterialDensityPair88) PolyVox::MaterialDensityPair; diff --git a/library/bindings/PolyVoxCore.i b/library/bindings/PolyVoxCore.i index 30ea5c65..c25aaf5e 100644 --- a/library/bindings/PolyVoxCore.i +++ b/library/bindings/PolyVoxCore.i @@ -27,20 +27,24 @@ const char* __str__() { //Centralise this to avoid repeating ourselves //This macro will be called in the volume interface files to define the various volume types. %define VOLUMETYPES(class) -%template(class ## Density8) PolyVox::class; -%template(class ## Material8) PolyVox::class; -%template(class ## Material16) PolyVox::class; -%template(class ## MaterialDensityPair44) PolyVox::class; -%template(class ## MaterialDensityPair88) PolyVox::class; +%template(class ## int8) PolyVox::class; +%template(class ## int16) PolyVox::class; +%template(class ## int32) PolyVox::class; +%template(class ## uint8) PolyVox::class; +%template(class ## uint16) PolyVox::class; +%template(class ## uint32) PolyVox::class; +%template(class ## float) PolyVox::class; %enddef //Template based on voxel type %define EXTRACTOR(class, volumetype) -%template(class ## volumetype ## Density8) PolyVox::class >; -//%template(class ## volumetype ## Material8) PolyVox::class >; -//%template(class ## volumetype ## Material16) PolyVox::class >; -%template(class ## volumetype ## MaterialDensityPair44) PolyVox::class >; -%template(class ## volumetype ## MaterialDensityPair88) PolyVox::class >; +%template(class ## volumetype ## int8) PolyVox::class >; +%template(class ## volumetype ## int16) PolyVox::class >; +%template(class ## volumetype ## int32) PolyVox::class >; +%template(class ## volumetype ## uint8) PolyVox::class >; +%template(class ## volumetype ## uint16) PolyVox::class >; +%template(class ## volumetype ## uint32) PolyVox::class >; +%template(class ## volumetype ## float) PolyVox::class >; %enddef //Template based on volume type @@ -61,9 +65,6 @@ EXTRACTOR(shortname, LargeVolume) %include "std_vector.i" %include "Vector.i" %include "DefaultMarchingCubesController.i" -%include "Density.i" -%include "Material.i" -%include "MaterialDensityPair.i" %include "Region.i" %include "BaseVolume.i" %include "SimpleVolume.i" diff --git a/library/bindings/RawVolume.i b/library/bindings/RawVolume.i index dbbd57da..c3cba2a7 100644 --- a/library/bindings/RawVolume.i +++ b/library/bindings/RawVolume.i @@ -1,12 +1,8 @@ %module RawVolume %{ -#include "Material.h" -#include "Density.h" #include "RawVolume.h" %} -%include "Material.h" -%include "Density.h" %include "RawVolume.h" VOLUMETYPES(RawVolume) diff --git a/library/bindings/Raycast.i b/library/bindings/Raycast.i index a3dc23f0..ed1869ca 100644 --- a/library/bindings/Raycast.i +++ b/library/bindings/Raycast.i @@ -28,7 +28,7 @@ public: { return false; //Make this raise a Python exception } - PyObject *args = Py_BuildValue("(l)", sampler.getVoxel().getDensity()); //TODO pass the sampler object itself in + PyObject *args = Py_BuildValue("(l)", sampler.getVoxel()); //TODO pass the sampler object itself in PyObject *result = PyObject_Call(func,args,0); Py_DECREF(args); Py_XDECREF(result); @@ -50,5 +50,4 @@ PolyVox::RaycastResult raycastWithEndpointsPython(VolumeType* volData, const Pol template PolyVox::RaycastResult raycastWithEndpointsPython(VolumeType* volData, const PolyVox::Vector3DFloat& v3dStart, const PolyVox::Vector3DFloat& v3dEnd, PyObject *callback); -%template(raycastWithEndpointsSimpleVolumeDensity8) raycastWithEndpointsPython, PyCallback > >; -//%template(raycastWithEndpointsSimpleVolumeMaterial8) raycastWithEndpointsPython, PyCallback > >; +%template(raycastWithEndpointsSimpleVolumeuint8) raycastWithEndpointsPython, PyCallback > >; diff --git a/library/bindings/SimpleVolume.i b/library/bindings/SimpleVolume.i index 249dd0c7..877ba1ed 100644 --- a/library/bindings/SimpleVolume.i +++ b/library/bindings/SimpleVolume.i @@ -1,12 +1,8 @@ %module SimpleVolume %{ -#include "Material.h" -#include "Density.h" #include "SimpleVolume.h" %} -%include "Material.h" -%include "Density.h" %include "SimpleVolume.h" VOLUMETYPES(SimpleVolume) diff --git a/tests/TestRaycast.py b/tests/TestRaycast.py index d68dad96..829654b1 100644 --- a/tests/TestRaycast.py +++ b/tests/TestRaycast.py @@ -14,15 +14,15 @@ class TestSurfaceExtractor(unittest.TestCase): #Create a small volume r = PolyVoxCore.Region(PolyVoxCore.Vector3DInt32(0,0,0), PolyVoxCore.Vector3DInt32(31,31,31)) - self.vol = PolyVoxCore.SimpleVolumeDensity8(r) + self.vol = PolyVoxCore.SimpleVolumeuint8(r) #Set one single voxel to have a reasonably high density - self.vol.setVoxelAt(PolyVoxCore.Vector3DInt32(5, 5, 5), PolyVoxCore.Density8(200)) + self.vol.setVoxelAt(PolyVoxCore.Vector3DInt32(5, 5, 5), 200) def test_hit_voxel(self): - self.assertEqual(PolyVoxCore.raycastWithEndpointsSimpleVolumeDensity8(self.vol, PolyVoxCore.Vector3DFloat(0,0,0), PolyVoxCore.Vector3DFloat(31,31,31), test_functor), 1) + self.assertEqual(PolyVoxCore.raycastWithEndpointsSimpleVolumeuint8(self.vol, PolyVoxCore.Vector3DFloat(0,0,0), PolyVoxCore.Vector3DFloat(31,31,31), test_functor), 1) def test_miss_voxel(self): - self.assertEqual(PolyVoxCore.raycastWithEndpointsSimpleVolumeDensity8(self.vol, PolyVoxCore.Vector3DFloat(0,0,0), PolyVoxCore.Vector3DFloat(0,31,31), test_functor), 0) + self.assertEqual(PolyVoxCore.raycastWithEndpointsSimpleVolumeuint8(self.vol, PolyVoxCore.Vector3DFloat(0,0,0), PolyVoxCore.Vector3DFloat(0,31,31), test_functor), 0) if __name__ == '__main__': unittest.main() diff --git a/tests/TestSurfaceExtractor.py b/tests/TestSurfaceExtractor.py index 1d8465ad..9ba40815 100644 --- a/tests/TestSurfaceExtractor.py +++ b/tests/TestSurfaceExtractor.py @@ -11,11 +11,11 @@ class TestSurfaceExtractor(unittest.TestCase): #Create a small volume r = PolyVoxCore.Region(PolyVoxCore.Vector3DInt32(0,0,0), PolyVoxCore.Vector3DInt32(31,31,31)) - vol = PolyVoxCore.SimpleVolumeDensity8(r) + vol = PolyVoxCore.SimpleVolumeuint8(r) #Set one single voxel to have a reasonably high density - vol.setVoxelAt(PolyVoxCore.Vector3DInt32(5, 5, 5), PolyVoxCore.Density8(200)) + vol.setVoxelAt(PolyVoxCore.Vector3DInt32(5, 5, 5), 200) self.mesh = PolyVoxCore.SurfaceMeshPositionMaterialNormal() - extractor = PolyVoxCore.MarchingCubesSurfaceExtractorSimpleVolumeDensity8(vol, r, self.mesh) + extractor = PolyVoxCore.MarchingCubesSurfaceExtractorSimpleVolumeuint8(vol, r, self.mesh) extractor.execute() def test_num_vertices(self):