diff --git a/source/ResourceLoader/loader_utils.js b/source/ResourceLoader/loader_utils.js index ff8eed14..7053a3c6 100644 --- a/source/ResourceLoader/loader_utils.js +++ b/source/ResourceLoader/loader_utils.js @@ -60,6 +60,9 @@ class ResourceLoaderUtils { * @returns {boolean} `true` if the URL is absolute, `false` otherwise. */ static isAbsoluteUrl(url) { + if (url.startsWith("data:")) { + return false; + } const colonIndex = url.indexOf(":"); const slashIndex = url.indexOf("/"); return colonIndex !== -1 && (slashIndex === -1 || colonIndex < slashIndex); diff --git a/source/gltf/primitive.js b/source/gltf/primitive.js index 2a0eec1b..93b354f3 100644 --- a/source/gltf/primitive.js +++ b/source/gltf/primitive.js @@ -394,9 +394,15 @@ class gltfPrimitive extends GltfObject { copyDataFromDecodedGeometry(gltf, dracoGeometry, primitiveAttributes) { // indices - let indexBuffer = dracoGeometry.index.array; if (this.indices !== undefined) { + let indexBuffer = this.loadArrayIntoArrayBuffer( + dracoGeometry.index.array, + dracoGeometry.index.array.constructor.name + ); this.loadBufferIntoGltf(indexBuffer, gltf, this.indices, 34963, "index buffer view"); + + // DRACO decoder always outputs uint32 indices + gltf.accessors[this.indices].componentType = GL.UNSIGNED_INT; } // Position