Extra check. Better logging.

pull/3718/head
Malcolm Tyrrell 2021-03-24 11:04:39 +00:00
parent add165c4a1
commit d94ddd32b1
1 changed files with 5 additions and 5 deletions

View File

@ -527,8 +527,8 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
std::fill(aim->mAnimMeshes, aim->mAnimMeshes + aim->mNumAnimMeshes, nullptr); std::fill(aim->mAnimMeshes, aim->mAnimMeshes + aim->mNumAnimMeshes, nullptr);
for (size_t i = 0; i < targets.size(); i++) { for (size_t i = 0; i < targets.size(); i++) {
bool needPositions = targets[i].position.size() > 0; bool needPositions = targets[i].position.size() > 0;
bool needNormals = targets[i].normal.size() > 0; bool needNormals = (targets[i].normal.size() > 0) && aim->HasNormals();
bool needTangents = targets[i].tangent.size() > 0; bool needTangents = (targets[i].tangent.size() > 0) && aim->HasTangentsAndBitangents();
// GLTF morph does not support colors and texCoords // GLTF morph does not support colors and texCoords
aim->mAnimMeshes[i] = aiCreateAnimMesh(aim, aim->mAnimMeshes[i] = aiCreateAnimMesh(aim,
needPositions, needNormals, needTangents, false, false); needPositions, needNormals, needTangents, false, false);
@ -537,7 +537,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
if (needPositions) { if (needPositions) {
if (target.position[0]->count != aim->mNumVertices) { if (target.position[0]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Positions of target in mesh \"" + mesh.name + "\" does not match the vertex count"); ASSIMP_LOG_WARN_F("Positions of target ", i, " in mesh \"", mesh.name, "\" does not match the vertex count");
} else { } else {
aiVector3D *positionDiff = nullptr; aiVector3D *positionDiff = nullptr;
target.position[0]->ExtractData(positionDiff); target.position[0]->ExtractData(positionDiff);
@ -549,7 +549,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
} }
if (needNormals) { if (needNormals) {
if (target.normal[0]->count != aim->mNumVertices) { if (target.normal[0]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Normals of target in mesh \"" + mesh.name + "\" does not match the vertex count"); ASSIMP_LOG_WARN_F("Normals of target ", i, " in mesh \"", mesh.name, "\" does not match the vertex count");
} else { } else {
aiVector3D *normalDiff = nullptr; aiVector3D *normalDiff = nullptr;
target.normal[0]->ExtractData(normalDiff); target.normal[0]->ExtractData(normalDiff);
@ -561,7 +561,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
} }
if (needTangents) { if (needTangents) {
if (target.tangent[0]->count != aim->mNumVertices) { if (target.tangent[0]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Tangents of target in mesh \"" + mesh.name + "\" does not match the vertex count"); ASSIMP_LOG_WARN_F("Tangents of target ", i, " in mesh \"", mesh.name, "\" does not match the vertex count");
} else { } else {
Tangent *tangent = nullptr; Tangent *tangent = nullptr;
attr.tangent[0]->ExtractData(tangent); attr.tangent[0]->ExtractData(tangent);