From db81b925d776103326128bf629cbdda576a223e7 Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 16 Apr 2022 11:55:09 -0500 Subject: move 3rd-party librarys into libs/ and add built-in honeysuckle --- libs/assimp/port/AndroidJNI/AndroidJNIIOSystem.cpp | 210 +++ .../port/AndroidJNI/BundledAssetIOSystem.cpp | 80 + libs/assimp/port/AndroidJNI/CMakeLists.txt | 16 + libs/assimp/port/AndroidJNI/README.md | 32 + libs/assimp/port/AssimpDelphi/Readme.txt | 6 + libs/assimp/port/AssimpDelphi/aiColor4D.pas | 17 + libs/assimp/port/AssimpDelphi/aiMaterial.pas | 153 ++ libs/assimp/port/AssimpDelphi/aiMatrix3x3.pas | 16 + libs/assimp/port/AssimpDelphi/aiMatrix4x4.pas | 16 + libs/assimp/port/AssimpDelphi/aiMesh.pas | 71 + libs/assimp/port/AssimpDelphi/aiQuaternion.pas | 12 + libs/assimp/port/AssimpDelphi/aiScene.pas | 46 + libs/assimp/port/AssimpDelphi/aiTexture.pas | 26 + libs/assimp/port/AssimpDelphi/aiTypes.pas | 53 + libs/assimp/port/AssimpDelphi/aiVector2D.pas | 13 + libs/assimp/port/AssimpDelphi/aiVector3D.pas | 16 + libs/assimp/port/AssimpDelphi/assimp.pas | 58 + libs/assimp/port/AssimpNET/Readme.md | 1 + libs/assimp/port/AssimpPascal/Readme.md | 1 + libs/assimp/port/PyAssimp/3d_viewer_screenshot.png | Bin 0 -> 51610 bytes libs/assimp/port/PyAssimp/README.md | 86 + libs/assimp/port/PyAssimp/README.rst | 93 + libs/assimp/port/PyAssimp/gen/materialgen.py | 96 + libs/assimp/port/PyAssimp/gen/structsgen.py | 290 +++ libs/assimp/port/PyAssimp/pyassimp/__init__.py | 1 + libs/assimp/port/PyAssimp/pyassimp/core.py | 556 ++++++ libs/assimp/port/PyAssimp/pyassimp/errors.py | 11 + libs/assimp/port/PyAssimp/pyassimp/formats.py | 41 + libs/assimp/port/PyAssimp/pyassimp/helper.py | 283 +++ libs/assimp/port/PyAssimp/pyassimp/material.py | 89 + libs/assimp/port/PyAssimp/pyassimp/postprocess.py | 530 ++++++ libs/assimp/port/PyAssimp/pyassimp/structs.py | 1135 +++++++++++ libs/assimp/port/PyAssimp/scripts/3d_viewer.py | 1318 +++++++++++++ libs/assimp/port/PyAssimp/scripts/3d_viewer_py3.py | 1316 +++++++++++++ libs/assimp/port/PyAssimp/scripts/README.md | 13 + .../PyAssimp/scripts/fixed_pipeline_3d_viewer.py | 372 ++++ libs/assimp/port/PyAssimp/scripts/quicktest.py | 53 + libs/assimp/port/PyAssimp/scripts/sample.py | 89 + .../port/PyAssimp/scripts/transformations.py | 1705 +++++++++++++++++ libs/assimp/port/PyAssimp/setup.py | 26 + libs/assimp/port/assimp_rs/Cargo.lock | 6 + libs/assimp/port/assimp_rs/Cargo.toml | 9 + libs/assimp/port/assimp_rs/src/camera/mod.rs | 1 + libs/assimp/port/assimp_rs/src/core/mod.rs | 0 libs/assimp/port/assimp_rs/src/errors/mod.rs | 0 libs/assimp/port/assimp_rs/src/formats/mod.rs | 0 libs/assimp/port/assimp_rs/src/lib.rs | 17 + libs/assimp/port/assimp_rs/src/material/mod.rs | 0 libs/assimp/port/assimp_rs/src/postprocess/mod.rs | 0 libs/assimp/port/assimp_rs/src/shims/mod.rs | 0 libs/assimp/port/assimp_rs/src/socket/mod.rs | 0 .../assimp/port/assimp_rs/src/structs/anim/anim.rs | 44 + libs/assimp/port/assimp_rs/src/structs/anim/mod.rs | 6 + .../assimp/port/assimp_rs/src/structs/blob/blob.rs | 0 libs/assimp/port/assimp_rs/src/structs/blob/mod.rs | 2 + .../assimp/port/assimp_rs/src/structs/bone/bone.rs | 0 libs/assimp/port/assimp_rs/src/structs/bone/mod.rs | 2 + .../port/assimp_rs/src/structs/camera/camera.rs | 0 .../port/assimp_rs/src/structs/camera/mod.rs | 2 + .../port/assimp_rs/src/structs/color/color.rs | 27 + .../assimp/port/assimp_rs/src/structs/color/mod.rs | 5 + .../assimp/port/assimp_rs/src/structs/face/face.rs | 0 libs/assimp/port/assimp_rs/src/structs/face/mod.rs | 2 + libs/assimp/port/assimp_rs/src/structs/key/key.rs | 0 libs/assimp/port/assimp_rs/src/structs/key/mod.rs | 2 + .../port/assimp_rs/src/structs/light/light.rs | 0 .../assimp/port/assimp_rs/src/structs/light/mod.rs | 2 + .../assimp_rs/src/structs/material/material.rs | 0 .../port/assimp_rs/src/structs/material/mod.rs | 2 + .../port/assimp_rs/src/structs/matrix/matrix.rs | 64 + .../port/assimp_rs/src/structs/matrix/mod.rs | 4 + .../port/assimp_rs/src/structs/memory/memory.rs | 35 + .../port/assimp_rs/src/structs/memory/mod.rs | 2 + .../assimp/port/assimp_rs/src/structs/mesh/mesh.rs | 0 libs/assimp/port/assimp_rs/src/structs/mesh/mod.rs | 3 + .../assimp/port/assimp_rs/src/structs/meta/meta.rs | 0 libs/assimp/port/assimp_rs/src/structs/meta/mod.rs | 2 + libs/assimp/port/assimp_rs/src/structs/mod.rs | 61 + libs/assimp/port/assimp_rs/src/structs/node/mod.rs | 2 + .../assimp/port/assimp_rs/src/structs/node/node.rs | 0 .../assimp/port/assimp_rs/src/structs/plane/mod.rs | 2 + .../port/assimp_rs/src/structs/plane/plane.rs | 23 + .../port/assimp_rs/src/structs/quaternion/mod.rs | 3 + .../assimp_rs/src/structs/quaternion/quaternion.rs | 7 + libs/assimp/port/assimp_rs/src/structs/ray/mod.rs | 2 + libs/assimp/port/assimp_rs/src/structs/ray/ray.rs | 0 .../assimp/port/assimp_rs/src/structs/scene/mod.rs | 2 + .../port/assimp_rs/src/structs/scene/scene.rs | 0 .../port/assimp_rs/src/structs/string/mod.rs | 3 + .../port/assimp_rs/src/structs/string/string.rs | 41 + .../port/assimp_rs/src/structs/texture/mod.rs | 3 + .../port/assimp_rs/src/structs/texture/texture.rs | 19 + .../port/assimp_rs/src/structs/transform/mod.rs | 2 + .../assimp_rs/src/structs/transform/transform.rs | 0 libs/assimp/port/assimp_rs/src/structs/vec/mod.rs | 2 + libs/assimp/port/assimp_rs/src/structs/vec/vec.rs | 48 + .../port/assimp_rs/src/structs/vertex/mod.rs | 2 + .../port/assimp_rs/src/structs/vertex/vertex.rs | 0 libs/assimp/port/dAssimp/README | 13 + libs/assimp/port/dAssimp/assimp/animation.d | 240 +++ libs/assimp/port/dAssimp/assimp/api.d | 686 +++++++ libs/assimp/port/dAssimp/assimp/assimp.d | 63 + libs/assimp/port/dAssimp/assimp/camera.d | 182 ++ libs/assimp/port/dAssimp/assimp/config.d | 705 +++++++ libs/assimp/port/dAssimp/assimp/fileIO.d | 140 ++ libs/assimp/port/dAssimp/assimp/light.d | 215 +++ libs/assimp/port/dAssimp/assimp/loader.d | 193 ++ libs/assimp/port/dAssimp/assimp/material.d | 641 +++++++ libs/assimp/port/dAssimp/assimp/math.d | 155 ++ libs/assimp/port/dAssimp/assimp/mesh.d | 465 +++++ libs/assimp/port/dAssimp/assimp/postprocess.d | 597 ++++++ libs/assimp/port/dAssimp/assimp/scene.d | 306 +++ libs/assimp/port/dAssimp/assimp/texture.d | 122 ++ libs/assimp/port/dAssimp/assimp/types.d | 249 +++ libs/assimp/port/dAssimp/assimp/versionInfo.d | 72 + .../port/iOS/IPHONEOS_ARM64E_TOOLCHAIN.cmake | 17 + .../assimp/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake | 17 + .../assimp/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake | 17 + .../port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake | 17 + .../assimp/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake | 17 + libs/assimp/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake | 17 + .../port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake | 17 + libs/assimp/port/iOS/README.md | 39 + libs/assimp/port/iOS/build.sh | 205 ++ libs/assimp/port/jassimp/README | 56 + libs/assimp/port/jassimp/build.xml | 54 + libs/assimp/port/jassimp/jassimp-native/Android.mk | 13 + .../port/jassimp/jassimp-native/src/jassimp.cpp | 1995 ++++++++++++++++++++ .../port/jassimp/jassimp-native/src/jassimp.h | 47 + .../jassimp/src/jassimp/AiAnimBehavior.java | 112 ++ .../jassimp/jassimp/src/jassimp/AiAnimation.java | 175 ++ .../jassimp/jassimp/src/jassimp/AiBlendMode.java | 117 ++ .../port/jassimp/jassimp/src/jassimp/AiBone.java | 136 ++ .../jassimp/jassimp/src/jassimp/AiBoneWeight.java | 88 + .../src/jassimp/AiBuiltInWrapperProvider.java | 84 + .../port/jassimp/jassimp/src/jassimp/AiCamera.java | 303 +++ .../jassimp/src/jassimp/AiClassLoaderIOSystem.java | 153 ++ .../port/jassimp/jassimp/src/jassimp/AiColor.java | 160 ++ .../port/jassimp/jassimp/src/jassimp/AiConfig.java | 15 + .../jassimp/src/jassimp/AiConfigOptions.java | 663 +++++++ .../jassimp/jassimp/src/jassimp/AiIOStream.java | 80 + .../jassimp/jassimp/src/jassimp/AiIOSystem.java | 79 + .../jassimp/src/jassimp/AiInputStreamIOStream.java | 127 ++ .../port/jassimp/jassimp/src/jassimp/AiLight.java | 387 ++++ .../jassimp/jassimp/src/jassimp/AiLightType.java | 123 ++ .../jassimp/jassimp/src/jassimp/AiMaterial.java | 1199 ++++++++++++ .../jassimp/jassimp/src/jassimp/AiMatrix4f.java | 133 ++ .../port/jassimp/jassimp/src/jassimp/AiMesh.java | 1421 ++++++++++++++ .../jassimp/jassimp/src/jassimp/AiMeshAnim.java | 49 + .../jassimp/src/jassimp/AiMetadataEntry.java | 118 ++ .../port/jassimp/jassimp/src/jassimp/AiNode.java | 246 +++ .../jassimp/jassimp/src/jassimp/AiNodeAnim.java | 501 +++++ .../jassimp/src/jassimp/AiPostProcessSteps.java | 571 ++++++ .../jassimp/src/jassimp/AiPrimitiveType.java | 113 ++ .../jassimp/src/jassimp/AiProgressHandler.java | 46 + .../jassimp/jassimp/src/jassimp/AiQuaternion.java | 165 ++ .../port/jassimp/jassimp/src/jassimp/AiScene.java | 251 +++ .../jassimp/jassimp/src/jassimp/AiSceneFlag.java | 151 ++ .../jassimp/jassimp/src/jassimp/AiShadingMode.java | 168 ++ .../jassimp/jassimp/src/jassimp/AiTextureInfo.java | 224 +++ .../jassimp/src/jassimp/AiTextureMapMode.java | 113 ++ .../jassimp/src/jassimp/AiTextureMapping.java | 78 + .../jassimp/jassimp/src/jassimp/AiTextureOp.java | 137 ++ .../jassimp/jassimp/src/jassimp/AiTextureType.java | 218 +++ .../port/jassimp/jassimp/src/jassimp/AiVector.java | 195 ++ .../jassimp/src/jassimp/AiWrapperProvider.java | 149 ++ .../port/jassimp/jassimp/src/jassimp/JaiDebug.java | 209 ++ .../port/jassimp/jassimp/src/jassimp/Jassimp.java | 402 ++++ .../jassimp/jassimp/src/jassimp/JassimpConfig.java | 66 + .../jassimp/src/jassimp/JassimpLibraryLoader.java | 65 + .../jassimp/jassimp/src/jassimp/package-info.java | 45 + libs/assimp/port/swig/DONOTUSEYET | 1 + libs/assimp/port/swig/assimp.i | 140 ++ libs/assimp/port/swig/d/build.sh | 2 + libs/assimp/port/swig/d/generate.sh | 4 + libs/assimp/port/swig/interface/DefaultLogger.i | 5 + libs/assimp/port/swig/interface/IOStream.i | 5 + libs/assimp/port/swig/interface/IOSystem.i | 11 + libs/assimp/port/swig/interface/LogStream.i | 5 + libs/assimp/port/swig/interface/Logger.i | 5 + libs/assimp/port/swig/interface/NullLogger.i | 5 + libs/assimp/port/swig/interface/aiAnim.i | 8 + libs/assimp/port/swig/interface/aiAssert.i | 5 + libs/assimp/port/swig/interface/aiCamera.i | 5 + libs/assimp/port/swig/interface/aiColor4D.i | 5 + libs/assimp/port/swig/interface/aiConfig.i | 5 + libs/assimp/port/swig/interface/aiDefines.i | 5 + libs/assimp/port/swig/interface/aiFileIO.i | 5 + libs/assimp/port/swig/interface/aiLight.i | 5 + libs/assimp/port/swig/interface/aiMaterial.i | 33 + libs/assimp/port/swig/interface/aiMatrix3x3.i | 5 + libs/assimp/port/swig/interface/aiMatrix4x4.i | 5 + libs/assimp/port/swig/interface/aiMesh.i | 29 + libs/assimp/port/swig/interface/aiPostProcess.i | 7 + libs/assimp/port/swig/interface/aiQuaternion.i | 5 + libs/assimp/port/swig/interface/aiScene.i | 17 + libs/assimp/port/swig/interface/aiTexture.i | 5 + libs/assimp/port/swig/interface/aiTypes.i | 8 + libs/assimp/port/swig/interface/aiVector2D.i | 5 + libs/assimp/port/swig/interface/aiVector3D.i | 5 + libs/assimp/port/swig/interface/aiVersion.i | 5 + libs/assimp/port/swig/interface/assimp.i | 45 + 202 files changed, 27214 insertions(+) create mode 100644 libs/assimp/port/AndroidJNI/AndroidJNIIOSystem.cpp create mode 100644 libs/assimp/port/AndroidJNI/BundledAssetIOSystem.cpp create mode 100644 libs/assimp/port/AndroidJNI/CMakeLists.txt create mode 100644 libs/assimp/port/AndroidJNI/README.md create mode 100644 libs/assimp/port/AssimpDelphi/Readme.txt create mode 100644 libs/assimp/port/AssimpDelphi/aiColor4D.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiMaterial.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiMatrix3x3.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiMatrix4x4.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiMesh.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiQuaternion.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiScene.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiTexture.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiTypes.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiVector2D.pas create mode 100644 libs/assimp/port/AssimpDelphi/aiVector3D.pas create mode 100644 libs/assimp/port/AssimpDelphi/assimp.pas create mode 100644 libs/assimp/port/AssimpNET/Readme.md create mode 100644 libs/assimp/port/AssimpPascal/Readme.md create mode 100644 libs/assimp/port/PyAssimp/3d_viewer_screenshot.png create mode 100644 libs/assimp/port/PyAssimp/README.md create mode 100644 libs/assimp/port/PyAssimp/README.rst create mode 100644 libs/assimp/port/PyAssimp/gen/materialgen.py create mode 100644 libs/assimp/port/PyAssimp/gen/structsgen.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/__init__.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/core.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/errors.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/formats.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/helper.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/material.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/postprocess.py create mode 100644 libs/assimp/port/PyAssimp/pyassimp/structs.py create mode 100755 libs/assimp/port/PyAssimp/scripts/3d_viewer.py create mode 100755 libs/assimp/port/PyAssimp/scripts/3d_viewer_py3.py create mode 100644 libs/assimp/port/PyAssimp/scripts/README.md create mode 100755 libs/assimp/port/PyAssimp/scripts/fixed_pipeline_3d_viewer.py create mode 100755 libs/assimp/port/PyAssimp/scripts/quicktest.py create mode 100755 libs/assimp/port/PyAssimp/scripts/sample.py create mode 100644 libs/assimp/port/PyAssimp/scripts/transformations.py create mode 100644 libs/assimp/port/PyAssimp/setup.py create mode 100644 libs/assimp/port/assimp_rs/Cargo.lock create mode 100644 libs/assimp/port/assimp_rs/Cargo.toml create mode 100644 libs/assimp/port/assimp_rs/src/camera/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/core/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/errors/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/formats/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/lib.rs create mode 100644 libs/assimp/port/assimp_rs/src/material/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/postprocess/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/shims/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/socket/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/anim/anim.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/anim/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/blob/blob.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/blob/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/bone/bone.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/bone/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/camera/camera.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/camera/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/color/color.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/color/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/face/face.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/face/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/key/key.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/key/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/light/light.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/light/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/material/material.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/material/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/matrix/matrix.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/matrix/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/memory/memory.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/memory/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/mesh/mesh.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/mesh/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/meta/meta.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/meta/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/node/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/node/node.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/plane/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/plane/plane.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/quaternion/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/quaternion/quaternion.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/ray/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/ray/ray.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/scene/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/scene/scene.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/string/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/string/string.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/texture/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/texture/texture.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/transform/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/transform/transform.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/vec/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/vec/vec.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/vertex/mod.rs create mode 100644 libs/assimp/port/assimp_rs/src/structs/vertex/vertex.rs create mode 100644 libs/assimp/port/dAssimp/README create mode 100644 libs/assimp/port/dAssimp/assimp/animation.d create mode 100644 libs/assimp/port/dAssimp/assimp/api.d create mode 100644 libs/assimp/port/dAssimp/assimp/assimp.d create mode 100644 libs/assimp/port/dAssimp/assimp/camera.d create mode 100644 libs/assimp/port/dAssimp/assimp/config.d create mode 100644 libs/assimp/port/dAssimp/assimp/fileIO.d create mode 100644 libs/assimp/port/dAssimp/assimp/light.d create mode 100644 libs/assimp/port/dAssimp/assimp/loader.d create mode 100644 libs/assimp/port/dAssimp/assimp/material.d create mode 100644 libs/assimp/port/dAssimp/assimp/math.d create mode 100644 libs/assimp/port/dAssimp/assimp/mesh.d create mode 100644 libs/assimp/port/dAssimp/assimp/postprocess.d create mode 100644 libs/assimp/port/dAssimp/assimp/scene.d create mode 100644 libs/assimp/port/dAssimp/assimp/texture.d create mode 100644 libs/assimp/port/dAssimp/assimp/types.d create mode 100644 libs/assimp/port/dAssimp/assimp/versionInfo.d create mode 100644 libs/assimp/port/iOS/IPHONEOS_ARM64E_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/IPHONEOS_ARMV6_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/IPHONEOS_ARMV7S_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/IPHONEOS_ARMV7_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/IPHONEOS_I386_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/IPHONEOS_X86_64_TOOLCHAIN.cmake create mode 100644 libs/assimp/port/iOS/README.md create mode 100755 libs/assimp/port/iOS/build.sh create mode 100644 libs/assimp/port/jassimp/README create mode 100644 libs/assimp/port/jassimp/build.xml create mode 100644 libs/assimp/port/jassimp/jassimp-native/Android.mk create mode 100644 libs/assimp/port/jassimp/jassimp-native/src/jassimp.cpp create mode 100644 libs/assimp/port/jassimp/jassimp-native/src/jassimp.h create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiAnimBehavior.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiAnimation.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiBlendMode.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiBone.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiBoneWeight.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiBuiltInWrapperProvider.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiCamera.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiClassLoaderIOSystem.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiColor.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiConfig.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiConfigOptions.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiIOStream.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiIOSystem.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiInputStreamIOStream.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiLight.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiLightType.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiMaterial.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiMatrix4f.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiMesh.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiMeshAnim.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiMetadataEntry.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiNode.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiNodeAnim.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiPostProcessSteps.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiPrimitiveType.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiProgressHandler.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiQuaternion.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiScene.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiSceneFlag.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiShadingMode.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiTextureInfo.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiTextureMapMode.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiTextureMapping.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiTextureOp.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiTextureType.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiVector.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/AiWrapperProvider.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/JaiDebug.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/Jassimp.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/JassimpConfig.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/JassimpLibraryLoader.java create mode 100644 libs/assimp/port/jassimp/jassimp/src/jassimp/package-info.java create mode 100644 libs/assimp/port/swig/DONOTUSEYET create mode 100644 libs/assimp/port/swig/assimp.i create mode 100755 libs/assimp/port/swig/d/build.sh create mode 100755 libs/assimp/port/swig/d/generate.sh create mode 100644 libs/assimp/port/swig/interface/DefaultLogger.i create mode 100644 libs/assimp/port/swig/interface/IOStream.i create mode 100644 libs/assimp/port/swig/interface/IOSystem.i create mode 100644 libs/assimp/port/swig/interface/LogStream.i create mode 100644 libs/assimp/port/swig/interface/Logger.i create mode 100644 libs/assimp/port/swig/interface/NullLogger.i create mode 100644 libs/assimp/port/swig/interface/aiAnim.i create mode 100644 libs/assimp/port/swig/interface/aiAssert.i create mode 100644 libs/assimp/port/swig/interface/aiCamera.i create mode 100644 libs/assimp/port/swig/interface/aiColor4D.i create mode 100644 libs/assimp/port/swig/interface/aiConfig.i create mode 100644 libs/assimp/port/swig/interface/aiDefines.i create mode 100644 libs/assimp/port/swig/interface/aiFileIO.i create mode 100644 libs/assimp/port/swig/interface/aiLight.i create mode 100644 libs/assimp/port/swig/interface/aiMaterial.i create mode 100644 libs/assimp/port/swig/interface/aiMatrix3x3.i create mode 100644 libs/assimp/port/swig/interface/aiMatrix4x4.i create mode 100644 libs/assimp/port/swig/interface/aiMesh.i create mode 100644 libs/assimp/port/swig/interface/aiPostProcess.i create mode 100644 libs/assimp/port/swig/interface/aiQuaternion.i create mode 100644 libs/assimp/port/swig/interface/aiScene.i create mode 100644 libs/assimp/port/swig/interface/aiTexture.i create mode 100644 libs/assimp/port/swig/interface/aiTypes.i create mode 100644 libs/assimp/port/swig/interface/aiVector2D.i create mode 100644 libs/assimp/port/swig/interface/aiVector3D.i create mode 100644 libs/assimp/port/swig/interface/aiVersion.i create mode 100644 libs/assimp/port/swig/interface/assimp.i (limited to 'libs/assimp/port') diff --git a/libs/assimp/port/AndroidJNI/AndroidJNIIOSystem.cpp b/libs/assimp/port/AndroidJNI/AndroidJNIIOSystem.cpp new file mode 100644 index 0000000..e0f8123 --- /dev/null +++ b/libs/assimp/port/AndroidJNI/AndroidJNIIOSystem.cpp @@ -0,0 +1,210 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2021, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ + +/** @file Android extension of DefaultIOSystem using the standard C file functions */ + + +#include +#include +#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace Assimp; + +// ------------------------------------------------------------------------------------------------ +// Constructor. +AndroidJNIIOSystem::AndroidJNIIOSystem(ANativeActivity* activity) +{ + AndroidActivityInit(activity); +} + +AndroidJNIIOSystem::AndroidJNIIOSystem(const char *internalPath, AAssetManager* assetManager) : + mApkWorkspacePath(internalPath), + mApkAssetManager(assetManager) { + // empty +} + +// ------------------------------------------------------------------------------------------------ +// Destructor. +AndroidJNIIOSystem::~AndroidJNIIOSystem() { + // nothing to do here +} + +// ------------------------------------------------------------------------------------------------ +// Tests for the existence of a file at the given path. +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; + } + + __android_log_print(ANDROID_LOG_ERROR, "Assimp", "Asset exists"); + if (file) { + ::fclose( file); + } + + return true; +} + +// ------------------------------------------------------------------------------------------------ +// Inits Android extractor +void AndroidJNIIOSystem::AndroidActivityInit(ANativeActivity* activity) { + if (activity == nullptr) { + return; + } + mApkWorkspacePath = activity->internalDataPath; + mApkAssetManager = activity->assetManager; +} + +// ------------------------------------------------------------------------------------------------ +// Create the directory for the extracted resource +static int mkpath(std::string path, mode_t mode) { + if (mkdir(path.c_str(), mode) == -1) { + switch(errno) { + case ENOENT: + if (mkpath(path.substr(0, path.find_last_of('/')), mode) == -1) + return -1; + else + return mkdir(path.c_str(), mode); + case EEXIST: + return 0; + default: + return -1; + } + } + + return 0; +} + +// ------------------------------------------------------------------------------------------------ +// Extracts android asset +bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name) { + std::string newPath = mApkWorkspacePath + getOsSeparator() + name; + + DefaultIOSystem io; + + // Do not extract if extracted already + if ( io.Exists(newPath.c_str()) ) { + __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); + std::vector assetContent; + + if (asset != NULL) { + // Find size + off_t assetSize = AAsset_getLength(asset); + + // Prepare input buffer + assetContent.resize(assetSize); + + // Store input buffer + AAsset_read(asset, &assetContent[0], assetSize); + + // Close + AAsset_close(asset); + + // Prepare directory for output buffer + std::string directoryNewPath = newPath; + directoryNewPath = dirname(&directoryNewPath[0]); + + if (mkpath(directoryNewPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1) { + __android_log_print(ANDROID_LOG_ERROR, "assimp", "Can not create the directory for the output file"); + } + + // Prepare output buffer + std::ofstream assetExtracted(newPath.c_str(), std::ios::out | std::ios::binary); + if (!assetExtracted) { + __android_log_print(ANDROID_LOG_ERROR, "assimp", "Can not open output file"); + } + + // Write output buffer into a file + assetExtracted.write(&assetContent[0], assetContent.size()); + assetExtracted.close(); + + __android_log_print(ANDROID_LOG_DEFAULT, "Assimp", "Asset extracted"); + } else { + __android_log_print(ANDROID_LOG_ERROR, "assimp", "Asset not found: %s", name.c_str()); + return false; + } + + return true; +} + +// ------------------------------------------------------------------------------------------------ +// Open a new file with a given path. +IOStream* AndroidJNIIOSystem::Open( const char* strFile, const char* strMode) { + ai_assert(nullptr != strFile); + ai_assert(nullptr != strMode); + + std::string fullPath(mApkWorkspacePath + getOsSeparator() + std::string(strFile)); + if (Exists(strFile)) { + AndroidExtractAsset(std::string(strFile)); + } + + FILE* file = ::fopen( fullPath.c_str(), strMode); + if (nullptr == file) { + return nullptr; + } + + __android_log_print(ANDROID_LOG_ERROR, "assimp", "AndroidIOSystem: file %s opened", fullPath.c_str()); + return new DefaultIOStream(file, fullPath); +} + +#undef PATHLIMIT +#endif // __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) diff --git a/libs/assimp/port/AndroidJNI/BundledAssetIOSystem.cpp b/libs/assimp/port/AndroidJNI/BundledAssetIOSystem.cpp new file mode 100644 index 0000000..39daf99 --- /dev/null +++ b/libs/assimp/port/AndroidJNI/BundledAssetIOSystem.cpp @@ -0,0 +1,80 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2021, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ + +/** @file Android extension of DefaultIOSystem using the standard C file functions */ + +#include +#include +#include + +#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) + +#include + +using namespace Assimp; + +/** Tests for the existence of a file at the given path. */ +bool BundledAssetIOSystem::Exists(const char* pFile) const { + ai_assert(NULL != mApkAssetManager); + AAsset * asset = AAssetManager_open(mApkAssetManager, pFile, AASSET_MODE_UNKNOWN); + if (!asset) { return false; } + if (asset) AAsset_close(asset); + return true; +} + +// ------------------------------------------------------------------- +/** Open a new file with a given path. */ +Assimp::IOStream* BundledAssetIOSystem::Open(const char* pFile, const char* pMode) { + ai_assert(NULL != mApkAssetManager); + AAsset * asset = AAssetManager_open(mApkAssetManager, pFile, AASSET_MODE_UNKNOWN); + if (!asset) { return NULL; } + + return new AssetIOStream(asset); +} + +// ------------------------------------------------------------------- +/** Closes the given file and releases all resources associated with it. */ +void BundledAssetIOSystem::Close(Assimp::IOStream* pFile) { + delete reinterpret_cast(pFile); +} + +#endif // __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) + diff --git a/libs/assimp/port/AndroidJNI/CMakeLists.txt b/libs/assimp/port/AndroidJNI/CMakeLists.txt new file mode 100644 index 0000000..8c821c7 --- /dev/null +++ b/libs/assimp/port/AndroidJNI/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) + +include_directories(./) +include_directories(./../../) +add_library( # Defines the name of the library. + android_jniiosystem + + # Implements a static library. + STATIC + + # relative path to source file(s). + AndroidJNIIOSystem.cpp + BundledAssetIOSystem.cpp +) +TARGET_LINK_LIBRARIES(android_jniiosystem android log) +INSTALL(TARGETS android_jniiosystem EXPORT "${TARGETS_EXPORT_NAME}") diff --git a/libs/assimp/port/AndroidJNI/README.md b/libs/assimp/port/AndroidJNI/README.md new file mode 100644 index 0000000..003b1da --- /dev/null +++ b/libs/assimp/port/AndroidJNI/README.md @@ -0,0 +1,32 @@ +Build Asset Importer Lib for Android +==================================== +This module provides a facade for the io-stream-access to files behind the android-asset-management within +an Android-native application. +- It is built as a static library +- It requires Android NDK with android API > 9 support. + +### Building ### +To use this module please provide following cmake defines: +``` +-DASSIMP_ANDROID_JNIIOSYSTEM=ON +-DCMAKE_TOOLCHAIN_FILE=$SOME_PATH/android.toolchain.cmake +``` + +"SOME_PATH" is a path to your cmake android toolchain script. + + +The build script for this port is based on [android-cmake](https://github.com/taka-no-me/android-cmake). +See its documentation for more Android-specific cmake options (e.g. -DANDROID_ABI for the target ABI). +Check [Asset-Importer-Docs](https://assimp-docs.readthedocs.io/en/latest/) for more information. + +### Code ### +A small example how to wrap assimp for Android: +```cpp +#include + +Assimp::Importer* importer = new Assimp::Importer(); +Assimp::AndroidJNIIOSystem *ioSystem = new Assimp::AndroidJNIIOSystem(app->activity); +if ( nullptr != iosSystem ) { + importer->SetIOHandler(ioSystem); +} +``` diff --git a/libs/assimp/port/AssimpDelphi/Readme.txt b/libs/assimp/port/AssimpDelphi/Readme.txt new file mode 100644 index 0000000..1ec6d21 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/Readme.txt @@ -0,0 +1,6 @@ +This is a set of Delphi units for using the Assimp C DLL. This was created for use with Delphi 7, but should be usable as-is or with minimal modifications with later Delphi versions. + +This set of headers is enough to load and display a model with external textures. Since I'm not familiar with animated models and some of the other functionality of the assimp library, I did not convert the headers for those features. + +See http://sourceforge.net/tracker/?func=detail&aid=3212646&group_id=226462&atid=1067634 for the original patch + diff --git a/libs/assimp/port/AssimpDelphi/aiColor4D.pas b/libs/assimp/port/AssimpDelphi/aiColor4D.pas new file mode 100644 index 0000000..0bc5d2a --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiColor4D.pas @@ -0,0 +1,17 @@ +unit aiColor4D; + +interface + +const AI_MAX_NUMBER_OF_COLOR_SETS = $04; + +type TaiColor4D = packed record + r, g, b, a: single; +end; +type PaiColor4D = ^TaiColor4D; + +type TaiColor4DArray = array[0..0] of TaiColor4D; +type PTaiColor4DArray = ^TaiColor4DArray; + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiMaterial.pas b/libs/assimp/port/AssimpDelphi/aiMaterial.pas new file mode 100644 index 0000000..ffd8109 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiMaterial.pas @@ -0,0 +1,153 @@ +unit aiMaterial; + +interface + +uses aiTypes, aiVector2D, aiVector3D; + +{This following directive causes enums to be stored as double words (32bit), to be compatible with + the assimp C Dll} +{$Z4} + +type TaiTextureOp = ( + aiTextureOp_Multiply = $0, + aiTextureOp_Add = $1, + aiTextureOp_Subtract = $2, + aiTextureOp_Divide = $3, + aiTextureOp_SmoothAdd = $4, + aiTextureOp_SignedAdd = $5 + //_aiTextureOp_Force32Bit = 0x9fffffff +); + +type TaiTextureMapMode = ( + aiTextureMapMode_Wrap = $0, + aiTextureMapMode_Clamp = $1, + aiTextureMapMode_Decal = $3, + aiTextureMapMode_Mirror = $2 + //_aiTextureMapMode_Force32Bit = 0x9fffffff +); + +type TaiTextureMapping = ( + aiTextureMapping_UV = $0, + aiTextureMapping_SPHERE = $1, + aiTextureMapping_CYLINDER = $2, + aiTextureMapping_BOX = $3, + aiTextureMapping_PLANE = $4, + aiTextureMapping_OTHER = $5 + //_aiTextureMapping_Force32Bit = 0x9fffffff +); + +type TaiTextureType = ( + aiTextureType_NONE = $0, + aiTextureType_DIFFUSE = $1, + aiTextureType_SPECULAR = $2, + aiTextureType_AMBIENT = $3, + aiTextureType_EMISSIVE = $4, + aiTextureType_HEIGHT = $5, + aiTextureType_NORMALS = $6, + aiTextureType_SHININESS = $7, + aiTextureType_OPACITY = $8, + aiTextureType_DISPLACEMENT = $9, + aiTextureType_LIGHTMAP = $A, + aiTextureType_REFLECTION = $B, + aiTextureType_UNKNOWN = $C + //_aiTextureType_Force32Bit = 0x9fffffff +); + +const AI_TEXTURE_TYPE_MAX = aiTextureType_UNKNOWN; + +type TaiShadingMode = ( + aiShadingMode_Flat = $1, + aiShadingMode_Gouraud = $2, + aiShadingMode_Phong = $3, + aiShadingMode_Blinn = $4, + aiShadingMode_Toon = $5, + aiShadingMode_OrenNayar = $6, + aiShadingMode_Minnaert = $7, + aiShadingMode_CookTorrance = $8, + aiShadingMode_NoShading = $9, + aiShadingMode_Fresnel = $A + //_aiShadingMode_Force32Bit = 0x9fffffff +); + + +type TaiTextureFlags = ( + aiTextureFlags_Invert = $1, + aiTextureFlags_UseAlpha = $2, + aiTextureFlags_IgnoreAlpha = $4 + //_aiTextureFlags_Force32Bit = 0x9fffffff +); + +type TaiBlendMode = ( + aiBlendMode_Default = $0, + aiBlendMode_Additive = $1 + //_aiBlendMode_Force32Bit = 0x9fffffff +); + +type TaiUVTransform = packed record + mTranslation: TaiVector2D; + mScaling: TaiVector2D; + mRotation: single; +end; + +type TaiPropertyTypeInfo = ( + aiPTI_Float = $1, + aiPTI_String = $3, + aiPTI_Integer = $4, + aiPTI_Buffer = $5 + // _aiPTI_Force32Bit = 0x9fffffff +); + +type TaiMaterialProperty = packed record + mKey: aiString; + mSemantic: Cardinal; + mIndex: Cardinal; + mDataLength: Cardinal; + mType: TaiPropertyTypeInfo; + mData: PChar; +end; +type PaiMaterialProperty = ^TaiMaterialProperty; + +type TaiMaterial = packed record + mProperties: pointer; + mNumProperties: Cardinal; + mNumAllocated: Cardinal; +end; +type PaiMaterial = ^TaiMaterial; +type PaiMaterialArray = array[0..0] of PaiMaterial; +type PPaiMaterialArray = ^PaiMaterialArray; + +const AI_MATKEY_NAME = '?mat.name'; +const AI_MATKEY_TWOSIDED = '$mat.twosided'; +const AI_MATKEY_SHADING_MODEL = '$mat.shadingm'; +const AI_MATKEY_ENABLE_WIREFRAME = '$mat.wireframe'; +const AI_MATKEY_BLEND_FUNC = '$mat.blend'; +const AI_MATKEY_OPACITY = '$mat.opacity'; +const AI_MATKEY_BUMPSCALING = '$mat.bumpscaling'; +const AI_MATKEY_SHININESS = '$mat.shininess'; +const AI_MATKEY_REFLECTIVITY = '$mat.reflectivity'; +const AI_MATKEY_SHININESS_STRENGTH = '$mat.shinpercent'; +const AI_MATKEY_REFRACTI = '$mat.refracti'; +const AI_MATKEY_COLOR_DIFFUSE = '$clr.diffuse'; +const AI_MATKEY_COLOR_AMBIENT = '$clr.ambient'; +const AI_MATKEY_COLOR_SPECULAR = '$clr.specular'; +const AI_MATKEY_COLOR_EMISSIVE = '$clr.emissive'; +const AI_MATKEY_COLOR_TRANSPARENT = '$clr.transparent'; +const AI_MATKEY_COLOR_REFLECTIVE = '$clr.reflective'; +const AI_MATKEY_GLOBAL_BACKGROUND_IMAGE = '?bg.global'; + +const _AI_MATKEY_TEXTURE_BASE = '$tex.file'; +const _AI_MATKEY_UVWSRC_BASE = '$tex.uvwsrc'; +const _AI_MATKEY_TEXOP_BASE = '$tex.op'; +const _AI_MATKEY_MAPPING_BASE = '$tex.mapping'; +const _AI_MATKEY_TEXBLEND_BASE = '$tex.blend'; +const _AI_MATKEY_MAPPINGMODE_U_BASE = '$tex.mapmodeu'; +const _AI_MATKEY_MAPPINGMODE_V_BASE = '$tex.mapmodev'; +const _AI_MATKEY_TEXMAP_AXIS_BASE = '$tex.mapaxis'; +const _AI_MATKEY_UVTRANSFORM_BASE = '$tex.uvtrafo'; +const _AI_MATKEY_TEXFLAGS_BASE = '$tex.flags'; + + + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiMatrix3x3.pas b/libs/assimp/port/AssimpDelphi/aiMatrix3x3.pas new file mode 100644 index 0000000..a90f11f --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiMatrix3x3.pas @@ -0,0 +1,16 @@ +unit aiMatrix3x3; + +interface + +type TaiMatrix3x3 = packed record + a1, a2, a3, a4: single; + b1, b2, b3, b4: single; + c1, c2, c3, c4: single; +end; +PaiMatrix3x3 = ^TaiMatrix3x3; + + + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiMatrix4x4.pas b/libs/assimp/port/AssimpDelphi/aiMatrix4x4.pas new file mode 100644 index 0000000..45e0faf --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiMatrix4x4.pas @@ -0,0 +1,16 @@ +unit aiMatrix4x4; + +interface + +type TaiMatrix4x4 = packed record + a1, a2, a3, a4: single; + b1, b2, b3, b4: single; + c1, c2, c3, c4: single; + d1, d2, d3, d4: single; +end; +PaiMatrix4x4 = ^TaiMatrix4x4; + + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiMesh.pas b/libs/assimp/port/AssimpDelphi/aiMesh.pas new file mode 100644 index 0000000..a05a0f2 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiMesh.pas @@ -0,0 +1,71 @@ +unit aiMesh; + +interface + +uses aiTypes, aiMatrix4x4, aiVector3D, aiColor4D; + +const + AI_MAX_NUMBER_OF_COLOR_SETS = $4; + AI_MAX_NUMBER_OF_TEXTURECOORDS = $4; + +type TaiFace = packed record + mNumIndicies: cardinal; + mIndices: PCardinalArray; +end; +type PaiFace = ^TaiFace; +type PaiFaceArray = array [0..0] of PaiFace; + +type TaiFaceArray = array [0..0] of TaiFace; +type PTaiFaceArray = ^TaiFaceArray; + +type TaiVertexWeight = packed record + mVertexId: cardinal; + mWeight: single; +end; + +type TaiBone = packed record + mName: aiString; + mNumWeights: cardinal; + mWeights: Pointer; + mOffsetMatrix: TaiMatrix4x4; +end; +type PaiBone = ^TaiBone; + +type TaiPrimitiveType = + ( + aiPrimitiveType_POINT = $1, + aiPrimitiveType_LINE = $2, + aiPrimitiveType_TRIANGLE = $4, + aiPrimitiveType_POLYGON = $8 + //,_aiPrimitiveType_Force32Bit = $9fffffff + ); + +type TaiMesh = packed record + mPrimitiveTypes: cardinal; + mNumVertices: cardinal; + mNumFaces: cardinal; + mVertices: PTaiVector3DArray; + mNormals: PTaiVector3DArray; + mTangents: PaiVector3DArray; + mBitangents: PaiVector3DArray; + mColors: array[0..3] of PTaiColor4Darray; //array [0..3] of PaiColor4DArray; //array of 4 + mTextureCoords: array [0..3] of PTaiVector3DArray; //array of 4 + mNumUVComponents: array[0..AI_MAX_NUMBER_OF_TEXTURECOORDS -1] of cardinal; + mFaces: PTaiFaceArray; + mNumBones: cardinal; + mBones: PaiBone; + mMaterialIndex: cardinal; + mName: aiString; + mNumAniMeshes: cardinal; + mAniMeshes: pointer; +end; +type PaiMesh = ^TaiMesh; +type PPaiMesh = ^PaiMesh; +type PaiMeshArray = array [0..0] of PaiMesh; +type PPaiMeshArray = ^PaiMeshArray; + + + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiQuaternion.pas b/libs/assimp/port/AssimpDelphi/aiQuaternion.pas new file mode 100644 index 0000000..d5550de --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiQuaternion.pas @@ -0,0 +1,12 @@ +unit aiQuaternion; + +interface + +type TaiQuaternion = packed record + w, x, y, z: single; +end; +type PaiQuaternion = ^TaiQuaternion; + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiScene.pas b/libs/assimp/port/AssimpDelphi/aiScene.pas new file mode 100644 index 0000000..28cebf1 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiScene.pas @@ -0,0 +1,46 @@ +unit aiScene; + +interface + +uses aiTypes, aiMatrix4x4, aiMesh, aiMaterial, aiTexture; + + +type + PaiNode = ^TaiNode; + PPaiNode = ^PaiNode; + PaiNodeArray = array[0..0] of PaiNode; + PPaiNodeArray = ^PaiNodeArray; + + TaiNode = packed record + mName: aiString; + mTransformation: TaiMatrix4x4; + mParent: PPaiNode; + mNumChildren: cardinal; + mChildren: PPaiNodeArray; + mNumMeshes: cardinal; + mMeshes: PCardinalArray; + end; + + + +type TaiScene = packed record + mFlags: cardinal; + mRootNode: PaiNode; + mNumMeshes: Cardinal; + mMeshes: PPaiMeshArray; //? + mNumMaterials: Cardinal; + mMaterials: PPaiMaterialArray; + mNumAnimations: Cardinal; + mAnimations: Pointer; + mNumTextures: Cardinal; + mTextures: PPaiTextureArray; + mNumLights: Cardinal; + mLights: Pointer; + mNumCameras: Cardinal; + mCameras: Pointer; +end; +type PaiScene = ^TaiScene; + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiTexture.pas b/libs/assimp/port/AssimpDelphi/aiTexture.pas new file mode 100644 index 0000000..55e246f --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiTexture.pas @@ -0,0 +1,26 @@ +unit aiTexture; + +interface + +type TaiTexel = packed record + b, g, r, a: byte; +end; +PaiTexel = ^TaiTexel; +TaiTexelArray = array[0..0] of TaiTexel; +PaiTexelArray = ^TaiTexelArray; + +type TaiTexture = packed record + mWidth: Cardinal; //width in pixels, OR total embedded file size if texture is a jpg/png/etc + mHeight: Cardinal; //0 if texture is an embedded file + achFormatHint: array[0..3] of byte; + pcData: PaiTexelArray; +end; +PaiTexture = ^TaiTexture; +PaiTextureArray = array [0..0] of PaiTexture; +PPaiTextureArray = ^PaiTextureArray; + + + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiTypes.pas b/libs/assimp/port/AssimpDelphi/aiTypes.pas new file mode 100644 index 0000000..b7924e8 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiTypes.pas @@ -0,0 +1,53 @@ +unit aiTypes; + +interface + +//added for Delphi interface +type + TCardinalArray = array [0..0] of Cardinal; + PCardinalArray = ^TCardinalArray; + + TSingleArray = array[0..0] of Single; + PSingleArray = ^TSingleArray; + +type aiString = packed record + length: Cardinal; + data: array [0..1023] of char; +end; +type PaiString = ^aiString; + +type aiReturn = ( + aiReturn_SUCCESS = $0, + aiReturn_FAILURE = -$1, + aiReturn_OUTOFMEMORY = -$3, + _AI_ENFORCE_ENUM_SIZE = $7fffffff +); + +const AI_SUCCESS = aiReturn_SUCCESS; +const AI_FAILURE = aiReturn_FAILURE; +const AI_OUTOFMEMORY = aiReturn_OUTOFMEMORY; + + + + +function aiStringToDelphiString( a: aiString): AnsiString; + + +implementation + +function aiStringToDelphiString( a: aiString): AnsiString; +var + i: integer; +begin + result := ''; + if a.length > 0 then + begin + SetLength( result, a.length); + for i := 1 to a.length do + begin + result[i] := a.data[i-1]; + end; + end; +end; + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiVector2D.pas b/libs/assimp/port/AssimpDelphi/aiVector2D.pas new file mode 100644 index 0000000..1e88209 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiVector2D.pas @@ -0,0 +1,13 @@ +unit aiVector2D; + +interface + +type TaiVector2D = packed record + x, y: single; +end; +type PaiVector2D = ^TaiVector2D; + + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/aiVector3D.pas b/libs/assimp/port/AssimpDelphi/aiVector3D.pas new file mode 100644 index 0000000..2081bb4 --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/aiVector3D.pas @@ -0,0 +1,16 @@ +unit aiVector3D; + +interface + +type TaiVector3D = packed record + x, y, z: single; +end; +type PaiVector3D = ^TaiVector3D; +type PaiVector3DArray = array [0..0] of PaiVector3D; + +type TaiVector3DArray = array[0..0] of TaiVector3D; +type PTaiVector3DArray = ^TaiVector3DArray; + +implementation + +end. diff --git a/libs/assimp/port/AssimpDelphi/assimp.pas b/libs/assimp/port/AssimpDelphi/assimp.pas new file mode 100644 index 0000000..d5bf31d --- /dev/null +++ b/libs/assimp/port/AssimpDelphi/assimp.pas @@ -0,0 +1,58 @@ +unit assimp; + +interface + +uses aiTypes, aiMatrix4x4, aiMatrix3x3, aiMesh, aiScene, aiMaterial, aiColor4d, aiVector3D; + +const ASSIMP_DLL = 'assimp32.dll'; + +function aiImportFile(filename: pchar; pFlags: integer): PaiScene; cdecl; external ASSIMP_DLL; +procedure aiReleaseImport( pScene: pointer); cdecl; external ASSIMP_DLL; +function aiGetErrorString(): PChar; cdecl; external ASSIMP_DLL; + +//procedure aiDecomposeMatrix( var mat: TaiMatrix4x4; var scaling: TaiVector3D; var rotation: TaiQuaternion; var position: TaiVector3D); cdecl; external ASSIMP_DLL; +procedure aiTransposeMatrix4( var mat: TaiMatrix4x4); cdecl; external ASSIMP_DLL; +procedure aiTransposeMatrix3( var mat: TaiMatrix3x3); cdecl; external ASSIMP_DLL; +procedure aiTransformVecByMatrix3( var vec: TaiVector3D; var mat: TaiMatrix3x3); cdecl; external ASSIMP_DLL; +procedure aiTransformVecByMatrix4( var vec: TaiVector3D; var mat: TaiMatrix4x4); cdecl; external ASSIMP_DLL; + +procedure aiMultiplyMatrix4(var dst: TaiMatrix4x4; var src: TaiMatrix4x4); cdecl; external ASSIMP_DLL; +procedure aiMultiplyMatrix3(var dst: TaiMatrix3x3; var src: TaiMatrix3x3); cdecl; external ASSIMP_DLL; + + +procedure aiIdentityMatrix3(var mat: TaiMatrix3x3); cdecl; external ASSIMP_DLL; +procedure aiIdentityMatrix4(var mat: TaiMatrix4x4); cdecl; external ASSIMP_DLL; + + +//----- from aiMaterial.h +function aiGetMaterialProperty( pMat: PaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; pPropOut: pointer): aiReturn; cdecl; external ASSIMP_DLL; +function aiGetMaterialFloatArray( var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Single; var pMax: Cardinal): aiReturn; cdecl; external ASSIMP_DLL; +function aiGetMaterialFloat( var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Single): aiReturn; +function aiGetMaterialIntegerArray(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Integer; var pMax: Cardinal): aiReturn; cdecl; external ASSIMP_DLL; +function aiGetMaterialInteger(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Integer): aiReturn; +function aiGetMaterialColor(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: TaiColor4d): aiReturn; cdecl; external ASSIMP_DLL; +function aiGetMaterialString(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: aiString): aiReturn; cdecl; external ASSIMP_DLL; +function aiGetMaterialTextureCount(var pMat: TaiMaterial; nType: TaiTextureType): Cardinal; cdecl; external ASSIMP_DLL; +function aiGetMaterialTexture(var mat: TaiMaterial; nType: TaiTextureType; nIndex: Cardinal; var path: aiString; var mapping: TaiTextureMapping; var uvindex: Cardinal; var blend: single; var op: TaiTextureOp; var mapmode: TaiTextureMapMode; var flags: Cardinal): aiReturn; cdecl; external ASSIMP_DLL; + + + +implementation + +function aiGetMaterialFloat( var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: Single): aiReturn; +var + n: cardinal; +begin + n := 0; + result := aiGetMaterialFloatArray( pMat, pKey, nType, nIndex, pOut, n); +end; + +function aiGetMaterialInteger(var pMat: TaiMaterial; pKey: PChar; nType: Cardinal; nIndex: Cardinal; var pOut: integer): aiReturn; +var + n: cardinal; +begin + n := 0; + result := aiGetMaterialIntegerArray( pMat, pKey, nType, nIndex, pOut, n); +end; + +end. diff --git a/libs/assimp/port/AssimpNET/Readme.md b/libs/assimp/port/AssimpNET/Readme.md new file mode 100644 index 0000000..814cab3 --- /dev/null +++ b/libs/assimp/port/AssimpNET/Readme.md @@ -0,0 +1 @@ +Please check the following git-repo for the source: https://github.com/kebby/assimp-net diff --git a/libs/assimp/port/AssimpPascal/Readme.md b/libs/assimp/port/AssimpPascal/Readme.md new file mode 100644 index 0000000..9dfc652 --- /dev/null +++ b/libs/assimp/port/AssimpPascal/Readme.md @@ -0,0 +1 @@ +See the [AssimpPascal headers here](https://github.com/ev1313/Pascal-Assimp-Headers) (by Tim Blume / ev1313). diff --git a/libs/assimp/port/PyAssimp/3d_viewer_screenshot.png b/libs/assimp/port/PyAssimp/3d_viewer_screenshot.png new file mode 100644 index 0000000..2031faf Binary files /dev/null and b/libs/assimp/port/PyAssimp/3d_viewer_screenshot.png differ diff --git a/libs/assimp/port/PyAssimp/README.md b/libs/assimp/port/PyAssimp/README.md new file mode 100644 index 0000000..c9944f7 --- /dev/null +++ b/libs/assimp/port/PyAssimp/README.md @@ -0,0 +1,86 @@ +PyAssimp Readme +=============== + +A simple Python wrapper for Assimp using `ctypes` to access the library. +Requires Python >= 2.6. + +Python 3 support is mostly here, but not well tested. + +Note that pyassimp is not complete. Many ASSIMP features are missing. + +USAGE +----- + +### Complete example: 3D viewer + +`pyassimp` comes with a simple 3D viewer that shows how to load and display a 3D +model using a shader-based OpenGL pipeline. + +![Screenshot](3d_viewer_screenshot.png) + +To use it, from within `/port/PyAssimp`: + +```console +$ cd scripts +$ python ./3D-viewer +``` + +You can use this code as starting point in your applications. + +### Writing your own code + +To get started with `pyassimp`, examine the simpler `sample.py` script in `scripts/`, +which illustrates the basic usage. All Assimp data structures are wrapped using +`ctypes`. All the data+length fields in Assimp's data structures (such as +`aiMesh::mNumVertices`, `aiMesh::mVertices`) are replaced by simple python +lists, so you can call `len()` on them to get their respective size and access +members using `[]`. + +For example, to load a file named `hello.3ds` and print the first +vertex of the first mesh, you would do (proper error handling +substituted by assertions ...): + +```python + +from pyassimp import load +with load('hello.3ds') as scene: + + assert len(scene.meshes) + mesh = scene.meshes[0] + + assert len(mesh.vertices) + print(mesh.vertices[0]) + +``` + +Another example to list the 'top nodes' in a +scene: + +```python + +from pyassimp import load +with load('hello.3ds') as scene: + + for c in scene.rootnode.children: + print(str(c)) + +``` + +INSTALL +------- + +Install `pyassimp` by running: + +```console +$ 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: + - the current directory + - on linux additionally: `/usr/lib`, `/usr/local/lib`, + `/usr/lib/x86_64-linux-gnu` + +To build that library, refer to the Assimp master `INSTALL` +instructions. To look in more places, edit `./pyassimp/helper.py`. +There's an `additional_dirs` list waiting for your entries. diff --git a/libs/assimp/port/PyAssimp/README.rst b/libs/assimp/port/PyAssimp/README.rst new file mode 100644 index 0000000..03b7968 --- /dev/null +++ b/libs/assimp/port/PyAssimp/README.rst @@ -0,0 +1,93 @@ +PyAssimp: Python bindings for libassimp +======================================= + +A simple Python wrapper for Assimp using ``ctypes`` to access the +library. Requires Python >= 2.6. + +Python 3 support is mostly here, but not well tested. + +Note that pyassimp is not complete. Many ASSIMP features are missing. + +USAGE +----- + +Complete example: 3D viewer +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``pyassimp`` comes with a simple 3D viewer that shows how to load and +display a 3D model using a shader-based OpenGL pipeline. + +.. figure:: 3d_viewer_screenshot.png + :alt: Screenshot + + Screenshot + +To use it, from within ``/port/PyAssimp``: + +:: + + $ cd scripts + $ python ./3D-viewer + +You can use this code as starting point in your applications. + +Writing your own code +~~~~~~~~~~~~~~~~~~~~~ + +To get started with ``pyassimp``, examine the simpler ``sample.py`` +script in ``scripts/``, which illustrates the basic usage. All Assimp +data structures are wrapped using ``ctypes``. All the data+length fields +in Assimp's data structures (such as ``aiMesh::mNumVertices``, +``aiMesh::mVertices``) are replaced by simple python lists, so you can +call ``len()`` on them to get their respective size and access members +using ``[]``. + +For example, to load a file named ``hello.3ds`` and print the first +vertex of the first mesh, you would do (proper error handling +substituted by assertions ...): + +.. code:: python + + + from pyassimp import load + with load('hello.3ds') as scene: + + assert len(scene.meshes) + mesh = scene.meshes[0] + + assert len(mesh.vertices) + print(mesh.vertices[0]) + + +Another example to list the 'top nodes' in a scene: + +.. code:: python + + + from pyassimp import load + with load('hello.3ds') as scene: + + for c in scene.rootnode.children: + print(str(c)) + + +INSTALL +------- + +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 +directories are: + +- the current directory +- on linux additionally: ``/usr/lib``, ``/usr/local/lib``, + ``/usr/lib/x86_64-linux-gnu`` + +To build that library, refer to the Assimp master ``INSTALL`` +instructions. To look in more places, edit ``./pyassimp/helper.py``. +There's an ``additional_dirs`` list waiting for your entries. diff --git a/libs/assimp/port/PyAssimp/gen/materialgen.py b/libs/assimp/port/PyAssimp/gen/materialgen.py new file mode 100644 index 0000000..ef32d8e --- /dev/null +++ b/libs/assimp/port/PyAssimp/gen/materialgen.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# -*- Coding: UTF-8 -*- + +# --------------------------------------------------------------------------- +# Open Asset Import Library (ASSIMP) +# --------------------------------------------------------------------------- +# +# Copyright (c) 2006-2020, ASSIMP Development Team +# +# All rights reserved. +# +# Redistribution and use of this software in source and binary forms, +# with or without modification, are permitted provided that the following +# conditions are met: +# +# * Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the +# following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# * Neither the name of the ASSIMP team, nor the names of its +# contributors may be used to endorse or promote products +# derived from this software without specific prior +# written permission of the ASSIMP Development Team. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# --------------------------------------------------------------------------- + +"""Update PyAssimp's texture type constants C/C++ headers. + +This script is meant to be executed in the source tree, directly from +port/PyAssimp/gen +""" + +import os +import re + +REenumTextureType = re.compile(r'' + r'enum\saiTextureType' # enum aiTextureType + r'[^{]*?\{' # { + r'(?P.*?)' # code + r'\};' # }; + , re.IGNORECASE + re.DOTALL + re.MULTILINE) + +# Replace comments +RErpcom = re.compile(r'' + r'\s*(/\*+\s|\*+/|\B\*\s?|///?!?)' # /** + r'(?P.*?)' # * line + , re.IGNORECASE + re.DOTALL) + +# Remove trailing commas +RErmtrailcom = re.compile(r',$', re.IGNORECASE + re.DOTALL) + +# Remove #ifdef __cplusplus +RErmifdef = re.compile(r'' + r'#ifndef SWIG' # #ifndef SWIG + r'(?P.*)' # code + r'#endif(\s*//\s*!?\s*SWIG)*' # #endif + , re.IGNORECASE + re.DOTALL) + +path = '../../../include/assimp' + +files = os.listdir (path) +enumText = '' +for fileName in files: + if fileName.endswith('.h'): + text = open(os.path.join(path, fileName)).read() + for enum in REenumTextureType.findall(text): + enumText = enum + +text = '' +for line in enumText.split('\n'): + line = line.lstrip().rstrip() + line = RErmtrailcom.sub('', line) + text += RErpcom.sub('# \g', line) + '\n' +text = RErmifdef.sub('', text) + +file = open('material.py', 'w') +file.write(text) +file.close() + +print("Generation done. You can now review the file 'material.py' and merge it.") diff --git a/libs/assimp/port/PyAssimp/gen/structsgen.py b/libs/assimp/port/PyAssimp/gen/structsgen.py new file mode 100644 index 0000000..f34ec19 --- /dev/null +++ b/libs/assimp/port/PyAssimp/gen/structsgen.py @@ -0,0 +1,290 @@ +#!/usr/bin/env python +# -*- Coding: UTF-8 -*- + +# --------------------------------------------------------------------------- +# Open Asset Import Library (ASSIMP) +# --------------------------------------------------------------------------- +# +# Copyright (c) 2006-2020, ASSIMP Development Team +# +# All rights reserved. +# +# Redistribution and use of this software in source and binary forms, +# with or without modification, are permitted provided that the following +# conditions are met: +# +# * Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the +# following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# * Neither the name of the ASSIMP team, nor the names of its +# contributors may be used to endorse or promote products +# derived from this software without specific prior +# written permission of the ASSIMP Development Team. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# --------------------------------------------------------------------------- + +"""Update PyAssimp's data structures to keep up with the +C/C++ headers. + +This script is meant to be executed in the source tree, directly from +port/PyAssimp/gen +""" + +import os +import re + +#==[regexps]================================================= + +# Clean desc +REdefine = re.compile(r'' + r'(?P)' # /** *desc */ + r'#\s*define\s(?P[^(\n]+?)\s(?P.+)$' # #define name value + , re.MULTILINE) + +# Get structs +REstructs = re.compile(r'' + #r'//\s?[\-]*\s(?P.*?)\*/\s' # /** *desc */ + #r'//\s?[\-]*(?P.*?)\*/(?:.*?)' # garbage + r'//\s?[\-]*\s(?P.*?)\*/\W*?' # /** *desc */ + r'struct\s(?:ASSIMP_API\s)?(?P[a-z][a-z0-9_]\w+\b)' # struct name + r'[^{]*?\{' # { + r'(?P.*?)' # code + r'\}\s*(PACK_STRUCT)?;' # }; + , re.IGNORECASE + re.DOTALL + re.MULTILINE) + +# Clean desc +REdesc = re.compile(r'' + r'^\s*?([*]|/\*\*)(?P.*?)' # * line + , re.IGNORECASE + re.DOTALL + re.MULTILINE) + +# Remove #ifdef __cplusplus +RErmifdef = re.compile(r'' + r'#ifdef __cplusplus' # #ifdef __cplusplus + r'(?P.*)' # code + r'#endif(\s*//\s*!?\s*__cplusplus)*' # #endif + , re.IGNORECASE + re.DOTALL) + +# Replace comments +RErpcom = re.compile(r'' + r'\s*(/\*+\s|\*+/|\B\*\s|///?!?)' # /** + r'(?P.*?)' # * line + , re.IGNORECASE + re.DOTALL) + +# Restructure +def GetType(type, prefix='c_'): + t = type + while t.endswith('*'): + t = t[:-1] + if t[:5] == 'const': + t = t[5:] + + # skip some types + if t in skiplist: + return None + + t = t.strip() + types = {'unsigned int':'uint', 'unsigned char':'ubyte',} + if t in types: + t = types[t] + t = prefix + t + while type.endswith('*'): + t = "POINTER(" + t + ")" + type = type[:-1] + return t + +def restructure( match ): + type = match.group("type") + if match.group("struct") == "": + type = GetType(type) + elif match.group("struct") == "C_ENUM ": + type = "c_uint" + else: + type = GetType(type[2:], '') + if type is None: + return '' + if match.group("index"): + type = type + "*" + match.group("index") + + result = "" + for name in match.group("name").split(','): + result += "(\"" + name.strip() + "\", "+ type + ")," + + return result + +RErestruc = re.compile(r'' + r'(?PC_STRUCT\s|C_ENUM\s|)' # [C_STRUCT] + r'(?P\w+\s?\w+?[*]*)\s' # type + #r'(?P\w+)' # name + r'(?P\w+|[a-z0-9_, ]+)' # name + r'(:?\[(?P\w+)\])?;' # []; (optional) + , re.DOTALL) +#==[template]================================================ +template = """ +class $NAME$(Structure): + \"\"\" +$DESCRIPTION$ + \"\"\" +$DEFINES$ + _fields_ = [ + $FIELDS$ + ] +""" + +templateSR = """ +class $NAME$(Structure): + \"\"\" +$DESCRIPTION$ + \"\"\" +$DEFINES$ + +$NAME$._fields_ = [ + $FIELDS$ + ] +""" + +skiplist = ("FileIO", "File", "locateFromAssimpHeap",'LogStream','MeshAnim','AnimMesh') + +#============================================================ +def Structify(fileName): + file = open(fileName, 'r') + text = file.read() + result = [] + + # Get defines. + defs = REdefine.findall(text) + # Create defines + defines = "\n" + for define in defs: + # Clean desc + desc = REdesc.sub('', define[0]) + # Replace comments + desc = RErpcom.sub('#\g', desc) + defines += desc + if len(define[2].strip()): + # skip non-integral defines, we can support them right now + try: + int(define[2],0) + except: + continue + defines += " "*4 + define[1] + " = " + define[2] + "\n" + + + # Get structs + rs = REstructs.finditer(text) + + fileName = os.path.basename(fileName) + print fileName + for r in rs: + name = r.group('name')[2:] + desc = r.group('desc') + + # Skip some structs + if name in skiplist: + continue + + text = r.group('code') + + # Clean desc + desc = REdesc.sub('', desc) + + desc = "See '"+ fileName +"' for details." #TODO + + # Remove #ifdef __cplusplus + text = RErmifdef.sub('', text) + + # Whether the struct contains more than just POD + primitive = text.find('C_STRUCT') == -1 + + # Restructure + text = RErestruc.sub(restructure, text) + # Replace comments + text = RErpcom.sub('# \g', text) + text = text.replace("),#", "),\n#") + text = text.replace("#", "\n#") + text = "".join([l for l in text.splitlines(True) if not l.strip().endswith("#")]) # remove empty comment lines + + # Whether it's selfreferencing: ex. struct Node { Node* parent; }; + selfreferencing = text.find('POINTER('+name+')') != -1 + + complex = name == "Scene" + + # Create description + description = "" + for line in desc.split('\n'): + description += " "*4 + line.strip() + "\n" + description = description.rstrip() + + # Create fields + fields = "" + for line in text.split('\n'): + fields += " "*12 + line.strip() + "\n" + fields = fields.strip() + + if selfreferencing: + templ = templateSR + else: + templ = template + + # Put it all together + text = templ.replace('$NAME$', name) + text = text.replace('$DESCRIPTION$', description) + text = text.replace('$FIELDS$', fields) + + if ((name.lower() == fileName.split('.')[0][2:].lower()) and (name != 'Material')) or name == "String": + text = text.replace('$DEFINES$', defines) + else: + text = text.replace('$DEFINES$', '') + + + result.append((primitive, selfreferencing, complex, text)) + + return result + +text = "#-*- coding: UTF-8 -*-\n\n" +text += "from ctypes import POINTER, c_int, c_uint, c_size_t, c_char, c_float, Structure, c_char_p, c_double, c_ubyte\n\n" + +structs1 = "" +structs2 = "" +structs3 = "" +structs4 = "" + +path = '../../../include/assimp' +files = os.listdir (path) +#files = ["aiScene.h", "aiTypes.h"] +for fileName in files: + if fileName.endswith('.h'): + for struct in Structify(os.path.join(path, fileName)): + primitive, sr, complex, struct = struct + if primitive: + structs1 += struct + elif sr: + structs2 += struct + elif complex: + structs4 += struct + else: + structs3 += struct + +text += structs1 + structs2 + structs3 + structs4 + +file = open('structs.py', 'w') +file.write(text) +file.close() + +print("Generation done. You can now review the file 'structs.py' and merge it.") diff --git a/libs/assimp/port/PyAssimp/pyassimp/__init__.py b/libs/assimp/port/PyAssimp/pyassimp/__init__.py new file mode 100644 index 0000000..bb67a43 --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/__init__.py @@ -0,0 +1 @@ +from .core import * diff --git a/libs/assimp/port/PyAssimp/pyassimp/core.py b/libs/assimp/port/PyAssimp/pyassimp/core.py new file mode 100644 index 0000000..35ad882 --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/core.py @@ -0,0 +1,556 @@ +""" +PyAssimp + +This is the main-module of PyAssimp. +""" + +import sys +if sys.version_info < (2,6): + raise RuntimeError('pyassimp: need python 2.6 or newer') + +# xrange was renamed range in Python 3 and the original range from Python 2 was removed. +# To keep compatibility with both Python 2 and 3, xrange is set to range for version 3.0 and up. +if sys.version_info >= (3,0): + xrange = range + + +try: + import numpy +except ImportError: + numpy = None +import logging +import ctypes +from contextlib import contextmanager +logger = logging.getLogger("pyassimp") +# attach default null handler to logger so it doesn't complain +# even if you don't attach another handler to logger +logger.addHandler(logging.NullHandler()) + +from . import structs +from . import helper +from . import postprocess +from .errors import AssimpError + +class AssimpLib(object): + """ + Assimp-Singleton + """ + load, load_mem, export, export_blob, release, dll = helper.search_library() +_assimp_lib = AssimpLib() + +def make_tuple(ai_obj, type = None): + res = None + + #notes: + # ai_obj._fields_ = [ ("attr", c_type), ... ] + # getattr(ai_obj, e[0]).__class__ == float + + if isinstance(ai_obj, structs.Matrix4x4): + if numpy: + res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]).reshape((4,4)) + #import pdb;pdb.set_trace() + else: + res = [getattr(ai_obj, e[0]) for e in ai_obj._fields_] + res = [res[i:i+4] for i in xrange(0,16,4)] + elif isinstance(ai_obj, structs.Matrix3x3): + if numpy: + res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]).reshape((3,3)) + else: + res = [getattr(ai_obj, e[0]) for e in ai_obj._fields_] + res = [res[i:i+3] for i in xrange(0,9,3)] + else: + if numpy: + res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]) + else: + res = [getattr(ai_obj, e[0]) for e in ai_obj._fields_] + + return res + +# Returns unicode object for Python 2, and str object for Python 3. +def _convert_assimp_string(assimp_string): + if sys.version_info >= (3, 0): + return str(assimp_string.data, errors='ignore') + else: + return unicode(assimp_string.data, errors='ignore') + +# It is faster and more correct to have an init function for each assimp class +def _init_face(aiFace): + aiFace.indices = [aiFace.mIndices[i] for i in range(aiFace.mNumIndices)] +assimp_struct_inits = { structs.Face : _init_face } + +def call_init(obj, caller = None): + if helper.hasattr_silent(obj,'contents'): #pointer + _init(obj.contents, obj, caller) + else: + _init(obj,parent=caller) + +def _is_init_type(obj): + + if obj and helper.hasattr_silent(obj,'contents'): #pointer + return _is_init_type(obj[0]) + # null-pointer case that arises when we reach a mesh attribute + # like mBitangents which use mNumVertices rather than mNumBitangents + # so it breaks the 'is iterable' check. + # Basically: + # FIXME! + elif not bool(obj): + return False + tname = obj.__class__.__name__ + return not (tname[:2] == 'c_' or tname == 'Structure' \ + or tname == 'POINTER') and not isinstance(obj, (int, str, bytes)) + +def _init(self, target = None, parent = None): + """ + Custom initialize() for C structs, adds safely accessible member functionality. + + :param target: set the object which receive the added methods. Useful when manipulating + pointers, to skip the intermediate 'contents' deferencing. + """ + if not target: + target = self + + dirself = dir(self) + for m in dirself: + + if m.startswith("_"): + continue + + if m.startswith('mNum'): + if 'm' + m[4:] in dirself: + continue # will be processed later on + else: + name = m[1:].lower() + + obj = getattr(self, m) + setattr(target, name, obj) + continue + + if m == 'mName': + target.name = str(_convert_assimp_string(self.mName)) + target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + getattr(x, 'name','') + ")" + target.__class__.__str__ = lambda x: getattr(x, 'name', '') + continue + + name = m[1:].lower() + + obj = getattr(self, m) + + # Create tuples + if isinstance(obj, structs.assimp_structs_as_tuple): + setattr(target, name, make_tuple(obj)) + logger.debug(str(self) + ": Added array " + str(getattr(target, name)) + " as self." + name.lower()) + continue + + if m.startswith('m') and len(m) > 1 and m[1].upper() == m[1]: + + if name == "parent": + setattr(target, name, parent) + logger.debug("Added a parent as self." + name) + continue + + if helper.hasattr_silent(self, 'mNum' + m[1:]): + + length = getattr(self, 'mNum' + m[1:]) + + # -> special case: properties are + # stored as a dict. + if m == 'mProperties': + setattr(target, name, _get_properties(obj, length)) + continue + + + if not length: # empty! + setattr(target, name, []) + logger.debug(str(self) + ": " + name + " is an empty list.") + continue + + + try: + if obj._type_ in structs.assimp_structs_as_tuple: + if numpy: + setattr(target, name, numpy.array([make_tuple(obj[i]) for i in range(length)], dtype=numpy.float32)) + + logger.debug(str(self) + ": Added an array of numpy arrays (type "+ str(type(obj)) + ") as self." + name) + else: + setattr(target, name, [make_tuple(obj[i]) for i in range(length)]) + + logger.debug(str(self) + ": Added a list of lists (type "+ str(type(obj)) + ") as self." + name) + + else: + setattr(target, name, [obj[i] for i in range(length)]) #TODO: maybe not necessary to recreate an array? + + logger.debug(str(self) + ": Added list of " + str(obj) + " " + name + " as self." + name + " (type: " + str(type(obj)) + ")") + + # initialize array elements + try: + init = assimp_struct_inits[type(obj[0])] + except KeyError: + if _is_init_type(obj[0]): + for e in getattr(target, name): + call_init(e, target) + else: + for e in getattr(target, name): + init(e) + + + except IndexError: + logger.error("in " + str(self) +" : mismatch between mNum" + name + " and the actual amount of data in m" + name + ". This may be due to version mismatch between libassimp and pyassimp. Quitting now.") + sys.exit(1) + + except ValueError as e: + + logger.error("In " + str(self) + "->" + name + ": " + str(e) + ". Quitting now.") + if "setting an array element with a sequence" in str(e): + logger.error("Note that pyassimp does not currently " + "support meshes with mixed triangles " + "and quads. Try to load your mesh with" + " a post-processing to triangulate your" + " faces.") + raise e + + + + else: # starts with 'm' but not iterable + setattr(target, m, obj) + logger.debug("Added " + name + " as self." + name + " (type: " + str(type(obj)) + ")") + + if _is_init_type(obj): + call_init(obj, target) + + if isinstance(self, structs.Mesh): + _finalize_mesh(self, target) + + if isinstance(self, structs.Texture): + _finalize_texture(self, target) + + if isinstance(self, structs.Metadata): + _finalize_metadata(self, target) + + + return self + + +def pythonize_assimp(type, obj, scene): + """ This method modify the Assimp data structures + to make them easier to work with in Python. + + Supported operations: + - MESH: replace a list of mesh IDs by reference to these meshes + - ADDTRANSFORMATION: add a reference to an object's transformation taken from their associated node. + + :param type: the type of modification to operate (cf above) + :param obj: the input object to modify + :param scene: a reference to the whole scene + """ + + if type == "MESH": + meshes = [] + for i in obj: + meshes.append(scene.meshes[i]) + return meshes + + if type == "ADDTRANSFORMATION": + def getnode(node, name): + if node.name == name: return node + for child in node.children: + n = getnode(child, name) + if n: return n + + node = getnode(scene.rootnode, obj.name) + if not node: + raise AssimpError("Object " + str(obj) + " has no associated node!") + setattr(obj, "transformation", node.transformation) + +def recur_pythonize(node, scene): + ''' + Recursively call pythonize_assimp on + nodes tree to apply several post-processing to + pythonize the assimp datastructures. + ''' + node.meshes = pythonize_assimp("MESH", node.meshes, scene) + for mesh in node.meshes: + mesh.material = scene.materials[mesh.materialindex] + for cam in scene.cameras: + pythonize_assimp("ADDTRANSFORMATION", cam, scene) + for c in node.children: + recur_pythonize(c, scene) + +def release(scene): + ''' + Release resources of a loaded scene. + ''' + _assimp_lib.release(ctypes.pointer(scene)) + +@contextmanager +def load(filename, + file_type = None, + processing = postprocess.aiProcess_Triangulate): + ''' + Load a model into a scene. On failure throws AssimpError. + + Arguments + --------- + filename: Either a filename or a file object to load model from. + If a file object is passed, file_type MUST be specified + Otherwise Assimp has no idea which importer to use. + This is named 'filename' so as to not break legacy code. + processing: assimp postprocessing parameters. Verbose keywords are imported + from postprocessing, and the parameters can be combined bitwise to + generate the final processing value. Note that the default value will + triangulate quad faces. Example of generating other possible values: + processing = (pyassimp.postprocess.aiProcess_Triangulate | + pyassimp.postprocess.aiProcess_OptimizeMeshes) + file_type: string of file extension, such as 'stl' + + Returns + --------- + Scene object with model data + ''' + + if hasattr(filename, 'read'): + # This is the case where a file object has been passed to load. + # It is calling the following function: + # const aiScene* aiImportFileFromMemory(const char* pBuffer, + # unsigned int pLength, + # unsigned int pFlags, + # const char* pHint) + if file_type is None: + raise AssimpError('File type must be specified when passing file objects!') + data = filename.read() + model = _assimp_lib.load_mem(data, + len(data), + processing, + file_type) + else: + # a filename string has been passed + model = _assimp_lib.load(filename.encode(sys.getfilesystemencoding()), processing) + + if not model: + raise AssimpError('Could not import file!') + scene = _init(model.contents) + recur_pythonize(scene.rootnode, scene) + try: + yield scene + finally: + release(scene) + +def export(scene, + filename, + file_type = None, + processing = postprocess.aiProcess_Triangulate): + ''' + Export a scene. On failure throws AssimpError. + + Arguments + --------- + scene: scene to export. + filename: Filename that the scene should be exported to. + file_type: string of file exporter to use. For example "collada". + processing: assimp postprocessing parameters. Verbose keywords are imported + from postprocessing, and the parameters can be combined bitwise to + generate the final processing value. Note that the default value will + triangulate quad faces. Example of generating other possible values: + processing = (pyassimp.postprocess.aiProcess_Triangulate | + pyassimp.postprocess.aiProcess_OptimizeMeshes) + + ''' + + exportStatus = _assimp_lib.export(ctypes.pointer(scene), file_type.encode("ascii"), filename.encode(sys.getfilesystemencoding()), processing) + + if exportStatus != 0: + raise AssimpError('Could not export scene!') + +def export_blob(scene, + file_type = None, + processing = postprocess.aiProcess_Triangulate): + ''' + Export a scene and return a blob in the correct format. On failure throws AssimpError. + + Arguments + --------- + scene: scene to export. + file_type: string of file exporter to use. For example "collada". + processing: assimp postprocessing parameters. Verbose keywords are imported + from postprocessing, and the parameters can be combined bitwise to + generate the final processing value. Note that the default value will + triangulate quad faces. Example of generating other possible values: + processing = (pyassimp.postprocess.aiProcess_Triangulate | + pyassimp.postprocess.aiProcess_OptimizeMeshes) + Returns + --------- + Pointer to structs.ExportDataBlob + ''' + exportBlobPtr = _assimp_lib.export_blob(ctypes.pointer(scene), file_type.encode("ascii"), processing) + + if exportBlobPtr == 0: + raise AssimpError('Could not export scene to blob!') + return exportBlobPtr + +def _finalize_texture(tex, target): + setattr(target, "achformathint", tex.achFormatHint) + if numpy: + data = numpy.array([make_tuple(getattr(tex, "pcData")[i]) for i in range(tex.mWidth * tex.mHeight)]) + else: + data = [make_tuple(getattr(tex, "pcData")[i]) for i in range(tex.mWidth * tex.mHeight)] + setattr(target, "data", data) + +def _finalize_mesh(mesh, target): + """ Building of meshes is a bit specific. + + We override here the various datasets that can + not be process as regular fields. + + For instance, the length of the normals array is + mNumVertices (no mNumNormals is available) + """ + nb_vertices = getattr(mesh, "mNumVertices") + + def fill(name): + mAttr = getattr(mesh, name) + if numpy: + if mAttr: + data = numpy.array([make_tuple(getattr(mesh, name)[i]) for i in range(nb_vertices)], dtype=numpy.float32) + setattr(target, name[1:].lower(), data) + else: + setattr(target, name[1:].lower(), numpy.array([], dtype="float32")) + else: + if mAttr: + data = [make_tuple(getattr(mesh, name)[i]) for i in range(nb_vertices)] + setattr(target, name[1:].lower(), data) + else: + setattr(target, name[1:].lower(), []) + + def fillarray(name): + mAttr = getattr(mesh, name) + + data = [] + for index, mSubAttr in enumerate(mAttr): + if mSubAttr: + data.append([make_tuple(getattr(mesh, name)[index][i]) for i in range(nb_vertices)]) + + if numpy: + setattr(target, name[1:].lower(), numpy.array(data, dtype=numpy.float32)) + else: + setattr(target, name[1:].lower(), data) + + fill("mNormals") + fill("mTangents") + fill("mBitangents") + + fillarray("mColors") + fillarray("mTextureCoords") + + # prepare faces + if numpy: + faces = numpy.array([f.indices for f in target.faces], dtype=numpy.int32) + else: + faces = [f.indices for f in target.faces] + setattr(target, 'faces', faces) + +def _init_metadata_entry(entry): + entry.type = entry.mType + if entry.type == structs.MetadataEntry.AI_BOOL: + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_bool)).contents.value + elif entry.type == structs.MetadataEntry.AI_INT32: + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_int32)).contents.value + elif entry.type == structs.MetadataEntry.AI_UINT64: + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_uint64)).contents.value + elif entry.type == structs.MetadataEntry.AI_FLOAT: + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_float)).contents.value + elif entry.type == structs.MetadataEntry.AI_DOUBLE: + entry.data = ctypes.cast(entry.mData, ctypes.POINTER(ctypes.c_double)).contents.value + elif entry.type == structs.MetadataEntry.AI_AISTRING: + assimp_string = ctypes.cast(entry.mData, ctypes.POINTER(structs.String)).contents + entry.data = _convert_assimp_string(assimp_string) + elif entry.type == structs.MetadataEntry.AI_AIVECTOR3D: + assimp_vector = ctypes.cast(entry.mData, ctypes.POINTER(structs.Vector3D)).contents + entry.data = make_tuple(assimp_vector) + + return entry + +def _finalize_metadata(metadata, target): + """ Building the metadata object is a bit specific. + + Firstly, there are two separate arrays: one with metadata keys and one + with metadata values, and there are no corresponding mNum* attributes, + so the C arrays are not converted to Python arrays using the generic + code in the _init function. + + Secondly, a metadata entry value has to be cast according to declared + metadata entry type. + """ + length = metadata.mNumProperties + setattr(target, 'keys', [str(_convert_assimp_string(metadata.mKeys[i])) for i in range(length)]) + setattr(target, 'values', [_init_metadata_entry(metadata.mValues[i]) for i in range(length)]) + +class PropertyGetter(dict): + def __getitem__(self, key): + semantic = 0 + if isinstance(key, tuple): + key, semantic = key + + return dict.__getitem__(self, (key, semantic)) + + def keys(self): + for k in dict.keys(self): + yield k[0] + + def __iter__(self): + return self.keys() + + def items(self): + for k, v in dict.items(self): + yield k[0], v + + +def _get_properties(properties, length): + """ + Convenience Function to get the material properties as a dict + and values in a python format. + """ + result = {} + #read all properties + for p in [properties[i] for i in range(length)]: + #the name + p = p.contents + key = str(_convert_assimp_string(p.mKey)) + key = (key.split('.')[1], p.mSemantic) + + #the data + if p.mType == 1: + arr = ctypes.cast(p.mData, + ctypes.POINTER(ctypes.c_float * int(p.mDataLength/ctypes.sizeof(ctypes.c_float))) + ).contents + value = [x for x in arr] + elif p.mType == 3: #string can't be an array + value = _convert_assimp_string(ctypes.cast(p.mData, ctypes.POINTER(structs.MaterialPropertyString)).contents) + + elif p.mType == 4: + arr = ctypes.cast(p.mData, + ctypes.POINTER(ctypes.c_int * int(p.mDataLength/ctypes.sizeof(ctypes.c_int))) + ).contents + value = [x for x in arr] + else: + value = p.mData[:p.mDataLength] + + if len(value) == 1: + [value] = value + + result[key] = value + + return PropertyGetter(result) + +def decompose_matrix(matrix): + if not isinstance(matrix, structs.Matrix4x4): + raise AssimpError("pyassimp.decompose_matrix failed: Not a Matrix4x4!") + + scaling = structs.Vector3D() + rotation = structs.Quaternion() + position = structs.Vector3D() + + _assimp_lib.dll.aiDecomposeMatrix(ctypes.pointer(matrix), + ctypes.byref(scaling), + ctypes.byref(rotation), + ctypes.byref(position)) + return scaling._init(), rotation._init(), position._init() + diff --git a/libs/assimp/port/PyAssimp/pyassimp/errors.py b/libs/assimp/port/PyAssimp/pyassimp/errors.py new file mode 100644 index 0000000..e017b51 --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/errors.py @@ -0,0 +1,11 @@ +#-*- coding: UTF-8 -*- + +""" +All possible errors. +""" + +class AssimpError(BaseException): + """ + If an internal error occurs. + """ + pass diff --git a/libs/assimp/port/PyAssimp/pyassimp/formats.py b/libs/assimp/port/PyAssimp/pyassimp/formats.py new file mode 100644 index 0000000..5d454e5 --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/formats.py @@ -0,0 +1,41 @@ +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 diff --git a/libs/assimp/port/PyAssimp/pyassimp/helper.py b/libs/assimp/port/PyAssimp/pyassimp/helper.py new file mode 100644 index 0000000..7c14f60 --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/helper.py @@ -0,0 +1,283 @@ +#-*- coding: UTF-8 -*- + +""" +Some fancy helper functions. +""" + +import os +import ctypes +import operator + +from distutils.sysconfig import get_python_lib +import re +import sys + +try: import numpy +except ImportError: numpy = None + +import logging;logger = logging.getLogger("pyassimp") + +from .errors import AssimpError + +additional_dirs, ext_whitelist = [],[] + +# populate search directories and lists of allowed file extensions +# depending on the platform we're running on. +if os.name=='posix': + additional_dirs.append('./') + additional_dirs.append('/usr/lib/') + additional_dirs.append('/usr/lib/x86_64-linux-gnu/') + additional_dirs.append('/usr/lib/aarch64-linux-gnu/') + additional_dirs.append('/usr/local/lib/') + + if 'LD_LIBRARY_PATH' in os.environ: + additional_dirs.extend([item for item in os.environ['LD_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): + cur_path = get_python_lib() + pattern = re.compile('.*\/lib\/') + conda_lib = pattern.match(cur_path).group() + logger.info("Adding Anaconda lib path:"+ conda_lib) + additional_dirs.append(conda_lib) + + # note - this won't catch libassimp.so.N.n, but + # currently there's always a symlink called + # libassimp.so in /usr/local/lib. + ext_whitelist.append('.so') + # libassimp.dylib in /usr/local/lib + ext_whitelist.append('.dylib') + +elif os.name=='nt': + ext_whitelist.append('.dll') + path_dirs = os.environ['PATH'].split(';') + additional_dirs.extend(path_dirs) + +def vec2tuple(x): + """ Converts a VECTOR3D to a Tuple """ + return (x.x, x.y, x.z) + +def transform(vector3, matrix4x4): + """ Apply a transformation matrix on a 3D vector. + + :param vector3: array with 3 elements + :param matrix4x4: 4x4 matrix + """ + if numpy: + return numpy.dot(matrix4x4, numpy.append(vector3, 1.)) + else: + m0,m1,m2,m3 = matrix4x4; x,y,z = vector3 + return [ + m0[0]*x + m0[1]*y + m0[2]*z + m0[3], + m1[0]*x + m1[1]*y + m1[2]*z + m1[3], + m2[0]*x + m2[1]*y + m2[2]*z + m2[3], + m3[0]*x + m3[1]*y + m3[2]*z + m3[3] + ] + +def _inv(matrix4x4): + m0,m1,m2,m3 = matrix4x4 + + det = m0[3]*m1[2]*m2[1]*m3[0] - m0[2]*m1[3]*m2[1]*m3[0] - \ + m0[3]*m1[1]*m2[2]*m3[0] + m0[1]*m1[3]*m2[2]*m3[0] + \ + m0[2]*m1[1]*m2[3]*m3[0] - m0[1]*m1[2]*m2[3]*m3[0] - \ + m0[3]*m1[2]*m2[0]*m3[1] + m0[2]*m1[3]*m2[0]*m3[1] + \ + m0[3]*m1[0]*m2[2]*m3[1] - m0[0]*m1[3]*m2[2]*m3[1] - \ + m0[2]*m1[0]*m2[3]*m3[1] + m0[0]*m1[2]*m2[3]*m3[1] + \ + m0[3]*m1[1]*m2[0]*m3[2] - m0[1]*m1[3]*m2[0]*m3[2] - \ + m0[3]*m1[0]*m2[1]*m3[2] + m0[0]*m1[3]*m2[1]*m3[2] + \ + m0[1]*m1[0]*m2[3]*m3[2] - m0[0]*m1[1]*m2[3]*m3[2] - \ + m0[2]*m1[1]*m2[0]*m3[3] + m0[1]*m1[2]*m2[0]*m3[3] + \ + m0[2]*m1[0]*m2[1]*m3[3] - m0[0]*m1[2]*m2[1]*m3[3] - \ + m0[1]*m1[0]*m2[2]*m3[3] + m0[0]*m1[1]*m2[2]*m3[3] + + return[[( m1[2]*m2[3]*m3[1] - m1[3]*m2[2]*m3[1] + m1[3]*m2[1]*m3[2] - m1[1]*m2[3]*m3[2] - m1[2]*m2[1]*m3[3] + m1[1]*m2[2]*m3[3]) /det, + ( m0[3]*m2[2]*m3[1] - m0[2]*m2[3]*m3[1] - m0[3]*m2[1]*m3[2] + m0[1]*m2[3]*m3[2] + m0[2]*m2[1]*m3[3] - m0[1]*m2[2]*m3[3]) /det, + ( m0[2]*m1[3]*m3[1] - m0[3]*m1[2]*m3[1] + m0[3]*m1[1]*m3[2] - m0[1]*m1[3]*m3[2] - m0[2]*m1[1]*m3[3] + m0[1]*m1[2]*m3[3]) /det, + ( m0[3]*m1[2]*m2[1] - m0[2]*m1[3]*m2[1] - m0[3]*m1[1]*m2[2] + m0[1]*m1[3]*m2[2] + m0[2]*m1[1]*m2[3] - m0[1]*m1[2]*m2[3]) /det], + [( m1[3]*m2[2]*m3[0] - m1[2]*m2[3]*m3[0] - m1[3]*m2[0]*m3[2] + m1[0]*m2[3]*m3[2] + m1[2]*m2[0]*m3[3] - m1[0]*m2[2]*m3[3]) /det, + ( m0[2]*m2[3]*m3[0] - m0[3]*m2[2]*m3[0] + m0[3]*m2[0]*m3[2] - m0[0]*m2[3]*m3[2] - m0[2]*m2[0]*m3[3] + m0[0]*m2[2]*m3[3]) /det, + ( m0[3]*m1[2]*m3[0] - m0[2]*m1[3]*m3[0] - m0[3]*m1[0]*m3[2] + m0[0]*m1[3]*m3[2] + m0[2]*m1[0]*m3[3] - m0[0]*m1[2]*m3[3]) /det, + ( m0[2]*m1[3]*m2[0] - m0[3]*m1[2]*m2[0] + m0[3]*m1[0]*m2[2] - m0[0]*m1[3]*m2[2] - m0[2]*m1[0]*m2[3] + m0[0]*m1[2]*m2[3]) /det], + [( m1[1]*m2[3]*m3[0] - m1[3]*m2[1]*m3[0] + m1[3]*m2[0]*m3[1] - m1[0]*m2[3]*m3[1] - m1[1]*m2[0]*m3[3] + m1[0]*m2[1]*m3[3]) /det, + ( m0[3]*m2[1]*m3[0] - m0[1]*m2[3]*m3[0] - m0[3]*m2[0]*m3[1] + m0[0]*m2[3]*m3[1] + m0[1]*m2[0]*m3[3] - m0[0]*m2[1]*m3[3]) /det, + ( m0[1]*m1[3]*m3[0] - m0[3]*m1[1]*m3[0] + m0[3]*m1[0]*m3[1] - m0[0]*m1[3]*m3[1] - m0[1]*m1[0]*m3[3] + m0[0]*m1[1]*m3[3]) /det, + ( m0[3]*m1[1]*m2[0] - m0[1]*m1[3]*m2[0] - m0[3]*m1[0]*m2[1] + m0[0]*m1[3]*m2[1] + m0[1]*m1[0]*m2[3] - m0[0]*m1[1]*m2[3]) /det], + [( m1[2]*m2[1]*m3[0] - m1[1]*m2[2]*m3[0] - m1[2]*m2[0]*m3[1] + m1[0]*m2[2]*m3[1] + m1[1]*m2[0]*m3[2] - m1[0]*m2[1]*m3[2]) /det, + ( m0[1]*m2[2]*m3[0] - m0[2]*m2[1]*m3[0] + m0[2]*m2[0]*m3[1] - m0[0]*m2[2]*m3[1] - m0[1]*m2[0]*m3[2] + m0[0]*m2[1]*m3[2]) /det, + ( m0[2]*m1[1]*m3[0] - m0[1]*m1[2]*m3[0] - m0[2]*m1[0]*m3[1] + m0[0]*m1[2]*m3[1] + m0[1]*m1[0]*m3[2] - m0[0]*m1[1]*m3[2]) /det, + ( m0[1]*m1[2]*m2[0] - m0[2]*m1[1]*m2[0] + m0[2]*m1[0]*m2[1] - m0[0]*m1[2]*m2[1] - m0[1]*m1[0]*m2[2] + m0[0]*m1[1]*m2[2]) /det]] + +def get_bounding_box(scene): + bb_min = [1e10, 1e10, 1e10] # x,y,z + bb_max = [-1e10, -1e10, -1e10] # x,y,z + inv = numpy.linalg.inv if numpy else _inv + return get_bounding_box_for_node(scene.rootnode, bb_min, bb_max, inv(scene.rootnode.transformation)) + +def get_bounding_box_for_node(node, bb_min, bb_max, transformation): + + if numpy: + transformation = numpy.dot(transformation, node.transformation) + else: + t0,t1,t2,t3 = transformation + T0,T1,T2,T3 = node.transformation + transformation = [ [ + t0[0]*T0[0] + t0[1]*T1[0] + t0[2]*T2[0] + t0[3]*T3[0], + t0[0]*T0[1] + t0[1]*T1[1] + t0[2]*T2[1] + t0[3]*T3[1], + t0[0]*T0[2] + t0[1]*T1[2] + t0[2]*T2[2] + t0[3]*T3[2], + t0[0]*T0[3] + t0[1]*T1[3] + t0[2]*T2[3] + t0[3]*T3[3] + ],[ + t1[0]*T0[0] + t1[1]*T1[0] + t1[2]*T2[0] + t1[3]*T3[0], + t1[0]*T0[1] + t1[1]*T1[1] + t1[2]*T2[1] + t1[3]*T3[1], + t1[0]*T0[2] + t1[1]*T1[2] + t1[2]*T2[2] + t1[3]*T3[2], + t1[0]*T0[3] + t1[1]*T1[3] + t1[2]*T2[3] + t1[3]*T3[3] + ],[ + t2[0]*T0[0] + t2[1]*T1[0] + t2[2]*T2[0] + t2[3]*T3[0], + t2[0]*T0[1] + t2[1]*T1[1] + t2[2]*T2[1] + t2[3]*T3[1], + t2[0]*T0[2] + t2[1]*T1[2] + t2[2]*T2[2] + t2[3]*T3[2], + t2[0]*T0[3] + t2[1]*T1[3] + t2[2]*T2[3] + t2[3]*T3[3] + ],[ + t3[0]*T0[0] + t3[1]*T1[0] + t3[2]*T2[0] + t3[3]*T3[0], + t3[0]*T0[1] + t3[1]*T1[1] + t3[2]*T2[1] + t3[3]*T3[1], + t3[0]*T0[2] + t3[1]*T1[2] + t3[2]*T2[2] + t3[3]*T3[2], + t3[0]*T0[3] + t3[1]*T1[3] + t3[2]*T2[3] + t3[3]*T3[3] + ] ] + + for mesh in node.meshes: + for v in mesh.vertices: + v = transform(v, transformation) + bb_min[0] = min(bb_min[0], v[0]) + bb_min[1] = min(bb_min[1], v[1]) + bb_min[2] = min(bb_min[2], v[2]) + bb_max[0] = max(bb_max[0], v[0]) + bb_max[1] = max(bb_max[1], v[1]) + bb_max[2] = max(bb_max[2], v[2]) + + + for child in node.children: + bb_min, bb_max = get_bounding_box_for_node(child, bb_min, bb_max, transformation) + + return bb_min, bb_max + +def try_load_functions(library_path, dll): + ''' + Try to bind to aiImportFile and aiReleaseImport + + Arguments + --------- + library_path: path to current lib + dll: ctypes handle to library + + Returns + --------- + If unsuccessful: + None + If successful: + Tuple containing (library_path, + load from filename function, + load from memory function, + export to filename function, + export to blob function, + release function, + ctypes handle to assimp library) + ''' + + try: + load = dll.aiImportFile + release = dll.aiReleaseImport + load_mem = dll.aiImportFileFromMemory + export = dll.aiExportScene + export2blob = dll.aiExportSceneToBlob + except AttributeError: + #OK, this is a library, but it doesn't have the functions we need + return None + + # library found! + from .structs import Scene, ExportDataBlob + load.restype = ctypes.POINTER(Scene) + load_mem.restype = ctypes.POINTER(Scene) + export2blob.restype = ctypes.POINTER(ExportDataBlob) + return (library_path, load, load_mem, export, export2blob, release, dll) + +def search_library(): + ''' + Loads the assimp library. + Throws exception AssimpError if no library_path is found + + Returns: tuple, (load from filename function, + load from memory function, + export to filename function, + export to blob function, + release function, + dll) + ''' + #this path + folder = os.path.dirname(__file__) + + # silence 'DLL not found' message boxes on win + try: + ctypes.windll.kernel32.SetErrorMode(0x8007) + except AttributeError: + pass + + candidates = [] + # test every file + for curfolder in [folder]+additional_dirs: + if os.path.isdir(curfolder): + for filename in os.listdir(curfolder): + # our minimum requirement for candidates is that + # they should contain 'assimp' somewhere in + # their name + if filename.lower().find('assimp')==-1 : + continue + is_out=1 + for et in ext_whitelist: + if et in filename.lower(): + is_out=0 + break + if is_out: + continue + + library_path = os.path.join(curfolder, filename) + logger.debug('Try ' + library_path) + try: + dll = ctypes.cdll.LoadLibrary(library_path) + except Exception as e: + logger.warning(str(e)) + # OK, this except is evil. But different OSs will throw different + # errors. So just ignore any errors. + continue + # see if the functions we need are in the dll + loaded = try_load_functions(library_path, dll) + if loaded: candidates.append(loaded) + + if not candidates: + # no library found + raise AssimpError("assimp library not found") + else: + # get the newest library_path + candidates = map(lambda x: (os.lstat(x[0])[-2], x), candidates) + res = max(candidates, key=operator.itemgetter(0))[1] + logger.debug('Using assimp library located at ' + res[0]) + + # XXX: if there are 1000 dll/so files containing 'assimp' + # in their name, do we have all of them in our address + # space now until gc kicks in? + + # XXX: take version postfix of the .so on linux? + return res[1:] + +def hasattr_silent(object, name): + """ + Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2) + functionality of silently catching exceptions. + + Returns the result of hasatter() or False if an exception was raised. + """ + + try: + if not object: + return False + return hasattr(object, name) + except AttributeError: + return False diff --git a/libs/assimp/port/PyAssimp/pyassimp/material.py b/libs/assimp/port/PyAssimp/pyassimp/material.py new file mode 100644 index 0000000..a36e50a --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/material.py @@ -0,0 +1,89 @@ +# Dummy value. +# +# No texture, but the value to be used as 'texture semantic' +# (#aiMaterialProperty::mSemantic) for all material properties +# # not* related to textures. +# +aiTextureType_NONE = 0x0 + +# The texture is combined with the result of the diffuse +# lighting equation. +# +aiTextureType_DIFFUSE = 0x1 + +# The texture is combined with the result of the specular +# lighting equation. +# +aiTextureType_SPECULAR = 0x2 + +# The texture is combined with the result of the ambient +# lighting equation. +# +aiTextureType_AMBIENT = 0x3 + +# The texture is added to the result of the lighting +# calculation. It isn't influenced by incoming light. +# +aiTextureType_EMISSIVE = 0x4 + +# The texture is a height map. +# +# By convention, higher gray-scale values stand for +# higher elevations from the base height. +# +aiTextureType_HEIGHT = 0x5 + +# The texture is a (tangent space) normal-map. +# +# Again, there are several conventions for tangent-space +# normal maps. Assimp does (intentionally) not +# distinguish here. +# +aiTextureType_NORMALS = 0x6 + +# The texture defines the glossiness of the material. +# +# The glossiness is in fact the exponent of the specular +# (phong) lighting equation. Usually there is a conversion +# function defined to map the linear color values in the +# texture to a suitable exponent. Have fun. +# +aiTextureType_SHININESS = 0x7 + +# The texture defines per-pixel opacity. +# +# Usually 'white' means opaque and 'black' means +# 'transparency'. Or quite the opposite. Have fun. +# +aiTextureType_OPACITY = 0x8 + +# Displacement texture +# +# The exact purpose and format is application-dependent. +# Higher color values stand for higher vertex displacements. +# +aiTextureType_DISPLACEMENT = 0x9 + +# Lightmap texture (aka Ambient Occlusion) +# +# Both 'Lightmaps' and dedicated 'ambient occlusion maps' are +# covered by this material property. The texture contains a +# scaling value for the final color value of a pixel. Its +# intensity is not affected by incoming light. +# +aiTextureType_LIGHTMAP = 0xA + +# Reflection texture +# +# Contains the color of a perfect mirror reflection. +# Rarely used, almost never for real-time applications. +# +aiTextureType_REFLECTION = 0xB + +# Unknown texture +# +# A texture reference that does not match any of the definitions +# above is considered to be 'unknown'. It is still imported +# but is excluded from any further postprocessing. +# +aiTextureType_UNKNOWN = 0xC diff --git a/libs/assimp/port/PyAssimp/pyassimp/postprocess.py b/libs/assimp/port/PyAssimp/pyassimp/postprocess.py new file mode 100644 index 0000000..0c55d67 --- /dev/null +++ b/libs/assimp/port/PyAssimp/pyassimp/postprocess.py @@ -0,0 +1,530 @@ +#
Calculates the tangents and bitangents for the imported meshes. +# +# Does nothing if a mesh does not have normals. You might want this post +# processing step to be executed if you plan to use tangent space calculations +# such as normal mapping applied to the meshes. There's a config setting, +# #AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE, which allows you to specify +# a maximum smoothing angle for the algorithm. However, usually you'll +# want to leave it at the default value. +# +aiProcess_CalcTangentSpace = 0x1 + +##
Identifies and joins identical vertex data sets within all +# imported meshes. +# +# After this step is run, each mesh contains unique vertices, +# so a vertex may be used by multiple faces. You usually want +# to use this post processing step. If your application deals with +# indexed geometry, this step is compulsory or you'll just waste rendering +# time. If this flag is not specified, no vertices are referenced by +# more than one face and no index buffer is required for rendering. +# +aiProcess_JoinIdenticalVertices = 0x2 + +##
Converts all the imported data to a left-handed coordinate space. +# +# By default the data is returned in a right-handed coordinate space (which +# OpenGL prefers). In this space, +X points to the right, +# +Z points towards the viewer, and +Y points upwards. In the DirectX +# coordinate space +X points to the right, +Y points upwards, and +Z points +# away from the viewer. +# +# You'll probably want to consider this flag if you use Direct3D for +# rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this +# setting and bundles all conversions typically required for D3D-based +# applications. +# +aiProcess_MakeLeftHanded = 0x4 + +##
Triangulates all faces of all meshes. +# +# By default the imported mesh data might contain faces with more than 3 +# indices. For rendering you'll usually want all faces to be triangles. +# This post processing step splits up faces with more than 3 indices into +# triangles. Line and point primitives are #not# modified! If you want +# 'triangles only' with no other kinds of primitives, try the following +# solution: +#