Commit Graph

125 Commits (master)

Author SHA1 Message Date
Marc 656b0b25d8
Fix warning for array comparison
The code previously compared two float arrays with the != operator. This is deprecated in Visual Studio 2019 and results in a warning that leads to an error when compiling with warnings as errors. Small fix to make the build work.
2021-10-05 19:24:42 +02:00
diharaw addd541251 Added gltf2 KHR_materials_ior support. 2021-09-30 08:47:53 +01:00
diharaw 200bf8df7a Added gltf2 KHR_materials_volume import support. 2021-09-29 17:05:17 +01:00
Kim Kulling 0fef0e1101 Move duplicate code to glFT common header. 2021-09-14 20:45:36 +02:00
Kim Kulling 18531e3677 Next iteration for c++11 features. 2021-09-13 22:38:20 +02:00
Max Vollmer (Microsoft Havok) bf8e36ae28 Fixed typo 2021-09-02 10:07:28 +01:00
Max Vollmer (Microsoft Havok) 72ea80b41f Revert last change (gltf2::Ref type is not a pointer and has a bool() operator) 2021-09-02 10:00:56 +01:00
Kim Kulling d710d0700f
Make nullptr test more explicit. 2021-09-02 10:10:42 +02:00
Max Vollmer (Microsoft Havok) 4c86772091 Added another nullptr safety check 2021-09-02 08:27:03 +01:00
Kim Kulling df739f00dd
Merge branch 'master' into issue_3398 2021-08-28 13:56:50 +02:00
Max Vollmer (Microsoft Havok) c1e830cf3b The GLTF2 specs aren't very specific about the restrictions of the number of keyframes in sampler input and output. It seems logical that they should be the same, but there is an official sample model from Khronos where output has more keyframes. I thus assume that the GLTF2 standard allows more keyframes in output, but not in input. Fixed the check accordingly. 2021-08-13 17:46:10 +01:00
Max Vollmer (Microsoft Havok) de2f5cf021 Crash fixes 2021-08-13 16:26:42 +01:00
Kim Kulling 4b1ff645e3 closes https://github.com/assimp/assimp/issues/3398: Add support for embedded textures 2021-08-12 21:13:07 +02:00
Krishty bb53961fa9 more range-based for
f6b4370f6a and 7c822f23bd introduced raw loops on data types with heavy nesting; range-based for suits better here
2021-07-29 14:57:25 +02:00
Promit Roy 90c115cb3f
Merge branch 'master' into promit/gltf-extras 2021-07-02 00:38:00 -04:00
Promit Roy 7c822f23bd Added support for custom properties ("extras") in glTF2 2021-06-27 00:53:40 -04:00
Jerome St-Louis 0e41efb050 glTF2: Improved support for AI_MATKEY_OPACITY
- Exporter: Writing opacity to pbrMetallicRoughness.baseColorFactor[3] even when alphaMode is set
- Importer: Setting AI_MATKEY_OPACITY from pbrMetallicRoughness.baseColorFactor[3]
2021-06-24 13:27:29 -04:00
Evangel63 e736538df3
Merge branch 'master' into master 2021-06-23 13:45:23 +10:00
RichardTea 985f3ee665 Fix glTFv2 texcoord/uv mapping
Use the standard property to indicate the UV map index
2021-06-14 15:11:41 +01:00
RichardTea fb039bb9eb Add glTFv2 Clearcoat import/export tests
Uses Clearcoat model from Khronos
2021-06-14 15:11:41 +01:00
RichardTea 4a66ec25d0 Standardise Clearcoat, Sheen and Transmission
Also cleanup glTFv2 defaults, don't import/export if disabled
2021-06-14 15:11:41 +01:00
RichardTea 4476352882 First pass at simplifying glTFv2 PBR
Removed 'core' set of GLTF-specific properties
2021-06-14 15:11:41 +01:00
Evangel 3de20af3cc Renamed glTF2::Object::extensions to customExtensions to avoid shadowing in other subclasses. 2021-06-12 13:16:53 +10:00
Evangel 36c8cdf3de Add scene metadata for glTF2 files as allowed by the glTF2 specification. 2021-06-12 11:44:28 +10:00
Kim Kulling 6b8a00dfa1
Merge branch 'master' into wangyi_basisu 2021-05-25 17:17:07 +02:00
Kim Kulling b5e54e4d3b
Merge branch 'master' into wangyi_basisu 2021-05-25 16:17:29 +02:00
Kim Kulling faeae27923
Merge branch 'master' into importer_fixes_followup 2021-05-25 16:15:09 +02:00
Malcolm Tyrrell 4ec01cfdcd Improve use of logging 2021-05-13 12:05:31 +01:00
Malcolm Tyrrell 5cd3bdd5c2 No need to distinguish formatting log functions. 2021-05-13 10:25:27 +01:00
ywang a19b708144 support both ktx and ktx2 2021-05-07 16:27:23 -07:00
ywang 2b9d88c943 support basis universal 2021-05-06 15:10:06 -07:00
Max Vollmer (Microsoft Havok) 153b890b02 Prevent accessing nullpointers 2021-05-05 14:09:43 +01:00
Krishty b79b84d34e Merge branch 'master' into new-file-detection 2021-05-05 00:09:42 +02:00
Max Vollmer (Microsoft Havok) e1d6e1f377
Merge branch 'master' into ms-maxvollmer/importer_fixes 2021-04-26 14:53:32 +01:00
Krishty b00de10eb3 Simplified importer search and fixed a few bugs
The search for a matching importer had a few issues, see #3791. There were two different mechanisms to determine whether an importer accepts a specific file extension:
1. `aiImporterDesc::mFileExtensions`, which was forwarded to the UI via `BaseImporter::GetExtensionList()`.
2. `BaseImporter::CanRead()` when called with `checkSig == false`, which determines whether to actually use that importer.
Both were redundant and got out of sync repeatedly. I removed 2. completely and replaced it with 1., thereby syncing UI/import and shortening all `BaseImporter::CanRead()` implementations.

Further bugfixes:
- fixed glTF2 importer throwing exceptions when checking whether it can load a file
- removed `BaseImporter::SimpleExtensionCheck()` because it is no longer used and had a bug with case sensitivity

Since the `checkSig` parameter in `BaseImporter::CanRead()` is now useless, it can be removed completely. I’m not sure if this would break ABI compatiblity, so I’ll submit it with a later pull request.
2021-04-24 00:17:50 +02:00
Max Vollmer (Microsoft Havok) 746d5cf964 * Throw instead of assert on invalid file input
* Check JSON object type before accessing members
* Ensure samplers input and output references are set before accessing them
2021-04-21 16:17:03 +01:00
Krishty 6cbeca5518 fixed glTF export stuff being pulled into the EXE even if building with ASSIMP_BUILD_NO_EXPORT
“LazyDictBase::WriteObjects()” in the two glTF implementations is only used for export. Since it’s a virtual method, and many compilers have trouble removing unreferenced virtual methods, glTF export stuff is pulled into the binary even if compiling without exports.

This commit removes said virtual function if only compiling for import.

This removes 75 KiB of useless code when compiled with Visual Studio for x64.
2021-04-16 20:44:40 +02:00
Malcolm Tyrrell d94ddd32b1 Extra check. Better logging. 2021-03-24 11:04:39 +00:00
Malcolm Tyrrell add165c4a1 Check target sizes to avoid reading beyond allocation 2021-03-24 10:55:40 +00:00
Kim Kulling c669c8f1eb
Merge branch 'master' into update_copyrights 2021-02-28 12:18:41 +01:00
Kim Kulling 9e8dbd0ca5 Update copyrights to 2021. 2021-02-28 12:17:54 +01:00
Max Vollmer (Microsoft Havok) eef03c1f17 Improved warnings 2021-02-24 14:28:18 +00:00
Max Vollmer (Microsoft Havok) facb7da701 Check that normal count and tangent count matches vertex count. Ignore data and warn if counts don't match. 2021-02-24 14:19:29 +00:00
Maki 6d13fd6aa2 Fix glTF vertex colors with types other than float 2021-01-15 02:56:45 +00:00
Danny-Kint 07b59f539d
Merge branch 'master' into dev/gltf-KHR_materials 2020-12-28 08:48:54 +01:00
Danny Kabrane 2b097c1e73 Add KHR_materials_transmission during import 2020-12-23 10:43:01 +01:00
Danny Kabrane f8c63d874b support KHR_materials_clearcoat during import 2020-12-23 08:12:09 +01:00
Danny Kabrane 0fdda99ea1 add underscore (MATERIAL_SHEEN instead of MATERIALSHEEN) 2020-12-21 14:33:35 +01:00
Danny Kabrane 63b0a97369 import KHR_materials_sheen 2020-12-20 07:59:12 +01:00
Max Vollmer 6ed1488e6e * Improved error messages
* Throw instead of asserts on invalid file input
2020-11-30 15:04:06 +00:00
Kim Kulling 4590f06756
Merge branch 'master' into master 2020-11-25 16:57:49 +01:00
Evangel 98e42e22b8 Added check around setting pScene->mName from asset.scene. 2020-11-22 15:49:41 +10:00
Evangel 67abcb10ba Added mName to aiScene. Primarily to provide access to the "name" member of glTF2 scenes. 2020-11-22 15:33:31 +10:00
Inho Lee e3083c21f0 glTF2: import correct animation values for CUBICSPLINE
CUBICSPLINE interpolation has tangent values with the animation data.
Current import don't care this interpolation type but it will help not
to fetch tangent values instead of animation data.

Note: Assimp cannot support interpolation types yet.
2020-11-17 17:21:07 +01:00
Inho Lee 8845d7eed3 Prevent to generate redundant morph targets for glTF2 2020-11-11 20:49:22 +01:00
Inho Lee ad7f8910e9 Rollback the method to handle empty bones for GLTF2
A patch made the assimp to ignore empty bones.
However, some assets can have bones which don't have weights
but are connected to other bones.
2020-10-16 17:09:17 +02:00
Malcolm Tyrrell b7c789da67 Stop concatenating std::strings. Use formatter. 2020-08-18 17:35:08 +01:00
Kim Kulling 0f442b1ff2
Merge branch 'master' into gltfIndexOutOfRangeFix 2020-07-23 11:27:34 +02:00
Malcolm Tyrrell 04df5f8b1e Don't use make_unique 2020-07-15 15:47:25 +01:00
Malcolm Tyrrell e1bab44e19 Exception safety 2020-07-15 15:02:27 +01:00
Malcolm Tyrrell 37e1fb9cd7 Fix message 2020-07-15 14:19:13 +01:00
Malcolm Tyrrell f3170a96ba Ensure data does not depend on faces we may not have created. 2020-07-15 12:36:48 +01:00
Malcolm Tyrrell fff6396e3c Rename to avoid overloading problems. 2020-07-15 12:22:28 +01:00
Malcolm Tyrrell 212903e935 Unit test for all indices out of range, and fix. 2020-07-15 12:19:00 +01:00
Malcolm Tyrrell c0d978786e Fix warning 2020-07-15 09:12:52 +01:00
Malcolm Tyrrell a56134ba33 Drop faces when indices are out of range. 2020-07-15 09:05:09 +01:00
Max Vollmer abf43eaf74 * Added ASSIMP_BUILD_NO_GLTF1_IMPORTER, ASSIMP_BUILD_NO_GLTF2_IMPORTER, ASSIMP_BUILD_NO_GLTF1_EXPORTER, and ASSIMP_BUILD_NO_GLTF2_EXPORTER to allow disabling GLTF1 and GLTF2 independently.
* ASSIMP_BUILD_NO_GLTF_IMPORTER and ASSIMP_BUILD_NO_GLTF_EXPORTER remain with same behavior as before
2020-07-05 19:22:31 +01:00
Evangel 6d85280c8d Added bool, removed unused debug parameter 2020-06-27 12:53:26 +10:00
Evangel f6b4370f6a Added arbitrary recursive metadata to allow for glTF2's extensions to be properly represented.
Primary changes are to include/assimp/metadata.h, adding in the aiMetadata GetAiType function,
adding the operator= to allow an aiMetadata type to be assigned, adding a check for the
AI_AIMETADATA type flag as it can't be trivially memcpy'd.

operator= is implemented with a by-value argument as then the copy is made by the copy
constructor and we can just swap everything out and let the destructor handle the mess.

Implemented parsing of the "extensions" flag on all glTF2 Nodes. Doesn't use the ReadValue
helper function on numbers as it did not seem to fill out the Nullable structure properly.
2020-06-26 14:28:41 +10:00
kimkulling f938a6b744 fix leak: just ignore broken texture coordinates. 2020-06-12 14:52:02 +02:00
Paul Arden 9e46f9751f Check for invalid texture coordinate accessor. Fixes #3269. 2020-06-09 15:49:38 +10:00
Malcolm Tyrrell 2ffd1cb8db nits 2020-05-15 17:22:15 +01:00
Malcolm Tyrrell bcca3a0d79 No need for bespoke macros 2020-05-15 17:22:02 +01:00
Malcolm Tyrrell 6be0ce1ec9 Initial pass at adding logging 2020-05-15 17:21:45 +01:00
Kim Kulling f8e6512a63 Move format importer and exporter into its won folder. 2020-05-02 15:14:38 +02:00