Moved bindings from inside 'library' folder to root folder.
This commit is contained in:
10
bindings/Array.i
Normal file
10
bindings/Array.i
Normal file
@ -0,0 +1,10 @@
|
||||
%module Array
|
||||
%{
|
||||
#include "PolyVoxImpl\SubArray.h"
|
||||
#include "Array.h"
|
||||
%}
|
||||
|
||||
%include "PolyVoxImpl\SubArray.h"
|
||||
%include "Array.h"
|
||||
|
||||
%template(Array3IndexAndMaterial) PolyVox::Array<3, PolyVox::IndexAndMaterial>;
|
8
bindings/BaseVolume.i
Normal file
8
bindings/BaseVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module SimpleVolume
|
||||
%{
|
||||
#include "BaseVolume.h"
|
||||
%}
|
||||
|
||||
%include "BaseVolume.h"
|
||||
|
||||
VOLUMETYPES(BaseVolume)
|
9
bindings/Block.i
Normal file
9
bindings/Block.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module Block
|
||||
%{
|
||||
#include "Block.h"
|
||||
%}
|
||||
|
||||
%include "Block.h"
|
||||
|
||||
VOLUMETYPES(Block)
|
||||
|
8
bindings/BlockCompressor.i
Normal file
8
bindings/BlockCompressor.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module BlockCompressor
|
||||
%{
|
||||
#include "BlockCompressor.h"
|
||||
%}
|
||||
|
||||
%include "BlockCompressor.h"
|
||||
|
||||
VOLUMETYPES(BlockCompressor)
|
65
bindings/CMakeLists.txt
Normal file
65
bindings/CMakeLists.txt
Normal file
@ -0,0 +1,65 @@
|
||||
# Copyright (c) 2009-2013 Matt Williams
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
# arising from the use of this software.
|
||||
#
|
||||
# Permission is granted to anyone to use this software for any purpose,
|
||||
# including commercial applications, and to alter it and redistribute it
|
||||
# freely, subject to the following restrictions:
|
||||
#
|
||||
# 1. The origin of this software must not be misrepresented; you must not
|
||||
# claim that you wrote the original software. If you use this software
|
||||
# in a product, an acknowledgment in the product documentation would be
|
||||
# appreciated but is not required.
|
||||
#
|
||||
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||
# misrepresented as being the original software.
|
||||
#
|
||||
# 3. This notice may not be removed or altered from any source
|
||||
# distribution.
|
||||
|
||||
option(ENABLE_BINDINGS "Build bindings" OFF) #Off by default
|
||||
if(ENABLE_BINDINGS)
|
||||
find_package(SWIG)
|
||||
mark_as_advanced(SWIG_DIR SWIG_VERSION)
|
||||
find_package(PythonLibs 3)
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.6")
|
||||
set_package_info(SWIG "Bindings generator" http://www.swig.org)
|
||||
set_package_info(PythonLibs "Programming language" http://www.python.org)
|
||||
else()
|
||||
set_package_properties(SWIG PROPERTIES DESCRIPTION "Bindings generator" URL http://www.swig.org)
|
||||
set_package_properties(PythonLibs PROPERTIES DESCRIPTION "Programming language" URL http://www.python.org)
|
||||
endif()
|
||||
if(SWIG_FOUND)
|
||||
set(BUILD_BINDINGS ON CACHE BOOL "Will the bindings be built" FORCE)
|
||||
include(${SWIG_USE_FILE})
|
||||
|
||||
set(CMAKE_SWIG_FLAGS "")
|
||||
set_source_files_properties(PolyVoxCore.i PROPERTIES CPLUSPLUS ON)
|
||||
|
||||
include_directories(${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include/PolyVoxCore)
|
||||
if(PYTHONLIBS_FOUND)
|
||||
include_directories(${PYTHON_INCLUDE_PATH})
|
||||
link_directories(${PolyVoxCore_BINARY_DIR})
|
||||
|
||||
#set_source_files_properties(PolyVoxCore.i PROPERTIES SWIG_FLAGS "-builtin")
|
||||
set(SWIG_MODULE_PolyVoxCorePython_EXTRA_FLAGS "-py3")
|
||||
swig_add_module(PolyVoxCorePython python PolyVoxCore.i)
|
||||
swig_link_libraries(PolyVoxCorePython ${PYTHON_LIBRARIES} PolyVoxCore)
|
||||
set_target_properties(${SWIG_MODULE_PolyVoxCorePython_REAL_NAME} PROPERTIES OUTPUT_NAME _PolyVoxCore)
|
||||
#set_target_properties(${SWIG_MODULE_PolyVoxCore_REAL_NAME} PROPERTIES SUFFIX ".pyd")
|
||||
SET_PROPERTY(TARGET ${SWIG_MODULE_PolyVoxCorePython_REAL_NAME} PROPERTY FOLDER "Bindings")
|
||||
endif()
|
||||
|
||||
set(SWIG_MODULE_PolyVoxCoreCSharp_EXTRA_FLAGS "-dllimport;PolyVoxCoreCSharp") #This _should_ be inside UseSWIG.cmake - http://www.cmake.org/Bug/view.php?id=13814
|
||||
swig_add_module(PolyVoxCoreCSharp csharp PolyVoxCore.i)
|
||||
swig_link_libraries(PolyVoxCoreCSharp PolyVoxCore)
|
||||
SET_PROPERTY(TARGET ${SWIG_MODULE_PolyVoxCoreCSharp_REAL_NAME} PROPERTY FOLDER "Bindings")
|
||||
else()
|
||||
set(BUILD_BINDINGS OFF CACHE BOOL "Will the bindings be built" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set(BUILD_BINDINGS OFF CACHE BOOL "Will the bindings be built" FORCE)
|
||||
endif()
|
||||
mark_as_advanced(FORCE BUILD_BINDINGS)
|
9
bindings/Chunk.i
Normal file
9
bindings/Chunk.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module Chunk
|
||||
%{
|
||||
#include "Chunk.h"
|
||||
%}
|
||||
|
||||
%include "Chunk.h"
|
||||
|
||||
VOLUMETYPES(Chunk)
|
||||
|
1
bindings/CleanCSharpBindings.bat
Normal file
1
bindings/CleanCSharpBindings.bat
Normal file
@ -0,0 +1 @@
|
||||
del /f *.cs *.cxx
|
8
bindings/CompressedBlock.i
Normal file
8
bindings/CompressedBlock.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module CompressedBlock
|
||||
%{
|
||||
#include "CompressedBlock.h"
|
||||
%}
|
||||
|
||||
%include "CompressedBlock.h"
|
||||
|
||||
VOLUMETYPES(CompressedBlock)
|
9
bindings/CubicSurfaceExtractor.i
Normal file
9
bindings/CubicSurfaceExtractor.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module CubicSurfaceExtractor
|
||||
%{
|
||||
#include "CubicSurfaceExtractor.h"
|
||||
%}
|
||||
|
||||
%include "CubicSurfaceExtractor.h"
|
||||
|
||||
%template(extractCubicMeshSimpleVolumeuint8) extractCubicMesh<PolyVox::PagedVolume<uint8_t> >;
|
||||
//EXTRACTORS(CubicSurfaceExtractor)
|
8
bindings/CubicSurfaceExtractorWithNormals.i
Normal file
8
bindings/CubicSurfaceExtractorWithNormals.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module CubicSurfaceExtractorWithNormals
|
||||
%{
|
||||
#include "CubicSurfaceExtractorWithNormals.h"
|
||||
%}
|
||||
|
||||
%include "CubicSurfaceExtractorWithNormals.h"
|
||||
|
||||
%template(CubicSurfaceExtractorWithNormalsSimpleVolumeuint8) PolyVox::CubicSurfaceExtractorWithNormals<PolyVox::SimpleVolume<uint8_t>, PolyVox::DefaultIsQuadNeeded<uint8_t> >;
|
7
bindings/DefaultMarchingCubesController.i
Normal file
7
bindings/DefaultMarchingCubesController.i
Normal file
@ -0,0 +1,7 @@
|
||||
%module DefaultMarchingCubesController
|
||||
%{
|
||||
#include "DefaultMarchingCubesController.h"
|
||||
%}
|
||||
|
||||
%include "DefaultMarchingCubesController.h"
|
||||
|
6
bindings/FilePager.i
Normal file
6
bindings/FilePager.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module FilePager
|
||||
%{
|
||||
#include "FilePager.h"
|
||||
%}
|
||||
|
||||
%include "FilePager.h"
|
8
bindings/LargeVolume.i
Normal file
8
bindings/LargeVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module LargeVolume
|
||||
%{
|
||||
#include "LargeVolume.h"
|
||||
%}
|
||||
|
||||
%include "LargeVolume.h"
|
||||
|
||||
VOLUMETYPES(LargeVolume)
|
1
bindings/MakeCSharpBindings.bat
Normal file
1
bindings/MakeCSharpBindings.bat
Normal file
@ -0,0 +1 @@
|
||||
swig -csharp -namespace PolyVoxCore -c++ -I../PolyVoxCore/include PolyVoxCore.i
|
8
bindings/MarchingCubesSurfaceExtractor.i
Normal file
8
bindings/MarchingCubesSurfaceExtractor.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module MarchingCubesSurfaceExtractor
|
||||
%{
|
||||
#include "MarchingCubesSurfaceExtractor.h"
|
||||
%}
|
||||
|
||||
%include "MarchingCubesSurfaceExtractor.h"
|
||||
|
||||
EXTRACTORS(MarchingCubesSurfaceExtractor)
|
9
bindings/MeshDecimator.i
Normal file
9
bindings/MeshDecimator.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module MeshDecimator
|
||||
%{
|
||||
#include "MeshDecimator.h"
|
||||
%}
|
||||
|
||||
%include "MeshDecimator.h"
|
||||
|
||||
%template(MeshDecimatorMaterial8) PolyVox::MeshDecimator<PolyVox::Material8>;
|
||||
%template(MeshDecimatorDensity8) PolyVox::MeshDecimator<PolyVox::Density8>;
|
6
bindings/MinizBlockCompressor.i
Normal file
6
bindings/MinizBlockCompressor.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module MinizBlockCompressor
|
||||
%{
|
||||
#include "MinizBlockCompressor.h"
|
||||
%}
|
||||
|
||||
%include "MinizBlockCompressor.h"
|
50
bindings/PagedVolume.i
Normal file
50
bindings/PagedVolume.i
Normal file
@ -0,0 +1,50 @@
|
||||
%module PagedVolume
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_NESTED_CLASS
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
class PolyVox::PagedVolume_Chunk {
|
||||
public:
|
||||
PagedVolume_Chunk(Vector3DInt32 v3dPosition, uint16_t uSideLength, PolyVox::PagedVolume_Pager* pPager = nullptr);
|
||||
~PagedVolume_Chunk();
|
||||
|
||||
VoxelType* getData(void) const;
|
||||
uint32_t getDataSizeInBytes(void) const;
|
||||
|
||||
VoxelType getVoxel(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const;
|
||||
VoxelType getVoxel(const Vector3DUint16& v3dPos) const;
|
||||
|
||||
void setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue);
|
||||
void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue);
|
||||
};
|
||||
|
||||
class PolyVox::PagedVolume_Pager {
|
||||
public:
|
||||
/// Constructor
|
||||
PagedVolume_Pager() {};
|
||||
/// Destructor
|
||||
virtual ~PagedVolume_Pager() {};
|
||||
|
||||
virtual void pageIn(const Region& region, PagedVolume_Chunk* pChunk) = 0;
|
||||
virtual void pageOut(const Region& region, PagedVolume_Chunk* pChunk) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
%{
|
||||
#include "PagedVolume.h"
|
||||
%}
|
||||
|
||||
%include "PagedVolume.h"
|
||||
|
||||
%{
|
||||
namespace PolyVox
|
||||
{
|
||||
// SWIG thinks that Inner is a global class, so we need to trick the C++
|
||||
// compiler into understanding this so called global type.
|
||||
typedef PagedVolume<int8_t>::Pager PagedVolume_Pager;
|
||||
typedef PagedVolume<int8_t>::Chunk PagedVolume_Chunk;
|
||||
}
|
||||
%}
|
||||
|
||||
VOLUMETYPES(PagedVolume)
|
6
bindings/Pager.i
Normal file
6
bindings/Pager.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module Pager
|
||||
%{
|
||||
#include "Pager.h"
|
||||
%}
|
||||
|
||||
%include "Pager.h"
|
8
bindings/Picking.i
Normal file
8
bindings/Picking.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module Picking
|
||||
%{
|
||||
#include "Picking.h"
|
||||
%}
|
||||
|
||||
%include "Picking.h"
|
||||
|
||||
EXTRACTORS(pickVoxel)
|
93
bindings/PolyVoxCore.i
Normal file
93
bindings/PolyVoxCore.i
Normal file
@ -0,0 +1,93 @@
|
||||
%module PolyVoxCore
|
||||
|
||||
#define POLYVOX_API
|
||||
%include "Impl/TypeDef.h"
|
||||
#define __attribute__(x) //Silence DEPRECATED errors
|
||||
|
||||
//This macro allows us to use Python properties on our classes
|
||||
%define PROPERTY(type,name,getter,setter)
|
||||
%extend type {
|
||||
%pythoncode %{
|
||||
__swig_getmethods__["name"] = getter
|
||||
__swig_setmethods__["name"] = setter
|
||||
if _newclass: name = property(getter, setter)
|
||||
%}
|
||||
};
|
||||
%enddef
|
||||
|
||||
//Put this in an %extend section to wrap operator<< as __str__
|
||||
%define STR()
|
||||
const char* __str__() {
|
||||
std::ostringstream out;
|
||||
out << *$self;
|
||||
return out.str().c_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, PagedVolume)
|
||||
EXTRACTOR(shortname, RawVolume)
|
||||
%enddef
|
||||
|
||||
%feature("autodoc", "1");
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
//This will rename "operator=" to "assign" since Python doesn't have assignment
|
||||
%rename(assign) *::operator=;
|
||||
#endif
|
||||
#ifdef SWIGCSHARP
|
||||
//These operators are not wrappable in C# and their function is provided by other means
|
||||
%ignore *::operator=;
|
||||
%ignore *::operator+=;
|
||||
%ignore *::operator-=;
|
||||
%ignore *::operator*=;
|
||||
%ignore *::operator/=;
|
||||
%ignore *::operator<<; //This is covered by STR()
|
||||
#endif
|
||||
|
||||
%include "stdint.i"
|
||||
%include "std_vector.i"
|
||||
%include "Vector.i"
|
||||
%include "DefaultMarchingCubesController.i"
|
||||
%include "Region.i"
|
||||
//%include "Chunk.i"
|
||||
//%include "CompressedBlock.i"
|
||||
//%include "UncompressedBlock.i"
|
||||
//%include "BlockCompressor.i"
|
||||
//%include "Pager.i"
|
||||
//%include "FilePager.i"
|
||||
//%include "MinizBlockCompressor.i"
|
||||
//%include "RLEBlockCompressor.i"
|
||||
%include "BaseVolume.i"
|
||||
//%include "RawVolume.i"
|
||||
%include "PagedVolume.i"
|
||||
//%include "VertexTypes.i"
|
||||
//%include "SurfaceMesh.i"
|
||||
////%include "MarchingCubesSurfaceExtractor.i"
|
||||
////%include "CubicSurfaceExtractor.i"
|
||||
//%include "Raycast.i"
|
||||
//%include "Picking.i"
|
6
bindings/RLEBlockCompressor.i
Normal file
6
bindings/RLEBlockCompressor.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module RLEBlockCompressor
|
||||
%{
|
||||
#include "RLEBlockCompressor.h"
|
||||
%}
|
||||
|
||||
%include "RLEBlockCompressor.h"
|
8
bindings/RawVolume.i
Normal file
8
bindings/RawVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module RawVolume
|
||||
%{
|
||||
#include "RawVolume.h"
|
||||
%}
|
||||
|
||||
%include "RawVolume.h"
|
||||
|
||||
VOLUMETYPES(RawVolume)
|
61
bindings/Raycast.i
Normal file
61
bindings/Raycast.i
Normal file
@ -0,0 +1,61 @@
|
||||
%module Raycast
|
||||
%{
|
||||
#include "Raycast.h"
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%include "Raycast.h"
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
|
||||
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> > >;
|
||||
|
||||
#endif
|
16
bindings/Region.i
Normal file
16
bindings/Region.i
Normal file
@ -0,0 +1,16 @@
|
||||
%module Region
|
||||
%{
|
||||
#define SWIG_DAVID
|
||||
#include "Region.h"
|
||||
%}
|
||||
|
||||
%extend PolyVox::Region {
|
||||
STR()
|
||||
};
|
||||
|
||||
%ignore depth;
|
||||
%ignore height;
|
||||
%ignore width;
|
||||
%ignore dimensions;
|
||||
|
||||
%include "Region.h"
|
8
bindings/SimpleVolume.i
Normal file
8
bindings/SimpleVolume.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module SimpleVolume
|
||||
%{
|
||||
#include "SimpleVolume.h"
|
||||
%}
|
||||
|
||||
%include "SimpleVolume.h"
|
||||
|
||||
VOLUMETYPES(SimpleVolume)
|
9
bindings/SimpleVolumeSampler.i
Normal file
9
bindings/SimpleVolumeSampler.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module SimpleVolumeSampler
|
||||
%{
|
||||
#include "SimpleVolume.h"
|
||||
%}
|
||||
|
||||
%include "SimpleVolume.h"
|
||||
|
||||
%template(SimpleVolumeSamplerMaterial8) PolyVox::SimpleVolume::Sampler<PolyVox::Material8>;
|
||||
%template(SimpleVolumeSamplerDensity8) PolyVox::SimpleVolume::Sampler<PolyVox::Density8>;
|
9
bindings/SubArray.i
Normal file
9
bindings/SubArray.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module SubArray
|
||||
%{
|
||||
#include "PolyVoxImpl\SubArray.h"
|
||||
%}
|
||||
|
||||
%include "PolyVoxImpl\SubArray.h"
|
||||
|
||||
//%template(SubArray) PolyVox::SubArray<uint32_t, PolyVox::IndexAndMaterial>;
|
||||
//%template(SubArray) PolyVox::SubArray<uint32_t, PolyVox::IndexAndMaterial>;
|
20
bindings/SurfaceMesh.i
Normal file
20
bindings/SurfaceMesh.i
Normal file
@ -0,0 +1,20 @@
|
||||
%module SurfaceMesh
|
||||
%{
|
||||
#include "Region.h"
|
||||
#include "Vertex.h"
|
||||
#include "Mesh.h"
|
||||
%}
|
||||
|
||||
%include "Region.h"
|
||||
%include "Vertex.h"
|
||||
%include "Mesh.h"
|
||||
|
||||
//%template(VertexTypeVector) std::vector<PolyVox::VertexType>;
|
||||
//%template(PositionMaterialVector) std::vector<PolyVox::PositionMaterial>;
|
||||
//%template(PositionMaterialNormalVector) std::vector<PolyVox::PositionMaterialNormal>;
|
||||
//%template(LodRecordVector) std::vector<PolyVox::LodRecord>;
|
||||
//%template(uint8Vector) std::vector<uint8_t>;
|
||||
//%template(uint32Vector) std::vector<uint32_t>;
|
||||
|
||||
%template(MeshPositionMaterial) PolyVox::Mesh<PolyVox::CubicVertex<uint8_t>, uint16_t >;
|
||||
%template(MeshPositionMaterialNormal) PolyVox::Mesh<PolyVox::MarchingCubesVertex<uint8_t>, uint16_t >;
|
6
bindings/TypeDef.i
Normal file
6
bindings/TypeDef.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module TypeDef
|
||||
%{
|
||||
#include "PolyVoxImpl/TypeDef.h"
|
||||
%}
|
||||
|
||||
%include "PolyVoxImpl/TypeDef.h"
|
8
bindings/UncompressedBlock.i
Normal file
8
bindings/UncompressedBlock.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module UncompressedBlock
|
||||
%{
|
||||
#include "UncompressedBlock.h"
|
||||
%}
|
||||
|
||||
%include "UncompressedBlock.h"
|
||||
|
||||
VOLUMETYPES(UncompressedBlock)
|
121
bindings/Vector.i
Normal file
121
bindings/Vector.i
Normal file
@ -0,0 +1,121 @@
|
||||
%module Vector
|
||||
%{
|
||||
#include "Vector.h"
|
||||
#include <sstream>
|
||||
%}
|
||||
|
||||
%include "Vector.h"
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
PROPERTY(PolyVox::Vector, x, getX, setX)
|
||||
PROPERTY(PolyVox::Vector, y, getY, setY)
|
||||
PROPERTY(PolyVox::Vector, z, getZ, setZ)
|
||||
#endif
|
||||
|
||||
%rename(Plus) operator +;
|
||||
%rename(Minus) operator -;
|
||||
%rename(Multiply) operator *;
|
||||
%rename(Divide) operator /;
|
||||
%rename(Equal) operator ==;
|
||||
%rename(NotEqual) operator !=;
|
||||
|
||||
%extend PolyVox::Vector {
|
||||
#ifdef SWIGPYTHON
|
||||
PolyVox::Vector __add__(const PolyVox::Vector& rhs) {
|
||||
return *$self + rhs;
|
||||
}
|
||||
PolyVox::Vector __sub__(const PolyVox::Vector& rhs) {
|
||||
return *$self - rhs;
|
||||
}
|
||||
PolyVox::Vector __div__(const PolyVox::Vector& rhs) {
|
||||
return *$self / rhs;
|
||||
}
|
||||
PolyVox::Vector __div__(const StorageType& rhs) {
|
||||
return *$self / rhs;
|
||||
}
|
||||
PolyVox::Vector __mul__(const PolyVox::Vector& rhs) {
|
||||
return *$self * rhs;
|
||||
}
|
||||
PolyVox::Vector __mul__(const StorageType& rhs) {
|
||||
return *$self * rhs;
|
||||
}
|
||||
#endif
|
||||
STR()
|
||||
};
|
||||
|
||||
%feature("pythonprepend") PolyVox::Vector::operator< %{
|
||||
import warnings
|
||||
warnings.warn("deprecated", DeprecationWarning)
|
||||
%}
|
||||
|
||||
//%csattributes PolyVox::Vector::operator< "[System.Obsolete(\"deprecated\")]"
|
||||
|
||||
%define VECTOR3(StorageType,OperationType,ReducedStorageType)
|
||||
#if SWIGCSHARP
|
||||
%extend PolyVox::Vector<3,StorageType,OperationType> {
|
||||
PolyVox::Vector<3,StorageType,OperationType> operator+(const PolyVox::Vector<3,StorageType,OperationType>& rhs) {return *$self + rhs;}
|
||||
PolyVox::Vector<3,StorageType,OperationType> operator-(const PolyVox::Vector<3,StorageType,OperationType>& rhs) {return *$self - rhs;}
|
||||
PolyVox::Vector<3,StorageType,OperationType> operator*(const PolyVox::Vector<3,StorageType,OperationType>& rhs) {return *$self * rhs;}
|
||||
PolyVox::Vector<3,StorageType,OperationType> operator/(const PolyVox::Vector<3,StorageType,OperationType>& rhs) {return *$self / rhs;}
|
||||
PolyVox::Vector<3,StorageType,OperationType> operator*(const StorageType& rhs) {return *$self * rhs;}
|
||||
PolyVox::Vector<3,StorageType,OperationType> operator/(const StorageType& rhs) {return *$self / rhs;}
|
||||
};
|
||||
%typemap(cscode) PolyVox::Vector<3,StorageType,OperationType> %{
|
||||
public static Vector3D##StorageType operator+(Vector3D##StorageType lhs, Vector3D##StorageType rhs) {
|
||||
Vector3D##StorageType newVec = new Vector3D##StorageType();
|
||||
newVec = lhs.Plus(rhs);
|
||||
return newVec;
|
||||
}
|
||||
public static Vector3D##StorageType operator-(Vector3D##StorageType lhs, Vector3D##StorageType rhs) {
|
||||
Vector3D##StorageType newVec = new Vector3D##StorageType();
|
||||
newVec = lhs.Minus(rhs);
|
||||
return newVec;
|
||||
}
|
||||
public static Vector3D##StorageType operator*(Vector3D##StorageType lhs, Vector3D##StorageType rhs) {
|
||||
Vector3D##StorageType newVec = new Vector3D##StorageType();
|
||||
newVec = lhs.Multiply(rhs);
|
||||
return newVec;
|
||||
}
|
||||
public static Vector3D##StorageType operator/(Vector3D##StorageType lhs, Vector3D##StorageType rhs) {
|
||||
Vector3D##StorageType newVec = new Vector3D##StorageType();
|
||||
newVec = lhs.Divide(rhs);
|
||||
return newVec;
|
||||
}
|
||||
public static Vector3D##StorageType operator*(Vector3D##StorageType lhs, $typemap(cstype, StorageType) rhs) {
|
||||
Vector3D##StorageType newVec = new Vector3D##StorageType();
|
||||
newVec = lhs.Multiply(rhs);
|
||||
return newVec;
|
||||
}
|
||||
public static Vector3D##StorageType operator/(Vector3D##StorageType lhs, $typemap(cstype, StorageType) rhs) {
|
||||
Vector3D##StorageType newVec = new Vector3D##StorageType();
|
||||
newVec = lhs.Divide(rhs);
|
||||
return newVec;
|
||||
}
|
||||
public bool Equals(Vector3D##StorageType rhs) {
|
||||
if ((object)rhs == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Equal(rhs);
|
||||
}
|
||||
%}
|
||||
%ignore PolyVox::Vector<3,StorageType,OperationType>::operator<; //This is deprecated
|
||||
#endif
|
||||
%ignore PolyVox::Vector<3,StorageType,OperationType>::Vector(ReducedStorageType,ReducedStorageType,ReducedStorageType,ReducedStorageType);
|
||||
%ignore PolyVox::Vector<3,StorageType,OperationType>::Vector(ReducedStorageType,ReducedStorageType);
|
||||
%ignore PolyVox::Vector<3,StorageType,OperationType>::getW() const;
|
||||
%ignore PolyVox::Vector<3,StorageType,OperationType>::setW(ReducedStorageType);
|
||||
%ignore PolyVox::Vector<3,StorageType,OperationType>::setElements(ReducedStorageType,ReducedStorageType,ReducedStorageType,ReducedStorageType);
|
||||
%template(Vector3D ## StorageType) PolyVox::Vector<3,StorageType,OperationType>;
|
||||
%enddef
|
||||
|
||||
VECTOR3(float,float,float)
|
||||
VECTOR3(double,double,double)
|
||||
VECTOR3(int8_t,int32_t,signed char)
|
||||
VECTOR3(uint8_t,int32_t,unsigned char)
|
||||
VECTOR3(int16_t,int32_t,signed short)
|
||||
VECTOR3(uint16_t,int32_t,unsigned short)
|
||||
VECTOR3(int32_t,int32_t,signed int)
|
||||
VECTOR3(uint32_t,int32_t,unsigned int)
|
||||
|
||||
//%rename(assign) Vector3DFloat::operator=;
|
13
bindings/VertexTypes.i
Normal file
13
bindings/VertexTypes.i
Normal file
@ -0,0 +1,13 @@
|
||||
%module VertexTypes
|
||||
%{
|
||||
#include "Impl/TypeDef.h"
|
||||
#include "Vector.h"
|
||||
#include "Vertex.h"
|
||||
%}
|
||||
|
||||
%include "Impl/TypeDef.h"
|
||||
%include "Vector.h"
|
||||
%include "Vertex.h"
|
||||
|
||||
//%template (PositionMaterial) PolyVox::PositionMaterial;
|
||||
//%template (PositionMaterialNormal) PolyVox::PositionMaterialNormal;
|
Reference in New Issue
Block a user