From 813f1714935f71696e8d6d8d1b398192c3c44c33 Mon Sep 17 00:00:00 2001 From: Natanael Rabello Date: Mon, 16 Nov 2020 21:39:59 -0300 Subject: [PATCH 1/4] Update Android port README.md with ABI doc --- port/AndroidJNI/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/port/AndroidJNI/README.md b/port/AndroidJNI/README.md index 0b95efd04..336ed8782 100644 --- a/port/AndroidJNI/README.md +++ b/port/AndroidJNI/README.md @@ -14,6 +14,10 @@ To use this module please provide following cmake defines: "SOME_PATH" is a path to your cmake android toolchain script. + +The build script for this port is based on [android-cmake](https://github.com/taka-no-me/android-cmake). +See its documentation for more Android-specific cmake options (e.g. -DANDROID_ABI for the target ABI). + ### Code ### A small example how to wrap assimp for Android: ```cpp From fc842a0f97d9456f20463c9a7fb3dce6301bee8f Mon Sep 17 00:00:00 2001 From: Neil Clifford Date: Thu, 19 Nov 2020 13:20:43 +0000 Subject: [PATCH 2/4] Sceneprecessor potential memory leak --- code/Common/ScenePreprocessor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/Common/ScenePreprocessor.cpp b/code/Common/ScenePreprocessor.cpp index 55aa04ad2..5850e0ffd 100644 --- a/code/Common/ScenePreprocessor.cpp +++ b/code/Common/ScenePreprocessor.cpp @@ -210,6 +210,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { // No rotation keys? Generate a dummy track if (!channel->mNumRotationKeys) { + if (channel->mRotationKeys) { + delete[] channel->mRotationKeys; + channel->mRotationKeys = NULL; + } ai_assert(!channel->mRotationKeys); channel->mNumRotationKeys = 1; channel->mRotationKeys = new aiQuatKey[1]; @@ -225,6 +229,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { // No scaling keys? Generate a dummy track if (!channel->mNumScalingKeys) { + if (channel->mScalingKeys) { + delete[] channel->mScalingKeys; + channel->mScalingKeys = NULL; + } ai_assert(!channel->mScalingKeys); channel->mNumScalingKeys = 1; channel->mScalingKeys = new aiVectorKey[1]; @@ -240,6 +248,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { // No position keys? Generate a dummy track if (!channel->mNumPositionKeys) { + if (channel->mPositionKeys) { + delete[] channel->mPositionKeys; + channel->mPositionKeys = NULL; + } ai_assert(!channel->mPositionKeys); channel->mNumPositionKeys = 1; channel->mPositionKeys = new aiVectorKey[1]; From 75204dfe7f8cdd86e0f53f8811446d961ceb7fe5 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 1 Dec 2020 08:58:45 +0100 Subject: [PATCH 3/4] Update README.md --- port/AndroidJNI/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/port/AndroidJNI/README.md b/port/AndroidJNI/README.md index 336ed8782..003b1da1a 100644 --- a/port/AndroidJNI/README.md +++ b/port/AndroidJNI/README.md @@ -17,6 +17,7 @@ To use this module please provide following cmake defines: The build script for this port is based on [android-cmake](https://github.com/taka-no-me/android-cmake). See its documentation for more Android-specific cmake options (e.g. -DANDROID_ABI for the target ABI). +Check [Asset-Importer-Docs](https://assimp-docs.readthedocs.io/en/latest/) for more information. ### Code ### A small example how to wrap assimp for Android: From c7aeb882e645c81bdb02ea73c247a17ceb1952cd Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 3 Dec 2020 17:28:51 +0100 Subject: [PATCH 4/4] Update ScenePreprocessor.cpp --- code/Common/ScenePreprocessor.cpp | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/code/Common/ScenePreprocessor.cpp b/code/Common/ScenePreprocessor.cpp index 5850e0ffd..2b73d9452 100644 --- a/code/Common/ScenePreprocessor.cpp +++ b/code/Common/ScenePreprocessor.cpp @@ -96,8 +96,9 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) { if (!mesh->mTextureCoords[i]) { mesh->mNumUVComponents[i] = 0; } else { - if (!mesh->mNumUVComponents[i]) + if (!mesh->mNumUVComponents[i]) { mesh->mNumUVComponents[i] = 2; + } aiVector3D *p = mesh->mTextureCoords[i], *end = p + mesh->mNumVertices; @@ -105,16 +106,19 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) { // as if they were 2D channels .. just in case an application doesn't handle // this case if (2 == mesh->mNumUVComponents[i]) { - for (; p != end; ++p) + for (; p != end; ++p) { p->z = 0.f; + } } else if (1 == mesh->mNumUVComponents[i]) { - for (; p != end; ++p) + for (; p != end; ++p) { p->z = p->y = 0.f; + } } else if (3 == mesh->mNumUVComponents[i]) { // Really 3D coordinates? Check whether the third coordinate is != 0 for at least one element for (; p != end; ++p) { - if (p->z != 0) + if (p->z != 0) { break; + } } if (p == end) { ASSIMP_LOG_WARN("ScenePreprocessor: UVs are declared to be 3D but they're obviously not. Reverting to 2D."); @@ -151,7 +155,6 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) { // If tangents and normals are given but no bitangents compute them if (mesh->mTangents && mesh->mNormals && !mesh->mBitangents) { - mesh->mBitangents = new aiVector3D[mesh->mNumVertices]; for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { mesh->mBitangents[i] = mesh->mNormals[i] ^ mesh->mTangents[i]; @@ -165,11 +168,9 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { for (unsigned int i = 0; i < anim->mNumChannels; ++i) { aiNodeAnim *channel = anim->mChannels[i]; - /* If the exact duration of the animation is not given - * compute it now. - */ + // If the exact duration of the animation is not given + // compute it now. if (anim->mDuration == -1.) { - // Position keys for (unsigned int j = 0; j < channel->mNumPositionKeys; ++j) { aiVectorKey &key = channel->mPositionKeys[j]; @@ -192,11 +193,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { } } - /* Check whether the animation channel has no rotation - * or position tracks. In this case we generate a dummy - * track from the information we have in the transformation - * matrix of the corresponding node. - */ + // Check whether the animation channel has no rotation + // or position tracks. In this case we generate a dummy + // track from the information we have in the transformation + // matrix of the corresponding node. if (!channel->mNumRotationKeys || !channel->mNumPositionKeys || !channel->mNumScalingKeys) { // Find the node that belongs to this animation aiNode *node = scene->mRootNode->FindNode(channel->mNodeName); @@ -212,7 +212,7 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { if (!channel->mNumRotationKeys) { if (channel->mRotationKeys) { delete[] channel->mRotationKeys; - channel->mRotationKeys = NULL; + channel->mRotationKeys = nullptr; } ai_assert(!channel->mRotationKeys); channel->mNumRotationKeys = 1; @@ -231,7 +231,7 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { if (!channel->mNumScalingKeys) { if (channel->mScalingKeys) { delete[] channel->mScalingKeys; - channel->mScalingKeys = NULL; + channel->mScalingKeys = nullptr; } ai_assert(!channel->mScalingKeys); channel->mNumScalingKeys = 1; @@ -250,7 +250,7 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) { if (!channel->mNumPositionKeys) { if (channel->mPositionKeys) { delete[] channel->mPositionKeys; - channel->mPositionKeys = NULL; + channel->mPositionKeys = nullptr; } ai_assert(!channel->mPositionKeys); channel->mNumPositionKeys = 1;