update assimp lib

This commit is contained in:
marauder2k7 2024-12-09 20:22:47 +00:00
parent 03a348deb7
commit d3f8fee74e
1725 changed files with 196314 additions and 62009 deletions

View file

@ -84,7 +84,7 @@ AndroidJNIIOSystem::~AndroidJNIIOSystem() {
bool AndroidJNIIOSystem::Exists( const char* pFile) const {
AAsset* asset = AAssetManager_open(mApkAssetManager, pFile, AASSET_MODE_UNKNOWN);
FILE* file = ::fopen( (mApkWorkspacePath + getOsSeparator() + std::string(pFile)).c_str(), "rb");
if (!asset && !file) {
__android_log_print(ANDROID_LOG_ERROR, "Assimp", "Asset manager can not find: %s", pFile);
return false;
@ -94,7 +94,7 @@ bool AndroidJNIIOSystem::Exists( const char* pFile) const {
if (file) {
::fclose( file);
}
return true;
}
@ -140,7 +140,7 @@ bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name) {
__android_log_print(ANDROID_LOG_DEFAULT, "Assimp", "Asset already extracted");
return true;
}
// Open file
AAsset* asset = AAssetManager_open(mApkAssetManager, name.c_str(),
AASSET_MODE_UNKNOWN);
@ -182,7 +182,7 @@ bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name) {
__android_log_print(ANDROID_LOG_ERROR, "assimp", "Asset not found: %s", name.c_str());
return false;
}
return true;
}

View file

@ -1 +1 @@
Please check the following git-repo for the source: https://github.com/kebby/assimp-net
Please check the following git-repo for the source: https://bitbucket.org/Starnick/assimpnet/

View file

@ -0,0 +1,17 @@
ISC License
Copyright 2024, pyassimp contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View file

@ -76,7 +76,7 @@ $ python setup.py install
```
PyAssimp requires a assimp dynamic library (`DLL` on windows,
`.so` on linux, `.dynlib` on macOS) in order to work. The default search directories are:
`.so` on linux, `.dylib` on macOS) in order to work. The default search directories are:
- the current directory
- on linux additionally: `/usr/lib`, `/usr/local/lib`,
`/usr/lib/x86_64-linux-gnu`

View file

@ -81,7 +81,7 @@ Install ``pyassimp`` by running:
$ python setup.py install
PyAssimp requires a assimp dynamic library (``DLL`` on windows, ``.so``
on linux, ``.dynlib`` on macOS) in order to work. The default search
on linux, ``.dylib`` on macOS) in order to work. The default search
directories are:
- the current directory

View file

@ -115,6 +115,10 @@ def _init(self, target = None, parent = None):
if m.startswith("_"):
continue
# We should not be accessing `mPrivate` according to structs.Scene.
if m == 'mPrivate':
continue
if m.startswith('mNum'):
if 'm' + m[4:] in dirself:
continue # will be processed later on
@ -211,7 +215,7 @@ def _init(self, target = None, parent = None):
else: # starts with 'm' but not iterable
setattr(target, m, obj)
setattr(target, name, obj)
logger.debug("Added " + name + " as self." + name + " (type: " + str(type(obj)) + ")")
if _is_init_type(obj):
@ -307,6 +311,7 @@ def load(filename,
Scene object with model data
'''
from ctypes import c_char_p
if hasattr(filename, 'read'):
# This is the case where a file object has been passed to load.
# It is calling the following function:
@ -320,7 +325,7 @@ def load(filename,
model = _assimp_lib.load_mem(data,
len(data),
processing,
file_type)
c_char_p(file_type.encode(sys.getfilesystemencoding())))
else:
# a filename string has been passed
model = _assimp_lib.load(filename.encode(sys.getfilesystemencoding()), processing)
@ -386,6 +391,19 @@ def export_blob(scene,
raise AssimpError('Could not export scene to blob!')
return exportBlobPtr
def available_formats():
"""
Return a list of file format extensions supported to import.
Returns
---------
A list of upper-case file extensions, e.g. [3DS, OBJ]
"""
from ctypes import byref
extension_list = structs.String()
_assimp_lib.dll.aiGetExtensionList(byref(extension_list))
return [e[2:].upper() for e in str(extension_list.data, sys.getfilesystemencoding()).split(";")]
def _finalize_texture(tex, target):
setattr(target, "achformathint", tex.achFormatHint)
if numpy:

View file

@ -1,41 +0,0 @@
FORMATS = ["CSM",
"LWS",
"B3D",
"COB",
"PLY",
"IFC",
"OFF",
"SMD",
"IRRMESH",
"3D",
"DAE",
"MDL",
"HMP",
"TER",
"WRL",
"XML",
"NFF",
"AC",
"OBJ",
"3DS",
"STL",
"IRR",
"Q3O",
"Q3D",
"MS3D",
"Q3S",
"ZGL",
"MD2",
"X",
"BLEND",
"XGL",
"MD5MESH",
"MAX",
"LXO",
"DXF",
"BVH",
"LWO",
"NDO"]
def available_formats():
return FORMATS

View file

@ -5,13 +5,17 @@ Some fancy helper functions.
"""
import os
import platform
import ctypes
import operator
from distutils.sysconfig import get_python_lib
import re
import sys
have_distutils = sys.version_info[0] < 3 and sys.version_info[1] < 12
if have_distutils:
from distutils.sysconfig import get_python_lib
try: import numpy
except ImportError: numpy = None
@ -32,10 +36,14 @@ if os.name=='posix':
if 'LD_LIBRARY_PATH' in os.environ:
additional_dirs.extend([item for item in os.environ['LD_LIBRARY_PATH'].split(':') if item])
if platform.system() == 'Darwin':
if 'DYLD_LIBRARY_PATH' in os.environ:
additional_dirs.extend([item for item in os.environ['DYLD_LIBRARY_PATH'].split(':') if item])
# check if running from anaconda.
anaconda_keywords = ("conda", "continuum")
if any(k in sys.version.lower() for k in anaconda_keywords):
if have_distutils and any(k in sys.version.lower() for k in anaconda_keywords):
cur_path = get_python_lib()
pattern = re.compile('.*\/lib\/')
conda_lib = pattern.match(cur_path).group()

View file

@ -270,7 +270,7 @@ aiProcess_SortByPType = 0x8000
# point primitives to separate meshes.
# <li>
# <li>Set the <tt>AI_CONFIG_PP_SBP_REMOVE<tt> option to
# @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES
# @code aiPrimitiveType_POINT | aiPrimitiveType_LINE
# @endcode to cause SortByPType to reject point
# and line meshes from the scene.
# <li>

View file

@ -1,6 +1,6 @@
#-*- coding: utf-8 -*-
from ctypes import POINTER, c_void_p, c_uint, c_char, c_float, Structure, c_double, c_ubyte, c_size_t, c_uint32
from ctypes import POINTER, c_void_p, c_uint, c_char, c_float, Structure, c_double, c_ubyte, c_size_t, c_uint32, c_int
class Vector2D(Structure):
@ -70,7 +70,7 @@ class String(Structure):
See 'types.h' for details.
"""
MAXLEN = 1024
AI_MAXLEN = 1024
_fields_ = [
# Binary length of the string excluding the terminal 0. This is NOT the
@ -78,8 +78,8 @@ class String(Structure):
# the number of bytes from the beginning of the string to its end.
("length", c_uint32),
# String buffer. Size limit is MAXLEN
("data", c_char*MAXLEN),
# String buffer. Size limit is AI_MAXLEN
("data", c_char*AI_MAXLEN),
]
class MaterialPropertyString(Structure):
@ -90,7 +90,7 @@ class MaterialPropertyString(Structure):
material property (see MaterialSystem.cpp aiMaterial::AddProperty() for details).
"""
MAXLEN = 1024
AI_MAXLEN = 1024
_fields_ = [
# Binary length of the string excluding the terminal 0. This is NOT the
@ -98,8 +98,8 @@ class MaterialPropertyString(Structure):
# the number of bytes from the beginning of the string to its end.
("length", c_uint32),
# String buffer. Size limit is MAXLEN
("data", c_char*MAXLEN),
# String buffer. Size limit is AI_MAXLEN
("data", c_char*AI_MAXLEN),
]
class MemoryInfo(Structure):
@ -748,18 +748,29 @@ class Mesh(Structure):
# - Vertex animations refer to meshes by their names.
("mName", String),
# The number of attachment meshes. Note! Currently only works with Collada loader.
# The number of attachment meshes.
# Currently known to work with loaders:
# - Collada
# - gltf
("mNumAnimMeshes", c_uint),
# Attachment meshes for this mesh, for vertex-based animation.
# Attachment meshes carry replacement data for some of the
# mesh'es vertex components (usually positions, normals).
# Note! Currently only works with Collada loader.
# Currently known to work with loaders:
# - Collada
# - gltf
("mAnimMeshes", POINTER(POINTER(AnimMesh))),
# Method of morphing when animeshes are specified.
("mMethod", c_uint),
# The bounding box.
("mAABB", 2 * Vector3D),
# Vertex UV stream names. Pointer to array of size AI_MAX_NUMBER_OF_TEXTURECOORDS
("mTextureCoordsNames", POINTER(POINTER(String)))
]
class Camera(Structure):
@ -999,6 +1010,54 @@ class Animation(Structure):
]
class SkeletonBone(Structure):
"""
See 'mesh.h' for details
"""
_fields_ = [
# The parent bone index, is -1 one if this bone represents the root bone.
("mParent", c_int),
# The number of weights
("mNumnWeights", c_uint),
# The mesh index, which will get influenced by the weight
("mMeshId", POINTER(Mesh)),
# The influence weights of this bone, by vertex index.
("mWeights", POINTER(VertexWeight)),
# Matrix that transforms from bone space to mesh space in bind pose.
#
# This matrix describes the position of the mesh
# in the local space of this bone when the skeleton was bound.
# Thus it can be used directly to determine a desired vertex position,
# given the world-space transform of the bone when animated,
# and the position of the vertex in mesh space.
#
# It is sometimes called an inverse-bind matrix,
# or inverse bind pose matrix
("mOffsetMatrix", Matrix4x4),
# Matrix that transforms the locale bone in bind pose.
("mLocalMatrix", Matrix4x4)
]
class Skeleton(Structure):
"""
See 'mesh.h' for details
"""
_fields_ = [
# Name
("mName", String),
# Number of bones
("mNumBones", c_uint),
# Bones
("mBones", POINTER(POINTER(SkeletonBone)))
]
class ExportDataBlob(Structure):
"""
See 'cexport.h' for details.
@ -1120,6 +1179,15 @@ class Scene(Structure):
# can be used to store format-specific metadata as well.
("mMetadata", POINTER(Metadata)),
# The name of the scene itself
("mName", String),
# Number of skeletons
("mNumSkeletons", c_uint),
# Skeletons
("mSkeletons", POINTER(POINTER(Skeleton))),
# Internal data, do not touch
("mPrivate", POINTER(c_char)),
]

View file

@ -466,8 +466,8 @@ class PyAssimp3DViewer:
try:
self.set_shaders_v130()
self.prepare_shaders()
except RuntimeError, message:
sys.stderr.write("%s\n" % message)
except RuntimeError as e:
sys.stderr.write("%s\n" % e.message)
sys.stdout.write("Could not compile shaders in version 1.30, trying version 1.20\n")
if not shader_compilation_succeeded:

View file

@ -8,7 +8,7 @@ def readme():
return f.read()
setup(name='pyassimp',
version='4.1.4',
version='5.2.5',
license='ISC',
description='Python bindings for the Open Asset Import Library (ASSIMP)',
long_description=readme(),

View file

@ -348,7 +348,7 @@ extern ( C ) {
* <li>Specify the <code>SortByPType</code> flag. This moves line and
* point primitives to separate meshes.</li>
* <li>Set the <code>AI_CONFIG_PP_SBP_REMOVE</codet> option to
* <code>aiPrimitiveType_POINTS | aiPrimitiveType_LINES</code>
* <code>aiPrimitiveType_POINT | aiPrimitiveType_LINE</code>
* to cause SortByPType to reject point and line meshes from the
* scene.</li>
* </ul>

View file

@ -1,7 +1,13 @@
# assimp for iOS
(deployment target 6.0+, 32/64bit)
Builds assimp libraries for several iOS CPU architectures at once, and outputs a fat binary from the result.
### Requirements
- cmake
- pkg-config
Note: all these packages can be installed with [brew](https://brew.sh)
Builds assimp libraries for several iOS CPU architectures at once, and outputs a fat binary / XCFramework from the result.
Run the **build.sh** script from the ```./port/iOS/``` directory. See **./build.sh --help** for information about command line options.
@ -15,11 +21,11 @@ shadeds-Mac:iOS arul$ ./build.sh --help
Example:
```bash
cd ./port/iOS/
./build.sh --stdlib=libc++ --archs="armv7 arm64 i386"
./build.sh --stdlib=libc++ --archs="arm64 x86_64" --no-fat --min-version="16.0"
```
Supported architectures/devices:
### Simulator
### Simulator [CPU Architectures](https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/)
- i386
- x86_64

View file

@ -60,23 +60,23 @@ build_arch()
unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS CMAKE_CLI_INPUT
export CC="$(xcrun -sdk iphoneos -find clang)"
export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export DEVROOT=$XCODE_ROOT_DIR/Platforms/$IOS_SDK_DEVICE.platform/Developer
export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET"
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -isysroot $SDKROOT -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET"
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
export CFLAGS="$CFLAGS -Og"
else
else
export CFLAGS="$CFLAGS -O3"
fi
fi
export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS -std=$CPP_STD"
rm CMakeCache.txt
CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS"
CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DASSIMP_BUILD_ZLIB=ON"
echo "[!] Running CMake with -G 'Unix Makefiles' $CMAKE_CLI_INPUT"
@ -102,6 +102,7 @@ CPP_STD_LIB=${CPP_STD_LIB_LIST[0]}
CPP_STD=${CPP_STD_LIST[0]}
DEPLOY_ARCHS=${BUILD_ARCHS_ALL[*]}
DEPLOY_FAT=1
DEPLOY_XCFramework=1
for i in "$@"; do
case $i in
@ -117,6 +118,11 @@ for i in "$@"; do
DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
echo "[!] Selecting architectures: $DEPLOY_ARCHS"
;;
--min-version=*)
MIN_IOS_VERSION=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
IOS_SDK_TARGET=$MIN_IOS_VERSION
echo "[!] Selecting minimum iOS version: $MIN_IOS_VERSION"
;;
--debug)
BUILD_TYPE=Debug
echo "[!] Selecting build type: Debug"
@ -129,11 +135,17 @@ for i in "$@"; do
DEPLOY_FAT=0
echo "[!] Fat binary will not be created."
;;
--no-xcframework)
DEPLOY_XCFramework=0
echo "[!] XCFramework will not be created."
;;
-h|--help)
echo " - don't build fat library (--no-fat)."
echo " - don't build XCFramework (--no-xcframework)."
echo " - Include debug information and symbols, no compiler optimizations (--debug)."
echo " - generate dynamic libraries rather than static ones (--shared-lib)."
echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')"
echo " - minimum iOS version (--min-version): 16.0"
echo " - supported C++ STD libs (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')"
echo " - supported C++ standards (--std): $(echo $(join , ${CPP_STD_LIST[*]}) | sed 's/,/, /g')"
exit
@ -147,7 +159,7 @@ cd ../../
rm -rf $BUILD_DIR
for ARCH_TARGET in $DEPLOY_ARCHS; do
echo "Creating folder: $BUILD_DIR/$ARCH_TARGET"
echo "Creating folder: $BUILD_DIR/$ARCH_TARGET"
mkdir -p $BUILD_DIR/$ARCH_TARGET
echo "Building for arc: $ARCH_TARGET"
build_arch $ARCH_TARGET
@ -157,8 +169,8 @@ done
make_fat_static_or_shared_binary()
{
LIB_NAME=$1
LIPO_ARGS=''
LIB_NAME=$1
LIPO_ARGS=''
for ARCH_TARGET in $DEPLOY_ARCHS; do
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.dylib "
@ -176,8 +188,8 @@ make_fat_static_or_shared_binary()
make_fat_static_binary()
{
LIB_NAME=$1
LIPO_ARGS=''
LIB_NAME=$1
LIPO_ARGS=''
for ARCH_TARGET in $DEPLOY_ARCHS; do
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a "
done
@ -190,16 +202,38 @@ if [[ "$DEPLOY_FAT" -eq 1 ]]; then
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
make_fat_static_or_shared_binary 'libassimpd'
make_fat_static_binary 'libIrrXMLd'
make_fat_static_binary 'libzlibstaticd'
else
make_fat_static_or_shared_binary 'libassimp'
make_fat_static_binary 'libIrrXML'
make_fat_static_binary 'libzlibstatic'
fi
echo "[!] Done! The fat binaries can be found at $BUILD_DIR"
fi
make_xcframework()
{
LIB_NAME=$1
FRAMEWORK_PATH=$BUILD_DIR/$LIB_NAME.xcframework
ARGS = ""
for ARCH_TARGET in $DEPLOY_ARCHS; do
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
ARGS="$ARGS -library $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.dylib -headers ./include "
else
ARGS="$ARGS -library $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a -headers ./include "
fi
done
xcodebuild -create-xcframework $ARGS -output $FRAMEWORK_PATH
}
if [[ "$DEPLOY_XCFramework" -eq 1 ]]; then
echo '[+] Creating XCFramework ...'
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
make_xcframework 'libassimpd'
else
make_xcframework 'libassimp'
fi
echo "[!] Done! The XCFramework can be found at $BUILD_DIR"
fi

View file

@ -558,13 +558,13 @@ class JavaIOSystem : public Assimp::IOSystem {
lprintf("NULL object from AiIOSystem.open\n");
return NULL;
}
size_t size = calli(mJniEnv, jStream, "jassimp/AiIOStream", "getFileSize", "()I");
lprintf("Model file size is %d\n", size);
char* buffer = (char*)malloc(size);
jobject javaBuffer = mJniEnv->NewDirectByteBuffer(buffer, size);
jvalue readParams[1];
readParams[0].l = javaBuffer;
if(call(mJniEnv, jStream, "jassimp/AiIOStream", "read", "(Ljava/nio/ByteBuffer;)Z", readParams))

View file

@ -349,7 +349,7 @@ public enum AiPostProcessSteps {
* <li>Specify the #SortByPType flag. This moves line and point
* primitives to separate meshes.
* <li>Set the <tt>AI_CONFIG_PP_SBP_REMOVE</tt> option to
* <code>aiPrimitiveType_POINTS | aiPrimitiveType_LINES</code>
* <code>aiPrimitiveType_POINT | aiPrimitiveType_LINE</code>
* to cause SortByPType to reject point and line meshes from the
* scene.
* </ul>

View file

@ -1 +0,0 @@
The interface files are by no means complete yet and only work with the not-yet-released D SWIG backend, although adding support for other languages should not be too much of problem via #ifdefs.

View file

@ -1,140 +0,0 @@
%module assimp
// SWIG helpers for std::string and std::vector wrapping.
%include <std_string.i>
%include <std_vector.i>
// Globally enable enum prefix stripping.
%dstripprefix;
// PACK_STRUCT is a no-op for SWIG it does not matter for the generated
// bindings how the underlying C++ code manages its memory.
#define PACK_STRUCT
// Helper macros for wrapping the pointer-and-length arrays used in the
// Assimp API.
%define ASSIMP_ARRAY(CLASS, TYPE, NAME, LENGTH)
%newobject CLASS::NAME;
%extend CLASS {
std::vector<TYPE > *NAME() const {
std::vector<TYPE > *result = new std::vector<TYPE >;
result->reserve(LENGTH);
for (unsigned int i = 0; i < LENGTH; ++i) {
result->push_back($self->NAME[i]);
}
return result;
}
}
%ignore CLASS::NAME;
%enddef
%define ASSIMP_POINTER_ARRAY(CLASS, TYPE, NAME, LENGTH)
%newobject CLASS::NAME;
%extend CLASS {
std::vector<TYPE *> *NAME() const {
std::vector<TYPE *> *result = new std::vector<TYPE *>;
result->reserve(LENGTH);
TYPE *currentValue = $self->NAME;
TYPE *valueLimit = $self->NAME + LENGTH;
while (currentValue < valueLimit) {
result->push_back(currentValue);
++currentValue;
}
return result;
}
}
%ignore CLASS::NAME;
%enddef
%define ASSIMP_POINTER_ARRAY_ARRAY(CLASS, TYPE, NAME, OUTER_LENGTH, INNER_LENGTH)
%newobject CLASS::NAME;
%extend CLASS {
std::vector<std::vector<TYPE *> > *NAME() const {
std::vector<std::vector<TYPE *> > *result = new std::vector<std::vector<TYPE *> >;
result->reserve(OUTER_LENGTH);
for (unsigned int i = 0; i < OUTER_LENGTH; ++i) {
std::vector<TYPE *> currentElements;
if ($self->NAME[i] != 0) {
currentElements.reserve(INNER_LENGTH);
TYPE *currentValue = $self->NAME[i];
TYPE *valueLimit = $self->NAME[i] + INNER_LENGTH;
while (currentValue < valueLimit) {
currentElements.push_back(currentValue);
++currentValue;
}
}
result->push_back(currentElements);
}
return result;
}
}
%ignore CLASS::NAME;
%enddef
%include "interface/aiDefines.i"
%include "interface/aiTypes.i"
%include "interface/assimp.i"
%include "interface/aiTexture.i"
%include "interface/aiMatrix4x4.i"
%include "interface/aiMatrix3x3.i"
%include "interface/aiVector3D.i"
%include "interface/aiVector2D.i"
%include "interface/aiColor4D.i"
%include "interface/aiLight.i"
%include "interface/aiCamera.i"
%include "interface/aiFileIO.i"
%include "interface/aiAssert.i"
%include "interface/aiVersion.i"
%include "interface/aiAnim.i"
%include "interface/aiMaterial.i"
%include "interface/aiMesh.i"
%include "interface/aiPostProcess.i"
%include "interface/aiConfig.i"
%include "interface/assimp.i"
%include "interface/aiQuaternion.i"
%include "interface/aiScene.i"
%include "interface/Logger.i"
%include "interface/DefaultLogger.i"
%include "interface/NullLogger.i"
%include "interface/LogStream.i"
%include "interface/IOStream.i"
%include "interface/IOSystem.i"
// We have to "instantiate" the templates used by the ASSSIMP_*_ARRAY macros
// here at the end to avoid running into forward reference issues (SWIG would
// spit out the helper functions before the header includes for the element
// types otherwise).
%template(UintVector) std::vector<unsigned int>;
%template(aiAnimationVector) std::vector<aiAnimation *>;
%template(aiAnimMeshVector) std::vector<aiAnimMesh *>;
%template(aiBonesVector) std::vector<aiBone *>;
%template(aiCameraVector) std::vector<aiCamera *>;
%template(aiColor4DVector) std::vector<aiColor4D *>;
%template(aiColor4DVectorVector) std::vector<std::vector<aiColor4D *> >;
%template(aiFaceVector) std::vector<aiFace *>;
%template(aiLightVector) std::vector<aiLight *>;
%template(aiMaterialVector) std::vector<aiMaterial *>;
%template(aiMaterialPropertyVector) std::vector<aiMaterialProperty *>;
%template(aiMeshAnimVector) std::vector<aiMeshAnim *>;
%template(aiMeshVector) std::vector<aiMesh *>;
%template(aiNodeVector) std::vector<aiNode *>;
%template(aiNodeAnimVector) std::vector<aiNodeAnim *>;
%template(aiTextureVector) std::vector<aiTexture *>;
%template(aiVector3DVector) std::vector<aiVector3D *>;
%template(aiVector3DVectorVector) std::vector<std::vector<aiVector3D *> >;
%template(aiVertexWeightVector) std::vector<aiVertexWeight *>;

View file

@ -1,2 +0,0 @@
#!/bin/sh
gcc -shared -fPIC -g3 -I../../../include/ -lassimp -olibassimp_wrap.so assimp_wrap.cxx

View file

@ -1,4 +0,0 @@
#!/bin/sh
rm -rf assimp/
mkdir assimp
swig -c++ -d -outcurrentdir -I../../../include -splitproxy -package assimp $@ ../assimp.i

View file

@ -1,5 +0,0 @@
%{
#include "DefaultLogger.h"
%}
%include "DefaultLogger.h"

View file

@ -1,5 +0,0 @@
%{
#include "IOStream.h"
%}
%include "IOStream.h"

View file

@ -1,11 +0,0 @@
%{
#include "IOSystem.h"
%}
// The const char* overload is used instead.
%ignore Assimp::IOSystem::Exists(const std::string&) const;
%ignore Assimp::IOSystem::Open(const std::string& pFile);
%ignore Assimp::IOSystem::Open(const std::string& pFile, const std::string& pMode);
%ignore Assimp::IOSystem::ComparePaths(const std::string& one, const std::string& second) const;
%include "IOSystem.h"

View file

@ -1,5 +0,0 @@
%{
#include "LogStream.h"
%}
%include "LogStream.h"

View file

@ -1,5 +0,0 @@
%{
#include "Logger.h"
%}
%include "Logger.h"

View file

@ -1,5 +0,0 @@
%{
#include "NullLogger.h"
%}
%include "NullLogger.h"

View file

@ -1,8 +0,0 @@
%{
#include "aiAnim.h"
%}
ASSIMP_ARRAY(aiAnimation, aiNodeAnim*, mChannels, $self->mNumChannels);
ASSIMP_ARRAY(aiAnimation, aiMeshAnim*, mMeshChannels, $self->mNumMeshChannels);
%include "aiAnim.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiAssert.h"
%}
%include "aiAssert.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiCamera.h"
%}
%include "aiCamera.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiColor4D.h"
%}
%include "aiColor4D.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiConfig.h"
%}
%include "aiConfig.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiDefines.h"
%}
%include "aiDefines.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiFileIO.h"
%}
%include "aiFileIO.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiLight.h"
%}
%include "aiLight.h"

View file

@ -1,33 +0,0 @@
%{
#include "aiMaterial.h"
%}
ASSIMP_ARRAY(aiMaterial, aiMaterialProperty*, mProperties, $self->mNumProperties)
%include <typemaps.i>
%apply enum SWIGTYPE *OUTPUT { aiTextureMapping* mapping };
%apply unsigned int *OUTPUT { unsigned int* uvindex };
%apply float *OUTPUT { float* blend };
%apply enum SWIGTYPE *OUTPUT { aiTextureOp* op };
%apply unsigned int *OUTPUT { unsigned int* flags };
%include "aiMaterial.h"
%clear unsigned int* flags;
%clear aiTextureOp* op;
%clear float *blend;
%clear unsigned int* uvindex;
%clear aiTextureMapping* mapping;
%apply int &OUTPUT { int &pOut };
%apply float &OUTPUT { float &pOut };
%template(GetInteger) aiMaterial::Get<int>;
%template(GetFloat) aiMaterial::Get<float>;
%template(GetColor4D) aiMaterial::Get<aiColor4D>;
%template(GetColor3D) aiMaterial::Get<aiColor3D>;
%template(GetString) aiMaterial::Get<aiString>;
%clear int &pOut;
%clear float &pOut;

View file

@ -1,5 +0,0 @@
%{
#include "aiMatrix3x3.h"
%}
%include "aiMatrix3x3.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiMatrix4x4.h"
%}
%include "aiMatrix4x4.h"

View file

@ -1,29 +0,0 @@
%{
#include "aiMesh.h"
%}
ASSIMP_ARRAY(aiFace, unsigned int, mIndices, $self->mNumIndices);
ASSIMP_POINTER_ARRAY(aiBone, aiVertexWeight, mWeights, $self->mNumWeights);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mVertices, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mNormals, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mTangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mBitangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY_ARRAY(aiAnimMesh, aiVector3D, mTextureCoords, AI_MAX_NUMBER_OF_TEXTURECOORDS, $self->mNumVertices);
ASSIMP_POINTER_ARRAY_ARRAY(aiAnimMesh, aiColor4D, mColors, AI_MAX_NUMBER_OF_COLOR_SETS, $self->mNumVertices);
ASSIMP_ARRAY(aiMesh, aiAnimMesh*, mAnimMeshes, $self->mNumAnimMeshes);
ASSIMP_ARRAY(aiMesh, aiBone*, mBones, $self->mNumBones);
ASSIMP_ARRAY(aiMesh, unsigned int, mNumUVComponents, AI_MAX_NUMBER_OF_TEXTURECOORDS);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mVertices, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mNormals, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mTangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mBitangents, $self->mNumVertices);
ASSIMP_POINTER_ARRAY(aiMesh, aiFace, mFaces, $self->mNumFaces);
ASSIMP_POINTER_ARRAY_ARRAY(aiMesh, aiVector3D, mTextureCoords, AI_MAX_NUMBER_OF_TEXTURECOORDS, $self->mNumVertices);
ASSIMP_POINTER_ARRAY_ARRAY(aiMesh, aiColor4D, mColors, AI_MAX_NUMBER_OF_COLOR_SETS, $self->mNumVertices);
%include "aiMesh.h"

View file

@ -1,7 +0,0 @@
%{
#include "aiPostProcess.h"
%}
%feature("d:stripprefix", "aiProcess_") aiPostProcessSteps;
%include "aiPostProcess.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiQuaternion.h"
%}
%include "aiQuaternion.h"

View file

@ -1,17 +0,0 @@
%{
#include "aiScene.h"
%}
ASSIMP_ARRAY(aiScene, aiAnimation*, mAnimations, $self->mNumAnimations);
ASSIMP_ARRAY(aiScene, aiCamera*, mCameras, $self->mNumCameras);
ASSIMP_ARRAY(aiScene, aiLight*, mLights, $self->mNumLights);
ASSIMP_ARRAY(aiScene, aiMaterial*, mMaterials, $self->mNumMaterials);
ASSIMP_ARRAY(aiScene, aiMesh*, mMeshes, $self->mNumMeshes);
ASSIMP_ARRAY(aiScene, aiTexture*, mTextures, $self->mNumTextures);
ASSIMP_ARRAY(aiNode, aiNode*, mChildren, $self->mNumChildren);
ASSIMP_ARRAY(aiNode, unsigned int, mMeshes, $self->mNumMeshes);
%include "aiScene.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiTexture.h"
%}
%include "aiTexture.h"

View file

@ -1,8 +0,0 @@
%{
#include "aiTypes.h"
%}
// The const char* overload is used instead.
%ignore aiString::Set(const std::string& pString);
%include "aiTypes.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiVector2D.h"
%}
%include "aiVector2D.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiVector3D.h"
%}
%include "aiVector3D.h"

View file

@ -1,5 +0,0 @@
%{
#include "aiVersion.h"
%}
%include "aiVersion.h"

View file

@ -1,45 +0,0 @@
%{
#include "assimp.hpp"
%}
namespace Assimp {
// See docs in assimp.hpp.
%ignore Importer::ReadFile(const std::string& pFile, unsigned int pFlags);
%ignore Importer::GetExtensionList(std::string& szOut);
%ignore Importer::IsExtensionSupported(const std::string& szExtension);
// These are only necessary for extending Assimp with custom importers or post
// processing steps, which would require wrapping the internal BaseImporter and
// BaseProcess classes.
%ignore Importer::RegisterLoader(BaseImporter* pImp);
%ignore Importer::UnregisterLoader(BaseImporter* pImp);
%ignore Importer::RegisterPPStep(BaseProcess* pImp);
%ignore Importer::UnregisterPPStep(BaseProcess* pImp);
%ignore Importer::FindLoader(const char* szExtension);
}
// Each aiScene has to keep a reference to the Importer to prevent it from
// being garbage collected, whose destructor would release the underlying
// C++ memory the scene is stored in.
%typemap(dcode) aiScene "package Object m_importer;"
%typemap(dout)
aiScene* GetScene,
aiScene* ReadFile,
aiScene* ApplyPostProcessing,
aiScene* ReadFileFromMemory {
void* cPtr = $wcall;
$dclassname ret = (cPtr is null) ? null : new $dclassname(cPtr, $owner);$excode
ret.m_importer = this;
return ret;
}
%include <typemaps.i>
%apply bool *OUTPUT { bool *bWasExisting };
%include "assimp.hpp"
%clear bool *bWasExisting;