mData)
+ if (!acc->mData) {
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource);
+ }
}
// For continued primitives, the given count does not come all in one , but only one primitive per
@@ -1884,11 +1886,13 @@ void ColladaParser::CopyVertex(size_t currentVertex, size_t numOffsets, size_t n
ai_assert((baseOffset + numOffsets - 1) < indices.size());
// extract per-vertex channels using the global per-vertex offset
- for (std::vector::iterator it = pMesh.mPerVertexData.begin(); it != pMesh.mPerVertexData.end(); ++it)
+ for (std::vector::iterator it = pMesh.mPerVertexData.begin(); it != pMesh.mPerVertexData.end(); ++it) {
ExtractDataObjectFromChannel(*it, indices[baseOffset + perVertexOffset], pMesh);
+ }
// and extract per-index channels using there specified offset
- for (std::vector::iterator it = pPerIndexChannels.begin(); it != pPerIndexChannels.end(); ++it)
+ for (std::vector::iterator it = pPerIndexChannels.begin(); it != pPerIndexChannels.end(); ++it) {
ExtractDataObjectFromChannel(*it, indices[baseOffset + it->mOffset], pMesh);
+ }
// store the vertex-data index for later assignment of bone vertex weights
pMesh.mFacePosIndices.push_back(indices[baseOffset + perVertexOffset]);
@@ -1912,8 +1916,9 @@ void ColladaParser::ReadPrimTriStrips(size_t numOffsets, size_t perVertexOffset,
// Extracts a single object from an input channel and stores it in the appropriate mesh data array
void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, size_t pLocalIndex, Mesh &pMesh) {
// ignore vertex referrer - we handle them that separate
- if (pInput.mType == IT_Vertex)
+ if (pInput.mType == IT_Vertex) {
return;
+ }
const Accessor &acc = *pInput.mResolved;
if (pLocalIndex >= acc.mCount) {
@@ -1926,86 +1931,93 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// assemble according to the accessors component sub-offset list. We don't care, yet,
// what kind of object exactly we're extracting here
ai_real obj[4];
- for (size_t c = 0; c < 4; ++c)
+ for (size_t c = 0; c < 4; ++c) {
obj[c] = dataObject[acc.mSubOffset[c]];
+ }
// now we reinterpret it according to the type we're reading here
switch (pInput.mType) {
- case IT_Position: // ignore all position streams except 0 - there can be only one position
- if (pInput.mIndex == 0)
- pMesh.mPositions.push_back(aiVector3D(obj[0], obj[1], obj[2]));
- else
- ASSIMP_LOG_ERROR("Collada: just one vertex position stream supported");
- break;
- case IT_Normal:
- // pad to current vertex count if necessary
- if (pMesh.mNormals.size() < pMesh.mPositions.size() - 1)
- pMesh.mNormals.insert(pMesh.mNormals.end(), pMesh.mPositions.size() - pMesh.mNormals.size() - 1, aiVector3D(0, 1, 0));
-
- // ignore all normal streams except 0 - there can be only one normal
- if (pInput.mIndex == 0)
- pMesh.mNormals.push_back(aiVector3D(obj[0], obj[1], obj[2]));
- else
- ASSIMP_LOG_ERROR("Collada: just one vertex normal stream supported");
- break;
- case IT_Tangent:
- // pad to current vertex count if necessary
- if (pMesh.mTangents.size() < pMesh.mPositions.size() - 1)
- pMesh.mTangents.insert(pMesh.mTangents.end(), pMesh.mPositions.size() - pMesh.mTangents.size() - 1, aiVector3D(1, 0, 0));
-
- // ignore all tangent streams except 0 - there can be only one tangent
- if (pInput.mIndex == 0)
- pMesh.mTangents.push_back(aiVector3D(obj[0], obj[1], obj[2]));
- else
- ASSIMP_LOG_ERROR("Collada: just one vertex tangent stream supported");
- break;
- case IT_Bitangent:
- // pad to current vertex count if necessary
- if (pMesh.mBitangents.size() < pMesh.mPositions.size() - 1)
- pMesh.mBitangents.insert(pMesh.mBitangents.end(), pMesh.mPositions.size() - pMesh.mBitangents.size() - 1, aiVector3D(0, 0, 1));
-
- // ignore all bitangent streams except 0 - there can be only one bitangent
- if (pInput.mIndex == 0)
- pMesh.mBitangents.push_back(aiVector3D(obj[0], obj[1], obj[2]));
- else
- ASSIMP_LOG_ERROR("Collada: just one vertex bitangent stream supported");
- break;
- case IT_Texcoord:
- // up to 4 texture coord sets are fine, ignore the others
- if (pInput.mIndex < AI_MAX_NUMBER_OF_TEXTURECOORDS) {
- // pad to current vertex count if necessary
- if (pMesh.mTexCoords[pInput.mIndex].size() < pMesh.mPositions.size() - 1)
- pMesh.mTexCoords[pInput.mIndex].insert(pMesh.mTexCoords[pInput.mIndex].end(),
- pMesh.mPositions.size() - pMesh.mTexCoords[pInput.mIndex].size() - 1, aiVector3D(0, 0, 0));
-
- pMesh.mTexCoords[pInput.mIndex].push_back(aiVector3D(obj[0], obj[1], obj[2]));
- if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) /* hack ... consider cleaner solution */
- pMesh.mNumUVComponents[pInput.mIndex] = 3;
- } else {
- ASSIMP_LOG_ERROR("Collada: too many texture coordinate sets. Skipping.");
- }
- break;
- case IT_Color:
- // up to 4 color sets are fine, ignore the others
- if (pInput.mIndex < AI_MAX_NUMBER_OF_COLOR_SETS) {
- // pad to current vertex count if necessary
- if (pMesh.mColors[pInput.mIndex].size() < pMesh.mPositions.size() - 1)
- pMesh.mColors[pInput.mIndex].insert(pMesh.mColors[pInput.mIndex].end(),
- pMesh.mPositions.size() - pMesh.mColors[pInput.mIndex].size() - 1, aiColor4D(0, 0, 0, 1));
-
- aiColor4D result(0, 0, 0, 1);
- for (size_t i = 0; i < pInput.mResolved->mSize; ++i) {
- result[static_cast(i)] = obj[pInput.mResolved->mSubOffset[i]];
+ case IT_Position: // ignore all position streams except 0 - there can be only one position
+ if (pInput.mIndex == 0) {
+ pMesh.mPositions.push_back(aiVector3D(obj[0], obj[1], obj[2]));
+ } else {
+ ASSIMP_LOG_ERROR("Collada: just one vertex position stream supported");
}
- pMesh.mColors[pInput.mIndex].push_back(result);
- } else {
- ASSIMP_LOG_ERROR("Collada: too many vertex color sets. Skipping.");
- }
+ break;
+ case IT_Normal:
+ // pad to current vertex count if necessary
+ if (pMesh.mNormals.size() < pMesh.mPositions.size() - 1)
+ pMesh.mNormals.insert(pMesh.mNormals.end(), pMesh.mPositions.size() - pMesh.mNormals.size() - 1, aiVector3D(0, 1, 0));
- break;
- default:
- // IT_Invalid and IT_Vertex
- ai_assert(false && "shouldn't ever get here");
+ // ignore all normal streams except 0 - there can be only one normal
+ if (pInput.mIndex == 0) {
+ pMesh.mNormals.push_back(aiVector3D(obj[0], obj[1], obj[2]));
+ } else {
+ ASSIMP_LOG_ERROR("Collada: just one vertex normal stream supported");
+ }
+ break;
+ case IT_Tangent:
+ // pad to current vertex count if necessary
+ if (pMesh.mTangents.size() < pMesh.mPositions.size() - 1)
+ pMesh.mTangents.insert(pMesh.mTangents.end(), pMesh.mPositions.size() - pMesh.mTangents.size() - 1, aiVector3D(1, 0, 0));
+
+ // ignore all tangent streams except 0 - there can be only one tangent
+ if (pInput.mIndex == 0) {
+ pMesh.mTangents.push_back(aiVector3D(obj[0], obj[1], obj[2]));
+ } else {
+ ASSIMP_LOG_ERROR("Collada: just one vertex tangent stream supported");
+ }
+ break;
+ case IT_Bitangent:
+ // pad to current vertex count if necessary
+ if (pMesh.mBitangents.size() < pMesh.mPositions.size() - 1) {
+ pMesh.mBitangents.insert(pMesh.mBitangents.end(), pMesh.mPositions.size() - pMesh.mBitangents.size() - 1, aiVector3D(0, 0, 1));
+ }
+
+ // ignore all bitangent streams except 0 - there can be only one bitangent
+ if (pInput.mIndex == 0) {
+ pMesh.mBitangents.push_back(aiVector3D(obj[0], obj[1], obj[2]));
+ } else {
+ ASSIMP_LOG_ERROR("Collada: just one vertex bitangent stream supported");
+ }
+ break;
+ case IT_Texcoord:
+ // up to 4 texture coord sets are fine, ignore the others
+ if (pInput.mIndex < AI_MAX_NUMBER_OF_TEXTURECOORDS) {
+ // pad to current vertex count if necessary
+ if (pMesh.mTexCoords[pInput.mIndex].size() < pMesh.mPositions.size() - 1)
+ pMesh.mTexCoords[pInput.mIndex].insert(pMesh.mTexCoords[pInput.mIndex].end(),
+ pMesh.mPositions.size() - pMesh.mTexCoords[pInput.mIndex].size() - 1, aiVector3D(0, 0, 0));
+
+ pMesh.mTexCoords[pInput.mIndex].push_back(aiVector3D(obj[0], obj[1], obj[2]));
+ if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) {
+ pMesh.mNumUVComponents[pInput.mIndex] = 3;
+ }
+ } else {
+ ASSIMP_LOG_ERROR("Collada: too many texture coordinate sets. Skipping.");
+ }
+ break;
+ case IT_Color:
+ // up to 4 color sets are fine, ignore the others
+ if (pInput.mIndex < AI_MAX_NUMBER_OF_COLOR_SETS) {
+ // pad to current vertex count if necessary
+ if (pMesh.mColors[pInput.mIndex].size() < pMesh.mPositions.size() - 1)
+ pMesh.mColors[pInput.mIndex].insert(pMesh.mColors[pInput.mIndex].end(),
+ pMesh.mPositions.size() - pMesh.mColors[pInput.mIndex].size() - 1, aiColor4D(0, 0, 0, 1));
+
+ aiColor4D result(0, 0, 0, 1);
+ for (size_t i = 0; i < pInput.mResolved->mSize; ++i) {
+ result[static_cast(i)] = obj[pInput.mResolved->mSubOffset[i]];
+ }
+ pMesh.mColors[pInput.mIndex].push_back(result);
+ } else {
+ ASSIMP_LOG_ERROR("Collada: too many vertex color sets. Skipping.");
+ }
+
+ break;
+ default:
+ // IT_Invalid and IT_Vertex
+ ai_assert(false && "shouldn't ever get here");
}
}
diff --git a/code/AssetLib/Collada/ColladaParser.h b/code/AssetLib/Collada/ColladaParser.h
index 5b8526b47..37ee0ec68 100644
--- a/code/AssetLib/Collada/ColladaParser.h
+++ b/code/AssetLib/Collada/ColladaParser.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
- Copyright (c) 2006-2020, assimp team
+ Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/DXF/DXFHelper.h b/code/AssetLib/DXF/DXFHelper.h
index d11addc0a..f7fc470e8 100644
--- a/code/AssetLib/DXF/DXFHelper.h
+++ b/code/AssetLib/DXF/DXFHelper.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/DXF/DXFLoader.cpp b/code/AssetLib/DXF/DXFLoader.cpp
index cda391fb8..d4a6be4ad 100644
--- a/code/AssetLib/DXF/DXFLoader.cpp
+++ b/code/AssetLib/DXF/DXFLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/DXF/DXFLoader.h b/code/AssetLib/DXF/DXFLoader.h
index 5c4f1787e..5319d2528 100644
--- a/code/AssetLib/DXF/DXFLoader.h
+++ b/code/AssetLib/DXF/DXFLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXAnimation.cpp b/code/AssetLib/FBX/FBXAnimation.cpp
index d7596131d..0fdc3517a 100644
--- a/code/AssetLib/FBX/FBXAnimation.cpp
+++ b/code/AssetLib/FBX/FBXAnimation.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp
index fae96a66a..800d0014d 100644
--- a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp
+++ b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -473,7 +473,7 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, size_t length)
catch (const DeadlyImportError& e)
{
if (!is64bits && (length > std::numeric_limits::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(), ")");
+ throw DeadlyImportError("The FBX file is invalid. This may be because the content is too big for this older version (", ai_to_string(version), ") of the FBX format. (", e.what(), ")");
}
throw;
}
diff --git a/code/AssetLib/FBX/FBXCommon.h b/code/AssetLib/FBX/FBXCommon.h
index 7d015a134..5ce6a7d15 100644
--- a/code/AssetLib/FBX/FBXCommon.h
+++ b/code/AssetLib/FBX/FBXCommon.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXCompileConfig.h b/code/AssetLib/FBX/FBXCompileConfig.h
index 5cdaa6960..49860b844 100644
--- a/code/AssetLib/FBX/FBXCompileConfig.h
+++ b/code/AssetLib/FBX/FBXCompileConfig.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -62,16 +62,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef ASSIMP_FBX_USE_UNORDERED_MULTIMAP
# include
# include
-# if _MSC_VER > 1600
-# define fbx_unordered_map unordered_map
-# define fbx_unordered_multimap unordered_multimap
-# define fbx_unordered_set unordered_set
-# define fbx_unordered_multiset unordered_multiset
-# else
+# if defined(_MSC_VER) && _MSC_VER <= 1600
# define fbx_unordered_map tr1::unordered_map
# define fbx_unordered_multimap tr1::unordered_multimap
# define fbx_unordered_set tr1::unordered_set
# define fbx_unordered_multiset tr1::unordered_multiset
+# else
+# define fbx_unordered_map unordered_map
+# define fbx_unordered_multimap unordered_multimap
+# define fbx_unordered_set unordered_set
+# define fbx_unordered_multiset unordered_multiset
# endif
#endif
diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp
index c27e48076..cb033a651 100644
--- a/code/AssetLib/FBX/FBXConverter.cpp
+++ b/code/AssetLib/FBX/FBXConverter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -3440,7 +3440,7 @@ void FBXConverter::ConvertGlobalSettings() {
mSceneOut->mMetaData->Set(12, "TimeSpanStart", doc.GlobalSettings().TimeSpanStart());
mSceneOut->mMetaData->Set(13, "TimeSpanStop", doc.GlobalSettings().TimeSpanStop());
mSceneOut->mMetaData->Set(14, "CustomFrameRate", doc.GlobalSettings().CustomFrameRate());
- mSceneOut->mMetaData->Set(15, AI_METADATA_SOURCE_FORMAT_VERSION, aiString(to_string(doc.FBXVersion())));
+ mSceneOut->mMetaData->Set(15, AI_METADATA_SOURCE_FORMAT_VERSION, aiString(ai_to_string(doc.FBXVersion())));
if (hasGenerator) {
mSceneOut->mMetaData->Set(16, AI_METADATA_SOURCE_GENERATOR, aiString(doc.Creator()));
}
@@ -3454,42 +3454,42 @@ void FBXConverter::TransferDataToScene() {
// many C++ users seem to know this, so pointing it out to avoid
// confusion why this code works.
- if (mMeshes.size()) {
+ if (!mMeshes.empty()) {
mSceneOut->mMeshes = new aiMesh *[mMeshes.size()]();
mSceneOut->mNumMeshes = static_cast(mMeshes.size());
std::swap_ranges(mMeshes.begin(), mMeshes.end(), mSceneOut->mMeshes);
}
- if (materials.size()) {
+ if (!materials.empty()) {
mSceneOut->mMaterials = new aiMaterial *[materials.size()]();
mSceneOut->mNumMaterials = static_cast(materials.size());
std::swap_ranges(materials.begin(), materials.end(), mSceneOut->mMaterials);
}
- if (animations.size()) {
+ if (!animations.empty()) {
mSceneOut->mAnimations = new aiAnimation *[animations.size()]();
mSceneOut->mNumAnimations = static_cast(animations.size());
std::swap_ranges(animations.begin(), animations.end(), mSceneOut->mAnimations);
}
- if (lights.size()) {
+ if (!lights.empty()) {
mSceneOut->mLights = new aiLight *[lights.size()]();
mSceneOut->mNumLights = static_cast(lights.size());
std::swap_ranges(lights.begin(), lights.end(), mSceneOut->mLights);
}
- if (cameras.size()) {
+ if (!cameras.empty()) {
mSceneOut->mCameras = new aiCamera *[cameras.size()]();
mSceneOut->mNumCameras = static_cast(cameras.size());
std::swap_ranges(cameras.begin(), cameras.end(), mSceneOut->mCameras);
}
- if (textures.size()) {
+ if (!textures.empty()) {
mSceneOut->mTextures = new aiTexture *[textures.size()]();
mSceneOut->mNumTextures = static_cast(textures.size());
diff --git a/code/AssetLib/FBX/FBXConverter.h b/code/AssetLib/FBX/FBXConverter.h
index 52f978a7b..d208ab429 100644
--- a/code/AssetLib/FBX/FBXConverter.h
+++ b/code/AssetLib/FBX/FBXConverter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXDeformer.cpp b/code/AssetLib/FBX/FBXDeformer.cpp
index 4b76cd0fa..d26807184 100644
--- a/code/AssetLib/FBX/FBXDeformer.cpp
+++ b/code/AssetLib/FBX/FBXDeformer.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXDocument.cpp b/code/AssetLib/FBX/FBXDocument.cpp
index 88e5c4eb4..a9eb3ad15 100644
--- a/code/AssetLib/FBX/FBXDocument.cpp
+++ b/code/AssetLib/FBX/FBXDocument.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXDocument.h b/code/AssetLib/FBX/FBXDocument.h
index 85ccca5d0..69cda1c1a 100644
--- a/code/AssetLib/FBX/FBXDocument.h
+++ b/code/AssetLib/FBX/FBXDocument.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXDocumentUtil.cpp b/code/AssetLib/FBX/FBXDocumentUtil.cpp
index 42c056628..6ba01aa47 100644
--- a/code/AssetLib/FBX/FBXDocumentUtil.cpp
+++ b/code/AssetLib/FBX/FBXDocumentUtil.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXExportNode.cpp b/code/AssetLib/FBX/FBXExportNode.cpp
index 6900790c4..91e421420 100644
--- a/code/AssetLib/FBX/FBXExportNode.cpp
+++ b/code/AssetLib/FBX/FBXExportNode.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -426,7 +426,7 @@ void FBX::Node::WritePropertyNodeAscii(
char buffer[32];
FBX::Node node(name);
node.Begin(s, false, indent);
- std::string vsize = to_string(v.size());
+ std::string vsize = ai_to_string(v.size());
// * {
s.PutChar('*'); s.PutString(vsize); s.PutString(" {\n");
// indent + 1
@@ -462,7 +462,7 @@ void FBX::Node::WritePropertyNodeAscii(
char buffer[32];
FBX::Node node(name);
node.Begin(s, false, indent);
- std::string vsize = to_string(v.size());
+ std::string vsize = ai_to_string(v.size());
// * {
s.PutChar('*'); s.PutString(vsize); s.PutString(" {\n");
// indent + 1
diff --git a/code/AssetLib/FBX/FBXExportNode.h b/code/AssetLib/FBX/FBXExportNode.h
index 2e8f491a1..c5f29ef0f 100644
--- a/code/AssetLib/FBX/FBXExportNode.h
+++ b/code/AssetLib/FBX/FBXExportNode.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXExportProperty.cpp b/code/AssetLib/FBX/FBXExportProperty.cpp
index 11ee35003..1e88042c6 100644
--- a/code/AssetLib/FBX/FBXExportProperty.cpp
+++ b/code/AssetLib/FBX/FBXExportProperty.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXExportProperty.h b/code/AssetLib/FBX/FBXExportProperty.h
index 6baae8b69..16fb0f144 100644
--- a/code/AssetLib/FBX/FBXExportProperty.h
+++ b/code/AssetLib/FBX/FBXExportProperty.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp
index 99ab7508e..e519f7e77 100644
--- a/code/AssetLib/FBX/FBXExporter.cpp
+++ b/code/AssetLib/FBX/FBXExporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -812,6 +812,18 @@ void FBXExporter::WriteDefinitions ()
// Geometry / FbxMesh
// <~~ aiMesh
count = mScene->mNumMeshes;
+
+ // Blendshapes are considered Geometry
+ int32_t bsDeformerCount=0;
+ for (size_t mi = 0; mi < mScene->mNumMeshes; ++mi) {
+ aiMesh* m = mScene->mMeshes[mi];
+ if (m->mNumAnimMeshes > 0) {
+ count+=m->mNumAnimMeshes;
+ bsDeformerCount+=m->mNumAnimMeshes; // One deformer per blendshape
+ bsDeformerCount++; // Plus one master blendshape deformer
+ }
+ }
+
if (count) {
n = FBX::Node("ObjectType", "Geometry");
n.AddChild("Count", count);
@@ -978,7 +990,7 @@ void FBXExporter::WriteDefinitions ()
}
// Deformer
- count = int32_t(count_deformers(mScene));
+ count = int32_t(count_deformers(mScene))+bsDeformerCount;
if (count) {
n = FBX::Node("ObjectType", "Deformer");
n.AddChild("Count", count);
@@ -1363,6 +1375,7 @@ void FBXExporter::WriteObjects ()
n.End(outstream, binary, indent, true);
}
+
// aiMaterial
material_uids.clear();
for (size_t i = 0; i < mScene->mNumMaterials; ++i) {
@@ -1697,6 +1710,100 @@ void FBXExporter::WriteObjects ()
}
}
+ // Blendshapes, if any
+ for (size_t mi = 0; mi < mScene->mNumMeshes; ++mi) {
+ const aiMesh* m = mScene->mMeshes[mi];
+ if (m->mNumAnimMeshes == 0) {
+ continue;
+ }
+ // make a deformer for this mesh
+ int64_t deformer_uid = generate_uid();
+ FBX::Node dnode("Deformer");
+ dnode.AddProperties(deformer_uid, m->mName.data + FBX::SEPARATOR + "Blendshapes", "BlendShape");
+ dnode.AddChild("Version", int32_t(101));
+ dnode.Dump(outstream, binary, indent);
+ // connect it
+ connections.emplace_back("C", "OO", deformer_uid, mesh_uids[mi]);
+ std::vector vertex_indices = vVertexIndice[mi];
+
+ for (unsigned int am = 0; am < m->mNumAnimMeshes; ++am) {
+ aiAnimMesh *pAnimMesh = m->mAnimMeshes[am];
+ std::string blendshape_name = pAnimMesh->mName.data;
+
+ // start the node record
+ FBX::Node bsnode("Geometry");
+ int64_t blendshape_uid = generate_uid();
+ mesh_uids.push_back(blendshape_uid);
+ bsnode.AddProperty(blendshape_uid);
+ bsnode.AddProperty(blendshape_name + FBX::SEPARATOR + "Blendshape");
+ bsnode.AddProperty("Shape");
+ bsnode.AddChild("Version", int32_t(100));
+ bsnode.Begin(outstream, binary, indent);
+ bsnode.DumpProperties(outstream, binary, indent);
+ bsnode.EndProperties(outstream, binary, indent);
+ bsnode.BeginChildren(outstream, binary, indent);
+ indent++;
+ if (pAnimMesh->HasPositions()) {
+ std::vectorshape_indices;
+ std::vectorpPositionDiff;
+ std::vectorpNormalDiff;
+
+ for (unsigned int vt = 0; vt < vertex_indices.size(); ++vt) {
+ aiVector3D pDiff = (pAnimMesh->mVertices[vertex_indices[vt]] - m->mVertices[vertex_indices[vt]]);
+ if(pDiff.Length()>1e-8){
+ shape_indices.push_back(vertex_indices[vt]);
+ pPositionDiff.push_back(pDiff[0]);
+ pPositionDiff.push_back(pDiff[1]);
+ pPositionDiff.push_back(pDiff[2]);
+
+ if (pAnimMesh->HasNormals()) {
+ aiVector3D nDiff = (pAnimMesh->mNormals[vertex_indices[vt]] - m->mNormals[vertex_indices[vt]]);
+ pNormalDiff.push_back(nDiff[0]);
+ pNormalDiff.push_back(nDiff[1]);
+ pNormalDiff.push_back(nDiff[2]);
+ }
+ }
+ }
+
+ FBX::Node::WritePropertyNode(
+ "Indexes", shape_indices, outstream, binary, indent
+ );
+
+ FBX::Node::WritePropertyNode(
+ "Vertices", pPositionDiff, outstream, binary, indent
+ );
+
+ if (pNormalDiff.size()>0) {
+ FBX::Node::WritePropertyNode(
+ "Normals", pNormalDiff, outstream, binary, indent
+ );
+ }
+ }
+ indent--;
+ bsnode.End(outstream, binary, indent, true);
+
+ // Add blendshape Channel Deformer
+ FBX::Node sdnode("Deformer");
+ const int64_t blendchannel_uid = generate_uid();
+ sdnode.AddProperties(
+ blendchannel_uid, blendshape_name + FBX::SEPARATOR + "SubDeformer", "BlendShapeChannel"
+ );
+ sdnode.AddChild("Version", int32_t(100));
+ sdnode.AddChild("DeformPercent", float_t(0.0));
+ FBX::Node p("Properties70");
+ p.AddP70numberA("DeformPercent", 0.0);
+ sdnode.AddChild(p);
+ // TODO: Normally just one weight per channel, adding stub for later development
+ std::vectorfFullWeights;
+ fFullWeights.push_back(100.);
+ sdnode.AddChild("FullWeights", fFullWeights);
+ sdnode.Dump(outstream, binary, indent);
+
+ connections.emplace_back("C", "OO", blendchannel_uid, deformer_uid);
+ connections.emplace_back("C", "OO", blendshape_uid, blendchannel_uid);
+ }
+ }
+
// bones.
//
// output structure:
diff --git a/code/AssetLib/FBX/FBXExporter.h b/code/AssetLib/FBX/FBXExporter.h
index eb8bfaf3b..dcd1d2727 100644
--- a/code/AssetLib/FBX/FBXExporter.h
+++ b/code/AssetLib/FBX/FBXExporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXImportSettings.h b/code/AssetLib/FBX/FBXImportSettings.h
index ec6d7ccc1..bd1c8bddc 100644
--- a/code/AssetLib/FBX/FBXImportSettings.h
+++ b/code/AssetLib/FBX/FBXImportSettings.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXImporter.cpp b/code/AssetLib/FBX/FBXImporter.cpp
index a097568a5..21e9f6d7d 100644
--- a/code/AssetLib/FBX/FBXImporter.cpp
+++ b/code/AssetLib/FBX/FBXImporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXImporter.h b/code/AssetLib/FBX/FBXImporter.h
index 7a9fc4b74..156a68a91 100644
--- a/code/AssetLib/FBX/FBXImporter.h
+++ b/code/AssetLib/FBX/FBXImporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXMaterial.cpp b/code/AssetLib/FBX/FBXMaterial.cpp
index 9fe4ce5be..3af014bc3 100644
--- a/code/AssetLib/FBX/FBXMaterial.cpp
+++ b/code/AssetLib/FBX/FBXMaterial.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -54,18 +54,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
-#include // std::transform
#include "FBXUtil.h"
namespace Assimp {
namespace FBX {
- using namespace Util;
+using namespace Util;
// ------------------------------------------------------------------------------------------------
-Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name)
-: Object(id,element,name)
-{
+Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
+ Object(id,element,name) {
const Scope& sc = GetRequiredScope(element);
const Element* const ShadingModel = sc["ShadingModel"];
@@ -77,23 +75,21 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
if(ShadingModel) {
shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0));
- }
- else {
+ } else {
DOMWarning("shading mode not specified, assuming phong",&element);
shading = "phong";
}
- std::string templateName;
-
// lower-case shading because Blender (for example) writes "Phong"
- std::transform(shading.data(), shading.data() + shading.size(), std::addressof(shading[0]), Assimp::ToLower);
+ for (size_t i = 0; i < shading.length(); ++i) {
+ shading[i] = static_cast(tolower(shading[i]));
+ }
+ std::string templateName;
if(shading == "phong") {
templateName = "Material.FbxSurfacePhong";
- }
- else if(shading == "lambert") {
+ } else if(shading == "lambert") {
templateName = "Material.FbxSurfaceLambert";
- }
- else {
+ } else {
DOMWarning("shading mode not recognized: " + shading,&element);
}
@@ -102,20 +98,19 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
// resolve texture links
const std::vector& conns = doc.GetConnectionsByDestinationSequenced(ID());
for(const Connection* con : conns) {
-
// texture link to properties, not objects
- if (!con->PropertyName().length()) {
+ if ( 0 == con->PropertyName().length()) {
continue;
}
const Object* const ob = con->SourceObject();
- if(!ob) {
+ if(nullptr == ob) {
DOMWarning("failed to read source object for texture link, ignoring",&element);
continue;
}
const Texture* const tex = dynamic_cast(ob);
- if(!tex) {
+ if(nullptr == tex) {
const LayeredTexture* const layeredTexture = dynamic_cast(ob);
if(!layeredTexture) {
DOMWarning("source object for texture link is not a texture or layered texture, ignoring",&element);
@@ -128,9 +123,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
layeredTextures[prop] = layeredTexture;
((LayeredTexture*)layeredTexture)->fillTexture(doc);
- }
- else
- {
+ } else {
const std::string& prop = con->PropertyName();
if (textures.find(prop) != textures.end()) {
DOMWarning("duplicate texture link: " + prop,&element);
@@ -138,23 +131,20 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
textures[prop] = tex;
}
-
}
}
// ------------------------------------------------------------------------------------------------
-Material::~Material()
-{
+Material::~Material() {
+ // empty
}
-
// ------------------------------------------------------------------------------------------------
-Texture::Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name)
-: Object(id,element,name)
-, uvScaling(1.0f,1.0f)
-, media(0)
-{
+Texture::Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
+ Object(id,element,name),
+ uvScaling(1.0f,1.0f),
+ media(0) {
const Scope& sc = GetRequiredScope(element);
const Element* const Type = sc["Type"];
@@ -194,8 +184,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
crop[1] = ParseTokenAsInt(GetRequiredToken(*Cropping,1));
crop[2] = ParseTokenAsInt(GetRequiredToken(*Cropping,2));
crop[3] = ParseTokenAsInt(GetRequiredToken(*Cropping,3));
- }
- else {
+ } else {
// vc8 doesn't support the crop() syntax in initialization lists
// (and vc9 WARNS about the new (i.e. compliant) behaviour).
crop[0] = crop[1] = crop[2] = crop[3] = 0;
@@ -226,7 +215,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
const std::vector& conns = doc.GetConnectionsByDestinationSequenced(ID());
for(const Connection* con : conns) {
const Object* const ob = con->SourceObject();
- if(!ob) {
+ if (nullptr == ob) {
DOMWarning("failed to read source object for texture link, ignoring",&element);
continue;
}
@@ -240,46 +229,38 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
}
-Texture::~Texture()
-{
-
+Texture::~Texture() {
+ // empty
}
-LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name)
-: Object(id,element,name)
-,blendMode(BlendMode_Modulate)
-,alpha(1)
-{
+LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name) :
+ Object(id,element,name),
+ blendMode(BlendMode_Modulate),
+ alpha(1) {
const Scope& sc = GetRequiredScope(element);
const Element* const BlendModes = sc["BlendModes"];
const Element* const Alphas = sc["Alphas"];
-
- if(BlendModes!=0)
- {
+ if (nullptr != BlendModes) {
blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(*BlendModes,0));
}
- if(Alphas!=0)
- {
+ if (nullptr != Alphas) {
alpha = ParseTokenAsFloat(GetRequiredToken(*Alphas,0));
}
}
-LayeredTexture::~LayeredTexture()
-{
-
+LayeredTexture::~LayeredTexture() {
+ // empty
}
-void LayeredTexture::fillTexture(const Document& doc)
-{
+void LayeredTexture::fillTexture(const Document& doc) {
const std::vector& conns = doc.GetConnectionsByDestinationSequenced(ID());
- for(size_t i = 0; i < conns.size();++i)
- {
+ for(size_t i = 0; i < conns.size();++i) {
const Connection* con = conns.at(i);
const Object* const ob = con->SourceObject();
- if(!ob) {
+ if (nullptr == ob) {
DOMWarning("failed to read source object for texture link, ignoring",&element);
continue;
}
@@ -290,13 +271,11 @@ void LayeredTexture::fillTexture(const Document& doc)
}
}
-
// ------------------------------------------------------------------------------------------------
-Video::Video(uint64_t id, const Element& element, const Document& doc, const std::string& name)
-: Object(id,element,name)
-, contentLength(0)
-, content(0)
-{
+Video::Video(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
+ Object(id,element,name),
+ contentLength(0),
+ content(0) {
const Scope& sc = GetRequiredScope(element);
const Element* const Type = sc["Type"];
@@ -324,52 +303,43 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
if (!token.IsBinary()) {
if (*data != '"') {
DOMError("embedded content is not surrounded by quotation marks", &element);
- }
- else {
+ } else {
size_t targetLength = 0;
auto numTokens = Content->Tokens().size();
// First time compute size (it could be large like 64Gb and it is good to allocate it once)
- for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx)
- {
+ for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx) {
const Token& dataToken = GetRequiredToken(*Content, tokenIdx);
size_t tokenLength = dataToken.end() - dataToken.begin() - 2; // ignore double quotes
const char* base64data = dataToken.begin() + 1;
const size_t outLength = Util::ComputeDecodedSizeBase64(base64data, tokenLength);
- if (outLength == 0)
- {
+ if (outLength == 0) {
DOMError("Corrupted embedded content found", &element);
}
targetLength += outLength;
}
- if (targetLength == 0)
- {
+ if (targetLength == 0) {
DOMError("Corrupted embedded content found", &element);
}
content = new uint8_t[targetLength];
contentLength = static_cast(targetLength);
size_t dst_offset = 0;
- for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx)
- {
+ for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx) {
const Token& dataToken = GetRequiredToken(*Content, tokenIdx);
size_t tokenLength = dataToken.end() - dataToken.begin() - 2; // ignore double quotes
const char* base64data = dataToken.begin() + 1;
dst_offset += Util::DecodeBase64(base64data, tokenLength, content + dst_offset, targetLength - dst_offset);
}
- if (targetLength != dst_offset)
- {
+ if (targetLength != dst_offset) {
delete[] content;
contentLength = 0;
DOMError("Corrupted embedded content found", &element);
}
}
- }
- else if (static_cast(token.end() - data) < 5) {
+ } else if (static_cast(token.end() - data) < 5) {
DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element);
- }
- else if (*data != 'R') {
+ } else if (*data != 'R') {
DOMWarning("video content is not raw binary data, ignoring", &element);
- }
- else {
+ } else {
// read number of elements
uint32_t len = 0;
::memcpy(&len, data + 1, sizeof(len));
@@ -380,8 +350,7 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
content = new uint8_t[len];
::memcpy(content, data + 5, len);
}
- } catch (const runtime_error& runtimeError)
- {
+ } catch (const runtime_error& runtimeError) {
//we don't need the content data for contents that has already been loaded
ASSIMP_LOG_VERBOSE_DEBUG_F("Caught exception in FBXMaterial (likely because content was already loaded): ",
runtimeError.what());
@@ -392,14 +361,11 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
}
-Video::~Video()
-{
- if(content) {
- delete[] content;
- }
+Video::~Video() {
+ delete[] content;
}
} //!FBX
} //!Assimp
-#endif
+#endif // ASSIMP_BUILD_NO_FBX_IMPORTER
diff --git a/code/AssetLib/FBX/FBXMeshGeometry.cpp b/code/AssetLib/FBX/FBXMeshGeometry.cpp
index da96934d6..2bca8dff2 100644
--- a/code/AssetLib/FBX/FBXMeshGeometry.cpp
+++ b/code/AssetLib/FBX/FBXMeshGeometry.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -330,7 +330,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
}
const Element* Name = source["Name"];
- m_uvNames[index] = "";
+ m_uvNames[index] = std::string();
if(Name) {
m_uvNames[index] = ParseTokenAsString(GetRequiredToken(*Name,0));
}
@@ -508,6 +508,12 @@ void ResolveVertexDataArray(std::vector& data_out, const Scope& source,
std::vector uvIndices;
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
+ if (uvIndices.size() > vertex_count) {
+ FBXImporter::LogWarn(Formatter::format("trimming length of input array for ByPolygonVertex mapping: ")
+ << uvIndices.size() << ", expected " << vertex_count);
+ uvIndices.resize(vertex_count);
+ }
+
if (uvIndices.size() != vertex_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
<< uvIndices.size() << ", expected " << vertex_count);
diff --git a/code/AssetLib/FBX/FBXMeshGeometry.h b/code/AssetLib/FBX/FBXMeshGeometry.h
index f30f527d6..ae17860e3 100644
--- a/code/AssetLib/FBX/FBXMeshGeometry.h
+++ b/code/AssetLib/FBX/FBXMeshGeometry.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXModel.cpp b/code/AssetLib/FBX/FBXModel.cpp
index 74acfa63f..7d08ff312 100644
--- a/code/AssetLib/FBX/FBXModel.cpp
+++ b/code/AssetLib/FBX/FBXModel.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXNodeAttribute.cpp b/code/AssetLib/FBX/FBXNodeAttribute.cpp
index 2ebf917e3..6f6869d6a 100644
--- a/code/AssetLib/FBX/FBXNodeAttribute.cpp
+++ b/code/AssetLib/FBX/FBXNodeAttribute.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp
index 8d4bbd866..37cf83cf9 100644
--- a/code/AssetLib/FBX/FBXParser.cpp
+++ b/code/AssetLib/FBX/FBXParser.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -462,7 +462,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
if (t.Type() != TokenType_DATA) {
err_out = "expected TOK_DATA token";
- return "";
+ return std::string();
}
if(t.IsBinary())
@@ -470,7 +470,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
const char* data = t.begin();
if (data[0] != 'S') {
err_out = "failed to parse S(tring), unexpected data type (binary)";
- return "";
+ return std::string();
}
// read string length
@@ -484,13 +484,13 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
const size_t length = static_cast(t.end() - t.begin());
if(length < 2) {
err_out = "token is too short to hold a string";
- return "";
+ return std::string();
}
const char* s = t.begin(), *e = t.end() - 1;
if (*s != '\"' || *e != '\"') {
err_out = "expected double quoted string";
- return "";
+ return std::string();
}
return std::string(s+1,length-2);
diff --git a/code/AssetLib/FBX/FBXParser.h b/code/AssetLib/FBX/FBXParser.h
index 3ee3d5033..db1e41f3d 100644
--- a/code/AssetLib/FBX/FBXParser.h
+++ b/code/AssetLib/FBX/FBXParser.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXProperties.cpp b/code/AssetLib/FBX/FBXProperties.cpp
index 84098cf10..1e4cd0ead 100644
--- a/code/AssetLib/FBX/FBXProperties.cpp
+++ b/code/AssetLib/FBX/FBXProperties.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -155,7 +155,7 @@ std::string PeekPropertyName(const Element& element)
ai_assert(element.KeyToken().StringContents() == "P");
const TokenList& tok = element.Tokens();
if(tok.size() < 4) {
- return "";
+ return std::string();
}
return ParseTokenAsString(*tok[0]);
diff --git a/code/AssetLib/FBX/FBXProperties.h b/code/AssetLib/FBX/FBXProperties.h
index 58793d7ae..9ab784fa7 100644
--- a/code/AssetLib/FBX/FBXProperties.h
+++ b/code/AssetLib/FBX/FBXProperties.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXTokenizer.cpp b/code/AssetLib/FBX/FBXTokenizer.cpp
index 2bb054d8e..24971d18c 100644
--- a/code/AssetLib/FBX/FBXTokenizer.cpp
+++ b/code/AssetLib/FBX/FBXTokenizer.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXTokenizer.h b/code/AssetLib/FBX/FBXTokenizer.h
index b9a5c307c..6d528970a 100644
--- a/code/AssetLib/FBX/FBXTokenizer.h
+++ b/code/AssetLib/FBX/FBXTokenizer.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXUtil.cpp b/code/AssetLib/FBX/FBXUtil.cpp
index 983730011..66abf0565 100644
--- a/code/AssetLib/FBX/FBXUtil.cpp
+++ b/code/AssetLib/FBX/FBXUtil.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/FBX/FBXUtil.h b/code/AssetLib/FBX/FBXUtil.h
index 82d53eea1..a4a1a9ec2 100644
--- a/code/AssetLib/FBX/FBXUtil.h
+++ b/code/AssetLib/FBX/FBXUtil.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/HMP/HMPFileData.h b/code/AssetLib/HMP/HMPFileData.h
index bad8dde5c..48b01e782 100644
--- a/code/AssetLib/HMP/HMPFileData.h
+++ b/code/AssetLib/HMP/HMPFileData.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/HMP/HMPLoader.cpp b/code/AssetLib/HMP/HMPLoader.cpp
index 8ccba2ea4..56401f5c9 100644
--- a/code/AssetLib/HMP/HMPLoader.cpp
+++ b/code/AssetLib/HMP/HMPLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -157,7 +157,10 @@ void HMPImporter::InternReadFile(const std::string &pFile,
szBuffer[2] = ((char *)&iMagic)[2];
szBuffer[3] = ((char *)&iMagic)[3];
szBuffer[4] = '\0';
-
+
+ delete[] mBuffer;
+ mBuffer = nullptr;
+
// We're definitely unable to load this file
throw DeadlyImportError("Unknown HMP subformat ", pFile,
". Magic word (", szBuffer, ") is not known");
diff --git a/code/AssetLib/HMP/HMPLoader.h b/code/AssetLib/HMP/HMPLoader.h
index 2995c1237..880aeecc9 100644
--- a/code/AssetLib/HMP/HMPLoader.h
+++ b/code/AssetLib/HMP/HMPLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/HMP/HalfLifeFileData.h b/code/AssetLib/HMP/HalfLifeFileData.h
index d7db1476c..125195646 100644
--- a/code/AssetLib/HMP/HalfLifeFileData.h
+++ b/code/AssetLib/HMP/HalfLifeFileData.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/IFC/IFCBoolean.cpp b/code/AssetLib/IFC/IFCBoolean.cpp
index 1e3a0c61f..6015920c1 100644
--- a/code/AssetLib/IFC/IFCBoolean.cpp
+++ b/code/AssetLib/IFC/IFCBoolean.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/code/AssetLib/IFC/IFCCurve.cpp b/code/AssetLib/IFC/IFCCurve.cpp
index c9d33961d..28cd9690c 100644
--- a/code/AssetLib/IFC/IFCCurve.cpp
+++ b/code/AssetLib/IFC/IFCCurve.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/IFC/IFCGeometry.cpp b/code/AssetLib/IFC/IFCGeometry.cpp
index 7e8a06bbb..664444443 100644
--- a/code/AssetLib/IFC/IFCGeometry.cpp
+++ b/code/AssetLib/IFC/IFCGeometry.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -656,7 +656,7 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te
}
}
- if( openings && ((sides_with_openings == 1 && sides_with_openings) || (sides_with_v_openings == 2 && sides_with_v_openings)) ) {
+ if( openings && (sides_with_openings == 1 || sides_with_v_openings == 2 ) ) {
IFCImporter::LogWarn("failed to resolve all openings, presumably their topology is not supported by Assimp");
}
diff --git a/code/AssetLib/IFC/IFCLoader.cpp b/code/AssetLib/IFC/IFCLoader.cpp
index 5201f87b9..bdac1801a 100644
--- a/code/AssetLib/IFC/IFCLoader.cpp
+++ b/code/AssetLib/IFC/IFCLoader.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -115,7 +115,7 @@ static const aiImporterDesc desc = {
0,
0,
0,
- "ifc ifczip stp"
+ "ifc ifczip step stp"
};
// ------------------------------------------------------------------------------------------------
@@ -567,7 +567,7 @@ typedef std::map Metadata;
// ------------------------------------------------------------------------------------------------
void ProcessMetadata(const Schema_2x3::ListOf, 1, 0> &set, ConversionData &conv, Metadata &properties,
- const std::string &prefix = "",
+ const std::string &prefix = std::string(),
unsigned int nest = 0) {
for (const Schema_2x3::IfcProperty &property : set) {
const std::string &key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
@@ -618,7 +618,7 @@ void ProcessMetadata(const Schema_2x3::ListOfHasProperties, conv, properties, key, nest + 1);
}
} else {
- properties[key] = "";
+ properties[key] = std::string();
}
}
}
diff --git a/code/AssetLib/IFC/IFCLoader.h b/code/AssetLib/IFC/IFCLoader.h
index 4abfe00f1..96374bfce 100644
--- a/code/AssetLib/IFC/IFCLoader.h
+++ b/code/AssetLib/IFC/IFCLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/IFC/IFCMaterial.cpp b/code/AssetLib/IFC/IFCMaterial.cpp
index 832712cd4..e0146b887 100644
--- a/code/AssetLib/IFC/IFCMaterial.cpp
+++ b/code/AssetLib/IFC/IFCMaterial.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/IFC/IFCOpenings.cpp b/code/AssetLib/IFC/IFCOpenings.cpp
index e15691957..b7665582c 100644
--- a/code/AssetLib/IFC/IFCOpenings.cpp
+++ b/code/AssetLib/IFC/IFCOpenings.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@@ -1189,20 +1189,9 @@ bool GenerateOpenings(std::vector& openings,
TempMesh* profile_data = opening.profileMesh.get();
bool is_2d_source = false;
if (opening.profileMesh2D && norm_extrusion_dir.SquareLength() > 0) {
-
- if(std::fabs(norm_extrusion_dir * wall_extrusion_axis_norm) < 0.1) {
- // horizontal extrusion
- if (std::fabs(norm_extrusion_dir * nor) > 0.9) {
- profile_data = opening.profileMesh2D.get();
- is_2d_source = true;
- }
- }
- else {
- // vertical extrusion
- if (std::fabs(norm_extrusion_dir * nor) > 0.9) {
- profile_data = opening.profileMesh2D.get();
- is_2d_source = true;
- }
+ if (std::fabs(norm_extrusion_dir * nor) > 0.9) {
+ profile_data = opening.profileMesh2D.get();
+ is_2d_source = true;
}
}
std::vector profile_verts = profile_data->mVerts;
diff --git a/code/AssetLib/IFC/IFCProfile.cpp b/code/AssetLib/IFC/IFCProfile.cpp
index a1a1b3967..f33f8cdbe 100644
--- a/code/AssetLib/IFC/IFCProfile.cpp
+++ b/code/AssetLib/IFC/IFCProfile.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/IFC/IFCUtil.cpp b/code/AssetLib/IFC/IFCUtil.cpp
index e1a733828..b451262e9 100644
--- a/code/AssetLib/IFC/IFCUtil.cpp
+++ b/code/AssetLib/IFC/IFCUtil.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/IFC/IFCUtil.h b/code/AssetLib/IFC/IFCUtil.h
index 2b7fba3b2..a1190746b 100644
--- a/code/AssetLib/IFC/IFCUtil.h
+++ b/code/AssetLib/IFC/IFCUtil.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp
index e176e83a6..ed92c93bb 100644
--- a/code/AssetLib/Irr/IRRLoader.cpp
+++ b/code/AssetLib/Irr/IRRLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -859,7 +859,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// Check whether we can read from the file
if (file.get() == nullptr) {
- throw DeadlyImportError("Failed to open IRR file " + pFile + "");
+ throw DeadlyImportError("Failed to open IRR file " + pFile);
}
// Construct the irrXML parser
diff --git a/code/AssetLib/Irr/IRRLoader.h b/code/AssetLib/Irr/IRRLoader.h
index b9e6486f4..535f6481d 100644
--- a/code/AssetLib/Irr/IRRLoader.h
+++ b/code/AssetLib/Irr/IRRLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/Irr/IRRMeshLoader.cpp b/code/AssetLib/Irr/IRRMeshLoader.cpp
index b6a9b4777..edcff6c83 100644
--- a/code/AssetLib/Irr/IRRMeshLoader.cpp
+++ b/code/AssetLib/Irr/IRRMeshLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
@@ -135,7 +135,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
// Check whether we can read from the file
if (file.get() == NULL)
- throw DeadlyImportError("Failed to open IRRMESH file " + pFile + "");
+ throw DeadlyImportError("Failed to open IRRMESH file " + pFile);
// Construct the irrXML parser
XmlParser parser;
diff --git a/code/AssetLib/Irr/IRRMeshLoader.h b/code/AssetLib/Irr/IRRMeshLoader.h
index b77033ea2..948a6ba3d 100644
--- a/code/AssetLib/Irr/IRRMeshLoader.h
+++ b/code/AssetLib/Irr/IRRMeshLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/Irr/IRRShared.cpp b/code/AssetLib/Irr/IRRShared.cpp
index a809f7ce6..b119b063a 100644
--- a/code/AssetLib/Irr/IRRShared.cpp
+++ b/code/AssetLib/Irr/IRRShared.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/LWO/LWOAnimation.cpp b/code/AssetLib/LWO/LWOAnimation.cpp
index d4b69b00b..d9208616d 100644
--- a/code/AssetLib/LWO/LWOAnimation.cpp
+++ b/code/AssetLib/LWO/LWOAnimation.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/LWO/LWOAnimation.h b/code/AssetLib/LWO/LWOAnimation.h
index 329548ef4..1ed8caf88 100644
--- a/code/AssetLib/LWO/LWOAnimation.h
+++ b/code/AssetLib/LWO/LWOAnimation.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/LWO/LWOBLoader.cpp b/code/AssetLib/LWO/LWOBLoader.cpp
index 751a7c18a..2654eccf4 100644
--- a/code/AssetLib/LWO/LWOBLoader.cpp
+++ b/code/AssetLib/LWO/LWOBLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/LWO/LWOFileData.h b/code/AssetLib/LWO/LWOFileData.h
index 4f85fc5f4..93ac1a236 100644
--- a/code/AssetLib/LWO/LWOFileData.h
+++ b/code/AssetLib/LWO/LWOFileData.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -502,7 +502,7 @@ struct Surface {
Surface() :
mColor(0.78431f, 0.78431f, 0.78431f), bDoubleSided(false), mDiffuseValue(1.f), mSpecularValue(0.f), mTransparency(0.f), mGlossiness(0.4f), mLuminosity(0.f), mColorHighlights(0.f), mMaximumSmoothAngle(0.f) // 0 == not specified, no smoothing
,
- mVCMap(""),
+ mVCMap(),
mVCMapType(AI_LWO_RGBA),
mIOR(1.f) // vakuum
,
diff --git a/code/AssetLib/LWO/LWOLoader.cpp b/code/AssetLib/LWO/LWOLoader.cpp
index 149360559..a9fa08f11 100644
--- a/code/AssetLib/LWO/LWOLoader.cpp
+++ b/code/AssetLib/LWO/LWOLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/LWO/LWOLoader.h b/code/AssetLib/LWO/LWOLoader.h
index 1ab85033f..31911945f 100644
--- a/code/AssetLib/LWO/LWOLoader.h
+++ b/code/AssetLib/LWO/LWOLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/LWO/LWOMaterial.cpp b/code/AssetLib/LWO/LWOMaterial.cpp
index be2892829..9d51438d7 100644
--- a/code/AssetLib/LWO/LWOMaterial.cpp
+++ b/code/AssetLib/LWO/LWOMaterial.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/LWS/LWSLoader.cpp b/code/AssetLib/LWS/LWSLoader.cpp
index 2a5cbeb8d..a75b90ef9 100644
--- a/code/AssetLib/LWS/LWSLoader.cpp
+++ b/code/AssetLib/LWS/LWSLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/LWS/LWSLoader.h b/code/AssetLib/LWS/LWSLoader.h
index 5f4cb204f..cd7a0543e 100644
--- a/code/AssetLib/LWS/LWSLoader.h
+++ b/code/AssetLib/LWS/LWSLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -88,7 +88,7 @@ struct NodeDesc {
id(),
number(0),
parent(0),
- name(""),
+ name(),
isPivotSet(false),
lightColor(1.f, 1.f, 1.f),
lightIntensity(1.f),
diff --git a/code/AssetLib/M3D/M3DExporter.cpp b/code/AssetLib/M3D/M3DExporter.cpp
index d26722b17..856932947 100644
--- a/code/AssetLib/M3D/M3DExporter.cpp
+++ b/code/AssetLib/M3D/M3DExporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
diff --git a/code/AssetLib/M3D/M3DExporter.h b/code/AssetLib/M3D/M3DExporter.h
index 40fce44d0..95313baa2 100644
--- a/code/AssetLib/M3D/M3DExporter.h
+++ b/code/AssetLib/M3D/M3DExporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
diff --git a/code/AssetLib/M3D/M3DImporter.cpp b/code/AssetLib/M3D/M3DImporter.cpp
index 05b75148b..b7ba74c8a 100644
--- a/code/AssetLib/M3D/M3DImporter.cpp
+++ b/code/AssetLib/M3D/M3DImporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
@@ -95,10 +95,9 @@ static const aiImporterDesc desc = {
0,
0,
0,
-#ifdef M3D_ASCII
- "m3d a3d"
-#else
"m3d"
+#ifdef M3D_ASCII
+ " a3d"
#endif
};
diff --git a/code/AssetLib/M3D/M3DImporter.h b/code/AssetLib/M3D/M3DImporter.h
index 5c9d4fad8..7a2a9fbd3 100644
--- a/code/AssetLib/M3D/M3DImporter.h
+++ b/code/AssetLib/M3D/M3DImporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
diff --git a/code/AssetLib/M3D/M3DMaterials.h b/code/AssetLib/M3D/M3DMaterials.h
index 1aa6f7536..13b76825b 100644
--- a/code/AssetLib/M3D/M3DMaterials.h
+++ b/code/AssetLib/M3D/M3DMaterials.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
diff --git a/code/AssetLib/M3D/M3DWrapper.cpp b/code/AssetLib/M3D/M3DWrapper.cpp
index df3c6bd0c..aa122f5b2 100644
--- a/code/AssetLib/M3D/M3DWrapper.cpp
+++ b/code/AssetLib/M3D/M3DWrapper.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
diff --git a/code/AssetLib/M3D/M3DWrapper.h b/code/AssetLib/M3D/M3DWrapper.h
index bf3ab7bc9..5c370e607 100644
--- a/code/AssetLib/M3D/M3DWrapper.h
+++ b/code/AssetLib/M3D/M3DWrapper.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
Copyright (c) 2019 bzt
All rights reserved.
diff --git a/code/AssetLib/M3D/m3d.h b/code/AssetLib/M3D/m3d.h
index c25c633ba..dfc30aec3 100644
--- a/code/AssetLib/M3D/m3d.h
+++ b/code/AssetLib/M3D/m3d.h
@@ -1642,7 +1642,7 @@ static int _m3dstbi__expand_png_palette(_m3dstbi__png *a, unsigned char *palette
static int _m3dstbi__parse_png_file(_m3dstbi__png *z, int scan, int req_comp) {
unsigned char palette[1024], pal_img_n = 0;
unsigned char has_trans = 0, tc[3] = {};
- _m3dstbi__uint16 tc16[3];
+ _m3dstbi__uint16 tc16[3] = {};
_m3dstbi__uint32 ioff = 0, idata_limit = 0, i, pal_len = 0;
int first = 1, k, interlace = 0, color = 0;
_m3dstbi__context *s = z->s;
diff --git a/code/AssetLib/MD2/MD2FileData.h b/code/AssetLib/MD2/MD2FileData.h
index 911cd4b98..8eb602e50 100644
--- a/code/AssetLib/MD2/MD2FileData.h
+++ b/code/AssetLib/MD2/MD2FileData.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MD2/MD2Loader.cpp b/code/AssetLib/MD2/MD2Loader.cpp
index 87b7a5609..9ccbcdfca 100644
--- a/code/AssetLib/MD2/MD2Loader.cpp
+++ b/code/AssetLib/MD2/MD2Loader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/MD2/MD2Loader.h b/code/AssetLib/MD2/MD2Loader.h
index cbebc90a4..c8866b92b 100644
--- a/code/AssetLib/MD2/MD2Loader.h
+++ b/code/AssetLib/MD2/MD2Loader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MD2/MD2NormalTable.h b/code/AssetLib/MD2/MD2NormalTable.h
index c5c790872..b2330d862 100644
--- a/code/AssetLib/MD2/MD2NormalTable.h
+++ b/code/AssetLib/MD2/MD2NormalTable.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_MDL_NORMALTABLE_H_INC
-float g_avNormals[162][3] = {
+const float g_avNormals[162][3] = {
{ -0.525731f, 0.000000f, 0.850651f },
{ -0.442863f, 0.238856f, 0.864188f },
{ -0.295242f, 0.000000f, 0.955423f },
diff --git a/code/AssetLib/MD3/MD3FileData.h b/code/AssetLib/MD3/MD3FileData.h
index a98af199c..a44f688f9 100644
--- a/code/AssetLib/MD3/MD3FileData.h
+++ b/code/AssetLib/MD3/MD3FileData.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MD3/MD3Loader.cpp b/code/AssetLib/MD3/MD3Loader.cpp
index 9c31a7b20..e27079766 100644
--- a/code/AssetLib/MD3/MD3Loader.cpp
+++ b/code/AssetLib/MD3/MD3Loader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/MD3/MD3Loader.h b/code/AssetLib/MD3/MD3Loader.h
index 8d8304345..d34df2d77 100644
--- a/code/AssetLib/MD3/MD3Loader.h
+++ b/code/AssetLib/MD3/MD3Loader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MD5/MD5Loader.cpp b/code/AssetLib/MD5/MD5Loader.cpp
index 1741f4472..b99638cd2 100644
--- a/code/AssetLib/MD5/MD5Loader.cpp
+++ b/code/AssetLib/MD5/MD5Loader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MD5/MD5Loader.h b/code/AssetLib/MD5/MD5Loader.h
index f62a57e68..53b7afd3c 100644
--- a/code/AssetLib/MD5/MD5Loader.h
+++ b/code/AssetLib/MD5/MD5Loader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MD5/MD5Parser.cpp b/code/AssetLib/MD5/MD5Parser.cpp
index 345f0e10c..a69275507 100644
--- a/code/AssetLib/MD5/MD5Parser.cpp
+++ b/code/AssetLib/MD5/MD5Parser.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
diff --git a/code/AssetLib/MD5/MD5Parser.h b/code/AssetLib/MD5/MD5Parser.h
index 692cb72ba..d36114b6d 100644
--- a/code/AssetLib/MD5/MD5Parser.h
+++ b/code/AssetLib/MD5/MD5Parser.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MDC/MDCFileData.h b/code/AssetLib/MDC/MDCFileData.h
index 9ec73c170..616556f03 100644
--- a/code/AssetLib/MDC/MDCFileData.h
+++ b/code/AssetLib/MDC/MDCFileData.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MDC/MDCLoader.cpp b/code/AssetLib/MDC/MDCLoader.cpp
index 0e917171c..17a349768 100644
--- a/code/AssetLib/MDC/MDCLoader.cpp
+++ b/code/AssetLib/MDC/MDCLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -250,7 +250,7 @@ void MDCImporter::InternReadFile(
// get the number of valid surfaces
BE_NCONST MDC::Surface *pcSurface, *pcSurface2;
- pcSurface = pcSurface2 = new (mBuffer + pcHeader->ulOffsetSurfaces) MDC::Surface;
+ pcSurface = pcSurface2 = reinterpret_cast(mBuffer + pcHeader->ulOffsetSurfaces);
unsigned int iNumShaders = 0;
for (unsigned int i = 0; i < pcHeader->ulNumSurfaces; ++i) {
// validate the surface header
@@ -260,7 +260,7 @@ void MDCImporter::InternReadFile(
++pScene->mNumMeshes;
}
iNumShaders += pcSurface2->ulNumShaders;
- pcSurface2 = new ((int8_t *)pcSurface2 + pcSurface2->ulOffsetEnd) MDC::Surface;
+ pcSurface2 = reinterpret_cast((BE_NCONST int8_t *)pcSurface2 + pcSurface2->ulOffsetEnd);
}
aszShaders.reserve(iNumShaders);
pScene->mMeshes = new aiMesh *[pScene->mNumMeshes];
@@ -405,7 +405,7 @@ void MDCImporter::InternReadFile(
pcFaceCur->mIndices[2] = iOutIndex + 0;
}
- pcSurface = new ((int8_t *)pcSurface + pcSurface->ulOffsetEnd) MDC::Surface;
+ pcSurface = reinterpret_cast((BE_NCONST int8_t *)pcSurface + pcSurface->ulOffsetEnd);
}
// create a flat node graph with a root node and one child for each surface
diff --git a/code/AssetLib/MDC/MDCLoader.h b/code/AssetLib/MDC/MDCLoader.h
index abd23bb19..d611b5e46 100644
--- a/code/AssetLib/MDC/MDCLoader.h
+++ b/code/AssetLib/MDC/MDCLoader.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MDC/MDCNormalTable.h b/code/AssetLib/MDC/MDCNormalTable.h
index f47e97f33..c96eba7bd 100644
--- a/code/AssetLib/MDC/MDCNormalTable.h
+++ b/code/AssetLib/MDC/MDCNormalTable.h
@@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MDC_NORMAL_TABLE_INCLUDED
/* mdc decoding normal table */
-float mdcNormals[ 256 ][ 3 ] =
+const float mdcNormals[ 256 ][ 3 ] =
{
{ 1.000000f, 0.000000f, 0.000000f },
{ 0.980785f, 0.195090f, 0.000000f },
diff --git a/code/AssetLib/MDL/HalfLife/HL1FileData.h b/code/AssetLib/MDL/HalfLife/HL1FileData.h
index a3cbb3439..30dca0d0a 100644
--- a/code/AssetLib/MDL/HalfLife/HL1FileData.h
+++ b/code/AssetLib/MDL/HalfLife/HL1FileData.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h b/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h
index 29b1cdceb..47b4fbb31 100644
--- a/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h
+++ b/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h b/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h
index 50be1f366..d52305e44 100644
--- a/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h
+++ b/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp
index c57b43c11..eee9ed346 100644
--- a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp
+++ b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -57,6 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
+#include