diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index cdc59a4596a..8c0a2885e79 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -102,7 +102,7 @@ License: Expat and Zlib Files: ./thirdparty/assimp/ Comment: Open Asset Import Library (assimp) -Copyright: 2006-2016, assimp team +Copyright: 2006-2020, assimp team License: BSD-3-clause Files: ./thirdparty/basis_universal/ diff --git a/SConstruct b/SConstruct index 436dd488006..4ebc33f593e 100644 --- a/SConstruct +++ b/SConstruct @@ -136,6 +136,7 @@ opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen fo opts.Add('system_certs_path', "Use this path as SSL certificates default for editor (for package maintainers)", '') # Thirdparty libraries +#opts.Add(BoolVariable('builtin_assimp', "Use the built-in Assimp library", True)) opts.Add(BoolVariable('builtin_bullet', "Use the built-in Bullet library", True)) opts.Add(BoolVariable('builtin_certs', "Bundle default SSL certificates to be used if you don't specify an override in the project settings", True)) opts.Add(BoolVariable('builtin_enet', "Use the built-in ENet library", True)) diff --git a/modules/assimp/SCsub b/modules/assimp/SCsub index 5e66b50de39..90cdd7f5fcd 100644 --- a/modules/assimp/SCsub +++ b/modules/assimp/SCsub @@ -4,97 +4,91 @@ Import('env') Import('env_modules') env_assimp = env_modules.Clone() -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/IFC']) -env_assimp.Prepend(CPPPATH=['#thirdparty/misc']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/common']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/irrXML/']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/unzip/']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/']) -env_assimp.Prepend(CPPPATH=['#thirdparty/zlib/']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include']) -env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include']) -env_assimp.Prepend(CPPPATH=['.']) -#env_assimp.Append(CPPDEFINES=['ASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_BOOST_WORKAROUND']) -env_assimp.Append(CPPDEFINES=['OPENDDLPARSER_BUILD']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OWN_ZLIB']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_EXPORT']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AMF_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3DS_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD3_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDL_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD2_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_PLY_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASE_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OBJ_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_HMP_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SMD_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDC_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STL_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWO_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_DXF_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NFF_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_RAW_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SIB_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OFF_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AC_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BVH_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRRMESH_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRR_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_B3D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COLLADA_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_TERRAGEN_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_CSM_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWS_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OGRE_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OPENGEX_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MS3D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COB_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BLEND_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3BSP_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NDO_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STEP_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IFC_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_XGL_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASSBIN_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_C4D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3MF_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X3D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF2_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_SINGLETHREADED']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_M3D_IMPORTER']) -env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MMD_IMPORTER']) +# Force bundled version for now, there's no released version of Assimp with +# support for ArmaturePopulate which we use from their master branch. +if True: # env['builtin_assimp']: + thirdparty_dir = "#thirdparty/assimp" -if(env['platform'] == 'windows'): - env_assimp.Append(CPPDEFINES=['PLATFORM_WINDOWS']) - env_assimp.Append(CPPDEFINES=[('PLATFORM', 'WINDOWS')]) -elif(env['platform'] == 'x11'): - env_assimp.Append(CPPDEFINES=['PLATFORM_LINUX']) - env_assimp.Append(CPPDEFINES=[('PLATFORM', 'LINUX')]) -elif(env['platform'] == 'osx'): - env_assimp.Append(CPPDEFINES=['PLATFORM_DARWIN']) - env_assimp.Append(CPPDEFINES=[('PLATFORM', 'DARWIN')]) + env_assimp.Prepend(CPPPATH=['#thirdparty/assimp']) + env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code']) + env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include']) + + #env_assimp.Append(CPPDEFINES=['ASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_SINGLETHREADED']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_BOOST_WORKAROUND']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OWN_ZLIB']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_EXPORT']) + + # Importers we don't need + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3DS_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3MF_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AC_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AMF_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASE_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASSBIN_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_B3D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BLEND_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BVH_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_C4D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COB_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COLLADA_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_CSM_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_DXF_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF2_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_HMP_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IFC_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRR_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRRMESH_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWO_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWS_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_M3D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD2_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD3_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDC_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDL_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MMD_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MS3D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NDO_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NFF_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OBJ_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OFF_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OGRE_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OPENGEX_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_PLY_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3BSP_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_RAW_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SIB_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SMD_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STEP_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STL_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_TERRAGEN_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X3D_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_XGL_IMPORTER']) + env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X_IMPORTER']) + + if(env['platform'] == 'windows'): + env_assimp.Append(CPPDEFINES=['PLATFORM_WINDOWS']) + env_assimp.Append(CPPDEFINES=[('PLATFORM', 'WINDOWS')]) + elif(env['platform'] == 'x11'): + env_assimp.Append(CPPDEFINES=['PLATFORM_LINUX']) + env_assimp.Append(CPPDEFINES=[('PLATFORM', 'LINUX')]) + elif(env['platform'] == 'osx'): + env_assimp.Append(CPPDEFINES=['PLATFORM_DARWIN']) + env_assimp.Append(CPPDEFINES=[('PLATFORM', 'DARWIN')]) -env_thirdparty = env_assimp.Clone() -env_thirdparty.disable_warnings() -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Common/*.cpp')) -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/PostProcessing/*.cpp')) -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Material/*.cpp')) -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/FBX/*.cpp')) -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/MMD/*.cpp')) -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/glTF/*.cpp')) -env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/glTF2/*.cpp')) + env_thirdparty = env_assimp.Clone() + env_thirdparty.disable_warnings() + env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/CApi/*.cpp')) + env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Common/*.cpp')) + env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/PostProcessing/*.cpp')) + env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Material/*.cpp')) + env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/FBX/*.cpp')) # Godot's own source files env_assimp.add_source_files(env.modules_sources, "*.cpp") diff --git a/platform/server/detect.py b/platform/server/detect.py index ef94dc436cd..db9ba8d0363 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -163,6 +163,10 @@ def configure(env): sys.exit(255) env.ParseConfig('pkg-config bullet --cflags --libs') + if False: # not env['builtin_assimp']: + # FIXME: Add min version check + env.ParseConfig('pkg-config assimp --cflags --libs') + if not env['builtin_enet']: env.ParseConfig('pkg-config libenet --cflags --libs') diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 8952aa5e824..9a9ab86068c 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -1,7 +1,6 @@ import os import platform import sys -from methods import using_gcc, using_clang def is_active(): @@ -226,6 +225,10 @@ def configure(env): sys.exit(255) env.ParseConfig('pkg-config bullet --cflags --libs') + if False: # not env['builtin_assimp']: + # FIXME: Add min version check + env.ParseConfig('pkg-config assimp --cflags --libs') + if not env['builtin_enet']: env.ParseConfig('pkg-config libenet --cflags --libs') diff --git a/thirdparty/README.md b/thirdparty/README.md index 2099bd773f9..8f8d212a82b 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 262606aff32..dc8e24706a7 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 7557edcfc6a..137cc2894c8 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 5a3a49565a1..91dd07f3775 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 21623203021..2988474945c 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 178b2c01d0e..66588f0bc6f 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 5c1e6055494..8d7b029baac 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& extensions) { } std::unique_ptr pStream (pIOHandler->Open(pFile)); - if (pStream.get() ) { + if (pStream) { // read 200 characters from the file std::unique_ptr _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); @@ -309,7 +308,7 @@ std::string BaseImporter::GetExtension( const std::string& file ) { }; magic = reinterpret_cast(_magic); std::unique_ptr 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 e247be418d0..974af68db0d 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 4d5c7a76bec..a7e48bba366 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 b22b71ea9e8..7d82257044d 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 98b60e53194..7317dc45b38 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 1c100b61897..205f19e3783 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 select_ftell(FILE* file) + { + return ::ftell(file); + } + + template + int select_fseek(FILE* file, int64_t offset, int origin) + { + return ::fseek(file, static_cast(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(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(mFile); } // ---------------------------------------------------------------------------------- diff --git a/thirdparty/assimp/code/Common/DefaultIOSystem.cpp b/thirdparty/assimp/code/Common/DefaultIOSystem.cpp index 6fdc24dd800..0343cb289b2 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 de3528d2b42..adb9ba1600d 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 bd2cce00be7..ebf7f118c06 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 4ce1a2bd801..9f9a33b58e7 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 &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::iterator it = pimpl->mExporters.begin(); + ai_assert(nullptr != pimpl); + for (std::vector::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 740c503192e..ecff03a7eb0 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 9923cdbdd35..1440cf97d13 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 91b50859a09..a59ec981221 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 #include #include +#include + #include #include #include @@ -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(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(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(a), static_cast(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(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 str; for (std::vector::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(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(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(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(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(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(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(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(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 a439d99c2f2..c31f67caa77 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 b9f28f03561..41aa21979a2 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 fbbda0e7d1c..1b897287772 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 8ff4af04006..21bd2af9536 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 91700a76999..f7e735c165f 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 120070b0aa4..35ffaae582a 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 f7b13cc9512..29b6082a874 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 432a3d76660..6065905193e 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 3f4c8d7c3f6..e059d1c95c4 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 f336aafc9a5..f66f48856b1 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 06cfe034e96..724359f99e3 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 a4f3a4e4b85..604b086b714 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 2ef66a9afcb..ab7a1fe0071 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 #include +#include 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::vectormNumBones <= 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::vectormBones[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::vectormFaces[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 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::vectormName.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::vectormNumFaces = static_cast(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::vectorHasTextureCoords( 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::vectormVertices[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::vectorHasTextureCoords( 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::vectormNumBones; ++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::max() ) + { newMesh->mBones[newBoneIndex]->mNumWeights++; + } } } diff --git a/thirdparty/assimp/code/Common/SplitByBoneCountProcess.h b/thirdparty/assimp/code/Common/SplitByBoneCountProcess.h index 6c904a9df48..7185d03300c 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 2e5100130f0..d474c612901 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 893e261a2b2..4f5999775a6 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 60c54939f59..08408f867a1 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 b8062499ff8..3c61d21769f 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 91634ab5aa2..5b9c1881de9 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 cf1da7d5ba9..f04d122333c 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" ; @@ -66,6 +66,12 @@ ASSIMP_API const char* aiGetLegalString () { return LEGAL_INFORMATION; } +// ------------------------------------------------------------------------------------------------ +// Get Assimp patch version +ASSIMP_API unsigned int aiGetVersionPatch() { + return VER_PATCH; +} + // ------------------------------------------------------------------------------------------------ // Get Assimp minor version ASSIMP_API unsigned int aiGetVersionMinor () { diff --git a/thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp b/thirdparty/assimp/code/Common/VertexTriangleAdjacency.cpp index 7cfd1a3505e..e588dc2a4ba 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 f3be47612da..2226fc1c42e 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 a6063a261ef..3a9d89c73c3 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 15e4af5e7dd..822df5198ef 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 <root>/code/assbin_chunks.h header contains some magic constants for use by stand-alone ASSBIN loaders. Also, Assimp's own file writer can be found -in <root>/tools/assimp_cmd/WriteDumb.cpp (yes, the 'b' is no typo ...). +in <root>/tools/assimp_cmd/WriteDump.cpp (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 00000000000..f4a29dacfc4 --- /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 +#include + +// ------------------------------------------------------------------------------- +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 d15619acff8..f56562b1cab 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 04615f408eb..3054459703d 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 3eecdd45813..17856fe720a 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 874914431b9..9a54f61a010 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 a4a2bc8e797..7faa0518b45 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 e5164491307..7f70eb784fc 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 03536a18234..5cdaa69605f 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 d8a22d9f741..22616a48021 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 #include +#include +#include #include #include @@ -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()); 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(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 46693bdca6e..c5ad47059b5 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 69275534502..4b76cd0fae7 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 506fd978ddb..ddb971b3fde 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 a60d7d9efad..8984b3df7ce 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 f84691479a5..7178e9f266a 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 2450109e592..2d76ee031d2 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 06c89cee468..53aa719f451 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 ef3bc781a47..2e8f491a132 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 f2a63b72b90..11ee3500385 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 d692fe6ee35..6baae8b69cc 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 9316dc4f026..594951e78a3 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 setWeightedVertex; // add indices and weights, if any if (b) { std::vector 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 1ae727eda95..eb8bfaf3b36 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 1a4c80f8b2f..974931b4cb2 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 afcc1ddc78c..571f6088307 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 c365b2cddfc..63375e40d01 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 f43a8b84b05..88ac9db16b8 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 1386e2383c1..4a3de9f9932 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& data_out, const Scope& source, return; } std::vector tempData; - ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); + ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); + + 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) { - + 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& data_out, const Scope& source, std::vector tempData; ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); - data_out.resize(vertex_count); - std::vector 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& data_out, const Scope& source, std::vector tempData; ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); - data_out.resize(vertex_count); - std::vector 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 d6d45121777..97265e4b216 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 589af36ac7e..e34f3a610ea 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 b72e5637ee2..2ebf917e332 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 4a9346040d0..aef59d60ca9 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(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(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 7b0cf720396..5d8d00307fb 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 8d7036b6a91..f6b80489490 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 58755542fcb..209d5e940ab 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 252cce3557f..831c40061b3 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 afa588a470d..cadc82770fa 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 c10e057c8c2..50dd78a4cd4 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 b6344188580..77bb0ad3048 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 0be6e9f7bbc..1c034e55f82 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 67d53578cb2..6df9818a352 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 75daeb6b597..31c99ae94ab 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 bones; - std::vector nodes; - std::map bone_stack; - BuildBoneList(out->mRootNode, out->mRootNode, out, bones); - BuildNodeList(out->mRootNode, nodes); + // Now convert all bone positions to the correct mOffsetMatrix + std::vector bones; + std::vector nodes; + std::map 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 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 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 &bones) { - ai_assert(scene); - for (unsigned int nodeId = 0; nodeId < current_node->mNumChildren; ++nodeId) { - aiNode *child = current_node->mChildren[nodeId]; - ai_assert(child); + 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); + // 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); + 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); + // 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 &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 &bones, std::map &bone_stack, - std::vector &node_stack) { - ai_assert(scene); - ai_assert(root_node); - ai_assert(!node_stack.empty()); + std::vector &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()); + 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); + node = GetNodeFromStack(bone->mName, node_stack); - if (!node) { - ASSIMP_LOG_ERROR("serious import issue node for bone was not detected"); - continue; - } + if (!node) { + ASSIMP_LOG_ERROR("serious import issue node for bone was not detected"); + continue; + } + } + + 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(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(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 &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; } - bone_node = bone_node->mParent; - } - - ASSIMP_LOG_ERROR("GetArmatureRoot() can't find armature!"); - - return nullptr; + 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 &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 &nodes) { - std::vector::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::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 aa1ad7c80c7..8985e1d1d85 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 a3f7dd2557c..4af335d2f0c 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 3568a624f86..bdd5ca7faa8 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 df4d44337d1..1ebf798bd5f 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 a6d36e06ea9..b4ad0f501f4 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 b7cd4f0bc68..6ca73f10e92 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 f32b91fc395..de984a1052a 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 83b8336bc9f..9d6313f71c0 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 8b64c2acc67..31955f2bdad 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 b11615bb82c..1d7cf33b02e 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 c710c5a5ee4..b9e942d5597 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 739382a057c..b187acf53c9 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 3c4b2eab4e9..bbe2656f56e 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 50fac46dbab..dfdfec6ccf5 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 7a15e77cf13..1edaab6570b 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 64907458a14..9a4c6f53b87 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 64b838d7cc4..dcac4bf8392 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 016884c6e76..c557d7f7079 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 ce7375f34fd..50a2fe04c6b 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 bbbe6899b46..bb2aa06cc7d 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 f60ce596a49..c022d036406 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 c013454fc31..bfe016cf275 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 4b43c82a42e..d93489a5bd5 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 028334dec79..08a1d9aaefa 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 c641fd63539..6e872af3a84 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 3f6c2f86bd5..1df33341078 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 2ceee17e854..38104b3bf7d 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 d0a016fa423..d72d15d3a7d 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 de25ecd9fb1..73e11f57bda 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 f121fc60d38..070c9636f23 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 e017ae62dbd..76e7cf061bd 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 d560f192879..1f1abfabb0a 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 73c2a68d537..8bc321a3c52 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 41f50a5ba59..88bdb3124fb 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 8565d5933a1..699cce30b46 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 5db51f58b6b..f3996c2752a 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 +#include "ConvertToLHProcess.h" #include +#include #include 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& nodes) { - nodes_in += nd->mNumChildren; +void OptimizeGraphProcess::CollectNewChildren(aiNode *nd, std::list &nodes) { + nodes_in += nd->mNumChildren; - // Process children - std::list child_nodes; - for (unsigned int i = 0; i < nd->mNumChildren; ++i) { - CollectNewChildren(nd->mChildren[i],child_nodes); - nd->mChildren[i] = nullptr; - } + // Process children + std::list 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::iterator it = child_nodes.begin(); it != child_nodes.end();) { + // 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::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); + 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; - } + it = child_nodes.erase(it); + continue; + } + ++it; + } - if (nd->mNumMeshes || !child_nodes.empty()) { - nodes.push_back(nd); - } else { - delete nd; /* bye, node */ - return; - } - } else { + 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); + // 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; + // 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(); + const LockedSetType::const_iterator end = locked.end(); - std::list join; - for (std::list::iterator it = child_nodes.begin(); it != child_nodes.end();) { - aiNode* child = *it; - if (child->mNumChildren == 0 && locked.find(AI_OG_GETKEY(child->mName)) == end) { + std::list join; + for (std::list::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 ; + // 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++); + 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::iterator it = join.begin(); it != join.end(); ++it) { - out_meshes += (*it)->mNumMeshes; - } + unsigned int out_meshes = 0; + for (std::list::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]; - } + // 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::iterator it = join.begin(); it != join.end(); ++it) { - for (unsigned int n = 0; n < (*it)->mNumMeshes; ++n) { + for (const aiNode *join_node : join) { + for (unsigned int n = 0; n < join_node->mNumMeshes; ++n) { - *tmp = (*it)->mMeshes[n]; - aiMesh* mesh = mScene->mMeshes[*tmp++]; + *tmp = join_node->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) { + // Assume the transformation is affine + // manually move the mesh into the right coordinate system - mesh->mVertices[a] *= (*it)->mTransformation; + // Check for odd negative scale (mirror) + if (join_node->mTransformation.Determinant() < 0) { + // Reverse the mesh face winding order + FlipWindingOrderProcess::ProcessMesh(mesh); + } - if (mesh->HasNormals()) - mesh->mNormals[a] *= IT; + // Update positions, normals and tangents + const aiMatrix3x3 IT = aiMatrix3x3(join_node->mTransformation).Inverse().Transpose(); + for (unsigned int a = 0; a < mesh->mNumVertices; ++a) { - 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) { + mesh->mVertices[a] *= join_node->mTransformation; - delete[] nd->mChildren; + if (mesh->HasNormals()) + mesh->mNormals[a] *= IT; - if (!child_nodes.empty()) { - nd->mChildren = new aiNode*[child_nodes.size()]; - } - else nd->mChildren = nullptr; - } + 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) { - nd->mNumChildren = static_cast(child_nodes.size()); + delete[] nd->mChildren; - if (nd->mChildren) { - aiNode** tmp = nd->mChildren; - for (std::list::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) { - aiNode* node = *tmp++ = *it; - node->mParent = nd; - } - } + if (!child_nodes.empty()) { + nd->mChildren = new aiNode *[child_nodes.size()]; + } else + nd->mChildren = nullptr; + } - nodes_out += static_cast(child_nodes.size()); + nd->mNumChildren = static_cast(child_nodes.size()); + + if (nd->mChildren) { + aiNode **tmp = nd->mChildren; + for (std::list::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) { + aiNode *node = *tmp++ = *it; + node->mParent = nd; + } + } + + nodes_out += static_cast(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::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::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->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) { + 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)); + 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; - } - } + // 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->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)); - } + 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)); + // 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; + 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; + 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 nodes; - CollectNewChildren (dummy_root,nodes); + // 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 nodes; + CollectNewChildren(dummy_root, nodes); - ai_assert(nodes.size() == 1); + 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 == 0) { + pScene->mRootNode = nullptr; + throw DeadlyImportError("After optimizing the scene graph, no data remains"); + } - if (dummy_root->mNumChildren > 1) { - pScene->mRootNode = dummy_root; + 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 { + // 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]; + // Remove the dummy root node again. + pScene->mRootNode = dummy_root->mChildren[0]; - dummy_root->mChildren[0] = NULL; - delete dummy_root; - } + dummy_root->mChildren[0] = nullptr; + 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(); + 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]]; - } +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]); + 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 82cc5db3fe4..34f70854f76 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 3f6765f6caf..983d8001f37 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 dec4ab52ded..50dfe2957ec 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 52001a05784..293a5c0ea95 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 #include +#include 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; +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); - const unsigned int iRet = GetMeshVFormatUnique(pcMesh); - - // store the value for later use - pcMesh->mBones = (aiBone**)(uint64_t)iRet; - return iRet; + // 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; - } +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 (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(); + 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); + // 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]; + 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; + const unsigned int num_idx = f_src.mNumIndices; - f_dst.mNumIndices = num_idx; + 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; + 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]; + // 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]; - } - } + // 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; - } - } + // 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); - } + // 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& 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 &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; - } +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]); - } + 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()) { +void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const { + // 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(); + // Check for odd negative scale (mirror) + if (mesh->HasFaces() && mat.Determinant() < 0) { + // Reverse the mesh face winding order + FlipWindingOrderProcess::ProcessMesh(mesh); + } - // TODO: implement Inverse() for aiMatrix3x3 - aiMatrix3x3 m = aiMatrix3x3(mWorldIT); + // Update positions + if (mesh->HasPositions()) { + for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { + mesh->mVertices[i] = mat * mesh->mVertices[i]; + } + } - 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(); - } - } - } - } + // 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& 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 +void PretransformVertices::BuildWCSMeshes(std::vector &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]]; + // 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(mesh->mBones) == node->mTransformation) { - // yes, we can. - mesh->mBones = reinterpret_cast (&node->mTransformation); - mesh->mNumBones = UINT_MAX; - } - else { + // check whether we can operate on this mesh + if (!mesh->mBones || *reinterpret_cast(mesh->mBones) == node->mTransformation) { + // yes, we can. + mesh->mBones = reinterpret_cast(&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(ctz->mBones) == node->mTransformation) { + // 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(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; + // 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; + 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 (&node->mTransformation); + ntz->mNumBones = node->mMeshes[i]; + ntz->mBones = reinterpret_cast(&node->mTransformation); - out.push_back(ntz); + out.push_back(ntz); - node->mMeshes[i] = static_cast(numIn + out.size() - 1); - } - } - } + node->mMeshes[i] = static_cast(numIn + out.size() - 1); + } + } + } - // call children - for (unsigned int i = 0; i < node->mNumChildren;++i) - BuildWCSMeshes(out,in,numIn,node->mChildren[i]); + // 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]]++; +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); + // 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"); +void PretransformVertices::Execute(aiScene *pScene) { + ASSIMP_LOG_DEBUG("PretransformVerticesProcess begin"); - // Return immediately if we have no meshes - if (!pScene->mNumMeshes) - return; + // 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); + 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; - } + if (configTransform) { + pScene->mRootNode->mTransformation = configTransformation; + } - // first compute absolute transformation matrices for all nodes - ComputeAbsoluteTransform(pScene->mRootNode); + // 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]; + // 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]; + for (unsigned int a = 0; a < mesh->mNumBones; ++a) + delete mesh->mBones[a]; - delete[] mesh->mBones; - mesh->mBones = NULL; - } + delete[] mesh->mBones; + mesh->mBones = NULL; + } - // now build a list of output meshes - std::vector apcOutMeshes; + // now build a list of output meshes + std::vector 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 ) { + // 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); + // 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()]; + // ... 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()); + memcpy(npp, pScene->mMeshes, sizeof(aiMesh *) * pScene->mNumMeshes); + memcpy(npp + pScene->mNumMeshes, &apcOutMeshes[0], sizeof(aiMesh *) * apcOutMeshes.size()); - pScene->mNumMeshes += static_cast(apcOutMeshes.size()); - delete[] pScene->mMeshes; pScene->mMeshes = npp; - } + pScene->mNumMeshes += static_cast(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( pScene->mMeshes[i]->mBones )); + // 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(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 aiVFormats; + // prevent improper destruction + pScene->mMeshes[i]->mBones = NULL; + pScene->mMeshes[i]->mNumBones = 0; + } + } else { + apcOutMeshes.reserve(pScene->mNumMaterials << 1u); + std::list aiVFormats; - std::vector s(pScene->mNumMeshes,0); - BuildMeshRefCountArray(pScene->mRootNode,&s[0]); + std::vector 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::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]; + 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::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]); - } - } - } + // 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; + // If no meshes are referenced in the node graph it is possible that we get no output meshes. + if (apcOutMeshes.empty()) { - // 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; - } + 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; - delete mesh; + // 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; + } - // 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; - } + delete mesh; - // 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]; - } - } - } + // 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; + } - // remove all animations from the scene - for (unsigned int i = 0; i < pScene->mNumAnimations;++i) - delete pScene->mAnimations[i]; - delete[] pScene->mAnimations; + // 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]; + } + } + } - pScene->mAnimations = NULL; - pScene->mNumAnimations = 0; + // remove all animations from the scene + for (unsigned int i = 0; i < pScene->mNumAnimations; ++i) + delete pScene->mAnimations[i]; + delete[] pScene->mAnimations; - // --- 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); + pScene->mAnimations = NULL; + pScene->mNumAnimations = 0; - // 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; - } + // --- 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); - 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 + cam->mPosition = nd->mTransformation * cam->mPosition; + cam->mLookAt = aiMatrix3x3(nd->mTransformation) * cam->mLookAt; + cam->mUp = aiMatrix3x3(nd->mTransformation) * cam->mUp; + } - // 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; - } + 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); - if( !configKeepHierarchy ) { + // 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; + } - // 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 (!configKeepHierarchy) { - 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]; + // 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; - // 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; + 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]; - // 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); - } + // 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; - if (configNormalize) { - // compute the boundary of all meshes - aiVector3D min,max; - MinMaxChooser ()(min,max); + // 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); + } - 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); - } - } + if (configNormalize) { + // compute the boundary of all meshes + aiVector3D min, max; + MinMaxChooser()(min, 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); + 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); + } + } - 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; - } - } - } + // 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); - // print statistics - if (!DefaultLogger::isNullLogger()) { - ASSIMP_LOG_DEBUG("PretransformVerticesProcess finished"); + 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; + } + } + } - 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, ")"); - } + // 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 b2982951e0d..4a958def4ee 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 ); + // ------------------------------------------------------------------- + // 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); + // ------------------------------------------------------------------- + // 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( aiScene* pcScene, aiNode* pcNode, - unsigned int iMat, - unsigned int iVFormat, - unsigned int* piFaces, - unsigned int* piVertices); + // ------------------------------------------------------------------- + // 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( aiScene* pcScene, aiNode* pcNode, - unsigned int iMat, - unsigned int iVFormat, - aiMesh* pcMeshOut, - unsigned int aiCurrent[2], - unsigned int* num_refs); + // ------------------------------------------------------------------- + // 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( aiScene* pcScene, unsigned int iMat, - std::list& aiOut); + // ------------------------------------------------------------------- + // 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 &aiOut) const; - // ------------------------------------------------------------------- - // Compute the absolute transformation matrices of each node - void ComputeAbsoluteTransform( aiNode* pcNode ); + // ------------------------------------------------------------------- + // 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& out, aiMesh** in, - unsigned int numIn, aiNode* node); + // ------------------------------------------------------------------- + // Simple routine to build meshes in worldspace, no further optimization + void BuildWCSMeshes(std::vector &out, aiMesh **in, + unsigned int numIn, aiNode *node) const; - // ------------------------------------------------------------------- - // Apply the node transformation to a mesh - void ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat); + // ------------------------------------------------------------------- + // Apply the node transformation to a mesh + void ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const; - // ------------------------------------------------------------------- - // Reset transformation matrices to identity - void MakeIdentityTransform(aiNode* nd); + // ------------------------------------------------------------------- + // Reset transformation matrices to identity + void MakeIdentityTransform(aiNode *nd) const; - // ------------------------------------------------------------------- - // Build reference counters for all meshes - void BuildMeshRefCountArray(aiNode* nd, unsigned int * refs); + // ------------------------------------------------------------------- + // 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; + //! 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 59869fdff78..1239864381f 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 0afcc414206..5762fbb35d4 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 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 49ec8f5c47c..0c42804103e 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 1f32a0abfb4..4b4f346c864 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 99fd47a3aa1..5ff5b55fad4 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 7bb21a83307..458b37ee0d5 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 ac770c41f2b..66714928b69 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 468a216736b..9cc664c6a73 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 be8405a17b4..c1b08c5a78e 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 1d7ccfc1524..5135139edf1 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 1797b28d5ac..70960f4a897 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 3f90576ea9b..fa6f77b2d87 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 8ae2ba72185..bf60e2970fa 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 2a5d623d7fe..2f6fc3edc26 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 1040836bbe1..64cc63bbd1f 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 916b5103ddb..388952eb55e 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 75d1b6ef784..6212bfb690a 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 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 7b309c92515..4b5503ae032 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 364411a23d6..00000000000 --- 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 6f2aacbe7bc..00000000000 --- a/thirdparty/assimp/contrib/utf8cpp/doc/utf8cpp.html +++ /dev/null @@ -1,1789 +0,0 @@ - - - - - - - - - UTF8-CPP: UTF-8 with C++ in a Portable Way - - - - -

- UTF8-CPP: UTF-8 with C++ in a Portable Way -

-

- The Sourceforge project page -

- -

- Introduction -

-

- 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. -

-

- 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. -

-

- 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 - Unicode Home Page 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. -

-

- Examples of use -

-

- Introductionary Sample -

-

- 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: -

-
-#include <fstream>
-#include <iostream>
-#include <string>
-#include <vector>
-#include "utf8.h"
-using namespace std;
-int main(int argc, char** argv)
-{
-    if (argc != 2) {
-        cout << "\nUsage: docsample filename\n";
-        return 0;
-    }
-
-    const char* test_file_path = argv[1];
-    // Open the test file (contains UTF-8 encoded text)
-    ifstream fs8(test_file_path);
-    if (!fs8.is_open()) {
-    cout << "Could not open " << test_file_path << endl;
-    return 0;
-    }
-
-    unsigned line_count = 1;
-    string line;
-    // Play with all the lines in the file
-    while (getline(fs8, line)) {
-       // check for invalid utf-8 (for a simple yes/no check, there is also utf8::is_valid function)
-        string::iterator end_it = utf8::find_invalid(line.begin(), line.end());
-        if (end_it != line.end()) {
-            cout << "Invalid UTF-8 encoding detected at line " << line_count << "\n";
-            cout << "This part is fine: " << string(line.begin(), end_it) << "\n";
-        }
-
-        // Get the line length (at least for the valid part)
-        int length = utf8::distance(line.begin(), end_it);
-        cout << "Length of line " << line_count << " is " << length <<  "\n";
-
-        // Convert it to utf-16
-        vector<unsigned short> utf16line;
-        utf8::utf8to16(line.begin(), end_it, back_inserter(utf16line));
-
-        // And back to utf-8
-        string utf8line; 
-        utf8::utf16to8(utf16line.begin(), utf16line.end(), back_inserter(utf8line));
-
-        // Confirm that the conversion went OK:
-        if (utf8line != string(line.begin(), end_it))
-            cout << "Error in UTF-16 conversion at line: " << line_count << "\n";        
-
-        line_count++;
-    }
-    return 0;
-}
-
-

- In the previous code sample, for each line we performed - a detection of invalid UTF-8 sequences with find_invalid; 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 utf8::distance; finally, we have converted - each line to UTF-16 encoding with utf8to16 and back to UTF-8 with - utf16to8. -

-

Checking if a file contains valid UTF-8 text

-

-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: -

-
    
-bool valid_utf8_file(iconst char* file_name)
-{
-    ifstream ifs(file_name);
-    if (!ifs)
-        return false; // even better, throw here
-
-    istreambuf_iterator<char> it(ifs.rdbuf());
-    istreambuf_iterator<char> eos;
-
-    return utf8::is_valid(it, eos);
-}
-
-

-Because the function utf8::is_valid() works with input iterators, we were able -to pass an istreambuf_iterator to it and read the content of the file directly -without loading it to the memory first.

-

-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: -

-
-    utf8::utf8to16(it, eos, back_inserter(u16string));
-
-

Ensure that a string contains valid UTF-8 text

-

-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: -

-
-void fix_utf8_string(std::string& str)
-{
-    std::string temp;
-    utf8::replace_invalid(str.begin(), str.end(), back_inserter(temp));
-    str = temp;
-}
-
-

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. -

-

- Reference -

-

- Functions From utf8 Namespace -

-

- utf8::append -

-

- Available in version 1.0 and later. -

-

- Encodes a 32 bit code point as a UTF-8 sequence of octets and appends the sequence - to a UTF-8 string. -

-
-template <typename octet_iterator>
-octet_iterator append(uint32_t cp, octet_iterator result);
-   
-
-

- octet_iterator: an output iterator.
- cp: a 32 bit integer representing a code point to append to the - sequence.
- result: an output iterator to the place in the sequence where to - append the code point.
- Return value: an iterator pointing to the place - after the newly appended sequence. -

-

- Example of use: -

-
-unsigned char u[5] = {0,0,0,0,0};
-unsigned char* end = append(0x0448, u);
-assert (u[0] == 0xd1 && u[1] == 0x88 && u[2] == 0 && u[3] == 0 && u[4] == 0);
-
-

- Note that append 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, append can add anywhere between 1 and 4 - octets to the sequence. In practice, you would most often want to use - std::back_inserter to ensure that the necessary memory is allocated. -

-

- In case of an invalid code point, a utf8::invalid_code_point exception - is thrown. -

-

- utf8::next -

-

- Available in version 1.0 and later. -

-

- Given the iterator to the beginning of the UTF-8 sequence, it returns the code - point and moves the iterator to the next position. -

-
-template <typename octet_iterator> 
-uint32_t next(octet_iterator& it, octet_iterator end);
-   
-
-

- octet_iterator: an input iterator.
- it: 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.
- end: end of the UTF-8 sequence to be processed. If it - gets equal to end during the extraction of a code point, an - utf8::not_enough_room exception is thrown.
- Return value: the 32 bit representation of the - processed UTF-8 code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars;
-int cp = next(w, twochars + 6);
-assert (cp == 0x65e5);
-assert (w == twochars + 3);
-
-

- This function is typically used to iterate through a UTF-8 encoded string. -

-

- In case of an invalid UTF-8 seqence, a utf8::invalid_utf8 exception is - thrown. -

-

- utf8::peek_next -

-

- Available in version 2.1 and later. -

-

- 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. -

-
-template <typename octet_iterator> 
-uint32_t peek_next(octet_iterator it, octet_iterator end);
-   
-
-

- octet_iterator: an input iterator.
- it: an iterator pointing to the beginning of an UTF-8 - encoded code point.
- end: end of the UTF-8 sequence to be processed. If it - gets equal to end during the extraction of a code point, an - utf8::not_enough_room exception is thrown.
- Return value: the 32 bit representation of the - processed UTF-8 code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars;
-int cp = peek_next(w, twochars + 6);
-assert (cp == 0x65e5);
-assert (w == twochars);
-
-

- In case of an invalid UTF-8 seqence, a utf8::invalid_utf8 exception is - thrown. -

-

- utf8::prior -

-

- Available in version 1.02 and later. -

-

- 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. -

-
-template <typename octet_iterator> 
-uint32_t prior(octet_iterator& it, octet_iterator start);
-   
-
-

- octet_iterator: a bidirectional iterator.
- it: 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.
- start: 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.
- Return value: the 32 bit representation of the - previous code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-unsigned char* w = twochars + 3;
-int cp = prior (w, twochars);
-assert (cp == 0x65e5);
-assert (w == twochars);
-
-

- 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 utf8::next 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 utf8::prior may not detect an invalid UTF-8 sequence in some scenarios: - for instance if there are superfluous trail octets, it will just skip them. -

-

- it will typically point to the beginning of - a code point, and start will point to the - beginning of the string to ensure we don't go backwards too far. it 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. -

-

- In case start is reached before a UTF-8 lead octet is hit, or if an - invalid UTF-8 sequence is started by the lead octet, an invalid_utf8 - exception is thrown. -

-

In case start equals it, a not_enough_room - exception is thrown. -

- utf8::previous -

-

- Deprecated in version 1.02 and later. -

-

- 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. -

-
-template <typename octet_iterator> 
-uint32_t previous(octet_iterator& it, octet_iterator pass_start);
-   
-
-

- octet_iterator: a random access iterator.
- it: 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.
- pass_start: 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.
- Return value: the 32 bit representation of the - previous code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-unsigned char* w = twochars + 3;
-int cp = previous (w, twochars - 1);
-assert (cp == 0x65e5);
-assert (w == twochars);
-
-

- utf8::previous is deprecated, and utf8::prior should - be used instead, although the existing code can continue using this function. - The problem is the parameter pass_start 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. -

-

- it will typically point to the beginning of - a code point, and pass_start will point to the octet just before the - beginning of the string to ensure we don't go backwards too far. it 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. -

-

- In case pass_start is reached before a UTF-8 lead octet is hit, or if an - invalid UTF-8 sequence is started by the lead octet, an invalid_utf8 - exception is thrown -

-

- utf8::advance -

-

- Available in version 1.0 and later. -

-

- Advances an iterator by the specified number of code points within an UTF-8 - sequence. -

-
-template <typename octet_iterator, typename distance_type> 
-void advance (octet_iterator& it, distance_type n, octet_iterator end);
-   
-
-

- octet_iterator: an input iterator.
- distance_type: an integral type convertible to octet_iterator's difference type.
- it: 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.
- n: a positive integer that shows how many code points we want to - advance.
- end: end of the UTF-8 sequence to be processed. If it - gets equal to end during the extraction of a code point, an - utf8::not_enough_room exception is thrown.
-

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-unsigned char* w = twochars;
-advance (w, 2, twochars + 6);
-assert (w == twochars + 5);
-
-

- This function works only "forward". In case of a negative n, there is - no effect. -

-

- In case of an invalid code point, a utf8::invalid_code_point exception - is thrown. -

-

- utf8::distance -

-

- Available in version 1.0 and later. -

-

- Given the iterators to two UTF-8 encoded code points in a seqence, returns the - number of code points between them. -

-
-template <typename octet_iterator> 
-typename std::iterator_traits<octet_iterator>::difference_type distance (octet_iterator first, octet_iterator last);
-   
-
-

- octet_iterator: an input iterator.
- first: an iterator to a beginning of a UTF-8 encoded code point.
- last: 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.
- Return value the distance between the iterators, - in code points. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-size_t dist = utf8::distance(twochars, twochars + 5);
-assert (dist == 2);
-
-

- This function is used to find the length (in code points) of a UTF-8 encoded - string. The reason it is called distance, rather than, say, - length is mainly because developers are used that length 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 std::distance algorithm. -

-

- In case of an invalid UTF-8 seqence, a utf8::invalid_utf8 exception is - thrown. If last does not point to the past-of-end of a UTF-8 seqence, - a utf8::not_enough_room exception is thrown. -

-

- utf8::utf16to8 -

-

- Available in version 1.0 and later. -

-

- Converts a UTF-16 encoded string to UTF-8. -

-
-template <typename u16bit_iterator, typename octet_iterator>
-octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result);
-   
-
-

- u16bit_iterator: an input iterator.
- octet_iterator: an output iterator.
- start: an iterator pointing to the beginning of the UTF-16 encoded - string to convert.
- end: an iterator pointing to pass-the-end of the UTF-16 encoded - string to convert.
- result: an output iterator to the place in the UTF-8 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-8 string. -

-

- Example of use: -

-
-unsigned short utf16string[] = {0x41, 0x0448, 0x65e5, 0xd834, 0xdd1e};
-vector<unsigned char> utf8result;
-utf16to8(utf16string, utf16string + 5, back_inserter(utf8result));
-assert (utf8result.size() == 10);    
-
-

- In case of invalid UTF-16 sequence, a utf8::invalid_utf16 exception is - thrown. -

-

- utf8::utf8to16 -

-

- Available in version 1.0 and later. -

-

- Converts an UTF-8 encoded string to UTF-16 -

-
-template <typename u16bit_iterator, typename octet_iterator>
-u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result);
-   
-
-

- octet_iterator: an input iterator.
- u16bit_iterator: an output iterator.
- start: an iterator pointing to the beginning of the UTF-8 encoded - string to convert. < br /> end: an iterator pointing to - pass-the-end of the UTF-8 encoded string to convert.
- result: an output iterator to the place in the UTF-16 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-16 string. -

-

- Example of use: -

-
-char utf8_with_surrogates[] = "\xe6\x97\xa5\xd1\x88\xf0\x9d\x84\x9e";
-vector <unsigned short> utf16result;
-utf8to16(utf8_with_surrogates, utf8_with_surrogates + 9, back_inserter(utf16result));
-assert (utf16result.size() == 4);
-assert (utf16result[2] == 0xd834);
-assert (utf16result[3] == 0xdd1e);
-
-

- In case of an invalid UTF-8 seqence, a utf8::invalid_utf8 exception is - thrown. If end does not point to the past-of-end of a UTF-8 seqence, a - utf8::not_enough_room exception is thrown. -

-

- utf8::utf32to8 -

-

- Available in version 1.0 and later. -

-

- Converts a UTF-32 encoded string to UTF-8. -

-
-template <typename octet_iterator, typename u32bit_iterator>
-octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result);
-   
-
-

- octet_iterator: an output iterator.
- u32bit_iterator: an input iterator.
- start: an iterator pointing to the beginning of the UTF-32 encoded - string to convert.
- end: an iterator pointing to pass-the-end of the UTF-32 encoded - string to convert.
- result: an output iterator to the place in the UTF-8 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-8 string. -

-

- Example of use: -

-
-int utf32string[] = {0x448, 0x65E5, 0x10346, 0};
-vector<unsigned char> utf8result;
-utf32to8(utf32string, utf32string + 3, back_inserter(utf8result));
-assert (utf8result.size() == 9);
-
-

- In case of invalid UTF-32 string, a utf8::invalid_code_point exception - is thrown. -

-

- utf8::utf8to32 -

-

- Available in version 1.0 and later. -

-

- Converts a UTF-8 encoded string to UTF-32. -

-
-template <typename octet_iterator, typename u32bit_iterator>
-u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result);
-   
-
-

- octet_iterator: an input iterator.
- u32bit_iterator: an output iterator.
- start: an iterator pointing to the beginning of the UTF-8 encoded - string to convert.
- end: an iterator pointing to pass-the-end of the UTF-8 encoded string - to convert.
- result: an output iterator to the place in the UTF-32 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-32 string. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-vector<int> utf32result;
-utf8to32(twochars, twochars + 5, back_inserter(utf32result));
-assert (utf32result.size() == 2);
-
-

- In case of an invalid UTF-8 seqence, a utf8::invalid_utf8 exception is - thrown. If end does not point to the past-of-end of a UTF-8 seqence, a - utf8::not_enough_room exception is thrown. -

-

- utf8::find_invalid -

-

- Available in version 1.0 and later. -

-

- Detects an invalid sequence within a UTF-8 string. -

-
-template <typename octet_iterator> 
-octet_iterator find_invalid(octet_iterator start, octet_iterator end);
-
-

- octet_iterator: an input iterator.
- start: an iterator pointing to the beginning of the UTF-8 string to - test for validity.
- end: an iterator pointing to pass-the-end of the UTF-8 string to test - for validity.
- Return value: an iterator pointing to the first - invalid octet in the UTF-8 string. In case none were found, equals - end. -

-

- Example of use: -

-
-char utf_invalid[] = "\xe6\x97\xa5\xd1\x88\xfa";
-char* invalid = find_invalid(utf_invalid, utf_invalid + 6);
-assert (invalid == utf_invalid + 5);
-
-

- 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 unchecked operations on it. -

-

- utf8::is_valid -

-

- Available in version 1.0 and later. -

-

- Checks whether a sequence of octets is a valid UTF-8 string. -

-
-template <typename octet_iterator> 
-bool is_valid(octet_iterator start, octet_iterator end);
-   
-
-

- octet_iterator: an input iterator.
- start: an iterator pointing to the beginning of the UTF-8 string to - test for validity.
- end: an iterator pointing to pass-the-end of the UTF-8 string to test - for validity.
- Return value: true if the sequence - is a valid UTF-8 string; false if not. -

- Example of use: -
-char utf_invalid[] = "\xe6\x97\xa5\xd1\x88\xfa";
-bool bvalid = is_valid(utf_invalid, utf_invalid + 6);
-assert (bvalid == false);
-
-

- is_valid is a shorthand for find_invalid(start, end) == - end;. 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. -

-

- utf8::replace_invalid -

-

- Available in version 2.0 and later. -

-

- Replaces all invalid UTF-8 sequences within a string with a replacement marker. -

-
-template <typename octet_iterator, typename output_iterator>
-output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement);
-template <typename octet_iterator, typename output_iterator>
-output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out);
-   
-
-

- octet_iterator: an input iterator.
- output_iterator: an output iterator.
- start: an iterator pointing to the beginning of the UTF-8 string to - look for invalid UTF-8 sequences.
- end: an iterator pointing to pass-the-end of the UTF-8 string to look - for invalid UTF-8 sequences.
- out: An output iterator to the range where the result of replacement - is stored.
- replacement: A Unicode code point for the replacement marker. The - version without this parameter assumes the value 0xfffd
- Return value: An iterator pointing to the place - after the UTF-8 string with replaced invalid sequences. -

-

- Example of use: -

-
-char invalid_sequence[] = "a\x80\xe0\xa0\xc0\xaf\xed\xa0\x80z";
-vector<char> replace_invalid_result;
-replace_invalid (invalid_sequence, invalid_sequence + sizeof(invalid_sequence), back_inserter(replace_invalid_result), '?');
-bvalid = is_valid(replace_invalid_result.begin(), replace_invalid_result.end());
-assert (bvalid);
-char* fixed_invalid_sequence = "a????z";
-assert (std::equal(replace_invalid_result.begin(), replace_invalid_result.end(), fixed_invalid_sequence));
-
-

- replace_invalid 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, out must not - be in the [start, end] range. -

-

- If end does not point to the past-of-end of a UTF-8 sequence, a - utf8::not_enough_room exception is thrown. -

-

- utf8::starts_with_bom -

-

- Available in version 2.3 and later. Relaces deprecated is_bom() function. -

-

- Checks whether an octet sequence starts with a UTF-8 byte order mark (BOM) -

-
-template <typename octet_iterator> 
-bool starts_with_bom (octet_iterator it, octet_iterator end);
-
-

- octet_iterator: an input iterator.
- it: beginning of the octet sequence to check
- end: pass-end of the sequence to check
- Return value: true if the sequence - starts with a UTF-8 byte order mark; false if not. -

-

- Example of use: -

-
-unsigned char byte_order_mark[] = {0xef, 0xbb, 0xbf};
-bool bbom = starts_with_bom(byte_order_mark, byte_order_mark + sizeof(byte_order_mark));
-assert (bbom == true);
-
-

- 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. -

-

- utf8::is_bom -

-

- Available in version 1.0 and later. Deprecated in version 2.3. starts_with_bom() should be used - instead. -

-

- Checks whether a sequence of three octets is a UTF-8 byte order mark (BOM) -

-
-template <typename octet_iterator> 
-bool is_bom (octet_iterator it);  // Deprecated
-
-

- octet_iterator: an input iterator.
- it: beginning of the 3-octet sequence to check
- Return value: true if the sequence - is UTF-8 byte order mark; false if not. -

-

- Example of use: -

-
-unsigned char byte_order_mark[] = {0xef, 0xbb, 0xbf};
-bool bbom = is_bom(byte_order_mark);
-assert (bbom == true);
-
-

- 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. -

-

- If a sequence is - shorter than three bytes, an invalid iterator will be dereferenced. Therefore, this function is deprecated - in favor of starts_with_bom()that takes the end of sequence as an argument. -

-

- Types From utf8 Namespace -

-

utf8::exception -

-

- Available in version 2.3 and later. -

-

- Base class for the exceptions thrown by UTF CPP library functions. -

-
-class exception : public std::exception {};
-
-

- Example of use: -

-
-try {
-  code_that_uses_utf_cpp_library();
-}
-catch(const utf8::exception& utfcpp_ex) {
-  cerr << utfcpp_ex.what();
-}
-
- -

utf8::invalid_code_point -

-

- Available in version 1.0 and later. -

-

- Thrown by UTF8 CPP functions such as advance and next if an UTF-8 sequence represents and invalid code point. -

- -
-class invalid_code_point : public exception {
-public: 
-    uint32_t code_point() const;
-};
-
-
-

- Member function code_point() can be used to determine the invalid code point that - caused the exception to be thrown. -

-

utf8::invalid_utf8 -

-

- Available in version 1.0 and later. -

-

- Thrown by UTF8 CPP functions such as next and prior if an invalid UTF-8 sequence - is detected during decoding. -

- -
-class invalid_utf8 : public exception {
-public: 
-    uint8_t utf8_octet() const;
-};
-
- -

- Member function utf8_octet() can be used to determine the beginning of the byte - sequence that caused the exception to be thrown. -

- -

utf8::invalid_utf16 -

-

- Available in version 1.0 and later. -

-

- Thrown by UTF8 CPP function utf16to8 if an invalid UTF-16 sequence - is detected during decoding. -

- -
-class invalid_utf16 : public exception {
-public: 
-    uint16_t utf16_word() const;
-};
-
- -

- Member function utf16_word() can be used to determine the UTF-16 code unit - that caused the exception to be thrown. -

-

utf8::not_enough_room -

-

- Available in version 1.0 and later. -

-

- Thrown by UTF8 CPP functions such as next if the end of the decoded UTF-8 sequence - was reached before the code point was decoded. -

- -
-class not_enough_room : public exception {};
-
-

- utf8::iterator -

-

- Available in version 2.0 and later. -

-

- Adapts the underlying octet iterator to iterate over the sequence of code points, - rather than raw octets. -

-
-template <typename octet_iterator>
-class iterator;
-
- -
Member functions
-
-
iterator();
the deafult constructor; the underlying octet_iterator is - constructed with its default constructor. -
explicit iterator (const octet_iterator& octet_it, - const octet_iterator& range_start, - const octet_iterator& range_end);
a constructor - that initializes the underlying octet_iterator with octet_it - and sets the range in which the iterator is considered valid. -
octet_iterator base () const;
returns the - underlying octet_iterator. -
uint32_t operator * () const;
decodes the utf-8 sequence - the underlying octet_iterator is pointing to and returns the code point. -
bool operator == (const iterator& rhs) - const;
returns true - if the two underlaying iterators are equal. -
bool operator != (const iterator& rhs) - const;
returns true - if the two underlaying iterators are not equal. -
iterator& operator ++ ();
the prefix increment - moves - the iterator to the next UTF-8 encoded code point. -
iterator operator ++ (int);
- the postfix increment - moves the iterator to the next UTF-8 encoded code point and returns the current one. -
iterator& operator -- ();
the prefix decrement - moves - the iterator to the previous UTF-8 encoded code point. -
iterator operator -- (int);
- the postfix decrement - moves the iterator to the previous UTF-8 encoded code point and returns the current one. -
-

- Example of use: -

-
-char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
-utf8::iterator<char*> it(threechars, threechars, threechars + 9);
-utf8::iterator<char*> it2 = it;
-assert (it2 == it);
-assert (*it == 0x10346);
-assert (*(++it) == 0x65e5);
-assert ((*it++) == 0x65e5);
-assert (*it == 0x0448);
-assert (it != it2);
-utf8::iterator<char*> endit (threechars + 9, threechars, threechars + 9);  
-assert (++it == endit);
-assert (*(--it) == 0x0448);
-assert ((*it--) == 0x0448);
-assert (*it == 0x65e5);
-assert (--it == utf8::iterator<char*>(threechars, threechars, threechars + 9));
-assert (*it == 0x10346);
-
-

- The purpose of utf8::iterator 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 - utf8::next() and utf8::prior() functions. -

-

- Note that utf8::iterator 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 begin and end, i.e.: -

-
-std::string s = "example";
-utf8::iterator i (s.begin(), s.begin(), s.end());
-
-

- Functions From utf8::unchecked Namespace -

-

- utf8::unchecked::append -

-

- Available in version 1.0 and later. -

-

- Encodes a 32 bit code point as a UTF-8 sequence of octets and appends the sequence - to a UTF-8 string. -

-
-template <typename octet_iterator>
-octet_iterator append(uint32_t cp, octet_iterator result);
-   
-
-

- cp: A 32 bit integer representing a code point to append to the - sequence.
- result: An output iterator to the place in the sequence where to - append the code point.
- Return value: An iterator pointing to the place - after the newly appended sequence. -

-

- Example of use: -

-
-unsigned char u[5] = {0,0,0,0,0};
-unsigned char* end = unchecked::append(0x0448, u);
-assert (u[0] == 0xd1 && u[1] == 0x88 && u[2] == 0 && u[3] == 0 && u[4] == 0);
-
-

- This is a faster but less safe version of utf8::append. It does not - check for validity of the supplied code point, and may produce an invalid UTF-8 - sequence. -

-

- utf8::unchecked::next -

-

- Available in version 1.0 and later. -

-

- Given the iterator to the beginning of a UTF-8 sequence, it returns the code point - and moves the iterator to the next position. -

-
-template <typename octet_iterator>
-uint32_t next(octet_iterator& it);
-   
-
-

- it: 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.
- Return value: the 32 bit representation of the - processed UTF-8 code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars;
-int cp = unchecked::next(w);
-assert (cp == 0x65e5);
-assert (w == twochars + 3);
-
-

- This is a faster but less safe version of utf8::next. It does not - check for validity of the supplied UTF-8 sequence. -

-

- utf8::unchecked::peek_next -

-

- Available in version 2.1 and later. -

-

- Given the iterator to the beginning of a UTF-8 sequence, it returns the code point. -

-
-template <typename octet_iterator>
-uint32_t peek_next(octet_iterator it);
-   
-
-

- it: an iterator pointing to the beginning of an UTF-8 - encoded code point.
- Return value: the 32 bit representation of the - processed UTF-8 code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars;
-int cp = unchecked::peek_next(w);
-assert (cp == 0x65e5);
-assert (w == twochars);
-
-

- This is a faster but less safe version of utf8::peek_next. It does not - check for validity of the supplied UTF-8 sequence. -

-

- utf8::unchecked::prior -

-

- Available in version 1.02 and later. -

-

- 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. -

-
-template <typename octet_iterator>
-uint32_t prior(octet_iterator& it);
-   
-
-

- it: 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.
- Return value: the 32 bit representation of the - previous code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars + 3;
-int cp = unchecked::prior (w);
-assert (cp == 0x65e5);
-assert (w == twochars);
-
-

- This is a faster but less safe version of utf8::prior. It does not - check for validity of the supplied UTF-8 sequence and offers no boundary checking. -

-

- utf8::unchecked::previous (deprecated, see utf8::unchecked::prior) -

-

- Deprecated in version 1.02 and later. -

-

- 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. -

-
-template <typename octet_iterator>
-uint32_t previous(octet_iterator& it);
-   
-
-

- it: 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.
- Return value: the 32 bit representation of the - previous code point. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars + 3;
-int cp = unchecked::previous (w);
-assert (cp == 0x65e5);
-assert (w == twochars);
-
-

- The reason this function is deprecated is just the consistency with the "checked" - versions, where prior should be used instead of previous. - In fact, unchecked::previous behaves exactly the same as - unchecked::prior -

-

- This is a faster but less safe version of utf8::previous. It does not - check for validity of the supplied UTF-8 sequence and offers no boundary checking. -

-

- utf8::unchecked::advance -

-

- Available in version 1.0 and later. -

-

- Advances an iterator by the specified number of code points within an UTF-8 - sequence. -

-
-template <typename octet_iterator, typename distance_type>
-void advance (octet_iterator& it, distance_type n);
-   
-
-

- it: 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.
- n: a positive integer that shows how many code points we want to - advance.
-

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-char* w = twochars;
-unchecked::advance (w, 2);
-assert (w == twochars + 5);
-
-

- This function works only "forward". In case of a negative n, there is - no effect. -

-

- This is a faster but less safe version of utf8::advance. It does not - check for validity of the supplied UTF-8 sequence and offers no boundary checking. -

-

- utf8::unchecked::distance -

-

- Available in version 1.0 and later. -

-

- Given the iterators to two UTF-8 encoded code points in a seqence, returns the - number of code points between them. -

-
-template <typename octet_iterator>
-typename std::iterator_traits<octet_iterator>::difference_type distance (octet_iterator first, octet_iterator last);
-
-

- first: an iterator to a beginning of a UTF-8 encoded code point.
- last: 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.
- Return value the distance between the iterators, - in code points. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-size_t dist = utf8::unchecked::distance(twochars, twochars + 5);
-assert (dist == 2);
-
-

- This is a faster but less safe version of utf8::distance. It does not - check for validity of the supplied UTF-8 sequence. -

-

- utf8::unchecked::utf16to8 -

-

- Available in version 1.0 and later. -

-

- Converts a UTF-16 encoded string to UTF-8. -

-
-template <typename u16bit_iterator, typename octet_iterator>
-octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result);
-   
-
-

- start: an iterator pointing to the beginning of the UTF-16 encoded - string to convert.
- end: an iterator pointing to pass-the-end of the UTF-16 encoded - string to convert.
- result: an output iterator to the place in the UTF-8 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-8 string. -

-

- Example of use: -

-
-unsigned short utf16string[] = {0x41, 0x0448, 0x65e5, 0xd834, 0xdd1e};
-vector<unsigned char> utf8result;
-unchecked::utf16to8(utf16string, utf16string + 5, back_inserter(utf8result));
-assert (utf8result.size() == 10);    
-
-

- This is a faster but less safe version of utf8::utf16to8. It does not - check for validity of the supplied UTF-16 sequence. -

-

- utf8::unchecked::utf8to16 -

-

- Available in version 1.0 and later. -

-

- Converts an UTF-8 encoded string to UTF-16 -

-
-template <typename u16bit_iterator, typename octet_iterator>
-u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result);
-   
-
-

- start: an iterator pointing to the beginning of the UTF-8 encoded - string to convert. < br /> end: an iterator pointing to - pass-the-end of the UTF-8 encoded string to convert.
- result: an output iterator to the place in the UTF-16 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-16 string. -

-

- Example of use: -

-
-char utf8_with_surrogates[] = "\xe6\x97\xa5\xd1\x88\xf0\x9d\x84\x9e";
-vector <unsigned short> utf16result;
-unchecked::utf8to16(utf8_with_surrogates, utf8_with_surrogates + 9, back_inserter(utf16result));
-assert (utf16result.size() == 4);
-assert (utf16result[2] == 0xd834);
-assert (utf16result[3] == 0xdd1e);
-
-

- This is a faster but less safe version of utf8::utf8to16. It does not - check for validity of the supplied UTF-8 sequence. -

-

- utf8::unchecked::utf32to8 -

-

- Available in version 1.0 and later. -

-

- Converts a UTF-32 encoded string to UTF-8. -

-
-template <typename octet_iterator, typename u32bit_iterator>
-octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result);
-   
-
-

- start: an iterator pointing to the beginning of the UTF-32 encoded - string to convert.
- end: an iterator pointing to pass-the-end of the UTF-32 encoded - string to convert.
- result: an output iterator to the place in the UTF-8 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-8 string. -

-

- Example of use: -

-
-int utf32string[] = {0x448, 0x65e5, 0x10346, 0};
-vector<unsigned char> utf8result;
-utf32to8(utf32string, utf32string + 3, back_inserter(utf8result));
-assert (utf8result.size() == 9);
-
-

- This is a faster but less safe version of utf8::utf32to8. It does not - check for validity of the supplied UTF-32 sequence. -

-

- utf8::unchecked::utf8to32 -

-

- Available in version 1.0 and later. -

-

- Converts a UTF-8 encoded string to UTF-32. -

-
-template <typename octet_iterator, typename u32bit_iterator>
-u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result);
-   
-
-

- start: an iterator pointing to the beginning of the UTF-8 encoded - string to convert.
- end: an iterator pointing to pass-the-end of the UTF-8 encoded string - to convert.
- result: an output iterator to the place in the UTF-32 string where to - append the result of conversion.
- Return value: An iterator pointing to the place - after the appended UTF-32 string. -

-

- Example of use: -

-
-char* twochars = "\xe6\x97\xa5\xd1\x88";
-vector<int> utf32result;
-unchecked::utf8to32(twochars, twochars + 5, back_inserter(utf32result));
-assert (utf32result.size() == 2);
-
-

- This is a faster but less safe version of utf8::utf8to32. It does not - check for validity of the supplied UTF-8 sequence. -

-

- Types From utf8::unchecked Namespace -

-

- utf8::iterator -

-

- Available in version 2.0 and later. -

-

- Adapts the underlying octet iterator to iterate over the sequence of code points, - rather than raw octets. -

-
-template <typename octet_iterator>
-class iterator;
-
- -
Member functions
-
-
iterator();
the deafult constructor; the underlying octet_iterator is - constructed with its default constructor. -
explicit iterator (const octet_iterator& octet_it); -
a constructor - that initializes the underlying octet_iterator with octet_it -
octet_iterator base () const;
returns the - underlying octet_iterator. -
uint32_t operator * () const;
decodes the utf-8 sequence - the underlying octet_iterator is pointing to and returns the code point. -
bool operator == (const iterator& rhs) - const;
returns true - if the two underlaying iterators are equal. -
bool operator != (const iterator& rhs) - const;
returns true - if the two underlaying iterators are not equal. -
iterator& operator ++ ();
the prefix increment - moves - the iterator to the next UTF-8 encoded code point. -
iterator operator ++ (int);
- the postfix increment - moves the iterator to the next UTF-8 encoded code point and returns the current one. -
iterator& operator -- ();
the prefix decrement - moves - the iterator to the previous UTF-8 encoded code point. -
iterator operator -- (int);
- the postfix decrement - moves the iterator to the previous UTF-8 encoded code point and returns the current one. -
-

- Example of use: -

-
-char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
-utf8::unchecked::iterator<char*> un_it(threechars);
-utf8::unchecked::iterator<char*> un_it2 = un_it;
-assert (un_it2 == un_it);
-assert (*un_it == 0x10346);
-assert (*(++un_it) == 0x65e5);
-assert ((*un_it++) == 0x65e5);
-assert (*un_it == 0x0448);
-assert (un_it != un_it2);
-utf8::::unchecked::iterator<char*> un_endit (threechars + 9);  
-assert (++un_it == un_endit);
-assert (*(--un_it) == 0x0448);
-assert ((*un_it--) == 0x0448);
-assert (*un_it == 0x65e5);
-assert (--un_it == utf8::unchecked::iterator<char*>(threechars));
-assert (*un_it == 0x10346);
-
-

- This is an unchecked version of utf8::iterator. It is faster in many cases, but offers - no validity or range checks. -

-

- Points of interest -

-

- Design goals and decisions -

-

- The library was designed to be: -

-
    -
  1. - 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. -
  2. -
  3. - 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. -
  4. -
  5. - Lightweight: follow the "pay only for what you use" guideline. -
  6. -
  7. - Unintrusive: avoid forcing any particular design or even programming style on the - user. This is a library, not a framework. -
  8. -
-

- Alternatives -

-

- 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: -

-
    -
  1. - ICU Library. 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. -
  2. -
  3. - C++11 language and library features. Still far from complete, and not widely - supported by compiler vendors. -
  4. -
  5. - Glib::ustring. - A class specifically made to work with UTF-8 strings, and also feel like - std::string. 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. -
  6. -
  7. - 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. -
  8. -
- -
    -
  1. - The Unicode Consortium. -
  2. -
  3. - ICU Library. -
  4. -
  5. - UTF-8 at Wikipedia -
  6. -
  7. - UTF-8 and Unicode FAQ for - Unix/Linux -
  8. -
- - diff --git a/thirdparty/assimp/include/assimp/BaseImporter.h b/thirdparty/assimp/include/assimp/BaseImporter.h index ad8a3dafd86..7cf8351742f 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 4c3f5a437b4..d0d94a6ebd4 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 d005e5c119d..30d9b1ac3c8 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 3f14c471a83..7af78b61ce3 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 1266d1de116..01a118ba354 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 c6d382c1b5f..05780def7c3 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 46f6d447c50..75dd97e7f4a 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 1946e250a68..789072a7c14 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 be3e2fafd6d..959e4b1fb8c 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 6bb6ce1e39f..dcd5e2b2e8c 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 { {\ 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()();\ + } catch(...) {\ + ASSIMP_END_EXCEPTION_REGION_errorString = "Unknown exception";\ + return ExceptionSwallower()();\ + }\ +} + #define ASSIMP_END_EXCEPTION_REGION(type)\ } catch(...) {\ return ExceptionSwallower()();\ diff --git a/thirdparty/assimp/include/assimp/Exporter.hpp b/thirdparty/assimp/include/assimp/Exporter.hpp index 2612e1f9d27..dc6661c11b1 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 7796d595b89..30f4988f909 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 90564407897..7c360b47483 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 39932cd9496..c3271d007ae 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 97c84b23e2e..6ca9be84a7f 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 f1fb3b0c277..291cd938f66 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 bf449a9a257..df52471a910 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 6c1097bb6d8..869585d92b2 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 bcead78dd3d..2265ff19c8a 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 d0281e2d026..243f13ee64b 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 89cade6c336..a0b798564ec 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 b6c5872a72a..1880ce0a982 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 5598d4fc5f9..2ad80cc850e 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 c45d01bd48e..7effca83a4d 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 30256012460..736952e2663 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 624029be998..ee6c5545ffa 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 8991a646180..45d3f57cd1a 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 f129420535c..5bb958257f9 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 fdb5ce81745..9afe38f85f3 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 0683c1e052e..40aad08903c 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 ad979a33fa3..8e1a9830f5d 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 c1a93947f16..5d37f1bb5a7 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 37ea083dbee..417ca4312af 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 9f935431508..c2d8bbbf8d1 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 c594cb63f4c..79bdae8592d 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 cb24f1595b2..4cad96f6ef9 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 489e8adfe33..de889b9f001 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 d3ca3e97143..d7b8972e360 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 af481f819ea..31410a9fb25 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 e9450267ecd..9a8bb9fd3df 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 6227e42c520..3c6ca66c659 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 5e63db5fe4a..5d4242cbd36 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 95f12cdebff..8458513081b 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 83bb62256b4..27a142c8e40 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 2b32b01d3ed..f430e4ad38e 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 e208b11adb1..a7af1034f64 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 adb749ff590..2001a9354ee 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 cbc0253d50b..959d4377ee3 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 be90999d877..627c700ad62 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 66b1c9a174e..dab60584bfa 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 fa86128f4f7..505a3510cec 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 d4a2a98109c..964b8fbf9eb 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 00000000000..f3f7d170ae6 --- /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 similarity index 81% rename from thirdparty/assimp/assimp/config.h rename to thirdparty/assimp/include/assimp/config.h index d0e48173495..ae487e7d244 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 @@ -500,14 +518,6 @@ enum aiComponent { // Everything baked together -> default value #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.
* 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.
* 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 3a6379bf40f..e2f2a388805 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. @@ -695,6 +695,73 @@ enum aiComponent #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 * diff --git a/thirdparty/assimp/include/assimp/defs.h b/thirdparty/assimp/include/assimp/defs.h index 6f2f8ae88b1..8e300e96849 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 0a6919c1ae2..e0f22a9d64e 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 bdb2368c4f4..84f2f7d0ab8 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 19a7c69709a..75695e50b33 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 8ae6b88d3e3..7591344418b 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 2c26cf92bbd..f9880ab9e30 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 1ce8c9691c2..b11e036b104 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 8fc216f6697..456d285e623 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 84079974f75..e8a3c53054d 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 fbf2a857ad7..8fd8c7f8792 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 849d90f4852..bddd04b1e8d 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 892a6347f71..cac4ab56b20 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 41d80048772..01505d5716b 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 4b6732e80a7..9997f0d6014 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 06780da5b8c..5ca80601d68 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 ae45959b412..fd9abfd2187 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 3ce514d1bbb..e8bdb9aeb8d 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 b76709eb15a..93d04eee67d 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 0867659f469..5a448643118 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 e32cae331ca..1f47dad8fc1 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 c8b1ebbbc24..a23e32e6334 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 4bbf432ff8f..19dbce291af 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 fffeb12ad74..8d3c82cf89b 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 6682d3b32c9..2765115a2fc 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 2fdd37a43c3..6709eaf39cc 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 @@ -62,6 +62,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 diff --git a/thirdparty/assimp/code/revision.h b/thirdparty/assimp/revision.h similarity index 85% rename from thirdparty/assimp/code/revision.h rename to thirdparty/assimp/revision.h index 66eb875303f..d180e5f1ab4 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