Merge branch 'develop' into feature/cmake-cxx11-detect
Conflicts: examples/Basic/CMakeLists.txt examples/OpenGL/CMakeLists.txt examples/Paging/CMakeLists.txt examples/SmoothLOD/CMakeLists.txt library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h
This commit is contained in:
8
library/bindings/BaseVolume.i
Normal file
8
library/bindings/BaseVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module SimpleVolume
|
||||
%{
|
||||
#include "BaseVolume.h"
|
||||
%}
|
||||
|
||||
%include "BaseVolume.h"
|
||||
|
||||
VOLUMETYPES(BaseVolume)
|
@ -1,13 +1,8 @@
|
||||
%module CubicSurfaceExtractor
|
||||
%{
|
||||
#include "SimpleVolume.h"
|
||||
#include "Array.h"
|
||||
#include "CubicSurfaceExtractor.h"
|
||||
%}
|
||||
|
||||
%include "SimpleVolume.h"
|
||||
%include "Array.h"
|
||||
%include "CubicSurfaceExtractor.h"
|
||||
|
||||
%template(CubicSurfaceExtractorMaterial8) PolyVox::CubicSurfaceExtractor<PolyVox::Material8>;
|
||||
%template(CubicSurfaceExtractorDensity8) PolyVox::CubicSurfaceExtractor<PolyVox::Density8>;
|
||||
EXTRACTORS(CubicSurfaceExtractor)
|
||||
|
@ -1,9 +0,0 @@
|
||||
%module Density
|
||||
%{
|
||||
#include "Density.h"
|
||||
%}
|
||||
|
||||
%include "MarchingCubesSurfaceExtractor.h"
|
||||
%include "Density.h"
|
||||
|
||||
%template(Density8) PolyVox::Density<uint8_t>;
|
8
library/bindings/LargeVolume.i
Normal file
8
library/bindings/LargeVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module LargeVolume
|
||||
%{
|
||||
#include "LargeVolume.h"
|
||||
%}
|
||||
|
||||
%include "LargeVolume.h"
|
||||
|
||||
VOLUMETYPES(LargeVolume)
|
@ -1,11 +1,8 @@
|
||||
%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> >;
|
||||
EXTRACTORS(MarchingCubesSurfaceExtractor)
|
||||
|
@ -1,10 +0,0 @@
|
||||
%module Material
|
||||
%{
|
||||
#include "Material.h"
|
||||
%}
|
||||
|
||||
%include "DefaultIsQuadNeeded.h"
|
||||
%include "Material.h"
|
||||
|
||||
%template(Material8) PolyVox::Material<uint8_t>;
|
||||
%template(Material16) PolyVox::Material<uint16_t>;
|
@ -1,9 +0,0 @@
|
||||
%module MaterialDensityPair
|
||||
%{
|
||||
#include "MaterialDensityPair.h"
|
||||
%}
|
||||
|
||||
%include "MaterialDensityPair.h"
|
||||
|
||||
%template(MaterialDensityPair44) PolyVox::MaterialDensityPair<uint8_t, 4, 4>;
|
||||
%template(MaterialDensityPair88) PolyVox::MaterialDensityPair<uint16_t, 8, 8>;
|
@ -25,28 +25,56 @@ 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(class)
|
||||
%template(class ## int8) PolyVox::class<int8_t>;
|
||||
%template(class ## int16) PolyVox::class<int16_t>;
|
||||
%template(class ## int32) PolyVox::class<int32_t>;
|
||||
%template(class ## uint8) PolyVox::class<uint8_t>;
|
||||
%template(class ## uint16) PolyVox::class<uint16_t>;
|
||||
%template(class ## uint32) PolyVox::class<uint32_t>;
|
||||
%template(class ## float) PolyVox::class<float>;
|
||||
%enddef
|
||||
|
||||
//Template based on voxel type
|
||||
%define EXTRACTOR(class, volumetype)
|
||||
%template(class ## volumetype ## int8) PolyVox::class<PolyVox::volumetype<int8_t> >;
|
||||
%template(class ## volumetype ## int16) PolyVox::class<PolyVox::volumetype<int16_t> >;
|
||||
%template(class ## volumetype ## int32) PolyVox::class<PolyVox::volumetype<int32_t> >;
|
||||
%template(class ## volumetype ## uint8) PolyVox::class<PolyVox::volumetype<uint8_t> >;
|
||||
%template(class ## volumetype ## uint16) PolyVox::class<PolyVox::volumetype<uint16_t> >;
|
||||
%template(class ## volumetype ## uint32) PolyVox::class<PolyVox::volumetype<uint32_t> >;
|
||||
%template(class ## volumetype ## float) PolyVox::class<PolyVox::volumetype<float> >;
|
||||
%enddef
|
||||
|
||||
//Template based on volume type
|
||||
%define EXTRACTORS(shortname)
|
||||
EXTRACTOR(shortname, SimpleVolume)
|
||||
EXTRACTOR(shortname, RawVolume)
|
||||
EXTRACTOR(shortname, LargeVolume)
|
||||
%enddef
|
||||
|
||||
%feature("autodoc", "1");
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
//This will rename "operator=" to "assign" since Python doesn't have assignment
|
||||
%rename(assign) *::operator=;
|
||||
#endif
|
||||
|
||||
%include "stdint.i"
|
||||
%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"
|
||||
//%include "TypeDef.i"
|
||||
%include "RawVolume.i"
|
||||
%include "LargeVolume.i"
|
||||
//%include "SubArray.i"
|
||||
//%include "Array.i"
|
||||
%include "VertexTypes.i"
|
||||
%include "SurfaceMesh.i"
|
||||
//%include "SimpleVolumeSampler.i"
|
||||
%include "MarchingCubesSurfaceExtractor.i"
|
||||
//%include "CubicSurfaceExtractor.i"
|
||||
//%include "CubicSurfaceExtractorWithNormals.i"
|
||||
//%include "MeshDecimator.i"
|
||||
|
||||
%include "Raycast.i"
|
||||
|
8
library/bindings/RawVolume.i
Normal file
8
library/bindings/RawVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module RawVolume
|
||||
%{
|
||||
#include "RawVolume.h"
|
||||
%}
|
||||
|
||||
%include "RawVolume.h"
|
||||
|
||||
VOLUMETYPES(RawVolume)
|
53
library/bindings/Raycast.i
Normal file
53
library/bindings/Raycast.i
Normal file
@ -0,0 +1,53 @@
|
||||
%module Raycast
|
||||
%{
|
||||
#include "Raycast.h"
|
||||
|
||||
template<typename VolumeType>
|
||||
class PyCallback
|
||||
{
|
||||
private:
|
||||
PyObject *func;
|
||||
PyCallback& operator=(const PyCallback&); // Not allowed
|
||||
public:
|
||||
PyCallback(const PyCallback& o) : func(o.func)
|
||||
{
|
||||
Py_XINCREF(func);
|
||||
}
|
||||
PyCallback(PyObject *func) : func(func)
|
||||
{
|
||||
Py_XINCREF(this->func);
|
||||
assert(PyCallable_Check(this->func));
|
||||
}
|
||||
~PyCallback()
|
||||
{
|
||||
Py_XDECREF(func);
|
||||
}
|
||||
bool operator()(const typename VolumeType::Sampler& sampler)
|
||||
{
|
||||
if (!func || Py_None == func || !PyCallable_Check(func))
|
||||
{
|
||||
return false; //Make this raise a Python exception
|
||||
}
|
||||
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);
|
||||
return (PyInt_AsLong(result) == 0) ? false : true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename VolumeType, typename Callback>
|
||||
PolyVox::RaycastResult raycastWithEndpointsPython(VolumeType* volData, const PolyVox::Vector3DFloat& v3dStart, const PolyVox::Vector3DFloat& v3dEnd, PyObject *callback)
|
||||
{
|
||||
PyCallback<VolumeType> newCallback(callback);
|
||||
return PolyVox::raycastWithEndpoints(volData, v3dStart, v3dEnd, newCallback);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%include "Raycast.h"
|
||||
|
||||
template<typename VolumeType, typename Callback>
|
||||
PolyVox::RaycastResult raycastWithEndpointsPython(VolumeType* volData, const PolyVox::Vector3DFloat& v3dStart, const PolyVox::Vector3DFloat& v3dEnd, PyObject *callback);
|
||||
|
||||
%template(raycastWithEndpointsSimpleVolumeuint8) raycastWithEndpointsPython<PolyVox::SimpleVolume<uint8_t>, PyCallback<PolyVox::SimpleVolume<uint8_t> > >;
|
@ -1,26 +1,8 @@
|
||||
%module SimpleVolume
|
||||
%{
|
||||
#include "Material.h"
|
||||
#include "Density.h"
|
||||
#include "SimpleVolume.h"
|
||||
%}
|
||||
|
||||
%import "BaseVolume.h"
|
||||
%include "Material.h"
|
||||
%include "Density.h"
|
||||
%include "SimpleVolume.h"
|
||||
|
||||
%template(BaseVolumeDensity8) PolyVox::BaseVolume<PolyVox::Density8>;
|
||||
%template(SimpleVolumeDensity8) PolyVox::SimpleVolume<PolyVox::Density8>;
|
||||
|
||||
%template(BaseVolumeMaterial8) PolyVox::BaseVolume<PolyVox::Material8>;
|
||||
%template(SimpleVolumeMaterial8) PolyVox::SimpleVolume<PolyVox::Material8>;
|
||||
|
||||
%template(BaseVolumeMaterial16) PolyVox::BaseVolume<PolyVox::Material16>;
|
||||
%template(SimpleVolumeMaterial16) PolyVox::SimpleVolume<PolyVox::Material16>;
|
||||
|
||||
%template(BaseVolumeMaterialDensityPair44) PolyVox::BaseVolume<PolyVox::MaterialDensityPair44>;
|
||||
%template(SimpleVolumeMaterialDensityPair44) PolyVox::SimpleVolume<PolyVox::MaterialDensityPair44>;
|
||||
|
||||
%template(BaseVolumeMaterialDensityPair88) PolyVox::BaseVolume<PolyVox::MaterialDensityPair88>;
|
||||
%template(SimpleVolumeMaterialDensityPair88) PolyVox::SimpleVolume<PolyVox::MaterialDensityPair88>;
|
||||
VOLUMETYPES(SimpleVolume)
|
||||
|
Reference in New Issue
Block a user