Merge pull request #249 from CesiumGS/accessor-index-fix

Ensures only valid bufferViews are mentioned in accessor
This commit is contained in:
Syoyo Fujita 2020-03-05 23:59:23 +09:00 committed by GitHub
commit e391f6b03e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6500,7 +6500,8 @@ static void SerializeExtensionMap(const ExtensionMap &extensions, json &o) {
}
static void SerializeGltfAccessor(Accessor &accessor, json &o) {
SerializeNumberProperty<int>("bufferView", accessor.bufferView, o);
if (accessor.bufferView >= 0)
SerializeNumberProperty<int>("bufferView", accessor.bufferView, o);
if (accessor.byteOffset != 0.0)
SerializeNumberProperty<int>("byteOffset", int(accessor.byteOffset), o);