Gltf file with VALUE_NOT_IN_RANGE not opening #311
This commit is contained in:
parent
d7345647fc
commit
3b63efc4f9
@ -803,6 +803,19 @@ export class ImporterGltf extends ImporterBase
|
|||||||
|
|
||||||
ImportPrimitive (gltf, primitive, mesh)
|
ImportPrimitive (gltf, primitive, mesh)
|
||||||
{
|
{
|
||||||
|
function HasAttribute (gltf, primitive, attributeName)
|
||||||
|
{
|
||||||
|
let accessorIndex = primitive.attributes[attributeName];
|
||||||
|
if (accessorIndex === undefined) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let accessor = gltf.accessors[accessorIndex];
|
||||||
|
if (accessor === undefined || accessor.count === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.gltfExtensions.ProcessPrimitive (this, gltf, primitive, mesh)) {
|
if (this.gltfExtensions.ProcessPrimitive (this, gltf, primitive, mesh)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -811,10 +824,10 @@ export class ImporterGltf extends ImporterBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let hasVertices = (primitive.attributes.POSITION !== undefined);
|
let hasVertices = HasAttribute (gltf, primitive, 'POSITION');
|
||||||
let hasVertexColors = (primitive.attributes.COLOR_0 !== undefined);
|
let hasVertexColors = HasAttribute (gltf, primitive, 'COLOR_0');
|
||||||
let hasNormals = (primitive.attributes.NORMAL !== undefined);
|
let hasNormals = HasAttribute (gltf, primitive, 'NORMAL');
|
||||||
let hasUVs = (primitive.attributes.TEXCOORD_0 !== undefined);
|
let hasUVs = HasAttribute (gltf, primitive, 'TEXCOORD_0');
|
||||||
let hasIndices = (primitive.indices !== undefined);
|
let hasIndices = (primitive.indices !== undefined);
|
||||||
|
|
||||||
let mode = GltfRenderMode.TRIANGLES;
|
let mode = GltfRenderMode.TRIANGLES;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user