mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
* Adjustment: Update Assimp version to 5.0.1.
This commit is contained in:
parent
14ebeaf3eb
commit
4758f7bdaf
679 changed files with 50502 additions and 19698 deletions
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2019, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <assimp/commonMetaData.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
@ -171,8 +170,6 @@ void glTFImporter::ImportMaterials(glTF::Asset& r) {
|
|||
|
||||
if (mScene->mNumMaterials == 0) {
|
||||
mScene->mNumMaterials = 1;
|
||||
// Delete the array of length zero created above.
|
||||
delete[] mScene->mMaterials;
|
||||
mScene->mMaterials = new aiMaterial*[1];
|
||||
mScene->mMaterials[0] = new aiMaterial();
|
||||
}
|
||||
|
|
@ -222,7 +219,6 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
|||
std::vector<aiMesh*> meshes;
|
||||
|
||||
unsigned int k = 0;
|
||||
meshOffsets.clear();
|
||||
|
||||
for (unsigned int m = 0; m < r.meshes.Size(); ++m) {
|
||||
Mesh& mesh = r.meshes[m];
|
||||
|
|
@ -334,10 +330,6 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
|||
|
||||
case PrimitiveMode_LINES: {
|
||||
nFaces = count / 2;
|
||||
if (nFaces * 2 != count) {
|
||||
ASSIMP_LOG_WARN("The number of vertices was not compatible with the LINES mode. Some vertices were dropped.");
|
||||
count = nFaces * 2;
|
||||
}
|
||||
faces = new aiFace[nFaces];
|
||||
for (unsigned int i = 0; i < count; i += 2) {
|
||||
SetFace(faces[i / 2], data.GetUInt(i), data.GetUInt(i + 1));
|
||||
|
|
@ -361,10 +353,6 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
|||
|
||||
case PrimitiveMode_TRIANGLES: {
|
||||
nFaces = count / 3;
|
||||
if (nFaces * 3 != count) {
|
||||
ASSIMP_LOG_WARN("The number of vertices was not compatible with the TRIANGLES mode. Some vertices were dropped.");
|
||||
count = nFaces * 3;
|
||||
}
|
||||
faces = new aiFace[nFaces];
|
||||
for (unsigned int i = 0; i < count; i += 3) {
|
||||
SetFace(faces[i / 3], data.GetUInt(i), data.GetUInt(i + 1), data.GetUInt(i + 2));
|
||||
|
|
@ -407,10 +395,6 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
|||
|
||||
case PrimitiveMode_LINES: {
|
||||
nFaces = count / 2;
|
||||
if (nFaces * 2 != count) {
|
||||
ASSIMP_LOG_WARN("The number of vertices was not compatible with the LINES mode. Some vertices were dropped.");
|
||||
count = nFaces * 2;
|
||||
}
|
||||
faces = new aiFace[nFaces];
|
||||
for (unsigned int i = 0; i < count; i += 2) {
|
||||
SetFace(faces[i / 2], i, i + 1);
|
||||
|
|
@ -434,10 +418,6 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
|||
|
||||
case PrimitiveMode_TRIANGLES: {
|
||||
nFaces = count / 3;
|
||||
if (nFaces * 3 != count) {
|
||||
ASSIMP_LOG_WARN("The number of vertices was not compatible with the TRIANGLES mode. Some vertices were dropped.");
|
||||
count = nFaces * 3;
|
||||
}
|
||||
faces = new aiFace[nFaces];
|
||||
for (unsigned int i = 0; i < count; i += 3) {
|
||||
SetFace(faces[i / 3], i, i + 1, i + 2);
|
||||
|
|
@ -681,7 +661,6 @@ void glTFImporter::ImportEmbeddedTextures(glTF::Asset& r)
|
|||
size_t length = img.GetDataLength();
|
||||
void* data = img.StealData();
|
||||
|
||||
tex->mFilename = img.name;
|
||||
tex->mWidth = static_cast<unsigned int>(length);
|
||||
tex->mHeight = 0;
|
||||
tex->pcData = reinterpret_cast<aiTexel*>(data);
|
||||
|
|
@ -700,30 +679,6 @@ void glTFImporter::ImportEmbeddedTextures(glTF::Asset& r)
|
|||
}
|
||||
}
|
||||
|
||||
void glTFImporter::ImportCommonMetadata(glTF::Asset& a)
|
||||
{
|
||||
ai_assert(mScene->mMetaData == nullptr);
|
||||
const bool hasVersion = !a.asset.version.empty();
|
||||
const bool hasGenerator = !a.asset.generator.empty();
|
||||
const bool hasCopyright = !a.asset.copyright.empty();
|
||||
if (hasVersion || hasGenerator || hasCopyright)
|
||||
{
|
||||
mScene->mMetaData = new aiMetadata;
|
||||
if (hasVersion)
|
||||
{
|
||||
mScene->mMetaData->Add(AI_METADATA_SOURCE_FORMAT_VERSION, aiString(a.asset.version));
|
||||
}
|
||||
if (hasGenerator)
|
||||
{
|
||||
mScene->mMetaData->Add(AI_METADATA_SOURCE_GENERATOR, aiString(a.asset.generator));
|
||||
}
|
||||
if (hasCopyright)
|
||||
{
|
||||
mScene->mMetaData->Add(AI_METADATA_SOURCE_COPYRIGHT, aiString(a.asset.copyright));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void glTFImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
||||
{
|
||||
// clean all member arrays
|
||||
|
|
@ -750,7 +705,7 @@ void glTFImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOS
|
|||
ImportLights(asset);
|
||||
|
||||
ImportNodes(asset);
|
||||
ImportCommonMetadata(asset);
|
||||
|
||||
|
||||
if (pScene->mNumMeshes == 0) {
|
||||
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue