mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 01:50:12 +02:00
Make the GLTF serializer count all other errors it detects
This commit is contained in:
parent
cd132246e6
commit
dd0439e40d
1 changed files with 23 additions and 0 deletions
|
@ -1063,6 +1063,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
|
|
||||||
if (indicesAccessorIdx > _file.accessors.size()) {
|
if (indicesAccessorIdx > _file.accessors.size()) {
|
||||||
qWarning(modelformat) << "Indices accessor index is out of bounds for model " << _url;
|
qWarning(modelformat) << "Indices accessor index is out of bounds for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,6 +1092,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF INDICES data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF INDICES data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,6 +1108,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
|
|
||||||
if (accessorIdx > _file.accessors.size()) {
|
if (accessorIdx > _file.accessors.size()) {
|
||||||
qWarning(modelformat) << "Accessor index is out of bounds for model " << _url;
|
qWarning(modelformat) << "Accessor index is out of bounds for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1114,23 +1117,27 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
if (key == "POSITION") {
|
if (key == "POSITION") {
|
||||||
if (accessor.type != GLTFAccessorType::VEC3) {
|
if (accessor.type != GLTFAccessorType::VEC3) {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF POSITION data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF POSITION data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = addArrayFromAccessor(accessor, vertices);
|
success = addArrayFromAccessor(accessor, vertices);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF POSITION data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF POSITION data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (key == "NORMAL") {
|
} else if (key == "NORMAL") {
|
||||||
if (accessor.type != GLTFAccessorType::VEC3) {
|
if (accessor.type != GLTFAccessorType::VEC3) {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF NORMAL data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF NORMAL data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = addArrayFromAccessor(accessor, normals);
|
success = addArrayFromAccessor(accessor, normals);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF NORMAL data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF NORMAL data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (key == "TANGENT") {
|
} else if (key == "TANGENT") {
|
||||||
|
@ -1140,12 +1147,14 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
tangentStride = 3;
|
tangentStride = 3;
|
||||||
} else {
|
} else {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF TANGENT data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF TANGENT data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = addArrayFromAccessor(accessor, tangents);
|
success = addArrayFromAccessor(accessor, tangents);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF TANGENT data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF TANGENT data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
tangentStride = 0;
|
tangentStride = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1153,22 +1162,26 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
success = addArrayFromAccessor(accessor, texcoords);
|
success = addArrayFromAccessor(accessor, texcoords);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF TEXCOORD_0 data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF TEXCOORD_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accessor.type != GLTFAccessorType::VEC2) {
|
if (accessor.type != GLTFAccessorType::VEC2) {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF TEXCOORD_0 data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF TEXCOORD_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (key == "TEXCOORD_1") {
|
} else if (key == "TEXCOORD_1") {
|
||||||
success = addArrayFromAccessor(accessor, texcoords2);
|
success = addArrayFromAccessor(accessor, texcoords2);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF TEXCOORD_1 data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF TEXCOORD_1 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accessor.type != GLTFAccessorType::VEC2) {
|
if (accessor.type != GLTFAccessorType::VEC2) {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF TEXCOORD_1 data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF TEXCOORD_1 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (key == "COLOR_0") {
|
} else if (key == "COLOR_0") {
|
||||||
|
@ -1178,12 +1191,14 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
colorStride = 3;
|
colorStride = 3;
|
||||||
} else {
|
} else {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF COLOR_0 data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF COLOR_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = addArrayFromAccessor(accessor, colors);
|
success = addArrayFromAccessor(accessor, colors);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF COLOR_0 data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF COLOR_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (key == "JOINTS_0") {
|
} else if (key == "JOINTS_0") {
|
||||||
|
@ -1197,12 +1212,14 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
jointStride = 1;
|
jointStride = 1;
|
||||||
} else {
|
} else {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF JOINTS_0 data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF JOINTS_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = addArrayFromAccessor(accessor, joints);
|
success = addArrayFromAccessor(accessor, joints);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF JOINTS_0 data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF JOINTS_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (key == "WEIGHTS_0") {
|
} else if (key == "WEIGHTS_0") {
|
||||||
|
@ -1216,12 +1233,14 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
weightStride = 1;
|
weightStride = 1;
|
||||||
} else {
|
} else {
|
||||||
qWarning(modelformat) << "Invalid accessor type on glTF WEIGHTS_0 data for model " << _url;
|
qWarning(modelformat) << "Invalid accessor type on glTF WEIGHTS_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = addArrayFromAccessor(accessor, weights);
|
success = addArrayFromAccessor(accessor, weights);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning(modelformat) << "There was a problem reading glTF WEIGHTS_0 data for model " << _url;
|
qWarning(modelformat) << "There was a problem reading glTF WEIGHTS_0 data for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1230,10 +1249,12 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
// Validation stage
|
// Validation stage
|
||||||
if (indices.count() == 0) {
|
if (indices.count() == 0) {
|
||||||
qWarning(modelformat) << "Missing indices for model " << _url;
|
qWarning(modelformat) << "Missing indices for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (vertices.count() == 0) {
|
if (vertices.count() == 0) {
|
||||||
qWarning(modelformat) << "Missing vertices for model " << _url;
|
qWarning(modelformat) << "Missing vertices for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1257,6 +1278,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
|
|
||||||
if (v1_index + 2 >= vertices.size() || v2_index + 2 >= vertices.size() || v3_index + 2 >= vertices.size()) {
|
if (v1_index + 2 >= vertices.size() || v2_index + 2 >= vertices.size() || v3_index + 2 >= vertices.size()) {
|
||||||
qWarning(modelformat) << "Indices out of range for model " << _url;
|
qWarning(modelformat) << "Indices out of range for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1355,6 +1377,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
|
|
||||||
if (validatedIndices.size() == 0) {
|
if (validatedIndices.size() == 0) {
|
||||||
qWarning(modelformat) << "No valid indices for model " << _url;
|
qWarning(modelformat) << "No valid indices for model " << _url;
|
||||||
|
hfmModel.loadErrorCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue