@@ -4,8 +4,6 @@ A library to import and export various 3d-model-formats including scene-post-pro
### Current project status ###
### Current project status ###
[](https://opencollective.com/assimp)
[](https://opencollective.com/assimp)
@@ -18,13 +16,16 @@ A library to import and export various 3d-model-formats including scene-post-pro
<br>
<br>
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
-
-[Check the latest doc](https://assimp-docs.readthedocs.io/en/latest/).
-
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
Additionally, assimp features various __mesh post processing tools__: normals and tangent space generation, triangulation, vertex cache locality optimization, removal of degenerate primitives and duplicate vertices, sorting by primitive type, merging of redundant materials and many more.
-This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases).
+### Latest Doc's ###
+Please check the latest documents at [Asset-Importer-Lib-Doc](https://assimp-docs.readthedocs.io/en/latest/).
+### Get involved ###
+This is the development repo containing the latest features and bugfixes. For productive use though, we recommend one of the stable releases available from [Github Assimp Releases](https://github.com/assimp/assimp/releases).
+<br>
+You find a bug in the docs? Use [Doc-Repo](https://github.com/assimp/assimp-docs).
+<br>
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
Please check our Wiki as well: https://github.com/assimp/assimp/wiki
If you want to check our Model-Database, use the following repo: https://github.com/assimp/assimp-mdb
If you want to check our Model-Database, use the following repo: https://github.com/assimp/assimp-mdb
@@ -72,7 +73,7 @@ The source code is organized in the following way:
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
(CHMs for Windows are included in some release packages and should be located right here in the root folder).
-If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
+If the docs don't solve your problem, ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
- message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
- if(!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsFloat. No data, seems file is corrupt.");
- if(mReader->getNodeType() != irr::io::EXN_TEXT) throw DeadlyImportError("XML_ReadNode_GetVal_AsFloat. Invalid type of XML element, seems file is corrupt.");
- if(!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsU32. No data, seems file is corrupt.");
- if(mReader->getNodeType() != irr::io::EXN_TEXT) throw DeadlyImportError("XML_ReadNode_GetVal_AsU32. Invalid type of XML element, seems file is corrupt.");
- if (!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsFloat. No data, seems file is corrupt.");
- if (mReader->getNodeType() != irr::io::EXN_TEXT) throw DeadlyImportError("XML_ReadNode_GetVal_AsFloat. Invalid type of XML element, seems file is corrupt.");
- if (!mReader->read()) throw DeadlyImportError("XML_ReadNode_GetVal_AsU32. No data, seems file is corrupt.");
- if (mReader->getNodeType() != irr::io::EXN_TEXT) throw DeadlyImportError("XML_ReadNode_GetVal_AsU32. Invalid type of XML element, seems file is corrupt.");
- /// Find texture in list of converted textures. Use at postprocessing step,
- /// \param [in] pID_R - ID of source "red" texture.
- /// \param [in] pID_G - ID of source "green" texture.
- /// \param [in] pID_B - ID of source "blue" texture.
- /// \param [in] pID_A - ID of source "alpha" texture. Use empty string to find RGB-texture.
- /// \param [out] pConvertedTextureIndex - pointer where index in list of found texture will be written. If equivalent to nullptr then nothing will be
- /// written.
- /// \return true - if the texture is found, else - false.
- /// Get data stored in <vertices> and place it to arrays.
- /// \param [in] pNodeElement - reference to node element which kept <object> data.
- /// \param [in] pVertexCoordinateArray - reference to vertices coordinates kept in <vertices>.
- /// \param [in] pVertexColorArray - reference to vertices colors for all <vertex's. If color for vertex is not set then corresponding member of array
- /// Return converted texture ID which related to specified source textures ID's. If converted texture does not exist then it will be created and ID on new
- /// converted texture will be returned. Conversion: set of textures from \ref CAMFImporter_NodeElement_Texture to one \ref SPP_Texture and place it
- /// to converted textures list.
- /// Any of source ID's can be absent(empty string) or even one ID only specified. But at least one ID must be specified.
- /// \param [in] pID_R - ID of source "red" texture.
- /// \param [in] pID_G - ID of source "green" texture.
- /// \param [in] pID_B - ID of source "blue" texture.
- /// \param [in] pID_A - ID of source "alpha" texture.
- /// \return index of the texture in array of the converted textures.
- /// Separate input list by texture IDs. This step is needed because aiMesh can contain mesh which is use only one texture (or set: diffuse, bump etc).
- /// \param [in] pInputList - input list with faces. Some of them can contain color or texture mapping, or both of them, or nothing. Will be cleared after
- /// processing.
- /// \param [out] pOutputList_Separated - output list of the faces lists. Separated faces list by used texture IDs. Will be cleared before processing.
- /// \param [in] pNodeElement - reference to node element which kept <mesh> data.
- /// \param [in] pVertexCoordinateArray - reference to vertices coordinates for all <volume>'s.
- /// \param [in] pVertexColorArray - reference to vertices colors for all <volume>'s. If color for vertex is not set then corresponding member of array
- /// contain nullptr.
- /// \param [in] pObjectColor - pointer to colors for <object>. If color is not set then argument contain nullptr.
- /// \param [in] pMaterialList - reference to a list with defined materials.
- /// \param [out] pMeshList - reference to a list with all aiMesh of the scene.
- /// \param [out] pSceneNode - reference to aiNode which will own new aiMesh's.
+ using AMFMetaDataArray = std::vector<AMFMetadata*>;
+ using MeshArray = std::vector<aiMesh*>;
+ using NodeArray = std::vector<aiNode*>;
+
+ /// Clear all temporary data.
+ void Clear();
+
+ /// Get data stored in <vertices> and place it to arrays.
+ /// \param [in] pNodeElement - reference to node element which kept <object> data.
+ /// \param [in] pVertexCoordinateArray - reference to vertices coordinates kept in <vertices>.
+ /// \param [in] pVertexColorArray - reference to vertices colors for all <vertex's. If color for vertex is not set then corresponding member of array
+ /// Return converted texture ID which related to specified source textures ID's. If converted texture does not exist then it will be created and ID on new
+ /// converted texture will be returned. Conversion: set of textures from \ref CAMFImporter_NodeElement_Texture to one \ref SPP_Texture and place it
+ /// to converted textures list.
+ /// Any of source ID's can be absent(empty string) or even one ID only specified. But at least one ID must be specified.
+ /// \param [in] pID_R - ID of source "red" texture.
+ /// \param [in] pID_G - ID of source "green" texture.
+ /// \param [in] pID_B - ID of source "blue" texture.
+ /// \param [in] pID_A - ID of source "alpha" texture.
+ /// \return index of the texture in array of the converted textures.
+ /// Separate input list by texture IDs. This step is needed because aiMesh can contain mesh which is use only one texture (or set: diffuse, bump etc).
+ /// \param [in] pInputList - input list with faces. Some of them can contain color or texture mapping, or both of them, or nothing. Will be cleared after
+ /// processing.
+ /// \param [out] pOutputList_Separated - output list of the faces lists. Separated faces list by used texture IDs. Will be cleared before processing.
+ /// \param [in] pNodeElement - reference to node element which kept <mesh> data.
+ /// \param [in] pVertexCoordinateArray - reference to vertices coordinates for all <volume>'s.
+ /// \param [in] pVertexColorArray - reference to vertices colors for all <volume>'s. If color for vertex is not set then corresponding member of array
+ /// contain nullptr.
+ /// \param [in] pObjectColor - pointer to colors for <object>. If color is not set then argument contain nullptr.
+ /// \param [in] pMaterialList - reference to a list with defined materials.
+ /// \param [out] pMeshList - reference to a list with all aiMesh of the scene.
+ /// \param [out] pSceneNode - reference to aiNode which will own new aiMesh's.
- if (root_el == nullptr) throw DeadlyImportError("Root(<amf>) element not found.");
+ if (root_el == nullptr) {
+ throw DeadlyImportError("Root(<amf>) element not found.");
+ }
// after that walk through children of root and collect data. Five types of nodes can be placed at top level - in <amf>: <object>, <material>, <texture>,
// after that walk through children of root and collect data. Five types of nodes can be placed at top level - in <amf>: <object>, <material>, <texture>,
// <constellation> and <metadata>. But at first we must read <material> and <texture> because they will be used in <object>. <metadata> can be read
// <constellation> and <metadata>. But at first we must read <material> and <texture> because they will be used in <object>. <metadata> can be read
- if (!ReadScope(output_tokens, input, cursor, input + length, is64bits)) {
- break;
+ try
+ {
+ while (cursor < end ) {
+ if (!ReadScope(output_tokens, input, cursor, input + length, is64bits)) {
+ break;
+ }
+ }
+ }
+ catch (const DeadlyImportError& e)
+ {
+ if (!is64bits && (length > std::numeric_limits<std::uint32_t>::max())) {
+ throw DeadlyImportError("The FBX file is invalid. This may be because the content is too big for this older version (", to_string(version), ") of the FBX format. (", e.what(), ")");