summaryrefslogtreecommitdiff
path: root/thirdparty
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-03-06 16:01:33 +0100
committerGitHub <noreply@github.com>2020-03-06 16:01:33 +0100
commit62afc3c12c2acfbd5f9bbaf93f86111e4d2f3ce0 (patch)
tree501c31a479e01cdca37377404ca728f36a0232d2 /thirdparty
parent54fa07e7f01b21bc69309172b439bc05db571977 (diff)
parent78b22393a8dd182ee56d0448ed77ba4430de5e75 (diff)
Merge pull request #36852 from akien-mga/assimp-unbundle
assimp: Clean and document buildsystem, update to upstream 0201fc5
Diffstat (limited to 'thirdparty')
-rw-r--r--thirdparty/README.md13
-rw-r--r--thirdparty/assimp/LICENSE2
-rw-r--r--thirdparty/assimp/code/CApi/AssimpCExport.cpp2
-rw-r--r--thirdparty/assimp/code/CApi/CInterfaceIOWrapper.cpp2
-rw-r--r--thirdparty/assimp/code/CApi/CInterfaceIOWrapper.h2
-rw-r--r--thirdparty/assimp/code/Common/Assimp.cpp2
-rw-r--r--thirdparty/assimp/code/Common/BaseImporter.cpp9
-rw-r--r--thirdparty/assimp/code/Common/BaseProcess.cpp2
-rw-r--r--thirdparty/assimp/code/Common/BaseProcess.h2
-rw-r--r--thirdparty/assimp/code/Common/Bitmap.cpp2
-rw-r--r--thirdparty/assimp/code/Common/CreateAnimMesh.cpp2
-rw-r--r--thirdparty/assimp/code/Common/DefaultIOStream.cpp35
-rw-r--r--thirdparty/assimp/code/Common/DefaultIOSystem.cpp2
-rw-r--r--thirdparty/assimp/code/Common/DefaultLogger.cpp6
-rw-r--r--thirdparty/assimp/code/Common/DefaultProgressHandler.h2
-rw-r--r--thirdparty/assimp/code/Common/Exporter.cpp134
-rw-r--r--thirdparty/assimp/code/Common/FileLogStream.h2
-rw-r--r--thirdparty/assimp/code/Common/FileSystemFilter.h2
-rw-r--r--thirdparty/assimp/code/Common/Importer.cpp292
-rw-r--r--thirdparty/assimp/code/Common/Importer.h2
-rw-r--r--thirdparty/assimp/code/Common/ImporterRegistry.cpp2
-rw-r--r--thirdparty/assimp/code/Common/PolyTools.h2
-rw-r--r--thirdparty/assimp/code/Common/PostStepRegistry.cpp2
-rw-r--r--thirdparty/assimp/code/Common/RemoveComments.cpp2
-rw-r--r--thirdparty/assimp/code/Common/SGSpatialSort.cpp2
-rw-r--r--thirdparty/assimp/code/Common/SceneCombiner.cpp3
-rw-r--r--thirdparty/assimp/code/Common/ScenePreprocessor.cpp11
-rw-r--r--thirdparty/assimp/code/Common/ScenePreprocessor.h2
-rw-r--r--thirdparty/assimp/code/Common/ScenePrivate.h2
-rw-r--r--thirdparty/assimp/code/Common/SkeletonMeshBuilder.cpp2
-rw-r--r--thirdparty/assimp/code/Common/SpatialSort.cpp2
-rw-r--r--thirdparty/assimp/code/Common/SplitByBoneCountProcess.cpp42
-rw-r--r--thirdparty/assimp/code/Common/SplitByBoneCountProcess.h2
-rw-r--r--thirdparty/assimp/code/Common/StandardShapes.cpp2
-rw-r--r--thirdparty/assimp/code/Common/StdOStreamLogStream.h2
-rw-r--r--thirdparty/assimp/code/Common/Subdivision.cpp2
-rw-r--r--thirdparty/assimp/code/Common/TargetAnimation.cpp2
-rw-r--r--thirdparty/assimp/code/Common/TargetAnimation.h2
-rw-r--r--thirdparty/assimp/code/Common/Version.cpp10
-rw-r--r--thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp6
-rw-r--r--thirdparty/assimp/code/Common/VertexTriangleAdjacency.h2
-rw-r--r--thirdparty/assimp/code/Common/Win32DebugLogStream.h2
-rw-r--r--thirdparty/assimp/code/Common/assbin_chunks.h2
-rw-r--r--thirdparty/assimp/code/Common/material.cpp97
-rw-r--r--thirdparty/assimp/code/Common/scene.cpp2
-rw-r--r--thirdparty/assimp/code/Common/simd.cpp2
-rw-r--r--thirdparty/assimp/code/Common/simd.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXAnimation.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXBinaryTokenizer.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXCommon.h9
-rw-r--r--thirdparty/assimp/code/FBX/FBXCompileConfig.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXConverter.cpp37
-rw-r--r--thirdparty/assimp/code/FBX/FBXConverter.h4
-rw-r--r--thirdparty/assimp/code/FBX/FBXDeformer.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXDocument.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXDocument.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXDocumentUtil.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXDocumentUtil.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXExportNode.cpp16
-rw-r--r--thirdparty/assimp/code/FBX/FBXExportNode.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXExportProperty.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXExportProperty.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXExporter.cpp11
-rw-r--r--thirdparty/assimp/code/FBX/FBXExporter.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXImportSettings.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXImporter.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXImporter.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXMaterial.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp33
-rw-r--r--thirdparty/assimp/code/FBX/FBXMeshGeometry.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXModel.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXNodeAttribute.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXParser.cpp10
-rw-r--r--thirdparty/assimp/code/FBX/FBXParser.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXProperties.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXProperties.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXTokenizer.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXTokenizer.h2
-rw-r--r--thirdparty/assimp/code/FBX/FBXUtil.cpp2
-rw-r--r--thirdparty/assimp/code/FBX/FBXUtil.h2
-rw-r--r--thirdparty/assimp/code/Material/MaterialSystem.cpp14
-rw-r--r--thirdparty/assimp/code/Material/MaterialSystem.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ArmaturePopulate.cpp294
-rw-r--r--thirdparty/assimp/code/PostProcessing/ArmaturePopulate.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.h7
-rw-r--r--thirdparty/assimp/code/PostProcessing/DeboneProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/DeboneProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.cpp5
-rw-r--r--thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FindDegenerates.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FindDegenerates.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FindInstancesProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FindInstancesProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FixNormalsStep.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/FixNormalsStep.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/OptimizeGraph.cpp515
-rw-r--r--thirdparty/assimp/code/PostProcessing/OptimizeGraph.h8
-rw-r--r--thirdparty/assimp/code/PostProcessing/OptimizeMeshes.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/OptimizeMeshes.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/PretransformVertices.cpp1174
-rw-r--r--thirdparty/assimp/code/PostProcessing/PretransformVertices.h164
-rw-r--r--thirdparty/assimp/code/PostProcessing/ProcessHelper.cpp42
-rw-r--r--thirdparty/assimp/code/PostProcessing/ProcessHelper.h8
-rw-r--r--thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/RemoveVCProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/RemoveVCProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ScaleProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ScaleProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/TextureTransform.cpp10
-rw-r--r--thirdparty/assimp/code/PostProcessing/TextureTransform.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/TriangulateProcess.cpp2
-rw-r--r--thirdparty/assimp/code/PostProcessing/TriangulateProcess.h2
-rw-r--r--thirdparty/assimp/code/PostProcessing/ValidateDataStructure.cpp23
-rw-r--r--thirdparty/assimp/code/PostProcessing/ValidateDataStructure.h2
-rw-r--r--thirdparty/assimp/contrib/utf8cpp/doc/ReleaseNotes12
-rw-r--r--thirdparty/assimp/contrib/utf8cpp/doc/utf8cpp.html1789
-rw-r--r--thirdparty/assimp/include/assimp/BaseImporter.h2
-rw-r--r--thirdparty/assimp/include/assimp/Bitmap.h2
-rw-r--r--thirdparty/assimp/include/assimp/BlobIOSystem.h2
-rw-r--r--thirdparty/assimp/include/assimp/ByteSwapper.h2
-rw-r--r--thirdparty/assimp/include/assimp/CreateAnimMesh.h2
-rw-r--r--thirdparty/assimp/include/assimp/DefaultIOStream.h2
-rw-r--r--thirdparty/assimp/include/assimp/DefaultIOSystem.h2
-rw-r--r--thirdparty/assimp/include/assimp/DefaultLogger.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/Defines.h2
-rw-r--r--thirdparty/assimp/include/assimp/Exceptional.h12
-rw-r--r--thirdparty/assimp/include/assimp/Exporter.hpp4
-rw-r--r--thirdparty/assimp/include/assimp/GenericProperty.h2
-rw-r--r--thirdparty/assimp/include/assimp/Hash.h2
-rw-r--r--thirdparty/assimp/include/assimp/IOStream.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/IOStreamBuffer.h2
-rw-r--r--thirdparty/assimp/include/assimp/IOSystem.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/Importer.hpp6
-rw-r--r--thirdparty/assimp/include/assimp/LineSplitter.h4
-rw-r--r--thirdparty/assimp/include/assimp/LogAux.h2
-rw-r--r--thirdparty/assimp/include/assimp/LogStream.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/Logger.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/MathFunctions.h2
-rw-r--r--thirdparty/assimp/include/assimp/MemoryIOWrapper.h2
-rw-r--r--thirdparty/assimp/include/assimp/NullLogger.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/ParsingUtils.h2
-rw-r--r--thirdparty/assimp/include/assimp/Profiler.h2
-rw-r--r--thirdparty/assimp/include/assimp/ProgressHandler.hpp2
-rw-r--r--thirdparty/assimp/include/assimp/RemoveComments.h2
-rw-r--r--thirdparty/assimp/include/assimp/SGSpatialSort.h2
-rw-r--r--thirdparty/assimp/include/assimp/SceneCombiner.h2
-rw-r--r--thirdparty/assimp/include/assimp/SkeletonMeshBuilder.h2
-rw-r--r--thirdparty/assimp/include/assimp/SmoothingGroups.h2
-rw-r--r--thirdparty/assimp/include/assimp/SmoothingGroups.inl2
-rw-r--r--thirdparty/assimp/include/assimp/SpatialSort.h2
-rw-r--r--thirdparty/assimp/include/assimp/StandardShapes.h2
-rw-r--r--thirdparty/assimp/include/assimp/StreamReader.h2
-rw-r--r--thirdparty/assimp/include/assimp/StreamWriter.h2
-rw-r--r--thirdparty/assimp/include/assimp/StringComparison.h2
-rw-r--r--thirdparty/assimp/include/assimp/StringUtils.h2
-rw-r--r--thirdparty/assimp/include/assimp/Subdivision.h2
-rw-r--r--thirdparty/assimp/include/assimp/TinyFormatter.h2
-rw-r--r--thirdparty/assimp/include/assimp/Vertex.h2
-rw-r--r--thirdparty/assimp/include/assimp/XMLTools.h2
-rw-r--r--thirdparty/assimp/include/assimp/aabb.h2
-rw-r--r--thirdparty/assimp/include/assimp/ai_assert.h2
-rw-r--r--thirdparty/assimp/include/assimp/anim.h2
-rw-r--r--thirdparty/assimp/include/assimp/camera.h2
-rw-r--r--thirdparty/assimp/include/assimp/cexport.h2
-rw-r--r--thirdparty/assimp/include/assimp/cfileio.h2
-rw-r--r--thirdparty/assimp/include/assimp/cimport.h2
-rw-r--r--thirdparty/assimp/include/assimp/color4.h2
-rw-r--r--thirdparty/assimp/include/assimp/color4.inl2
-rw-r--r--thirdparty/assimp/include/assimp/commonMetaData.h67
-rw-r--r--thirdparty/assimp/include/assimp/config.h (renamed from thirdparty/assimp/assimp/config.h)360
-rw-r--r--thirdparty/assimp/include/assimp/config.h.in69
-rw-r--r--thirdparty/assimp/include/assimp/defs.h8
-rw-r--r--thirdparty/assimp/include/assimp/importerdesc.h2
-rw-r--r--thirdparty/assimp/include/assimp/light.h2
-rw-r--r--thirdparty/assimp/include/assimp/material.h6
-rw-r--r--thirdparty/assimp/include/assimp/material.inl2
-rw-r--r--thirdparty/assimp/include/assimp/matrix3x3.h2
-rw-r--r--thirdparty/assimp/include/assimp/matrix3x3.inl2
-rw-r--r--thirdparty/assimp/include/assimp/matrix4x4.h2
-rw-r--r--thirdparty/assimp/include/assimp/matrix4x4.inl2
-rw-r--r--thirdparty/assimp/include/assimp/mesh.h2
-rw-r--r--thirdparty/assimp/include/assimp/metadata.h23
-rw-r--r--thirdparty/assimp/include/assimp/pbrmaterial.h2
-rw-r--r--thirdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h2
-rw-r--r--thirdparty/assimp/include/assimp/postprocess.h2
-rw-r--r--thirdparty/assimp/include/assimp/qnan.h2
-rw-r--r--thirdparty/assimp/include/assimp/quaternion.h2
-rw-r--r--thirdparty/assimp/include/assimp/quaternion.inl2
-rw-r--r--thirdparty/assimp/include/assimp/scene.h2
-rw-r--r--thirdparty/assimp/include/assimp/texture.h5
-rw-r--r--thirdparty/assimp/include/assimp/types.h2
-rw-r--r--thirdparty/assimp/include/assimp/vector2.h2
-rw-r--r--thirdparty/assimp/include/assimp/vector2.inl2
-rw-r--r--thirdparty/assimp/include/assimp/vector3.h2
-rw-r--r--thirdparty/assimp/include/assimp/vector3.inl2
-rw-r--r--thirdparty/assimp/include/assimp/version.h9
-rw-r--r--thirdparty/assimp/revision.h (renamed from thirdparty/assimp/code/revision.h)6
225 files changed, 2209 insertions, 3571 deletions
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 2099bd773f..8f8d212a82 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -9,9 +9,20 @@ Subcategories (`###` level) where needed are separated by a single empty line.
## assimp
- Upstream: http://github.com/assimp/assimp
-- Version: git (308db73d0b3c2d1870cd3e465eaa283692a4cf23)
+- Version: git (0201fc57dca48910ca7f9fdf7457534ea6a57efc, 2020)
- License: BSD-3-Clause
+Files extracted from upstream source:
+
+- Run `cmake .` in root folder to generate files
+- `code/{CApi,Common,FBX,Material,PostProcessing}/`
+- `contrib/utf8cpp/source/`
+- `include/`
+- `revision.h`
+- `CREDITS` and `LICENSE` files
+- `rm -f code/Common/ZipArchiveIOSystem.cpp include/assimp/ZipArchiveIOSystem.h
+ include/assimp/irrXMLWrapper.h`
+
## basis_universal
diff --git a/thirdparty/assimp/LICENSE b/thirdparty/assimp/LICENSE
index 262606aff3..dc8e24706a 100644
--- a/thirdparty/assimp/LICENSE
+++ b/thirdparty/assimp/LICENSE
@@ -1,6 +1,6 @@
Open Asset Import Library (assimp)
-Copyright (c) 2006-2016, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/thirdparty/assimp/code/CApi/AssimpCExport.cpp b/thirdparty/assimp/code/CApi/AssimpCExport.cpp
index 7557edcfc6..137cc2894c 100644
--- a/thirdparty/assimp/code/CApi/AssimpCExport.cpp
+++ b/thirdparty/assimp/code/CApi/AssimpCExport.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.cpp b/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.cpp
index 5a3a49565a..91dd07f377 100644
--- a/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.cpp
+++ b/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.h b/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.h
index 2162320302..2988474945 100644
--- a/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.h
+++ b/thirdparty/assimp/code/CApi/CInterfaceIOWrapper.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/Assimp.cpp b/thirdparty/assimp/code/Common/Assimp.cpp
index 178b2c01d0..66588f0bc6 100644
--- a/thirdparty/assimp/code/Common/Assimp.cpp
+++ b/thirdparty/assimp/code/Common/Assimp.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/BaseImporter.cpp b/thirdparty/assimp/code/Common/BaseImporter.cpp
index 5c1e605549..8d7b029baa 100644
--- a/thirdparty/assimp/code/Common/BaseImporter.cpp
+++ b/thirdparty/assimp/code/Common/BaseImporter.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -191,7 +191,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions) {
}
std::unique_ptr<IOStream> pStream (pIOHandler->Open(pFile));
- if (pStream.get() ) {
+ if (pStream) {
// read 200 characters from the file
std::unique_ptr<char[]> _buffer (new char[searchBytes+1 /* for the '\0' */]);
char *buffer( _buffer.get() );
@@ -283,7 +283,6 @@ std::string BaseImporter::GetExtension( const std::string& file ) {
return "";
}
-
// thanks to Andy Maloney for the hint
std::string ret = file.substr( pos + 1 );
std::transform( ret.begin(), ret.end(), ret.begin(), ToLower<char>);
@@ -309,7 +308,7 @@ std::string BaseImporter::GetExtension( const std::string& file ) {
};
magic = reinterpret_cast<const char*>(_magic);
std::unique_ptr<IOStream> pStream (pIOHandler->Open(pFile));
- if (pStream.get() ) {
+ if (pStream) {
// skip to offset
pStream->Seek(offset,aiOrigin_SET);
@@ -603,7 +602,7 @@ unsigned int BatchLoader::AddLoadRequest(const std::string& file,
}
// no, we don't have it. So add it to the queue ...
- m_data->requests.push_back(LoadRequest(file,steps,map, m_data->next_id));
+ m_data->requests.emplace_back(file, steps, map, m_data->next_id);
return m_data->next_id++;
}
diff --git a/thirdparty/assimp/code/Common/BaseProcess.cpp b/thirdparty/assimp/code/Common/BaseProcess.cpp
index e247be418d..974af68db0 100644
--- a/thirdparty/assimp/code/Common/BaseProcess.cpp
+++ b/thirdparty/assimp/code/Common/BaseProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/BaseProcess.h b/thirdparty/assimp/code/Common/BaseProcess.h
index 4d5c7a76be..a7e48bba36 100644
--- a/thirdparty/assimp/code/Common/BaseProcess.h
+++ b/thirdparty/assimp/code/Common/BaseProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/Bitmap.cpp b/thirdparty/assimp/code/Common/Bitmap.cpp
index b22b71ea9e..7d82257044 100644
--- a/thirdparty/assimp/code/Common/Bitmap.cpp
+++ b/thirdparty/assimp/code/Common/Bitmap.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/CreateAnimMesh.cpp b/thirdparty/assimp/code/Common/CreateAnimMesh.cpp
index 98b60e5319..7317dc45b3 100644
--- a/thirdparty/assimp/code/Common/CreateAnimMesh.cpp
+++ b/thirdparty/assimp/code/Common/CreateAnimMesh.cpp
@@ -4,7 +4,7 @@ Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (C) 2016 The Qt Company Ltd.
-Copyright (c) 2006-2012, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/DefaultIOStream.cpp b/thirdparty/assimp/code/Common/DefaultIOStream.cpp
index 1c100b6189..205f19e378 100644
--- a/thirdparty/assimp/code/Common/DefaultIOStream.cpp
+++ b/thirdparty/assimp/code/Common/DefaultIOStream.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -52,6 +52,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
+namespace
+{
+ template<size_t sizeOfPointer>
+ size_t select_ftell(FILE* file)
+ {
+ return ::ftell(file);
+ }
+
+ template<size_t sizeOfPointer>
+ int select_fseek(FILE* file, int64_t offset, int origin)
+ {
+ return ::fseek(file, static_cast<long>(offset), origin);
+ }
+
+#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
+ template<>
+ size_t select_ftell<8>(FILE* file)
+ {
+ return ::_ftelli64(file);
+ }
+
+ template<>
+ int select_fseek<8>(FILE* file, int64_t offset, int origin)
+ {
+ return ::_fseeki64(file, offset, origin);
+ }
+#endif
+}
+
// ----------------------------------------------------------------------------------
DefaultIOStream::~DefaultIOStream()
{
@@ -93,7 +122,7 @@ aiReturn DefaultIOStream::Seek(size_t pOffset,
aiOrigin_END == SEEK_END && aiOrigin_SET == SEEK_SET");
// do the seek
- return (0 == ::fseek(mFile, (long)pOffset,(int)pOrigin) ? AI_SUCCESS : AI_FAILURE);
+ return (0 == select_fseek<sizeof(void*)>(mFile, (int64_t)pOffset,(int)pOrigin) ? AI_SUCCESS : AI_FAILURE);
}
// ----------------------------------------------------------------------------------
@@ -102,7 +131,7 @@ size_t DefaultIOStream::Tell() const
if (!mFile) {
return 0;
}
- return ::ftell(mFile);
+ return select_ftell<sizeof(void*)>(mFile);
}
// ----------------------------------------------------------------------------------
diff --git a/thirdparty/assimp/code/Common/DefaultIOSystem.cpp b/thirdparty/assimp/code/Common/DefaultIOSystem.cpp
index 6fdc24dd80..0343cb289b 100644
--- a/thirdparty/assimp/code/Common/DefaultIOSystem.cpp
+++ b/thirdparty/assimp/code/Common/DefaultIOSystem.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/DefaultLogger.cpp b/thirdparty/assimp/code/Common/DefaultLogger.cpp
index de3528d2b4..adb9ba1600 100644
--- a/thirdparty/assimp/code/Common/DefaultLogger.cpp
+++ b/thirdparty/assimp/code/Common/DefaultLogger.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -107,7 +107,7 @@ LogStream* LogStream::createDefaultStream(aiDefaultLogStream streams,
return nullptr;
#endif
- // Platform-independent default streams
+ // Platform-independent default streams
case aiDefaultLogStream_STDERR:
return new StdOStreamLogStream(std::cerr);
case aiDefaultLogStream_STDOUT:
@@ -121,7 +121,7 @@ LogStream* LogStream::createDefaultStream(aiDefaultLogStream streams,
};
// For compilers without dead code path detection
- return NULL;
+ return nullptr;
}
// ----------------------------------------------------------------------------------
diff --git a/thirdparty/assimp/code/Common/DefaultProgressHandler.h b/thirdparty/assimp/code/Common/DefaultProgressHandler.h
index bd2cce00be..ebf7f118c0 100644
--- a/thirdparty/assimp/code/Common/DefaultProgressHandler.h
+++ b/thirdparty/assimp/code/Common/DefaultProgressHandler.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/Exporter.cpp b/thirdparty/assimp/code/Common/Exporter.cpp
index 4ce1a2bd80..9f9a33b58e 100644
--- a/thirdparty/assimp/code/Common/Exporter.cpp
+++ b/thirdparty/assimp/code/Common/Exporter.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -103,100 +103,91 @@ void ExportSceneFBX(const char*, IOSystem*, const aiScene*, const ExportProperti
void ExportSceneFBXA(const char*, IOSystem*, const aiScene*, const ExportProperties*);
void ExportScene3MF( const char*, IOSystem*, const aiScene*, const ExportProperties* );
void ExportSceneM3D(const char*, IOSystem*, const aiScene*, const ExportProperties*);
-void ExportSceneA3D(const char*, IOSystem*, const aiScene*, const ExportProperties*);
+void ExportSceneM3DA(const char*, IOSystem*, const aiScene*, const ExportProperties*);
void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*);
-// ------------------------------------------------------------------------------------------------
-// global array of all export formats which Assimp supports in its current build
-Exporter::ExportFormatEntry gExporters[] =
-{
+
+static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporters) {
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
- Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada ),
+ exporters.push_back(Exporter::ExportFormatEntry("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada));
#endif
#ifndef ASSIMP_BUILD_NO_X_EXPORTER
- Exporter::ExportFormatEntry( "x", "X Files", "x", &ExportSceneXFile,
- aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs ),
+ exporters.push_back(Exporter::ExportFormatEntry("x", "X Files", "x", &ExportSceneXFile,
+ aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs));
#endif
#ifndef ASSIMP_BUILD_NO_STEP_EXPORTER
- Exporter::ExportFormatEntry( "stp", "Step Files", "stp", &ExportSceneStep, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("stp", "Step Files", "stp", &ExportSceneStep, 0));
#endif
#ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
- Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
- aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */ ),
- Exporter::ExportFormatEntry( "objnomtl", "Wavefront OBJ format without material file", "obj", &ExportSceneObjNoMtl,
- aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */ ),
+ exporters.push_back(Exporter::ExportFormatEntry("obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
+ aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */));
+ exporters.push_back(Exporter::ExportFormatEntry("objnomtl", "Wavefront OBJ format without material file", "obj", &ExportSceneObjNoMtl,
+ aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */));
#endif
#ifndef ASSIMP_BUILD_NO_STL_EXPORTER
- Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL,
- aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
- ),
- Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary,
- aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
- ),
+ exporters.push_back(Exporter::ExportFormatEntry("stl", "Stereolithography", "stl", &ExportSceneSTL,
+ aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices));
+ exporters.push_back(Exporter::ExportFormatEntry("stlb", "Stereolithography (binary)", "stl", &ExportSceneSTLBinary,
+ aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices));
#endif
#ifndef ASSIMP_BUILD_NO_PLY_EXPORTER
- Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly,
- aiProcess_PreTransformVertices
- ),
- Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
- aiProcess_PreTransformVertices
- ),
+ exporters.push_back(Exporter::ExportFormatEntry("ply", "Stanford Polygon Library", "ply", &ExportScenePly,
+ aiProcess_PreTransformVertices));
+ exporters.push_back(Exporter::ExportFormatEntry("plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
+ aiProcess_PreTransformVertices));
#endif
#ifndef ASSIMP_BUILD_NO_3DS_EXPORTER
- Exporter::ExportFormatEntry( "3ds", "Autodesk 3DS (legacy)", "3ds" , &ExportScene3DS,
- aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices ),
+ exporters.push_back(Exporter::ExportFormatEntry("3ds", "Autodesk 3DS (legacy)", "3ds", &ExportScene3DS,
+ aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices));
#endif
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
- Exporter::ExportFormatEntry( "gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2,
- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
- Exporter::ExportFormatEntry( "glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2,
- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
- Exporter::ExportFormatEntry( "gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
- Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ),
+ exporters.push_back(Exporter::ExportFormatEntry("gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2,
+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
+ exporters.push_back(Exporter::ExportFormatEntry("glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2,
+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
+ exporters.push_back(Exporter::ExportFormatEntry("gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
+ exporters.push_back(Exporter::ExportFormatEntry("glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
#endif
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
- Exporter::ExportFormatEntry( "assbin", "Assimp Binary File", "assbin" , &ExportSceneAssbin, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("assbin", "Assimp Binary File", "assbin", &ExportSceneAssbin, 0));
#endif
#ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER
- Exporter::ExportFormatEntry( "assxml", "Assimp XML Document", "assxml" , &ExportSceneAssxml, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("assxml", "Assimp XML Document", "assxml", &ExportSceneAssxml, 0));
#endif
#ifndef ASSIMP_BUILD_NO_X3D_EXPORTER
- Exporter::ExportFormatEntry( "x3d", "Extensible 3D", "x3d" , &ExportSceneX3D, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("x3d", "Extensible 3D", "x3d", &ExportSceneX3D, 0));
#endif
#ifndef ASSIMP_BUILD_NO_FBX_EXPORTER
- Exporter::ExportFormatEntry( "fbx", "Autodesk FBX (binary)", "fbx", &ExportSceneFBX, 0 ),
- Exporter::ExportFormatEntry( "fbxa", "Autodesk FBX (ascii)", "fbx", &ExportSceneFBXA, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("fbx", "Autodesk FBX (binary)", "fbx", &ExportSceneFBX, 0));
+ exporters.push_back(Exporter::ExportFormatEntry("fbxa", "Autodesk FBX (ascii)", "fbx", &ExportSceneFBXA, 0));
#endif
#ifndef ASSIMP_BUILD_NO_M3D_EXPORTER
- Exporter::ExportFormatEntry( "m3d", "Model 3D (binary)", "m3d", &ExportSceneM3D, 0 ),
- Exporter::ExportFormatEntry( "a3d", "Model 3D (ascii)", "m3d", &ExportSceneA3D, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("m3d", "Model 3D (binary)", "m3d", &ExportSceneM3D, 0));
+ exporters.push_back(Exporter::ExportFormatEntry("m3da", "Model 3D (ascii)", "a3d", &ExportSceneM3DA, 0));
#endif
#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
- Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ),
+ exporters.push_back(Exporter::ExportFormatEntry("3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0));
#endif
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
- Exporter::ExportFormatEntry( "assjson", "Assimp JSON Document", "json", &ExportAssimp2Json, 0)
+ exporters.push_back(Exporter::ExportFormatEntry("assjson", "Assimp JSON Document", "json", &ExportAssimp2Json, 0));
#endif
-};
-
-#define ASSIMP_NUM_EXPORTERS (sizeof(gExporters)/sizeof(gExporters[0]))
-
+}
class ExporterPimpl {
public:
@@ -212,10 +203,7 @@ public:
GetPostProcessingStepInstanceList(mPostProcessingSteps);
// grab all built-in exporters
- if ( 0 != ( ASSIMP_NUM_EXPORTERS ) ) {
- mExporters.resize( ASSIMP_NUM_EXPORTERS );
- std::copy( gExporters, gExporters + ASSIMP_NUM_EXPORTERS, mExporters.begin() );
- }
+ setupExporterArray(mExporters);
}
~ExporterPimpl() {
@@ -259,24 +247,28 @@ Exporter :: Exporter()
// ------------------------------------------------------------------------------------------------
Exporter::~Exporter() {
- FreeBlob();
+ ai_assert(nullptr != pimpl);
+ FreeBlob();
delete pimpl;
}
// ------------------------------------------------------------------------------------------------
void Exporter::SetIOHandler( IOSystem* pIOHandler) {
- pimpl->mIsDefaultIOHandler = !pIOHandler;
+ ai_assert(nullptr != pimpl);
+ pimpl->mIsDefaultIOHandler = !pIOHandler;
pimpl->mIOSystem.reset(pIOHandler);
}
// ------------------------------------------------------------------------------------------------
IOSystem* Exporter::GetIOHandler() const {
- return pimpl->mIOSystem.get();
+ ai_assert(nullptr != pimpl);
+ return pimpl->mIOSystem.get();
}
// ------------------------------------------------------------------------------------------------
bool Exporter::IsDefaultIOHandler() const {
- return pimpl->mIsDefaultIOHandler;
+ ai_assert(nullptr != pimpl);
+ return pimpl->mIsDefaultIOHandler;
}
// ------------------------------------------------------------------------------------------------
@@ -302,6 +294,7 @@ void Exporter::SetProgressHandler(ProgressHandler* pHandler) {
// ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const char* pFormatId,
unsigned int pPreprocessing, const ExportProperties* pProperties) {
+ ai_assert(nullptr != pimpl);
if (pimpl->blob) {
delete pimpl->blob;
pimpl->blob = nullptr;
@@ -326,7 +319,7 @@ const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const cha
aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const char* pPath,
unsigned int pPreprocessing, const ExportProperties* pProperties) {
ASSIMP_BEGIN_EXCEPTION_REGION();
-
+ ai_assert(nullptr != pimpl);
// when they create scenes from scratch, users will likely create them not in verbose
// format. They will likely not be aware that there is a flag in the scene to indicate
// this, however. To avoid surprises and bug reports, we check for duplicates in
@@ -452,8 +445,7 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c
ExportProperties emptyProperties; // Never pass NULL ExportProperties so Exporters don't have to worry.
ExportProperties* pProp = pProperties ? (ExportProperties*)pProperties : &emptyProperties;
- pProp->SetPropertyBool("bJoinIdenticalVertices", must_join_again);
- exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get(), pProp);
+ pProp->SetPropertyBool("bJoinIdenticalVertices", pp & aiProcess_JoinIdenticalVertices);
exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get(), pProp);
pimpl->mProgressHandler->UpdateFileWrite(4, 4);
@@ -473,11 +465,13 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c
// ------------------------------------------------------------------------------------------------
const char* Exporter::GetErrorString() const {
+ ai_assert(nullptr != pimpl);
return pimpl->mError.c_str();
}
// ------------------------------------------------------------------------------------------------
void Exporter::FreeBlob() {
+ ai_assert(nullptr != pimpl);
delete pimpl->blob;
pimpl->blob = nullptr;
@@ -486,30 +480,34 @@ void Exporter::FreeBlob() {
// ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter::GetBlob() const {
- return pimpl->blob;
+ ai_assert(nullptr != pimpl);
+ return pimpl->blob;
}
// ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter::GetOrphanedBlob() const {
- const aiExportDataBlob* tmp = pimpl->blob;
+ ai_assert(nullptr != pimpl);
+ const aiExportDataBlob *tmp = pimpl->blob;
pimpl->blob = nullptr;
return tmp;
}
// ------------------------------------------------------------------------------------------------
size_t Exporter::GetExportFormatCount() const {
+ ai_assert(nullptr != pimpl);
return pimpl->mExporters.size();
}
// ------------------------------------------------------------------------------------------------
const aiExportFormatDesc* Exporter::GetExportFormatDescription( size_t index ) const {
- if (index >= GetExportFormatCount()) {
+ ai_assert(nullptr != pimpl);
+ if (index >= GetExportFormatCount()) {
return nullptr;
}
// Return from static storage if the requested index is built-in.
- if (index < sizeof(gExporters) / sizeof(gExporters[0])) {
- return &gExporters[index].mDescription;
+ if (index < pimpl->mExporters.size()) {
+ return &pimpl->mExporters[index].mDescription;
}
return &pimpl->mExporters[index].mDescription;
@@ -517,7 +515,8 @@ const aiExportFormatDesc* Exporter::GetExportFormatDescription( size_t index ) c
// ------------------------------------------------------------------------------------------------
aiReturn Exporter::RegisterExporter(const ExportFormatEntry& desc) {
- for(const ExportFormatEntry& e : pimpl->mExporters) {
+ ai_assert(nullptr != pimpl);
+ for (const ExportFormatEntry &e : pimpl->mExporters) {
if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
return aiReturn_FAILURE;
}
@@ -529,7 +528,8 @@ aiReturn Exporter::RegisterExporter(const ExportFormatEntry& desc) {
// ------------------------------------------------------------------------------------------------
void Exporter::UnregisterExporter(const char* id) {
- for(std::vector<ExportFormatEntry>::iterator it = pimpl->mExporters.begin();
+ ai_assert(nullptr != pimpl);
+ for (std::vector<ExportFormatEntry>::iterator it = pimpl->mExporters.begin();
it != pimpl->mExporters.end(); ++it) {
if (!strcmp((*it).mDescription.id,id)) {
pimpl->mExporters.erase(it);
diff --git a/thirdparty/assimp/code/Common/FileLogStream.h b/thirdparty/assimp/code/Common/FileLogStream.h
index 740c503192..ecff03a7eb 100644
--- a/thirdparty/assimp/code/Common/FileLogStream.h
+++ b/thirdparty/assimp/code/Common/FileLogStream.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/FileSystemFilter.h b/thirdparty/assimp/code/Common/FileSystemFilter.h
index 9923cdbdd3..1440cf97d1 100644
--- a/thirdparty/assimp/code/Common/FileSystemFilter.h
+++ b/thirdparty/assimp/code/Common/FileSystemFilter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2008, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/thirdparty/assimp/code/Common/Importer.cpp b/thirdparty/assimp/code/Common/Importer.cpp
index 91b50859a0..a59ec98122 100644
--- a/thirdparty/assimp/code/Common/Importer.cpp
+++ b/thirdparty/assimp/code/Common/Importer.cpp
@@ -3,9 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
-
-
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -78,6 +76,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/TinyFormatter.h>
#include <assimp/Exceptional.h>
#include <assimp/Profiler.h>
+#include <assimp/commonMetaData.h>
+
#include <set>
#include <memory>
#include <cctype>
@@ -119,7 +119,7 @@ void* AllocateFromAssimpHeap::operator new ( size_t num_bytes, const std::nothro
return AllocateFromAssimpHeap::operator new( num_bytes );
}
catch( ... ) {
- return NULL;
+ return nullptr;
}
}
@@ -134,9 +134,8 @@ void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes) {
void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw() {
try {
return AllocateFromAssimpHeap::operator new[]( num_bytes );
- }
- catch( ... ) {
- return NULL;
+ } catch( ... ) {
+ return nullptr;
}
}
@@ -148,7 +147,7 @@ void AllocateFromAssimpHeap::operator delete[] ( void* data) {
// Importer constructor.
Importer::Importer()
: pimpl( new ImporterPimpl ) {
- pimpl->mScene = NULL;
+ pimpl->mScene = nullptr;
pimpl->mErrorString = "";
// Allocate a default IO handler
@@ -174,14 +173,14 @@ Importer::Importer()
// ------------------------------------------------------------------------------------------------
// Destructor of Importer
-Importer::~Importer()
-{
+Importer::~Importer() {
// Delete all import plugins
DeleteImporterInstanceList(pimpl->mImporter);
// Delete all post-processing plug-ins
- for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
+ for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); ++a ) {
delete pimpl->mPostProcessingSteps[a];
+ }
// Delete the assigned IO and progress handler
delete pimpl->mIOHandler;
@@ -199,9 +198,9 @@ Importer::~Importer()
// ------------------------------------------------------------------------------------------------
// Register a custom post-processing step
-aiReturn Importer::RegisterPPStep(BaseProcess* pImp)
-{
- ai_assert(NULL != pImp);
+aiReturn Importer::RegisterPPStep(BaseProcess* pImp) {
+ ai_assert( nullptr != pImp );
+
ASSIMP_BEGIN_EXCEPTION_REGION();
pimpl->mPostProcessingSteps.push_back(pImp);
@@ -213,9 +212,9 @@ aiReturn Importer::RegisterPPStep(BaseProcess* pImp)
// ------------------------------------------------------------------------------------------------
// Register a custom loader plugin
-aiReturn Importer::RegisterLoader(BaseImporter* pImp)
-{
- ai_assert(NULL != pImp);
+aiReturn Importer::RegisterLoader(BaseImporter* pImp) {
+ ai_assert(nullptr != pImp);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
// --------------------------------------------------------------------
@@ -242,13 +241,13 @@ aiReturn Importer::RegisterLoader(BaseImporter* pImp)
pimpl->mImporter.push_back(pImp);
ASSIMP_LOG_INFO_F("Registering custom importer for these file extensions: ", baked);
ASSIMP_END_EXCEPTION_REGION(aiReturn);
+
return AI_SUCCESS;
}
// ------------------------------------------------------------------------------------------------
// Unregister a custom loader plugin
-aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
-{
+aiReturn Importer::UnregisterLoader(BaseImporter* pImp) {
if(!pImp) {
// unregistering a NULL importer is no problem for us ... really!
return AI_SUCCESS;
@@ -265,13 +264,13 @@ aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
}
ASSIMP_LOG_WARN("Unable to remove custom importer: I can't find you ...");
ASSIMP_END_EXCEPTION_REGION(aiReturn);
+
return AI_FAILURE;
}
// ------------------------------------------------------------------------------------------------
// Unregister a custom loader plugin
-aiReturn Importer::UnregisterPPStep(BaseProcess* pImp)
-{
+aiReturn Importer::UnregisterPPStep(BaseProcess* pImp) {
if(!pImp) {
// unregistering a NULL ppstep is no problem for us ... really!
return AI_SUCCESS;
@@ -288,24 +287,22 @@ aiReturn Importer::UnregisterPPStep(BaseProcess* pImp)
}
ASSIMP_LOG_WARN("Unable to remove custom post-processing step: I can't find you ..");
ASSIMP_END_EXCEPTION_REGION(aiReturn);
+
return AI_FAILURE;
}
// ------------------------------------------------------------------------------------------------
// Supplies a custom IO handler to the importer to open and access files.
-void Importer::SetIOHandler( IOSystem* pIOHandler)
-{
+void Importer::SetIOHandler( IOSystem* pIOHandler) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
// If the new handler is zero, allocate a default IO implementation.
- if (!pIOHandler)
- {
+ if (!pIOHandler) {
// Release pointer in the possession of the caller
pimpl->mIOHandler = new DefaultIOSystem();
pimpl->mIsDefaultHandler = true;
- }
- // Otherwise register the custom handler
- else if (pimpl->mIOHandler != pIOHandler)
- {
+ } else if (pimpl->mIOHandler != pIOHandler) { // Otherwise register the custom handler
delete pimpl->mIOHandler;
pimpl->mIOHandler = pIOHandler;
pimpl->mIsDefaultHandler = false;
@@ -316,29 +313,32 @@ void Importer::SetIOHandler( IOSystem* pIOHandler)
// ------------------------------------------------------------------------------------------------
// Get the currently set IO handler
IOSystem* Importer::GetIOHandler() const {
+ ai_assert(nullptr != pimpl);
+
return pimpl->mIOHandler;
}
// ------------------------------------------------------------------------------------------------
// Check whether a custom IO handler is currently set
bool Importer::IsDefaultIOHandler() const {
+ ai_assert(nullptr != pimpl);
+
return pimpl->mIsDefaultHandler;
}
// ------------------------------------------------------------------------------------------------
// Supplies a custom progress handler to get regular callbacks during importing
void Importer::SetProgressHandler ( ProgressHandler* pHandler ) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
+
// If the new handler is zero, allocate a default implementation.
- if (!pHandler)
- {
+ if (!pHandler) {
// Release pointer in the possession of the caller
pimpl->mProgressHandler = new DefaultProgressHandler();
pimpl->mIsDefaultProgressHandler = true;
- }
- // Otherwise register the custom handler
- else if (pimpl->mProgressHandler != pHandler)
- {
+ } else if (pimpl->mProgressHandler != pHandler) { // Otherwise register the custom handler
delete pimpl->mProgressHandler;
pimpl->mProgressHandler = pHandler;
pimpl->mIsDefaultProgressHandler = false;
@@ -349,19 +349,22 @@ void Importer::SetProgressHandler ( ProgressHandler* pHandler ) {
// ------------------------------------------------------------------------------------------------
// Get the currently set progress handler
ProgressHandler* Importer::GetProgressHandler() const {
+ ai_assert(nullptr != pimpl);
+
return pimpl->mProgressHandler;
}
// ------------------------------------------------------------------------------------------------
// Check whether a custom progress handler is currently set
bool Importer::IsDefaultProgressHandler() const {
+ ai_assert(nullptr != pimpl);
+
return pimpl->mIsDefaultProgressHandler;
}
// ------------------------------------------------------------------------------------------------
// Validate post process step flags
-bool _ValidateFlags(unsigned int pFlags)
-{
+bool _ValidateFlags(unsigned int pFlags) {
if (pFlags & aiProcess_GenSmoothNormals && pFlags & aiProcess_GenNormals) {
ASSIMP_LOG_ERROR("#aiProcess_GenSmoothNormals and #aiProcess_GenNormals are incompatible");
return false;
@@ -375,12 +378,13 @@ bool _ValidateFlags(unsigned int pFlags)
// ------------------------------------------------------------------------------------------------
// Free the current scene
-void Importer::FreeScene( )
-{
+void Importer::FreeScene( ) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
delete pimpl->mScene;
- pimpl->mScene = NULL;
+ pimpl->mScene = nullptr;
pimpl->mErrorString = "";
ASSIMP_END_EXCEPTION_REGION(void);
@@ -388,44 +392,48 @@ void Importer::FreeScene( )
// ------------------------------------------------------------------------------------------------
// Get the current error string, if any
-const char* Importer::GetErrorString() const
-{
- /* Must remain valid as long as ReadFile() or FreeFile() are not called */
+const char* Importer::GetErrorString() const {
+ ai_assert(nullptr != pimpl);
+
+ // Must remain valid as long as ReadFile() or FreeFile() are not called
return pimpl->mErrorString.c_str();
}
// ------------------------------------------------------------------------------------------------
// Enable extra-verbose mode
-void Importer::SetExtraVerbose(bool bDo)
-{
+void Importer::SetExtraVerbose(bool bDo) {
+ ai_assert(nullptr != pimpl);
+
pimpl->bExtraVerbose = bDo;
}
// ------------------------------------------------------------------------------------------------
// Get the current scene
-const aiScene* Importer::GetScene() const
-{
+const aiScene* Importer::GetScene() const {
+ ai_assert(nullptr != pimpl);
+
return pimpl->mScene;
}
// ------------------------------------------------------------------------------------------------
// Orphan the current scene and return it.
-aiScene* Importer::GetOrphanedScene()
-{
+aiScene* Importer::GetOrphanedScene() {
+ ai_assert(nullptr != pimpl);
+
aiScene* s = pimpl->mScene;
ASSIMP_BEGIN_EXCEPTION_REGION();
- pimpl->mScene = NULL;
+ pimpl->mScene = nullptr;
- pimpl->mErrorString = ""; /* reset error string */
+ pimpl->mErrorString = ""; // reset error string
ASSIMP_END_EXCEPTION_REGION(aiScene*);
+
return s;
}
// ------------------------------------------------------------------------------------------------
// Validate post-processing flags
-bool Importer::ValidateFlags(unsigned int pFlags) const
-{
+bool Importer::ValidateFlags(unsigned int pFlags) const {
ASSIMP_BEGIN_EXCEPTION_REGION();
// run basic checks for mutually exclusive flags
if(!_ValidateFlags(pFlags)) {
@@ -467,8 +475,9 @@ bool Importer::ValidateFlags(unsigned int pFlags) const
const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
size_t pLength,
unsigned int pFlags,
- const char* pHint /*= ""*/)
-{
+ const char* pHint /*= ""*/) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
if (!pHint) {
pHint = "";
@@ -476,12 +485,12 @@ const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
if (!pBuffer || !pLength || strlen(pHint) > MaxLenHint ) {
pimpl->mErrorString = "Invalid parameters passed to ReadFileFromMemory()";
- return NULL;
+ return nullptr;
}
// prevent deletion of the previous IOHandler
IOSystem* io = pimpl->mIOHandler;
- pimpl->mIOHandler = NULL;
+ pimpl->mIOHandler = nullptr;
SetIOHandler(new MemoryIOSystem((const uint8_t*)pBuffer,pLength,io));
@@ -493,13 +502,13 @@ const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
ReadFile(fbuff,pFlags);
SetIOHandler(io);
- ASSIMP_END_EXCEPTION_REGION(const aiScene*);
+ ASSIMP_END_EXCEPTION_REGION_WITH_ERROR_STRING(const aiScene*, pimpl->mErrorString);
return pimpl->mScene;
}
// ------------------------------------------------------------------------------------------------
-void WriteLogOpening(const std::string& file)
-{
+void WriteLogOpening(const std::string& file) {
+
ASSIMP_LOG_INFO_F("Load ", file);
// print a full version dump. This is nice because we don't
@@ -550,8 +559,9 @@ void WriteLogOpening(const std::string& file)
// ------------------------------------------------------------------------------------------------
// Reads the given file and returns its contents if successful.
-const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
-{
+const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
const std::string pFile(_pFile);
@@ -580,7 +590,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
pimpl->mErrorString = "Unable to open file \"" + pFile + "\".";
ASSIMP_LOG_ERROR(pimpl->mErrorString);
- return NULL;
+ return nullptr;
}
std::unique_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
@@ -589,7 +599,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
}
// Find an worker class which can handle the file
- BaseImporter* imp = NULL;
+ BaseImporter* imp = nullptr;
SetPropertyInteger("importerIndex", -1);
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {
@@ -617,7 +627,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
if( !imp) {
pimpl->mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\".";
ASSIMP_LOG_ERROR(pimpl->mErrorString);
- return NULL;
+ return nullptr;
}
}
@@ -633,7 +643,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
// Dispatch the reading to the worker class for this format
const aiImporterDesc *desc( imp->GetInfo() );
std::string ext( "unknown" );
- if ( NULL != desc ) {
+ if ( nullptr != desc ) {
ext = desc->mName;
}
ASSIMP_LOG_INFO("Found a matching importer for this file format: " + ext + "." );
@@ -654,15 +664,20 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
// If successful, apply all active post processing steps to the imported data
if( pimpl->mScene) {
+ if (!pimpl->mScene->mMetaData || !pimpl->mScene->mMetaData->HasKey(AI_METADATA_SOURCE_FORMAT)) {
+ if (!pimpl->mScene->mMetaData) {
+ pimpl->mScene->mMetaData = new aiMetadata;
+ }
+ pimpl->mScene->mMetaData->Add(AI_METADATA_SOURCE_FORMAT, aiString(ext));
+ }
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
// The ValidateDS process is an exception. It is executed first, even before ScenePreprocessor is called.
- if (pFlags & aiProcess_ValidateDataStructure)
- {
+ if (pFlags & aiProcess_ValidateDataStructure) {
ValidateDSProcess ds;
ds.ExecuteOnScene (this);
if (!pimpl->mScene) {
- return NULL;
+ return nullptr;
}
}
#endif // no validation
@@ -695,8 +710,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
}
}
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
- catch (std::exception &e)
- {
+ catch (std::exception &e) {
#if (defined _MSC_VER) && (defined _CPPRTTI)
// if we have RTTI get the full name of the exception that occurred
pimpl->mErrorString = std::string(typeid( e ).name()) + ": " + e.what();
@@ -705,24 +719,26 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
#endif
ASSIMP_LOG_ERROR(pimpl->mErrorString);
- delete pimpl->mScene; pimpl->mScene = NULL;
+ delete pimpl->mScene; pimpl->mScene = nullptr;
}
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
// either successful or failure - the pointer expresses it anyways
- ASSIMP_END_EXCEPTION_REGION(const aiScene*);
+ ASSIMP_END_EXCEPTION_REGION_WITH_ERROR_STRING(const aiScene*, pimpl->mErrorString);
+
return pimpl->mScene;
}
// ------------------------------------------------------------------------------------------------
// Apply post-processing to the currently bound scene
-const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
-{
+const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
// Return immediately if no scene is active
if (!pimpl->mScene) {
- return NULL;
+ return nullptr;
}
// If no flags are given, return the current scene with no further action
@@ -737,12 +753,11 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
// The ValidateDS process plays an exceptional role. It isn't contained in the global
// list of post-processing steps, so we need to call it manually.
- if (pFlags & aiProcess_ValidateDataStructure)
- {
+ if (pFlags & aiProcess_ValidateDataStructure) {
ValidateDSProcess ds;
ds.ExecuteOnScene (this);
if (!pimpl->mScene) {
- return NULL;
+ return nullptr;
}
}
#endif // no validation
@@ -762,11 +777,9 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
std::unique_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
-
BaseProcess* process = pimpl->mPostProcessingSteps[a];
pimpl->mProgressHandler->UpdatePostProcess(static_cast<int>(a), static_cast<int>(pimpl->mPostProcessingSteps.size()) );
if( process->IsActive( pFlags)) {
-
if (profiler) {
profiler->BeginRegion("postprocess");
}
@@ -803,24 +816,28 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
static_cast<int>(pimpl->mPostProcessingSteps.size()) );
// update private scene flags
- if( pimpl->mScene )
+ if( pimpl->mScene ) {
ScenePriv(pimpl->mScene)->mPPStepsApplied |= pFlags;
+ }
// clear any data allocated by post-process steps
pimpl->mPPShared->Clean();
ASSIMP_LOG_INFO("Leaving post processing pipeline");
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
+
return pimpl->mScene;
}
// ------------------------------------------------------------------------------------------------
const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess, bool requestValidation ) {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
// Return immediately if no scene is active
- if ( NULL == pimpl->mScene ) {
- return NULL;
+ if ( nullptr == pimpl->mScene ) {
+ return nullptr;
}
// If no flags are given, return the current scene with no further action
@@ -839,7 +856,7 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
ValidateDSProcess ds;
ds.ExecuteOnScene( this );
if ( !pimpl->mScene ) {
- return NULL;
+ return nullptr;
}
}
#endif // no validation
@@ -890,46 +907,50 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
// ------------------------------------------------------------------------------------------------
// Helper function to check whether an extension is supported by ASSIMP
-bool Importer::IsExtensionSupported(const char* szExtension) const
-{
+bool Importer::IsExtensionSupported(const char* szExtension) const {
return nullptr != GetImporter(szExtension);
}
// ------------------------------------------------------------------------------------------------
-size_t Importer::GetImporterCount() const
-{
+size_t Importer::GetImporterCount() const {
+ ai_assert(nullptr != pimpl);
+
return pimpl->mImporter.size();
}
// ------------------------------------------------------------------------------------------------
-const aiImporterDesc* Importer::GetImporterInfo(size_t index) const
-{
+const aiImporterDesc* Importer::GetImporterInfo(size_t index) const {
+ ai_assert(nullptr != pimpl);
+
if (index >= pimpl->mImporter.size()) {
- return NULL;
+ return nullptr;
}
return pimpl->mImporter[index]->GetInfo();
}
// ------------------------------------------------------------------------------------------------
-BaseImporter* Importer::GetImporter (size_t index) const
-{
+BaseImporter* Importer::GetImporter (size_t index) const {
+ ai_assert(nullptr != pimpl);
+
if (index >= pimpl->mImporter.size()) {
- return NULL;
+ return nullptr;
}
return pimpl->mImporter[index];
}
// ------------------------------------------------------------------------------------------------
// Find a loader plugin for a given file extension
-BaseImporter* Importer::GetImporter (const char* szExtension) const
-{
+BaseImporter* Importer::GetImporter (const char* szExtension) const {
+ ai_assert(nullptr != pimpl);
+
return GetImporter(GetImporterIndex(szExtension));
}
// ------------------------------------------------------------------------------------------------
// Find a loader plugin for a given file extension
size_t Importer::GetImporterIndex (const char* szExtension) const {
+ ai_assert(nullptr != pimpl);
ai_assert(nullptr != szExtension);
ASSIMP_BEGIN_EXCEPTION_REGION();
@@ -960,8 +981,9 @@ size_t Importer::GetImporterIndex (const char* szExtension) const {
// ------------------------------------------------------------------------------------------------
// Helper function to build a list of all file extensions supported by ASSIMP
-void Importer::GetExtensionList(aiString& szOut) const
-{
+void Importer::GetExtensionList(aiString& szOut) const {
+ ai_assert(nullptr != pimpl);
+
ASSIMP_BEGIN_EXCEPTION_REGION();
std::set<std::string> str;
for (std::vector<BaseImporter*>::const_iterator i = pimpl->mImporter.begin();i != pimpl->mImporter.end();++i) {
@@ -985,8 +1007,9 @@ void Importer::GetExtensionList(aiString& szOut) const
// ------------------------------------------------------------------------------------------------
// Set a configuration property
-bool Importer::SetPropertyInteger(const char* szName, int iValue)
-{
+bool Importer::SetPropertyInteger(const char* szName, int iValue) {
+ ai_assert(nullptr != pimpl);
+
bool existing;
ASSIMP_BEGIN_EXCEPTION_REGION();
existing = SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue);
@@ -996,8 +1019,9 @@ bool Importer::SetPropertyInteger(const char* szName, int iValue)
// ------------------------------------------------------------------------------------------------
// Set a configuration property
-bool Importer::SetPropertyFloat(const char* szName, ai_real iValue)
-{
+bool Importer::SetPropertyFloat(const char* szName, ai_real iValue) {
+ ai_assert(nullptr != pimpl);
+
bool existing;
ASSIMP_BEGIN_EXCEPTION_REGION();
existing = SetGenericProperty<ai_real>(pimpl->mFloatProperties, szName,iValue);
@@ -1007,8 +1031,9 @@ bool Importer::SetPropertyFloat(const char* szName, ai_real iValue)
// ------------------------------------------------------------------------------------------------
// Set a configuration property
-bool Importer::SetPropertyString(const char* szName, const std::string& value)
-{
+bool Importer::SetPropertyString(const char* szName, const std::string& value) {
+ ai_assert(nullptr != pimpl);
+
bool existing;
ASSIMP_BEGIN_EXCEPTION_REGION();
existing = SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value);
@@ -1018,8 +1043,9 @@ bool Importer::SetPropertyString(const char* szName, const std::string& value)
// ------------------------------------------------------------------------------------------------
// Set a configuration property
-bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
-{
+bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value) {
+ ai_assert(nullptr != pimpl);
+
bool existing;
ASSIMP_BEGIN_EXCEPTION_REGION();
existing = SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value);
@@ -1029,40 +1055,43 @@ bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
// ------------------------------------------------------------------------------------------------
// Get a configuration property
-int Importer::GetPropertyInteger(const char* szName,
- int iErrorReturn /*= 0xffffffff*/) const
-{
+int Importer::GetPropertyInteger(const char* szName, int iErrorReturn /*= 0xffffffff*/) const {
+ ai_assert(nullptr != pimpl);
+
return GetGenericProperty<int>(pimpl->mIntProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
// Get a configuration property
-ai_real Importer::GetPropertyFloat(const char* szName,
- ai_real iErrorReturn /*= 10e10*/) const
-{
+ai_real Importer::GetPropertyFloat(const char* szName, ai_real iErrorReturn /*= 10e10*/) const {
+ ai_assert(nullptr != pimpl);
+
return GetGenericProperty<ai_real>(pimpl->mFloatProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
// Get a configuration property
-const std::string Importer::GetPropertyString(const char* szName,
- const std::string& iErrorReturn /*= ""*/) const
-{
+std::string Importer::GetPropertyString(const char* szName, const std::string& iErrorReturn /*= ""*/) const {
+ ai_assert(nullptr != pimpl);
+
return GetGenericProperty<std::string>(pimpl->mStringProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
// Get a configuration property
-const aiMatrix4x4 Importer::GetPropertyMatrix(const char* szName,
- const aiMatrix4x4& iErrorReturn /*= aiMatrix4x4()*/) const
-{
+aiMatrix4x4 Importer::GetPropertyMatrix(const char* szName, const aiMatrix4x4& iErrorReturn /*= aiMatrix4x4()*/) const {
+ ai_assert(nullptr != pimpl);
+
return GetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
// Get the memory requirements of a single node
-inline void AddNodeWeight(unsigned int& iScene,const aiNode* pcNode)
-{
+inline
+void AddNodeWeight(unsigned int& iScene,const aiNode* pcNode) {
+ if ( nullptr == pcNode ) {
+ return;
+ }
iScene += sizeof(aiNode);
iScene += sizeof(unsigned int) * pcNode->mNumMeshes;
iScene += sizeof(void*) * pcNode->mNumChildren;
@@ -1074,21 +1103,20 @@ inline void AddNodeWeight(unsigned int& iScene,const aiNode* pcNode)
// ------------------------------------------------------------------------------------------------
// Get the memory requirements of the scene
-void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
-{
+void Importer::GetMemoryRequirements(aiMemoryInfo& in) const {
+ ai_assert(nullptr != pimpl);
+
in = aiMemoryInfo();
aiScene* mScene = pimpl->mScene;
// return if we have no scene loaded
- if (!pimpl->mScene)
+ if (!mScene)
return;
-
in.total = sizeof(aiScene);
// add all meshes
- for (unsigned int i = 0; i < mScene->mNumMeshes;++i)
- {
+ for (unsigned int i = 0; i < mScene->mNumMeshes;++i) {
in.meshes += sizeof(aiMesh);
if (mScene->mMeshes[i]->HasPositions()) {
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
@@ -1105,14 +1133,16 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS;++a) {
if (mScene->mMeshes[i]->HasVertexColors(a)) {
in.meshes += sizeof(aiColor4D) * mScene->mMeshes[i]->mNumVertices;
+ } else {
+ break;
}
- else break;
}
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS;++a) {
if (mScene->mMeshes[i]->HasTextureCoords(a)) {
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
+ } else {
+ break;
}
- else break;
}
if (mScene->mMeshes[i]->HasBones()) {
in.meshes += sizeof(void*) * mScene->mMeshes[i]->mNumBones;
@@ -1131,8 +1161,9 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
in.textures += sizeof(aiTexture);
if (pc->mHeight) {
in.textures += 4 * pc->mHeight * pc->mWidth;
+ } else {
+ in.textures += pc->mWidth;
}
- else in.textures += pc->mWidth;
}
in.total += in.textures;
@@ -1170,5 +1201,6 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
in.materials += pc->mProperties[a]->mDataLength;
}
}
+
in.total += in.materials;
}
diff --git a/thirdparty/assimp/code/Common/Importer.h b/thirdparty/assimp/code/Common/Importer.h
index a439d99c2f..c31f67caa7 100644
--- a/thirdparty/assimp/code/Common/Importer.h
+++ b/thirdparty/assimp/code/Common/Importer.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/ImporterRegistry.cpp b/thirdparty/assimp/code/Common/ImporterRegistry.cpp
index b9f28f0356..41aa21979a 100644
--- a/thirdparty/assimp/code/Common/ImporterRegistry.cpp
+++ b/thirdparty/assimp/code/Common/ImporterRegistry.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/PolyTools.h b/thirdparty/assimp/code/Common/PolyTools.h
index fbbda0e7d1..1b89728777 100644
--- a/thirdparty/assimp/code/Common/PolyTools.h
+++ b/thirdparty/assimp/code/Common/PolyTools.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/PostStepRegistry.cpp b/thirdparty/assimp/code/Common/PostStepRegistry.cpp
index 8ff4af0400..21bd2af953 100644
--- a/thirdparty/assimp/code/Common/PostStepRegistry.cpp
+++ b/thirdparty/assimp/code/Common/PostStepRegistry.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/RemoveComments.cpp b/thirdparty/assimp/code/Common/RemoveComments.cpp
index 91700a7699..f7e735c165 100644
--- a/thirdparty/assimp/code/Common/RemoveComments.cpp
+++ b/thirdparty/assimp/code/Common/RemoveComments.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/SGSpatialSort.cpp b/thirdparty/assimp/code/Common/SGSpatialSort.cpp
index 120070b0aa..35ffaae582 100644
--- a/thirdparty/assimp/code/Common/SGSpatialSort.cpp
+++ b/thirdparty/assimp/code/Common/SGSpatialSort.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/SceneCombiner.cpp b/thirdparty/assimp/code/Common/SceneCombiner.cpp
index f7b13cc951..29b6082a87 100644
--- a/thirdparty/assimp/code/Common/SceneCombiner.cpp
+++ b/thirdparty/assimp/code/Common/SceneCombiner.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -1312,7 +1312,6 @@ void SceneCombiner::Copy(aiMetadata** _dest, const aiMetadata* src) {
aiMetadata* dest = *_dest = aiMetadata::Alloc( src->mNumProperties );
std::copy(src->mKeys, src->mKeys + src->mNumProperties, dest->mKeys);
- dest->mValues = new aiMetadataEntry[src->mNumProperties];
for (unsigned int i = 0; i < src->mNumProperties; ++i) {
aiMetadataEntry& in = src->mValues[i];
aiMetadataEntry& out = dest->mValues[i];
diff --git a/thirdparty/assimp/code/Common/ScenePreprocessor.cpp b/thirdparty/assimp/code/Common/ScenePreprocessor.cpp
index 432a3d7666..6065905193 100644
--- a/thirdparty/assimp/code/Common/ScenePreprocessor.cpp
+++ b/thirdparty/assimp/code/Common/ScenePreprocessor.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -217,6 +217,7 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
// No rotation keys? Generate a dummy track
if (!channel->mNumRotationKeys) {
+ ai_assert(!channel->mRotationKeys);
channel->mNumRotationKeys = 1;
channel->mRotationKeys = new aiQuatKey[1];
aiQuatKey& q = channel->mRotationKeys[0];
@@ -225,10 +226,13 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
q.mValue = rotation;
ASSIMP_LOG_DEBUG("ScenePreprocessor: Dummy rotation track has been generated");
+ } else {
+ ai_assert(channel->mRotationKeys);
}
// No scaling keys? Generate a dummy track
if (!channel->mNumScalingKeys) {
+ ai_assert(!channel->mScalingKeys);
channel->mNumScalingKeys = 1;
channel->mScalingKeys = new aiVectorKey[1];
aiVectorKey& q = channel->mScalingKeys[0];
@@ -237,10 +241,13 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
q.mValue = scaling;
ASSIMP_LOG_DEBUG("ScenePreprocessor: Dummy scaling track has been generated");
+ } else {
+ ai_assert(channel->mScalingKeys);
}
// No position keys? Generate a dummy track
if (!channel->mNumPositionKeys) {
+ ai_assert(!channel->mPositionKeys);
channel->mNumPositionKeys = 1;
channel->mPositionKeys = new aiVectorKey[1];
aiVectorKey& q = channel->mPositionKeys[0];
@@ -249,6 +256,8 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
q.mValue = position;
ASSIMP_LOG_DEBUG("ScenePreprocessor: Dummy position track has been generated");
+ } else {
+ ai_assert(channel->mPositionKeys);
}
}
}
diff --git a/thirdparty/assimp/code/Common/ScenePreprocessor.h b/thirdparty/assimp/code/Common/ScenePreprocessor.h
index 3f4c8d7c3f..e059d1c95c 100644
--- a/thirdparty/assimp/code/Common/ScenePreprocessor.h
+++ b/thirdparty/assimp/code/Common/ScenePreprocessor.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/ScenePrivate.h b/thirdparty/assimp/code/Common/ScenePrivate.h
index f336aafc9a..f66f48856b 100644
--- a/thirdparty/assimp/code/Common/ScenePrivate.h
+++ b/thirdparty/assimp/code/Common/ScenePrivate.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/SkeletonMeshBuilder.cpp b/thirdparty/assimp/code/Common/SkeletonMeshBuilder.cpp
index 06cfe034e9..724359f99e 100644
--- a/thirdparty/assimp/code/Common/SkeletonMeshBuilder.cpp
+++ b/thirdparty/assimp/code/Common/SkeletonMeshBuilder.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/SpatialSort.cpp b/thirdparty/assimp/code/Common/SpatialSort.cpp
index a4f3a4e4b8..604b086b71 100644
--- a/thirdparty/assimp/code/Common/SpatialSort.cpp
+++ b/thirdparty/assimp/code/Common/SpatialSort.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/SplitByBoneCountProcess.cpp b/thirdparty/assimp/code/Common/SplitByBoneCountProcess.cpp
index 2ef66a9afc..ab7a1fe007 100644
--- a/thirdparty/assimp/code/Common/SplitByBoneCountProcess.cpp
+++ b/thirdparty/assimp/code/Common/SplitByBoneCountProcess.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <limits>
#include <assimp/TinyFormatter.h>
+#include <assimp/Exceptional.h>
using namespace Assimp;
using namespace Assimp::Formatter;
@@ -94,7 +95,10 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
bool isNecessary = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a)
if( pScene->mMeshes[a]->mNumBones > mMaxBoneCount )
+ {
isNecessary = true;
+ break;
+ }
if( !isNecessary )
{
@@ -155,7 +159,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
{
// skip if not necessary
if( pMesh->mNumBones <= mMaxBoneCount )
+ {
return;
+ }
// necessary optimisation: build a list of all affecting bones for each vertex
// TODO: (thom) maybe add a custom allocator here to avoid allocating tens of thousands of small arrays
@@ -165,7 +171,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
{
const aiBone* bone = pMesh->mBones[a];
for( unsigned int b = 0; b < bone->mNumWeights; ++b)
+ {
vertexBones[ bone->mWeights[b].mVertexId ].push_back( BoneWeight( a, bone->mWeights[b].mWeight));
+ }
}
unsigned int numFacesHandled = 0;
@@ -189,7 +197,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
{
// skip if the face is already stored in a submesh
if( isFaceHandled[a] )
+ {
continue;
+ }
const aiFace& face = pMesh->mFaces[a];
// check every vertex if its bones would still fit into the current submesh
@@ -201,17 +211,27 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
unsigned int boneIndex = vb[c].first;
// if the bone is already used in this submesh, it's ok
if( isBoneUsed[boneIndex] )
+ {
continue;
+ }
// if it's not used, yet, we would need to add it. Store its bone index
if( std::find( newBonesAtCurrentFace.begin(), newBonesAtCurrentFace.end(), boneIndex) == newBonesAtCurrentFace.end() )
+ {
newBonesAtCurrentFace.push_back( boneIndex);
+ }
}
}
+ if (newBonesAtCurrentFace.size() > mMaxBoneCount)
+ {
+ throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!");
+ }
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount )
+ {
continue;
+ }
// mark all new bones as necessary
while( !newBonesAtCurrentFace.empty() )
@@ -219,7 +239,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
unsigned int newIndex = newBonesAtCurrentFace.back();
newBonesAtCurrentFace.pop_back(); // this also avoids the deallocation which comes with a clear()
if( isBoneUsed[newIndex] )
+ {
continue;
+ }
isBoneUsed[newIndex] = true;
numBones++;
@@ -237,7 +259,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
// create a new mesh to hold this subset of the source mesh
aiMesh* newMesh = new aiMesh;
if( pMesh->mName.length > 0 )
+ {
newMesh->mName.Set( format() << pMesh->mName.data << "_sub" << poNewMeshes.size());
+ }
newMesh->mMaterialIndex = pMesh->mMaterialIndex;
newMesh->mPrimitiveTypes = pMesh->mPrimitiveTypes;
poNewMeshes.push_back( newMesh);
@@ -247,7 +271,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
newMesh->mNumFaces = static_cast<unsigned int>(subMeshFaces.size());
newMesh->mVertices = new aiVector3D[newMesh->mNumVertices];
if( pMesh->HasNormals() )
+ {
newMesh->mNormals = new aiVector3D[newMesh->mNumVertices];
+ }
if( pMesh->HasTangentsAndBitangents() )
{
newMesh->mTangents = new aiVector3D[newMesh->mNumVertices];
@@ -256,13 +282,17 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
{
if( pMesh->HasTextureCoords( a) )
+ {
newMesh->mTextureCoords[a] = new aiVector3D[newMesh->mNumVertices];
+ }
newMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a];
}
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
{
if( pMesh->HasVertexColors( a) )
+ {
newMesh->mColors[a] = new aiColor4D[newMesh->mNumVertices];
+ }
}
// and copy over the data, generating faces with linear indices along the way
@@ -285,7 +315,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
newMesh->mVertices[nvi] = pMesh->mVertices[srcIndex];
if( pMesh->HasNormals() )
+ {
newMesh->mNormals[nvi] = pMesh->mNormals[srcIndex];
+ }
if( pMesh->HasTangentsAndBitangents() )
{
newMesh->mTangents[nvi] = pMesh->mTangents[srcIndex];
@@ -294,12 +326,16 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c )
{
if( pMesh->HasTextureCoords( c) )
+ {
newMesh->mTextureCoords[c][nvi] = pMesh->mTextureCoords[c][srcIndex];
+ }
}
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c )
{
if( pMesh->HasVertexColors( c) )
+ {
newMesh->mColors[c][nvi] = pMesh->mColors[c][srcIndex];
+ }
}
nvi++;
@@ -316,7 +352,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
for( unsigned int a = 0; a < pMesh->mNumBones; ++a )
{
if( !isBoneUsed[a] )
+ {
continue;
+ }
// create the new bone
const aiBone* srcBone = pMesh->mBones[a];
@@ -340,7 +378,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
{
unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ];
if( newBoneIndex != std::numeric_limits<unsigned int>::max() )
+ {
newMesh->mBones[newBoneIndex]->mNumWeights++;
+ }
}
}
diff --git a/thirdparty/assimp/code/Common/SplitByBoneCountProcess.h b/thirdparty/assimp/code/Common/SplitByBoneCountProcess.h
index 6c904a9df4..7185d03300 100644
--- a/thirdparty/assimp/code/Common/SplitByBoneCountProcess.h
+++ b/thirdparty/assimp/code/Common/SplitByBoneCountProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/StandardShapes.cpp b/thirdparty/assimp/code/Common/StandardShapes.cpp
index 2e5100130f..d474c61290 100644
--- a/thirdparty/assimp/code/Common/StandardShapes.cpp
+++ b/thirdparty/assimp/code/Common/StandardShapes.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/StdOStreamLogStream.h b/thirdparty/assimp/code/Common/StdOStreamLogStream.h
index 893e261a2b..4f5999775a 100644
--- a/thirdparty/assimp/code/Common/StdOStreamLogStream.h
+++ b/thirdparty/assimp/code/Common/StdOStreamLogStream.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/Subdivision.cpp b/thirdparty/assimp/code/Common/Subdivision.cpp
index 60c54939f5..08408f867a 100644
--- a/thirdparty/assimp/code/Common/Subdivision.cpp
+++ b/thirdparty/assimp/code/Common/Subdivision.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/TargetAnimation.cpp b/thirdparty/assimp/code/Common/TargetAnimation.cpp
index b8062499ff..3c61d21769 100644
--- a/thirdparty/assimp/code/Common/TargetAnimation.cpp
+++ b/thirdparty/assimp/code/Common/TargetAnimation.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/TargetAnimation.h b/thirdparty/assimp/code/Common/TargetAnimation.h
index 91634ab5aa..5b9c1881de 100644
--- a/thirdparty/assimp/code/Common/TargetAnimation.h
+++ b/thirdparty/assimp/code/Common/TargetAnimation.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/Version.cpp b/thirdparty/assimp/code/Common/Version.cpp
index cf1da7d5ba..f04d122333 100644
--- a/thirdparty/assimp/code/Common/Version.cpp
+++ b/thirdparty/assimp/code/Common/Version.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -55,7 +55,7 @@ static const char* LEGAL_INFORMATION =
"Open Asset Import Library (Assimp).\n"
"A free C/C++ library to import various 3D file formats into applications\n\n"
-"(c) 2006-2019, assimp team\n"
+"(c) 2006-2020, assimp team\n"
"License under the terms and conditions of the 3-clause BSD license\n"
"http://assimp.org\n"
;
@@ -67,6 +67,12 @@ ASSIMP_API const char* aiGetLegalString () {
}
// ------------------------------------------------------------------------------------------------
+// Get Assimp patch version
+ASSIMP_API unsigned int aiGetVersionPatch() {
+ return VER_PATCH;
+}
+
+// ------------------------------------------------------------------------------------------------
// Get Assimp minor version
ASSIMP_API unsigned int aiGetVersionMinor () {
return VER_MINOR;
diff --git a/thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp b/thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp
index 7cfd1a3505..e588dc2a4b 100644
--- a/thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp
+++ b/thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -58,7 +58,7 @@ VertexTriangleAdjacency::VertexTriangleAdjacency(aiFace *pcFaces,
{
// compute the number of referenced vertices if it wasn't specified by the caller
const aiFace* const pcFaceEnd = pcFaces + iNumFaces;
- if (!iNumVertices) {
+ if (0 == iNumVertices) {
for (aiFace* pcFace = pcFaces; pcFace != pcFaceEnd; ++pcFace) {
ai_assert( nullptr != pcFace );
ai_assert(3 == pcFace->mNumIndices);
@@ -68,7 +68,7 @@ VertexTriangleAdjacency::VertexTriangleAdjacency(aiFace *pcFaces,
}
}
- mNumVertices = iNumVertices;
+ mNumVertices = iNumVertices + 1;
unsigned int* pi;
diff --git a/thirdparty/assimp/code/Common/VertexTriangleAdjacency.h b/thirdparty/assimp/code/Common/VertexTriangleAdjacency.h
index f3be47612d..2226fc1c42 100644
--- a/thirdparty/assimp/code/Common/VertexTriangleAdjacency.h
+++ b/thirdparty/assimp/code/Common/VertexTriangleAdjacency.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Common/Win32DebugLogStream.h b/thirdparty/assimp/code/Common/Win32DebugLogStream.h
index a6063a261e..3a9d89c73c 100644
--- a/thirdparty/assimp/code/Common/Win32DebugLogStream.h
+++ b/thirdparty/assimp/code/Common/Win32DebugLogStream.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/assbin_chunks.h b/thirdparty/assimp/code/Common/assbin_chunks.h
index 15e4af5e7d..822df5198e 100644
--- a/thirdparty/assimp/code/Common/assbin_chunks.h
+++ b/thirdparty/assimp/code/Common/assbin_chunks.h
@@ -37,7 +37,7 @@ The ASSBIN file format is composed of chunks to represent the hierarchical aiSce
This makes the format extensible and allows backward-compatibility with future data structure
versions. The <tt>&lt;root&gt;/code/assbin_chunks.h</tt> header contains some magic constants
for use by stand-alone ASSBIN loaders. Also, Assimp's own file writer can be found
-in <tt>&lt;root&gt;/tools/assimp_cmd/WriteDumb.cpp</tt> (yes, the 'b' is no typo ...).
+in <tt>&lt;root&gt;/tools/assimp_cmd/WriteDump.cpp</tt> (yes, the 'b' is no typo ...).
@verbatim
diff --git a/thirdparty/assimp/code/Common/material.cpp b/thirdparty/assimp/code/Common/material.cpp
new file mode 100644
index 0000000000..f4a29dacfc
--- /dev/null
+++ b/thirdparty/assimp/code/Common/material.cpp
@@ -0,0 +1,97 @@
+/*
+Open Asset Import Library (assimp)
+----------------------------------------------------------------------
+
+Copyright (c) 2006-2020, 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 material.cpp
+/** Implement common material related functions. */
+
+#include <assimp/ai_assert.h>
+#include <assimp/material.h>
+
+// -------------------------------------------------------------------------------
+const char* TextureTypeToString(aiTextureType in)
+{
+ switch (in)
+ {
+ case aiTextureType_NONE:
+ return "n/a";
+ case aiTextureType_DIFFUSE:
+ return "Diffuse";
+ case aiTextureType_SPECULAR:
+ return "Specular";
+ case aiTextureType_AMBIENT:
+ return "Ambient";
+ case aiTextureType_EMISSIVE:
+ return "Emissive";
+ case aiTextureType_OPACITY:
+ return "Opacity";
+ case aiTextureType_NORMALS:
+ return "Normals";
+ case aiTextureType_HEIGHT:
+ return "Height";
+ case aiTextureType_SHININESS:
+ return "Shininess";
+ case aiTextureType_DISPLACEMENT:
+ return "Displacement";
+ case aiTextureType_LIGHTMAP:
+ return "Lightmap";
+ case aiTextureType_REFLECTION:
+ return "Reflection";
+ case aiTextureType_BASE_COLOR:
+ return "BaseColor";
+ case aiTextureType_NORMAL_CAMERA:
+ return "NormalCamera";
+ case aiTextureType_EMISSION_COLOR:
+ return "EmissionColor";
+ case aiTextureType_METALNESS:
+ return "Metalness";
+ case aiTextureType_DIFFUSE_ROUGHNESS:
+ return "DiffuseRoughness";
+ case aiTextureType_AMBIENT_OCCLUSION:
+ return "AmbientOcclusion";
+ case aiTextureType_UNKNOWN:
+ return "Unknown";
+ default:
+ break;
+ }
+ ai_assert(false);
+ return "BUG";
+}
diff --git a/thirdparty/assimp/code/Common/scene.cpp b/thirdparty/assimp/code/Common/scene.cpp
index d15619acff..f56562b1ca 100644
--- a/thirdparty/assimp/code/Common/scene.cpp
+++ b/thirdparty/assimp/code/Common/scene.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/simd.cpp b/thirdparty/assimp/code/Common/simd.cpp
index 04615f408e..3054459703 100644
--- a/thirdparty/assimp/code/Common/simd.cpp
+++ b/thirdparty/assimp/code/Common/simd.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/Common/simd.h b/thirdparty/assimp/code/Common/simd.h
index 3eecdd4581..17856fe720 100644
--- a/thirdparty/assimp/code/Common/simd.h
+++ b/thirdparty/assimp/code/Common/simd.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/FBX/FBXAnimation.cpp b/thirdparty/assimp/code/FBX/FBXAnimation.cpp
index 874914431b..9a54f61a01 100644
--- a/thirdparty/assimp/code/FBX/FBXAnimation.cpp
+++ b/thirdparty/assimp/code/FBX/FBXAnimation.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXBinaryTokenizer.cpp b/thirdparty/assimp/code/FBX/FBXBinaryTokenizer.cpp
index a4a2bc8e79..7faa0518b4 100644
--- a/thirdparty/assimp/code/FBX/FBXBinaryTokenizer.cpp
+++ b/thirdparty/assimp/code/FBX/FBXBinaryTokenizer.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXCommon.h b/thirdparty/assimp/code/FBX/FBXCommon.h
index e516449130..7f70eb784f 100644
--- a/thirdparty/assimp/code/FBX/FBXCommon.h
+++ b/thirdparty/assimp/code/FBX/FBXCommon.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -50,9 +50,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
namespace FBX
{
- const std::string NULL_RECORD = { // 13 null bytes
- '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'
- }; // who knows why
+ const std::string NULL_RECORD = { // 25 null bytes in 64-bit and 13 null bytes in 32-bit
+ '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',
+ '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'
+ }; // who knows why, it looks like two integers 32/64 bit (compressed and uncompressed sizes?) + 1 byte (might be compression type?)
const std::string SEPARATOR = {'\x00', '\x01'}; // for use inside strings
const std::string MAGIC_NODE_TAG = "_$AssimpFbx$"; // from import
const int64_t SECOND = 46186158000; // FBX's kTime unit
diff --git a/thirdparty/assimp/code/FBX/FBXCompileConfig.h b/thirdparty/assimp/code/FBX/FBXCompileConfig.h
index 03536a1823..5cdaa69605 100644
--- a/thirdparty/assimp/code/FBX/FBXCompileConfig.h
+++ b/thirdparty/assimp/code/FBX/FBXCompileConfig.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXConverter.cpp b/thirdparty/assimp/code/FBX/FBXConverter.cpp
index d8a22d9f74..22616a4802 100644
--- a/thirdparty/assimp/code/FBX/FBXConverter.cpp
+++ b/thirdparty/assimp/code/FBX/FBXConverter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -60,6 +60,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <assimp/CreateAnimMesh.h>
+#include <assimp/commonMetaData.h>
+#include <assimp/StringUtils.h>
#include <tuple>
#include <memory>
@@ -1562,7 +1564,7 @@ namespace Assimp {
bone_map.clear();
}
- catch (std::exception&e) {
+ catch (std::exception&) {
std::for_each(bones.begin(), bones.end(), Util::delete_fun<aiBone>());
throw;
}
@@ -1597,12 +1599,11 @@ namespace Assimp {
aiBone *bone = nullptr;
if (bone_map.count(deformer_name)) {
- std::cout << "retrieved bone from lookup " << bone_name.C_Str() << ". Deformer: " << deformer_name
- << std::endl;
- bone = bone_map[deformer_name];
- } else {
- std::cout << "created new bone " << bone_name.C_Str() << ". Deformer: " << deformer_name << std::endl;
- bone = new aiBone();
+ ASSIMP_LOG_DEBUG_F("retrieved bone from lookup ", bone_name.C_Str(), ". Deformer:", deformer_name);
+ bone = bone_map[deformer_name];
+ } else {
+ ASSIMP_LOG_DEBUG_F("created new bone ", bone_name.C_Str(), ". Deformer: ", deformer_name);
+ bone = new aiBone();
bone->mName = bone_name;
// store local transform link for post processing
@@ -1648,7 +1649,7 @@ namespace Assimp {
bone_map.insert(std::pair<const std::string, aiBone *>(deformer_name, bone));
}
- std::cout << "bone research: Indicies size: " << out_indices.size() << std::endl;
+ ASSIMP_LOG_DEBUG_F("bone research: Indicies size: ", out_indices.size());
// lookup must be populated in case something goes wrong
// this also allocates bones to mesh instance outside
@@ -2087,7 +2088,14 @@ namespace Assimp {
TrySetTextureProperties(out_mat, textures, "Maya|TEX_emissive_map|file", aiTextureType_EMISSION_COLOR, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_metallic_map|file", aiTextureType_METALNESS, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_roughness_map|file", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
- TrySetTextureProperties(out_mat, textures, "Maya|TEX_ao_map|file", aiTextureType_AMBIENT_OCCLUSION, mesh);
+ TrySetTextureProperties(out_mat, textures, "Maya|TEX_ao_map|file", aiTextureType_AMBIENT_OCCLUSION, mesh);
+
+ // 3DSMax PBR
+ TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|base_color_map", aiTextureType_BASE_COLOR, mesh);
+ TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|bump_map", aiTextureType_NORMAL_CAMERA, mesh);
+ TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|emission_map", aiTextureType_EMISSION_COLOR, mesh);
+ TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|metalness_map", aiTextureType_METALNESS, mesh);
+ TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|roughness_map", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
}
void FBXConverter::SetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh)
@@ -3604,7 +3612,9 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
return;
}
- out->mMetaData = aiMetadata::Alloc(15);
+ const bool hasGenerator = !doc.Creator().empty();
+
+ out->mMetaData = aiMetadata::Alloc(16 + (hasGenerator ? 1 : 0));
out->mMetaData->Set(0, "UpAxis", doc.GlobalSettings().UpAxis());
out->mMetaData->Set(1, "UpAxisSign", doc.GlobalSettings().UpAxisSign());
out->mMetaData->Set(2, "FrontAxis", doc.GlobalSettings().FrontAxis());
@@ -3620,6 +3630,11 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
out->mMetaData->Set(12, "TimeSpanStart", doc.GlobalSettings().TimeSpanStart());
out->mMetaData->Set(13, "TimeSpanStop", doc.GlobalSettings().TimeSpanStop());
out->mMetaData->Set(14, "CustomFrameRate", doc.GlobalSettings().CustomFrameRate());
+ out->mMetaData->Set(15, AI_METADATA_SOURCE_FORMAT_VERSION, aiString(to_string(doc.FBXVersion())));
+ if (hasGenerator)
+ {
+ out->mMetaData->Set(16, AI_METADATA_SOURCE_GENERATOR, aiString(doc.Creator()));
+ }
}
void FBXConverter::TransferDataToScene()
diff --git a/thirdparty/assimp/code/FBX/FBXConverter.h b/thirdparty/assimp/code/FBX/FBXConverter.h
index 46693bdca6..c5ad47059b 100644
--- a/thirdparty/assimp/code/FBX/FBXConverter.h
+++ b/thirdparty/assimp/code/FBX/FBXConverter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -421,6 +421,8 @@ private:
double& minTime,
Model::RotOrder order);
+ // ------------------------------------------------------------------------------------------------
+ // Copy global geometric data and some information about the source asset into scene metadata.
void ConvertGlobalSettings();
// ------------------------------------------------------------------------------------------------
diff --git a/thirdparty/assimp/code/FBX/FBXDeformer.cpp b/thirdparty/assimp/code/FBX/FBXDeformer.cpp
index 6927553450..4b76cd0fae 100644
--- a/thirdparty/assimp/code/FBX/FBXDeformer.cpp
+++ b/thirdparty/assimp/code/FBX/FBXDeformer.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXDocument.cpp b/thirdparty/assimp/code/FBX/FBXDocument.cpp
index 506fd978dd..ddb971b3fd 100644
--- a/thirdparty/assimp/code/FBX/FBXDocument.cpp
+++ b/thirdparty/assimp/code/FBX/FBXDocument.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXDocument.h b/thirdparty/assimp/code/FBX/FBXDocument.h
index a60d7d9efa..8984b3df7c 100644
--- a/thirdparty/assimp/code/FBX/FBXDocument.h
+++ b/thirdparty/assimp/code/FBX/FBXDocument.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXDocumentUtil.cpp b/thirdparty/assimp/code/FBX/FBXDocumentUtil.cpp
index f84691479a..7178e9f266 100644
--- a/thirdparty/assimp/code/FBX/FBXDocumentUtil.cpp
+++ b/thirdparty/assimp/code/FBX/FBXDocumentUtil.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXDocumentUtil.h b/thirdparty/assimp/code/FBX/FBXDocumentUtil.h
index 2450109e59..2d76ee031d 100644
--- a/thirdparty/assimp/code/FBX/FBXDocumentUtil.h
+++ b/thirdparty/assimp/code/FBX/FBXDocumentUtil.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2012, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/thirdparty/assimp/code/FBX/FBXExportNode.cpp b/thirdparty/assimp/code/FBX/FBXExportNode.cpp
index 06c89cee46..53aa719f45 100644
--- a/thirdparty/assimp/code/FBX/FBXExportNode.cpp
+++ b/thirdparty/assimp/code/FBX/FBXExportNode.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -325,9 +325,9 @@ void FBX::Node::BeginBinary(Assimp::StreamWriterLE &s)
this->start_pos = s.Tell();
// placeholders for end pos and property section info
- s.PutU4(0); // end pos
- s.PutU4(0); // number of properties
- s.PutU4(0); // total property section length
+ s.PutU8(0); // end pos
+ s.PutU8(0); // number of properties
+ s.PutU8(0); // total property section length
// node name
s.PutU1(uint8_t(name.size())); // length of node name
@@ -352,9 +352,9 @@ void FBX::Node::EndPropertiesBinary(
size_t pos = s.Tell();
ai_assert(pos > property_start);
size_t property_section_size = pos - property_start;
- s.Seek(start_pos + 4);
- s.PutU4(uint32_t(num_properties));
- s.PutU4(uint32_t(property_section_size));
+ s.Seek(start_pos + 8); // 8 bytes of uint64_t of end_pos
+ s.PutU8(num_properties);
+ s.PutU8(property_section_size);
s.Seek(pos);
}
@@ -375,7 +375,7 @@ void FBX::Node::EndBinary(
// now go back and write initial pos
this->end_pos = s.Tell();
s.Seek(start_pos);
- s.PutU4(uint32_t(end_pos));
+ s.PutU8(end_pos);
s.Seek(end_pos);
}
diff --git a/thirdparty/assimp/code/FBX/FBXExportNode.h b/thirdparty/assimp/code/FBX/FBXExportNode.h
index ef3bc781a4..2e8f491a13 100644
--- a/thirdparty/assimp/code/FBX/FBXExportNode.h
+++ b/thirdparty/assimp/code/FBX/FBXExportNode.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXExportProperty.cpp b/thirdparty/assimp/code/FBX/FBXExportProperty.cpp
index f2a63b72b9..11ee350038 100644
--- a/thirdparty/assimp/code/FBX/FBXExportProperty.cpp
+++ b/thirdparty/assimp/code/FBX/FBXExportProperty.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXExportProperty.h b/thirdparty/assimp/code/FBX/FBXExportProperty.h
index d692fe6ee3..6baae8b69c 100644
--- a/thirdparty/assimp/code/FBX/FBXExportProperty.h
+++ b/thirdparty/assimp/code/FBX/FBXExportProperty.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXExporter.cpp b/thirdparty/assimp/code/FBX/FBXExporter.cpp
index 9316dc4f02..594951e78a 100644
--- a/thirdparty/assimp/code/FBX/FBXExporter.cpp
+++ b/thirdparty/assimp/code/FBX/FBXExporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -81,8 +81,8 @@ using namespace Assimp::FBX;
// some constants that we'll use for writing metadata
namespace Assimp {
namespace FBX {
- const std::string EXPORT_VERSION_STR = "7.4.0";
- const uint32_t EXPORT_VERSION_INT = 7400; // 7.4 == 2014/2015
+ const std::string EXPORT_VERSION_STR = "7.5.0";
+ const uint32_t EXPORT_VERSION_INT = 7500; // 7.5 == 2016+
// FBX files have some hashed values that depend on the creation time field,
// but for now we don't actually know how to generate these.
// what we can do is set them to a known-working version.
@@ -1860,6 +1860,7 @@ void FBXExporter::WriteObjects ()
sdnode.AddChild("Version", int32_t(100));
sdnode.AddChild("UserData", "", "");
+ std::set<int32_t> setWeightedVertex;
// add indices and weights, if any
if (b) {
std::vector<int32_t> subdef_indices;
@@ -1867,7 +1868,8 @@ void FBXExporter::WriteObjects ()
int32_t last_index = -1;
for (size_t wi = 0; wi < b->mNumWeights; ++wi) {
int32_t vi = vertex_indices[b->mWeights[wi].mVertexId];
- if (vi == last_index) {
+ bool bIsWeightedAlready = (setWeightedVertex.find(vi) != setWeightedVertex.end());
+ if (vi == last_index || bIsWeightedAlready) {
// only for vertices we exported to fbx
// TODO, FIXME: this assumes identically-located vertices
// will always deform in the same way.
@@ -1877,6 +1879,7 @@ void FBXExporter::WriteObjects ()
// identical vertex.
continue;
}
+ setWeightedVertex.insert(vi);
subdef_indices.push_back(vi);
subdef_weights.push_back(b->mWeights[wi].mWeight);
last_index = vi;
diff --git a/thirdparty/assimp/code/FBX/FBXExporter.h b/thirdparty/assimp/code/FBX/FBXExporter.h
index 1ae727eda9..eb8bfaf3b3 100644
--- a/thirdparty/assimp/code/FBX/FBXExporter.h
+++ b/thirdparty/assimp/code/FBX/FBXExporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXImportSettings.h b/thirdparty/assimp/code/FBX/FBXImportSettings.h
index 1a4c80f8b2..974931b4cb 100644
--- a/thirdparty/assimp/code/FBX/FBXImportSettings.h
+++ b/thirdparty/assimp/code/FBX/FBXImportSettings.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXImporter.cpp b/thirdparty/assimp/code/FBX/FBXImporter.cpp
index afcc1ddc78..571f608830 100644
--- a/thirdparty/assimp/code/FBX/FBXImporter.cpp
+++ b/thirdparty/assimp/code/FBX/FBXImporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXImporter.h b/thirdparty/assimp/code/FBX/FBXImporter.h
index c365b2cddf..63375e40d0 100644
--- a/thirdparty/assimp/code/FBX/FBXImporter.h
+++ b/thirdparty/assimp/code/FBX/FBXImporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXMaterial.cpp b/thirdparty/assimp/code/FBX/FBXMaterial.cpp
index f43a8b84b0..88ac9db16b 100644
--- a/thirdparty/assimp/code/FBX/FBXMaterial.cpp
+++ b/thirdparty/assimp/code/FBX/FBXMaterial.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp b/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
index 1386e2383c..4a3de9f993 100644
--- a/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
+++ b/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -446,14 +446,19 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
return;
}
std::vector<T> tempData;
- ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
+ ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
- data_out.resize(vertex_count);
- for (size_t i = 0, e = tempData.size(); i < e; ++i) {
+ if (tempData.size() != mapping_offsets.size()) {
+ FBXImporter::LogError(Formatter::format("length of input data unexpected for ByVertice mapping: ")
+ << tempData.size() << ", expected " << mapping_offsets.size());
+ return;
+ }
+ data_out.resize(vertex_count);
+ for (size_t i = 0, e = tempData.size(); i < e; ++i) {
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
for (unsigned int j = istart; j < iend; ++j) {
- data_out[mappings[j]] = tempData[i];
+ data_out[mappings[j]] = tempData[i];
}
}
}
@@ -461,10 +466,17 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
- data_out.resize(vertex_count);
-
std::vector<int> uvIndices;
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
+
+ if (uvIndices.size() != vertex_count) {
+ FBXImporter::LogError(Formatter::format("length of input data unexpected for ByVertice mapping: ")
+ << uvIndices.size() << ", expected " << vertex_count);
+ return;
+ }
+
+ data_out.resize(vertex_count);
+
for (size_t i = 0, e = uvIndices.size(); i < e; ++i) {
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
@@ -493,16 +505,17 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
- data_out.resize(vertex_count);
-
std::vector<int> uvIndices;
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
if (uvIndices.size() != vertex_count) {
- FBXImporter::LogError("length of input data unexpected for ByPolygonVertex mapping");
+ FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
+ << uvIndices.size() << ", expected " << vertex_count);
return;
}
+ data_out.resize(vertex_count);
+
const T empty;
unsigned int next = 0;
for(int i : uvIndices) {
diff --git a/thirdparty/assimp/code/FBX/FBXMeshGeometry.h b/thirdparty/assimp/code/FBX/FBXMeshGeometry.h
index d6d4512177..97265e4b21 100644
--- a/thirdparty/assimp/code/FBX/FBXMeshGeometry.h
+++ b/thirdparty/assimp/code/FBX/FBXMeshGeometry.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXModel.cpp b/thirdparty/assimp/code/FBX/FBXModel.cpp
index 589af36ac7..e34f3a610e 100644
--- a/thirdparty/assimp/code/FBX/FBXModel.cpp
+++ b/thirdparty/assimp/code/FBX/FBXModel.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXNodeAttribute.cpp b/thirdparty/assimp/code/FBX/FBXNodeAttribute.cpp
index b72e5637ee..2ebf917e33 100644
--- a/thirdparty/assimp/code/FBX/FBXNodeAttribute.cpp
+++ b/thirdparty/assimp/code/FBX/FBXNodeAttribute.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXParser.cpp b/thirdparty/assimp/code/FBX/FBXParser.cpp
index 4a9346040d..aef59d60ca 100644
--- a/thirdparty/assimp/code/FBX/FBXParser.cpp
+++ b/thirdparty/assimp/code/FBX/FBXParser.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -367,9 +367,13 @@ float ParseTokenAsFloat(const Token& t, const char*& err_out)
// first - next in the fbx token stream comes ',',
// which fast_atof could interpret as decimal point.
#define MAX_FLOAT_LENGTH 31
- char temp[MAX_FLOAT_LENGTH + 1];
const size_t length = static_cast<size_t>(t.end()-t.begin());
- std::copy(t.begin(),t.end(),temp);
+ if (length > MAX_FLOAT_LENGTH) {
+ return 0.f;
+ }
+
+ char temp[MAX_FLOAT_LENGTH + 1];
+ std::copy(t.begin(), t.end(), temp);
temp[std::min(static_cast<size_t>(MAX_FLOAT_LENGTH),length)] = '\0';
return fast_atof(temp);
diff --git a/thirdparty/assimp/code/FBX/FBXParser.h b/thirdparty/assimp/code/FBX/FBXParser.h
index 7b0cf72039..5d8d00307f 100644
--- a/thirdparty/assimp/code/FBX/FBXParser.h
+++ b/thirdparty/assimp/code/FBX/FBXParser.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXProperties.cpp b/thirdparty/assimp/code/FBX/FBXProperties.cpp
index 8d7036b6a9..f6b8048949 100644
--- a/thirdparty/assimp/code/FBX/FBXProperties.cpp
+++ b/thirdparty/assimp/code/FBX/FBXProperties.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXProperties.h b/thirdparty/assimp/code/FBX/FBXProperties.h
index 58755542fc..209d5e940a 100644
--- a/thirdparty/assimp/code/FBX/FBXProperties.h
+++ b/thirdparty/assimp/code/FBX/FBXProperties.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXTokenizer.cpp b/thirdparty/assimp/code/FBX/FBXTokenizer.cpp
index 252cce3557..831c40061b 100644
--- a/thirdparty/assimp/code/FBX/FBXTokenizer.cpp
+++ b/thirdparty/assimp/code/FBX/FBXTokenizer.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXTokenizer.h b/thirdparty/assimp/code/FBX/FBXTokenizer.h
index afa588a470..cadc82770f 100644
--- a/thirdparty/assimp/code/FBX/FBXTokenizer.h
+++ b/thirdparty/assimp/code/FBX/FBXTokenizer.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXUtil.cpp b/thirdparty/assimp/code/FBX/FBXUtil.cpp
index c10e057c8c..50dd78a4cd 100644
--- a/thirdparty/assimp/code/FBX/FBXUtil.cpp
+++ b/thirdparty/assimp/code/FBX/FBXUtil.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/FBX/FBXUtil.h b/thirdparty/assimp/code/FBX/FBXUtil.h
index b634418858..77bb0ad304 100644
--- a/thirdparty/assimp/code/FBX/FBXUtil.h
+++ b/thirdparty/assimp/code/FBX/FBXUtil.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/Material/MaterialSystem.cpp b/thirdparty/assimp/code/Material/MaterialSystem.cpp
index 0be6e9f7bb..1c034e55f8 100644
--- a/thirdparty/assimp/code/Material/MaterialSystem.cpp
+++ b/thirdparty/assimp/code/Material/MaterialSystem.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -273,14 +273,14 @@ aiReturn aiGetMaterialColor(const aiMaterial* pMat,
}
// ------------------------------------------------------------------------------------------------
-// Get a aiUVTransform (4 floats) from the material
+// Get a aiUVTransform (5 floats) from the material
aiReturn aiGetMaterialUVTransform(const aiMaterial* pMat,
const char* pKey,
unsigned int type,
unsigned int index,
aiUVTransform* pOut)
{
- unsigned int iMax = 4;
+ unsigned int iMax = 5;
return aiGetMaterialFloatArray(pMat,pKey,type,index,(ai_real*)pOut,&iMax);
}
@@ -471,12 +471,12 @@ aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
aiPropertyTypeInfo pType
)
{
- ai_assert( pInput != NULL );
- ai_assert( pKey != NULL );
+ ai_assert( pInput != nullptr );
+ ai_assert(pKey != nullptr );
ai_assert( 0 != pSizeInBytes );
if ( 0 == pSizeInBytes ) {
-
+ return AI_FAILURE;
}
// first search the list whether there is already an entry with this key
@@ -504,7 +504,7 @@ aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
pcNew->mData = new char[pSizeInBytes];
memcpy (pcNew->mData,pInput,pSizeInBytes);
- pcNew->mKey.length = ::strlen(pKey);
+ pcNew->mKey.length = (ai_uint32)::strlen(pKey);
ai_assert ( MAXLEN > pcNew->mKey.length);
strcpy( pcNew->mKey.data, pKey );
diff --git a/thirdparty/assimp/code/Material/MaterialSystem.h b/thirdparty/assimp/code/Material/MaterialSystem.h
index 67d53578cb..6df9818a35 100644
--- a/thirdparty/assimp/code/Material/MaterialSystem.h
+++ b/thirdparty/assimp/code/Material/MaterialSystem.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.cpp b/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.cpp
index 75daeb6b59..31c99ae94a 100644
--- a/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.cpp
@@ -2,8 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
-
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -36,7 +35,6 @@ 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.
-
----------------------------------------------------------------------
*/
#include "ArmaturePopulate.h"
@@ -50,219 +48,215 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
/// The default class constructor.
-ArmaturePopulate::ArmaturePopulate() : BaseProcess()
-{}
+ArmaturePopulate::ArmaturePopulate() :
+ BaseProcess() {
+ // do nothing
+}
/// The class destructor.
-ArmaturePopulate::~ArmaturePopulate()
-{}
+ArmaturePopulate::~ArmaturePopulate() {
+ // do nothing
+}
bool ArmaturePopulate::IsActive(unsigned int pFlags) const {
- return (pFlags & aiProcess_PopulateArmatureData) != 0;
+ return (pFlags & aiProcess_PopulateArmatureData) != 0;
}
void ArmaturePopulate::SetupProperties(const Importer *pImp) {
- // do nothing
+ // do nothing
}
void ArmaturePopulate::Execute(aiScene *out) {
- // Now convert all bone positions to the correct mOffsetMatrix
- std::vector<aiBone *> bones;
- std::vector<aiNode *> nodes;
- std::map<aiBone *, aiNode *> bone_stack;
- BuildBoneList(out->mRootNode, out->mRootNode, out, bones);
- BuildNodeList(out->mRootNode, nodes);
+ // Now convert all bone positions to the correct mOffsetMatrix
+ std::vector<aiBone *> bones;
+ std::vector<aiNode *> nodes;
+ std::map<aiBone *, aiNode *> bone_stack;
+ BuildBoneList(out->mRootNode, out->mRootNode, out, bones);
+ BuildNodeList(out->mRootNode, nodes);
- BuildBoneStack(out->mRootNode, out->mRootNode, out, bones, bone_stack, nodes);
+ BuildBoneStack(out->mRootNode, out->mRootNode, out, bones, bone_stack, nodes);
- ASSIMP_LOG_DEBUG_F("Bone stack size: ", bone_stack.size());
+ ASSIMP_LOG_DEBUG_F("Bone stack size: ", bone_stack.size());
- for (std::pair<aiBone *, aiNode *> kvp : bone_stack) {
- aiBone *bone = kvp.first;
- aiNode *bone_node = kvp.second;
- ASSIMP_LOG_DEBUG_F("active node lookup: ", bone->mName.C_Str());
- // lcl transform grab - done in generate_nodes :)
+ for (std::pair<aiBone *, aiNode *> kvp : bone_stack) {
+ aiBone *bone = kvp.first;
+ aiNode *bone_node = kvp.second;
+ ASSIMP_LOG_DEBUG_F("active node lookup: ", bone->mName.C_Str());
+ // lcl transform grab - done in generate_nodes :)
- // bone->mOffsetMatrix = bone_node->mTransformation;
- aiNode *armature = GetArmatureRoot(bone_node, bones);
+ // bone->mOffsetMatrix = bone_node->mTransformation;
+ aiNode *armature = GetArmatureRoot(bone_node, bones);
- ai_assert(armature);
+ ai_assert(armature);
- // set up bone armature id
- bone->mArmature = armature;
+ // set up bone armature id
+ bone->mArmature = armature;
- // set this bone node to be referenced properly
- ai_assert(bone_node);
- bone->mNode = bone_node;
- }
+ // set this bone node to be referenced properly
+ ai_assert(bone_node);
+ bone->mNode = bone_node;
+ }
}
-/* Reprocess all nodes to calculate bone transforms properly based on the REAL
- * mOffsetMatrix not the local. */
-/* Before this would use mesh transforms which is wrong for bone transforms */
-/* Before this would work for simple character skeletons but not complex meshes
- * with multiple origins */
-/* Source: sketch fab log cutter fbx */
+// Reprocess all nodes to calculate bone transforms properly based on the REAL
+// mOffsetMatrix not the local.
+// Before this would use mesh transforms which is wrong for bone transforms
+// Before this would work for simple character skeletons but not complex meshes
+// with multiple origins
+// Source: sketch fab log cutter fbx
void ArmaturePopulate::BuildBoneList(aiNode *current_node,
const aiNode *root_node,
const aiScene *scene,
std::vector<aiBone *> &bones) {
- ai_assert(scene);
- for (unsigned int nodeId = 0; nodeId < current_node->mNumChildren; ++nodeId) {
- aiNode *child = current_node->mChildren[nodeId];
- ai_assert(child);
-
- // check for bones
- for (unsigned int meshId = 0; meshId < child->mNumMeshes; ++meshId) {
- ai_assert(child->mMeshes);
- unsigned int mesh_index = child->mMeshes[meshId];
- aiMesh *mesh = scene->mMeshes[mesh_index];
- ai_assert(mesh);
-
- for (unsigned int boneId = 0; boneId < mesh->mNumBones; ++boneId) {
- aiBone *bone = mesh->mBones[boneId];
- ai_assert(bone);
-
- // duplicate meshes exist with the same bones sometimes :)
- // so this must be detected
- if (std::find(bones.begin(), bones.end(), bone) == bones.end()) {
- // add the element once
- bones.push_back(bone);
+ ai_assert(scene);
+ for (unsigned int nodeId = 0; nodeId < current_node->mNumChildren; ++nodeId) {
+ aiNode *child = current_node->mChildren[nodeId];
+ ai_assert(child);
+
+ // check for bones
+ for (unsigned int meshId = 0; meshId < child->mNumMeshes; ++meshId) {
+ ai_assert(child->mMeshes);
+ unsigned int mesh_index = child->mMeshes[meshId];
+ aiMesh *mesh = scene->mMeshes[mesh_index];
+ ai_assert(mesh);
+
+ for (unsigned int boneId = 0; boneId < mesh->mNumBones; ++boneId) {
+ aiBone *bone = mesh->mBones[boneId];
+ ai_assert(bone);
+
+ // duplicate mehes exist with the same bones sometimes :)
+ // so this must be detected
+ if (std::find(bones.begin(), bones.end(), bone) == bones.end()) {
+ // add the element once
+ bones.push_back(bone);
+ }
+ }
+
+ // find mesh and get bones
+ // then do recursive lookup for bones in root node hierarchy
}
- }
- // find mesh and get bones
- // then do recursive lookup for bones in root node hierarchy
+ BuildBoneList(child, root_node, scene, bones);
}
-
- BuildBoneList(child, root_node, scene, bones);
- }
}
-/* Prepare flat node list which can be used for non recursive lookups later */
+// Prepare flat node list which can be used for non recursive lookups later
void ArmaturePopulate::BuildNodeList(const aiNode *current_node,
std::vector<aiNode *> &nodes) {
- ai_assert(current_node);
+ ai_assert(current_node);
- for (unsigned int nodeId = 0; nodeId < current_node->mNumChildren; ++nodeId) {
- aiNode *child = current_node->mChildren[nodeId];
- ai_assert(child);
+ for (unsigned int nodeId = 0; nodeId < current_node->mNumChildren; ++nodeId) {
+ aiNode *child = current_node->mChildren[nodeId];
+ ai_assert(child);
- nodes.push_back(child);
+ if (child->mNumMeshes == 0) {
+ nodes.push_back(child);
+ }
- BuildNodeList(child, nodes);
+ BuildNodeList(child, nodes);
}
}
-/* A bone stack allows us to have multiple armatures, with the same bone names
- * A bone stack allows us also to retrieve bones true transform even with
- * duplicate names :)
- */
+// A bone stack allows us to have multiple armatures, with the same bone names
+// A bone stack allows us also to retrieve bones true transform even with
+// duplicate names :)
void ArmaturePopulate::BuildBoneStack(aiNode *current_node,
const aiNode *root_node,
const aiScene *scene,
const std::vector<aiBone *> &bones,
std::map<aiBone *, aiNode *> &bone_stack,
- std::vector<aiNode *> &node_stack) {
- ai_assert(scene);
- ai_assert(root_node);
- ai_assert(!node_stack.empty());
-
- for (aiBone *bone : bones) {
- ai_assert(bone);
- aiNode *node = GetNodeFromStack(bone->mName, node_stack);
- if (node == nullptr) {
- node_stack.clear();
- BuildNodeList(root_node, node_stack);
- ASSIMP_LOG_DEBUG_F("Resetting bone stack: nullptr element ", bone->mName.C_Str());
-
- node = GetNodeFromStack(bone->mName, node_stack);
-
- if (!node) {
- ASSIMP_LOG_ERROR("serious import issue node for bone was not detected");
- continue;
- }
- }
+ std::vector<aiNode *> &node_stack) {
+ ai_assert(scene);
+ ai_assert(root_node);
+ ai_assert(!node_stack.empty());
- ASSIMP_LOG_DEBUG_F("Successfully added bone[", bone->mName.C_Str(), "] to stack and bone node is: ", node->mName.C_Str());
+ for (aiBone *bone : bones) {
+ ai_assert(bone);
+ aiNode *node = GetNodeFromStack(bone->mName, node_stack);
+ if (node == nullptr) {
+ node_stack.clear();
+ BuildNodeList(root_node, node_stack);
+ ASSIMP_LOG_DEBUG_F("Resetting bone stack: nullptr element ", bone->mName.C_Str());
+
+ node = GetNodeFromStack(bone->mName, node_stack);
+
+ if (!node) {
+ ASSIMP_LOG_ERROR("serious import issue node for bone was not detected");
+ continue;
+ }
+ }
- bone_stack.insert(std::pair<aiBone *, aiNode *>(bone, node));
- }
-}
+ ASSIMP_LOG_DEBUG_F("Successfully added bone[", bone->mName.C_Str(), "] to stack and bone node is: ", node->mName.C_Str());
+ bone_stack.insert(std::pair<aiBone *, aiNode *>(bone, node));
+ }
+}
-/* Returns the armature root node */
-/* This is required to be detected for a bone initially, it will recurse up
- * until it cannot find another bone and return the node No known failure
- * points. (yet)
- */
+// Returns the armature root node
+// This is required to be detected for a bone initially, it will recurse up
+// until it cannot find another bone and return the node No known failure
+// points. (yet)
aiNode *ArmaturePopulate::GetArmatureRoot(aiNode *bone_node,
std::vector<aiBone *> &bone_list) {
- while (bone_node) {
- if (!IsBoneNode(bone_node->mName, bone_list)) {
- ASSIMP_LOG_DEBUG_F("GetArmatureRoot() Found valid armature: ", bone_node->mName.C_Str());
- return bone_node;
- }
+ while (bone_node) {
+ if (!IsBoneNode(bone_node->mName, bone_list)) {
+ ASSIMP_LOG_DEBUG_F("GetArmatureRoot() Found valid armature: ", bone_node->mName.C_Str());
+ return bone_node;
+ }
- bone_node = bone_node->mParent;
- }
-
- ASSIMP_LOG_ERROR("GetArmatureRoot() can't find armature!");
-
- return nullptr;
-}
+ bone_node = bone_node->mParent;
+ }
+ ASSIMP_LOG_ERROR("GetArmatureRoot() can't find armature!");
+ return nullptr;
+}
-/* Simple IsBoneNode check if this could be a bone */
+// Simple IsBoneNode check if this could be a bone
bool ArmaturePopulate::IsBoneNode(const aiString &bone_name,
std::vector<aiBone *> &bones) {
- for (aiBone *bone : bones) {
- if (bone->mName == bone_name) {
- return true;
+ for (aiBone *bone : bones) {
+ if (bone->mName == bone_name) {
+ return true;
+ }
}
- }
- return false;
+ return false;
}
-/* Pop this node by name from the stack if found */
-/* Used in multiple armature situations with duplicate node / bone names */
-/* Known flaw: cannot have nodes with bone names, will be fixed in later release
- */
-/* (serious to be fixed) Known flaw: nodes which have more than one bone could
- * be prematurely dropped from stack */
+// Pop this node by name from the stack if found
+// Used in multiple armature situations with duplicate node / bone names
+// Known flaw: cannot have nodes with bone names, will be fixed in later release
+// (serious to be fixed) Known flaw: nodes which have more than one bone could
+// be prematurely dropped from stack
aiNode *ArmaturePopulate::GetNodeFromStack(const aiString &node_name,
std::vector<aiNode *> &nodes) {
- std::vector<aiNode *>::iterator iter;
- aiNode *found = nullptr;
- for (iter = nodes.begin(); iter < nodes.end(); ++iter) {
- aiNode *element = *iter;
- ai_assert(element);
- // node valid and node name matches
- if (element->mName == node_name) {
- found = element;
- break;
+ std::vector<aiNode *>::iterator iter;
+ aiNode *found = nullptr;
+ for (iter = nodes.begin(); iter < nodes.end(); ++iter) {
+ aiNode *element = *iter;
+ ai_assert(element);
+ // node valid and node name matches
+ if (element->mName == node_name) {
+ found = element;
+ break;
+ }
}
- }
- if (found != nullptr) {
- ASSIMP_LOG_INFO_F("Removed node from stack: ", found->mName.C_Str());
- // now pop the element from the node list
- nodes.erase(iter);
+ if (found != nullptr) {
+ ASSIMP_LOG_INFO_F("Removed node from stack: ", found->mName.C_Str());
+ // now pop the element from the node list
+ nodes.erase(iter);
- return found;
- }
+ return found;
+ }
- // unique names can cause this problem
- ASSIMP_LOG_ERROR("[Serious] GetNodeFromStack() can't find node from stack!");
+ // unique names can cause this problem
+ ASSIMP_LOG_ERROR("[Serious] GetNodeFromStack() can't find node from stack!");
- return nullptr;
+ return nullptr;
}
-
-
-
} // Namespace Assimp
diff --git a/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.h b/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.h
index aa1ad7c80c..8985e1d1d8 100644
--- a/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.h
+++ b/thirdparty/assimp/code/PostProcessing/ArmaturePopulate.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.cpp b/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.cpp
index a3f7dd2557..4af335d2f0 100644
--- a/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.h b/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.h
index 3568a624f8..bdd5ca7faa 100644
--- a/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/CalcTangentsProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.cpp b/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.cpp
index df4d44337d..1ebf798bd5 100644
--- a/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.h b/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.h
index a6d36e06ea..b4ad0f501f 100644
--- a/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/ComputeUVMappingProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.cpp b/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.cpp
index b7cd4f0bc6..6ca73f10e9 100644
--- a/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.h b/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.h
index f32b91fc39..de984a1052 100644
--- a/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/ConvertToLHProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -137,8 +137,9 @@ public:
// -------------------------------------------------------------------
void Execute( aiScene* pScene);
-protected:
- void ProcessMesh( aiMesh* pMesh);
+public:
+ /** Some other types of post-processing require winding order flips */
+ static void ProcessMesh( aiMesh* pMesh);
};
// ---------------------------------------------------------------------------
diff --git a/thirdparty/assimp/code/PostProcessing/DeboneProcess.cpp b/thirdparty/assimp/code/PostProcessing/DeboneProcess.cpp
index 83b8336bc9..9d6313f71c 100644
--- a/thirdparty/assimp/code/PostProcessing/DeboneProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/DeboneProcess.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/DeboneProcess.h b/thirdparty/assimp/code/PostProcessing/DeboneProcess.h
index 8b64c2acc6..31955f2bda 100644
--- a/thirdparty/assimp/code/PostProcessing/DeboneProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/DeboneProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.cpp b/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.cpp
index b11615bb82..1d7cf33b02 100644
--- a/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.h b/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.h
index c710c5a5ee..b9e942d559 100644
--- a/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/DropFaceNormalsProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.cpp b/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.cpp
index 739382a057..b187acf53c 100644
--- a/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -128,7 +128,8 @@ bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const {
auto oldTextures = pScene->mTextures;
pScene->mTextures = new aiTexture*[pScene->mNumTextures];
::memmove(pScene->mTextures, oldTextures, sizeof(aiTexture*) * (pScene->mNumTextures - 1u));
-
+ delete [] oldTextures;
+
// Add the new texture
auto pTexture = new aiTexture;
pTexture->mHeight = 0; // Means that this is still compressed
diff --git a/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.h b/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.h
index 3c4b2eab4e..bbe2656f56 100644
--- a/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/EmbedTexturesProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/FindDegenerates.cpp b/thirdparty/assimp/code/PostProcessing/FindDegenerates.cpp
index 50fac46dba..dfdfec6ccf 100644
--- a/thirdparty/assimp/code/PostProcessing/FindDegenerates.cpp
+++ b/thirdparty/assimp/code/PostProcessing/FindDegenerates.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/FindDegenerates.h b/thirdparty/assimp/code/PostProcessing/FindDegenerates.h
index 7a15e77cf1..1edaab6570 100644
--- a/thirdparty/assimp/code/PostProcessing/FindDegenerates.h
+++ b/thirdparty/assimp/code/PostProcessing/FindDegenerates.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.cpp b/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.cpp
index 64907458a1..9a4c6f53b8 100644
--- a/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.h b/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.h
index 64b838d7cc..dcac4bf839 100644
--- a/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/FindInstancesProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.cpp b/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.cpp
index 016884c6e7..c557d7f707 100644
--- a/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.h b/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.h
index ce7375f34f..50a2fe04c6 100644
--- a/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/FindInvalidDataProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/FixNormalsStep.cpp b/thirdparty/assimp/code/PostProcessing/FixNormalsStep.cpp
index bbbe6899b4..bb2aa06cc7 100644
--- a/thirdparty/assimp/code/PostProcessing/FixNormalsStep.cpp
+++ b/thirdparty/assimp/code/PostProcessing/FixNormalsStep.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/FixNormalsStep.h b/thirdparty/assimp/code/PostProcessing/FixNormalsStep.h
index f60ce596a4..c022d03640 100644
--- a/thirdparty/assimp/code/PostProcessing/FixNormalsStep.h
+++ b/thirdparty/assimp/code/PostProcessing/FixNormalsStep.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.cpp b/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.cpp
index c013454fc3..bfe016cf27 100644
--- a/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.h b/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.h
index 4b43c82a42..d93489a5bd 100644
--- a/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/GenBoundingBoxesProcess.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.cpp b/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.cpp
index 028334dec7..08a1d9aaef 100644
--- a/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.h b/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.h
index c641fd6353..6e872af3a8 100644
--- a/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/GenFaceNormalsProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.cpp b/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.cpp
index 3f6c2f86bd..1df3334107 100644
--- a/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.h b/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.h
index 2ceee17e85..38104b3bf7 100644
--- a/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/GenVertexNormalsProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.cpp b/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.cpp
index d0a016fa42..d72d15d3a7 100644
--- a/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.h b/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.h
index de25ecd9fb..73e11f57bd 100644
--- a/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.h
+++ b/thirdparty/assimp/code/PostProcessing/ImproveCacheLocality.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.cpp b/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.cpp
index f121fc60d3..070c9636f2 100644
--- a/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.h b/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.h
index e017ae62db..76e7cf061b 100644
--- a/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/JoinVerticesProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.cpp b/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.cpp
index d560f19287..1f1abfabb0 100644
--- a/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.h b/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.h
index 73c2a68d53..8bc321a3c5 100644
--- a/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/LimitBoneWeightsProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.cpp b/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.cpp
index 41f50a5ba5..88bdb3124f 100644
--- a/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.cpp
+++ b/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.h b/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.h
index 8565d5933a..699cce30b4 100644
--- a/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.h
+++ b/thirdparty/assimp/code/PostProcessing/MakeVerboseFormat.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/OptimizeGraph.cpp b/thirdparty/assimp/code/PostProcessing/OptimizeGraph.cpp
index 5db51f58b6..f3996c2752 100644
--- a/thirdparty/assimp/code/PostProcessing/OptimizeGraph.cpp
+++ b/thirdparty/assimp/code/PostProcessing/OptimizeGraph.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -43,13 +43,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of the aiProcess_OptimizGraph step
*/
-
#ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
#include "OptimizeGraph.h"
#include "ProcessHelper.h"
-#include <assimp/SceneCombiner.h>
+#include "ConvertToLHProcess.h"
#include <assimp/Exceptional.h>
+#include <assimp/SceneCombiner.h>
#include <stdio.h>
using namespace Assimp;
@@ -60,292 +60,299 @@ using namespace Assimp;
* The unhashed variant should be faster, except for *very* large data sets
*/
#ifdef AI_OG_USE_HASHING
- // Use our standard hashing function to compute the hash
-# define AI_OG_GETKEY(str) SuperFastHash(str.data,str.length)
+// Use our standard hashing function to compute the hash
+#define AI_OG_GETKEY(str) SuperFastHash(str.data, str.length)
#else
- // Otherwise hope that std::string will utilize a static buffer
- // for shorter node names. This would avoid endless heap copying.
-# define AI_OG_GETKEY(str) std::string(str.data)
+// Otherwise hope that std::string will utilize a static buffer
+// for shorter node names. This would avoid endless heap copying.
+#define AI_OG_GETKEY(str) std::string(str.data)
#endif
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
-OptimizeGraphProcess::OptimizeGraphProcess()
-: mScene()
-, nodes_in()
-, nodes_out()
-, count_merged() {
- // empty
+OptimizeGraphProcess::OptimizeGraphProcess() :
+ mScene(),
+ nodes_in(),
+ nodes_out(),
+ count_merged() {
+ // empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
OptimizeGraphProcess::~OptimizeGraphProcess() {
- // empty
+ // empty
}
// ------------------------------------------------------------------------------------------------
// Returns whether the processing step is present in the given flag field.
-bool OptimizeGraphProcess::IsActive( unsigned int pFlags) const {
- return (0 != (pFlags & aiProcess_OptimizeGraph));
+bool OptimizeGraphProcess::IsActive(unsigned int pFlags) const {
+ return (0 != (pFlags & aiProcess_OptimizeGraph));
}
// ------------------------------------------------------------------------------------------------
// Setup properties for the post-processing step
-void OptimizeGraphProcess::SetupProperties(const Importer* pImp) {
- // Get value of AI_CONFIG_PP_OG_EXCLUDE_LIST
- std::string tmp = pImp->GetPropertyString(AI_CONFIG_PP_OG_EXCLUDE_LIST,"");
- AddLockedNodeList(tmp);
+void OptimizeGraphProcess::SetupProperties(const Importer *pImp) {
+ // Get value of AI_CONFIG_PP_OG_EXCLUDE_LIST
+ std::string tmp = pImp->GetPropertyString(AI_CONFIG_PP_OG_EXCLUDE_LIST, "");
+ AddLockedNodeList(tmp);
}
// ------------------------------------------------------------------------------------------------
// Collect new children
-void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& nodes) {
- nodes_in += nd->mNumChildren;
-
- // Process children
- std::list<aiNode*> child_nodes;
- for (unsigned int i = 0; i < nd->mNumChildren; ++i) {
- CollectNewChildren(nd->mChildren[i],child_nodes);
- nd->mChildren[i] = nullptr;
- }
-
- // Check whether we need this node; if not we can replace it by our own children (warn, danger of incest).
- if (locked.find(AI_OG_GETKEY(nd->mName)) == locked.end() ) {
- for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
-
- if (locked.find(AI_OG_GETKEY((*it)->mName)) == locked.end()) {
- (*it)->mTransformation = nd->mTransformation * (*it)->mTransformation;
- nodes.push_back(*it);
-
- it = child_nodes.erase(it);
- continue;
- }
- ++it;
- }
-
- if (nd->mNumMeshes || !child_nodes.empty()) {
- nodes.push_back(nd);
- } else {
- delete nd; /* bye, node */
- return;
- }
- } else {
-
- // Retain our current position in the hierarchy
- nodes.push_back(nd);
-
- // Now check for possible optimizations in our list of child nodes. join as many as possible
- aiNode* join_master = NULL;
- aiMatrix4x4 inv;
-
- const LockedSetType::const_iterator end = locked.end();
-
- std::list<aiNode*> join;
- for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
- aiNode* child = *it;
- if (child->mNumChildren == 0 && locked.find(AI_OG_GETKEY(child->mName)) == end) {
-
- // There may be no instanced meshes
- unsigned int n = 0;
- for (; n < child->mNumMeshes;++n) {
- if (meshes[child->mMeshes[n]] > 1) {
- break;
- }
- }
- if (n == child->mNumMeshes) {
- if (!join_master) {
- join_master = child;
- inv = join_master->mTransformation;
- inv.Inverse();
- } else {
- child->mTransformation = inv * child->mTransformation ;
-
- join.push_back(child);
- it = child_nodes.erase(it);
- continue;
- }
- }
- }
- ++it;
- }
- if (join_master && !join.empty()) {
- join_master->mName.length = ::ai_snprintf(join_master->mName.data, MAXLEN, "$MergedNode_%i",count_merged++);
-
- unsigned int out_meshes = 0;
- for (std::list<aiNode*>::iterator it = join.begin(); it != join.end(); ++it) {
- out_meshes += (*it)->mNumMeshes;
- }
-
- // copy all mesh references in one array
- if (out_meshes) {
- unsigned int* meshes = new unsigned int[out_meshes+join_master->mNumMeshes], *tmp = meshes;
- for (unsigned int n = 0; n < join_master->mNumMeshes;++n) {
- *tmp++ = join_master->mMeshes[n];
- }
-
- for (std::list<aiNode*>::iterator it = join.begin(); it != join.end(); ++it) {
- for (unsigned int n = 0; n < (*it)->mNumMeshes; ++n) {
-
- *tmp = (*it)->mMeshes[n];
- aiMesh* mesh = mScene->mMeshes[*tmp++];
-
- // manually move the mesh into the right coordinate system
- const aiMatrix3x3 IT = aiMatrix3x3( (*it)->mTransformation ).Inverse().Transpose();
- for (unsigned int a = 0; a < mesh->mNumVertices; ++a) {
-
- mesh->mVertices[a] *= (*it)->mTransformation;
-
- if (mesh->HasNormals())
- mesh->mNormals[a] *= IT;
-
- if (mesh->HasTangentsAndBitangents()) {
- mesh->mTangents[a] *= IT;
- mesh->mBitangents[a] *= IT;
- }
- }
- }
- delete *it; // bye, node
- }
- delete[] join_master->mMeshes;
- join_master->mMeshes = meshes;
- join_master->mNumMeshes += out_meshes;
- }
- }
- }
- // reassign children if something changed
- if (child_nodes.empty() || child_nodes.size() > nd->mNumChildren) {
-
- delete[] nd->mChildren;
-
- if (!child_nodes.empty()) {
- nd->mChildren = new aiNode*[child_nodes.size()];
- }
- else nd->mChildren = nullptr;
- }
-
- nd->mNumChildren = static_cast<unsigned int>(child_nodes.size());
-
- if (nd->mChildren) {
- aiNode** tmp = nd->mChildren;
- for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) {
- aiNode* node = *tmp++ = *it;
- node->mParent = nd;
- }
- }
-
- nodes_out += static_cast<unsigned int>(child_nodes.size());
+void OptimizeGraphProcess::CollectNewChildren(aiNode *nd, std::list<aiNode *> &nodes) {
+ nodes_in += nd->mNumChildren;
+
+ // Process children
+ std::list<aiNode *> child_nodes;
+ for (unsigned int i = 0; i < nd->mNumChildren; ++i) {
+ CollectNewChildren(nd->mChildren[i], child_nodes);
+ nd->mChildren[i] = nullptr;
+ }
+
+ // Check whether we need this node; if not we can replace it by our own children (warn, danger of incest).
+ if (locked.find(AI_OG_GETKEY(nd->mName)) == locked.end()) {
+ for (std::list<aiNode *>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
+
+ if (locked.find(AI_OG_GETKEY((*it)->mName)) == locked.end()) {
+ (*it)->mTransformation = nd->mTransformation * (*it)->mTransformation;
+ nodes.push_back(*it);
+
+ it = child_nodes.erase(it);
+ continue;
+ }
+ ++it;
+ }
+
+ if (nd->mNumMeshes || !child_nodes.empty()) {
+ nodes.push_back(nd);
+ } else {
+ delete nd; /* bye, node */
+ return;
+ }
+ } else {
+
+ // Retain our current position in the hierarchy
+ nodes.push_back(nd);
+
+ // Now check for possible optimizations in our list of child nodes. join as many as possible
+ aiNode *join_master = nullptr;
+ aiMatrix4x4 inv;
+
+ const LockedSetType::const_iterator end = locked.end();
+
+ std::list<aiNode *> join;
+ for (std::list<aiNode *>::iterator it = child_nodes.begin(); it != child_nodes.end();) {
+ aiNode *child = *it;
+ if (child->mNumChildren == 0 && locked.find(AI_OG_GETKEY(child->mName)) == end) {
+
+ // There may be no instanced meshes
+ unsigned int n = 0;
+ for (; n < child->mNumMeshes; ++n) {
+ if (meshes[child->mMeshes[n]] > 1) {
+ break;
+ }
+ }
+ if (n == child->mNumMeshes) {
+ if (!join_master) {
+ join_master = child;
+ inv = join_master->mTransformation;
+ inv.Inverse();
+ } else {
+ child->mTransformation = inv * child->mTransformation;
+
+ join.push_back(child);
+ it = child_nodes.erase(it);
+ continue;
+ }
+ }
+ }
+ ++it;
+ }
+ if (join_master && !join.empty()) {
+ join_master->mName.length = ::ai_snprintf(join_master->mName.data, MAXLEN, "$MergedNode_%i", count_merged++);
+
+ unsigned int out_meshes = 0;
+ for (std::list<aiNode *>::const_iterator it = join.cbegin(); it != join.cend(); ++it) {
+ out_meshes += (*it)->mNumMeshes;
+ }
+
+ // copy all mesh references in one array
+ if (out_meshes) {
+ unsigned int *meshes = new unsigned int[out_meshes + join_master->mNumMeshes], *tmp = meshes;
+ for (unsigned int n = 0; n < join_master->mNumMeshes; ++n) {
+ *tmp++ = join_master->mMeshes[n];
+ }
+
+ for (const aiNode *join_node : join) {
+ for (unsigned int n = 0; n < join_node->mNumMeshes; ++n) {
+
+ *tmp = join_node->mMeshes[n];
+ aiMesh *mesh = mScene->mMeshes[*tmp++];
+
+ // Assume the transformation is affine
+ // manually move the mesh into the right coordinate system
+
+ // Check for odd negative scale (mirror)
+ if (join_node->mTransformation.Determinant() < 0) {
+ // Reverse the mesh face winding order
+ FlipWindingOrderProcess::ProcessMesh(mesh);
+ }
+
+ // Update positions, normals and tangents
+ const aiMatrix3x3 IT = aiMatrix3x3(join_node->mTransformation).Inverse().Transpose();
+ for (unsigned int a = 0; a < mesh->mNumVertices; ++a) {
+
+ mesh->mVertices[a] *= join_node->mTransformation;
+
+ if (mesh->HasNormals())
+ mesh->mNormals[a] *= IT;
+
+ if (mesh->HasTangentsAndBitangents()) {
+ mesh->mTangents[a] *= IT;
+ mesh->mBitangents[a] *= IT;
+ }
+ }
+ }
+ delete join_node; // bye, node
+ }
+ delete[] join_master->mMeshes;
+ join_master->mMeshes = meshes;
+ join_master->mNumMeshes += out_meshes;
+ }
+ }
+ }
+ // reassign children if something changed
+ if (child_nodes.empty() || child_nodes.size() > nd->mNumChildren) {
+
+ delete[] nd->mChildren;
+
+ if (!child_nodes.empty()) {
+ nd->mChildren = new aiNode *[child_nodes.size()];
+ } else
+ nd->mChildren = nullptr;
+ }
+
+ nd->mNumChildren = static_cast<unsigned int>(child_nodes.size());
+
+ if (nd->mChildren) {
+ aiNode **tmp = nd->mChildren;
+ for (std::list<aiNode *>::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) {
+ aiNode *node = *tmp++ = *it;
+ node->mParent = nd;
+ }
+ }
+
+ nodes_out += static_cast<unsigned int>(child_nodes.size());
}
// ------------------------------------------------------------------------------------------------
// Execute the post-processing step on the given scene
-void OptimizeGraphProcess::Execute( aiScene* pScene) {
- ASSIMP_LOG_DEBUG("OptimizeGraphProcess begin");
- nodes_in = nodes_out = count_merged = 0;
- mScene = pScene;
+void OptimizeGraphProcess::Execute(aiScene *pScene) {
+ ASSIMP_LOG_DEBUG("OptimizeGraphProcess begin");
+ nodes_in = nodes_out = count_merged = 0;
+ mScene = pScene;
- meshes.resize(pScene->mNumMeshes,0);
- FindInstancedMeshes(pScene->mRootNode);
+ meshes.resize(pScene->mNumMeshes, 0);
+ FindInstancedMeshes(pScene->mRootNode);
- // build a blacklist of identifiers. If the name of a node matches one of these, we won't touch it
- locked.clear();
- for (std::list<std::string>::const_iterator it = locked_nodes.begin(); it != locked_nodes.end(); ++it) {
+ // build a blacklist of identifiers. If the name of a node matches one of these, we won't touch it
+ locked.clear();
+ for (std::list<std::string>::const_iterator it = locked_nodes.begin(); it != locked_nodes.end(); ++it) {
#ifdef AI_OG_USE_HASHING
- locked.insert(SuperFastHash((*it).c_str()));
+ locked.insert(SuperFastHash((*it).c_str()));
#else
- locked.insert(*it);
+ locked.insert(*it);
#endif
- }
-
- for (unsigned int i = 0; i < pScene->mNumAnimations; ++i) {
- for (unsigned int a = 0; a < pScene->mAnimations[i]->mNumChannels; ++a) {
- aiNodeAnim* anim = pScene->mAnimations[i]->mChannels[a];
- locked.insert(AI_OG_GETKEY(anim->mNodeName));
- }
- }
-
- for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
- for (unsigned int a = 0; a < pScene->mMeshes[i]->mNumBones; ++a) {
-
- aiBone* bone = pScene->mMeshes[i]->mBones[a];
- locked.insert(AI_OG_GETKEY(bone->mName));
-
- // HACK: Meshes referencing bones may not be transformed; we need to look them.
- // The easiest way to do this is to increase their reference counters ...
- meshes[i] += 2;
- }
- }
-
- for (unsigned int i = 0; i < pScene->mNumCameras; ++i) {
- aiCamera* cam = pScene->mCameras[i];
- locked.insert(AI_OG_GETKEY(cam->mName));
- }
-
- for (unsigned int i = 0; i < pScene->mNumLights; ++i) {
- aiLight* lgh = pScene->mLights[i];
- locked.insert(AI_OG_GETKEY(lgh->mName));
- }
-
- // Insert a dummy master node and make it read-only
- aiNode* dummy_root = new aiNode(AI_RESERVED_NODE_NAME);
- locked.insert(AI_OG_GETKEY(dummy_root->mName));
-
- const aiString prev = pScene->mRootNode->mName;
- pScene->mRootNode->mParent = dummy_root;
-
- dummy_root->mChildren = new aiNode*[dummy_root->mNumChildren = 1];
- dummy_root->mChildren[0] = pScene->mRootNode;
-
- // Do our recursive processing of scenegraph nodes. For each node collect
- // a fully new list of children and allow their children to place themselves
- // on the same hierarchy layer as their parents.
- std::list<aiNode*> nodes;
- CollectNewChildren (dummy_root,nodes);
-
- ai_assert(nodes.size() == 1);
-
- if (dummy_root->mNumChildren == 0) {
- pScene->mRootNode = NULL;
- throw DeadlyImportError("After optimizing the scene graph, no data remains");
- }
-
- if (dummy_root->mNumChildren > 1) {
- pScene->mRootNode = dummy_root;
-
- // Keep the dummy node but assign the name of the old root node to it
- pScene->mRootNode->mName = prev;
- }
- else {
-
- // Remove the dummy root node again.
- pScene->mRootNode = dummy_root->mChildren[0];
-
- dummy_root->mChildren[0] = NULL;
- delete dummy_root;
- }
-
- pScene->mRootNode->mParent = NULL;
- if (!DefaultLogger::isNullLogger()) {
- if ( nodes_in != nodes_out) {
- ASSIMP_LOG_INFO_F("OptimizeGraphProcess finished; Input nodes: ", nodes_in, ", Output nodes: ", nodes_out);
- } else {
- ASSIMP_LOG_DEBUG("OptimizeGraphProcess finished");
- }
- }
- meshes.clear();
- locked.clear();
+ }
+
+ for (unsigned int i = 0; i < pScene->mNumAnimations; ++i) {
+ for (unsigned int a = 0; a < pScene->mAnimations[i]->mNumChannels; ++a) {
+ aiNodeAnim *anim = pScene->mAnimations[i]->mChannels[a];
+ locked.insert(AI_OG_GETKEY(anim->mNodeName));
+ }
+ }
+
+ for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
+ for (unsigned int a = 0; a < pScene->mMeshes[i]->mNumBones; ++a) {
+
+ aiBone *bone = pScene->mMeshes[i]->mBones[a];
+ locked.insert(AI_OG_GETKEY(bone->mName));
+
+ // HACK: Meshes referencing bones may not be transformed; we need to look them.
+ // The easiest way to do this is to increase their reference counters ...
+ meshes[i] += 2;
+ }
+ }
+
+ for (unsigned int i = 0; i < pScene->mNumCameras; ++i) {
+ aiCamera *cam = pScene->mCameras[i];
+ locked.insert(AI_OG_GETKEY(cam->mName));
+ }
+
+ for (unsigned int i = 0; i < pScene->mNumLights; ++i) {
+ aiLight *lgh = pScene->mLights[i];
+ locked.insert(AI_OG_GETKEY(lgh->mName));
+ }
+
+ // Insert a dummy master node and make it read-only
+ aiNode *dummy_root = new aiNode(AI_RESERVED_NODE_NAME);
+ locked.insert(AI_OG_GETKEY(dummy_root->mName));
+
+ const aiString prev = pScene->mRootNode->mName;
+ pScene->mRootNode->mParent = dummy_root;
+
+ dummy_root->mChildren = new aiNode *[dummy_root->mNumChildren = 1];
+ dummy_root->mChildren[0] = pScene->mRootNode;
+
+ // Do our recursive processing of scenegraph nodes. For each node collect
+ // a fully new list of children and allow their children to place themselves
+ // on the same hierarchy layer as their parents.
+ std::list<aiNode *> nodes;
+ CollectNewChildren(dummy_root, nodes);
+
+ ai_assert(nodes.size() == 1);
+
+ if (dummy_root->mNumChildren == 0) {
+ pScene->mRootNode = nullptr;
+ throw DeadlyImportError("After optimizing the scene graph, no data remains");
+ }
+
+ if (dummy_root->mNumChildren > 1) {
+ pScene->mRootNode = dummy_root;
+
+ // Keep the dummy node but assign the name of the old root node to it
+ pScene->mRootNode->mName = prev;
+ } else {
+
+ // Remove the dummy root node again.
+ pScene->mRootNode = dummy_root->mChildren[0];
+
+ dummy_root->mChildren[0] = nullptr;
+ delete dummy_root;
+ }
+
+ pScene->mRootNode->mParent = nullptr;
+ if (!DefaultLogger::isNullLogger()) {
+ if (nodes_in != nodes_out) {
+ ASSIMP_LOG_INFO_F("OptimizeGraphProcess finished; Input nodes: ", nodes_in, ", Output nodes: ", nodes_out);
+ } else {
+ ASSIMP_LOG_DEBUG("OptimizeGraphProcess finished");
+ }
+ }
+ meshes.clear();
+ locked.clear();
}
// ------------------------------------------------------------------------------------------------
// Build a LUT of all instanced meshes
-void OptimizeGraphProcess::FindInstancedMeshes (aiNode* pNode)
-{
- for (unsigned int i = 0; i < pNode->mNumMeshes;++i) {
- ++meshes[pNode->mMeshes[i]];
- }
-
- for (unsigned int i = 0; i < pNode->mNumChildren; ++i)
- FindInstancedMeshes(pNode->mChildren[i]);
+void OptimizeGraphProcess::FindInstancedMeshes(aiNode *pNode) {
+ for (unsigned int i = 0; i < pNode->mNumMeshes; ++i) {
+ ++meshes[pNode->mMeshes[i]];
+ }
+
+ for (unsigned int i = 0; i < pNode->mNumChildren; ++i)
+ FindInstancedMeshes(pNode->mChildren[i]);
}
#endif // !! ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
diff --git a/thirdparty/assimp/code/PostProcessing/OptimizeGraph.h b/thirdparty/assimp/code/PostProcessing/OptimizeGraph.h
index 82cc5db3fe..34f70854f7 100644
--- a/thirdparty/assimp/code/PostProcessing/OptimizeGraph.h
+++ b/thirdparty/assimp/code/PostProcessing/OptimizeGraph.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -75,13 +75,13 @@ public:
~OptimizeGraphProcess();
// -------------------------------------------------------------------
- bool IsActive( unsigned int pFlags) const;
+ bool IsActive( unsigned int pFlags) const override;
// -------------------------------------------------------------------
- void Execute( aiScene* pScene);
+ void Execute( aiScene* pScene) override;
// -------------------------------------------------------------------
- void SetupProperties(const Importer* pImp);
+ void SetupProperties(const Importer* pImp) override;
// -------------------------------------------------------------------
/** @brief Add a list of node names to be locked and not modified.
diff --git a/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.cpp b/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.cpp
index 3f6765f6ca..983d8001f3 100644
--- a/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.cpp
+++ b/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.h b/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.h
index dec4ab52de..50dfe2957e 100644
--- a/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.h
+++ b/thirdparty/assimp/code/PostProcessing/OptimizeMeshes.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/PretransformVertices.cpp b/thirdparty/assimp/code/PostProcessing/PretransformVertices.cpp
index 52001a0578..293a5c0ea9 100644
--- a/thirdparty/assimp/code/PostProcessing/PretransformVertices.cpp
+++ b/thirdparty/assimp/code/PostProcessing/PretransformVertices.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -45,11 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of the "PretransformVertices" post processing step
*/
-
#include "PretransformVertices.h"
+#include "ConvertToLHProcess.h"
#include "ProcessHelper.h"
-#include <assimp/SceneCombiner.h>
#include <assimp/Exceptional.h>
+#include <assimp/SceneCombiner.h>
using namespace Assimp;
@@ -59,670 +59,630 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
-PretransformVertices::PretransformVertices()
-: configKeepHierarchy (false)
-, configNormalize(false)
-, configTransform(false)
-, configTransformation()
-, mConfigPointCloud( false ) {
- // empty
+PretransformVertices::PretransformVertices() :
+ configKeepHierarchy(false),
+ configNormalize(false),
+ configTransform(false),
+ configTransformation(),
+ mConfigPointCloud(false) {
+ // empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
PretransformVertices::~PretransformVertices() {
- // nothing to do here
+ // nothing to do here
}
// ------------------------------------------------------------------------------------------------
// Returns whether the processing step is present in the given flag field.
-bool PretransformVertices::IsActive( unsigned int pFlags) const
-{
- return (pFlags & aiProcess_PreTransformVertices) != 0;
+bool PretransformVertices::IsActive(unsigned int pFlags) const {
+ return (pFlags & aiProcess_PreTransformVertices) != 0;
}
// ------------------------------------------------------------------------------------------------
// Setup import configuration
-void PretransformVertices::SetupProperties(const Importer* pImp)
-{
- // Get the current value of AI_CONFIG_PP_PTV_KEEP_HIERARCHY, AI_CONFIG_PP_PTV_NORMALIZE,
- // AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION and AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION
- configKeepHierarchy = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_KEEP_HIERARCHY,0));
- configNormalize = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_NORMALIZE,0));
- configTransform = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION,0));
+void PretransformVertices::SetupProperties(const Importer *pImp) {
+ // Get the current value of AI_CONFIG_PP_PTV_KEEP_HIERARCHY, AI_CONFIG_PP_PTV_NORMALIZE,
+ // AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION and AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION
+ configKeepHierarchy = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_KEEP_HIERARCHY, 0));
+ configNormalize = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_NORMALIZE, 0));
+ configTransform = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION, 0));
- configTransformation = pImp->GetPropertyMatrix(AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION, aiMatrix4x4());
+ configTransformation = pImp->GetPropertyMatrix(AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION, aiMatrix4x4());
- mConfigPointCloud = pImp->GetPropertyBool(AI_CONFIG_EXPORT_POINT_CLOUDS);
+ mConfigPointCloud = pImp->GetPropertyBool(AI_CONFIG_EXPORT_POINT_CLOUDS);
}
// ------------------------------------------------------------------------------------------------
// Count the number of nodes
-unsigned int PretransformVertices::CountNodes( aiNode* pcNode )
-{
- unsigned int iRet = 1;
- for (unsigned int i = 0;i < pcNode->mNumChildren;++i)
- {
- iRet += CountNodes(pcNode->mChildren[i]);
- }
- return iRet;
+unsigned int PretransformVertices::CountNodes(const aiNode *pcNode) const {
+ unsigned int iRet = 1;
+ for (unsigned int i = 0; i < pcNode->mNumChildren; ++i) {
+ iRet += CountNodes(pcNode->mChildren[i]);
+ }
+ return iRet;
}
// ------------------------------------------------------------------------------------------------
// Get a bitwise combination identifying the vertex format of a mesh
-unsigned int PretransformVertices::GetMeshVFormat( aiMesh* pcMesh )
-{
- // the vertex format is stored in aiMesh::mBones for later retrieval.
- // there isn't a good reason to compute it a few hundred times
- // from scratch. The pointer is unused as animations are lost
- // during PretransformVertices.
- if (pcMesh->mBones)
- return (unsigned int)(uint64_t)pcMesh->mBones;
-
-
- const unsigned int iRet = GetMeshVFormatUnique(pcMesh);
-
- // store the value for later use
- pcMesh->mBones = (aiBone**)(uint64_t)iRet;
- return iRet;
+unsigned int PretransformVertices::GetMeshVFormat(aiMesh *pcMesh) const {
+ // the vertex format is stored in aiMesh::mBones for later retrieval.
+ // there isn't a good reason to compute it a few hundred times
+ // from scratch. The pointer is unused as animations are lost
+ // during PretransformVertices.
+ if (pcMesh->mBones)
+ return (unsigned int)(uint64_t)pcMesh->mBones;
+
+ const unsigned int iRet = GetMeshVFormatUnique(pcMesh);
+
+ // store the value for later use
+ pcMesh->mBones = (aiBone **)(uint64_t)iRet;
+ return iRet;
}
// ------------------------------------------------------------------------------------------------
// Count the number of vertices in the whole scene and a given
// material index
-void PretransformVertices::CountVerticesAndFaces( aiScene* pcScene, aiNode* pcNode, unsigned int iMat,
- unsigned int iVFormat, unsigned int* piFaces, unsigned int* piVertices)
-{
- for (unsigned int i = 0; i < pcNode->mNumMeshes;++i)
- {
- aiMesh* pcMesh = pcScene->mMeshes[ pcNode->mMeshes[i] ];
- if (iMat == pcMesh->mMaterialIndex && iVFormat == GetMeshVFormat(pcMesh))
- {
- *piVertices += pcMesh->mNumVertices;
- *piFaces += pcMesh->mNumFaces;
- }
- }
- for (unsigned int i = 0;i < pcNode->mNumChildren;++i)
- {
- CountVerticesAndFaces(pcScene,pcNode->mChildren[i],iMat,
- iVFormat,piFaces,piVertices);
- }
+void PretransformVertices::CountVerticesAndFaces(const aiScene *pcScene, const aiNode *pcNode, unsigned int iMat,
+ unsigned int iVFormat, unsigned int *piFaces, unsigned int *piVertices) const {
+ for (unsigned int i = 0; i < pcNode->mNumMeshes; ++i) {
+ aiMesh *pcMesh = pcScene->mMeshes[pcNode->mMeshes[i]];
+ if (iMat == pcMesh->mMaterialIndex && iVFormat == GetMeshVFormat(pcMesh)) {
+ *piVertices += pcMesh->mNumVertices;
+ *piFaces += pcMesh->mNumFaces;
+ }
+ }
+ for (unsigned int i = 0; i < pcNode->mNumChildren; ++i) {
+ CountVerticesAndFaces(pcScene, pcNode->mChildren[i], iMat,
+ iVFormat, piFaces, piVertices);
+ }
}
// ------------------------------------------------------------------------------------------------
// Collect vertex/face data
-void PretransformVertices::CollectData( aiScene* pcScene, aiNode* pcNode, unsigned int iMat,
- unsigned int iVFormat, aiMesh* pcMeshOut,
- unsigned int aiCurrent[2], unsigned int* num_refs)
-{
- // No need to multiply if there's no transformation
- const bool identity = pcNode->mTransformation.IsIdentity();
- for (unsigned int i = 0; i < pcNode->mNumMeshes;++i)
- {
- aiMesh* pcMesh = pcScene->mMeshes[ pcNode->mMeshes[i] ];
- if (iMat == pcMesh->mMaterialIndex && iVFormat == GetMeshVFormat(pcMesh))
- {
- // Decrement mesh reference counter
- unsigned int& num_ref = num_refs[pcNode->mMeshes[i]];
- ai_assert(0 != num_ref);
- --num_ref;
- // Save the name of the last mesh
- if (num_ref==0)
- {
- pcMeshOut->mName = pcMesh->mName;
- }
-
- if (identity) {
- // copy positions without modifying them
- ::memcpy(pcMeshOut->mVertices + aiCurrent[AI_PTVS_VERTEX],
- pcMesh->mVertices,
- pcMesh->mNumVertices * sizeof(aiVector3D));
-
- if (iVFormat & 0x2) {
- // copy normals without modifying them
- ::memcpy(pcMeshOut->mNormals + aiCurrent[AI_PTVS_VERTEX],
- pcMesh->mNormals,
- pcMesh->mNumVertices * sizeof(aiVector3D));
- }
- if (iVFormat & 0x4)
- {
- // copy tangents without modifying them
- ::memcpy(pcMeshOut->mTangents + aiCurrent[AI_PTVS_VERTEX],
- pcMesh->mTangents,
- pcMesh->mNumVertices * sizeof(aiVector3D));
- // copy bitangents without modifying them
- ::memcpy(pcMeshOut->mBitangents + aiCurrent[AI_PTVS_VERTEX],
- pcMesh->mBitangents,
- pcMesh->mNumVertices * sizeof(aiVector3D));
- }
- }
- else
- {
- // copy positions, transform them to worldspace
- for (unsigned int n = 0; n < pcMesh->mNumVertices;++n) {
- pcMeshOut->mVertices[aiCurrent[AI_PTVS_VERTEX]+n] = pcNode->mTransformation * pcMesh->mVertices[n];
- }
- aiMatrix4x4 mWorldIT = pcNode->mTransformation;
- mWorldIT.Inverse().Transpose();
-
- // TODO: implement Inverse() for aiMatrix3x3
- aiMatrix3x3 m = aiMatrix3x3(mWorldIT);
-
- if (iVFormat & 0x2)
- {
- // copy normals, transform them to worldspace
- for (unsigned int n = 0; n < pcMesh->mNumVertices;++n) {
- pcMeshOut->mNormals[aiCurrent[AI_PTVS_VERTEX]+n] =
- (m * pcMesh->mNormals[n]).Normalize();
- }
- }
- if (iVFormat & 0x4)
- {
- // copy tangents and bitangents, transform them to worldspace
- for (unsigned int n = 0; n < pcMesh->mNumVertices;++n) {
- pcMeshOut->mTangents [aiCurrent[AI_PTVS_VERTEX]+n] = (m * pcMesh->mTangents[n]).Normalize();
- pcMeshOut->mBitangents[aiCurrent[AI_PTVS_VERTEX]+n] = (m * pcMesh->mBitangents[n]).Normalize();
- }
- }
- }
- unsigned int p = 0;
- while (iVFormat & (0x100 << p))
- {
- // copy texture coordinates
- memcpy(pcMeshOut->mTextureCoords[p] + aiCurrent[AI_PTVS_VERTEX],
- pcMesh->mTextureCoords[p],
- pcMesh->mNumVertices * sizeof(aiVector3D));
- ++p;
- }
- p = 0;
- while (iVFormat & (0x1000000 << p))
- {
- // copy vertex colors
- memcpy(pcMeshOut->mColors[p] + aiCurrent[AI_PTVS_VERTEX],
- pcMesh->mColors[p],
- pcMesh->mNumVertices * sizeof(aiColor4D));
- ++p;
- }
- // now we need to copy all faces. since we will delete the source mesh afterwards,
- // we don't need to reallocate the array of indices except if this mesh is
- // referenced multiple times.
- for (unsigned int planck = 0;planck < pcMesh->mNumFaces;++planck)
- {
- aiFace& f_src = pcMesh->mFaces[planck];
- aiFace& f_dst = pcMeshOut->mFaces[aiCurrent[AI_PTVS_FACE]+planck];
-
- const unsigned int num_idx = f_src.mNumIndices;
-
- f_dst.mNumIndices = num_idx;
-
- unsigned int* pi;
- if (!num_ref) { /* if last time the mesh is referenced -> no reallocation */
- pi = f_dst.mIndices = f_src.mIndices;
-
- // offset all vertex indices
- for (unsigned int hahn = 0; hahn < num_idx;++hahn){
- pi[hahn] += aiCurrent[AI_PTVS_VERTEX];
- }
- }
- else {
- pi = f_dst.mIndices = new unsigned int[num_idx];
-
- // copy and offset all vertex indices
- for (unsigned int hahn = 0; hahn < num_idx;++hahn){
- pi[hahn] = f_src.mIndices[hahn] + aiCurrent[AI_PTVS_VERTEX];
- }
- }
-
- // Update the mPrimitiveTypes member of the mesh
- switch (pcMesh->mFaces[planck].mNumIndices)
- {
- case 0x1:
- pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_POINT;
- break;
- case 0x2:
- pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_LINE;
- break;
- case 0x3:
- pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE;
- break;
- default:
- pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
- break;
- };
- }
- aiCurrent[AI_PTVS_VERTEX] += pcMesh->mNumVertices;
- aiCurrent[AI_PTVS_FACE] += pcMesh->mNumFaces;
- }
- }
-
- // append all children of us
- for (unsigned int i = 0;i < pcNode->mNumChildren;++i) {
- CollectData(pcScene,pcNode->mChildren[i],iMat,
- iVFormat,pcMeshOut,aiCurrent,num_refs);
- }
+void PretransformVertices::CollectData(const aiScene *pcScene, const aiNode *pcNode, unsigned int iMat,
+ unsigned int iVFormat, aiMesh *pcMeshOut,
+ unsigned int aiCurrent[2], unsigned int *num_refs) const {
+ // No need to multiply if there's no transformation
+ const bool identity = pcNode->mTransformation.IsIdentity();
+ for (unsigned int i = 0; i < pcNode->mNumMeshes; ++i) {
+ aiMesh *pcMesh = pcScene->mMeshes[pcNode->mMeshes[i]];
+ if (iMat == pcMesh->mMaterialIndex && iVFormat == GetMeshVFormat(pcMesh)) {
+ // Decrement mesh reference counter
+ unsigned int &num_ref = num_refs[pcNode->mMeshes[i]];
+ ai_assert(0 != num_ref);
+ --num_ref;
+ // Save the name of the last mesh
+ if (num_ref == 0) {
+ pcMeshOut->mName = pcMesh->mName;
+ }
+
+ if (identity) {
+ // copy positions without modifying them
+ ::memcpy(pcMeshOut->mVertices + aiCurrent[AI_PTVS_VERTEX],
+ pcMesh->mVertices,
+ pcMesh->mNumVertices * sizeof(aiVector3D));
+
+ if (iVFormat & 0x2) {
+ // copy normals without modifying them
+ ::memcpy(pcMeshOut->mNormals + aiCurrent[AI_PTVS_VERTEX],
+ pcMesh->mNormals,
+ pcMesh->mNumVertices * sizeof(aiVector3D));
+ }
+ if (iVFormat & 0x4) {
+ // copy tangents without modifying them
+ ::memcpy(pcMeshOut->mTangents + aiCurrent[AI_PTVS_VERTEX],
+ pcMesh->mTangents,
+ pcMesh->mNumVertices * sizeof(aiVector3D));
+ // copy bitangents without modifying them
+ ::memcpy(pcMeshOut->mBitangents + aiCurrent[AI_PTVS_VERTEX],
+ pcMesh->mBitangents,
+ pcMesh->mNumVertices * sizeof(aiVector3D));
+ }
+ } else {
+ // copy positions, transform them to worldspace
+ for (unsigned int n = 0; n < pcMesh->mNumVertices; ++n) {
+ pcMeshOut->mVertices[aiCurrent[AI_PTVS_VERTEX] + n] = pcNode->mTransformation * pcMesh->mVertices[n];
+ }
+ aiMatrix4x4 mWorldIT = pcNode->mTransformation;
+ mWorldIT.Inverse().Transpose();
+
+ // TODO: implement Inverse() for aiMatrix3x3
+ aiMatrix3x3 m = aiMatrix3x3(mWorldIT);
+
+ if (iVFormat & 0x2) {
+ // copy normals, transform them to worldspace
+ for (unsigned int n = 0; n < pcMesh->mNumVertices; ++n) {
+ pcMeshOut->mNormals[aiCurrent[AI_PTVS_VERTEX] + n] =
+ (m * pcMesh->mNormals[n]).Normalize();
+ }
+ }
+ if (iVFormat & 0x4) {
+ // copy tangents and bitangents, transform them to worldspace
+ for (unsigned int n = 0; n < pcMesh->mNumVertices; ++n) {
+ pcMeshOut->mTangents[aiCurrent[AI_PTVS_VERTEX] + n] = (m * pcMesh->mTangents[n]).Normalize();
+ pcMeshOut->mBitangents[aiCurrent[AI_PTVS_VERTEX] + n] = (m * pcMesh->mBitangents[n]).Normalize();
+ }
+ }
+ }
+ unsigned int p = 0;
+ while (iVFormat & (0x100 << p)) {
+ // copy texture coordinates
+ memcpy(pcMeshOut->mTextureCoords[p] + aiCurrent[AI_PTVS_VERTEX],
+ pcMesh->mTextureCoords[p],
+ pcMesh->mNumVertices * sizeof(aiVector3D));
+ ++p;
+ }
+ p = 0;
+ while (iVFormat & (0x1000000 << p)) {
+ // copy vertex colors
+ memcpy(pcMeshOut->mColors[p] + aiCurrent[AI_PTVS_VERTEX],
+ pcMesh->mColors[p],
+ pcMesh->mNumVertices * sizeof(aiColor4D));
+ ++p;
+ }
+ // now we need to copy all faces. since we will delete the source mesh afterwards,
+ // we don't need to reallocate the array of indices except if this mesh is
+ // referenced multiple times.
+ for (unsigned int planck = 0; planck < pcMesh->mNumFaces; ++planck) {
+ aiFace &f_src = pcMesh->mFaces[planck];
+ aiFace &f_dst = pcMeshOut->mFaces[aiCurrent[AI_PTVS_FACE] + planck];
+
+ const unsigned int num_idx = f_src.mNumIndices;
+
+ f_dst.mNumIndices = num_idx;
+
+ unsigned int *pi;
+ if (!num_ref) { /* if last time the mesh is referenced -> no reallocation */
+ pi = f_dst.mIndices = f_src.mIndices;
+
+ // offset all vertex indices
+ for (unsigned int hahn = 0; hahn < num_idx; ++hahn) {
+ pi[hahn] += aiCurrent[AI_PTVS_VERTEX];
+ }
+ } else {
+ pi = f_dst.mIndices = new unsigned int[num_idx];
+
+ // copy and offset all vertex indices
+ for (unsigned int hahn = 0; hahn < num_idx; ++hahn) {
+ pi[hahn] = f_src.mIndices[hahn] + aiCurrent[AI_PTVS_VERTEX];
+ }
+ }
+
+ // Update the mPrimitiveTypes member of the mesh
+ switch (pcMesh->mFaces[planck].mNumIndices) {
+ case 0x1:
+ pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_POINT;
+ break;
+ case 0x2:
+ pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_LINE;
+ break;
+ case 0x3:
+ pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE;
+ break;
+ default:
+ pcMeshOut->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
+ break;
+ };
+ }
+ aiCurrent[AI_PTVS_VERTEX] += pcMesh->mNumVertices;
+ aiCurrent[AI_PTVS_FACE] += pcMesh->mNumFaces;
+ }
+ }
+
+ // append all children of us
+ for (unsigned int i = 0; i < pcNode->mNumChildren; ++i) {
+ CollectData(pcScene, pcNode->mChildren[i], iMat,
+ iVFormat, pcMeshOut, aiCurrent, num_refs);
+ }
}
// ------------------------------------------------------------------------------------------------
// Get a list of all vertex formats that occur for a given material index
// The output list contains duplicate elements
-void PretransformVertices::GetVFormatList( aiScene* pcScene, unsigned int iMat,
- std::list<unsigned int>& aiOut)
-{
- for (unsigned int i = 0; i < pcScene->mNumMeshes;++i)
- {
- aiMesh* pcMesh = pcScene->mMeshes[ i ];
- if (iMat == pcMesh->mMaterialIndex) {
- aiOut.push_back(GetMeshVFormat(pcMesh));
- }
- }
+void PretransformVertices::GetVFormatList(const aiScene *pcScene, unsigned int iMat,
+ std::list<unsigned int> &aiOut) const {
+ for (unsigned int i = 0; i < pcScene->mNumMeshes; ++i) {
+ aiMesh *pcMesh = pcScene->mMeshes[i];
+ if (iMat == pcMesh->mMaterialIndex) {
+ aiOut.push_back(GetMeshVFormat(pcMesh));
+ }
+ }
}
// ------------------------------------------------------------------------------------------------
// Compute the absolute transformation matrices of each node
-void PretransformVertices::ComputeAbsoluteTransform( aiNode* pcNode )
-{
- if (pcNode->mParent) {
- pcNode->mTransformation = pcNode->mParent->mTransformation*pcNode->mTransformation;
- }
-
- for (unsigned int i = 0;i < pcNode->mNumChildren;++i) {
- ComputeAbsoluteTransform(pcNode->mChildren[i]);
- }
+void PretransformVertices::ComputeAbsoluteTransform(aiNode *pcNode) {
+ if (pcNode->mParent) {
+ pcNode->mTransformation = pcNode->mParent->mTransformation * pcNode->mTransformation;
+ }
+
+ for (unsigned int i = 0; i < pcNode->mNumChildren; ++i) {
+ ComputeAbsoluteTransform(pcNode->mChildren[i]);
+ }
}
// ------------------------------------------------------------------------------------------------
// Apply the node transformation to a mesh
-void PretransformVertices::ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat)
-{
- // Check whether we need to transform the coordinates at all
- if (!mat.IsIdentity()) {
-
- if (mesh->HasPositions()) {
- for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
- mesh->mVertices[i] = mat * mesh->mVertices[i];
- }
- }
- if (mesh->HasNormals() || mesh->HasTangentsAndBitangents()) {
- aiMatrix4x4 mWorldIT = mat;
- mWorldIT.Inverse().Transpose();
-
- // TODO: implement Inverse() for aiMatrix3x3
- aiMatrix3x3 m = aiMatrix3x3(mWorldIT);
-
- if (mesh->HasNormals()) {
- for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
- mesh->mNormals[i] = (m * mesh->mNormals[i]).Normalize();
- }
- }
- if (mesh->HasTangentsAndBitangents()) {
- for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
- mesh->mTangents[i] = (m * mesh->mTangents[i]).Normalize();
- mesh->mBitangents[i] = (m * mesh->mBitangents[i]).Normalize();
- }
- }
- }
- }
+void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const {
+ // Check whether we need to transform the coordinates at all
+ if (!mat.IsIdentity()) {
+
+ // Check for odd negative scale (mirror)
+ if (mesh->HasFaces() && mat.Determinant() < 0) {
+ // Reverse the mesh face winding order
+ FlipWindingOrderProcess::ProcessMesh(mesh);
+ }
+
+ // Update positions
+ if (mesh->HasPositions()) {
+ for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
+ mesh->mVertices[i] = mat * mesh->mVertices[i];
+ }
+ }
+
+ // Update normals and tangents
+ if (mesh->HasNormals() || mesh->HasTangentsAndBitangents()) {
+ const aiMatrix3x3 m = aiMatrix3x3(mat).Inverse().Transpose();
+
+ if (mesh->HasNormals()) {
+ for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
+ mesh->mNormals[i] = (m * mesh->mNormals[i]).Normalize();
+ }
+ }
+ if (mesh->HasTangentsAndBitangents()) {
+ for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
+ mesh->mTangents[i] = (m * mesh->mTangents[i]).Normalize();
+ mesh->mBitangents[i] = (m * mesh->mBitangents[i]).Normalize();
+ }
+ }
+ }
+ }
}
// ------------------------------------------------------------------------------------------------
// Simple routine to build meshes in worldspace, no further optimization
-void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in,
- unsigned int numIn, aiNode* node)
-{
- // NOTE:
- // aiMesh::mNumBones store original source mesh, or UINT_MAX if not a copy
- // aiMesh::mBones store reference to abs. transform we multiplied with
-
- // process meshes
- for (unsigned int i = 0; i < node->mNumMeshes;++i) {
- aiMesh* mesh = in[node->mMeshes[i]];
-
- // check whether we can operate on this mesh
- if (!mesh->mBones || *reinterpret_cast<aiMatrix4x4*>(mesh->mBones) == node->mTransformation) {
- // yes, we can.
- mesh->mBones = reinterpret_cast<aiBone**> (&node->mTransformation);
- mesh->mNumBones = UINT_MAX;
- }
- else {
-
- // try to find us in the list of newly created meshes
- for (unsigned int n = 0; n < out.size(); ++n) {
- aiMesh* ctz = out[n];
- if (ctz->mNumBones == node->mMeshes[i] && *reinterpret_cast<aiMatrix4x4*>(ctz->mBones) == node->mTransformation) {
-
- // ok, use this one. Update node mesh index
- node->mMeshes[i] = numIn + n;
- }
- }
- if (node->mMeshes[i] < numIn) {
- // Worst case. Need to operate on a full copy of the mesh
- ASSIMP_LOG_INFO("PretransformVertices: Copying mesh due to mismatching transforms");
- aiMesh* ntz;
-
- const unsigned int tmp = mesh->mNumBones; //
- mesh->mNumBones = 0;
- SceneCombiner::Copy(&ntz,mesh);
- mesh->mNumBones = tmp;
-
- ntz->mNumBones = node->mMeshes[i];
- ntz->mBones = reinterpret_cast<aiBone**> (&node->mTransformation);
-
- out.push_back(ntz);
-
- node->mMeshes[i] = static_cast<unsigned int>(numIn + out.size() - 1);
- }
- }
- }
-
- // call children
- for (unsigned int i = 0; i < node->mNumChildren;++i)
- BuildWCSMeshes(out,in,numIn,node->mChildren[i]);
+void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh *> &out, aiMesh **in,
+ unsigned int numIn, aiNode *node) const {
+ // NOTE:
+ // aiMesh::mNumBones store original source mesh, or UINT_MAX if not a copy
+ // aiMesh::mBones store reference to abs. transform we multiplied with
+
+ // process meshes
+ for (unsigned int i = 0; i < node->mNumMeshes; ++i) {
+ aiMesh *mesh = in[node->mMeshes[i]];
+
+ // check whether we can operate on this mesh
+ if (!mesh->mBones || *reinterpret_cast<aiMatrix4x4 *>(mesh->mBones) == node->mTransformation) {
+ // yes, we can.
+ mesh->mBones = reinterpret_cast<aiBone **>(&node->mTransformation);
+ mesh->mNumBones = UINT_MAX;
+ } else {
+
+ // try to find us in the list of newly created meshes
+ for (unsigned int n = 0; n < out.size(); ++n) {
+ aiMesh *ctz = out[n];
+ if (ctz->mNumBones == node->mMeshes[i] && *reinterpret_cast<aiMatrix4x4 *>(ctz->mBones) == node->mTransformation) {
+
+ // ok, use this one. Update node mesh index
+ node->mMeshes[i] = numIn + n;
+ }
+ }
+ if (node->mMeshes[i] < numIn) {
+ // Worst case. Need to operate on a full copy of the mesh
+ ASSIMP_LOG_INFO("PretransformVertices: Copying mesh due to mismatching transforms");
+ aiMesh *ntz;
+
+ const unsigned int tmp = mesh->mNumBones; //
+ mesh->mNumBones = 0;
+ SceneCombiner::Copy(&ntz, mesh);
+ mesh->mNumBones = tmp;
+
+ ntz->mNumBones = node->mMeshes[i];
+ ntz->mBones = reinterpret_cast<aiBone **>(&node->mTransformation);
+
+ out.push_back(ntz);
+
+ node->mMeshes[i] = static_cast<unsigned int>(numIn + out.size() - 1);
+ }
+ }
+ }
+
+ // call children
+ for (unsigned int i = 0; i < node->mNumChildren; ++i)
+ BuildWCSMeshes(out, in, numIn, node->mChildren[i]);
}
// ------------------------------------------------------------------------------------------------
// Reset transformation matrices to identity
-void PretransformVertices::MakeIdentityTransform(aiNode* nd)
-{
- nd->mTransformation = aiMatrix4x4();
+void PretransformVertices::MakeIdentityTransform(aiNode *nd) const {
+ nd->mTransformation = aiMatrix4x4();
- // call children
- for (unsigned int i = 0; i < nd->mNumChildren;++i)
- MakeIdentityTransform(nd->mChildren[i]);
+ // call children
+ for (unsigned int i = 0; i < nd->mNumChildren; ++i)
+ MakeIdentityTransform(nd->mChildren[i]);
}
// ------------------------------------------------------------------------------------------------
// Build reference counters for all meshes
-void PretransformVertices::BuildMeshRefCountArray(aiNode* nd, unsigned int * refs)
-{
- for (unsigned int i = 0; i< nd->mNumMeshes;++i)
- refs[nd->mMeshes[i]]++;
-
- // call children
- for (unsigned int i = 0; i < nd->mNumChildren;++i)
- BuildMeshRefCountArray(nd->mChildren[i],refs);
+void PretransformVertices::BuildMeshRefCountArray(const aiNode *nd, unsigned int *refs) const {
+ for (unsigned int i = 0; i < nd->mNumMeshes; ++i)
+ refs[nd->mMeshes[i]]++;
+
+ // call children
+ for (unsigned int i = 0; i < nd->mNumChildren; ++i)
+ BuildMeshRefCountArray(nd->mChildren[i], refs);
}
// ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data.
-void PretransformVertices::Execute( aiScene* pScene)
-{
- ASSIMP_LOG_DEBUG("PretransformVerticesProcess begin");
-
- // Return immediately if we have no meshes
- if (!pScene->mNumMeshes)
- return;
-
- const unsigned int iOldMeshes = pScene->mNumMeshes;
- const unsigned int iOldAnimationChannels = pScene->mNumAnimations;
- const unsigned int iOldNodes = CountNodes(pScene->mRootNode);
-
- if(configTransform) {
- pScene->mRootNode->mTransformation = configTransformation;
- }
-
- // first compute absolute transformation matrices for all nodes
- ComputeAbsoluteTransform(pScene->mRootNode);
-
- // Delete aiMesh::mBones for all meshes. The bones are
- // removed during this step and we need the pointer as
- // temporary storage
- for (unsigned int i = 0; i < pScene->mNumMeshes;++i) {
- aiMesh* mesh = pScene->mMeshes[i];
-
- for (unsigned int a = 0; a < mesh->mNumBones;++a)
- delete mesh->mBones[a];
-
- delete[] mesh->mBones;
- mesh->mBones = NULL;
- }
-
- // now build a list of output meshes
- std::vector<aiMesh*> apcOutMeshes;
-
- // Keep scene hierarchy? It's an easy job in this case ...
- // we go on and transform all meshes, if one is referenced by nodes
- // with different absolute transformations a depth copy of the mesh
- // is required.
- if( configKeepHierarchy ) {
-
- // Hack: store the matrix we're transforming a mesh with in aiMesh::mBones
- BuildWCSMeshes(apcOutMeshes,pScene->mMeshes,pScene->mNumMeshes, pScene->mRootNode);
-
- // ... if new meshes have been generated, append them to the end of the scene
- if (apcOutMeshes.size() > 0) {
- aiMesh** npp = new aiMesh*[pScene->mNumMeshes + apcOutMeshes.size()];
-
- memcpy(npp,pScene->mMeshes,sizeof(aiMesh*)*pScene->mNumMeshes);
- memcpy(npp+pScene->mNumMeshes,&apcOutMeshes[0],sizeof(aiMesh*)*apcOutMeshes.size());
-
- pScene->mNumMeshes += static_cast<unsigned int>(apcOutMeshes.size());
- delete[] pScene->mMeshes; pScene->mMeshes = npp;
- }
-
- // now iterate through all meshes and transform them to worldspace
- for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
- ApplyTransform(pScene->mMeshes[i],*reinterpret_cast<aiMatrix4x4*>( pScene->mMeshes[i]->mBones ));
-
- // prevent improper destruction
- pScene->mMeshes[i]->mBones = NULL;
- pScene->mMeshes[i]->mNumBones = 0;
- }
- } else {
- apcOutMeshes.reserve(pScene->mNumMaterials<<1u);
- std::list<unsigned int> aiVFormats;
-
- std::vector<unsigned int> s(pScene->mNumMeshes,0);
- BuildMeshRefCountArray(pScene->mRootNode,&s[0]);
-
- for (unsigned int i = 0; i < pScene->mNumMaterials;++i) {
- // get the list of all vertex formats for this material
- aiVFormats.clear();
- GetVFormatList(pScene,i,aiVFormats);
- aiVFormats.sort();
- aiVFormats.unique();
- for (std::list<unsigned int>::const_iterator j = aiVFormats.begin();j != aiVFormats.end();++j) {
- unsigned int iVertices = 0;
- unsigned int iFaces = 0;
- CountVerticesAndFaces(pScene,pScene->mRootNode,i,*j,&iFaces,&iVertices);
- if (0 != iFaces && 0 != iVertices)
- {
- apcOutMeshes.push_back(new aiMesh());
- aiMesh* pcMesh = apcOutMeshes.back();
- pcMesh->mNumFaces = iFaces;
- pcMesh->mNumVertices = iVertices;
- pcMesh->mFaces = new aiFace[iFaces];
- pcMesh->mVertices = new aiVector3D[iVertices];
- pcMesh->mMaterialIndex = i;
- if ((*j) & 0x2)pcMesh->mNormals = new aiVector3D[iVertices];
- if ((*j) & 0x4)
- {
- pcMesh->mTangents = new aiVector3D[iVertices];
- pcMesh->mBitangents = new aiVector3D[iVertices];
- }
- iFaces = 0;
- while ((*j) & (0x100 << iFaces))
- {
- pcMesh->mTextureCoords[iFaces] = new aiVector3D[iVertices];
- if ((*j) & (0x10000 << iFaces))pcMesh->mNumUVComponents[iFaces] = 3;
- else pcMesh->mNumUVComponents[iFaces] = 2;
- iFaces++;
- }
- iFaces = 0;
- while ((*j) & (0x1000000 << iFaces))
- pcMesh->mColors[iFaces++] = new aiColor4D[iVertices];
-
- // fill the mesh ...
- unsigned int aiTemp[2] = {0,0};
- CollectData(pScene,pScene->mRootNode,i,*j,pcMesh,aiTemp,&s[0]);
- }
- }
- }
-
- // If no meshes are referenced in the node graph it is possible that we get no output meshes.
- if (apcOutMeshes.empty()) {
-
- throw DeadlyImportError("No output meshes: all meshes are orphaned and are not referenced by any nodes");
- }
- else
- {
- // now delete all meshes in the scene and build a new mesh list
- for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
- {
- aiMesh* mesh = pScene->mMeshes[i];
- mesh->mNumBones = 0;
- mesh->mBones = NULL;
-
- // we're reusing the face index arrays. avoid destruction
- for (unsigned int a = 0; a < mesh->mNumFaces; ++a) {
- mesh->mFaces[a].mNumIndices = 0;
- mesh->mFaces[a].mIndices = NULL;
- }
-
- delete mesh;
-
- // Invalidate the contents of the old mesh array. We will most
- // likely have less output meshes now, so the last entries of
- // the mesh array are not overridden. We set them to NULL to
- // make sure the developer gets notified when his application
- // attempts to access these fields ...
- mesh = NULL;
- }
-
- // It is impossible that we have more output meshes than
- // input meshes, so we can easily reuse the old mesh array
- pScene->mNumMeshes = (unsigned int)apcOutMeshes.size();
- for (unsigned int i = 0; i < pScene->mNumMeshes;++i) {
- pScene->mMeshes[i] = apcOutMeshes[i];
- }
- }
- }
-
- // remove all animations from the scene
- for (unsigned int i = 0; i < pScene->mNumAnimations;++i)
- delete pScene->mAnimations[i];
- delete[] pScene->mAnimations;
-
- pScene->mAnimations = NULL;
- pScene->mNumAnimations = 0;
-
- // --- we need to keep all cameras and lights
- for (unsigned int i = 0; i < pScene->mNumCameras;++i)
- {
- aiCamera* cam = pScene->mCameras[i];
- const aiNode* nd = pScene->mRootNode->FindNode(cam->mName);
- ai_assert(NULL != nd);
-
- // multiply all properties of the camera with the absolute
- // transformation of the corresponding node
- cam->mPosition = nd->mTransformation * cam->mPosition;
- cam->mLookAt = aiMatrix3x3( nd->mTransformation ) * cam->mLookAt;
- cam->mUp = aiMatrix3x3( nd->mTransformation ) * cam->mUp;
- }
-
- for (unsigned int i = 0; i < pScene->mNumLights;++i)
- {
- aiLight* l = pScene->mLights[i];
- const aiNode* nd = pScene->mRootNode->FindNode(l->mName);
- ai_assert(NULL != nd);
-
- // multiply all properties of the camera with the absolute
- // transformation of the corresponding node
- l->mPosition = nd->mTransformation * l->mPosition;
- l->mDirection = aiMatrix3x3( nd->mTransformation ) * l->mDirection;
- l->mUp = aiMatrix3x3( nd->mTransformation ) * l->mUp;
- }
-
- if( !configKeepHierarchy ) {
-
- // now delete all nodes in the scene and build a new
- // flat node graph with a root node and some level 1 children
- aiNode* newRoot = new aiNode();
- newRoot->mName = pScene->mRootNode->mName;
- delete pScene->mRootNode;
- pScene->mRootNode = newRoot;
-
- if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras)
- {
- pScene->mRootNode->mNumMeshes = 1;
- pScene->mRootNode->mMeshes = new unsigned int[1];
- pScene->mRootNode->mMeshes[0] = 0;
- }
- else
- {
- pScene->mRootNode->mNumChildren = pScene->mNumMeshes+pScene->mNumLights+pScene->mNumCameras;
- aiNode** nodes = pScene->mRootNode->mChildren = new aiNode*[pScene->mRootNode->mNumChildren];
-
- // generate mesh nodes
- for (unsigned int i = 0; i < pScene->mNumMeshes;++i,++nodes)
- {
- aiNode* pcNode = new aiNode();
- *nodes = pcNode;
- pcNode->mParent = pScene->mRootNode;
- pcNode->mName = pScene->mMeshes[i]->mName;
-
- // setup mesh indices
- pcNode->mNumMeshes = 1;
- pcNode->mMeshes = new unsigned int[1];
- pcNode->mMeshes[0] = i;
- }
- // generate light nodes
- for (unsigned int i = 0; i < pScene->mNumLights;++i,++nodes)
- {
- aiNode* pcNode = new aiNode();
- *nodes = pcNode;
- pcNode->mParent = pScene->mRootNode;
- pcNode->mName.length = ai_snprintf(pcNode->mName.data, MAXLEN, "light_%u",i);
- pScene->mLights[i]->mName = pcNode->mName;
- }
- // generate camera nodes
- for (unsigned int i = 0; i < pScene->mNumCameras;++i,++nodes)
- {
- aiNode* pcNode = new aiNode();
- *nodes = pcNode;
- pcNode->mParent = pScene->mRootNode;
- pcNode->mName.length = ::ai_snprintf(pcNode->mName.data,MAXLEN,"cam_%u",i);
- pScene->mCameras[i]->mName = pcNode->mName;
- }
- }
- }
- else {
- // ... and finally set the transformation matrix of all nodes to identity
- MakeIdentityTransform(pScene->mRootNode);
- }
-
- if (configNormalize) {
- // compute the boundary of all meshes
- aiVector3D min,max;
- MinMaxChooser<aiVector3D> ()(min,max);
-
- for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
- aiMesh* m = pScene->mMeshes[a];
- for (unsigned int i = 0; i < m->mNumVertices;++i) {
- min = std::min(m->mVertices[i],min);
- max = std::max(m->mVertices[i],max);
- }
- }
-
- // find the dominant axis
- aiVector3D d = max-min;
- const ai_real div = std::max(d.x,std::max(d.y,d.z))*ai_real( 0.5);
-
- d = min + d * (ai_real)0.5;
- for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
- aiMesh* m = pScene->mMeshes[a];
- for (unsigned int i = 0; i < m->mNumVertices;++i) {
- m->mVertices[i] = (m->mVertices[i]-d)/div;
- }
- }
- }
-
- // print statistics
- if (!DefaultLogger::isNullLogger()) {
- ASSIMP_LOG_DEBUG("PretransformVerticesProcess finished");
-
- ASSIMP_LOG_INFO_F("Removed ", iOldNodes, " nodes and ", iOldAnimationChannels, " animation channels (",
- CountNodes(pScene->mRootNode) ," output nodes)" );
- ASSIMP_LOG_INFO_F("Kept ", pScene->mNumLights, " lights and ", pScene->mNumCameras, " cameras." );
- ASSIMP_LOG_INFO_F("Moved ", iOldMeshes, " meshes to WCS (number of output meshes: ", pScene->mNumMeshes, ")");
- }
+void PretransformVertices::Execute(aiScene *pScene) {
+ ASSIMP_LOG_DEBUG("PretransformVerticesProcess begin");
+
+ // Return immediately if we have no meshes
+ if (!pScene->mNumMeshes)
+ return;
+
+ const unsigned int iOldMeshes = pScene->mNumMeshes;
+ const unsigned int iOldAnimationChannels = pScene->mNumAnimations;
+ const unsigned int iOldNodes = CountNodes(pScene->mRootNode);
+
+ if (configTransform) {
+ pScene->mRootNode->mTransformation = configTransformation;
+ }
+
+ // first compute absolute transformation matrices for all nodes
+ ComputeAbsoluteTransform(pScene->mRootNode);
+
+ // Delete aiMesh::mBones for all meshes. The bones are
+ // removed during this step and we need the pointer as
+ // temporary storage
+ for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
+ aiMesh *mesh = pScene->mMeshes[i];
+
+ for (unsigned int a = 0; a < mesh->mNumBones; ++a)
+ delete mesh->mBones[a];
+
+ delete[] mesh->mBones;
+ mesh->mBones = NULL;
+ }
+
+ // now build a list of output meshes
+ std::vector<aiMesh *> apcOutMeshes;
+
+ // Keep scene hierarchy? It's an easy job in this case ...
+ // we go on and transform all meshes, if one is referenced by nodes
+ // with different absolute transformations a depth copy of the mesh
+ // is required.
+ if (configKeepHierarchy) {
+
+ // Hack: store the matrix we're transforming a mesh with in aiMesh::mBones
+ BuildWCSMeshes(apcOutMeshes, pScene->mMeshes, pScene->mNumMeshes, pScene->mRootNode);
+
+ // ... if new meshes have been generated, append them to the end of the scene
+ if (apcOutMeshes.size() > 0) {
+ aiMesh **npp = new aiMesh *[pScene->mNumMeshes + apcOutMeshes.size()];
+
+ memcpy(npp, pScene->mMeshes, sizeof(aiMesh *) * pScene->mNumMeshes);
+ memcpy(npp + pScene->mNumMeshes, &apcOutMeshes[0], sizeof(aiMesh *) * apcOutMeshes.size());
+
+ pScene->mNumMeshes += static_cast<unsigned int>(apcOutMeshes.size());
+ delete[] pScene->mMeshes;
+ pScene->mMeshes = npp;
+ }
+
+ // now iterate through all meshes and transform them to worldspace
+ for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
+ ApplyTransform(pScene->mMeshes[i], *reinterpret_cast<aiMatrix4x4 *>(pScene->mMeshes[i]->mBones));
+
+ // prevent improper destruction
+ pScene->mMeshes[i]->mBones = NULL;
+ pScene->mMeshes[i]->mNumBones = 0;
+ }
+ } else {
+ apcOutMeshes.reserve(pScene->mNumMaterials << 1u);
+ std::list<unsigned int> aiVFormats;
+
+ std::vector<unsigned int> s(pScene->mNumMeshes, 0);
+ BuildMeshRefCountArray(pScene->mRootNode, &s[0]);
+
+ for (unsigned int i = 0; i < pScene->mNumMaterials; ++i) {
+ // get the list of all vertex formats for this material
+ aiVFormats.clear();
+ GetVFormatList(pScene, i, aiVFormats);
+ aiVFormats.sort();
+ aiVFormats.unique();
+ for (std::list<unsigned int>::const_iterator j = aiVFormats.begin(); j != aiVFormats.end(); ++j) {
+ unsigned int iVertices = 0;
+ unsigned int iFaces = 0;
+ CountVerticesAndFaces(pScene, pScene->mRootNode, i, *j, &iFaces, &iVertices);
+ if (0 != iFaces && 0 != iVertices) {
+ apcOutMeshes.push_back(new aiMesh());
+ aiMesh *pcMesh = apcOutMeshes.back();
+ pcMesh->mNumFaces = iFaces;
+ pcMesh->mNumVertices = iVertices;
+ pcMesh->mFaces = new aiFace[iFaces];
+ pcMesh->mVertices = new aiVector3D[iVertices];
+ pcMesh->mMaterialIndex = i;
+ if ((*j) & 0x2) pcMesh->mNormals = new aiVector3D[iVertices];
+ if ((*j) & 0x4) {
+ pcMesh->mTangents = new aiVector3D[iVertices];
+ pcMesh->mBitangents = new aiVector3D[iVertices];
+ }
+ iFaces = 0;
+ while ((*j) & (0x100 << iFaces)) {
+ pcMesh->mTextureCoords[iFaces] = new aiVector3D[iVertices];
+ if ((*j) & (0x10000 << iFaces))
+ pcMesh->mNumUVComponents[iFaces] = 3;
+ else
+ pcMesh->mNumUVComponents[iFaces] = 2;
+ iFaces++;
+ }
+ iFaces = 0;
+ while ((*j) & (0x1000000 << iFaces))
+ pcMesh->mColors[iFaces++] = new aiColor4D[iVertices];
+
+ // fill the mesh ...
+ unsigned int aiTemp[2] = { 0, 0 };
+ CollectData(pScene, pScene->mRootNode, i, *j, pcMesh, aiTemp, &s[0]);
+ }
+ }
+ }
+
+ // If no meshes are referenced in the node graph it is possible that we get no output meshes.
+ if (apcOutMeshes.empty()) {
+
+ throw DeadlyImportError("No output meshes: all meshes are orphaned and are not referenced by any nodes");
+ } else {
+ // now delete all meshes in the scene and build a new mesh list
+ for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
+ aiMesh *mesh = pScene->mMeshes[i];
+ mesh->mNumBones = 0;
+ mesh->mBones = NULL;
+
+ // we're reusing the face index arrays. avoid destruction
+ for (unsigned int a = 0; a < mesh->mNumFaces; ++a) {
+ mesh->mFaces[a].mNumIndices = 0;
+ mesh->mFaces[a].mIndices = NULL;
+ }
+
+ delete mesh;
+
+ // Invalidate the contents of the old mesh array. We will most
+ // likely have less output meshes now, so the last entries of
+ // the mesh array are not overridden. We set them to NULL to
+ // make sure the developer gets notified when his application
+ // attempts to access these fields ...
+ mesh = NULL;
+ }
+
+ // It is impossible that we have more output meshes than
+ // input meshes, so we can easily reuse the old mesh array
+ pScene->mNumMeshes = (unsigned int)apcOutMeshes.size();
+ for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
+ pScene->mMeshes[i] = apcOutMeshes[i];
+ }
+ }
+ }
+
+ // remove all animations from the scene
+ for (unsigned int i = 0; i < pScene->mNumAnimations; ++i)
+ delete pScene->mAnimations[i];
+ delete[] pScene->mAnimations;
+
+ pScene->mAnimations = NULL;
+ pScene->mNumAnimations = 0;
+
+ // --- we need to keep all cameras and lights
+ for (unsigned int i = 0; i < pScene->mNumCameras; ++i) {
+ aiCamera *cam = pScene->mCameras[i];
+ const aiNode *nd = pScene->mRootNode->FindNode(cam->mName);
+ ai_assert(NULL != nd);
+
+ // multiply all properties of the camera with the absolute
+ // transformation of the corresponding node
+ cam->mPosition = nd->mTransformation * cam->mPosition;
+ cam->mLookAt = aiMatrix3x3(nd->mTransformation) * cam->mLookAt;
+ cam->mUp = aiMatrix3x3(nd->mTransformation) * cam->mUp;
+ }
+
+ for (unsigned int i = 0; i < pScene->mNumLights; ++i) {
+ aiLight *l = pScene->mLights[i];
+ const aiNode *nd = pScene->mRootNode->FindNode(l->mName);
+ ai_assert(NULL != nd);
+
+ // multiply all properties of the camera with the absolute
+ // transformation of the corresponding node
+ l->mPosition = nd->mTransformation * l->mPosition;
+ l->mDirection = aiMatrix3x3(nd->mTransformation) * l->mDirection;
+ l->mUp = aiMatrix3x3(nd->mTransformation) * l->mUp;
+ }
+
+ if (!configKeepHierarchy) {
+
+ // now delete all nodes in the scene and build a new
+ // flat node graph with a root node and some level 1 children
+ aiNode *newRoot = new aiNode();
+ newRoot->mName = pScene->mRootNode->mName;
+ delete pScene->mRootNode;
+ pScene->mRootNode = newRoot;
+
+ if (1 == pScene->mNumMeshes && !pScene->mNumLights && !pScene->mNumCameras) {
+ pScene->mRootNode->mNumMeshes = 1;
+ pScene->mRootNode->mMeshes = new unsigned int[1];
+ pScene->mRootNode->mMeshes[0] = 0;
+ } else {
+ pScene->mRootNode->mNumChildren = pScene->mNumMeshes + pScene->mNumLights + pScene->mNumCameras;
+ aiNode **nodes = pScene->mRootNode->mChildren = new aiNode *[pScene->mRootNode->mNumChildren];
+
+ // generate mesh nodes
+ for (unsigned int i = 0; i < pScene->mNumMeshes; ++i, ++nodes) {
+ aiNode *pcNode = new aiNode();
+ *nodes = pcNode;
+ pcNode->mParent = pScene->mRootNode;
+ pcNode->mName = pScene->mMeshes[i]->mName;
+
+ // setup mesh indices
+ pcNode->mNumMeshes = 1;
+ pcNode->mMeshes = new unsigned int[1];
+ pcNode->mMeshes[0] = i;
+ }
+ // generate light nodes
+ for (unsigned int i = 0; i < pScene->mNumLights; ++i, ++nodes) {
+ aiNode *pcNode = new aiNode();
+ *nodes = pcNode;
+ pcNode->mParent = pScene->mRootNode;
+ pcNode->mName.length = ai_snprintf(pcNode->mName.data, MAXLEN, "light_%u", i);
+ pScene->mLights[i]->mName = pcNode->mName;
+ }
+ // generate camera nodes
+ for (unsigned int i = 0; i < pScene->mNumCameras; ++i, ++nodes) {
+ aiNode *pcNode = new aiNode();
+ *nodes = pcNode;
+ pcNode->mParent = pScene->mRootNode;
+ pcNode->mName.length = ::ai_snprintf(pcNode->mName.data, MAXLEN, "cam_%u", i);
+ pScene->mCameras[i]->mName = pcNode->mName;
+ }
+ }
+ } else {
+ // ... and finally set the transformation matrix of all nodes to identity
+ MakeIdentityTransform(pScene->mRootNode);
+ }
+
+ if (configNormalize) {
+ // compute the boundary of all meshes
+ aiVector3D min, max;
+ MinMaxChooser<aiVector3D>()(min, max);
+
+ for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
+ aiMesh *m = pScene->mMeshes[a];
+ for (unsigned int i = 0; i < m->mNumVertices; ++i) {
+ min = std::min(m->mVertices[i], min);
+ max = std::max(m->mVertices[i], max);
+ }
+ }
+
+ // find the dominant axis
+ aiVector3D d = max - min;
+ const ai_real div = std::max(d.x, std::max(d.y, d.z)) * ai_real(0.5);
+
+ d = min + d * (ai_real)0.5;
+ for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
+ aiMesh *m = pScene->mMeshes[a];
+ for (unsigned int i = 0; i < m->mNumVertices; ++i) {
+ m->mVertices[i] = (m->mVertices[i] - d) / div;
+ }
+ }
+ }
+
+ // print statistics
+ if (!DefaultLogger::isNullLogger()) {
+ ASSIMP_LOG_DEBUG("PretransformVerticesProcess finished");
+
+ ASSIMP_LOG_INFO_F("Removed ", iOldNodes, " nodes and ", iOldAnimationChannels, " animation channels (",
+ CountNodes(pScene->mRootNode), " output nodes)");
+ ASSIMP_LOG_INFO_F("Kept ", pScene->mNumLights, " lights and ", pScene->mNumCameras, " cameras.");
+ ASSIMP_LOG_INFO_F("Moved ", iOldMeshes, " meshes to WCS (number of output meshes: ", pScene->mNumMeshes, ")");
+ }
}
diff --git a/thirdparty/assimp/code/PostProcessing/PretransformVertices.h b/thirdparty/assimp/code/PostProcessing/PretransformVertices.h
index b2982951e0..4a958def4e 100644
--- a/thirdparty/assimp/code/PostProcessing/PretransformVertices.h
+++ b/thirdparty/assimp/code/PostProcessing/PretransformVertices.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -59,7 +59,7 @@ struct aiNode;
class PretransformVerticesTest;
-namespace Assimp {
+namespace Assimp {
// ---------------------------------------------------------------------------
/** The PretransformVertices pre-transforms all vertices in the node tree
@@ -68,97 +68,97 @@ namespace Assimp {
*/
class ASSIMP_API PretransformVertices : public BaseProcess {
public:
- PretransformVertices ();
- ~PretransformVertices ();
+ PretransformVertices();
+ ~PretransformVertices();
- // -------------------------------------------------------------------
- // Check whether step is active
- bool IsActive( unsigned int pFlags) const;
+ // -------------------------------------------------------------------
+ // Check whether step is active
+ bool IsActive(unsigned int pFlags) const override;
- // -------------------------------------------------------------------
- // Execute step on a given scene
- void Execute( aiScene* pScene);
+ // -------------------------------------------------------------------
+ // Execute step on a given scene
+ void Execute(aiScene *pScene) override;
- // -------------------------------------------------------------------
- // Setup import settings
- void SetupProperties(const Importer* pImp);
+ // -------------------------------------------------------------------
+ // Setup import settings
+ void SetupProperties(const Importer *pImp) override;
- // -------------------------------------------------------------------
- /** @brief Toggle the 'keep hierarchy' option
+ // -------------------------------------------------------------------
+ /** @brief Toggle the 'keep hierarchy' option
* @param keep true for keep configuration.
*/
- void KeepHierarchy(bool keep) {
- configKeepHierarchy = keep;
- }
+ void KeepHierarchy(bool keep) {
+ configKeepHierarchy = keep;
+ }
- // -------------------------------------------------------------------
- /** @brief Check whether 'keep hierarchy' is currently enabled.
+ // -------------------------------------------------------------------
+ /** @brief Check whether 'keep hierarchy' is currently enabled.
* @return ...
*/
- bool IsHierarchyKept() const {
- return configKeepHierarchy;
- }
+ bool IsHierarchyKept() const {
+ return configKeepHierarchy;
+ }
private:
- // -------------------------------------------------------------------
- // Count the number of nodes
- unsigned int CountNodes( aiNode* pcNode );
-
- // -------------------------------------------------------------------
- // Get a bitwise combination identifying the vertex format of a mesh
- unsigned int GetMeshVFormat(aiMesh* pcMesh);
-
- // -------------------------------------------------------------------
- // Count the number of vertices in the whole scene and a given
- // material index
- void CountVerticesAndFaces( aiScene* pcScene, aiNode* pcNode,
- unsigned int iMat,
- unsigned int iVFormat,
- unsigned int* piFaces,
- unsigned int* piVertices);
-
- // -------------------------------------------------------------------
- // Collect vertex/face data
- void CollectData( aiScene* pcScene, aiNode* pcNode,
- unsigned int iMat,
- unsigned int iVFormat,
- aiMesh* pcMeshOut,
- unsigned int aiCurrent[2],
- unsigned int* num_refs);
-
- // -------------------------------------------------------------------
- // Get a list of all vertex formats that occur for a given material
- // The output list contains duplicate elements
- void GetVFormatList( aiScene* pcScene, unsigned int iMat,
- std::list<unsigned int>& aiOut);
-
- // -------------------------------------------------------------------
- // Compute the absolute transformation matrices of each node
- void ComputeAbsoluteTransform( aiNode* pcNode );
-
- // -------------------------------------------------------------------
- // Simple routine to build meshes in worldspace, no further optimization
- void BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in,
- unsigned int numIn, aiNode* node);
-
- // -------------------------------------------------------------------
- // Apply the node transformation to a mesh
- void ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat);
-
- // -------------------------------------------------------------------
- // Reset transformation matrices to identity
- void MakeIdentityTransform(aiNode* nd);
-
- // -------------------------------------------------------------------
- // Build reference counters for all meshes
- void BuildMeshRefCountArray(aiNode* nd, unsigned int * refs);
-
- //! Configuration option: keep scene hierarchy as long as possible
- bool configKeepHierarchy;
- bool configNormalize;
- bool configTransform;
- aiMatrix4x4 configTransformation;
- bool mConfigPointCloud;
+ // -------------------------------------------------------------------
+ // Count the number of nodes
+ unsigned int CountNodes(const aiNode *pcNode) const;
+
+ // -------------------------------------------------------------------
+ // Get a bitwise combination identifying the vertex format of a mesh
+ unsigned int GetMeshVFormat(aiMesh *pcMesh) const;
+
+ // -------------------------------------------------------------------
+ // Count the number of vertices in the whole scene and a given
+ // material index
+ void CountVerticesAndFaces(const aiScene *pcScene, const aiNode *pcNode,
+ unsigned int iMat,
+ unsigned int iVFormat,
+ unsigned int *piFaces,
+ unsigned int *piVertices) const;
+
+ // -------------------------------------------------------------------
+ // Collect vertex/face data
+ void CollectData(const aiScene *pcScene, const aiNode *pcNode,
+ unsigned int iMat,
+ unsigned int iVFormat,
+ aiMesh *pcMeshOut,
+ unsigned int aiCurrent[2],
+ unsigned int *num_refs) const;
+
+ // -------------------------------------------------------------------
+ // Get a list of all vertex formats that occur for a given material
+ // The output list contains duplicate elements
+ void GetVFormatList(const aiScene *pcScene, unsigned int iMat,
+ std::list<unsigned int> &aiOut) const;
+
+ // -------------------------------------------------------------------
+ // Compute the absolute transformation matrices of each node
+ void ComputeAbsoluteTransform(aiNode *pcNode);
+
+ // -------------------------------------------------------------------
+ // Simple routine to build meshes in worldspace, no further optimization
+ void BuildWCSMeshes(std::vector<aiMesh *> &out, aiMesh **in,
+ unsigned int numIn, aiNode *node) const;
+
+ // -------------------------------------------------------------------
+ // Apply the node transformation to a mesh
+ void ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const;
+
+ // -------------------------------------------------------------------
+ // Reset transformation matrices to identity
+ void MakeIdentityTransform(aiNode *nd) const;
+
+ // -------------------------------------------------------------------
+ // Build reference counters for all meshes
+ void BuildMeshRefCountArray(const aiNode *nd, unsigned int *refs) const;
+
+ //! Configuration option: keep scene hierarchy as long as possible
+ bool configKeepHierarchy;
+ bool configNormalize;
+ bool configTransform;
+ aiMatrix4x4 configTransformation;
+ bool mConfigPointCloud;
};
} // end of namespace Assimp
diff --git a/thirdparty/assimp/code/PostProcessing/ProcessHelper.cpp b/thirdparty/assimp/code/PostProcessing/ProcessHelper.cpp
index 59869fdff7..1239864381 100644
--- a/thirdparty/assimp/code/PostProcessing/ProcessHelper.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ProcessHelper.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -230,46 +230,6 @@ VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh)
return avPerVertexWeights;
}
-
-// -------------------------------------------------------------------------------
-const char* TextureTypeToString(aiTextureType in)
-{
- switch (in)
- {
- case aiTextureType_NONE:
- return "n/a";
- case aiTextureType_DIFFUSE:
- return "Diffuse";
- case aiTextureType_SPECULAR:
- return "Specular";
- case aiTextureType_AMBIENT:
- return "Ambient";
- case aiTextureType_EMISSIVE:
- return "Emissive";
- case aiTextureType_OPACITY:
- return "Opacity";
- case aiTextureType_NORMALS:
- return "Normals";
- case aiTextureType_HEIGHT:
- return "Height";
- case aiTextureType_SHININESS:
- return "Shininess";
- case aiTextureType_DISPLACEMENT:
- return "Displacement";
- case aiTextureType_LIGHTMAP:
- return "Lightmap";
- case aiTextureType_REFLECTION:
- return "Reflection";
- case aiTextureType_UNKNOWN:
- return "Unknown";
- default:
- break;
- }
-
- ai_assert(false);
- return "BUG";
-}
-
// -------------------------------------------------------------------------------
const char* MappingTypeToString(aiTextureMapping in)
{
diff --git a/thirdparty/assimp/code/PostProcessing/ProcessHelper.h b/thirdparty/assimp/code/PostProcessing/ProcessHelper.h
index 0afcc41420..5762fbb35d 100644
--- a/thirdparty/assimp/code/PostProcessing/ProcessHelper.h
+++ b/thirdparty/assimp/code/PostProcessing/ProcessHelper.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -316,12 +316,6 @@ typedef std::vector <PerVertexWeight> VertexWeightTable;
// Compute a per-vertex bone weight table
VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh);
-
-// -------------------------------------------------------------------------------
-// Get a string for a given aiTextureType
-const char* TextureTypeToString(aiTextureType in);
-
-
// -------------------------------------------------------------------------------
// Get a string for a given aiTextureMapping
const char* MappingTypeToString(aiTextureMapping in);
diff --git a/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.cpp b/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.cpp
index 49ec8f5c47..0c42804103 100644
--- a/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.cpp
+++ b/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.h b/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.h
index 1f32a0abfb..4b4f346c86 100644
--- a/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.h
+++ b/thirdparty/assimp/code/PostProcessing/RemoveRedundantMaterials.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.cpp b/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.cpp
index 99fd47a3aa..5ff5b55fad 100644
--- a/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.h b/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.h
index 7bb21a8330..458b37ee0d 100644
--- a/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/RemoveVCProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ScaleProcess.cpp b/thirdparty/assimp/code/PostProcessing/ScaleProcess.cpp
index ac770c41f2..66714928b6 100644
--- a/thirdparty/assimp/code/PostProcessing/ScaleProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ScaleProcess.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ScaleProcess.h b/thirdparty/assimp/code/PostProcessing/ScaleProcess.h
index 468a216736..9cc664c6a7 100644
--- a/thirdparty/assimp/code/PostProcessing/ScaleProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/ScaleProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.cpp b/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.cpp
index be8405a17b..c1b08c5a78 100644
--- a/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.h b/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.h
index 1d7ccfc152..5135139edf 100644
--- a/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/SortByPTypeProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.cpp b/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.cpp
index 1797b28d5a..70960f4a89 100644
--- a/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.cpp
+++ b/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.h b/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.h
index 3f90576ea9..fa6f77b2d8 100644
--- a/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.h
+++ b/thirdparty/assimp/code/PostProcessing/SplitLargeMeshes.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/TextureTransform.cpp b/thirdparty/assimp/code/PostProcessing/TextureTransform.cpp
index 8ae2ba7218..bf60e2970f 100644
--- a/thirdparty/assimp/code/PostProcessing/TextureTransform.cpp
+++ b/thirdparty/assimp/code/PostProcessing/TextureTransform.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -92,9 +92,8 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
* are applied is - as always - scaling, rotation, translation.
*/
- char szTemp[512];
- int rounded = 0;
-
+ int rounded;
+ char szTemp[512];
/* Optimize the rotation angle. That's slightly difficult as
* we have an inprecise floating-point number (when comparing
@@ -185,7 +184,6 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
info.mTranslation.y = out;
}
}
- return;
}
// ------------------------------------------------------------------------------------------------
@@ -428,7 +426,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
// at the end of the list
bool ref[AI_MAX_NUMBER_OF_TEXTURECOORDS];
for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n)
- ref[n] = (!mesh->mTextureCoords[n] ? true : false);
+ ref[n] = !mesh->mTextureCoords[n];
for (it = trafo.begin();it != trafo.end(); ++it)
ref[(*it).uvIndex] = true;
diff --git a/thirdparty/assimp/code/PostProcessing/TextureTransform.h b/thirdparty/assimp/code/PostProcessing/TextureTransform.h
index 2a5d623d7f..2f6fc3edc2 100644
--- a/thirdparty/assimp/code/PostProcessing/TextureTransform.h
+++ b/thirdparty/assimp/code/PostProcessing/TextureTransform.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/TriangulateProcess.cpp b/thirdparty/assimp/code/PostProcessing/TriangulateProcess.cpp
index 1040836bbe..64cc63bbd1 100644
--- a/thirdparty/assimp/code/PostProcessing/TriangulateProcess.cpp
+++ b/thirdparty/assimp/code/PostProcessing/TriangulateProcess.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/TriangulateProcess.h b/thirdparty/assimp/code/PostProcessing/TriangulateProcess.h
index 916b5103dd..388952eb55 100644
--- a/thirdparty/assimp/code/PostProcessing/TriangulateProcess.h
+++ b/thirdparty/assimp/code/PostProcessing/TriangulateProcess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.cpp b/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.cpp
index 75d1b6ef78..6212bfb690 100644
--- a/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.cpp
+++ b/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -603,15 +603,18 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial,
ReportError("%s #%i is set, but there are only %i %s textures",
szType,iIndex,iNumIndices,szType);
}
- if (!iNumIndices)return;
+ if (!iNumIndices) {
+ return;
+ }
std::vector<aiTextureMapping> mappings(iNumIndices);
// Now check whether all UV indices are valid ...
bool bNoSpecified = true;
- for (unsigned int i = 0; i < pMaterial->mNumProperties;++i)
- {
+ for (unsigned int i = 0; i < pMaterial->mNumProperties;++i) {
aiMaterialProperty* prop = pMaterial->mProperties[i];
- if (prop->mSemantic != type)continue;
+ if (prop->mSemantic != type) {
+ continue;
+ }
if ((int)prop->mIndex >= iNumIndices)
{
@@ -634,7 +637,7 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial,
ReportError("Material property %s%i is expected to be 5 floats large (size is %i)",
prop->mKey.data,prop->mIndex, prop->mDataLength);
}
- mappings[prop->mIndex] = *((aiTextureMapping*)prop->mData);
+ //mappings[prop->mIndex] = ((aiUVTransform*)prop->mData);
}
else if (!::strcmp(prop->mKey.data,"$tex.uvwsrc")) {
if (aiPTI_Integer != prop->mType || sizeof(int) > prop->mDataLength)
@@ -774,6 +777,12 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial)
SearchForInvalidTextures(pMaterial,aiTextureType_DISPLACEMENT);
SearchForInvalidTextures(pMaterial,aiTextureType_LIGHTMAP);
SearchForInvalidTextures(pMaterial,aiTextureType_REFLECTION);
+ SearchForInvalidTextures(pMaterial,aiTextureType_BASE_COLOR);
+ SearchForInvalidTextures(pMaterial,aiTextureType_NORMAL_CAMERA);
+ SearchForInvalidTextures(pMaterial,aiTextureType_EMISSION_COLOR);
+ SearchForInvalidTextures(pMaterial,aiTextureType_METALNESS);
+ SearchForInvalidTextures(pMaterial,aiTextureType_DIFFUSE_ROUGHNESS);
+ SearchForInvalidTextures(pMaterial,aiTextureType_AMBIENT_OCCLUSION);
}
// ------------------------------------------------------------------------------------------------
@@ -795,7 +804,7 @@ void ValidateDSProcess::Validate( const aiTexture* pTexture)
if (!pTexture->mWidth) {
ReportError("aiTexture::mWidth is zero (compressed texture)");
}
- if ('\0' != pTexture->achFormatHint[3]) {
+ if ('\0' != pTexture->achFormatHint[HINTMAXTEXTURELEN - 1]) {
ReportWarning("aiTexture::achFormatHint must be zero-terminated");
}
else if ('.' == pTexture->achFormatHint[0]) {
diff --git a/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.h b/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.h
index 7b309c9251..4b5503ae03 100644
--- a/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.h
+++ b/thirdparty/assimp/code/PostProcessing/ValidateDataStructure.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/contrib/utf8cpp/doc/ReleaseNotes b/thirdparty/assimp/contrib/utf8cpp/doc/ReleaseNotes
deleted file mode 100644
index 364411a23d..0000000000
--- a/thirdparty/assimp/contrib/utf8cpp/doc/ReleaseNotes
+++ /dev/null
@@ -1,12 +0,0 @@
-utf8 cpp library
-Release 2.3.4
-
-A minor bug fix release. Thanks to all who reported bugs.
-
-Note: Version 2.3.3 contained a regression, and therefore was removed.
-
-Changes from version 2.3.2
-- Bug fix [39]: checked.h Line 273 and unchecked.h Line 182 have an extra ';'
-- Bug fix [36]: replace_invalid() only works with back_inserter
-
-Files included in the release: utf8.h, core.h, checked.h, unchecked.h, utf8cpp.html, ReleaseNotes
diff --git a/thirdparty/assimp/contrib/utf8cpp/doc/utf8cpp.html b/thirdparty/assimp/contrib/utf8cpp/doc/utf8cpp.html
deleted file mode 100644
index 6f2aacbe7b..0000000000
--- a/thirdparty/assimp/contrib/utf8cpp/doc/utf8cpp.html
+++ /dev/null
@@ -1,1789 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <meta name="generator" content=
- "HTML Tidy for Linux/x86 (vers 1st November 2002), see www.w3.org">
- <meta name="description" content=
- "A simple, portable and lightweigt C++ library for easy handling of UTF-8 encoded strings">
- <meta name="keywords" content="UTF-8 C++ portable utf8 unicode generic templates">
- <meta name="author" content="Nemanja Trifunovic">
- <title>
- UTF8-CPP: UTF-8 with C++ in a Portable Way
- </title>
- <style type="text/css">
- <!--
- span.return_value {
- color: brown;
- }
- span.keyword {
- color: blue;
- }
- span.preprocessor {
- color: navy;
- }
- span.literal {
- color: olive;
- }
- span.comment {
- color: green;
- }
- code {
- font-weight: bold;
- }
- ul.toc {
- list-style-type: none;
- }
- p.version {
- font-size: small;
- font-style: italic;
- }
- -->
- </style>
- </head>
- <body>
- <h1>
- UTF8-CPP: UTF-8 with C++ in a Portable Way
- </h1>
- <p>
- <a href="https://sourceforge.net/projects/utfcpp">The Sourceforge project page</a>
- </p>
- <div id="toc">
- <h2>
- Table of Contents
- </h2>
- <ul class="toc">
- <li>
- <a href="#introduction">Introduction</a>
- </li>
- <li>
- <a href="#examples">Examples of Use</a>
- <ul class="toc">
- <li>
- <a href=#introsample>Introductionary Sample </a>
- </li>
- <li>
- <a href=#validfile>Checking if a file contains valid UTF-8 text</a>
- </li>
- <li>
- <a href=#fixinvalid>Ensure that a string contains valid UTF-8 text</a>
- </li>
- </ul>
- <li>
- <a href="#reference">Reference</a>
- <ul class="toc">
- <li>
- <a href="#funutf8">Functions From utf8 Namespace </a>
- </li>
- <li>
- <a href="#typesutf8">Types From utf8 Namespace </a>
- </li>
- <li>
- <a href="#fununchecked">Functions From utf8::unchecked Namespace </a>
- </li>
- <li>
- <a href="#typesunchecked">Types From utf8::unchecked Namespace </a>
- </li>
- </ul>
- </li>
- <li>
- <a href="#points">Points of Interest</a>
- </li>
- <li>
- <a href="#links">Links</a>
- </li>
- </ul>
- </div>
- <h2 id="introduction">
- Introduction
- </h2>
- <p>
- Many C++ developers miss an easy and portable way of handling Unicode encoded
- strings. The original C++ Standard (known as C++98 or C++03) is Unicode agnostic.
- C++11 provides some support for Unicode on core language and library level:
- u8, u, and U character and string literals, char16_t and char32_t character types,
- u16string and u32string library classes, and codecvt support for conversions
- between Unicode encoding forms.
- In the meantime, developers use third party libraries like ICU, OS specific capabilities, or simply
- roll out their own solutions.
- </p>
- <p>
- In order to easily handle UTF-8 encoded Unicode strings, I came up with a small
- generic library. For anybody used to work with STL algorithms and iterators, it should be
- easy and natural to use. The code is freely available for any purpose - check out
- the license at the beginning of the utf8.h file. If you run into
- bugs or performance issues, please let me know and I'll do my best to address them.
- </p>
- <p>
- The purpose of this article is not to offer an introduction to Unicode in general,
- and UTF-8 in particular. If you are not familiar with Unicode, be sure to check out
- <a href="http://www.unicode.org/">Unicode Home Page</a> or some other source of
- information for Unicode. Also, it is not my aim to advocate the use of UTF-8
- encoded strings in C++ programs; if you want to handle UTF-8 encoded strings from
- C++, I am sure you have good reasons for it.
- </p>
- <h2 id="examples">
- Examples of use
- </h2>
- <h3 id="introsample">
- Introductionary Sample
- </h3>
- <p>
- To illustrate the use of the library, let's start with a small but complete program
- that opens a file containing UTF-8 encoded text, reads it line by line, checks each line
- for invalid UTF-8 byte sequences, and converts it to UTF-16 encoding and back to UTF-8:
- </p>
-<pre>
-<span class="preprocessor">#include &lt;fstream&gt;</span>
-<span class="preprocessor">#include &lt;iostream&gt;</span>
-<span class="preprocessor">#include &lt;string&gt;</span>
-<span class="preprocessor">#include &lt;vector&gt;</span>
-<span class="preprocessor">#include "utf8.h"</span>
-<span class="keyword">using namespace</span> std;
-<span class="keyword">int</span> main(<span class="keyword">int</span> argc, <span class="keyword">char</span>** argv)
-{
- <span class="keyword">if</span> (argc != <span class="literal">2</span>) {
- cout &lt;&lt; <span class="literal">"\nUsage: docsample filename\n"</span>;
- <span class="keyword">return</span> <span class="literal">0</span>;
- }
-
- <span class="keyword">const char</span>* test_file_path = argv[1];
- <span class="comment">// Open the test file (contains UTF-8 encoded text)</span>
- ifstream fs8(test_file_path);
- <span class="keyword">if</span> (!fs8.is_open()) {
- cout &lt;&lt; <span class=
-"literal">"Could not open "</span> &lt;&lt; test_file_path &lt;&lt; endl;
- <span class="keyword">return</span> <span class="literal">0</span>;
- }
-
- <span class="keyword">unsigned</span> line_count = <span class="literal">1</span>;
- string line;
- <span class="comment">// Play with all the lines in the file</span>
- <span class="keyword">while</span> (getline(fs8, line)) {
- <span class="comment">// check for invalid utf-8 (for a simple yes/no check, there is also utf8::is_valid function)</span>
- string::iterator end_it = utf8::find_invalid(line.begin(), line.end());
- <span class="keyword">if</span> (end_it != line.end()) {
- cout &lt;&lt; <span class=
-"literal">"Invalid UTF-8 encoding detected at line "</span> &lt;&lt; line_count &lt;&lt; <span
- class="literal">"\n"</span>;
- cout &lt;&lt; <span class=
-"literal">"This part is fine: "</span> &lt;&lt; string(line.begin(), end_it) &lt;&lt; <span
- class="literal">"\n"</span>;
- }
-
- <span class="comment">// Get the line length (at least for the valid part)</span>
- <span class="keyword">int</span> length = utf8::distance(line.begin(), end_it);
- cout &lt;&lt; <span class=
-"literal">"Length of line "</span> &lt;&lt; line_count &lt;&lt; <span class=
-"literal">" is "</span> &lt;&lt; length &lt;&lt; <span class="literal">"\n"</span>;
-
- <span class="comment">// Convert it to utf-16</span>
- vector&lt;unsigned short&gt; utf16line;
- utf8::utf8to16(line.begin(), end_it, back_inserter(utf16line));
-
- <span class="comment">// And back to utf-8</span>
- string utf8line;
- utf8::utf16to8(utf16line.begin(), utf16line.end(), back_inserter(utf8line));
-
- <span class="comment">// Confirm that the conversion went OK:</span>
- <span class="keyword">if</span> (utf8line != string(line.begin(), end_it))
- cout &lt;&lt; <span class=
-"literal">"Error in UTF-16 conversion at line: "</span> &lt;&lt; line_count &lt;&lt; <span
- class="literal">"\n"</span>;
-
- line_count++;
- }
- <span class="keyword">return</span> <span class="literal">0</span>;
-}
-</pre>
- <p>
- In the previous code sample, for each line we performed
- a detection of invalid UTF-8 sequences with <code>find_invalid</code>; the number
- of characters (more precisely - the number of Unicode code points, including the end
- of line and even BOM if there is one) in each line was
- determined with a use of <code>utf8::distance</code>; finally, we have converted
- each line to UTF-16 encoding with <code>utf8to16</code> and back to UTF-8 with
- <code>utf16to8</code>.
- </p>
- <h3 id="validfile">Checking if a file contains valid UTF-8 text</h3>
-<p>
-Here is a function that checks whether the content of a file is valid UTF-8 encoded text without
-reading the content into the memory:
-</p>
-<pre>
-<span class="keyword">bool</span> valid_utf8_file(i<span class="keyword">const char</span>* file_name)
-{
- ifstream ifs(file_name);
- <span class="keyword">if</span> (!ifs)
- <span class="keyword">return false</span>; <span class="comment">// even better, throw here</span>
-
- istreambuf_iterator&lt;<span class="keyword">char</span>&gt; it(ifs.rdbuf());
- istreambuf_iterator&lt;<span class="keyword">char</span>&gt; eos;
-
- <span class="keyword">return</span> utf8::is_valid(it, eos);
-}
-</pre>
-<p>
-Because the function <code>utf8::is_valid()</code> works with input iterators, we were able
-to pass an <code>istreambuf_iterator</code> to it and read the content of the file directly
-without loading it to the memory first.</p>
-<p>
-Note that other functions that take input iterator arguments can be used in a similar way. For
-instance, to read the content of a UTF-8 encoded text file and convert the text to UTF-16, just
-do something like:
-</p>
-<pre>
- utf8::utf8to16(it, eos, back_inserter(u16string));
-</pre>
- <h3 id="fixinvalid">Ensure that a string contains valid UTF-8 text</h3>
-<p>
-If we have some text that "probably" contains UTF-8 encoded text and we want to
-replace any invalid UTF-8 sequence with a replacement character, something like
-the following function may be used:
-</p>
-<pre>
-<span class="keyword">void</span> fix_utf8_string(std::string&amp; str)
-{
- std::string temp;
- utf8::replace_invalid(str.begin(), str.end(), back_inserter(temp));
- str = temp;
-}
-</pre>
-<p>The function will replace any invalid UTF-8 sequence with a Unicode replacement character.
-There is an overloaded function that enables the caller to supply their own replacement character.
-</p>
- <h2 id="reference">
- Reference
- </h2>
- <h3 id="funutf8">
- Functions From utf8 Namespace
- </h3>
- <h4>
- utf8::append
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Encodes a 32 bit code point as a UTF-8 sequence of octets and appends the sequence
- to a UTF-8 string.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-octet_iterator append(uint32_t cp, octet_iterator result);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an output iterator.<br>
- <code>cp</code>: a 32 bit integer representing a code point to append to the
- sequence.<br>
- <code>result</code>: an output iterator to the place in the sequence where to
- append the code point.<br>
- <span class="return_value">Return value</span>: an iterator pointing to the place
- after the newly appended sequence.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">unsigned char</span> u[<span class="literal">5</span>] = {<span
-class="literal">0</span>,<span class="literal">0</span>,<span class=
-"literal">0</span>,<span class="literal">0</span>,<span class="literal">0</span>};
-<span class="keyword">unsigned char</span>* end = append(<span class=
-"literal">0x0448</span>, u);
-assert (u[<span class="literal">0</span>] == <span class=
-"literal">0xd1</span> &amp;&amp; u[<span class="literal">1</span>] == <span class=
-"literal">0x88</span> &amp;&amp; u[<span class="literal">2</span>] == <span class=
-"literal">0</span> &amp;&amp; u[<span class="literal">3</span>] == <span class=
-"literal">0</span> &amp;&amp; u[<span class="literal">4</span>] == <span class=
-"literal">0</span>);
-</pre>
- <p>
- Note that <code>append</code> does not allocate any memory - it is the burden of
- the caller to make sure there is enough memory allocated for the operation. To make
- things more interesting, <code>append</code> can add anywhere between 1 and 4
- octets to the sequence. In practice, you would most often want to use
- <code>std::back_inserter</code> to ensure that the necessary memory is allocated.
- </p>
- <p>
- In case of an invalid code point, a <code>utf8::invalid_code_point</code> exception
- is thrown.
- </p>
- <h4>
- utf8::next
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Given the iterator to the beginning of the UTF-8 sequence, it returns the code
- point and moves the iterator to the next position.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t next(octet_iterator&amp; it, octet_iterator end);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>it</code>: a reference to an iterator pointing to the beginning of an UTF-8
- encoded code point. After the function returns, it is incremented to point to the
- beginning of the next code point.<br>
- <code>end</code>: end of the UTF-8 sequence to be processed. If <code>it</code>
- gets equal to <code>end</code> during the extraction of a code point, an
- <code>utf8::not_enough_room</code> exception is thrown.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- processed UTF-8 code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars;
-<span class="keyword">int</span> cp = next(w, twochars + <span class="literal">6</span>);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars + <span class="literal">3</span>);
-</pre>
- <p>
- This function is typically used to iterate through a UTF-8 encoded string.
- </p>
- <p>
- In case of an invalid UTF-8 seqence, a <code>utf8::invalid_utf8</code> exception is
- thrown.
- </p>
- <h4>
- utf8::peek_next
- </h4>
- <p class="version">
- Available in version 2.1 and later.
- </p>
- <p>
- Given the iterator to the beginning of the UTF-8 sequence, it returns the code
- point for the following sequence without changing the value of the iterator.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t peek_next(octet_iterator it, octet_iterator end);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>it</code>: an iterator pointing to the beginning of an UTF-8
- encoded code point.<br>
- <code>end</code>: end of the UTF-8 sequence to be processed. If <code>it</code>
- gets equal to <code>end</code> during the extraction of a code point, an
- <code>utf8::not_enough_room</code> exception is thrown.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- processed UTF-8 code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars;
-<span class="keyword">int</span> cp = peek_next(w, twochars + <span class="literal">6</span>);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars);
-</pre>
- <p>
- In case of an invalid UTF-8 seqence, a <code>utf8::invalid_utf8</code> exception is
- thrown.
- </p>
- <h4>
- utf8::prior
- </h4>
- <p class="version">
- Available in version 1.02 and later.
- </p>
- <p>
- Given a reference to an iterator pointing to an octet in a UTF-8 sequence, it
- decreases the iterator until it hits the beginning of the previous UTF-8 encoded
- code point and returns the 32 bits representation of the code point.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t prior(octet_iterator&amp; it, octet_iterator start);
-
-</pre>
- <p>
- <code>octet_iterator</code>: a bidirectional iterator.<br>
- <code>it</code>: a reference pointing to an octet within a UTF-8 encoded string.
- After the function returns, it is decremented to point to the beginning of the
- previous code point.<br>
- <code>start</code>: an iterator to the beginning of the sequence where the search
- for the beginning of a code point is performed. It is a
- safety measure to prevent passing the beginning of the string in the search for a
- UTF-8 lead octet.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- previous code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">unsigned char</span>* w = twochars + <span class=
-"literal">3</span>;
-<span class="keyword">int</span> cp = prior (w, twochars);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars);
-</pre>
- <p>
- This function has two purposes: one is two iterate backwards through a UTF-8
- encoded string. Note that it is usually a better idea to iterate forward instead,
- since <code>utf8::next</code> is faster. The second purpose is to find a beginning
- of a UTF-8 sequence if we have a random position within a string. Note that in that
- case <code>utf8::prior</code> may not detect an invalid UTF-8 sequence in some scenarios:
- for instance if there are superfluous trail octets, it will just skip them.
- </p>
- <p>
- <code>it</code> will typically point to the beginning of
- a code point, and <code>start</code> will point to the
- beginning of the string to ensure we don't go backwards too far. <code>it</code> is
- decreased until it points to a lead UTF-8 octet, and then the UTF-8 sequence
- beginning with that octet is decoded to a 32 bit representation and returned.
- </p>
- <p>
- In case <code>start</code> is reached before a UTF-8 lead octet is hit, or if an
- invalid UTF-8 sequence is started by the lead octet, an <code>invalid_utf8</code>
- exception is thrown.
- </p>
- <p>In case <code>start</code> equals <code>it</code>, a <code>not_enough_room</code>
- exception is thrown.
- <h4>
- utf8::previous
- </h4>
- <p class="version">
- Deprecated in version 1.02 and later.
- </p>
- <p>
- Given a reference to an iterator pointing to an octet in a UTF-8 seqence, it
- decreases the iterator until it hits the beginning of the previous UTF-8 encoded
- code point and returns the 32 bits representation of the code point.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t previous(octet_iterator&amp; it, octet_iterator pass_start);
-
-</pre>
- <p>
- <code>octet_iterator</code>: a random access iterator.<br>
- <code>it</code>: a reference pointing to an octet within a UTF-8 encoded string.
- After the function returns, it is decremented to point to the beginning of the
- previous code point.<br>
- <code>pass_start</code>: an iterator to the point in the sequence where the search
- for the beginning of a code point is aborted if no result was reached. It is a
- safety measure to prevent passing the beginning of the string in the search for a
- UTF-8 lead octet.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- previous code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">unsigned char</span>* w = twochars + <span class=
-"literal">3</span>;
-<span class="keyword">int</span> cp = previous (w, twochars - <span class=
-"literal">1</span>);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars);
-</pre>
- <p>
- <code>utf8::previous</code> is deprecated, and <code>utf8::prior</code> should
- be used instead, although the existing code can continue using this function.
- The problem is the parameter <code>pass_start</code> that points to the position
- just before the beginning of the sequence. Standard containers don't have the
- concept of "pass start" and the function can not be used with their iterators.
- </p>
- <p>
- <code>it</code> will typically point to the beginning of
- a code point, and <code>pass_start</code> will point to the octet just before the
- beginning of the string to ensure we don't go backwards too far. <code>it</code> is
- decreased until it points to a lead UTF-8 octet, and then the UTF-8 sequence
- beginning with that octet is decoded to a 32 bit representation and returned.
- </p>
- <p>
- In case <code>pass_start</code> is reached before a UTF-8 lead octet is hit, or if an
- invalid UTF-8 sequence is started by the lead octet, an <code>invalid_utf8</code>
- exception is thrown
- </p>
- <h4>
- utf8::advance
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Advances an iterator by the specified number of code points within an UTF-8
- sequence.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, typename distance_type&gt;
-<span class=
-"keyword">void</span> advance (octet_iterator&amp; it, distance_type n, octet_iterator end);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>distance_type</code>: an integral type convertible to <code>octet_iterator</code>'s difference type.<br>
- <code>it</code>: a reference to an iterator pointing to the beginning of an UTF-8
- encoded code point. After the function returns, it is incremented to point to the
- nth following code point.<br>
- <code>n</code>: a positive integer that shows how many code points we want to
- advance.<br>
- <code>end</code>: end of the UTF-8 sequence to be processed. If <code>it</code>
- gets equal to <code>end</code> during the extraction of a code point, an
- <code>utf8::not_enough_room</code> exception is thrown.<br>
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">unsigned char</span>* w = twochars;
-advance (w, <span class="literal">2</span>, twochars + <span class="literal">6</span>);
-assert (w == twochars + <span class="literal">5</span>);
-</pre>
- <p>
- This function works only "forward". In case of a negative <code>n</code>, there is
- no effect.
- </p>
- <p>
- In case of an invalid code point, a <code>utf8::invalid_code_point</code> exception
- is thrown.
- </p>
- <h4>
- utf8::distance
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Given the iterators to two UTF-8 encoded code points in a seqence, returns the
- number of code points between them.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-<span class=
-"keyword">typename</span> std::iterator_traits&lt;octet_iterator&gt;::difference_type distance (octet_iterator first, octet_iterator last);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>first</code>: an iterator to a beginning of a UTF-8 encoded code point.<br>
- <code>last</code>: an iterator to a "post-end" of the last UTF-8 encoded code
- point in the sequence we are trying to determine the length. It can be the
- beginning of a new code point, or not.<br>
- <span class="return_value">Return value</span> the distance between the iterators,
- in code points.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-size_t dist = utf8::distance(twochars, twochars + <span class="literal">5</span>);
-assert (dist == <span class="literal">2</span>);
-</pre>
- <p>
- This function is used to find the length (in code points) of a UTF-8 encoded
- string. The reason it is called <em>distance</em>, rather than, say,
- <em>length</em> is mainly because developers are used that <em>length</em> is an
- O(1) function. Computing the length of an UTF-8 string is a linear operation, and
- it looked better to model it after <code>std::distance</code> algorithm.
- </p>
- <p>
- In case of an invalid UTF-8 seqence, a <code>utf8::invalid_utf8</code> exception is
- thrown. If <code>last</code> does not point to the past-of-end of a UTF-8 seqence,
- a <code>utf8::not_enough_room</code> exception is thrown.
- </p>
- <h4>
- utf8::utf16to8
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts a UTF-16 encoded string to UTF-8.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> u16bit_iterator, <span class=
-"keyword">typename</span> octet_iterator&gt;
-octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result);
-
-</pre>
- <p>
- <code>u16bit_iterator</code>: an input iterator.<br>
- <code>octet_iterator</code>: an output iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-16 encoded
- string to convert.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-16 encoded
- string to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-8 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-8 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">unsigned short</span> utf16string[] = {<span class=
-"literal">0x41</span>, <span class="literal">0x0448</span>, <span class=
-"literal">0x65e5</span>, <span class="literal">0xd834</span>, <span class=
-"literal">0xdd1e</span>};
-vector&lt;<span class="keyword">unsigned char</span>&gt; utf8result;
-utf16to8(utf16string, utf16string + <span class=
-"literal">5</span>, back_inserter(utf8result));
-assert (utf8result.size() == <span class="literal">10</span>);
-</pre>
- <p>
- In case of invalid UTF-16 sequence, a <code>utf8::invalid_utf16</code> exception is
- thrown.
- </p>
- <h4>
- utf8::utf8to16
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts an UTF-8 encoded string to UTF-16
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> u16bit_iterator, typename octet_iterator&gt;
-u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>u16bit_iterator</code>: an output iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 encoded
- string to convert. &lt; br /&gt; <code>end</code>: an iterator pointing to
- pass-the-end of the UTF-8 encoded string to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-16 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-16 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span> utf8_with_surrogates[] = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88\xf0\x9d\x84\x9e"</span>;
-vector &lt;<span class="keyword">unsigned short</span>&gt; utf16result;
-utf8to16(utf8_with_surrogates, utf8_with_surrogates + <span class=
-"literal">9</span>, back_inserter(utf16result));
-assert (utf16result.size() == <span class="literal">4</span>);
-assert (utf16result[<span class="literal">2</span>] == <span class=
-"literal">0xd834</span>);
-assert (utf16result[<span class="literal">3</span>] == <span class=
-"literal">0xdd1e</span>);
-</pre>
- <p>
- In case of an invalid UTF-8 seqence, a <code>utf8::invalid_utf8</code> exception is
- thrown. If <code>end</code> does not point to the past-of-end of a UTF-8 seqence, a
- <code>utf8::not_enough_room</code> exception is thrown.
- </p>
- <h4>
- utf8::utf32to8
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts a UTF-32 encoded string to UTF-8.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, typename u32bit_iterator&gt;
-octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an output iterator.<br>
- <code>u32bit_iterator</code>: an input iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-32 encoded
- string to convert.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-32 encoded
- string to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-8 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-8 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">int</span> utf32string[] = {<span class=
-"literal">0x448</span>, <span class="literal">0x65E5</span>, <span class=
-"literal">0x10346</span>, <span class="literal">0</span>};
-vector&lt;<span class="keyword">unsigned char</span>&gt; utf8result;
-utf32to8(utf32string, utf32string + <span class=
-"literal">3</span>, back_inserter(utf8result));
-assert (utf8result.size() == <span class="literal">9</span>);
-</pre>
- <p>
- In case of invalid UTF-32 string, a <code>utf8::invalid_code_point</code> exception
- is thrown.
- </p>
- <h4>
- utf8::utf8to32
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts a UTF-8 encoded string to UTF-32.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, <span class=
-"keyword">typename</span> u32bit_iterator&gt;
-u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>u32bit_iterator</code>: an output iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 encoded
- string to convert.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-8 encoded string
- to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-32 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-32 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-vector&lt;<span class="keyword">int</span>&gt; utf32result;
-utf8to32(twochars, twochars + <span class=
-"literal">5</span>, back_inserter(utf32result));
-assert (utf32result.size() == <span class="literal">2</span>);
-</pre>
- <p>
- In case of an invalid UTF-8 seqence, a <code>utf8::invalid_utf8</code> exception is
- thrown. If <code>end</code> does not point to the past-of-end of a UTF-8 seqence, a
- <code>utf8::not_enough_room</code> exception is thrown.
- </p>
- <h4>
- utf8::find_invalid
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Detects an invalid sequence within a UTF-8 string.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-octet_iterator find_invalid(octet_iterator start, octet_iterator end);
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 string to
- test for validity.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-8 string to test
- for validity.<br>
- <span class="return_value">Return value</span>: an iterator pointing to the first
- invalid octet in the UTF-8 string. In case none were found, equals
- <code>end</code>.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span> utf_invalid[] = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88\xfa"</span>;
-<span class=
-"keyword">char</span>* invalid = find_invalid(utf_invalid, utf_invalid + <span class=
-"literal">6</span>);
-assert (invalid == utf_invalid + <span class="literal">5</span>);
-</pre>
- <p>
- This function is typically used to make sure a UTF-8 string is valid before
- processing it with other functions. It is especially important to call it if before
- doing any of the <em>unchecked</em> operations on it.
- </p>
- <h4>
- utf8::is_valid
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Checks whether a sequence of octets is a valid UTF-8 string.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-<span class="keyword">bool</span> is_valid(octet_iterator start, octet_iterator end);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 string to
- test for validity.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-8 string to test
- for validity.<br>
- <span class="return_value">Return value</span>: <code>true</code> if the sequence
- is a valid UTF-8 string; <code>false</code> if not.
- </p>
- Example of use:
-<pre>
-<span class="keyword">char</span> utf_invalid[] = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88\xfa"</span>;
-<span class="keyword">bool</span> bvalid = is_valid(utf_invalid, utf_invalid + <span
-class="literal">6</span>);
-assert (bvalid == false);
-</pre>
- <p>
- <code>is_valid</code> is a shorthand for <code>find_invalid(start, end) ==
- end;</code>. You may want to use it to make sure that a byte seqence is a valid
- UTF-8 string without the need to know where it fails if it is not valid.
- </p>
- <h4>
- utf8::replace_invalid
- </h4>
- <p class="version">
- Available in version 2.0 and later.
- </p>
- <p>
- Replaces all invalid UTF-8 sequences within a string with a replacement marker.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, <span class=
-"keyword">typename</span> output_iterator&gt;
-output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement);
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, <span class=
-"keyword">typename</span> output_iterator&gt;
-output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out);
-
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>output_iterator</code>: an output iterator.<br>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 string to
- look for invalid UTF-8 sequences.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-8 string to look
- for invalid UTF-8 sequences.<br>
- <code>out</code>: An output iterator to the range where the result of replacement
- is stored.<br>
- <code>replacement</code>: A Unicode code point for the replacement marker. The
- version without this parameter assumes the value <code>0xfffd</code><br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the UTF-8 string with replaced invalid sequences.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span> invalid_sequence[] = <span class=
-"literal">"a\x80\xe0\xa0\xc0\xaf\xed\xa0\x80z"</span>;
-vector&lt;<span class="keyword">char</span>&gt; replace_invalid_result;
-replace_invalid (invalid_sequence, invalid_sequence + sizeof(invalid_sequence), back_inserter(replace_invalid_result), <span
- class="literal">'?'</span>);
-bvalid = is_valid(replace_invalid_result.begin(), replace_invalid_result.end());
-assert (bvalid);
-<span class="keyword">char</span>* fixed_invalid_sequence = <span class=
-"literal">"a????z"</span>;
-assert (std::equal(replace_invalid_result.begin(), replace_invalid_result.end(), fixed_invalid_sequence));
-</pre>
- <p>
- <code>replace_invalid</code> does not perform in-place replacement of invalid
- sequences. Rather, it produces a copy of the original string with the invalid
- sequences replaced with a replacement marker. Therefore, <code>out</code> must not
- be in the <code>[start, end]</code> range.
- </p>
- <p>
- If <code>end</code> does not point to the past-of-end of a UTF-8 sequence, a
- <code>utf8::not_enough_room</code> exception is thrown.
- </p>
- <h4>
- utf8::starts_with_bom
- </h4>
- <p class="version">
- Available in version 2.3 and later. Relaces deprecated <code>is_bom()</code> function.
- </p>
- <p>
- Checks whether an octet sequence starts with a UTF-8 byte order mark (BOM)
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-<span class="keyword">bool</span> starts_with_bom (octet_iterator it, octet_iterator end);
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>it</code>: beginning of the octet sequence to check<br>
- <code>end</code>: pass-end of the sequence to check<br>
- <span class="return_value">Return value</span>: <code>true</code> if the sequence
- starts with a UTF-8 byte order mark; <code>false</code> if not.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">unsigned char</span> byte_order_mark[] = {<span class=
-"literal">0xef</span>, <span class="literal">0xbb</span>, <span class=
-"literal">0xbf</span>};
-<span class="keyword">bool</span> bbom = starts_with_bom(byte_order_mark, byte_order_mark + <span class="keyword">sizeof</span>(byte_order_mark));
-assert (bbom == <span class="literal">true</span>);
-</pre>
- <p>
- The typical use of this function is to check the first three bytes of a file. If
- they form the UTF-8 BOM, we want to skip them before processing the actual UTF-8
- encoded text.
- </p>
- <h4>
- utf8::is_bom
- </h4>
- <p class="version">
- Available in version 1.0 and later. Deprecated in version 2.3. <code>starts_with_bom()</code> should be used
- instead.
- </p>
- <p>
- Checks whether a sequence of three octets is a UTF-8 byte order mark (BOM)
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-<span class="keyword">bool</span> is_bom (octet_iterator it); <span class="comment"> // Deprecated</span>
-</pre>
- <p>
- <code>octet_iterator</code>: an input iterator.<br>
- <code>it</code>: beginning of the 3-octet sequence to check<br>
- <span class="return_value">Return value</span>: <code>true</code> if the sequence
- is UTF-8 byte order mark; <code>false</code> if not.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">unsigned char</span> byte_order_mark[] = {<span class=
-"literal">0xef</span>, <span class="literal">0xbb</span>, <span class=
-"literal">0xbf</span>};
-<span class="keyword">bool</span> bbom = is_bom(byte_order_mark);
-assert (bbom == <span class="literal">true</span>);
-</pre>
- <p>
- The typical use of this function is to check the first three bytes of a file. If
- they form the UTF-8 BOM, we want to skip them before processing the actual UTF-8
- encoded text.
- </p>
- <p>
- If a sequence is
- shorter than three bytes, an invalid iterator will be dereferenced. Therefore, this function is deprecated
- in favor of <code>starts_with_bom()</code>that takes the end of sequence as an argument.
- </p>
- <h3 id="typesutf8">
- Types From utf8 Namespace
- </h3>
- <h4>utf8::exception
- </h4>
- <p class="version">
- Available in version 2.3 and later.
- </p>
- <p>
- Base class for the exceptions thrown by UTF CPP library functions.
- </p>
-<pre>
-<span class="keyword">class</span> exception : <span class="keyword">public</span> std::exception {};
-</pre>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">try</span> {
- code_that_uses_utf_cpp_library();
-}
-<span class="keyword">catch</span>(<span class="keyword">const</span> utf8::exception&amp; utfcpp_ex) {
- cerr &lt;&lt; utfcpp_ex.what();
-}
-</pre>
-
- <h4>utf8::invalid_code_point
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Thrown by UTF8 CPP functions such as <code>advance</code> and <code>next</code> if an UTF-8 sequence represents and invalid code point.
- </p>
-
-<pre>
-<span class="keyword">class</span> invalid_code_point : <span class="keyword">public</span> exception {
-<span class="keyword">public</span>:
- uint32_t code_point() <span class="keyword">const</span>;
-};
-
-</pre>
- <p>
- Member function <code>code_point()</code> can be used to determine the invalid code point that
- caused the exception to be thrown.
- </p>
- <h4>utf8::invalid_utf8
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Thrown by UTF8 CPP functions such as <code>next</code> and <code>prior</code> if an invalid UTF-8 sequence
- is detected during decoding.
- </p>
-
-<pre>
-<span class="keyword">class</span> invalid_utf8 : <span class="keyword">public</span> exception {
-<span class="keyword">public</span>:
- uint8_t utf8_octet() <span class="keyword">const</span>;
-};
-</pre>
-
- <p>
- Member function <code>utf8_octet()</code> can be used to determine the beginning of the byte
- sequence that caused the exception to be thrown.
- </p>
-</pre>
- <h4>utf8::invalid_utf16
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Thrown by UTF8 CPP function <code>utf16to8</code> if an invalid UTF-16 sequence
- is detected during decoding.
- </p>
-
-<pre>
-<span class="keyword">class</span> invalid_utf16 : <span class="keyword">public</span> exception {
-<span class="keyword">public</span>:
- uint16_t utf16_word() <span class="keyword">const</span>;
-};
-</pre>
-
- <p>
- Member function <code>utf16_word()</code> can be used to determine the UTF-16 code unit
- that caused the exception to be thrown.
- </p>
- <h4>utf8::not_enough_room
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Thrown by UTF8 CPP functions such as <code>next</code> if the end of the decoded UTF-8 sequence
- was reached before the code point was decoded.
- </p>
-
-<pre>
-<span class="keyword">class</span> not_enough_room : <span class="keyword">public</span> exception {};
-</pre>
- <h4>
- utf8::iterator
- </h4>
- <p class="version">
- Available in version 2.0 and later.
- </p>
- <p>
- Adapts the underlying octet iterator to iterate over the sequence of code points,
- rather than raw octets.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class="keyword">typename</span> octet_iterator&gt;
-<span class="keyword">class</span> iterator;
-</pre>
-
- <h5>Member functions</h5>
- <dl>
- <dt><code>iterator();</code> <dd> the deafult constructor; the underlying <code>octet_iterator</code> is
- constructed with its default constructor.
- <dt><code><span class="keyword">explicit</span> iterator (const octet_iterator&amp; octet_it,
- const octet_iterator&amp; range_start,
- const octet_iterator&amp; range_end);</code> <dd> a constructor
- that initializes the underlying <code>octet_iterator</code> with <code>octet_it</code>
- and sets the range in which the iterator is considered valid.
- <dt><code>octet_iterator base () <span class="keyword">const</span>;</code> <dd> returns the
- underlying <code>octet_iterator</code>.
- <dt><code>uint32_t operator * () <span class="keyword">const</span>;</code> <dd> decodes the utf-8 sequence
- the underlying <code>octet_iterator</code> is pointing to and returns the code point.
- <dt><code><span class="keyword">bool operator</span> == (const iterator&amp; rhs)
- <span class="keyword">const</span>;</code> <dd> returns <span class="keyword">true</span>
- if the two underlaying iterators are equal.
- <dt><code><span class="keyword">bool operator</span> != (const iterator&amp; rhs)
- <span class="keyword">const</span>;</code> <dd> returns <span class="keyword">true</span>
- if the two underlaying iterators are not equal.
- <dt><code>iterator&amp; <span class="keyword">operator</span> ++ (); </code> <dd> the prefix increment - moves
- the iterator to the next UTF-8 encoded code point.
- <dt><code>iterator <span class="keyword">operator</span> ++ (<span class="keyword">int</span>); </code> <dd>
- the postfix increment - moves the iterator to the next UTF-8 encoded code point and returns the current one.
- <dt><code>iterator&amp; <span class="keyword">operator</span> -- (); </code> <dd> the prefix decrement - moves
- the iterator to the previous UTF-8 encoded code point.
- <dt><code>iterator <span class="keyword">operator</span> -- (<span class="keyword">int</span>); </code> <dd>
- the postfix decrement - moves the iterator to the previous UTF-8 encoded code point and returns the current one.
- </dl>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* threechars = <span class="literal">"\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88"</span>;
-utf8::iterator&lt;<span class="keyword">char</span>*&gt; it(threechars, threechars, threechars + <span class="literal">9</span>);
-utf8::iterator&lt;<span class="keyword">char</span>*&gt; it2 = it;
-assert (it2 == it);
-assert (*it == <span class="literal">0x10346</span>);
-assert (*(++it) == <span class="literal">0x65e5</span>);
-assert ((*it++) == <span class="literal">0x65e5</span>);
-assert (*it == <span class="literal">0x0448</span>);
-assert (it != it2);
-utf8::iterator&lt;<span class="keyword">char</span>*&gt; endit (threechars + <span class="literal">9</span>, threechars, threechars + <span class="literal">9</span>);
-assert (++it == endit);
-assert (*(--it) == <span class="literal">0x0448</span>);
-assert ((*it--) == <span class="literal">0x0448</span>);
-assert (*it == <span class="literal">0x65e5</span>);
-assert (--it == utf8::iterator&lt;<span class="keyword">char</span>*&gt;(threechars, threechars, threechars + <span class="literal">9</span>));
-assert (*it == <span class="literal">0x10346</span>);
-</pre>
- <p>
- The purpose of <code>utf8::iterator</code> adapter is to enable easy iteration as well as the use of STL
- algorithms with UTF-8 encoded strings. Increment and decrement operators are implemented in terms of
- <code>utf8::next()</code> and <code>utf8::prior()</code> functions.
- </p>
- <p>
- Note that <code>utf8::iterator</code> adapter is a checked iterator. It operates on the range specified in
- the constructor; any attempt to go out of that range will result in an exception. Even the comparison operators
- require both iterator object to be constructed against the same range - otherwise an exception is thrown. Typically,
- the range will be determined by sequence container functions <code>begin</code> and <code>end</code>, i.e.:
- </p>
-<pre>
-std::string s = <span class="literal">"example"</span>;
-utf8::iterator i (s.begin(), s.begin(), s.end());
-</pre>
- <h3 id="fununchecked">
- Functions From utf8::unchecked Namespace
- </h3>
- <h4>
- utf8::unchecked::append
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Encodes a 32 bit code point as a UTF-8 sequence of octets and appends the sequence
- to a UTF-8 string.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-octet_iterator append(uint32_t cp, octet_iterator result);
-
-</pre>
- <p>
- <code>cp</code>: A 32 bit integer representing a code point to append to the
- sequence.<br>
- <code>result</code>: An output iterator to the place in the sequence where to
- append the code point.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the newly appended sequence.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">unsigned char</span> u[<span class="literal">5</span>] = {<span
-class="literal">0</span>,<span class="literal">0</span>,<span class=
-"literal">0</span>,<span class="literal">0</span>,<span class="literal">0</span>};
-<span class="keyword">unsigned char</span>* end = unchecked::append(<span class=
-"literal">0x0448</span>, u);
-assert (u[<span class="literal">0</span>] == <span class=
-"literal">0xd1</span> &amp;&amp; u[<span class="literal">1</span>] == <span class=
-"literal">0x88</span> &amp;&amp; u[<span class="literal">2</span>] == <span class=
-"literal">0</span> &amp;&amp; u[<span class="literal">3</span>] == <span class=
-"literal">0</span> &amp;&amp; u[<span class="literal">4</span>] == <span class=
-"literal">0</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::append</code>. It does not
- check for validity of the supplied code point, and may produce an invalid UTF-8
- sequence.
- </p>
- <h4>
- utf8::unchecked::next
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Given the iterator to the beginning of a UTF-8 sequence, it returns the code point
- and moves the iterator to the next position.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t next(octet_iterator&amp; it);
-
-</pre>
- <p>
- <code>it</code>: a reference to an iterator pointing to the beginning of an UTF-8
- encoded code point. After the function returns, it is incremented to point to the
- beginning of the next code point.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- processed UTF-8 code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars;
-<span class="keyword">int</span> cp = unchecked::next(w);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars + <span class="literal">3</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::next</code>. It does not
- check for validity of the supplied UTF-8 sequence.
- </p>
- <h4>
- utf8::unchecked::peek_next
- </h4>
- <p class="version">
- Available in version 2.1 and later.
- </p>
- <p>
- Given the iterator to the beginning of a UTF-8 sequence, it returns the code point.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t peek_next(octet_iterator it);
-
-</pre>
- <p>
- <code>it</code>: an iterator pointing to the beginning of an UTF-8
- encoded code point.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- processed UTF-8 code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars;
-<span class="keyword">int</span> cp = unchecked::peek_next(w);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::peek_next</code>. It does not
- check for validity of the supplied UTF-8 sequence.
- </p>
- <h4>
- utf8::unchecked::prior
- </h4>
- <p class="version">
- Available in version 1.02 and later.
- </p>
- <p>
- Given a reference to an iterator pointing to an octet in a UTF-8 seqence, it
- decreases the iterator until it hits the beginning of the previous UTF-8 encoded
- code point and returns the 32 bits representation of the code point.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t prior(octet_iterator&amp; it);
-
-</pre>
- <p>
- <code>it</code>: a reference pointing to an octet within a UTF-8 encoded string.
- After the function returns, it is decremented to point to the beginning of the
- previous code point.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- previous code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars + <span class="literal">3</span>;
-<span class="keyword">int</span> cp = unchecked::prior (w);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::prior</code>. It does not
- check for validity of the supplied UTF-8 sequence and offers no boundary checking.
- </p>
- <h4>
- utf8::unchecked::previous (deprecated, see utf8::unchecked::prior)
- </h4>
- <p class="version">
- Deprecated in version 1.02 and later.
- </p>
- <p>
- Given a reference to an iterator pointing to an octet in a UTF-8 seqence, it
- decreases the iterator until it hits the beginning of the previous UTF-8 encoded
- code point and returns the 32 bits representation of the code point.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-uint32_t previous(octet_iterator&amp; it);
-
-</pre>
- <p>
- <code>it</code>: a reference pointing to an octet within a UTF-8 encoded string.
- After the function returns, it is decremented to point to the beginning of the
- previous code point.<br>
- <span class="return_value">Return value</span>: the 32 bit representation of the
- previous code point.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars + <span class="literal">3</span>;
-<span class="keyword">int</span> cp = unchecked::previous (w);
-assert (cp == <span class="literal">0x65e5</span>);
-assert (w == twochars);
-</pre>
- <p>
- The reason this function is deprecated is just the consistency with the "checked"
- versions, where <code>prior</code> should be used instead of <code>previous</code>.
- In fact, <code>unchecked::previous</code> behaves exactly the same as <code>
- unchecked::prior</code>
- </p>
- <p>
- This is a faster but less safe version of <code>utf8::previous</code>. It does not
- check for validity of the supplied UTF-8 sequence and offers no boundary checking.
- </p>
- <h4>
- utf8::unchecked::advance
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Advances an iterator by the specified number of code points within an UTF-8
- sequence.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, typename distance_type&gt;
-<span class="keyword">void</span> advance (octet_iterator&amp; it, distance_type n);
-
-</pre>
- <p>
- <code>it</code>: a reference to an iterator pointing to the beginning of an UTF-8
- encoded code point. After the function returns, it is incremented to point to the
- nth following code point.<br>
- <code>n</code>: a positive integer that shows how many code points we want to
- advance.<br>
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-<span class="keyword">char</span>* w = twochars;
-unchecked::advance (w, <span class="literal">2</span>);
-assert (w == twochars + <span class="literal">5</span>);
-</pre>
- <p>
- This function works only "forward". In case of a negative <code>n</code>, there is
- no effect.
- </p>
- <p>
- This is a faster but less safe version of <code>utf8::advance</code>. It does not
- check for validity of the supplied UTF-8 sequence and offers no boundary checking.
- </p>
- <h4>
- utf8::unchecked::distance
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Given the iterators to two UTF-8 encoded code points in a seqence, returns the
- number of code points between them.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator&gt;
-<span class=
-"keyword">typename</span> std::iterator_traits&lt;octet_iterator&gt;::difference_type distance (octet_iterator first, octet_iterator last);
-</pre>
- <p>
- <code>first</code>: an iterator to a beginning of a UTF-8 encoded code point.<br>
- <code>last</code>: an iterator to a "post-end" of the last UTF-8 encoded code
- point in the sequence we are trying to determine the length. It can be the
- beginning of a new code point, or not.<br>
- <span class="return_value">Return value</span> the distance between the iterators,
- in code points.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-size_t dist = utf8::unchecked::distance(twochars, twochars + <span class=
-"literal">5</span>);
-assert (dist == <span class="literal">2</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::distance</code>. It does not
- check for validity of the supplied UTF-8 sequence.
- </p>
- <h4>
- utf8::unchecked::utf16to8
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts a UTF-16 encoded string to UTF-8.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> u16bit_iterator, <span class=
-"keyword">typename</span> octet_iterator&gt;
-octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result);
-
-</pre>
- <p>
- <code>start</code>: an iterator pointing to the beginning of the UTF-16 encoded
- string to convert.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-16 encoded
- string to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-8 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-8 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">unsigned short</span> utf16string[] = {<span class=
-"literal">0x41</span>, <span class="literal">0x0448</span>, <span class=
-"literal">0x65e5</span>, <span class="literal">0xd834</span>, <span class=
-"literal">0xdd1e</span>};
-vector&lt;<span class="keyword">unsigned char</span>&gt; utf8result;
-unchecked::utf16to8(utf16string, utf16string + <span class=
-"literal">5</span>, back_inserter(utf8result));
-assert (utf8result.size() == <span class="literal">10</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::utf16to8</code>. It does not
- check for validity of the supplied UTF-16 sequence.
- </p>
- <h4>
- utf8::unchecked::utf8to16
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts an UTF-8 encoded string to UTF-16
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> u16bit_iterator, typename octet_iterator&gt;
-u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result);
-
-</pre>
- <p>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 encoded
- string to convert. &lt; br /&gt; <code>end</code>: an iterator pointing to
- pass-the-end of the UTF-8 encoded string to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-16 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-16 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span> utf8_with_surrogates[] = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88\xf0\x9d\x84\x9e"</span>;
-vector &lt;<span class="keyword">unsigned short</span>&gt; utf16result;
-unchecked::utf8to16(utf8_with_surrogates, utf8_with_surrogates + <span class=
-"literal">9</span>, back_inserter(utf16result));
-assert (utf16result.size() == <span class="literal">4</span>);
-assert (utf16result[<span class="literal">2</span>] == <span class=
-"literal">0xd834</span>);
-assert (utf16result[<span class="literal">3</span>] == <span class=
-"literal">0xdd1e</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::utf8to16</code>. It does not
- check for validity of the supplied UTF-8 sequence.
- </p>
- <h4>
- utf8::unchecked::utf32to8
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts a UTF-32 encoded string to UTF-8.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, <span class=
-"keyword">typename</span> u32bit_iterator&gt;
-octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result);
-
-</pre>
- <p>
- <code>start</code>: an iterator pointing to the beginning of the UTF-32 encoded
- string to convert.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-32 encoded
- string to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-8 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-8 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">int</span> utf32string[] = {<span class=
-"literal">0x448</span>, <span class="literal">0x65e5</span>, <span class=
-"literal">0x10346</span>, <span class="literal">0</span>};
-vector&lt;<span class="keyword">unsigned char</span>&gt; utf8result;
-utf32to8(utf32string, utf32string + <span class=
-"literal">3</span>, back_inserter(utf8result));
-assert (utf8result.size() == <span class="literal">9</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::utf32to8</code>. It does not
- check for validity of the supplied UTF-32 sequence.
- </p>
- <h4>
- utf8::unchecked::utf8to32
- </h4>
- <p class="version">
- Available in version 1.0 and later.
- </p>
- <p>
- Converts a UTF-8 encoded string to UTF-32.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class=
-"keyword">typename</span> octet_iterator, typename u32bit_iterator&gt;
-u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result);
-
-</pre>
- <p>
- <code>start</code>: an iterator pointing to the beginning of the UTF-8 encoded
- string to convert.<br>
- <code>end</code>: an iterator pointing to pass-the-end of the UTF-8 encoded string
- to convert.<br>
- <code>result</code>: an output iterator to the place in the UTF-32 string where to
- append the result of conversion.<br>
- <span class="return_value">Return value</span>: An iterator pointing to the place
- after the appended UTF-32 string.
- </p>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* twochars = <span class=
-"literal">"\xe6\x97\xa5\xd1\x88"</span>;
-vector&lt;<span class="keyword">int</span>&gt; utf32result;
-unchecked::utf8to32(twochars, twochars + <span class=
-"literal">5</span>, back_inserter(utf32result));
-assert (utf32result.size() == <span class="literal">2</span>);
-</pre>
- <p>
- This is a faster but less safe version of <code>utf8::utf8to32</code>. It does not
- check for validity of the supplied UTF-8 sequence.
- </p>
- <h3 id="typesunchecked">
- Types From utf8::unchecked Namespace
- </h3>
- <h4>
- utf8::iterator
- </h4>
- <p class="version">
- Available in version 2.0 and later.
- </p>
- <p>
- Adapts the underlying octet iterator to iterate over the sequence of code points,
- rather than raw octets.
- </p>
-<pre>
-<span class="keyword">template</span> &lt;<span class="keyword">typename</span> octet_iterator&gt;
-<span class="keyword">class</span> iterator;
-</pre>
-
- <h5>Member functions</h5>
- <dl>
- <dt><code>iterator();</code> <dd> the deafult constructor; the underlying <code>octet_iterator</code> is
- constructed with its default constructor.
- <dt><code><span class="keyword">explicit</span> iterator (const octet_iterator&amp; octet_it);
- </code> <dd> a constructor
- that initializes the underlying <code>octet_iterator</code> with <code>octet_it</code>
- <dt><code>octet_iterator base () <span class="keyword">const</span>;</code> <dd> returns the
- underlying <code>octet_iterator</code>.
- <dt><code>uint32_t operator * () <span class="keyword">const</span>;</code> <dd> decodes the utf-8 sequence
- the underlying <code>octet_iterator</code> is pointing to and returns the code point.
- <dt><code><span class="keyword">bool operator</span> == (const iterator&amp; rhs)
- <span class="keyword">const</span>;</code> <dd> returns <span class="keyword">true</span>
- if the two underlaying iterators are equal.
- <dt><code><span class="keyword">bool operator</span> != (const iterator&amp; rhs)
- <span class="keyword">const</span>;</code> <dd> returns <span class="keyword">true</span>
- if the two underlaying iterators are not equal.
- <dt><code>iterator&amp; <span class="keyword">operator</span> ++ (); </code> <dd> the prefix increment - moves
- the iterator to the next UTF-8 encoded code point.
- <dt><code>iterator <span class="keyword">operator</span> ++ (<span class="keyword">int</span>); </code> <dd>
- the postfix increment - moves the iterator to the next UTF-8 encoded code point and returns the current one.
- <dt><code>iterator&amp; <span class="keyword">operator</span> -- (); </code> <dd> the prefix decrement - moves
- the iterator to the previous UTF-8 encoded code point.
- <dt><code>iterator <span class="keyword">operator</span> -- (<span class="keyword">int</span>); </code> <dd>
- the postfix decrement - moves the iterator to the previous UTF-8 encoded code point and returns the current one.
- </dl>
- <p>
- Example of use:
- </p>
-<pre>
-<span class="keyword">char</span>* threechars = <span class="literal">"\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88"</span>;
-utf8::unchecked::iterator&lt;<span class="keyword">char</span>*&gt; un_it(threechars);
-utf8::unchecked::iterator&lt;<span class="keyword">char</span>*&gt; un_it2 = un_it;
-assert (un_it2 == un_it);
-assert (*un_it == <span class="literal">0x10346</span>);
-assert (*(++un_it) == <span class="literal">0x65e5</span>);
-assert ((*un_it++) == <span class="literal">0x65e5</span>);
-assert (*un_it == <span class="literal">0x0448</span>);
-assert (un_it != un_it2);
-utf8::::unchecked::iterator&lt;<span class="keyword">char</span>*&gt; un_endit (threechars + <span class="literal">9</span>);
-assert (++un_it == un_endit);
-assert (*(--un_it) == <span class="literal">0x0448</span>);
-assert ((*un_it--) == <span class="literal">0x0448</span>);
-assert (*un_it == <span class="literal">0x65e5</span>);
-assert (--un_it == utf8::unchecked::iterator&lt;<span class="keyword">char</span>*&gt;(threechars));
-assert (*un_it == <span class="literal">0x10346</span>);
-</pre>
- <p>
- This is an unchecked version of <code>utf8::iterator</code>. It is faster in many cases, but offers
- no validity or range checks.
- </p>
- <h2 id="points">
- Points of interest
- </h2>
- <h4>
- Design goals and decisions
- </h4>
- <p>
- The library was designed to be:
- </p>
- <ol>
- <li>
- Generic: for better or worse, there are many C++ string classes out there, and
- the library should work with as many of them as possible.
- </li>
- <li>
- Portable: the library should be portable both accross different platforms and
- compilers. The only non-portable code is a small section that declares unsigned
- integers of different sizes: three typedefs. They can be changed by the users of
- the library if they don't match their platform. The default setting should work
- for Windows (both 32 and 64 bit), and most 32 bit and 64 bit Unix derivatives.
- </li>
- <li>
- Lightweight: follow the "pay only for what you use" guideline.
- </li>
- <li>
- Unintrusive: avoid forcing any particular design or even programming style on the
- user. This is a library, not a framework.
- </li>
- </ol>
- <h4>
- Alternatives
- </h4>
- <p>
- In case you want to look into other means of working with UTF-8 strings from C++,
- here is the list of solutions I am aware of:
- </p>
- <ol>
- <li>
- <a href="http://icu.sourceforge.net/">ICU Library</a>. It is very powerful,
- complete, feature-rich, mature, and widely used. Also big, intrusive,
- non-generic, and doesn't play well with the Standard Library. I definitelly
- recommend looking at ICU even if you don't plan to use it.
- </li>
- <li>
- C++11 language and library features. Still far from complete, and not widely
- supported by compiler vendors.
- </li>
- <li>
- <a href=
- "http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch03s04.html">Glib::ustring</a>.
- A class specifically made to work with UTF-8 strings, and also feel like
- <code>std::string</code>. If you prefer to have yet another string class in your
- code, it may be worth a look. Be aware of the licensing issues, though.
- </li>
- <li>
- Platform dependent solutions: Windows and POSIX have functions to convert strings
- from one encoding to another. That is only a subset of what my library offers,
- but if that is all you need it may be good enough.
- </li>
- </ol>
- <h2 id="links">
- Links
- </h2>
- <ol>
- <li>
- <a href="http://www.unicode.org/">The Unicode Consortium</a>.
- </li>
- <li>
- <a href="http://icu.sourceforge.net/">ICU Library</a>.
- </li>
- <li>
- <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8 at Wikipedia</a>
- </li>
- <li>
- <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html">UTF-8 and Unicode FAQ for
- Unix/Linux</a>
- </li>
- </ol>
- </body>
-</html>
diff --git a/thirdparty/assimp/include/assimp/BaseImporter.h b/thirdparty/assimp/include/assimp/BaseImporter.h
index ad8a3dafd8..7cf8351742 100644
--- a/thirdparty/assimp/include/assimp/BaseImporter.h
+++ b/thirdparty/assimp/include/assimp/BaseImporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Bitmap.h b/thirdparty/assimp/include/assimp/Bitmap.h
index 4c3f5a437b..d0d94a6ebd 100644
--- a/thirdparty/assimp/include/assimp/Bitmap.h
+++ b/thirdparty/assimp/include/assimp/Bitmap.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/BlobIOSystem.h b/thirdparty/assimp/include/assimp/BlobIOSystem.h
index d005e5c119..30d9b1ac3c 100644
--- a/thirdparty/assimp/include/assimp/BlobIOSystem.h
+++ b/thirdparty/assimp/include/assimp/BlobIOSystem.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/ByteSwapper.h b/thirdparty/assimp/include/assimp/ByteSwapper.h
index 3f14c471a8..7af78b61ce 100644
--- a/thirdparty/assimp/include/assimp/ByteSwapper.h
+++ b/thirdparty/assimp/include/assimp/ByteSwapper.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/CreateAnimMesh.h b/thirdparty/assimp/include/assimp/CreateAnimMesh.h
index 1266d1de11..01a118ba35 100644
--- a/thirdparty/assimp/include/assimp/CreateAnimMesh.h
+++ b/thirdparty/assimp/include/assimp/CreateAnimMesh.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/DefaultIOStream.h b/thirdparty/assimp/include/assimp/DefaultIOStream.h
index c6d382c1b5..05780def7c 100644
--- a/thirdparty/assimp/include/assimp/DefaultIOStream.h
+++ b/thirdparty/assimp/include/assimp/DefaultIOStream.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/DefaultIOSystem.h b/thirdparty/assimp/include/assimp/DefaultIOSystem.h
index 46f6d447c5..75dd97e7f4 100644
--- a/thirdparty/assimp/include/assimp/DefaultIOSystem.h
+++ b/thirdparty/assimp/include/assimp/DefaultIOSystem.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/DefaultLogger.hpp b/thirdparty/assimp/include/assimp/DefaultLogger.hpp
index 1946e250a6..789072a7c1 100644
--- a/thirdparty/assimp/include/assimp/DefaultLogger.hpp
+++ b/thirdparty/assimp/include/assimp/DefaultLogger.hpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Defines.h b/thirdparty/assimp/include/assimp/Defines.h
index be3e2fafd6..959e4b1fb8 100644
--- a/thirdparty/assimp/include/assimp/Defines.h
+++ b/thirdparty/assimp/include/assimp/Defines.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2012, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/thirdparty/assimp/include/assimp/Exceptional.h b/thirdparty/assimp/include/assimp/Exceptional.h
index 6bb6ce1e39..dcd5e2b2e8 100644
--- a/thirdparty/assimp/include/assimp/Exceptional.h
+++ b/thirdparty/assimp/include/assimp/Exceptional.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2008, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -119,6 +119,16 @@ struct ExceptionSwallower<void> {
{\
try {
+#define ASSIMP_END_EXCEPTION_REGION_WITH_ERROR_STRING(type, ASSIMP_END_EXCEPTION_REGION_errorString)\
+ } catch(const DeadlyImportError& e) {\
+ ASSIMP_END_EXCEPTION_REGION_errorString = e.what();\
+ return ExceptionSwallower<type>()();\
+ } catch(...) {\
+ ASSIMP_END_EXCEPTION_REGION_errorString = "Unknown exception";\
+ return ExceptionSwallower<type>()();\
+ }\
+}
+
#define ASSIMP_END_EXCEPTION_REGION(type)\
} catch(...) {\
return ExceptionSwallower<type>()();\
diff --git a/thirdparty/assimp/include/assimp/Exporter.hpp b/thirdparty/assimp/include/assimp/Exporter.hpp
index 2612e1f9d2..dc6661c11b 100644
--- a/thirdparty/assimp/include/assimp/Exporter.hpp
+++ b/thirdparty/assimp/include/assimp/Exporter.hpp
@@ -3,9 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
-
-
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/GenericProperty.h b/thirdparty/assimp/include/assimp/GenericProperty.h
index 7796d595b8..30f4988f90 100644
--- a/thirdparty/assimp/include/assimp/GenericProperty.h
+++ b/thirdparty/assimp/include/assimp/GenericProperty.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Hash.h b/thirdparty/assimp/include/assimp/Hash.h
index 9056440789..7c360b4748 100644
--- a/thirdparty/assimp/include/assimp/Hash.h
+++ b/thirdparty/assimp/include/assimp/Hash.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/IOStream.hpp b/thirdparty/assimp/include/assimp/IOStream.hpp
index 39932cd949..c3271d007a 100644
--- a/thirdparty/assimp/include/assimp/IOStream.hpp
+++ b/thirdparty/assimp/include/assimp/IOStream.hpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/IOStreamBuffer.h b/thirdparty/assimp/include/assimp/IOStreamBuffer.h
index 97c84b23e2..6ca9be84a7 100644
--- a/thirdparty/assimp/include/assimp/IOStreamBuffer.h
+++ b/thirdparty/assimp/include/assimp/IOStreamBuffer.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/IOSystem.hpp b/thirdparty/assimp/include/assimp/IOSystem.hpp
index f1fb3b0c27..291cd938f6 100644
--- a/thirdparty/assimp/include/assimp/IOSystem.hpp
+++ b/thirdparty/assimp/include/assimp/IOSystem.hpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/Importer.hpp b/thirdparty/assimp/include/assimp/Importer.hpp
index bf449a9a25..df52471a91 100644
--- a/thirdparty/assimp/include/assimp/Importer.hpp
+++ b/thirdparty/assimp/include/assimp/Importer.hpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -285,7 +285,7 @@ public:
* The return value remains valid until the property is modified.
* @see GetPropertyInteger()
*/
- const std::string GetPropertyString(const char* szName,
+ std::string GetPropertyString(const char* szName,
const std::string& sErrorReturn = "") const;
// -------------------------------------------------------------------
@@ -294,7 +294,7 @@ public:
* The return value remains valid until the property is modified.
* @see GetPropertyInteger()
*/
- const aiMatrix4x4 GetPropertyMatrix(const char* szName,
+ aiMatrix4x4 GetPropertyMatrix(const char* szName,
const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;
// -------------------------------------------------------------------
diff --git a/thirdparty/assimp/include/assimp/LineSplitter.h b/thirdparty/assimp/include/assimp/LineSplitter.h
index 6c1097bb6d..869585d92b 100644
--- a/thirdparty/assimp/include/assimp/LineSplitter.h
+++ b/thirdparty/assimp/include/assimp/LineSplitter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -72,7 +72,7 @@ for(LineSplitter splitter(stream);splitter;++splitter) {
if (strtol(splitter[2]) > 5) { .. }
}
- std::cout << "Current line is: " << splitter.get_index() << std::endl;
+ ASSIMP_LOG_DEBUG_F("Current line is: ", splitter.get_index());
}
@endcode
*/
diff --git a/thirdparty/assimp/include/assimp/LogAux.h b/thirdparty/assimp/include/assimp/LogAux.h
index bcead78dd3..2265ff19c8 100644
--- a/thirdparty/assimp/include/assimp/LogAux.h
+++ b/thirdparty/assimp/include/assimp/LogAux.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/LogStream.hpp b/thirdparty/assimp/include/assimp/LogStream.hpp
index d0281e2d02..243f13ee64 100644
--- a/thirdparty/assimp/include/assimp/LogStream.hpp
+++ b/thirdparty/assimp/include/assimp/LogStream.hpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Logger.hpp b/thirdparty/assimp/include/assimp/Logger.hpp
index 89cade6c33..a0b798564e 100644
--- a/thirdparty/assimp/include/assimp/Logger.hpp
+++ b/thirdparty/assimp/include/assimp/Logger.hpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/MathFunctions.h b/thirdparty/assimp/include/assimp/MathFunctions.h
index b6c5872a72..1880ce0a98 100644
--- a/thirdparty/assimp/include/assimp/MathFunctions.h
+++ b/thirdparty/assimp/include/assimp/MathFunctions.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2016, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/MemoryIOWrapper.h b/thirdparty/assimp/include/assimp/MemoryIOWrapper.h
index 5598d4fc5f..2ad80cc850 100644
--- a/thirdparty/assimp/include/assimp/MemoryIOWrapper.h
+++ b/thirdparty/assimp/include/assimp/MemoryIOWrapper.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/NullLogger.hpp b/thirdparty/assimp/include/assimp/NullLogger.hpp
index c45d01bd48..7effca83a4 100644
--- a/thirdparty/assimp/include/assimp/NullLogger.hpp
+++ b/thirdparty/assimp/include/assimp/NullLogger.hpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/ParsingUtils.h b/thirdparty/assimp/include/assimp/ParsingUtils.h
index 3025601246..736952e266 100644
--- a/thirdparty/assimp/include/assimp/ParsingUtils.h
+++ b/thirdparty/assimp/include/assimp/ParsingUtils.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Profiler.h b/thirdparty/assimp/include/assimp/Profiler.h
index 624029be99..ee6c5545ff 100644
--- a/thirdparty/assimp/include/assimp/Profiler.h
+++ b/thirdparty/assimp/include/assimp/Profiler.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/ProgressHandler.hpp b/thirdparty/assimp/include/assimp/ProgressHandler.hpp
index 8991a64618..45d3f57cd1 100644
--- a/thirdparty/assimp/include/assimp/ProgressHandler.hpp
+++ b/thirdparty/assimp/include/assimp/ProgressHandler.hpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/RemoveComments.h b/thirdparty/assimp/include/assimp/RemoveComments.h
index f129420535..5bb958257f 100644
--- a/thirdparty/assimp/include/assimp/RemoveComments.h
+++ b/thirdparty/assimp/include/assimp/RemoveComments.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/SGSpatialSort.h b/thirdparty/assimp/include/assimp/SGSpatialSort.h
index fdb5ce8174..9afe38f85f 100644
--- a/thirdparty/assimp/include/assimp/SGSpatialSort.h
+++ b/thirdparty/assimp/include/assimp/SGSpatialSort.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/SceneCombiner.h b/thirdparty/assimp/include/assimp/SceneCombiner.h
index 0683c1e052..40aad08903 100644
--- a/thirdparty/assimp/include/assimp/SceneCombiner.h
+++ b/thirdparty/assimp/include/assimp/SceneCombiner.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/SkeletonMeshBuilder.h b/thirdparty/assimp/include/assimp/SkeletonMeshBuilder.h
index ad979a33fa..8e1a9830f5 100644
--- a/thirdparty/assimp/include/assimp/SkeletonMeshBuilder.h
+++ b/thirdparty/assimp/include/assimp/SkeletonMeshBuilder.h
@@ -4,7 +4,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/SmoothingGroups.h b/thirdparty/assimp/include/assimp/SmoothingGroups.h
index c1a93947f1..5d37f1bb5a 100644
--- a/thirdparty/assimp/include/assimp/SmoothingGroups.h
+++ b/thirdparty/assimp/include/assimp/SmoothingGroups.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/SmoothingGroups.inl b/thirdparty/assimp/include/assimp/SmoothingGroups.inl
index 37ea083dbe..417ca4312a 100644
--- a/thirdparty/assimp/include/assimp/SmoothingGroups.inl
+++ b/thirdparty/assimp/include/assimp/SmoothingGroups.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2012, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/SpatialSort.h b/thirdparty/assimp/include/assimp/SpatialSort.h
index 9f93543150..c2d8bbbf8d 100644
--- a/thirdparty/assimp/include/assimp/SpatialSort.h
+++ b/thirdparty/assimp/include/assimp/SpatialSort.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/StandardShapes.h b/thirdparty/assimp/include/assimp/StandardShapes.h
index c594cb63f4..79bdae8592 100644
--- a/thirdparty/assimp/include/assimp/StandardShapes.h
+++ b/thirdparty/assimp/include/assimp/StandardShapes.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/StreamReader.h b/thirdparty/assimp/include/assimp/StreamReader.h
index cb24f1595b..4cad96f6ef 100644
--- a/thirdparty/assimp/include/assimp/StreamReader.h
+++ b/thirdparty/assimp/include/assimp/StreamReader.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/StreamWriter.h b/thirdparty/assimp/include/assimp/StreamWriter.h
index 489e8adfe3..de889b9f00 100644
--- a/thirdparty/assimp/include/assimp/StreamWriter.h
+++ b/thirdparty/assimp/include/assimp/StreamWriter.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/StringComparison.h b/thirdparty/assimp/include/assimp/StringComparison.h
index d3ca3e9714..d7b8972e36 100644
--- a/thirdparty/assimp/include/assimp/StringComparison.h
+++ b/thirdparty/assimp/include/assimp/StringComparison.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/StringUtils.h b/thirdparty/assimp/include/assimp/StringUtils.h
index af481f819e..31410a9fb2 100644
--- a/thirdparty/assimp/include/assimp/StringUtils.h
+++ b/thirdparty/assimp/include/assimp/StringUtils.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Subdivision.h b/thirdparty/assimp/include/assimp/Subdivision.h
index e9450267ec..9a8bb9fd3d 100644
--- a/thirdparty/assimp/include/assimp/Subdivision.h
+++ b/thirdparty/assimp/include/assimp/Subdivision.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/TinyFormatter.h b/thirdparty/assimp/include/assimp/TinyFormatter.h
index 6227e42c52..3c6ca66c65 100644
--- a/thirdparty/assimp/include/assimp/TinyFormatter.h
+++ b/thirdparty/assimp/include/assimp/TinyFormatter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/Vertex.h b/thirdparty/assimp/include/assimp/Vertex.h
index 5e63db5fe4..5d4242cbd3 100644
--- a/thirdparty/assimp/include/assimp/Vertex.h
+++ b/thirdparty/assimp/include/assimp/Vertex.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/XMLTools.h b/thirdparty/assimp/include/assimp/XMLTools.h
index 95f12cdebf..8458513081 100644
--- a/thirdparty/assimp/include/assimp/XMLTools.h
+++ b/thirdparty/assimp/include/assimp/XMLTools.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/aabb.h b/thirdparty/assimp/include/assimp/aabb.h
index 83bb62256b..27a142c8e4 100644
--- a/thirdparty/assimp/include/assimp/aabb.h
+++ b/thirdparty/assimp/include/assimp/aabb.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/ai_assert.h b/thirdparty/assimp/include/assimp/ai_assert.h
index 2b32b01d3e..f430e4ad38 100644
--- a/thirdparty/assimp/include/assimp/ai_assert.h
+++ b/thirdparty/assimp/include/assimp/ai_assert.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/anim.h b/thirdparty/assimp/include/assimp/anim.h
index e208b11adb..a7af1034f6 100644
--- a/thirdparty/assimp/include/assimp/anim.h
+++ b/thirdparty/assimp/include/assimp/anim.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/camera.h b/thirdparty/assimp/include/assimp/camera.h
index adb749ff59..2001a9354e 100644
--- a/thirdparty/assimp/include/assimp/camera.h
+++ b/thirdparty/assimp/include/assimp/camera.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/cexport.h b/thirdparty/assimp/include/assimp/cexport.h
index cbc0253d50..959d4377ee 100644
--- a/thirdparty/assimp/include/assimp/cexport.h
+++ b/thirdparty/assimp/include/assimp/cexport.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/cfileio.h b/thirdparty/assimp/include/assimp/cfileio.h
index be90999d87..627c700ad6 100644
--- a/thirdparty/assimp/include/assimp/cfileio.h
+++ b/thirdparty/assimp/include/assimp/cfileio.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/cimport.h b/thirdparty/assimp/include/assimp/cimport.h
index 66b1c9a174..dab60584bf 100644
--- a/thirdparty/assimp/include/assimp/cimport.h
+++ b/thirdparty/assimp/include/assimp/cimport.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/color4.h b/thirdparty/assimp/include/assimp/color4.h
index fa86128f4f..505a3510ce 100644
--- a/thirdparty/assimp/include/assimp/color4.h
+++ b/thirdparty/assimp/include/assimp/color4.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/color4.inl b/thirdparty/assimp/include/assimp/color4.inl
index d4a2a98109..964b8fbf9e 100644
--- a/thirdparty/assimp/include/assimp/color4.inl
+++ b/thirdparty/assimp/include/assimp/color4.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/commonMetaData.h b/thirdparty/assimp/include/assimp/commonMetaData.h
new file mode 100644
index 0000000000..f3f7d170ae
--- /dev/null
+++ b/thirdparty/assimp/include/assimp/commonMetaData.h
@@ -0,0 +1,67 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2020, 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 commonMetaData.h
+ * @brief Defines a set of common scene metadata keys.
+ */
+#pragma once
+#ifndef AI_COMMONMETADATA_H_INC
+#define AI_COMMONMETADATA_H_INC
+
+/// Scene metadata holding the name of the importer which loaded the source asset.
+/// This is always present if the scene was created from an imported asset.
+#define AI_METADATA_SOURCE_FORMAT "SourceAsset_Format"
+
+/// Scene metadata holding the version of the source asset as a string, if available.
+/// Not all formats add this metadata.
+#define AI_METADATA_SOURCE_FORMAT_VERSION "SourceAsset_FormatVersion"
+
+/// Scene metadata holding the name of the software which generated the source asset, if available.
+/// Not all formats add this metadata.
+#define AI_METADATA_SOURCE_GENERATOR "SourceAsset_Generator"
+
+/// Scene metadata holding the source asset copyright statement, if available.
+/// Not all formats add this metadata.
+#define AI_METADATA_SOURCE_COPYRIGHT "SourceAsset_Copyright"
+
+#endif
diff --git a/thirdparty/assimp/assimp/config.h b/thirdparty/assimp/include/assimp/config.h
index d0e4817349..ae487e7d24 100644
--- a/thirdparty/assimp/assimp/config.h
+++ b/thirdparty/assimp/include/assimp/config.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2018, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -60,6 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_CONFIG_H_INC
#define AI_CONFIG_H_INC
+
// ###########################################################################
// LIBRARY SETTINGS
// General, global settings
@@ -75,8 +76,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Property type: bool. Default value: false.
*/
-#define AI_CONFIG_GLOB_MEASURE_TIME \
- "GLOB_MEASURE_TIME"
+#define AI_CONFIG_GLOB_MEASURE_TIME \
+ "GLOB_MEASURE_TIME"
+
// ---------------------------------------------------------------------------
/** @brief Global setting to disable generation of skeleton dummy meshes
@@ -87,9 +89,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// ---------------------------------------------------------------------------
#define AI_CONFIG_IMPORT_NO_SKELETON_MESHES \
- "IMPORT_NO_SKELETON_MESHES"
+ "IMPORT_NO_SKELETON_MESHES"
+
-#if 0 // not implemented yet
+
+# if 0 // not implemented yet
// ---------------------------------------------------------------------------
/** @brief Set Assimp's multithreading policy.
*
@@ -105,8 +109,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* For more information, see the @link threading Threading page@endlink.
* Property type: int, default value: -1.
*/
-#define AI_CONFIG_GLOB_MULTITHREADING \
- "GLOB_MULTITHREADING"
+#define AI_CONFIG_GLOB_MULTITHREADING \
+ "GLOB_MULTITHREADING"
#endif
// ###########################################################################
@@ -114,6 +118,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Various stuff to fine-tune the behavior of a specific post processing step.
// ###########################################################################
+
// ---------------------------------------------------------------------------
/** @brief Maximum bone count per mesh for the SplitbyBoneCount step.
*
@@ -124,13 +129,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// ---------------------------------------------------------------------------
#define AI_CONFIG_PP_SBBC_MAX_BONES \
- "PP_SBBC_MAX_BONES"
+ "PP_SBBC_MAX_BONES"
+
// default limit for bone count
#if (!defined AI_SBBC_DEFAULT_MAX_BONES)
-#define AI_SBBC_DEFAULT_MAX_BONES 60
+# define AI_SBBC_DEFAULT_MAX_BONES 60
#endif
+
// ---------------------------------------------------------------------------
/** @brief Specifies the maximum angle that may be between two vertex tangents
* that their tangents and bi-tangents are smoothed.
@@ -140,7 +147,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Property type: float. Default value: 45 degrees
*/
#define AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE \
- "PP_CT_MAX_SMOOTHING_ANGLE"
+ "PP_CT_MAX_SMOOTHING_ANGLE"
// ---------------------------------------------------------------------------
/** @brief Source UV channel for tangent space computation.
@@ -150,7 +157,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// ---------------------------------------------------------------------------
#define AI_CONFIG_PP_CT_TEXTURE_CHANNEL_INDEX \
- "PP_CT_TEXTURE_CHANNEL_INDEX"
+ "PP_CT_TEXTURE_CHANNEL_INDEX"
// ---------------------------------------------------------------------------
/** @brief Specifies the maximum angle that may be between two face normals
@@ -165,7 +172,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* the output quality may be reduced.
*/
#define AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE \
- "PP_GSN_MAX_SMOOTHING_ANGLE"
+ "PP_GSN_MAX_SMOOTHING_ANGLE"
+
// ---------------------------------------------------------------------------
/** @brief Sets the colormap (= palette) to be used to decode embedded
@@ -177,8 +185,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* a default palette (from Quake 1) is used.
* Property type: string.
*/
-#define AI_CONFIG_IMPORT_MDL_COLORMAP \
- "IMPORT_MDL_COLORMAP"
+#define AI_CONFIG_IMPORT_MDL_COLORMAP \
+ "IMPORT_MDL_COLORMAP"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_RemoveRedundantMaterials step to
@@ -199,8 +207,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @note Linefeeds, tabs or carriage returns are treated as whitespace.
* Material names are case sensitive.
*/
-#define AI_CONFIG_PP_RRM_EXCLUDE_LIST \
- "PP_RRM_EXCLUDE_LIST"
+#define AI_CONFIG_PP_RRM_EXCLUDE_LIST \
+ "PP_RRM_EXCLUDE_LIST"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_PreTransformVertices step to
@@ -214,8 +222,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* any transformations.
* Property type: bool. Default value: false.
*/
-#define AI_CONFIG_PP_PTV_KEEP_HIERARCHY \
- "PP_PTV_KEEP_HIERARCHY"
+#define AI_CONFIG_PP_PTV_KEEP_HIERARCHY \
+ "PP_PTV_KEEP_HIERARCHY"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_PreTransformVertices step to normalize
@@ -224,8 +232,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* meshes are scaled appropriately (uniformly of course!).
* This might be useful if you don't know the spatial dimension of the input
* data*/
-#define AI_CONFIG_PP_PTV_NORMALIZE \
- "PP_PTV_NORMALIZE"
+#define AI_CONFIG_PP_PTV_NORMALIZE \
+ "PP_PTV_NORMALIZE"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_PreTransformVertices step to use
@@ -233,8 +241,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* transforming vertices.
* Property type: bool. Default value: false.
*/
-#define AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION \
- "PP_PTV_ADD_ROOT_TRANSFORMATION"
+#define AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION \
+ "PP_PTV_ADD_ROOT_TRANSFORMATION"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_PreTransformVertices step to use
@@ -243,8 +251,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* of the transformation matrix.
* Property type: aiMatrix4x4.
*/
-#define AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION \
- "PP_PTV_ROOT_TRANSFORMATION"
+#define AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION \
+ "PP_PTV_ROOT_TRANSFORMATION"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_FindDegenerates step to
@@ -257,7 +265,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Property type: bool. Default value: false.
*/
#define AI_CONFIG_PP_FD_REMOVE \
- "PP_FD_REMOVE"
+ "PP_FD_REMOVE"
// ---------------------------------------------------------------------------
/**
@@ -266,7 +274,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* be removed if #AI_CONFIG_PP_FD_REMOVE is set to true.
*/
#define AI_CONFIG_PP_FD_CHECKAREA \
- "PP_FD_CHECKAREA"
+ "PP_FD_CHECKAREA"
// ---------------------------------------------------------------------------
/** @brief Configures the #aiProcess_OptimizeGraph step to preserve nodes
@@ -286,8 +294,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @note Linefeeds, tabs or carriage returns are treated as whitespace.
* Node names are case sensitive.
*/
-#define AI_CONFIG_PP_OG_EXCLUDE_LIST \
- "PP_OG_EXCLUDE_LIST"
+#define AI_CONFIG_PP_OG_EXCLUDE_LIST \
+ "PP_OG_EXCLUDE_LIST"
// ---------------------------------------------------------------------------
/** @brief Set the maximum number of triangles in a mesh.
@@ -298,11 +306,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Property type: integer.
*/
#define AI_CONFIG_PP_SLM_TRIANGLE_LIMIT \
- "PP_SLM_TRIANGLE_LIMIT"
+ "PP_SLM_TRIANGLE_LIMIT"
// default value for AI_CONFIG_PP_SLM_TRIANGLE_LIMIT
#if (!defined AI_SLM_DEFAULT_MAX_TRIANGLES)
-#define AI_SLM_DEFAULT_MAX_TRIANGLES 1000000
+# define AI_SLM_DEFAULT_MAX_TRIANGLES 1000000
#endif
// ---------------------------------------------------------------------------
@@ -314,11 +322,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Property type: integer.
*/
#define AI_CONFIG_PP_SLM_VERTEX_LIMIT \
- "PP_SLM_VERTEX_LIMIT"
+ "PP_SLM_VERTEX_LIMIT"
// default value for AI_CONFIG_PP_SLM_VERTEX_LIMIT
#if (!defined AI_SLM_DEFAULT_MAX_VERTICES)
-#define AI_SLM_DEFAULT_MAX_VERTICES 1000000
+# define AI_SLM_DEFAULT_MAX_VERTICES 1000000
#endif
// ---------------------------------------------------------------------------
@@ -327,12 +335,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This is used by the #aiProcess_LimitBoneWeights PostProcess-Step.
* @note The default value is AI_LMW_MAX_WEIGHTS
* Property type: integer.*/
-#define AI_CONFIG_PP_LBW_MAX_WEIGHTS \
- "PP_LBW_MAX_WEIGHTS"
+#define AI_CONFIG_PP_LBW_MAX_WEIGHTS \
+ "PP_LBW_MAX_WEIGHTS"
// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS
#if (!defined AI_LMW_MAX_WEIGHTS)
-#define AI_LMW_MAX_WEIGHTS 0x4
+# define AI_LMW_MAX_WEIGHTS 0x4
#endif // !! AI_LMW_MAX_WEIGHTS
// ---------------------------------------------------------------------------
@@ -342,11 +350,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @note The default value is AI_DEBONE_THRESHOLD
* Property type: float.*/
#define AI_CONFIG_PP_DB_THRESHOLD \
- "PP_DB_THRESHOLD"
+ "PP_DB_THRESHOLD"
// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS
#if (!defined AI_DEBONE_THRESHOLD)
-#define AI_DEBONE_THRESHOLD 1.0f
+# define AI_DEBONE_THRESHOLD 1.0f
#endif // !! AI_DEBONE_THRESHOLD
// ---------------------------------------------------------------------------
@@ -356,12 +364,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @note The default value is 0
* Property type: bool.*/
#define AI_CONFIG_PP_DB_ALL_OR_NONE \
- "PP_DB_ALL_OR_NONE"
+ "PP_DB_ALL_OR_NONE"
/** @brief Default value for the #AI_CONFIG_PP_ICL_PTCACHE_SIZE property
*/
#ifndef PP_ICL_PTCACHE_SIZE
-#define PP_ICL_PTCACHE_SIZE 12
+# define PP_ICL_PTCACHE_SIZE 12
#endif
// ---------------------------------------------------------------------------
@@ -375,7 +383,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* performance improvements for most nVidia/AMD cards since 2002.
* Property type: integer.
*/
-#define AI_CONFIG_PP_ICL_PTCACHE_SIZE "PP_ICL_PTCACHE_SIZE"
+#define AI_CONFIG_PP_ICL_PTCACHE_SIZE "PP_ICL_PTCACHE_SIZE"
// ---------------------------------------------------------------------------
/** @brief Enumerates components of the aiScene and aiMesh data structures
@@ -383,71 +391,73 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* See the documentation to #aiProcess_RemoveComponent for more details.
*/
-enum aiComponent {
-/** Normal vectors */
+enum aiComponent
+{
+ /** Normal vectors */
#ifdef SWIG
aiComponent_NORMALS = 0x2,
#else
- aiComponent_NORMALS = 0x2u,
+ aiComponent_NORMALS = 0x2u,
#endif
-/** Tangents and bitangents go always together ... */
+ /** Tangents and bitangents go always together ... */
#ifdef SWIG
aiComponent_TANGENTS_AND_BITANGENTS = 0x4,
#else
- aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,
+ aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,
#endif
- /** ALL color sets
+ /** ALL color sets
* Use aiComponent_COLORn(N) to specify the N'th set */
- aiComponent_COLORS = 0x8,
+ aiComponent_COLORS = 0x8,
- /** ALL texture UV sets
+ /** ALL texture UV sets
* aiComponent_TEXCOORDn(N) to specify the N'th set */
- aiComponent_TEXCOORDS = 0x10,
+ aiComponent_TEXCOORDS = 0x10,
- /** Removes all bone weights from all meshes.
+ /** Removes all bone weights from all meshes.
* The scenegraph nodes corresponding to the bones are NOT removed.
* use the #aiProcess_OptimizeGraph step to do this */
- aiComponent_BONEWEIGHTS = 0x20,
+ aiComponent_BONEWEIGHTS = 0x20,
- /** Removes all node animations (aiScene::mAnimations).
+ /** Removes all node animations (aiScene::mAnimations).
* The corresponding scenegraph nodes are NOT removed.
* use the #aiProcess_OptimizeGraph step to do this */
- aiComponent_ANIMATIONS = 0x40,
+ aiComponent_ANIMATIONS = 0x40,
- /** Removes all embedded textures (aiScene::mTextures) */
- aiComponent_TEXTURES = 0x80,
+ /** Removes all embedded textures (aiScene::mTextures) */
+ aiComponent_TEXTURES = 0x80,
- /** Removes all light sources (aiScene::mLights).
+ /** Removes all light sources (aiScene::mLights).
* The corresponding scenegraph nodes are NOT removed.
* use the #aiProcess_OptimizeGraph step to do this */
- aiComponent_LIGHTS = 0x100,
+ aiComponent_LIGHTS = 0x100,
- /** Removes all cameras (aiScene::mCameras).
+ /** Removes all cameras (aiScene::mCameras).
* The corresponding scenegraph nodes are NOT removed.
* use the #aiProcess_OptimizeGraph step to do this */
- aiComponent_CAMERAS = 0x200,
+ aiComponent_CAMERAS = 0x200,
- /** Removes all meshes (aiScene::mMeshes). */
- aiComponent_MESHES = 0x400,
+ /** Removes all meshes (aiScene::mMeshes). */
+ aiComponent_MESHES = 0x400,
- /** Removes all materials. One default material will
+ /** Removes all materials. One default material will
* be generated, so aiScene::mNumMaterials will be 1. */
- aiComponent_MATERIALS = 0x800,
+ aiComponent_MATERIALS = 0x800,
+
-/** This value is not used. It is just there to force the
+ /** This value is not used. It is just there to force the
* compiler to map this enum to a 32 Bit integer. */
#ifndef SWIG
- _aiComponent_Force32Bit = 0x9fffffff
+ _aiComponent_Force32Bit = 0x9fffffff
#endif
};
// Remove a specific color channel 'n'
-#define aiComponent_COLORSn(n) (1u << (n + 20u))
+#define aiComponent_COLORSn(n) (1u << (n+20u))
// Remove a specific UV channel 'n'
-#define aiComponent_TEXCOORDSn(n) (1u << (n + 25u))
+#define aiComponent_TEXCOORDSn(n) (1u << (n+25u))
// ---------------------------------------------------------------------------
/** @brief Input parameter to the #aiProcess_RemoveComponent step:
@@ -461,8 +471,8 @@ enum aiComponent {
* of the flags defined above) the import FAILS. Mainly because there is
* no data to work on anymore ...
*/
-#define AI_CONFIG_PP_RVC_FLAGS \
- "PP_RVC_FLAGS"
+#define AI_CONFIG_PP_RVC_FLAGS \
+ "PP_RVC_FLAGS"
// ---------------------------------------------------------------------------
/** @brief Input parameter to the #aiProcess_SortByPType step:
@@ -473,8 +483,8 @@ enum aiComponent {
* be to exclude all line and point meshes from the import. This
* is an integer property, its default value is 0.
*/
-#define AI_CONFIG_PP_SBP_REMOVE \
- "PP_SBP_REMOVE"
+#define AI_CONFIG_PP_SBP_REMOVE \
+ "PP_SBP_REMOVE"
// ---------------------------------------------------------------------------
/** @brief Input parameter to the #aiProcess_FindInvalidData step:
@@ -485,8 +495,16 @@ enum aiComponent {
* abs(n0-n1)>epsilon holds true for all vector respectively quaternion
* components. The default value is 0.f - comparisons are exact then.
*/
-#define AI_CONFIG_PP_FID_ANIM_ACCURACY \
- "PP_FID_ANIM_ACCURACY"
+#define AI_CONFIG_PP_FID_ANIM_ACCURACY \
+ "PP_FID_ANIM_ACCURACY"
+
+// ---------------------------------------------------------------------------
+/** @brief Input parameter to the #aiProcess_FindInvalidData step:
+ * Set to true to ignore texture coordinates. This may be useful if you have
+ * to assign different kind of textures like one for the summer or one for the winter.
+ */
+#define AI_CONFIG_PP_FID_IGNORE_TEXTURECOORDS \
+ "PP_FID_IGNORE_TEXTURECOORDS"
// TransformUVCoords evaluates UV scalings
#define AI_UVTRAFO_SCALING 0x1
@@ -501,14 +519,6 @@ enum aiComponent {
#define AI_UVTRAFO_ALL (AI_UVTRAFO_SCALING | AI_UVTRAFO_ROTATION | AI_UVTRAFO_TRANSLATION)
// ---------------------------------------------------------------------------
-/** @brief Input parameter to the #aiProcess_FindInvalidData step:
- * Set to true to ignore texture coordinates. This may be useful if you have
- * to assign different kind of textures like one for the summer or one for the winter.
- */
-#define AI_CONFIG_PP_FID_IGNORE_TEXTURECOORDS \
- "PP_FID_IGNORE_TEXTURECOORDS"
-
-// ---------------------------------------------------------------------------
/** @brief Input parameter to the #aiProcess_TransformUVCoords step:
* Specifies which UV transformations are evaluated.
*
@@ -516,8 +526,8 @@ enum aiComponent {
* property, of course). By default all transformations are enabled
* (AI_UVTRAFO_ALL).
*/
-#define AI_CONFIG_PP_TUV_EVALUATE \
- "PP_TUV_EVALUATE"
+#define AI_CONFIG_PP_TUV_EVALUATE \
+ "PP_TUV_EVALUATE"
// ---------------------------------------------------------------------------
/** @brief A hint to assimp to favour speed against import quality.
@@ -528,14 +538,16 @@ enum aiComponent {
* This property is expected to be an integer, != 0 stands for true.
* The default value is 0.
*/
-#define AI_CONFIG_FAVOUR_SPEED \
- "FAVOUR_SPEED"
+#define AI_CONFIG_FAVOUR_SPEED \
+ "FAVOUR_SPEED"
+
// ###########################################################################
// IMPORTER SETTINGS
// Various stuff to fine-tune the behaviour of specific importer plugins.
// ###########################################################################
+
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will merge all geometry layers present
* in the source file or take only the first.
@@ -544,7 +556,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS \
- "IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS"
+ "IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will read all materials present in the
@@ -556,7 +568,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_ALL_MATERIALS \
- "IMPORT_FBX_READ_ALL_MATERIALS"
+ "IMPORT_FBX_READ_ALL_MATERIALS"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will read materials.
@@ -565,7 +577,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_MATERIALS \
- "IMPORT_FBX_READ_MATERIALS"
+ "IMPORT_FBX_READ_MATERIALS"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will read embedded textures.
@@ -574,7 +586,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_TEXTURES \
- "IMPORT_FBX_READ_TEXTURES"
+ "IMPORT_FBX_READ_TEXTURES"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will read cameras.
@@ -583,7 +595,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_CAMERAS \
- "IMPORT_FBX_READ_CAMERAS"
+ "IMPORT_FBX_READ_CAMERAS"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will read light sources.
@@ -592,7 +604,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_LIGHTS \
- "IMPORT_FBX_READ_LIGHTS"
+ "IMPORT_FBX_READ_LIGHTS"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will read animations.
@@ -601,7 +613,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_READ_ANIMATIONS \
- "IMPORT_FBX_READ_ANIMATIONS"
+ "IMPORT_FBX_READ_ANIMATIONS"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will act in strict mode in which only
@@ -613,7 +625,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_STRICT_MODE \
- "IMPORT_FBX_STRICT_MODE"
+ "IMPORT_FBX_STRICT_MODE"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will preserve pivot points for
@@ -624,7 +636,7 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS \
- "IMPORT_FBX_PRESERVE_PIVOTS"
+ "IMPORT_FBX_PRESERVE_PIVOTS"
// ---------------------------------------------------------------------------
/** @brief Specifies whether the importer will drop empty animation curves or
@@ -635,26 +647,26 @@ enum aiComponent {
* Property type: bool
*/
#define AI_CONFIG_IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES \
- "IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES"
+ "IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES"
// ---------------------------------------------------------------------------
/** @brief Set whether the fbx importer will use the legacy embedded texture naming.
-*
-* The default value is false (0)
-* Property type: bool
-*/
+ *
+ * The default value is false (0)
+ * Property type: bool
+ */
#define AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING \
"AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING"
// ---------------------------------------------------------------------------
-/** @brief Set wether the FBX importer shall not remove empty bones.
- *
+/** @brief Set wether the importer shall not remove empty bones.
*
* Empty bone are often used to define connections for other models.
*/
#define AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES \
"AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES"
+
// ---------------------------------------------------------------------------
/** @brief Set wether the FBX importer shall convert the unit from cm to m.
*/
@@ -674,14 +686,81 @@ enum aiComponent {
* want to override the global setting).
* Property type: integer.
*/
-#define AI_CONFIG_IMPORT_GLOBAL_KEYFRAME "IMPORT_GLOBAL_KEYFRAME"
+#define AI_CONFIG_IMPORT_GLOBAL_KEYFRAME "IMPORT_GLOBAL_KEYFRAME"
+
+#define AI_CONFIG_IMPORT_MD3_KEYFRAME "IMPORT_MD3_KEYFRAME"
+#define AI_CONFIG_IMPORT_MD2_KEYFRAME "IMPORT_MD2_KEYFRAME"
+#define AI_CONFIG_IMPORT_MDL_KEYFRAME "IMPORT_MDL_KEYFRAME"
+#define AI_CONFIG_IMPORT_MDC_KEYFRAME "IMPORT_MDC_KEYFRAME"
+#define AI_CONFIG_IMPORT_SMD_KEYFRAME "IMPORT_SMD_KEYFRAME"
+#define AI_CONFIG_IMPORT_UNREAL_KEYFRAME "IMPORT_UNREAL_KEYFRAME"
-#define AI_CONFIG_IMPORT_MD3_KEYFRAME "IMPORT_MD3_KEYFRAME"
-#define AI_CONFIG_IMPORT_MD2_KEYFRAME "IMPORT_MD2_KEYFRAME"
-#define AI_CONFIG_IMPORT_MDL_KEYFRAME "IMPORT_MDL_KEYFRAME"
-#define AI_CONFIG_IMPORT_MDC_KEYFRAME "IMPORT_MDC_KEYFRAME"
-#define AI_CONFIG_IMPORT_SMD_KEYFRAME "IMPORT_SMD_KEYFRAME"
-#define AI_CONFIG_IMPORT_UNREAL_KEYFRAME "IMPORT_UNREAL_KEYFRAME"
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read animations.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS "IMPORT_MDL_HL1_READ_ANIMATIONS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read animation events.
+ * \note This property requires AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS to be set to true.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATION_EVENTS "IMPORT_MDL_HL1_READ_ANIMATION_EVENTS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read blend controllers.
+ * \note This property requires AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS to be set to true.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_BLEND_CONTROLLERS "IMPORT_MDL_HL1_READ_BLEND_CONTROLLERS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read sequence transition graph.
+ * \note This property requires AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS to be set to true.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_SEQUENCE_TRANSITIONS "IMPORT_MDL_HL1_READ_SEQUENCE_TRANSITIONS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read attachments info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_ATTACHMENTS "IMPORT_MDL_HL1_READ_ATTACHMENTS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read bone controllers info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_BONE_CONTROLLERS "IMPORT_MDL_HL1_READ_BONE_CONTROLLERS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read hitboxes info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_HITBOXES "IMPORT_MDL_HL1_READ_HITBOXES"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read miscellaneous global model info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_MISC_GLOBAL_INFO "IMPORT_MDL_HL1_READ_MISC_GLOBAL_INFO"
// ---------------------------------------------------------------------------
/** Smd load multiple animations
@@ -697,7 +776,7 @@ enum aiComponent {
* Property type: bool. Default value: true.
*/
#define AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL \
- "IMPORT_AC_SEPARATE_BFCULL"
+ "IMPORT_AC_SEPARATE_BFCULL"
// ---------------------------------------------------------------------------
/** @brief Configures whether the AC loader evaluates subdivision surfaces (
@@ -707,8 +786,8 @@ enum aiComponent {
*
* * Property type: bool. Default value: true.
*/
-#define AI_CONFIG_IMPORT_AC_EVAL_SUBDIVISION \
- "IMPORT_AC_EVAL_SUBDIVISION"
+#define AI_CONFIG_IMPORT_AC_EVAL_SUBDIVISION \
+ "IMPORT_AC_EVAL_SUBDIVISION"
// ---------------------------------------------------------------------------
/** @brief Configures the UNREAL 3D loader to separate faces with different
@@ -717,7 +796,7 @@ enum aiComponent {
* * Property type: bool. Default value: true.
*/
#define AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS \
- "UNREAL_HANDLE_FLAGS"
+ "UNREAL_HANDLE_FLAGS"
// ---------------------------------------------------------------------------
/** @brief Configures the terragen import plugin to compute uv's for
@@ -730,7 +809,7 @@ enum aiComponent {
* * Property type: bool. Default value: false.
*/
#define AI_CONFIG_IMPORT_TER_MAKE_UVS \
- "IMPORT_TER_MAKE_UVS"
+ "IMPORT_TER_MAKE_UVS"
// ---------------------------------------------------------------------------
/** @brief Configures the ASE loader to always reconstruct normal vectors
@@ -739,8 +818,8 @@ enum aiComponent {
* Some ASE files have carry invalid normals, other don't.
* * Property type: bool. Default value: true.
*/
-#define AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS \
- "IMPORT_ASE_RECONSTRUCT_NORMALS"
+#define AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS \
+ "IMPORT_ASE_RECONSTRUCT_NORMALS"
// ---------------------------------------------------------------------------
/** @brief Configures the M3D loader to detect and process multi-part
@@ -752,7 +831,7 @@ enum aiComponent {
* Property type: bool. Default value: true.
*/
#define AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART \
- "IMPORT_MD3_HANDLE_MULTIPART"
+ "IMPORT_MD3_HANDLE_MULTIPART"
// ---------------------------------------------------------------------------
/** @brief Tells the MD3 loader which skin files to load.
@@ -764,7 +843,7 @@ enum aiComponent {
* Property type: String. Default value: "default".
*/
#define AI_CONFIG_IMPORT_MD3_SKIN_NAME \
- "IMPORT_MD3_SKIN_NAME"
+ "IMPORT_MD3_SKIN_NAME"
// ---------------------------------------------------------------------------
/** @brief Specify the Quake 3 shader file to be used for a particular
@@ -782,7 +861,7 @@ enum aiComponent {
* Property type: String. Default value: n/a.
*/
#define AI_CONFIG_IMPORT_MD3_SHADER_SRC \
- "IMPORT_MD3_SHADER_SRC"
+ "IMPORT_MD3_SHADER_SRC"
// ---------------------------------------------------------------------------
/** @brief Configures the LWO loader to load just one layer from the model.
@@ -795,8 +874,8 @@ enum aiComponent {
* layer name may not be empty.<br>
* Property type: Integer. Default value: all layers are loaded.
*/
-#define AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY \
- "IMPORT_LWO_ONE_LAYER_ONLY"
+#define AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY \
+ "IMPORT_LWO_ONE_LAYER_ONLY"
// ---------------------------------------------------------------------------
/** @brief Configures the MD5 loader to not load the MD5ANIM file for
@@ -809,8 +888,8 @@ enum aiComponent {
*
* * Property type: bool. Default value: false.
*/
-#define AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD \
- "IMPORT_MD5_NO_ANIM_AUTOLOAD"
+#define AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD \
+ "IMPORT_MD5_NO_ANIM_AUTOLOAD"
// ---------------------------------------------------------------------------
/** @brief Defines the begin of the time range for which the LWS loader
@@ -828,10 +907,10 @@ enum aiComponent {
*
* @see AI_CONFIG_IMPORT_LWS_ANIM_END - end of the imported time range
*/
-#define AI_CONFIG_IMPORT_LWS_ANIM_START \
- "IMPORT_LWS_ANIM_START"
-#define AI_CONFIG_IMPORT_LWS_ANIM_END \
- "IMPORT_LWS_ANIM_END"
+#define AI_CONFIG_IMPORT_LWS_ANIM_START \
+ "IMPORT_LWS_ANIM_START"
+#define AI_CONFIG_IMPORT_LWS_ANIM_END \
+ "IMPORT_LWS_ANIM_END"
// ---------------------------------------------------------------------------
/** @brief Defines the output frame rate of the IRR loader.
@@ -841,8 +920,8 @@ enum aiComponent {
* are returned by the converter.<br>
* Property type: integer. Default value: 100
*/
-#define AI_CONFIG_IMPORT_IRR_ANIM_FPS \
- "IMPORT_IRR_ANIM_FPS"
+#define AI_CONFIG_IMPORT_IRR_ANIM_FPS \
+ "IMPORT_IRR_ANIM_FPS"
// ---------------------------------------------------------------------------
/** @brief Ogre Importer will try to find referenced materials from this file.
@@ -855,7 +934,7 @@ enum aiComponent {
* Property type: String. Default value: Scene.material.
*/
#define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE \
- "IMPORT_OGRE_MATERIAL_FILE"
+ "IMPORT_OGRE_MATERIAL_FILE"
// ---------------------------------------------------------------------------
/** @brief Ogre Importer detect the texture usage from its filename.
@@ -875,15 +954,15 @@ enum aiComponent {
* Property type: Bool. Default value: false.
*/
#define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME \
- "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME"
+ "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME"
-/** @brief Specifies whether the Android JNI asset extraction is supported.
+ /** @brief Specifies whether the Android JNI asset extraction is supported.
*
* Turn on this option if you want to manage assets in native
* Android application without having to keep the internal directory and asset
* manager pointer.
*/
-#define AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT "AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT"
+ #define AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT "AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT"
// ---------------------------------------------------------------------------
/** @brief Specifies whether the IFC loader skips over IfcSpace elements.
@@ -922,7 +1001,7 @@ enum aiComponent {
// default value for AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE
#if (!defined AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE)
-#define AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE 10.0f
+# define AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE 10.0f
#endif
// ---------------------------------------------------------------------------
@@ -938,7 +1017,7 @@ enum aiComponent {
// default value for AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION
#if (!defined AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION)
-#define AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION 32
+# define AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION 32
#endif
// ---------------------------------------------------------------------------
@@ -969,8 +1048,12 @@ enum aiComponent {
#define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT"
-/**
- *
+/** @brief Specifies whether the assimp export shall be able to export point clouds
+ *
+ * When this flag is not defined the render data has to contain valid faces.
+ * Point clouds are only a collection of vertices which have nor spatial organization
+ * by a face and the validation process will remove them. Enabling this feature will
+ * switch off the flag and enable the functionality to export pure point clouds.
*/
#define AI_CONFIG_EXPORT_POINT_CLOUDS "EXPORT_POINT_CLOUDS"
@@ -980,7 +1063,7 @@ enum aiComponent {
#define AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY "GLOBAL_SCALE_FACTOR"
#if (!defined AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT)
-#define AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT 1.0f
+# define AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT 1.0f
#endif // !! AI_DEBONE_THRESHOLD
#define AI_CONFIG_APP_SCALE_KEY "APP_SCALE_FACTOR"
@@ -997,7 +1080,6 @@ enum aiComponent {
* Property type: Bool. Default value: undefined.
*/
-/* #cmakedefine ASSIMP_DOUBLE_PRECISION 1 */
+/* #undef ASSIMP_DOUBLE_PRECISION */
#endif // !! AI_CONFIG_H_INC
-
diff --git a/thirdparty/assimp/include/assimp/config.h.in b/thirdparty/assimp/include/assimp/config.h.in
index 3a6379bf40..e2f2a38880 100644
--- a/thirdparty/assimp/include/assimp/config.h.in
+++ b/thirdparty/assimp/include/assimp/config.h.in
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2018, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -696,6 +696,73 @@ enum aiComponent
#define AI_CONFIG_IMPORT_UNREAL_KEYFRAME "IMPORT_UNREAL_KEYFRAME"
// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read animations.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS "IMPORT_MDL_HL1_READ_ANIMATIONS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read animation events.
+ * \note This property requires AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS to be set to true.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATION_EVENTS "IMPORT_MDL_HL1_READ_ANIMATION_EVENTS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read blend controllers.
+ * \note This property requires AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS to be set to true.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_BLEND_CONTROLLERS "IMPORT_MDL_HL1_READ_BLEND_CONTROLLERS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read sequence transition graph.
+ * \note This property requires AI_CONFIG_IMPORT_MDL_HL1_READ_ANIMATIONS to be set to true.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_SEQUENCE_TRANSITIONS "IMPORT_MDL_HL1_READ_SEQUENCE_TRANSITIONS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read attachments info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_ATTACHMENTS "IMPORT_MDL_HL1_READ_ATTACHMENTS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read bone controllers info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_BONE_CONTROLLERS "IMPORT_MDL_HL1_READ_BONE_CONTROLLERS"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read hitboxes info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_HITBOXES "IMPORT_MDL_HL1_READ_HITBOXES"
+
+// ---------------------------------------------------------------------------
+/** @brief Set whether the MDL (HL1) importer will read miscellaneous global model info.
+ *
+ * The default value is true (1)
+ * Property type: bool
+ */
+#define AI_CONFIG_IMPORT_MDL_HL1_READ_MISC_GLOBAL_INFO "IMPORT_MDL_HL1_READ_MISC_GLOBAL_INFO"
+
+// ---------------------------------------------------------------------------
/** Smd load multiple animations
*
* Property type: bool. Default value: true.
diff --git a/thirdparty/assimp/include/assimp/defs.h b/thirdparty/assimp/include/assimp/defs.h
index 6f2f8ae88b..8e300e9684 100644
--- a/thirdparty/assimp/include/assimp/defs.h
+++ b/thirdparty/assimp/include/assimp/defs.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -306,7 +306,11 @@ static const ai_real ai_epsilon = (ai_real) 0.00001;
#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
#ifndef _MSC_VER
-# define AI_NO_EXCEPT noexcept
+# if __cplusplus >= 201103L // C++11
+# define AI_NO_EXCEPT noexcept
+# else
+# define AI_NO_EXCEPT
+# endif
#else
# if (_MSC_VER >= 1915 )
# define AI_NO_EXCEPT noexcept
diff --git a/thirdparty/assimp/include/assimp/importerdesc.h b/thirdparty/assimp/include/assimp/importerdesc.h
index 0a6919c1ae..e0f22a9d64 100644
--- a/thirdparty/assimp/include/assimp/importerdesc.h
+++ b/thirdparty/assimp/include/assimp/importerdesc.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/light.h b/thirdparty/assimp/include/assimp/light.h
index bdb2368c4f..84f2f7d0ab 100644
--- a/thirdparty/assimp/include/assimp/light.h
+++ b/thirdparty/assimp/include/assimp/light.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/material.h b/thirdparty/assimp/include/assimp/material.h
index 19a7c69709..75695e50b3 100644
--- a/thirdparty/assimp/include/assimp/material.h
+++ b/thirdparty/assimp/include/assimp/material.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -312,6 +312,10 @@ enum aiTextureType
#define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN
+// -------------------------------------------------------------------------------
+// Get a string for a given aiTextureType
+ASSIMP_API const char* TextureTypeToString(enum aiTextureType in);
+
// ---------------------------------------------------------------------------
/** @brief Defines all shading models supported by the library
*
diff --git a/thirdparty/assimp/include/assimp/material.inl b/thirdparty/assimp/include/assimp/material.inl
index 8ae6b88d3e..7591344418 100644
--- a/thirdparty/assimp/include/assimp/material.inl
+++ b/thirdparty/assimp/include/assimp/material.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/matrix3x3.h b/thirdparty/assimp/include/assimp/matrix3x3.h
index 2c26cf92bb..f9880ab9e3 100644
--- a/thirdparty/assimp/include/assimp/matrix3x3.h
+++ b/thirdparty/assimp/include/assimp/matrix3x3.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/matrix3x3.inl b/thirdparty/assimp/include/assimp/matrix3x3.inl
index 1ce8c9691c..b11e036b10 100644
--- a/thirdparty/assimp/include/assimp/matrix3x3.inl
+++ b/thirdparty/assimp/include/assimp/matrix3x3.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/matrix4x4.h b/thirdparty/assimp/include/assimp/matrix4x4.h
index 8fc216f669..456d285e62 100644
--- a/thirdparty/assimp/include/assimp/matrix4x4.h
+++ b/thirdparty/assimp/include/assimp/matrix4x4.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/matrix4x4.inl b/thirdparty/assimp/include/assimp/matrix4x4.inl
index 84079974f7..e8a3c53054 100644
--- a/thirdparty/assimp/include/assimp/matrix4x4.inl
+++ b/thirdparty/assimp/include/assimp/matrix4x4.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/mesh.h b/thirdparty/assimp/include/assimp/mesh.h
index fbf2a857ad..8fd8c7f879 100644
--- a/thirdparty/assimp/include/assimp/mesh.h
+++ b/thirdparty/assimp/include/assimp/mesh.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/metadata.h b/thirdparty/assimp/include/assimp/metadata.h
index 849d90f485..bddd04b1e8 100644
--- a/thirdparty/assimp/include/assimp/metadata.h
+++ b/thirdparty/assimp/include/assimp/metadata.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -286,8 +286,8 @@ struct aiMetadata {
new_values[i] = mValues[i];
}
- delete mKeys;
- delete mValues;
+ delete[] mKeys;
+ delete[] mValues;
mKeys = new_keys;
mValues = new_values;
@@ -377,6 +377,23 @@ struct aiMetadata {
return true;
}
+ /// Check whether there is a metadata entry for the given key.
+ /// \param [in] Key - the key value value to check for.
+ inline
+ bool HasKey(const char* key) {
+ if ( nullptr == key ) {
+ return false;
+ }
+
+ // Search for the given key
+ for (unsigned int i = 0; i < mNumProperties; ++i) {
+ if ( 0 == strncmp(mKeys[i].C_Str(), key, mKeys[i].length ) ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
#endif // __cplusplus
};
diff --git a/thirdparty/assimp/include/assimp/pbrmaterial.h b/thirdparty/assimp/include/assimp/pbrmaterial.h
index 892a6347f7..cac4ab56b2 100644
--- a/thirdparty/assimp/include/assimp/pbrmaterial.h
+++ b/thirdparty/assimp/include/assimp/pbrmaterial.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h b/thirdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h
index 41d8004877..01505d5716 100644
--- a/thirdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h
+++ b/thirdparty/assimp/include/assimp/port/AndroidJNI/AndroidJNIIOSystem.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2016, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/thirdparty/assimp/include/assimp/postprocess.h b/thirdparty/assimp/include/assimp/postprocess.h
index 4b6732e80a..9997f0d601 100644
--- a/thirdparty/assimp/include/assimp/postprocess.h
+++ b/thirdparty/assimp/include/assimp/postprocess.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/qnan.h b/thirdparty/assimp/include/assimp/qnan.h
index 06780da5b8..5ca80601d6 100644
--- a/thirdparty/assimp/include/assimp/qnan.h
+++ b/thirdparty/assimp/include/assimp/qnan.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/quaternion.h b/thirdparty/assimp/include/assimp/quaternion.h
index ae45959b41..fd9abfd218 100644
--- a/thirdparty/assimp/include/assimp/quaternion.h
+++ b/thirdparty/assimp/include/assimp/quaternion.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
diff --git a/thirdparty/assimp/include/assimp/quaternion.inl b/thirdparty/assimp/include/assimp/quaternion.inl
index 3ce514d1bb..e8bdb9aeb8 100644
--- a/thirdparty/assimp/include/assimp/quaternion.inl
+++ b/thirdparty/assimp/include/assimp/quaternion.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/scene.h b/thirdparty/assimp/include/assimp/scene.h
index b76709eb15..93d04eee67 100644
--- a/thirdparty/assimp/include/assimp/scene.h
+++ b/thirdparty/assimp/include/assimp/scene.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/texture.h b/thirdparty/assimp/include/assimp/texture.h
index 0867659f46..5a44864311 100644
--- a/thirdparty/assimp/include/assimp/texture.h
+++ b/thirdparty/assimp/include/assimp/texture.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -207,8 +207,7 @@ struct aiTexture {
, mHeight(0)
, pcData(nullptr)
, mFilename() {
- achFormatHint[0] = achFormatHint[1] = 0;
- achFormatHint[2] = achFormatHint[3] = 0;
+ memset(achFormatHint, 0, sizeof(achFormatHint));
}
// Destruction
diff --git a/thirdparty/assimp/include/assimp/types.h b/thirdparty/assimp/include/assimp/types.h
index e32cae331c..1f47dad8fc 100644
--- a/thirdparty/assimp/include/assimp/types.h
+++ b/thirdparty/assimp/include/assimp/types.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/vector2.h b/thirdparty/assimp/include/assimp/vector2.h
index c8b1ebbbc2..a23e32e633 100644
--- a/thirdparty/assimp/include/assimp/vector2.h
+++ b/thirdparty/assimp/include/assimp/vector2.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/vector2.inl b/thirdparty/assimp/include/assimp/vector2.inl
index 4bbf432ff8..19dbce291a 100644
--- a/thirdparty/assimp/include/assimp/vector2.inl
+++ b/thirdparty/assimp/include/assimp/vector2.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/vector3.h b/thirdparty/assimp/include/assimp/vector3.h
index fffeb12ad7..8d3c82cf89 100644
--- a/thirdparty/assimp/include/assimp/vector3.h
+++ b/thirdparty/assimp/include/assimp/vector3.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/vector3.inl b/thirdparty/assimp/include/assimp/vector3.inl
index 6682d3b32c..2765115a2f 100644
--- a/thirdparty/assimp/include/assimp/vector3.inl
+++ b/thirdparty/assimp/include/assimp/vector3.inl
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
diff --git a/thirdparty/assimp/include/assimp/version.h b/thirdparty/assimp/include/assimp/version.h
index 2fdd37a43c..6709eaf39c 100644
--- a/thirdparty/assimp/include/assimp/version.h
+++ b/thirdparty/assimp/include/assimp/version.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
@@ -63,6 +63,13 @@ extern "C" {
ASSIMP_API const char* aiGetLegalString (void);
// ---------------------------------------------------------------------------
+/** @brief Returns the current patch version number of Assimp.
+ * @return Patch version of the Assimp runtime the application was
+ * linked/built against
+ */
+ASSIMP_API unsigned int aiGetVersionPatch(void);
+
+// ---------------------------------------------------------------------------
/** @brief Returns the current minor version number of Assimp.
* @return Minor version of the Assimp runtime the application was
* linked/built against
diff --git a/thirdparty/assimp/code/revision.h b/thirdparty/assimp/revision.h
index 66eb875303..d180e5f1ab 100644
--- a/thirdparty/assimp/code/revision.h
+++ b/thirdparty/assimp/revision.h
@@ -1,12 +1,12 @@
#ifndef ASSIMP_REVISION_H_INC
#define ASSIMP_REVISION_H_INC
-#define GitVersion 0x308db73d
+#define GitVersion 0x0201fc57
#define GitBranch "master"
#define VER_MAJOR 5
#define VER_MINOR 0
-#define VER_PATCH 0
+#define VER_PATCH 1
#define VER_BUILD 0
#define STR_HELP(x) #x
@@ -16,7 +16,7 @@
#if (GitVersion == 0)
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD)
#else
-#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit 308db73d)"
+#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit 0201fc57)"
#endif
#ifdef NDEBUG