From 020554e213365e009f5455ae3572bb0ae10026eb Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 14 Oct 2023 11:19:19 +0200 Subject: [PATCH 1/6] Update Readme.md - Fix typos - Remove deprecated badges - Add the new experimental viewer --- Readme.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Readme.md b/Readme.md index 9a8ac7c33..a740be772 100644 --- a/Readme.md +++ b/Readme.md @@ -6,20 +6,14 @@ Open Asset Import Library is a library to load various 3d file formats into a sh ### Current project status ### [![Financial Contributors on Open Collective](https://opencollective.com/assimp/all/badge.svg?label=financial+contributors)](https://opencollective.com/assimp) ![C/C++ CI](https://github.com/assimp/assimp/workflows/C/C++%20CI/badge.svg) - - Coverity Scan Build Status - [![Codacy Badge](https://app.codacy.com/project/badge/Grade/9973693b7bdd4543b07084d5d9cf4745)](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade) - -[![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master) [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Percentage of issues still open")
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. -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. ### Latest Doc's ### Please check the latest documents at [Asset-Importer-Lib-Doc](https://assimp-docs.readthedocs.io/en/latest/). @@ -58,20 +52,21 @@ Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file. ### Other tools ### [open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities. +[Assimp-Viewer(]https://github.com/assimp/assimp_view) is an experimental implementation for an Asset-Viewer based on ImGUI and Assimp (experimental). #### Repository structure #### -Open Asset Import Library is implemented in C++. The directory structure looks like: +Open Asset Import Library is implemented in C++. The directory structure looks like this: /code Source code /contrib Third-party libraries /doc Documentation (doxysource and pre-compiled docs) - /fuzz Contains the test-code for the Google-Fuzzer project + /fuzz Contains the test code for the Google Fuzzer project /include Public header C and C++ header files - /scripts Scripts used to generate the loading code for some formats + /scripts Scripts are used to generate the loading code for some formats /port Ports to other languages and scripts to maintain those. /test Unit- and regression tests, test suite of models /tools Tools (old assimp viewer, command line `assimp`) - /samples A small number of samples to illustrate possible use-cases for Assimp + /samples A small number of samples to illustrate possible use cases for Assimp The source code is organized in the following way: @@ -79,9 +74,9 @@ The source code is organized in the following way: code/CApi Special implementations which are only used for the C-API code/Geometry A collection of geometry tools code/Material The material system - code/PBR An exporter for physical based models + code/PBR An exporter for physical-based models code/PostProcessing The post-processing steps - code/AssetLib/ Implementation for import and export for the format + code/AssetLib/ Implementation for import and export of the format ### Contributing ### Contributions to assimp are highly appreciated. The easiest way to get involved is to submit @@ -118,4 +113,4 @@ and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you ma For the legal details, see the `LICENSE` file. ### Why this name ### -Sorry, we're germans :-), no english native speakers ... +Sorry, we're germans :-), no English native speakers ... From 945c77d699c0911fabff1e1264e86010b91d0707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mar=C4=8Dinkovi=C4=87?= Date: Thu, 9 Feb 2023 12:23:43 +0100 Subject: [PATCH 2/6] Fix double free when the mesh contains duplicate bones. --- include/assimp/mesh.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/assimp/mesh.h b/include/assimp/mesh.h index 3ef94e606..45f50d5a5 100644 --- a/include/assimp/mesh.h +++ b/include/assimp/mesh.h @@ -59,6 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #ifdef __cplusplus +#include + extern "C" { #endif @@ -872,11 +874,15 @@ struct aiMesh { // DO NOT REMOVE THIS ADDITIONAL CHECK if (mNumBones && mBones) { + std::unordered_set bones; for (unsigned int a = 0; a < mNumBones; a++) { if (mBones[a]) { - delete mBones[a]; + bones.insert(mBones[a]); } } + for (const aiBone *bone: bones) { + delete bone; + } delete[] mBones; } From 1169d3bc8cdd3a8c1abfce90491c57e0186ed4cc Mon Sep 17 00:00:00 2001 From: julianknodt Date: Mon, 23 Oct 2023 22:14:18 -0700 Subject: [PATCH 3/6] Fix spelling error --- code/AssetLib/IFC/IFCOpenings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/IFC/IFCOpenings.cpp b/code/AssetLib/IFC/IFCOpenings.cpp index 48b843aa1..c47446dda 100644 --- a/code/AssetLib/IFC/IFCOpenings.cpp +++ b/code/AssetLib/IFC/IFCOpenings.cpp @@ -1372,7 +1372,7 @@ std::vector GetContourInPlane2D(const std::shared_ptr& mes const std::vector& va = mesh->mVerts; if(va.size() <= 2) { std::stringstream msg; - msg << "Skipping: Only " << va.size() << " verticies in opening mesh."; + msg << "Skipping: Only " << va.size() << " vertices in opening mesh."; IFCImporter::LogDebug(msg.str().c_str()); ok = false; return contour; From c44e3427aa58fd77cefd3b2b847b279085dc9fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 10 Oct 2023 12:44:34 -0700 Subject: [PATCH 4/6] use size in order to be compatible with float and double --- code/AssetLib/Irr/IRRLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index ba6ebc964..f841cd876 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -575,8 +575,8 @@ void SetupMapping(aiMaterial *mat, aiTextureMapping mode, const aiVector3D &axis m->mSemantic = prop->mSemantic; m->mType = aiPTI_Float; - m->mDataLength = 12; - m->mData = new char[12]; + m->mDataLength = sizeof(aiVector3D); + m->mData = new char[m->mDataLength]; *((aiVector3D *)m->mData) = axis; p.push_back(m); } From 25aee03f6626c93a0b188a6291c4bf7ff88b2cb7 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 29 Oct 2023 09:44:23 +0100 Subject: [PATCH 5/6] Fix: Add missing transformation for normalized normals. --- code/PostProcessing/PretransformVertices.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/code/PostProcessing/PretransformVertices.cpp b/code/PostProcessing/PretransformVertices.cpp index 87af2297d..aff6e535a 100644 --- a/code/PostProcessing/PretransformVertices.cpp +++ b/code/PostProcessing/PretransformVertices.cpp @@ -290,12 +290,6 @@ void PretransformVertices::ComputeAbsoluteTransform(aiNode *pcNode) { } } -static void normalizeVectorArray(aiVector3D *vectorArrayIn, aiVector3D *vectorArrayOut, size_t numVectors) { - for (size_t i=0; iHasNormals()) { - normalizeVectorArray(mesh->mNormals, mesh->mNormals, mesh->mNumVertices); + 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(); From c1deb808faadd85a7a007447b62ae238a4be2337 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 29 Oct 2023 09:47:02 +0100 Subject: [PATCH 6/6] Fix: Remove incorrect final statements --- test/unit/utBlendImportAreaLight.cpp | 3 +++ test/unit/utBlenderWork.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/unit/utBlendImportAreaLight.cpp b/test/unit/utBlendImportAreaLight.cpp index 4a16e662c..470d80737 100644 --- a/test/unit/utBlendImportAreaLight.cpp +++ b/test/unit/utBlendImportAreaLight.cpp @@ -48,6 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class BlendImportAreaLight : public ::testing::Test { public: + BlendImportAreaLight() : + im(nullptr) {} + ~BlendImportAreaLight() override = default; void SetUp() override { im = new Assimp::Importer(); } diff --git a/test/unit/utBlenderWork.cpp b/test/unit/utBlenderWork.cpp index b20720521..977877250 100644 --- a/test/unit/utBlenderWork.cpp +++ b/test/unit/utBlenderWork.cpp @@ -48,11 +48,14 @@ using namespace ::Assimp; class BlenderWorkTest : public ::testing::Test { public: - virtual void SetUp() { + BlenderWorkTest() : im(nullptr) {} + ~BlenderWorkTest() override = default; + + void SetUp() override { im = new Assimp::Importer(); } - virtual void TearDown() { + void TearDown() override { delete im; }