summaryrefslogtreecommitdiff
path: root/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp')
-rw-r--r--thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp b/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
index 1386e2383c..4a3de9f993 100644
--- a/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
+++ b/thirdparty/assimp/code/FBX/FBXMeshGeometry.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2019, assimp team
+Copyright (c) 2006-2020, assimp team
All rights reserved.
@@ -446,14 +446,19 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
return;
}
std::vector<T> tempData;
- ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
+ ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
- data_out.resize(vertex_count);
- for (size_t i = 0, e = tempData.size(); i < e; ++i) {
+ if (tempData.size() != mapping_offsets.size()) {
+ FBXImporter::LogError(Formatter::format("length of input data unexpected for ByVertice mapping: ")
+ << tempData.size() << ", expected " << mapping_offsets.size());
+ return;
+ }
+ data_out.resize(vertex_count);
+ for (size_t i = 0, e = tempData.size(); i < e; ++i) {
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
for (unsigned int j = istart; j < iend; ++j) {
- data_out[mappings[j]] = tempData[i];
+ data_out[mappings[j]] = tempData[i];
}
}
}
@@ -461,10 +466,17 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
- data_out.resize(vertex_count);
-
std::vector<int> uvIndices;
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
+
+ if (uvIndices.size() != vertex_count) {
+ FBXImporter::LogError(Formatter::format("length of input data unexpected for ByVertice mapping: ")
+ << uvIndices.size() << ", expected " << vertex_count);
+ return;
+ }
+
+ data_out.resize(vertex_count);
+
for (size_t i = 0, e = uvIndices.size(); i < e; ++i) {
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
@@ -493,16 +505,17 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
- data_out.resize(vertex_count);
-
std::vector<int> uvIndices;
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
if (uvIndices.size() != vertex_count) {
- FBXImporter::LogError("length of input data unexpected for ByPolygonVertex mapping");
+ FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
+ << uvIndices.size() << ", expected " << vertex_count);
return;
}
+ data_out.resize(vertex_count);
+
const T empty;
unsigned int next = 0;
for(int i : uvIndices) {