diff --git a/Engine/lib/assimp/INSTALL b/Engine/lib/assimp/INSTALL
new file mode 100644
index 000000000..410050b10
--- /dev/null
+++ b/Engine/lib/assimp/INSTALL
@@ -0,0 +1,17 @@
+
+========================================================================
+Open Asset Import Library (assimp) INSTALL
+========================================================================
+
+------------------------------
+Getting the documentation
+------------------------------
+
+A regularly-updated copy is available at
+https://assimp-docs.readthedocs.io/en/latest/
+
+------------------------------
+Building Assimp
+------------------------------
+
+Just check the build-instructions which you can find here: https://github.com/assimp/assimp/blob/master/Build.md
diff --git a/Engine/lib/assimp/Readme.md b/Engine/lib/assimp/Readme.md
index f4167c9f2..0a04da999 100644
--- a/Engine/lib/assimp/Readme.md
+++ b/Engine/lib/assimp/Readme.md
@@ -9,9 +9,11 @@ A library to import and export various 3d-model-formats including scene-post-pro
src="https://scan.coverity.com/projects/5607/badge.svg"/>
[](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade)
+
[](https://coveralls.io/github/assimp/assimp?branch=master)
[](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
+[](http://isitmaintained.com/project/assimp/assimp "Percentage of issues still open")
[](https://lgtm.com/projects/g/assimp/assimp/alerts/)
@@ -58,6 +60,7 @@ Open Asset Import Library is implemented in C++. The directory structure looks l
/code Source code
/contrib Third-party libraries
/doc Documentation (doxysource and pre-compiled docs)
+ /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
/port Ports to other languages and scripts to maintain those.
diff --git a/Engine/lib/assimp/code/AssetLib/3DS/3DSConverter.cpp b/Engine/lib/assimp/code/AssetLib/3DS/3DSConverter.cpp
index 5a01429e4..b4f625b76 100644
--- a/Engine/lib/assimp/code/AssetLib/3DS/3DSConverter.cpp
+++ b/Engine/lib/assimp/code/AssetLib/3DS/3DSConverter.cpp
@@ -262,6 +262,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
unsigned int iWire = 1;
mat.AddProperty((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME);
}
+ [[fallthrough]];
case D3DS::Discreet3DS::Gouraud:
eShading = aiShadingMode_Gouraud;
diff --git a/Engine/lib/assimp/code/AssetLib/3DS/3DSExporter.cpp b/Engine/lib/assimp/code/AssetLib/3DS/3DSExporter.cpp
index 71588f935..1b335a272 100644
--- a/Engine/lib/assimp/code/AssetLib/3DS/3DSExporter.cpp
+++ b/Engine/lib/assimp/code/AssetLib/3DS/3DSExporter.cpp
@@ -209,9 +209,7 @@ Discreet3DSExporter::Discreet3DSExporter(std::shared_ptr &outfile, con
}
// ------------------------------------------------------------------------------------------------
-Discreet3DSExporter::~Discreet3DSExporter() {
- // empty
-}
+Discreet3DSExporter::~Discreet3DSExporter() = default;
// ------------------------------------------------------------------------------------------------
int Discreet3DSExporter::WriteHierarchy(const aiNode &node, int seq, int sibling_level) {
diff --git a/Engine/lib/assimp/code/AssetLib/3DS/3DSLoader.cpp b/Engine/lib/assimp/code/AssetLib/3DS/3DSLoader.cpp
index 0ec8b872a..769e8a6ee 100644
--- a/Engine/lib/assimp/code/AssetLib/3DS/3DSLoader.cpp
+++ b/Engine/lib/assimp/code/AssetLib/3DS/3DSLoader.cpp
@@ -105,9 +105,7 @@ Discreet3DSImporter::Discreet3DSImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
-Discreet3DSImporter::~Discreet3DSImporter() {
- // empty
-}
+Discreet3DSImporter::~Discreet3DSImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@@ -319,7 +317,7 @@ void Discreet3DSImporter::ParseObjectChunk() {
case Discreet3DS::CHUNK_MAT_MATERIAL:
// Add a new material to the list
- mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size()))));
+ mScene->mMaterials.emplace_back(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size())));
ParseMaterialChunk();
break;
@@ -370,7 +368,7 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
switch (chunk.Flag) {
case Discreet3DS::CHUNK_TRIMESH: {
// this starts a new triangle mesh
- mScene->mMeshes.push_back(D3DS::Mesh(std::string(name, num)));
+ mScene->mMeshes.emplace_back(std::string(name, num));
// Read mesh chunks
ParseMeshChunk();
@@ -999,7 +997,7 @@ void Discreet3DSImporter::ParseMeshChunk() {
mMesh.mFaces.reserve(num);
while (num-- > 0) {
// 3DS faces are ALWAYS triangles
- mMesh.mFaces.push_back(D3DS::Face());
+ mMesh.mFaces.emplace_back();
D3DS::Face &sFace = mMesh.mFaces.back();
sFace.mIndices[0] = (uint16_t)stream->GetI2();
@@ -1284,7 +1282,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
switch (chunk.Flag) {
case Discreet3DS::CHUNK_LINRGBF:
bGamma = true;
-
+ // fallthrough
case Discreet3DS::CHUNK_RGBF:
if (sizeof(float) * 3 > diff) {
*out = clrError;
@@ -1297,6 +1295,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) {
case Discreet3DS::CHUNK_LINRGBB:
bGamma = true;
+ // fallthrough
case Discreet3DS::CHUNK_RGBB: {
if (sizeof(char) * 3 > diff) {
*out = clrError;
diff --git a/Engine/lib/assimp/code/AssetLib/3MF/3MFXmlTags.h b/Engine/lib/assimp/code/AssetLib/3MF/3MFXmlTags.h
index 63f18b455..333d169aa 100644
--- a/Engine/lib/assimp/code/AssetLib/3MF/3MFXmlTags.h
+++ b/Engine/lib/assimp/code/AssetLib/3MF/3MFXmlTags.h
@@ -74,6 +74,8 @@ namespace XmlTag {
const char* const pid = "pid";
const char* const pindex = "pindex";
const char* const p1 = "p1";
+ const char *const p2 = "p2";
+ const char *const p3 = "p3";
const char* const name = "name";
const char* const type = "type";
const char* const build = "build";
diff --git a/Engine/lib/assimp/code/AssetLib/3MF/D3MFImporter.cpp b/Engine/lib/assimp/code/AssetLib/3MF/D3MFImporter.cpp
index 5b0f34c3a..5d9644fa5 100644
--- a/Engine/lib/assimp/code/AssetLib/3MF/D3MFImporter.cpp
+++ b/Engine/lib/assimp/code/AssetLib/3MF/D3MFImporter.cpp
@@ -81,14 +81,9 @@ static const aiImporterDesc desc = {
"3mf"
};
-D3MFImporter::D3MFImporter() :
- BaseImporter() {
- // empty
-}
+D3MFImporter::D3MFImporter() = default;
-D3MFImporter::~D3MFImporter() {
- // empty
-}
+D3MFImporter::~D3MFImporter() = default;
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
diff --git a/Engine/lib/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp b/Engine/lib/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp
index f88039ae8..a2182dc29 100644
--- a/Engine/lib/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp
+++ b/Engine/lib/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp
@@ -186,6 +186,9 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) :
D3MFOpcPackage::~D3MFOpcPackage() {
mZipArchive->Close(mRootStream);
delete mZipArchive;
+ for (auto tex : mEmbeddedTextures) {
+ delete tex;
+ }
}
IOStream *D3MFOpcPackage::RootStream() const {
diff --git a/Engine/lib/assimp/code/AssetLib/3MF/XmlSerializer.cpp b/Engine/lib/assimp/code/AssetLib/3MF/XmlSerializer.cpp
index 9bd1c5bb0..043ac84cc 100644
--- a/Engine/lib/assimp/code/AssetLib/3MF/XmlSerializer.cpp
+++ b/Engine/lib/assimp/code/AssetLib/3MF/XmlSerializer.cpp
@@ -64,7 +64,7 @@ bool validateColorString(const char *color) {
return true;
}
-aiFace ReadTriangle(XmlNode &node) {
+aiFace ReadTriangle(XmlNode &node, int &texId0, int &texId1, int &texId2) {
aiFace face;
face.mNumIndices = 3;
@@ -73,6 +73,11 @@ aiFace ReadTriangle(XmlNode &node) {
face.mIndices[1] = static_cast(std::atoi(node.attribute(XmlTag::v2).as_string()));
face.mIndices[2] = static_cast(std::atoi(node.attribute(XmlTag::v3).as_string()));
+ texId0 = texId1 = texId2 = -1;
+ XmlParser::getIntAttribute(node, XmlTag::p1, texId0);
+ XmlParser::getIntAttribute(node, XmlTag::p2, texId1);
+ XmlParser::getIntAttribute(node, XmlTag::p3, texId2);
+
return face;
}
@@ -106,7 +111,7 @@ bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &va
return false;
}
-aiMatrix4x4 parseTransformMatrix(std::string matrixStr) {
+aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) {
// split the string
std::vector numbers;
std::string currentNumber;
@@ -412,6 +417,9 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
bool hasPid = getNodeAttribute(currentNode, D3MF::XmlTag::pid, pid);
bool hasP1 = getNodeAttribute(currentNode, D3MF::XmlTag::p1, p1);
+ int texId[3];
+ Texture2DGroup *group = nullptr;
+ aiFace face = ReadTriangle(currentNode, texId[0], texId[1], texId[2]);
if (hasPid && hasP1) {
auto it = mResourcesDictionnary.find(pid);
if (it != mResourcesDictionnary.end()) {
@@ -420,23 +428,34 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
mesh->mMaterialIndex = baseMaterials->mMaterialIndex[p1];
} else if (it->second->getType() == ResourceType::RT_Texture2DGroup) {
if (mesh->mTextureCoords[0] == nullptr) {
- Texture2DGroup *group = static_cast(it->second);
+ mesh->mNumUVComponents[0] = 2;
+ for (unsigned int i = 1; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
+ mesh->mNumUVComponents[i] = 0;
+ }
+
+ group = static_cast(it->second);
const std::string name = ai_to_string(group->mTexId);
for (size_t i = 0; i < mMaterials.size(); ++i) {
if (name == mMaterials[i]->GetName().C_Str()) {
mesh->mMaterialIndex = static_cast(i);
}
}
- mesh->mTextureCoords[0] = new aiVector3D[group->mTex2dCoords.size()];
- for (unsigned int i = 0; i < group->mTex2dCoords.size(); ++i) {
- mesh->mTextureCoords[0][i] = aiVector3D(group->mTex2dCoords[i].x, group->mTex2dCoords[i].y, 0);
- }
+ mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
}
}
}
}
- aiFace face = ReadTriangle(currentNode);
+ // Load texture coordinates into mesh, when any
+ if (group != nullptr) {
+ size_t i0 = face.mIndices[0];
+ size_t i1 = face.mIndices[1];
+ size_t i2 = face.mIndices[2];
+ mesh->mTextureCoords[0][i0] = aiVector3D(group->mTex2dCoords[texId[0]].x, group->mTex2dCoords[texId[0]].y, 0.0f);
+ mesh->mTextureCoords[0][i1] = aiVector3D(group->mTex2dCoords[texId[1]].x, group->mTex2dCoords[texId[1]].y, 0.0f);
+ mesh->mTextureCoords[0][i2] = aiVector3D(group->mTex2dCoords[texId[2]].x, group->mTex2dCoords[texId[2]].y, 0.0f);
+ }
+
faces.push_back(face);
}
}
@@ -578,11 +597,15 @@ aiMaterial *XmlSerializer::readMaterialDef(XmlNode &node, unsigned int basemater
}
void XmlSerializer::StoreMaterialsInScene(aiScene *scene) {
- if (nullptr == scene || mMaterials.empty()) {
+ if (nullptr == scene) {
return;
}
scene->mNumMaterials = static_cast(mMaterials.size());
+ if (scene->mNumMaterials == 0) {
+ return;
+ }
+
scene->mMaterials = new aiMaterial *[scene->mNumMaterials];
for (size_t i = 0; i < mMaterials.size(); ++i) {
scene->mMaterials[i] = mMaterials[i];
diff --git a/Engine/lib/assimp/code/AssetLib/AC/ACLoader.cpp b/Engine/lib/assimp/code/AssetLib/AC/ACLoader.cpp
index e93624b3e..26bc2e9d5 100644
--- a/Engine/lib/assimp/code/AssetLib/AC/ACLoader.cpp
+++ b/Engine/lib/assimp/code/AssetLib/AC/ACLoader.cpp
@@ -146,9 +146,7 @@ AC3DImporter::AC3DImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
-AC3DImporter::~AC3DImporter() {
- // nothing to be done here
-}
+AC3DImporter::~AC3DImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@@ -180,7 +178,7 @@ void AC3DImporter::LoadObjectSection(std::vector