{ "version": 3, "sources": ["index.js", "lib/extensions/EXT_mesh_features.js", "lib/api/gltf-scenegraph.js", "lib/utils/assert.js", "lib/gltf-utils/gltf-constants.js", "lib/gltf-utils/gltf-utils.js", "lib/gltf-utils/get-typed-array.js", "lib/extensions/utils/3d-tiles-utils.js", "lib/extensions/EXT_structural_metadata.js", "lib/extensions/deprecated/EXT_feature_metadata.js", "lib/utils/version.js", "lib/parsers/parse-gltf.js", "lib/parsers/parse-glb.js", "lib/gltf-utils/resolve-url.js", "lib/extensions/EXT_meshopt_compression.js", "meshopt/meshopt-decoder.js", "lib/extensions/EXT_texture_webp.js", "lib/extensions/KHR_texture_basisu.js", "lib/extensions/KHR_draco_mesh_compression.js", "lib/gltf-utils/gltf-attribute-utils.js", "lib/extensions/KHR_texture_transform.js", "lib/extensions/deprecated/KHR_lights_punctual.js", "lib/extensions/deprecated/KHR_materials_unlit.js", "lib/extensions/deprecated/KHR_techniques_webgl.js", "lib/api/gltf-extensions.js", "lib/extensions/KHR_binary_gltf.js", "lib/api/normalize-gltf-v1.js", "gltf-loader.js", "lib/encoders/encode-glb.js", "lib/encoders/encode-gltf.js", "gltf-writer.js", "glb-loader.js", "glb-writer.js", "lib/api/post-process-gltf.js"], "sourcesContent": ["export { name as EXT_MESH_FEATURES } from \"./lib/extensions/EXT_mesh_features.js\";\nexport { name as EXT_STRUCTURAL_METADATA } from \"./lib/extensions/EXT_structural_metadata.js\";\nexport { name as EXT_FEATURE_METADATA } from \"./lib/extensions/deprecated/EXT_feature_metadata.js\";\n// glTF loader/writer definition objects\nexport { GLTFLoader } from \"./gltf-loader.js\";\nexport { GLTFWriter } from \"./gltf-writer.js\";\n// GLB Loader & Writer (for custom formats that want to leverage the GLB binary \"envelope\")\nexport { GLBLoader } from \"./glb-loader.js\";\nexport { GLBWriter } from \"./glb-writer.js\";\n// glTF Data Access Helper Class\nexport { GLTFScenegraph } from \"./lib/api/gltf-scenegraph.js\";\nexport { postProcessGLTF } from \"./lib/api/post-process-gltf.js\";\nexport { getMemoryUsageGLTF as _getMemoryUsageGLTF } from \"./lib/gltf-utils/gltf-utils.js\";\nexport { createExtStructuralMetadata } from \"./lib/extensions/EXT_structural_metadata.js\";\nexport { createExtMeshFeatures } from \"./lib/extensions/EXT_mesh_features.js\";\n", "import { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { getPrimitiveTextureData } from \"./utils/3d-tiles-utils.js\";\nimport { getComponentTypeFromArray } from \"../gltf-utils/gltf-utils.js\";\nconst EXT_MESH_FEATURES_NAME = 'EXT_mesh_features';\nexport const name = EXT_MESH_FEATURES_NAME;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtMeshFeatures(scenegraph, options);\n}\nexport function encode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n encodeExtMeshFeatures(scenegraph, options);\n scenegraph.createBinaryChunk();\n return scenegraph.gltf;\n}\n/**\n * Decodes feature metadata from extension.\n * @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.\n * @param {GLTFLoaderOptions} options - GLTFLoader options.\n */\nfunction decodeExtMeshFeatures(scenegraph, options) {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return;\n }\n // Iterate through all meshes/primitives.\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processMeshPrimitiveFeatures(scenegraph, primitive, options);\n }\n }\n}\n/**\n * Takes data from EXT_mesh_features and store it in 'data' property of featureIds.\n * If combined with EXT_structural_metadata, corresponding data are taken from the property tables of that extension.\n * @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.\n * @param {GLTFMeshPrimitive} primitive - Primitive that contains extensions.\n * @param {GLTFLoaderOptions} options - GLTFLoader options.\n */\nfunction processMeshPrimitiveFeatures(scenegraph, primitive, options) {\n // Processing of mesh primitive features requires buffers to be loaded.\n if (!options?.gltf?.loadBuffers) {\n return;\n }\n const extension = primitive.extensions?.[EXT_MESH_FEATURES_NAME];\n const featureIds = extension?.featureIds;\n if (!featureIds) {\n return;\n }\n for (const featureId of featureIds) {\n let featureIdData;\n // Process \"Feature ID by Vertex\"\n if (typeof featureId.attribute !== 'undefined') {\n const accessorKey = `_FEATURE_ID_${featureId.attribute}`;\n const accessorIndex = primitive.attributes[accessorKey];\n featureIdData = scenegraph.getTypedArrayForAccessor(accessorIndex);\n }\n // Process \"Feature ID by Texture Coordinates\"\n else if (typeof featureId.texture !== 'undefined' && options?.gltf?.loadImages) {\n featureIdData = getPrimitiveTextureData(scenegraph, featureId.texture, primitive);\n }\n // Process \"Feature ID by Index\"\n else {\n /*\n When both featureId.attribute and featureId.texture are undefined,\n then the feature ID value for each vertex is given implicitly, via the index of the vertex.\n In this case, the featureCount must match the number of vertices of the mesh primitive.\n */\n // TODO: At the moment of writing we don't have a tileset with the data of that kind. Implement it later.\n featureIdData = [];\n }\n featureId.data = featureIdData;\n }\n}\n/*\n Encoding data\n*/\nfunction encodeExtMeshFeatures(scenegraph, options) {\n const meshes = scenegraph.gltf.json.meshes;\n if (!meshes) {\n return;\n }\n // Iterate through all meshes/primitives.\n for (const mesh of meshes) {\n for (const primitive of mesh.primitives) {\n encodeExtMeshFeaturesForPrimitive(scenegraph, primitive);\n }\n }\n}\n/**\n * Creates ExtMeshFeatures, creates a featureId containing feature ids provided.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param primitive - target primitive instance that will contain the extension\n * @param featureIdArray - Array of feature id\n * @param propertyTableIndex - index of the property table created by the ExtStructuralMetadata (optional).\n */\nexport function createExtMeshFeatures(scenegraph, primitive, featureIdArray, propertyTableIndex) {\n if (!primitive.extensions) {\n primitive.extensions = {};\n }\n let extension = primitive.extensions[EXT_MESH_FEATURES_NAME];\n if (!extension) {\n extension = { featureIds: [] };\n primitive.extensions[EXT_MESH_FEATURES_NAME] = extension;\n }\n const { featureIds } = extension;\n const featureId = {\n featureCount: featureIdArray.length,\n propertyTable: propertyTableIndex,\n data: featureIdArray\n };\n featureIds.push(featureId);\n scenegraph.addObjectExtension(primitive, EXT_MESH_FEATURES_NAME, extension);\n}\n/**\n * Encodes a feature ID set to extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param primitive - Primitive that the data encoded belongs to.\n * @see https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features\n */\nfunction encodeExtMeshFeaturesForPrimitive(scenegraph, primitive) {\n const extension = primitive.extensions?.[EXT_MESH_FEATURES_NAME];\n if (!extension) {\n return;\n }\n const featureIds = extension.featureIds;\n featureIds.forEach((featureId, elementIndex) => {\n if (featureId.data) {\n const { accessorKey, index } = createAccessorKey(primitive.attributes);\n const typedArray = new Uint32Array(featureId.data);\n // Clean up featureId object.\n // Everything that could come from the original extension in case of round-trip decode/encode operations should be deleted.\n // We need make sure the featureId object is clean.\n featureIds[elementIndex] = {\n featureCount: typedArray.length,\n propertyTable: featureId.propertyTable,\n attribute: index\n };\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n });\n const bufferViewIndex = scenegraph.addBufferView(typedArray);\n const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {\n size: 1,\n componentType: getComponentTypeFromArray(typedArray),\n count: typedArray.length\n });\n primitive.attributes[accessorKey] = accessorIndex;\n }\n });\n}\n/**\n * Creates an accessor key for the attribute array provided.\n * The generated key has a suffix (number) that is the next consequtive in the list of existing accessors.\n * @param attributes - attribute array\n * @returns accessor key and the key suffix (number) used in the key.\n */\nfunction createAccessorKey(attributes) {\n const prefix = '_FEATURE_ID_';\n // Search for all \"_FEATURE_ID_n\" attribures in the primitive provided if any.\n // If there are some, e.g. \"_FEATURE_ID_0\", \"_FEATURE_ID_1\",\n // we will add a new one with the name \"_FEATURE_ID_2\"\n const attrs = Object.keys(attributes).filter((item) => item.indexOf(prefix) === 0);\n let max = -1;\n for (const a of attrs) {\n const n = Number(a.substring(prefix.length));\n if (n > max) {\n max = n;\n }\n }\n max++;\n const accessorKey = `${prefix}${max}`;\n return { accessorKey, index: max };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getBinaryImageMetadata } from '@loaders.gl/images';\nimport { padToNBytes, copyToArray } from '@loaders.gl/loader-utils';\nimport { assert } from \"../utils/assert.js\";\nimport { getAccessorTypeFromSize, getComponentTypeFromArray } from \"../gltf-utils/gltf-utils.js\";\nimport { getTypedArrayForAccessor as _getTypedArrayForAccessor } from \"../gltf-utils/get-typed-array.js\";\nfunction makeDefaultGLTFJson() {\n return {\n asset: {\n version: '2.0',\n generator: 'loaders.gl'\n },\n buffers: [],\n extensions: {},\n extensionsRequired: [],\n extensionsUsed: []\n };\n}\n/**\n * Class for structured access to GLTF data\n */\nexport class GLTFScenegraph {\n // internal\n gltf;\n sourceBuffers;\n byteLength;\n // TODO - why is this not GLTFWithBuffers - what happens to images?\n constructor(gltf) {\n // Declare locally so\n this.gltf = {\n json: gltf?.json || makeDefaultGLTFJson(),\n buffers: gltf?.buffers || [],\n images: gltf?.images || []\n };\n this.sourceBuffers = [];\n this.byteLength = 0;\n // Initialize buffers\n if (this.gltf.buffers && this.gltf.buffers[0]) {\n this.byteLength = this.gltf.buffers[0].byteLength;\n this.sourceBuffers = [this.gltf.buffers[0]];\n }\n }\n // Accessors\n get json() {\n return this.gltf.json;\n }\n getApplicationData(key) {\n // TODO - Data is already unpacked by GLBParser\n const data = this.json[key];\n return data;\n }\n getExtraData(key) {\n // TODO - Data is already unpacked by GLBParser\n const extras = (this.json.extras || {});\n return extras[key];\n }\n hasExtension(extensionName) {\n const isUsedExtension = this.getUsedExtensions().find((name) => name === extensionName);\n const isRequiredExtension = this.getRequiredExtensions().find((name) => name === extensionName);\n return typeof isUsedExtension === 'string' || typeof isRequiredExtension === 'string';\n }\n getExtension(extensionName) {\n const isExtension = this.getUsedExtensions().find((name) => name === extensionName);\n const extensions = this.json.extensions || {};\n return isExtension ? extensions[extensionName] : null;\n }\n getRequiredExtension(extensionName) {\n const isRequired = this.getRequiredExtensions().find((name) => name === extensionName);\n return isRequired ? this.getExtension(extensionName) : null;\n }\n getRequiredExtensions() {\n return this.json.extensionsRequired || [];\n }\n getUsedExtensions() {\n return this.json.extensionsUsed || [];\n }\n getRemovedExtensions() {\n return (this.json.extensionsRemoved || []);\n }\n getObjectExtension(object, extensionName) {\n const extensions = object.extensions || {};\n return extensions[extensionName];\n }\n getScene(index) {\n return this.getObject('scenes', index);\n }\n getNode(index) {\n return this.getObject('nodes', index);\n }\n getSkin(index) {\n return this.getObject('skins', index);\n }\n getMesh(index) {\n return this.getObject('meshes', index);\n }\n getMaterial(index) {\n return this.getObject('materials', index);\n }\n getAccessor(index) {\n return this.getObject('accessors', index);\n }\n // getCamera(index: number): object | null {\n // return null; // TODO: fix thi: object as null;\n // }\n getTexture(index) {\n return this.getObject('textures', index);\n }\n getSampler(index) {\n return this.getObject('samplers', index);\n }\n getImage(index) {\n return this.getObject('images', index);\n }\n getBufferView(index) {\n return this.getObject('bufferViews', index);\n }\n getBuffer(index) {\n return this.getObject('buffers', index);\n }\n getObject(array, index) {\n // check if already resolved\n if (typeof index === 'object') {\n return index;\n }\n const object = this.json[array] && this.json[array][index];\n if (!object) {\n throw new Error(`glTF file error: Could not find ${array}[${index}]`); // eslint-disable-line\n }\n return object;\n }\n /**\n * Accepts buffer view index or buffer view object\n * @returns a `Uint8Array`\n */\n getTypedArrayForBufferView(bufferView) {\n bufferView = this.getBufferView(bufferView);\n // @ts-ignore\n const bufferIndex = bufferView.buffer;\n // Get hold of the arrayBuffer\n // const buffer = this.getBuffer(bufferIndex);\n const binChunk = this.gltf.buffers[bufferIndex];\n assert(binChunk);\n // @ts-ignore\n const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;\n // @ts-ignore\n return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);\n }\n /** Accepts accessor index or accessor object\n * @returns a typed array with type that matches the types\n */\n getTypedArrayForAccessor(accessor) {\n // @ts-ignore\n const gltfAccessor = this.getAccessor(accessor);\n return _getTypedArrayForAccessor(this.gltf.json, this.gltf.buffers, gltfAccessor);\n }\n /** accepts accessor index or accessor object\n * returns a `Uint8Array`\n */\n getTypedArrayForImageData(image) {\n // @ts-ignore\n image = this.getAccessor(image);\n // @ts-ignore\n const bufferView = this.getBufferView(image.bufferView);\n const buffer = this.getBuffer(bufferView.buffer);\n // @ts-ignore\n const arrayBuffer = buffer.data;\n const byteOffset = bufferView.byteOffset || 0;\n return new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);\n }\n // MODIFERS\n /**\n * Add an extra application-defined key to the top-level data structure\n */\n addApplicationData(key, data) {\n this.json[key] = data;\n return this;\n }\n /**\n * `extras` - Standard GLTF field for storing application specific data\n */\n addExtraData(key, data) {\n this.json.extras = this.json.extras || {};\n this.json.extras[key] = data;\n return this;\n }\n addObjectExtension(object, extensionName, data) {\n // @ts-ignore\n object.extensions = object.extensions || {};\n // TODO - clobber or merge?\n // @ts-ignore\n object.extensions[extensionName] = data;\n this.registerUsedExtension(extensionName);\n return this;\n }\n setObjectExtension(object, extensionName, data) {\n const extensions = object.extensions || {};\n extensions[extensionName] = data;\n // TODO - add to usedExtensions...\n }\n removeObjectExtension(object, extensionName) {\n const extensions = object?.extensions || {};\n if (extensions[extensionName]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const extensionsRemoved = this.json.extensionsRemoved;\n if (!extensionsRemoved.includes(extensionName)) {\n extensionsRemoved.push(extensionName);\n }\n }\n delete extensions[extensionName];\n }\n /**\n * Add to standard GLTF top level extension object, mark as used\n */\n addExtension(extensionName, extensionData = {}) {\n assert(extensionData);\n this.json.extensions = this.json.extensions || {};\n this.json.extensions[extensionName] = extensionData;\n this.registerUsedExtension(extensionName);\n return extensionData;\n }\n /**\n * Standard GLTF top level extension object, mark as used and required\n */\n addRequiredExtension(extensionName, extensionData = {}) {\n assert(extensionData);\n this.addExtension(extensionName, extensionData);\n this.registerRequiredExtension(extensionName);\n return extensionData;\n }\n /**\n * Add extensionName to list of used extensions\n */\n registerUsedExtension(extensionName) {\n this.json.extensionsUsed = this.json.extensionsUsed || [];\n if (!this.json.extensionsUsed.find((ext) => ext === extensionName)) {\n this.json.extensionsUsed.push(extensionName);\n }\n }\n /**\n * Add extensionName to list of required extensions\n */\n registerRequiredExtension(extensionName) {\n this.registerUsedExtension(extensionName);\n this.json.extensionsRequired = this.json.extensionsRequired || [];\n if (!this.json.extensionsRequired.find((ext) => ext === extensionName)) {\n this.json.extensionsRequired.push(extensionName);\n }\n }\n /**\n * Removes an extension from the top-level list\n */\n removeExtension(extensionName) {\n if (this.json.extensions?.[extensionName]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const extensionsRemoved = this.json.extensionsRemoved;\n if (!extensionsRemoved.includes(extensionName)) {\n extensionsRemoved.push(extensionName);\n }\n }\n if (this.json.extensions) {\n delete this.json.extensions[extensionName];\n }\n if (this.json.extensionsRequired) {\n this._removeStringFromArray(this.json.extensionsRequired, extensionName);\n }\n if (this.json.extensionsUsed) {\n this._removeStringFromArray(this.json.extensionsUsed, extensionName);\n }\n }\n /**\n * Set default scene which is to be displayed at load time\n */\n setDefaultScene(sceneIndex) {\n this.json.scene = sceneIndex;\n }\n /**\n * @todo: add more properties for scene initialization:\n * name`, `extensions`, `extras`\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene\n */\n addScene(scene) {\n const { nodeIndices } = scene;\n this.json.scenes = this.json.scenes || [];\n this.json.scenes.push({ nodes: nodeIndices });\n return this.json.scenes.length - 1;\n }\n /**\n * @todo: add more properties for node initialization:\n * `name`, `extensions`, `extras`, `camera`, `children`, `skin`, `rotation`, `scale`, `translation`, `weights`\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#node\n */\n addNode(node) {\n const { meshIndex, matrix } = node;\n this.json.nodes = this.json.nodes || [];\n const nodeData = { mesh: meshIndex };\n if (matrix) {\n // @ts-ignore\n nodeData.matrix = matrix;\n }\n this.json.nodes.push(nodeData);\n return this.json.nodes.length - 1;\n }\n /** Adds a mesh to the json part */\n addMesh(mesh) {\n const { attributes, indices, material, mode = 4 } = mesh;\n const accessors = this._addAttributes(attributes);\n const glTFMesh = {\n primitives: [\n {\n attributes: accessors,\n mode\n }\n ]\n };\n if (indices) {\n const indicesAccessor = this._addIndices(indices);\n // @ts-ignore\n glTFMesh.primitives[0].indices = indicesAccessor;\n }\n if (Number.isFinite(material)) {\n // @ts-ignore\n glTFMesh.primitives[0].material = material;\n }\n this.json.meshes = this.json.meshes || [];\n this.json.meshes.push(glTFMesh);\n return this.json.meshes.length - 1;\n }\n addPointCloud(attributes) {\n // @ts-ignore\n const accessorIndices = this._addAttributes(attributes);\n const glTFMesh = {\n primitives: [\n {\n attributes: accessorIndices,\n mode: 0 // GL.POINTS\n }\n ]\n };\n this.json.meshes = this.json.meshes || [];\n this.json.meshes.push(glTFMesh);\n return this.json.meshes.length - 1;\n }\n /**\n * Adds a binary image. Builds glTF \"JSON metadata\" and saves buffer reference\n * Buffer will be copied into BIN chunk during \"pack\"\n * Currently encodes as glTF image\n * @param imageData\n * @param mimeType\n */\n addImage(imageData, mimeTypeOpt) {\n // If image is referencing a bufferView instead of URI, mimeType must be defined:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#images\n // \"a reference to a bufferView; in that case mimeType must be defined.\"\n const metadata = getBinaryImageMetadata(imageData);\n const mimeType = mimeTypeOpt || metadata?.mimeType;\n const bufferViewIndex = this.addBufferView(imageData);\n const glTFImage = {\n bufferView: bufferViewIndex,\n mimeType\n };\n this.json.images = this.json.images || [];\n this.json.images.push(glTFImage);\n return this.json.images.length - 1;\n }\n /**\n * Add one untyped source buffer, create a matching glTF `bufferView`, and return its index\n * @param buffer\n */\n addBufferView(buffer, bufferIndex = 0, byteOffset = this.byteLength) {\n const byteLength = buffer.byteLength;\n assert(Number.isFinite(byteLength));\n // Add this buffer to the list of buffers to be written to the body.\n this.sourceBuffers = this.sourceBuffers || [];\n this.sourceBuffers.push(buffer);\n const glTFBufferView = {\n buffer: bufferIndex,\n // Write offset from the start of the binary body\n byteOffset,\n byteLength\n };\n // We've now added the contents to the body, so update the total length\n // Every sub-chunk needs to be 4-byte align ed\n this.byteLength += padToNBytes(byteLength, 4);\n // Add a bufferView indicating start and length of this binary sub-chunk\n this.json.bufferViews = this.json.bufferViews || [];\n this.json.bufferViews.push(glTFBufferView);\n return this.json.bufferViews.length - 1;\n }\n /**\n * Adds an accessor to a bufferView\n * @param bufferViewIndex\n * @param accessor\n */\n addAccessor(bufferViewIndex, accessor) {\n const glTFAccessor = {\n bufferView: bufferViewIndex,\n // @ts-ignore\n type: getAccessorTypeFromSize(accessor.size),\n // @ts-ignore\n componentType: accessor.componentType,\n // @ts-ignore\n count: accessor.count,\n // @ts-ignore\n max: accessor.max,\n // @ts-ignore\n min: accessor.min\n };\n this.json.accessors = this.json.accessors || [];\n this.json.accessors.push(glTFAccessor);\n return this.json.accessors.length - 1;\n }\n /**\n * Add a binary buffer. Builds glTF \"JSON metadata\" and saves buffer reference\n * Buffer will be copied into BIN chunk during \"pack\"\n * Currently encodes buffers as glTF accessors, but this could be optimized\n * @param sourceBuffer\n * @param accessor\n */\n addBinaryBuffer(sourceBuffer, accessor = { size: 3 }) {\n const bufferViewIndex = this.addBufferView(sourceBuffer);\n // @ts-ignore\n let minMax = { min: accessor.min, max: accessor.max };\n if (!minMax.min || !minMax.max) {\n // @ts-ignore\n minMax = this._getAccessorMinMax(sourceBuffer, accessor.size);\n }\n const accessorDefaults = {\n // @ts-ignore\n size: accessor.size,\n componentType: getComponentTypeFromArray(sourceBuffer),\n // @ts-ignore\n count: Math.round(sourceBuffer.length / accessor.size),\n min: minMax.min,\n max: minMax.max\n };\n return this.addAccessor(bufferViewIndex, Object.assign(accessorDefaults, accessor));\n }\n /**\n * Adds a texture to the json part\n * @todo: add more properties for texture initialization\n * `sampler`, `name`, `extensions`, `extras`\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture\n */\n addTexture(texture) {\n const { imageIndex } = texture;\n const glTFTexture = {\n source: imageIndex\n };\n this.json.textures = this.json.textures || [];\n this.json.textures.push(glTFTexture);\n return this.json.textures.length - 1;\n }\n /** Adds a material to the json part */\n addMaterial(pbrMaterialInfo) {\n this.json.materials = this.json.materials || [];\n this.json.materials.push(pbrMaterialInfo);\n return this.json.materials.length - 1;\n }\n /** Pack the binary chunk */\n createBinaryChunk() {\n // Allocate total array\n const totalByteLength = this.byteLength;\n const arrayBuffer = new ArrayBuffer(totalByteLength);\n const targetArray = new Uint8Array(arrayBuffer);\n // Copy each array into\n let dstByteOffset = 0;\n for (const sourceBuffer of this.sourceBuffers || []) {\n dstByteOffset = copyToArray(sourceBuffer, targetArray, dstByteOffset);\n }\n // Update the glTF BIN CHUNK byte length\n if (this.json?.buffers?.[0]) {\n this.json.buffers[0].byteLength = totalByteLength;\n }\n else {\n this.json.buffers = [{ byteLength: totalByteLength }];\n }\n // Save generated arrayBuffer\n this.gltf.binary = arrayBuffer;\n // Put arrayBuffer to sourceBuffers for possible additional writing data in the chunk\n this.sourceBuffers = [arrayBuffer];\n this.gltf.buffers = [{ arrayBuffer, byteOffset: 0, byteLength: arrayBuffer.byteLength }];\n }\n // PRIVATE\n _removeStringFromArray(array, string) {\n let found = true;\n while (found) {\n const index = array.indexOf(string);\n if (index > -1) {\n array.splice(index, 1);\n }\n else {\n found = false;\n }\n }\n }\n /**\n * Add attributes to buffers and create `attributes` object which is part of `mesh`\n */\n _addAttributes(attributes = {}) {\n const result = {};\n for (const attributeKey in attributes) {\n const attributeData = attributes[attributeKey];\n const attrName = this._getGltfAttributeName(attributeKey);\n const accessor = this.addBinaryBuffer(attributeData.value, attributeData);\n result[attrName] = accessor;\n }\n return result;\n }\n /**\n * Add indices to buffers\n */\n _addIndices(indices) {\n return this.addBinaryBuffer(indices, { size: 1 });\n }\n /**\n * Deduce gltf specific attribue name from input attribute name\n */\n _getGltfAttributeName(attributeName) {\n switch (attributeName.toLowerCase()) {\n case 'position':\n case 'positions':\n case 'vertices':\n return 'POSITION';\n case 'normal':\n case 'normals':\n return 'NORMAL';\n case 'color':\n case 'colors':\n return 'COLOR_0';\n case 'texcoord':\n case 'texcoords':\n return 'TEXCOORD_0';\n default:\n return attributeName;\n }\n }\n /**\n * Calculate `min` and `max` arrays of accessor according to spec:\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-accessor\n */\n _getAccessorMinMax(buffer, size) {\n const result = { min: null, max: null };\n if (buffer.length < size) {\n return result;\n }\n // @ts-ignore\n result.min = [];\n // @ts-ignore\n result.max = [];\n const initValues = buffer.subarray(0, size);\n for (const value of initValues) {\n // @ts-ignore\n result.min.push(value);\n // @ts-ignore\n result.max.push(value);\n }\n for (let index = size; index < buffer.length; index += size) {\n for (let componentIndex = 0; componentIndex < size; componentIndex++) {\n // @ts-ignore\n result.min[0 + componentIndex] = Math.min(\n // @ts-ignore\n result.min[0 + componentIndex], buffer[index + componentIndex]);\n // @ts-ignore\n result.max[0 + componentIndex] = Math.max(\n // @ts-ignore\n result.max[0 + componentIndex], buffer[index + componentIndex]);\n }\n }\n return result;\n }\n}\n", "// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'assert failed: gltf');\n }\n}\n", "export const COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nexport const BYTES = {\n 5120: 1, // BYTE\n 5121: 1, // UNSIGNED_BYTE\n 5122: 2, // SHORT\n 5123: 2, // UNSIGNED_SHORT\n 5125: 4, // UNSIGNED_INT\n 5126: 4 // FLOAT\n};\n// ENUM LOOKUP\nexport function getBytesFromComponentType(componentType) {\n return BYTES[componentType];\n}\nexport function getSizeFromAccessorType(type) {\n return COMPONENTS[type];\n}\nexport function getGLEnumFromSamplerParameter(parameter) {\n const GL_TEXTURE_MAG_FILTER = 0x2800;\n const GL_TEXTURE_MIN_FILTER = 0x2801;\n const GL_TEXTURE_WRAP_S = 0x2802;\n const GL_TEXTURE_WRAP_T = 0x2803;\n const PARAMETER_MAP = {\n magFilter: GL_TEXTURE_MAG_FILTER,\n minFilter: GL_TEXTURE_MIN_FILTER,\n wrapS: GL_TEXTURE_WRAP_S,\n wrapT: GL_TEXTURE_WRAP_T\n };\n return PARAMETER_MAP[parameter];\n}\n", "import { assert } from \"../utils/assert.js\";\nimport { BYTES, COMPONENTS } from \"../gltf-utils/gltf-constants.js\";\n/**\n * Memory needed to store texture and all mipmap levels 1 + 1/4 + 1/16 + 1/64 + ...\n * Minimum 1.33, but due to GPU layout may be 1.5\n */\nconst MIPMAP_FACTOR = 1.33;\nconst TYPES = ['SCALAR', 'VEC2', 'VEC3', 'VEC4'];\nconst ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT = [\n [Int8Array, 5120],\n [Uint8Array, 5121],\n [Int16Array, 5122],\n [Uint16Array, 5123],\n [Uint32Array, 5125],\n [Float32Array, 5126],\n [Float64Array, 5130]\n];\nconst ARRAY_TO_COMPONENT_TYPE = new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);\nconst ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nexport function getAccessorTypeFromSize(size) {\n const type = TYPES[size - 1];\n return type || TYPES[0];\n}\nexport function getComponentTypeFromArray(typedArray) {\n const componentType = ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);\n if (!componentType) {\n throw new Error('Illegal typed array');\n }\n return componentType;\n}\nexport function getAccessorArrayTypeAndLength(accessor, bufferView) {\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];\n const components = ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];\n const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];\n const length = accessor.count * components;\n const byteLength = accessor.count * components * bytesPerComponent;\n assert(byteLength >= 0 && byteLength <= bufferView.byteLength);\n const componentByteSize = BYTES[accessor.componentType];\n const numberOfComponentsInElement = COMPONENTS[accessor.type];\n return { ArrayType, length, byteLength, componentByteSize, numberOfComponentsInElement };\n}\n/**\n * Calculate the GPU memory used by a GLTF tile, for both buffer and texture memory\n * @param gltf - the gltf content of a GLTF tile\n * @returns - total memory usage in bytes\n */\nexport function getMemoryUsageGLTF(gltf) {\n let { images, bufferViews } = gltf;\n images = images || [];\n bufferViews = bufferViews || [];\n const imageBufferViews = images.map((i) => i.bufferView);\n bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view));\n const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);\n // Assume each pixel of the texture is 4 channel with mimmaps (which add 33%)\n // TODO correctly handle compressed textures\n const pixelCount = images.reduce((acc, image) => {\n // @ts-ignore\n const { width, height } = image.image;\n return acc + width * height;\n }, 0);\n return bufferMemory + Math.ceil(4 * pixelCount * MIPMAP_FACTOR);\n}\n", "// TODO - GLTFScenegraph should use these\nimport { assert } from \"../utils/assert.js\";\nimport { getAccessorArrayTypeAndLength } from \"./gltf-utils.js\";\n// accepts buffer view index or buffer view object\n// returns a `Uint8Array`\nexport function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {\n const bufferView = json.bufferViews[bufferViewIndex];\n assert(bufferView);\n // Get hold of the arrayBuffer\n const bufferIndex = bufferView.buffer;\n const binChunk = buffers[bufferIndex];\n assert(binChunk);\n const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;\n return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);\n}\n// accepts accessor index or accessor object\n// returns a `Uint8Array`\nexport function getTypedArrayForImageData(json, buffers, imageIndex) {\n const image = json.images[imageIndex];\n const bufferViewIndex = json.bufferViews[image.bufferView];\n return getTypedArrayForBufferView(json, buffers, bufferViewIndex);\n}\n/**\n * Gets data pointed by the accessor.\n * @param json - json part of gltf content of a GLTF tile.\n * @param buffers - Array containing buffers of data.\n * @param accessor - accepts accessor index or accessor object.\n * @returns {TypedArray} Typed array with type matching the type of data poited by the accessor.\n */\n// eslint-disable-next-line complexity\nexport function getTypedArrayForAccessor(json, buffers, accessor) {\n const gltfAccessor = typeof accessor === 'number' ? json.accessors?.[accessor] : accessor;\n if (!gltfAccessor) {\n throw new Error(`No gltf accessor ${JSON.stringify(accessor)}`);\n }\n const bufferView = json.bufferViews?.[gltfAccessor.bufferView || 0];\n if (!bufferView) {\n throw new Error(`No gltf buffer view for accessor ${bufferView}`);\n }\n // Get `arrayBuffer` the `bufferView` looks at\n const { arrayBuffer, byteOffset: bufferByteOffset } = buffers[bufferView.buffer];\n // Resulting byteOffset is sum of the buffer, accessor and bufferView byte offsets\n const byteOffset = (bufferByteOffset || 0) + (gltfAccessor.byteOffset || 0) + (bufferView.byteOffset || 0);\n // Deduce TypedArray type and its length from `accessor` and `bufferView` data\n const { ArrayType, length, componentByteSize, numberOfComponentsInElement } = getAccessorArrayTypeAndLength(gltfAccessor, bufferView);\n // 'length' is a whole number of components of all elements in the buffer pointed by the accessor\n // Multiplier to calculate the address of the element in the arrayBuffer\n const elementByteSize = componentByteSize * numberOfComponentsInElement;\n const elementAddressScale = bufferView.byteStride || elementByteSize;\n // Creare an array of component's type where all components (not just elements) will reside\n if (typeof bufferView.byteStride === 'undefined' || bufferView.byteStride === elementByteSize) {\n // No iterleaving\n const result = new ArrayType(arrayBuffer, byteOffset, length);\n return result;\n }\n // Iterleaving\n const result = new ArrayType(length);\n for (let i = 0; i < gltfAccessor.count; i++) {\n const values = new ArrayType(arrayBuffer, byteOffset + i * elementAddressScale, numberOfComponentsInElement);\n result.set(values, i * numberOfComponentsInElement);\n }\n return result;\n}\n", "/**\n * loaders.gl, MIT license\n *\n * Shared code for 3DTiles extensions:\n * * EXT_feature_metadata\n * * EXT_mesh_features\n * * EXT_structural_metadata\n */\nimport { getComponentTypeFromArray } from \"../../gltf-utils/gltf-utils.js\";\nimport { getImageData } from '@loaders.gl/images';\nfunction emod(n) {\n return ((n % 1) + 1) % 1;\n}\nconst ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16,\n BOOLEAN: 1,\n STRING: 1,\n ENUM: 1\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: BigInt64Array,\n UINT64: BigUint64Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n};\nconst ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {\n INT8: 1,\n UINT8: 1,\n INT16: 2,\n UINT16: 2,\n INT32: 4,\n UINT32: 4,\n INT64: 8,\n UINT64: 8,\n FLOAT32: 4,\n FLOAT64: 8\n};\nexport function getArrayElementByteSize(attributeType, componentType) {\n return (ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType] *\n ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType]);\n}\n/**\n * Gets offset array from `arrayOffsets` or `stringOffsets`.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param bufferViewIndex - Buffer view index\n * @param offsetType - The type of values in `arrayOffsets` or `stringOffsets`.\n * @param numberOfElements - The number of elements in each property array.\n * @returns Array of values offsets. The number of offsets in the array is equal to `numberOfElements` plus one.\n */\nexport function getOffsetsForProperty(scenegraph, bufferViewIndex, offsetType, numberOfElements) {\n if (offsetType !== 'UINT8' &&\n offsetType !== 'UINT16' &&\n offsetType !== 'UINT32' &&\n offsetType !== 'UINT64') {\n return null;\n }\n const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);\n const arrayOffsets = convertRawBufferToMetadataArray(arrayOffsetsBytes, 'SCALAR', // offsets consist of ONE component\n offsetType, numberOfElements + 1 // The number of offsets is equal to the property table `count` plus one.\n );\n // We don't support BigInt offsets at the moment. It requires additional logic and potential issues in Safari\n if (arrayOffsets instanceof BigInt64Array || arrayOffsets instanceof BigUint64Array) {\n return null;\n }\n return arrayOffsets;\n}\n/**\n * Converts raw bytes that are in the buffer to an array of the type defined by the schema.\n * @param data - Raw bytes in the buffer.\n * @param attributeType - SCALAR, VECN, MATN.\n * @param componentType - Type of the component in elements, e.g. 'UINT8' or 'FLOAT32'.\n * @param elementCount - Number of elements in the array. Default value is 1.\n * @returns Data array\n */\nexport function convertRawBufferToMetadataArray(data, attributeType, componentType, elementCount = 1) {\n const numberOfComponents = ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType];\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[componentType];\n const size = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType];\n const length = elementCount * numberOfComponents;\n const byteLength = length * size;\n let buffer = data.buffer;\n let offset = data.byteOffset;\n if (offset % size !== 0) {\n const bufferArray = new Uint8Array(buffer);\n buffer = bufferArray.slice(offset, offset + byteLength).buffer;\n offset = 0;\n }\n return new ArrayType(buffer, offset, length);\n}\n/**\n * Processes data encoded in the texture associated with the primitive.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param textureInfo - Reference to the texture where extension data are stored.\n * @param primitive - Primitive object in the mesh.\n * @returns Array of data taken. Null if data can't be taken from the texture.\n */\nexport function getPrimitiveTextureData(scenegraph, textureInfo, primitive) {\n /*\n texture.index is an index for the \"textures\" array.\n The texture object referenced by this index looks like this:\n {\n \"sampler\": 0,\n \"source\": 0\n }\n \"sampler\" is an index for the \"samplers\" array\n \"source\" is an index for the \"images\" array that contains data stored in rgba channels of the image.\n \n texture.texCoord is a number-suffix (like 1) for an attribute like \"TEXCOORD_1\" in meshes.primitives\n The value of \"TEXCOORD_1\" is an accessor that is used to get coordinates.\n These coordinates are being used to get data from the image.\n \n Default for texture.texCoord is 0\n @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/specification/2.0/schema/textureInfo.schema.json\n */\n const texCoordAccessorKey = `TEXCOORD_${textureInfo.texCoord || 0}`;\n const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];\n const textureCoordinates = scenegraph.getTypedArrayForAccessor(texCoordAccessorIndex);\n const json = scenegraph.gltf.json;\n const textureIndex = textureInfo.index;\n const imageIndex = json.textures?.[textureIndex]?.source;\n if (typeof imageIndex !== 'undefined') {\n const mimeType = json.images?.[imageIndex]?.mimeType;\n const parsedImage = scenegraph.gltf.images?.[imageIndex];\n // Checking for width is to prevent handling Un-processed images (e.g. [analyze] stage, where loadImages option is set to false)\n if (parsedImage && typeof parsedImage.width !== 'undefined') {\n const textureData = [];\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const value = getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, textureInfo.channels);\n textureData.push(value);\n }\n return textureData;\n }\n }\n return [];\n}\n/**\n * Puts property data to attributes.\n * It creates corresponding buffer, bufferView and accessor\n * so the data can be accessed like regular data stored in buffers.\n * @param scenegraph - Scenegraph object.\n * @param attributeName - Name of the attribute.\n * @param propertyData - Property data to store.\n * @param featureTable - Array where unique data from the property data are being stored.\n * @param primitive - Primitive object.\n */\nexport function primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTable, primitive) {\n // No reason to create an empty buffer if there is no property data to store.\n if (!propertyData?.length) {\n return;\n }\n /*\n featureTable will contain unique values, e.g.\n propertyData = [24, 35, 28, 24]\n featureTable = [24, 35, 28]\n featureIndices will contain indices that refer featureTextureTable, e.g.\n featureIndices = [0, 1, 2, 0]\n */\n const featureIndices = [];\n for (const texelData of propertyData) {\n let index = featureTable.findIndex((item) => item === texelData);\n if (index === -1) {\n index = featureTable.push(texelData) - 1;\n }\n featureIndices.push(index);\n }\n const typedArray = new Uint32Array(featureIndices);\n const bufferIndex = scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n }) - 1;\n const bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);\n const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {\n size: 1,\n componentType: getComponentTypeFromArray(typedArray),\n count: typedArray.length\n });\n primitive.attributes[attributeName] = accessorIndex;\n}\n/**\n * Gets the value from the texture by coordinates provided.\n * @param parsedImage - Image where the data are stored.\n * @param mimeType - MIME type.\n * @param textureCoordinates - uv coordinates to access data in the image.\n * @param index - Index of uv coordinates in the array textureCoordinates.\n * @param channels - Image channels where data are stored.\n * Channels of an RGBA texture are numbered 0..3 respectively.\n * For Ext_mesh_features and EXT_strucural_metadata the channels default is [0]\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdTexture.schema.json\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTexture.property.schema.json\n * @returns Value taken from the image.\n */\nfunction getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, channels = [0]) {\n const CHANNELS_MAP = {\n r: { offset: 0, shift: 0 },\n g: { offset: 1, shift: 8 },\n b: { offset: 2, shift: 16 },\n a: { offset: 3, shift: 24 }\n };\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n let components = 1;\n if (mimeType && (mimeType.indexOf('image/jpeg') !== -1 || mimeType.indexOf('image/png') !== -1))\n components = 4;\n const offset = coordinatesToOffset(u, v, parsedImage, components);\n let value = 0;\n for (const c of channels) {\n /*\n According to the EXT_feature_metadata extension specification:\n Channels are labeled by rgba and are swizzled with a string of 1-4 characters.\n According to the EXT_mesh_features extension specification:\n The channels array contains non-negative integer values corresponding to channels of the source texture that the feature ID consists of.\n Channels of an RGBA texture are numbered 0\u20133 respectively.\n Function getImageValueByCoordinates is used to process both extensions.\n So, there should be possible to get the element of CHANNELS_MAP by either index (0, 1, 2, 3) or key (r, g, b, a).\n */\n const map = typeof c === 'number' ? Object.values(CHANNELS_MAP)[c] : CHANNELS_MAP[c];\n const imageOffset = offset + map.offset;\n const imageData = getImageData(parsedImage);\n if (imageData.data.length <= imageOffset) {\n throw new Error(`${imageData.data.length} <= ${imageOffset}`);\n }\n const imageValue = imageData.data[imageOffset];\n value |= imageValue << map.shift;\n }\n return value;\n}\n/**\n * Retrieves the offset in the image where the data are stored.\n * @param u - u-coordinate.\n * @param v - v-coordinate.\n * @param parsedImage - Image where the data are stored.\n * @param componentsCount - Number of components the data consists of.\n * @returns Offset in the image where the data are stored.\n */\nfunction coordinatesToOffset(u, v, parsedImage, componentsCount = 1) {\n const w = parsedImage.width;\n const iX = emod(u) * (w - 1);\n const indX = Math.round(iX);\n const h = parsedImage.height;\n const iY = emod(v) * (h - 1);\n const indY = Math.round(iY);\n const components = parsedImage.components ? parsedImage.components : componentsCount;\n // components is a number of channels in the image\n const offset = (indY * w + indX) * components;\n return offset;\n}\n/**\n * Parses variable-length array data.\n * In this case every value of the property in the table will be an array\n * of arbitrary length.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - Number of rows in the property table.\n * @param arrayOffsets - Offsets of nested arrays in the flat values array.\n * @param valuesDataBytesLength - Data byte length.\n * @param valueSize - Value size in bytes.\n * @returns Array of typed arrays.\n */\nexport function parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, valueSize) {\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const arrayOffset = arrayOffsets[index];\n const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];\n if (arrayByteSize + arrayOffset > valuesDataBytesLength) {\n break;\n }\n const typedArrayOffset = arrayOffset / valueSize;\n const elementCount = arrayByteSize / valueSize;\n attributeValueArray.push(valuesData.slice(typedArrayOffset, typedArrayOffset + elementCount));\n }\n return attributeValueArray;\n}\n/**\n * Parses fixed-length array data.\n * In this case every value of the property in the table will be an array\n * of constant length equal to `arrayCount`.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - Number of rows in the property table.\n * @param arrayCount - Nested arrays length.\n * @returns Array of typed arrays.\n */\nexport function parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount) {\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const elementOffset = index * arrayCount;\n attributeValueArray.push(valuesData.slice(elementOffset, elementOffset + arrayCount));\n }\n return attributeValueArray;\n}\n/**\n * Decodes properties of string type from binary source.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @param stringOffsets - Index of the buffer view containing offsets for strings. It should be available for string type.\n * @returns String property values\n */\nexport function getPropertyDataString(numberOfElements, valuesDataBytes, arrayOffsets, stringOffsets) {\n if (arrayOffsets) {\n // TODO: implement it as soon as we have the corresponding tileset\n throw new Error('Not implemented - arrayOffsets for strings is specified');\n }\n if (stringOffsets) {\n const stringsArray = [];\n const textDecoder = new TextDecoder('utf8');\n let stringOffset = 0;\n for (let index = 0; index < numberOfElements; index++) {\n const stringByteSize = stringOffsets[index + 1] - stringOffsets[index];\n if (stringByteSize + stringOffset <= valuesDataBytes.length) {\n const stringData = valuesDataBytes.subarray(stringOffset, stringByteSize + stringOffset);\n const stringAttribute = textDecoder.decode(stringData);\n stringsArray.push(stringAttribute);\n stringOffset += stringByteSize;\n }\n }\n return stringsArray;\n }\n return [];\n}\n", "import { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { convertRawBufferToMetadataArray, getPrimitiveTextureData, primitivePropertyDataToAttributes, getArrayElementByteSize, getOffsetsForProperty, parseVariableLengthArrayNumeric, parseFixedLengthArrayNumeric, getPropertyDataString } from \"./utils/3d-tiles-utils.js\";\nconst EXT_STRUCTURAL_METADATA_NAME = 'EXT_structural_metadata';\nexport const name = EXT_STRUCTURAL_METADATA_NAME;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtStructuralMetadata(scenegraph, options);\n}\nexport function encode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n encodeExtStructuralMetadata(scenegraph, options);\n scenegraph.createBinaryChunk();\n return scenegraph.gltf;\n}\n/*\n// Example of the extension.\n// See more info at https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata\nconst extensions = {\n \"extensions\": {\n \"EXT_structural_metadata\": {\n \"schema\": {\n \"classes\": {\n \"tree\": {\n \"name\": \"Tree\",\n \"description\": \"Woody, perennial plant.\",\n \"properties\": {\n \"species\": {\n \"description\": \"Type of tree.\",\n \"type\": \"ENUM\",\n \"enumType\": \"speciesEnum\",\n \"required\": true\n },\n \"age\": {\n \"description\": \"The age of the tree, in years\",\n \"type\": \"SCALAR\",\n \"componentType\": \"UINT8\",\n \"required\": true\n }\n }\n }\n },\n \"enums\": {\n \"speciesEnum\": {\n \"name\": \"Species\",\n \"description\": \"An example enum for tree species.\",\n // valueType is not defined here. Default is \"UINT16\"\n \"values\": [\n { \"name\": \"Unspecified\", \"value\": 0 },\n { \"name\": \"Oak\", \"value\": 1 }\n ]\n }\n }\n },\n \"propertyTables\": [{\n \"name\": \"tree_survey_2021-09-29\",\n \"class\": \"tree\",\n \"count\": 10, // The number of elements in each property array (in `species`, in `age`).\n \"properties\": {\n \"species\": {\n \"values\": 0, // It's an index of the buffer view containing property values.\n },\n \"age\": {\n \"values\": 1\n }\n }\n }]\n }\n }\n}\n*/\n/**\n * Decodes feature metadata from extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param options - GLTFLoader options.\n */\nfunction decodeExtStructuralMetadata(scenegraph, options) {\n // Decoding metadata involves buffers processing.\n // So, if buffers have not been loaded, there is no reason to process metadata.\n if (!options.gltf?.loadBuffers) {\n return;\n }\n const extension = scenegraph.getExtension(EXT_STRUCTURAL_METADATA_NAME);\n if (!extension) {\n return;\n }\n if (options.gltf?.loadImages) {\n decodePropertyTextures(scenegraph, extension);\n }\n decodePropertyTables(scenegraph, extension);\n}\n/**\n * Processes the data stored in the textures\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTextures(scenegraph, extension) {\n const propertyTextures = extension.propertyTextures;\n const json = scenegraph.gltf.json;\n if (propertyTextures && json.meshes) {\n // Iterate through all meshes/primitives.\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitivePropertyTextures(scenegraph, propertyTextures, primitive, extension);\n }\n }\n }\n}\n/**\n * Processes the data stored in the property tables.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTables(scenegraph, extension) {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const propertyTables = extension.propertyTables;\n if (schemaClasses && propertyTables) {\n for (const schemaName in schemaClasses) {\n const propertyTable = findPropertyTableByClass(propertyTables, schemaName);\n if (propertyTable) {\n processPropertyTable(scenegraph, schema, propertyTable);\n }\n }\n }\n}\n/**\n * Finds the property table by class name.\n * @param propertyTables - propertyTable definition taken from the top-level extension.\n * @param schemaClassName - class name in the extension schema.\n */\nfunction findPropertyTableByClass(propertyTables, schemaClassName) {\n for (const propertyTable of propertyTables) {\n if (propertyTable.class === schemaClassName) {\n return propertyTable;\n }\n }\n return null;\n}\n/**\n * Takes data from property textures reffered by the primitive.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTextures - propertyTexture definition taken from the top-level extention.\n * @param primitive - Primitive object.\n * @param extension - Top-level extension.\n */\nfunction processPrimitivePropertyTextures(scenegraph, propertyTextures, primitive, extension) {\n if (!propertyTextures) {\n return;\n }\n const primitiveExtension = primitive.extensions?.[EXT_STRUCTURAL_METADATA_NAME];\n const primitivePropertyTextureIndices = primitiveExtension?.propertyTextures;\n if (!primitivePropertyTextureIndices) {\n return;\n }\n for (const primitivePropertyTextureIndex of primitivePropertyTextureIndices) {\n const propertyTexture = propertyTextures[primitivePropertyTextureIndex];\n processPrimitivePropertyTexture(scenegraph, propertyTexture, primitive, extension);\n }\n}\n/**\n * Takes property data from the texture pointed by the primitive and appends them to `exension.data`.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTexture - propertyTexture definition taken from the top-level extension.\n * @param primitive - Primitive object.\n * @param extension - Top-level extension.\n */\nfunction processPrimitivePropertyTexture(scenegraph, propertyTexture, primitive, extension) {\n if (!propertyTexture.properties) {\n return;\n }\n if (!extension.dataAttributeNames) {\n extension.dataAttributeNames = [];\n }\n /* Iterate through all properties defined in propertyTexture, e.g. \"speed\" and \"direction\":\n {\n \"class\": \"wind\",\n \"properties\": {\n \"speed\": {\n \"index\": 0,\n \"texCoord\": 0,\n \"channels\": [0]\n },\n \"direction\": {\n \"index\": 0,\n \"texCoord\": 0,\n \"channels\": [1, 2]\n }\n }\n }\n */\n const className = propertyTexture.class;\n for (const propertyName in propertyTexture.properties) {\n // propertyName has values like \"speed\", \"direction\"\n // Make attributeName as a combination of the class name and the propertyName like \"wind_speed\" or \"wind_direction\"\n const attributeName = `${className}_${propertyName}`;\n const textureInfoTopLevel = propertyTexture.properties?.[propertyName];\n if (!textureInfoTopLevel) {\n // eslint-disable-next-line no-continue\n continue;\n }\n // The data taken from all meshes/primitives (the same property, e.g. \"speed\" or \"direction\") will be combined into one array and saved in textureInfoTopLevel.data\n // Initially textureInfoTopLevel.data will be initialized with an empty array.\n if (!textureInfoTopLevel.data) {\n textureInfoTopLevel.data = [];\n }\n const featureTextureTable = textureInfoTopLevel.data;\n const propertyData = getPrimitiveTextureData(scenegraph, textureInfoTopLevel, primitive);\n if (propertyData === null) {\n // eslint-disable-next-line no-continue\n continue;\n }\n primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTextureTable, primitive);\n textureInfoTopLevel.data = featureTextureTable;\n extension.dataAttributeNames.push(attributeName);\n }\n}\n/**\n * Navigates through all properies in the property table, gets properties data,\n * and put the data to `propertyTable.data` as an array.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - schema object.\n * @param propertyTable - propertyTable definition taken from the top-level extension.\n */\nfunction processPropertyTable(scenegraph, schema, propertyTable) {\n const schemaClass = schema.classes?.[propertyTable.class];\n if (!schemaClass) {\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${propertyTable.class}`);\n }\n const numberOfElements = propertyTable.count; // `propertyTable.count` is a number of elements in each property array.\n for (const propertyName in schemaClass.properties) {\n const classProperty = schemaClass.properties[propertyName];\n const propertyTableProperty = propertyTable.properties?.[propertyName];\n if (propertyTableProperty) {\n // Getting all elements (`numberOfElements`) of the array in the `propertyTableProperty`\n const data = getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfElements, propertyTableProperty);\n propertyTableProperty.data = data;\n }\n }\n}\n/**\n * Decodes a propertyTable column from binary source based on property type.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - Schema object.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @returns {string[] | number[] | string[][] | number[][]}\n */\nfunction getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfElements, propertyTableProperty) {\n let data = [];\n const valuesBufferView = propertyTableProperty.values;\n const valuesDataBytes = scenegraph.getTypedArrayForBufferView(valuesBufferView);\n const arrayOffsets = getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements);\n const stringOffsets = getStringOffsetsForProperty(scenegraph, propertyTableProperty, numberOfElements);\n switch (classProperty.type) {\n case 'SCALAR':\n case 'VEC2':\n case 'VEC3':\n case 'VEC4':\n case 'MAT2':\n case 'MAT3':\n case 'MAT4': {\n data = getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets);\n break;\n }\n case 'BOOLEAN': {\n // TODO: implement it as soon as we have the corresponding tileset\n throw new Error(`Not implemented - classProperty.type=${classProperty.type}`);\n }\n case 'STRING': {\n data = getPropertyDataString(numberOfElements, valuesDataBytes, arrayOffsets, stringOffsets);\n break;\n }\n case 'ENUM': {\n data = getPropertyDataENUM(schema, classProperty, numberOfElements, valuesDataBytes, arrayOffsets);\n break;\n }\n default:\n throw new Error(`Unknown classProperty type ${classProperty.type}`);\n }\n return data;\n}\n/**\n * Parses propertyTable.property.arrayOffsets that are offsets of sub-arrays in a flatten array of values.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param classProperty - class property object.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L21\n */\nfunction getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {\n if (classProperty.array &&\n // `count` is a number of array elements. May only be defined when `array` is true.\n // If `count` is NOT defined, it's a VARIABLE-length array\n typeof classProperty.count === 'undefined' &&\n // `arrayOffsets` is an index of the buffer view containing offsets for variable-length arrays.\n typeof propertyTableProperty.arrayOffsets !== 'undefined') {\n // Data are in a VARIABLE-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsets, propertyTableProperty.arrayOffsetType || 'UINT32', numberOfElements);\n }\n return null;\n}\n/**\n * Parses propertyTable.property.stringOffsets.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L29C10-L29C23\n */\nfunction getStringOffsetsForProperty(scenegraph, propertyTableProperty, numberOfElements) {\n if (typeof propertyTableProperty.stringOffsets !== 'undefined' // `stringOffsets` is an index of the buffer view containing offsets for strings.\n ) {\n // Data are in a FIXED-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsets, propertyTableProperty.stringOffsetType || 'UINT32', numberOfElements);\n }\n return null;\n}\n/**\n * Decodes properties of SCALAR, VEC-N, MAT-N types from binary sourse.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Property values in a typed array or in an array of typed arrays.\n */\nfunction getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {\n const isArray = classProperty.array;\n const arrayCount = classProperty.count;\n const elementSize = getArrayElementByteSize(classProperty.type, classProperty.componentType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n let valuesData;\n if (classProperty.componentType) {\n valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, \n // The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n classProperty.componentType, elementCount);\n }\n else {\n // The spec doesn't provide any info what to do if componentType is not set.\n valuesData = valuesDataBytes;\n }\n if (isArray) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize);\n }\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);\n }\n return [];\n }\n return valuesData;\n}\n/**\n * Decodes properties of enum type from binary source.\n * @param schema - Schema object.\n * @param classProperty - Class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Strings array of nested strings array.\n */\nfunction getPropertyDataENUM(schema, classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {\n const enumType = classProperty.enumType;\n // Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`.\n if (!enumType) {\n throw new Error('Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM');\n }\n const enumEntry = schema.enums?.[enumType];\n if (!enumEntry) {\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${enumType}`);\n }\n const enumValueType = enumEntry.valueType || 'UINT16';\n const elementSize = getArrayElementByteSize(classProperty.type, enumValueType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n let valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, enumValueType, elementCount);\n if (!valuesData) {\n valuesData = valuesDataBytes;\n }\n if (classProperty.array) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayENUM({\n valuesData,\n numberOfElements,\n arrayOffsets,\n valuesDataBytesLength: valuesDataBytes.length,\n elementSize,\n enumEntry\n });\n }\n const arrayCount = classProperty.count;\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry);\n }\n return [];\n }\n // Single value (not an array)\n return getEnumsArray(valuesData, 0, numberOfElements, enumEntry);\n}\n/**\n * Parses variable length nested ENUM arrays.\n * @param params.valuesData - Values in a flat typed array.\n * @param params.numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param params.arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @param params.valuesDataBytesLength - Byte length of values array.\n * @param params.elementSize - Single element byte size.\n * @param params.enumEntry - Enums dictionary.\n * @returns Nested strings array.\n */\nfunction parseVariableLengthArrayENUM(params) {\n const { valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, elementSize, enumEntry } = params;\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const arrayOffset = arrayOffsets[index];\n const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];\n if (arrayByteSize + arrayOffset > valuesDataBytesLength) {\n break;\n }\n const typedArrayOffset = arrayOffset / elementSize;\n const elementCount = arrayByteSize / elementSize;\n const array = getEnumsArray(valuesData, typedArrayOffset, elementCount, enumEntry);\n attributeValueArray.push(array);\n }\n return attributeValueArray;\n}\n/**\n * Parses fixed length ENUM arrays.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param arrayCount - Nested arrays length.\n * @param enumEntry - Enums dictionary.\n * @returns Nested strings array.\n */\nfunction parseFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry) {\n const attributeValueArray = [];\n for (let index = 0; index < numberOfElements; index++) {\n const elementOffset = arrayCount * index;\n const array = getEnumsArray(valuesData, elementOffset, arrayCount, enumEntry);\n attributeValueArray.push(array);\n }\n return attributeValueArray;\n}\n/**\n * Parses ENUM values into a string array.\n * @param valuesData - Values in a flat typed array.\n * @param offset - Offset to start parse from.\n * @param count - Values length to parse.\n * @param enumEntry - Enums dictionary.\n * @returns Array of strings with parsed ENUM names.\n */\nfunction getEnumsArray(valuesData, offset, count, enumEntry) {\n const array = [];\n for (let i = 0; i < count; i++) {\n // At the moment we don't support BigInt. It requires additional calculations logic\n // and might be an issue in Safari\n if (valuesData instanceof BigInt64Array || valuesData instanceof BigUint64Array) {\n array.push('');\n }\n else {\n const value = valuesData[offset + i];\n const enumObject = getEnumByValue(enumEntry, value);\n if (enumObject) {\n array.push(enumObject.name);\n }\n else {\n array.push('');\n }\n }\n }\n return array;\n}\n/**\n * Looks up ENUM whose `value` property matches the specified number in the parameter `value`.\n * @param {GLTF_EXT_structural_metadata_Enum} enumEntry - ENUM entry containing the array of possible enums.\n * @param {number} value - The value of the ENUM to locate.\n * @returns {GLTF_EXT_structural_metadata_EnumValue | null} ENUM matcihng the specified value or null of no ENUM object was found.\n */\nfunction getEnumByValue(enumEntry, value) {\n for (const enumValue of enumEntry.values) {\n if (enumValue.value === value) {\n return enumValue;\n }\n }\n return null;\n}\nconst SCHEMA_CLASS_ID_DEFAULT = 'schemaClassId';\nfunction encodeExtStructuralMetadata(scenegraph, options) {\n const extension = scenegraph.getExtension(EXT_STRUCTURAL_METADATA_NAME);\n if (!extension) {\n return;\n }\n if (extension.propertyTables) {\n for (const table of extension.propertyTables) {\n const classId = table.class;\n const schemaClass = extension.schema?.classes?.[classId];\n if (table.properties && schemaClass) {\n encodeProperties(table, schemaClass, scenegraph);\n }\n }\n }\n}\nfunction encodeProperties(table, schemaClass, scenegraph) {\n for (const propertyName in table.properties) {\n const data = table.properties[propertyName].data;\n if (data) {\n const classProperty = schemaClass.properties[propertyName];\n if (classProperty) {\n const tableProperty = createPropertyTableProperty(data, classProperty, scenegraph);\n // Override table property that came with \"data\"\n table.properties[propertyName] = tableProperty;\n }\n }\n }\n}\n/**\n * Creates ExtStructuralMetadata, creates the schema and creates a property table containing feature data provided.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyAttributes - property attributes\n * @param classId - classId to use for encoding metadata.\n * @returns Index of the table created.\n */\nexport function createExtStructuralMetadata(scenegraph, propertyAttributes, classId = SCHEMA_CLASS_ID_DEFAULT) {\n let extension = scenegraph.getExtension(EXT_STRUCTURAL_METADATA_NAME);\n if (!extension) {\n extension = scenegraph.addExtension(EXT_STRUCTURAL_METADATA_NAME);\n }\n extension.schema = createSchema(propertyAttributes, classId, extension.schema);\n const table = createPropertyTable(propertyAttributes, classId, extension.schema);\n if (!extension.propertyTables) {\n extension.propertyTables = [];\n }\n return extension.propertyTables.push(table) - 1; // index of the table\n}\nfunction createSchema(propertyAttributes, classId, schemaToUpdate) {\n const schema = schemaToUpdate ?? {\n id: 'schema_id'\n };\n const schemaClass = {\n properties: {}\n };\n for (const attribute of propertyAttributes) {\n const classProperty = {\n type: attribute.elementType,\n componentType: attribute.componentType\n };\n schemaClass.properties[attribute.name] = classProperty;\n }\n schema.classes = {};\n schema.classes[classId] = schemaClass;\n return schema;\n}\nfunction createPropertyTable(propertyAttributes, classId, schema) {\n const table = {\n class: classId,\n count: 0\n };\n // count is a number of rows in the table\n let count = 0;\n const schemaClass = schema.classes?.[classId];\n for (const attribute of propertyAttributes) {\n if (count === 0) {\n count = attribute.values.length;\n }\n // The number of elements in all propertyAttributes must be the same\n if (count !== attribute.values.length && attribute.values.length) {\n throw new Error('Illegal values in attributes');\n }\n const classProperty = schemaClass?.properties[attribute.name];\n if (classProperty) {\n // const tableProperty = createPropertyTableProperty(attribute, classProperty, scenegraph);\n if (!table.properties) {\n table.properties = {};\n }\n // values is a required field. Its real value will be set while encoding data\n table.properties[attribute.name] = { values: 0, data: attribute.values };\n }\n }\n table.count = count;\n return table;\n}\nfunction createPropertyTableProperty(\n// attribute: PropertyAttribute,\nvalues, classProperty, scenegraph) {\n const prop = { values: 0 };\n if (classProperty.type === 'STRING') {\n const { stringData, stringOffsets } = createPropertyDataString(values);\n prop.stringOffsets = createBufferView(stringOffsets, scenegraph);\n prop.values = createBufferView(stringData, scenegraph);\n }\n else if (classProperty.type === 'SCALAR' && classProperty.componentType) {\n const data = createPropertyDataScalar(values, classProperty.componentType);\n prop.values = createBufferView(data, scenegraph);\n }\n return prop;\n}\nconst COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: Int32Array,\n UINT64: Uint32Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n};\nfunction createPropertyDataScalar(array, componentType) {\n const numberArray = [];\n for (const value of array) {\n numberArray.push(Number(value));\n }\n const Construct = COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR[componentType];\n if (!Construct) {\n throw new Error('Illegal component type');\n }\n return new Construct(numberArray);\n}\nfunction createPropertyDataString(strings) {\n const utf8Encode = new TextEncoder();\n const arr = [];\n let len = 0;\n for (const str of strings) {\n const uint8Array = utf8Encode.encode(str);\n len += uint8Array.length;\n arr.push(uint8Array);\n }\n const strArray = new Uint8Array(len);\n const strOffsets = [];\n let offset = 0;\n for (const str of arr) {\n strArray.set(str, offset);\n strOffsets.push(offset);\n offset += str.length;\n }\n strOffsets.push(offset); // The last offset represents the byte offset after the last string.\n const stringOffsetsTypedArray = new Uint32Array(strOffsets); // Its length = len+1\n return { stringData: strArray, stringOffsets: stringOffsetsTypedArray };\n}\nfunction createBufferView(typedArray, scenegraph) {\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n });\n return scenegraph.addBufferView(typedArray);\n}\n", "import { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nimport { convertRawBufferToMetadataArray, getPrimitiveTextureData, primitivePropertyDataToAttributes, getArrayElementByteSize, getOffsetsForProperty, parseVariableLengthArrayNumeric, parseFixedLengthArrayNumeric, getPropertyDataString } from \"../utils/3d-tiles-utils.js\";\n/** Extension name */\nconst EXT_FEATURE_METADATA_NAME = 'EXT_feature_metadata';\nexport const name = EXT_FEATURE_METADATA_NAME;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtFeatureMetadata(scenegraph, options);\n}\n/**\n * Decodes feature metadata from extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param options - GLTFLoader options.\n */\nfunction decodeExtFeatureMetadata(scenegraph, options) {\n // Decoding metadata involves buffers processing.\n // So, if buffers have not been loaded, there is no reason to process metadata.\n if (!options.gltf?.loadBuffers) {\n return;\n }\n const extension = scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);\n if (!extension) {\n return;\n }\n if (options.gltf?.loadImages) {\n decodePropertyTextures(scenegraph, extension);\n }\n decodePropertyTables(scenegraph, extension);\n}\n/**\n * Processes the data stored in the textures\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTextures(scenegraph, extension) {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const { featureTextures } = extension;\n if (schemaClasses && featureTextures) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTexture = findFeatureTextureByClass(featureTextures, schemaName);\n if (featureTexture) {\n handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);\n }\n }\n }\n}\n/**\n * Processes the data stored in the property tables.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTables(scenegraph, extension) {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const propertyTables = extension.featureTables;\n if (schemaClasses && propertyTables) {\n for (const schemaName in schemaClasses) {\n const propertyTable = findPropertyTableByClass(propertyTables, schemaName);\n if (propertyTable) {\n processPropertyTable(scenegraph, schema, propertyTable);\n }\n }\n }\n}\n/**\n * Finds the property table by class name.\n * @param propertyTables - propertyTable definition taken from the top-level extension.\n * @param schemaClassName - class name in the extension schema.\n */\nfunction findPropertyTableByClass(propertyTables, schemaClassName) {\n for (const propertyTableName in propertyTables) {\n const propertyTable = propertyTables[propertyTableName];\n if (propertyTable.class === schemaClassName) {\n return propertyTable;\n }\n }\n return null;\n}\nfunction findFeatureTextureByClass(featureTextures, schemaClassName) {\n for (const featureTexturesName in featureTextures) {\n const featureTable = featureTextures[featureTexturesName];\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n return null;\n}\n/**\n * Navigates through all properies in the property table, gets properties data,\n * and put the data to `propertyTable.data` as an array.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - schema object.\n * @param propertyTable - propertyTable definition taken from the top-level extension.\n */\nfunction processPropertyTable(scenegraph, schema, propertyTable) {\n // Though 'class' is not required by spec, it doesn't make any scence when it's not provided.\n // So, bale out here.\n if (!propertyTable.class) {\n return;\n }\n const schemaClass = schema.classes?.[propertyTable.class];\n if (!schemaClass) {\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${propertyTable.class}`);\n }\n const numberOfElements = propertyTable.count; // `propertyTable.count` is a number of elements in each property array.\n for (const propertyName in schemaClass.properties) {\n const classProperty = schemaClass.properties[propertyName];\n const propertyTableProperty = propertyTable.properties?.[propertyName];\n if (propertyTableProperty) {\n // Getting all elements (`numberOfElements`) of the array in the `propertyTableProperty`\n const data = getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfElements, propertyTableProperty);\n propertyTableProperty.data = data;\n }\n }\n}\n/**\n * Navigates through all properies in feature texture and gets properties data.\n * Data will be stored in featureTexture.properties[propertyName].data.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param featureTexture\n * @param schemaClass\n */\nfunction handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass) {\n const attributeName = featureTexture.class;\n for (const propertyName in schemaClass.properties) {\n const featureTextureProperty = featureTexture?.properties?.[propertyName];\n if (featureTextureProperty) {\n const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);\n featureTextureProperty.data = data;\n }\n }\n}\n/**\n * Decodes properties from binary sourse based on property type.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schemaProperty\n * @param numberOfFeatures\n * @param featureTableProperty\n */\nfunction getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numberOfFeatures, featureTableProperty) {\n let data = [];\n const bufferView = featureTableProperty.bufferView;\n const dataArray = scenegraph.getTypedArrayForBufferView(bufferView);\n const arrayOffsets = getArrayOffsetsForProperty(scenegraph, classProperty, featureTableProperty, numberOfFeatures);\n const stringOffsets = getStringOffsetsForProperty(scenegraph, classProperty, featureTableProperty, numberOfFeatures);\n if (classProperty.type === 'STRING' || classProperty.componentType === 'STRING') {\n data = getPropertyDataString(numberOfFeatures, dataArray, arrayOffsets, stringOffsets);\n }\n else if (isNumericProperty(classProperty)) {\n data = getPropertyDataNumeric(classProperty, numberOfFeatures, dataArray, arrayOffsets);\n }\n return data;\n}\n/**\n * Parses propertyTable.property.arrayOffsets that are offsets of sub-arrays in a flatten array of values.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param classProperty - class property object.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L21\n */\nfunction getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {\n /*\n If ARRAY is used, then componentType must also be specified.\n ARRAY is a fixed-length array when componentCount is defined, and variable-length otherwise.\n */\n if (classProperty.type === 'ARRAY' &&\n // `componentCount` is a number of fixed-length array elements.\n // If `componentCount` is NOT defined, it's a VARIABLE-length array\n typeof classProperty.componentCount === 'undefined' &&\n // `arrayOffsetBufferView` is an index of the buffer view containing offsets for variable-length arrays.\n typeof propertyTableProperty.arrayOffsetBufferView !== 'undefined') {\n // Data are in a VARIABLE-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsetBufferView, propertyTableProperty.offsetType || 'UINT32', // offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView\n numberOfElements);\n }\n return null;\n}\n/**\n * Parses featureTable.property.stringOffsetBufferView.\n * String offsets is an array of offsets of strings in the united array of characters.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array of offset values. The number of offsets in the array is equal to `numberOfElements` plus one.\n * @see https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.property.schema.json#L50C10-L50C32\n */\nfunction getStringOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {\n if (typeof propertyTableProperty.stringOffsetBufferView !== 'undefined' // `stringOffsetBufferView` is an index of the buffer view containing offsets for strings.\n ) {\n // Data are in a FIXED-length array\n return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsetBufferView, propertyTableProperty.offsetType || 'UINT32', // offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView\n numberOfElements);\n }\n return null;\n}\n/**\n * Checks if the feature table property is of numeric type.\n * @param schemaPropertyType - feature table property\n * @returns true if property is numeric, else - false\n */\nfunction isNumericProperty(schemaProperty) {\n const types = [\n 'UINT8',\n 'INT16',\n 'UINT16',\n 'INT32',\n 'UINT32',\n 'INT64',\n 'UINT64',\n 'FLOAT32',\n 'FLOAT64'\n ];\n return (types.includes(schemaProperty.type) ||\n (typeof schemaProperty.componentType !== 'undefined' &&\n types.includes(schemaProperty.componentType)));\n}\n/**\n * Decodes properties of numeric types from binary sourse.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Property values in a typed array or in an array of typed arrays.\n */\nfunction getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {\n const isArray = classProperty.type === 'ARRAY';\n const arrayCount = classProperty.componentCount;\n /*\n We are getting Numeric data. So,\n the component type can be one of NumericComponentType,\n the attribute type should be 'SCALAR'\n */\n const attributeType = 'SCALAR';\n const componentType = classProperty.componentType || classProperty.type;\n const elementSize = getArrayElementByteSize(attributeType, componentType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n const valuesData = convertRawBufferToMetadataArray(valuesDataBytes, attributeType, componentType, elementCount);\n if (isArray) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize);\n }\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);\n }\n return [];\n }\n return valuesData;\n}\n/**\n * Gets properties from texture associated with all mesh primitives.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param featureTextureProperty\n * @param attributeName\n * @returns Feature texture data\n */\nfunction getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName) {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return [];\n }\n const featureTextureTable = [];\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive);\n }\n }\n return featureTextureTable;\n}\n/**\n * Processes data encoded in the texture associated with the primitive. This data will be accessible through the attributes.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param attributeName\n * @param featureTextureProperty\n * @param featureTextureTable\n * @param primitive\n */\nfunction processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive) {\n const textureInfoTopLevel = {\n channels: featureTextureProperty.channels,\n ...featureTextureProperty.texture\n };\n const propertyData = getPrimitiveTextureData(scenegraph, textureInfoTopLevel, primitive);\n if (!propertyData) {\n return;\n }\n primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTextureTable, primitive);\n}\n", "// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.1\" !== 'undefined' ? \"4.3.1\" : 'latest';\n", "import { parseJSON, sliceArrayBuffer, parseFromContext } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { BasisLoader, selectSupportedBasisFormat } from '@loaders.gl/textures';\nimport { assert } from \"../utils/assert.js\";\nimport { isGLB, parseGLBSync } from \"./parse-glb.js\";\nimport { resolveUrl } from \"../gltf-utils/resolve-url.js\";\nimport { getTypedArrayForBufferView } from \"../gltf-utils/get-typed-array.js\";\nimport { preprocessExtensions, decodeExtensions } from \"../api/gltf-extensions.js\";\nimport { normalizeGLTFV1 } from \"../api/normalize-gltf-v1.js\";\n/** Check if an array buffer appears to contain GLTF data */\nexport function isGLTF(arrayBuffer, options) {\n const byteOffset = 0;\n return isGLB(arrayBuffer, byteOffset, options);\n}\nexport async function parseGLTF(gltf, arrayBufferOrString, byteOffset = 0, options, context) {\n parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);\n normalizeGLTFV1(gltf, { normalize: options?.gltf?.normalize });\n preprocessExtensions(gltf, options, context);\n // Load linked buffers asynchronously and decodes base64 buffers in parallel\n if (options?.gltf?.loadBuffers && gltf.json.buffers) {\n await loadBuffers(gltf, options, context);\n }\n // loadImages and decodeExtensions should not be running in parallel, because\n // decodeExtensions uses data from images taken during the loadImages call.\n if (options?.gltf?.loadImages) {\n await loadImages(gltf, options, context);\n }\n await decodeExtensions(gltf, options, context);\n return gltf;\n}\n/**\n *\n * @param gltf\n * @param data - can be ArrayBuffer (GLB), ArrayBuffer (Binary JSON), String (JSON), or Object (parsed JSON)\n * @param byteOffset\n * @param options\n */\nfunction parseGLTFContainerSync(gltf, data, byteOffset, options) {\n // Initialize gltf container\n if (options.uri) {\n gltf.baseUri = options.uri;\n }\n // If data is binary and starting with magic bytes, assume binary JSON text, convert to string\n if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options)) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(data);\n }\n if (typeof data === 'string') {\n // If string, try to parse as JSON\n gltf.json = parseJSON(data);\n }\n else if (data instanceof ArrayBuffer) {\n // If still ArrayBuffer, parse as GLB container\n const glb = {};\n byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);\n assert(glb.type === 'glTF', `Invalid GLB magic string ${glb.type}`);\n gltf._glb = glb;\n gltf.json = glb.json;\n }\n else {\n assert(false, 'GLTF: must be ArrayBuffer or string');\n }\n // Populate buffers\n // Create an external buffers array to hold binary data\n const buffers = gltf.json.buffers || [];\n gltf.buffers = new Array(buffers.length).fill(null);\n // Populates JSON and some bin chunk info\n if (gltf._glb && gltf._glb.header.hasBinChunk) {\n const { binChunks } = gltf._glb;\n gltf.buffers[0] = {\n arrayBuffer: binChunks[0].arrayBuffer,\n byteOffset: binChunks[0].byteOffset,\n byteLength: binChunks[0].byteLength\n };\n // TODO - this modifies JSON and is a post processing thing\n // gltf.json.buffers[0].data = gltf.buffers[0].arrayBuffer;\n // gltf.json.buffers[0].byteOffset = gltf.buffers[0].byteOffset;\n }\n // Populate images\n const images = gltf.json.images || [];\n gltf.images = new Array(images.length).fill({});\n}\n/** Asynchronously fetch and parse buffers, store in buffers array outside of json\n * TODO - traverse gltf and determine which buffers are actually needed\n */\nasync function loadBuffers(gltf, options, context) {\n // TODO\n const buffers = gltf.json.buffers || [];\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = buffers[i];\n if (buffer.uri) {\n const { fetch } = context;\n assert(fetch);\n const uri = resolveUrl(buffer.uri, options);\n const response = await context?.fetch?.(uri);\n const arrayBuffer = await response?.arrayBuffer?.();\n gltf.buffers[i] = {\n arrayBuffer,\n byteOffset: 0,\n byteLength: arrayBuffer.byteLength\n };\n delete buffer.uri;\n }\n else if (gltf.buffers[i] === null) {\n gltf.buffers[i] = {\n arrayBuffer: new ArrayBuffer(buffer.byteLength),\n byteOffset: 0,\n byteLength: buffer.byteLength\n };\n }\n }\n}\n/**\n * Loads all images\n * TODO - traverse gltf and determine which images are actually needed\n * @param gltf\n * @param options\n * @param context\n * @returns\n */\nasync function loadImages(gltf, options, context) {\n const imageIndices = getReferencesImageIndices(gltf);\n const images = gltf.json.images || [];\n const promises = [];\n for (const imageIndex of imageIndices) {\n promises.push(loadImage(gltf, images[imageIndex], imageIndex, options, context));\n }\n return await Promise.all(promises);\n}\n/** Make sure we only load images that are actually referenced by textures */\nfunction getReferencesImageIndices(gltf) {\n const imageIndices = new Set();\n const textures = gltf.json.textures || [];\n for (const texture of textures) {\n if (texture.source !== undefined) {\n imageIndices.add(texture.source);\n }\n }\n return Array.from(imageIndices).sort();\n}\n/** Asynchronously fetches and parses one image, store in images array outside of json */\nasync function loadImage(gltf, image, index, options, context) {\n let arrayBuffer;\n if (image.uri && !image.hasOwnProperty('bufferView')) {\n const uri = resolveUrl(image.uri, options);\n const { fetch } = context;\n const response = await fetch(uri);\n arrayBuffer = await response.arrayBuffer();\n image.bufferView = {\n data: arrayBuffer\n };\n }\n if (Number.isFinite(image.bufferView)) {\n const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);\n arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);\n }\n assert(arrayBuffer, 'glTF image has no data');\n // Call `parse`\n let parsedImage = (await parseFromContext(arrayBuffer, [ImageLoader, BasisLoader], {\n ...options,\n mimeType: image.mimeType,\n basis: options.basis || { format: selectSupportedBasisFormat() }\n }, context));\n if (parsedImage && parsedImage[0]) {\n parsedImage = {\n compressed: true,\n // @ts-expect-error\n mipmaps: false,\n width: parsedImage[0].width,\n height: parsedImage[0].height,\n data: parsedImage[0]\n };\n }\n // TODO making sure ImageLoader is overridable by using array of loaders\n // const parsedImage = await parse(arrayBuffer, [ImageLoader]);\n // Store the loaded image\n gltf.images = gltf.images || [];\n // @ts-expect-error TODO - sort out image typing asap\n gltf.images[index] = parsedImage;\n}\n", "import { padToNBytes, assert } from '@loaders.gl/loader-utils';\n/** Binary GLTF is little endian. */\nconst LITTLE_ENDIAN = true;\n/** 'glTF' in Big-Endian ASCII */\nconst MAGIC_glTF = 0x676c5446;\nconst GLB_FILE_HEADER_SIZE = 12;\nconst GLB_CHUNK_HEADER_SIZE = 8;\nconst GLB_CHUNK_TYPE_JSON = 0x4e4f534a;\nconst GLB_CHUNK_TYPE_BIN = 0x004e4942;\nconst GLB_V1_CONTENT_FORMAT_JSON = 0x0;\n/** @deprecated - Backward compatibility for old xviz files */\nconst GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED = 0;\n/** @deprecated - Backward compatibility for old xviz files */\nconst GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED = 1;\nfunction getMagicString(dataView, byteOffset = 0) {\n return `\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 0))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 1))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 2))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;\n}\n/** Check if the contents of an array buffer contains GLB byte markers */\nexport function isGLB(arrayBuffer, byteOffset = 0, options = {}) {\n const dataView = new DataView(arrayBuffer);\n // Check that GLB Header starts with the magic number\n const { magic = MAGIC_glTF } = options;\n const magic1 = dataView.getUint32(byteOffset, false);\n return magic1 === magic || magic1 === MAGIC_glTF;\n}\n/**\n * Synchronously parse a GLB\n * @param glb - Target, Output is stored there\n * @param arrayBuffer - Input data\n * @param byteOffset - Offset into arrayBuffer to start parsing from (for \"embedded\" GLBs, e.g. in 3D tiles)\n * @param options\n * @returns\n */\nexport function parseGLBSync(glb, arrayBuffer, byteOffset = 0, options = {}) {\n // Check that GLB Header starts with the magic number\n const dataView = new DataView(arrayBuffer);\n // Compare format with GLBLoader documentation\n const type = getMagicString(dataView, byteOffset + 0);\n const version = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Version 2 of binary glTF container format\n const byteLength = dataView.getUint32(byteOffset + 8, LITTLE_ENDIAN); // Total byte length of binary file\n Object.assign(glb, {\n // Put less important stuff in a header, to avoid clutter\n header: {\n byteOffset, // Byte offset into the initial arrayBuffer\n byteLength,\n hasBinChunk: false\n },\n type,\n version,\n json: {},\n binChunks: []\n });\n byteOffset += GLB_FILE_HEADER_SIZE;\n switch (glb.version) {\n case 1:\n return parseGLBV1(glb, dataView, byteOffset);\n case 2:\n return parseGLBV2(glb, dataView, byteOffset, (options = {}));\n default:\n throw new Error(`Invalid GLB version ${glb.version}. Only supports version 1 and 2.`);\n }\n}\n/**\n * Parse a V1 GLB\n * @param glb - target, output is stored in this object\n * @param dataView - Input, memory to be parsed\n * @param byteOffset - Offset of first byte of GLB data in the data view\n * @returns Number of bytes parsed (there could be additional non-GLB data after the GLB)\n */\nfunction parseGLBV1(glb, dataView, byteOffset) {\n // Sanity: ensure file is big enough to hold at least the headers\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n // Explanation of GLB structure:\n // https://cloud.githubusercontent.com/assets/3479527/22600725/36b87122-ea55-11e6-9d40-6fd42819fcab.png\n const contentLength = dataView.getUint32(byteOffset + 0, LITTLE_ENDIAN); // Byte length of chunk\n const contentFormat = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n // GLB v1 only supports a single chunk type\n assert(contentFormat === GLB_V1_CONTENT_FORMAT_JSON);\n parseJSONChunk(glb, dataView, byteOffset, contentLength);\n // No need to call the function padToBytes() from parseJSONChunk()\n byteOffset += contentLength;\n byteOffset += parseBINChunk(glb, dataView, byteOffset, glb.header.byteLength);\n return byteOffset;\n}\n/**\n * Parse a V2 GLB\n * @param glb - target, output is stored in this object\n * @param dataView - Input, memory to be parsed\n * @param byteOffset - Offset of first byte of GLB data in the data view\n * @returns Number of bytes parsed (there could be additional non-GLB data after the GLB)\n */\nfunction parseGLBV2(glb, dataView, byteOffset, options) {\n // Sanity: ensure file is big enough to hold at least the first chunk header\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n parseGLBChunksSync(glb, dataView, byteOffset, options);\n return byteOffset + glb.header.byteLength;\n}\n/** Iterate over GLB chunks and parse them */\nfunction parseGLBChunksSync(glb, dataView, byteOffset, options) {\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n // Iterate as long as there is space left for another chunk header\n while (byteOffset + 8 <= glb.header.byteLength) {\n const chunkLength = dataView.getUint32(byteOffset + 0, LITTLE_ENDIAN); // Byte length of chunk\n const chunkFormat = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n switch (chunkFormat) {\n case GLB_CHUNK_TYPE_JSON:\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n break;\n case GLB_CHUNK_TYPE_BIN:\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n break;\n // Backward compatibility for very old xviz files\n case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n default:\n // Ignore, per spec\n // console.warn(`Unknown GLB chunk type`); // eslint-disable-line\n break;\n }\n byteOffset += padToNBytes(chunkLength, 4);\n }\n return byteOffset;\n}\n/* Parse a GLB JSON chunk */\nfunction parseJSONChunk(glb, dataView, byteOffset, chunkLength) {\n // 1. Create a \"view\" of the binary encoded JSON data inside the GLB\n const jsonChunk = new Uint8Array(dataView.buffer, byteOffset, chunkLength);\n // 2. Decode the JSON binary array into clear text\n const textDecoder = new TextDecoder('utf8');\n const jsonText = textDecoder.decode(jsonChunk);\n // 3. Parse the JSON text into a JavaScript data structure\n glb.json = JSON.parse(jsonText);\n return padToNBytes(chunkLength, 4);\n}\n/** Parse a GLB BIN chunk */\nfunction parseBINChunk(glb, dataView, byteOffset, chunkLength) {\n // Note: BIN chunk can be optional\n glb.header.hasBinChunk = true;\n glb.binChunks.push({\n byteOffset,\n byteLength: chunkLength,\n arrayBuffer: dataView.buffer\n // TODO - copy, or create typed array view?\n });\n return padToNBytes(chunkLength, 4);\n}\n", "// Resolves a relative url against a baseUrl\n// If url is absolute, return it unchanged\nexport function resolveUrl(url, options) {\n // TODO: Use better logic to handle all protocols plus not delay on data\n const absolute = url.startsWith('data:') || url.startsWith('http:') || url.startsWith('https:');\n if (absolute) {\n return url;\n }\n const baseUrl = options.baseUri || options.uri;\n if (!baseUrl) {\n throw new Error(`'baseUri' must be provided to resolve relative url ${url}`);\n }\n return baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1) + url;\n}\n", "import { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { meshoptDecodeGltfBuffer } from \"../../meshopt/meshopt-decoder.js\";\n// @ts-ignore\n// eslint-disable-next-line\nconst DEFAULT_MESHOPT_OPTIONS = {\n byteOffset: 0,\n filter: 'NONE'\n};\n/** Extension name */\nconst EXT_MESHOPT_COMPRESSION = 'EXT_meshopt_compression';\nexport const name = EXT_MESHOPT_COMPRESSION;\nexport async function decode(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n if (!options?.gltf?.decompressMeshes || !options.gltf?.loadBuffers) {\n return;\n }\n const promises = [];\n for (const bufferViewIndex of gltfData.json.bufferViews || []) {\n promises.push(decodeMeshoptBufferView(scenegraph, bufferViewIndex));\n }\n // Decompress meshes in parallel\n await Promise.all(promises);\n // We have now decompressed all primitives, so remove the top-level extension\n scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);\n}\n/** Decode one meshopt buffer view */\nasync function decodeMeshoptBufferView(scenegraph, bufferView) {\n const meshoptExtension = scenegraph.getObjectExtension(bufferView, EXT_MESHOPT_COMPRESSION);\n if (meshoptExtension) {\n const { byteOffset = 0, byteLength = 0, byteStride, count, mode, filter = 'NONE', buffer: bufferIndex } = meshoptExtension;\n const buffer = scenegraph.gltf.buffers[bufferIndex];\n const source = new Uint8Array(buffer.arrayBuffer, buffer.byteOffset + byteOffset, byteLength);\n const result = new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer, bufferView.byteOffset, bufferView.byteLength);\n await meshoptDecodeGltfBuffer(result, count, byteStride, source, mode, filter);\n scenegraph.removeObjectExtension(bufferView, EXT_MESHOPT_COMPRESSION);\n }\n}\n", "// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2021, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\n/* eslint-disable camelcase */\nconst isWebAssemblySupported = typeof WebAssembly !== 'object';\n// Built with clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)\n// Built from meshoptimizer 0.16\nconst wasm_base = 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCb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XAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';\n// Uses bulk-memory and simd extensions\nconst detector = new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2,\n 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11\n]);\n// Used to unpack wasm\nconst wasmpack = new Uint8Array([\n 32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113,\n 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101,\n 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167\n]);\nconst FILTERS = {\n // legacy index-based enums for glTF\n 0: '',\n 1: 'meshopt_decodeFilterOct',\n 2: 'meshopt_decodeFilterQuat',\n 3: 'meshopt_decodeFilterExp',\n // string-based enums for glTF\n NONE: '',\n OCTAHEDRAL: 'meshopt_decodeFilterOct',\n QUATERNION: 'meshopt_decodeFilterQuat',\n EXPONENTIAL: 'meshopt_decodeFilterExp'\n};\nconst DECODERS = {\n // legacy index-based enums for glTF\n 0: 'meshopt_decodeVertexBuffer',\n 1: 'meshopt_decodeIndexBuffer',\n 2: 'meshopt_decodeIndexSequence',\n // string-based enums for glTF\n ATTRIBUTES: 'meshopt_decodeVertexBuffer',\n TRIANGLES: 'meshopt_decodeIndexBuffer',\n INDICES: 'meshopt_decodeIndexSequence'\n};\nexport function isMeshoptSupported() {\n return isWebAssemblySupported;\n}\nexport async function meshoptDecodeVertexBuffer(target, count, size, source, filter = 'NONE') {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[FILTERS[filter]]);\n}\nexport async function meshoptDecodeIndexBuffer(target, count, size, source) {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);\n}\nexport async function meshoptDecodeIndexSequence(target, count, size, source) {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports.meshopt_decodeIndexSequence, target, count, size, source);\n}\n// eslint-disable-next-line max-params\nexport async function meshoptDecodeGltfBuffer(target, count, size, source, mode, filter = 'NONE') {\n const instance = await loadWasmInstance();\n decode(instance, instance.exports[DECODERS[mode]], target, count, size, source, instance.exports[FILTERS[filter || 'NONE']]);\n}\nlet wasmPromise;\nasync function loadWasmInstance() {\n // eslint-disable-next-line\n if (!wasmPromise) {\n wasmPromise = loadWasmModule();\n }\n return wasmPromise;\n}\nasync function loadWasmModule() {\n let wasm = wasm_base;\n if (WebAssembly.validate(detector)) {\n wasm = wasm_simd;\n // eslint-disable-next-line no-console\n console.log('Warning: meshopt_decoder is using experimental SIMD support');\n }\n const result = await WebAssembly.instantiate(unpack(wasm), {});\n await result.instance.exports.__wasm_call_ctors();\n return result.instance;\n}\nfunction unpack(data) {\n const result = new Uint8Array(data.length);\n for (let i = 0; i < data.length; ++i) {\n const ch = data.charCodeAt(i);\n result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;\n }\n let write = 0;\n for (let i = 0; i < data.length; ++i) {\n result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n }\n return result.buffer.slice(0, write);\n}\n// eslint-disable-next-line max-params\nfunction decode(instance, fun, target, count, size, source, filter) {\n const sbrk = instance.exports.sbrk;\n const count4 = (count + 3) & ~3; // pad for SIMD filter\n const tp = sbrk(count4 * size);\n const sp = sbrk(source.length);\n const heap = new Uint8Array(instance.exports.memory.buffer);\n heap.set(source, sp);\n const res = fun(tp, count, size, sp, source.length);\n if (res === 0 && filter) {\n filter(tp, count4, size);\n }\n target.set(heap.subarray(tp, tp + count * size));\n sbrk(tp - sbrk(0));\n if (res !== 0) {\n throw new Error(`Malformed buffer data: ${res}`);\n }\n}\n", "// GLTF EXTENSION: EXT_TEXTURE_WEBP\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_TEXTURE_WEBP\n/* eslint-disable camelcase */\nimport { isImageFormatSupported } from '@loaders.gl/images';\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nconst EXT_TEXTURE_WEBP = 'EXT_texture_webp';\n/** Extension name */\nexport const name = EXT_TEXTURE_WEBP;\n/**\n * Replaces a texture source reference with the extension texture\n * Done in preprocess() to prevent load of default image\n */\nexport function preprocess(gltfData, options) {\n const scenegraph = new GLTFScenegraph(gltfData);\n if (!isImageFormatSupported('image/webp')) {\n if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {\n throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);\n }\n return;\n }\n const { json } = scenegraph;\n for (const texture of json.textures || []) {\n const extension = scenegraph.getObjectExtension(texture, EXT_TEXTURE_WEBP);\n if (extension) {\n // TODO - if multiple texture extensions are present which one wins?\n texture.source = extension.source;\n }\n scenegraph.removeObjectExtension(texture, EXT_TEXTURE_WEBP);\n }\n // Remove the top-level extension\n scenegraph.removeExtension(EXT_TEXTURE_WEBP);\n}\n", "// GLTF EXTENSION: KHR_texture_basisu\n// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_basisu\n/* eslint-disable camelcase */\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nconst KHR_TEXTURE_BASISU = 'KHR_texture_basisu';\n/** Extension name */\nexport const name = KHR_TEXTURE_BASISU;\n/**\n * Replaces a texture source reference with the extension texture\n * Done in preprocess() to prevent load of default image\n */\nexport function preprocess(gltfData, options) {\n const scene = new GLTFScenegraph(gltfData);\n const { json } = scene;\n for (const texture of json.textures || []) {\n const extension = scene.getObjectExtension(texture, KHR_TEXTURE_BASISU);\n if (extension) {\n // TODO - if multiple texture extensions are present which one wins?\n texture.source = extension.source;\n scene.removeObjectExtension(texture, KHR_TEXTURE_BASISU);\n }\n }\n // Remove the top-level extension\n scene.removeExtension(KHR_TEXTURE_BASISU);\n}\n", "// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n// Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported\n/* eslint-disable camelcase */\nimport { sliceArrayBuffer, parseFromContext } from '@loaders.gl/loader-utils';\nimport { DracoLoader } from '@loaders.gl/draco';\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nimport { getGLTFAccessors, getGLTFAccessor } from \"../gltf-utils/gltf-attribute-utils.js\";\nconst KHR_DRACO_MESH_COMPRESSION = 'KHR_draco_mesh_compression';\n/** Extension name */\nexport const name = KHR_DRACO_MESH_COMPRESSION;\nexport function preprocess(gltfData, options, context) {\n const scenegraph = new GLTFScenegraph(gltfData);\n for (const primitive of makeMeshPrimitiveIterator(scenegraph)) {\n if (scenegraph.getObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION)) {\n // TODO - Remove fallback accessors to make sure we don't load unnecessary buffers\n }\n }\n}\nexport async function decode(gltfData, options, context) {\n if (!options?.gltf?.decompressMeshes) {\n return;\n }\n const scenegraph = new GLTFScenegraph(gltfData);\n const promises = [];\n for (const primitive of makeMeshPrimitiveIterator(scenegraph)) {\n if (scenegraph.getObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION)) {\n promises.push(decompressPrimitive(scenegraph, primitive, options, context));\n }\n }\n // Decompress meshes in parallel\n await Promise.all(promises);\n // We have now decompressed all primitives, so remove the top-level extension\n scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);\n}\nexport function encode(gltfData, options = {}) {\n const scenegraph = new GLTFScenegraph(gltfData);\n for (const mesh of scenegraph.json.meshes || []) {\n // eslint-disable-next-line camelcase\n // @ts-ignore\n compressMesh(mesh, options);\n // NOTE: Only add the extension if something was actually compressed\n scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);\n }\n}\n// DECODE\n// Unpacks one mesh primitive and removes the extension from the primitive\n// DracoDecoder needs to be imported and registered by app\n// Returns: Promise that resolves when all pending draco decoder jobs for this mesh complete\n// TODO - Implement fallback behavior per KHR_DRACO_MESH_COMPRESSION spec\nasync function decompressPrimitive(scenegraph, primitive, options, context) {\n const dracoExtension = scenegraph.getObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION);\n if (!dracoExtension) {\n return;\n }\n const buffer = scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);\n // TODO - parse does not yet deal well with byte offsets embedded in typed arrays. Copy buffer\n // TODO - remove when `parse` is fixed to handle `byteOffset`s\n const bufferCopy = sliceArrayBuffer(buffer.buffer, buffer.byteOffset); // , buffer.byteLength);\n const dracoOptions = { ...options };\n // TODO - remove hack: The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n const decodedData = await parseFromContext(bufferCopy, DracoLoader, dracoOptions, context);\n const decodedAttributes = getGLTFAccessors(decodedData.attributes);\n // Restore min/max values\n for (const [attributeName, decodedAttribute] of Object.entries(decodedAttributes)) {\n if (attributeName in primitive.attributes) {\n const accessorIndex = primitive.attributes[attributeName];\n const accessor = scenegraph.getAccessor(accessorIndex);\n if (accessor?.min && accessor?.max) {\n decodedAttribute.min = accessor.min;\n decodedAttribute.max = accessor.max;\n }\n }\n }\n // @ts-ignore\n primitive.attributes = decodedAttributes;\n if (decodedData.indices) {\n // @ts-ignore\n primitive.indices = getGLTFAccessor(decodedData.indices);\n }\n // Extension has been processed, delete it\n scenegraph.removeObjectExtension(primitive, KHR_DRACO_MESH_COMPRESSION);\n checkPrimitive(primitive);\n}\n// ENCODE\n// eslint-disable-next-line max-len\n// Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported\nfunction compressMesh(attributes, indices, mode = 4, options, context) {\n if (!options.DracoWriter) {\n throw new Error('options.gltf.DracoWriter not provided');\n }\n // TODO - use DracoWriter using encode w/ registered DracoWriter...\n const compressedData = options.DracoWriter.encodeSync({ attributes });\n // Draco compression may change the order and number of vertices in a mesh.\n // To satisfy the requirement that accessors properties be correct for both\n // compressed and uncompressed data, generators should create uncompressed\n // attributes and indices using data that has been decompressed from the Draco buffer,\n // rather than the original source data.\n // @ts-ignore TODO this needs to be fixed\n const decodedData = context?.parseSync?.({ attributes });\n const fauxAccessors = options._addFauxAttributes(decodedData.attributes);\n const bufferViewIndex = options.addBufferView(compressedData);\n const glTFMesh = {\n primitives: [\n {\n attributes: fauxAccessors, // TODO - verify with spec\n mode, // GL.POINTS\n extensions: {\n [KHR_DRACO_MESH_COMPRESSION]: {\n bufferView: bufferViewIndex,\n attributes: fauxAccessors // TODO - verify with spec\n }\n }\n }\n ]\n };\n return glTFMesh;\n}\n// UTILS\nfunction checkPrimitive(primitive) {\n if (!primitive.attributes && Object.keys(primitive.attributes).length > 0) {\n throw new Error('glTF: Empty primitive detected: Draco decompression failure?');\n }\n}\nfunction* makeMeshPrimitiveIterator(scenegraph) {\n for (const mesh of scenegraph.json.meshes || []) {\n for (const primitive of mesh.primitives) {\n yield primitive;\n }\n }\n}\n", "// TODO - remove\nimport { getAccessorTypeFromSize, getComponentTypeFromArray } from \"./gltf-utils.js\";\n// Returns a fresh attributes object with glTF-standardized attributes names\n// Attributes that cannot be identified will not be included\n// Removes `indices` if present, as it should be stored separately from the attributes\nexport function getGLTFAccessors(attributes) {\n const accessors = {};\n for (const name in attributes) {\n const attribute = attributes[name];\n if (name !== 'indices') {\n const glTFAccessor = getGLTFAccessor(attribute);\n accessors[name] = glTFAccessor;\n }\n }\n return accessors;\n}\n// Fix up a single accessor.\n// Input: typed array or a partial accessor object\n// Return: accessor object\nexport function getGLTFAccessor(attribute) {\n const { buffer, size, count } = getAccessorData(attribute);\n const glTFAccessor = {\n // glTF Accessor values\n // TODO: Instead of a bufferView index we could have an actual buffer (typed array)\n // bufferView: null,\n // TODO: Deprecate `value` in favor of bufferView?\n // @ts-ignore\n value: buffer,\n size, // Decoded `type` (e.g. SCALAR)\n byteOffset: 0,\n count,\n type: getAccessorTypeFromSize(size),\n componentType: getComponentTypeFromArray(buffer)\n };\n return glTFAccessor;\n}\n// export function getGLTFAttribute(data, gltfAttributeName): GLTFAccessor {\n// return data.attributes[data.glTFAttributeMap[gltfAttributeName]];\n// }\nfunction getAccessorData(attribute) {\n let buffer = attribute;\n let size = 1;\n let count = 0;\n if (attribute && attribute.value) {\n buffer = attribute.value;\n size = attribute.size || 1;\n }\n if (buffer) {\n if (!ArrayBuffer.isView(buffer)) {\n buffer = toTypedArray(buffer, Float32Array);\n }\n count = buffer.length / size;\n }\n return { buffer, size, count };\n}\n// Convert non-typed arrays to arrays of specified format\nfunction toTypedArray(array, ArrayType, convertTypedArrays = false) {\n if (!array) {\n return null;\n }\n if (Array.isArray(array)) {\n return new ArrayType(array);\n }\n if (convertTypedArrays && !(array instanceof ArrayType)) {\n return new ArrayType(array);\n }\n return array;\n}\n", "/**\n * https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_transform/README.md\n */\nimport { Vector3, Matrix3 } from '@math.gl/core';\nimport { getAccessorArrayTypeAndLength } from \"../gltf-utils/gltf-utils.js\";\nimport { BYTES, COMPONENTS } from \"../gltf-utils/gltf-constants.js\";\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\n/** Extension name */\nconst KHR_TEXTURE_TRANSFORM = 'KHR_texture_transform';\nexport const name = KHR_TEXTURE_TRANSFORM;\nconst scratchVector = new Vector3();\nconst scratchRotationMatrix = new Matrix3();\nconst scratchScaleMatrix = new Matrix3();\n/**\n * The extension entry to process the transformation\n * @param gltfData gltf buffers and json\n * @param options GLTFLoader options\n */\nexport async function decode(gltfData, options) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const hasExtension = gltfScenegraph.hasExtension(KHR_TEXTURE_TRANSFORM);\n if (!hasExtension || !options.gltf?.loadBuffers) {\n return;\n }\n const materials = gltfData.json.materials || [];\n for (let i = 0; i < materials.length; i++) {\n transformTexCoords(i, gltfData);\n }\n}\n/**\n * Transform TEXCOORD by material\n * @param materialIndex processing material index\n * @param gltfData gltf buffers and json\n */\nfunction transformTexCoords(materialIndex, gltfData) {\n const material = gltfData.json.materials?.[materialIndex];\n const materialTextures = [\n material?.pbrMetallicRoughness?.baseColorTexture,\n material?.emissiveTexture,\n material?.normalTexture,\n material?.occlusionTexture,\n material?.pbrMetallicRoughness?.metallicRoughnessTexture\n ];\n // Save processed texCoords in order no to process the same twice\n const processedTexCoords = [];\n for (const textureInfo of materialTextures) {\n if (textureInfo && textureInfo?.extensions?.[KHR_TEXTURE_TRANSFORM]) {\n transformPrimitives(gltfData, materialIndex, textureInfo, processedTexCoords);\n }\n }\n}\n/**\n * Transform primitives of the particular material\n * @param gltfData gltf data\n * @param materialIndex primitives with this material will be transformed\n * @param texture texture object\n * @param processedTexCoords storage to save already processed texCoords\n */\nfunction transformPrimitives(gltfData, materialIndex, texture, processedTexCoords) {\n const transformParameters = getTransformParameters(texture, processedTexCoords);\n if (!transformParameters) {\n return;\n }\n const meshes = gltfData.json.meshes || [];\n for (const mesh of meshes) {\n for (const primitive of mesh.primitives) {\n const material = primitive.material;\n if (Number.isFinite(material) && materialIndex === material) {\n transformPrimitive(gltfData, primitive, transformParameters);\n }\n }\n }\n}\n/**\n * Get parameters for TEXCOORD transformation\n * @param texture texture object\n * @param processedTexCoords storage to save already processed texCoords\n * @returns texCoord couple and transformation matrix\n */\nfunction getTransformParameters(texture, processedTexCoords) {\n const textureInfo = texture.extensions?.[KHR_TEXTURE_TRANSFORM];\n const { texCoord: originalTexCoord = 0 } = texture;\n // If texCoord is not set in the extension, original attribute data will be replaced\n const { texCoord = originalTexCoord } = textureInfo;\n // Make sure that couple [originalTexCoord, extensionTexCoord] is not processed twice\n const isProcessed = processedTexCoords.findIndex(([original, newTexCoord]) => original === originalTexCoord && newTexCoord === texCoord) !== -1;\n if (!isProcessed) {\n const matrix = makeTransformationMatrix(textureInfo);\n if (originalTexCoord !== texCoord) {\n texture.texCoord = texCoord;\n }\n processedTexCoords.push([originalTexCoord, texCoord]);\n return { originalTexCoord, texCoord, matrix };\n }\n return null;\n}\n/**\n * Transform `TEXCOORD_0` attribute in the primitive\n * @param gltfData gltf data\n * @param primitive primitive object\n * @param transformParameters texCoord couple and transformation matrix\n */\nfunction transformPrimitive(gltfData, primitive, transformParameters) {\n const { originalTexCoord, texCoord, matrix } = transformParameters;\n const texCoordAccessor = primitive.attributes[`TEXCOORD_${originalTexCoord}`];\n if (Number.isFinite(texCoordAccessor)) {\n // Get accessor of the `TEXCOORD_0` attribute\n const accessor = gltfData.json.accessors?.[texCoordAccessor];\n if (accessor && accessor.bufferView) {\n // Get `bufferView` of the `accessor`\n const bufferView = gltfData.json.bufferViews?.[accessor.bufferView];\n if (bufferView) {\n // Get `arrayBuffer` the `bufferView` look at\n const { arrayBuffer, byteOffset: bufferByteOffset } = gltfData.buffers[bufferView.buffer];\n // Resulting byteOffset is sum of the buffer, accessor and bufferView byte offsets\n const byteOffset = (bufferByteOffset || 0) + (accessor.byteOffset || 0) + (bufferView.byteOffset || 0);\n // Deduce TypedArray type and its length from `accessor` and `bufferView` data\n const { ArrayType, length } = getAccessorArrayTypeAndLength(accessor, bufferView);\n // Number of bytes each component occupies\n const bytes = BYTES[accessor.componentType];\n // Number of components. For the `TEXCOORD_0` with `VEC2` type, it must return 2\n const components = COMPONENTS[accessor.type];\n // Multiplier to calculate the address of the `TEXCOORD_0` element in the arrayBuffer\n const elementAddressScale = bufferView.byteStride || bytes * components;\n // Data transform to Float32Array\n const result = new Float32Array(length);\n for (let i = 0; i < accessor.count; i++) {\n // Take [u, v] couple from the arrayBuffer\n const uv = new ArrayType(arrayBuffer, byteOffset + i * elementAddressScale, 2);\n // Set and transform Vector3 per https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#overview\n scratchVector.set(uv[0], uv[1], 1);\n scratchVector.transformByMatrix3(matrix);\n // Save result in Float32Array\n result.set([scratchVector[0], scratchVector[1]], i * components);\n }\n // If texCoord the same, replace gltf structural data\n if (originalTexCoord === texCoord) {\n updateGltf(accessor, bufferView, gltfData.buffers, result);\n }\n else {\n // If texCoord change, create new attribute\n createAttribute(texCoord, accessor, primitive, gltfData, result);\n }\n }\n }\n }\n}\n/**\n * Update GLTF structural objects with new data as we create new `Float32Array` for `TEXCOORD_0`.\n * @param accessor accessor to change\n * @param bufferView bufferView to change\n * @param buffers binary buffers\n * @param newTexcoordArray typed array with data after transformation\n */\nfunction updateGltf(accessor, bufferView, buffers, newTexCoordArray) {\n accessor.componentType = 5126;\n buffers.push({\n arrayBuffer: newTexCoordArray.buffer,\n byteOffset: 0,\n byteLength: newTexCoordArray.buffer.byteLength\n });\n bufferView.buffer = buffers.length - 1;\n bufferView.byteLength = newTexCoordArray.buffer.byteLength;\n bufferView.byteOffset = 0;\n delete bufferView.byteStride;\n}\n/**\n *\n * @param newTexCoord new `texCoord` value\n * @param originalAccessor original accessor object, that store data before transformation\n * @param primitive primitive object\n * @param gltfData gltf data\n * @param newTexCoordArray typed array with data after transformation\n * @returns\n */\nfunction createAttribute(newTexCoord, originalAccessor, primitive, gltfData, newTexCoordArray) {\n gltfData.buffers.push({\n arrayBuffer: newTexCoordArray.buffer,\n byteOffset: 0,\n byteLength: newTexCoordArray.buffer.byteLength\n });\n const bufferViews = gltfData.json.bufferViews;\n if (!bufferViews) {\n return;\n }\n bufferViews.push({\n buffer: gltfData.buffers.length - 1,\n byteLength: newTexCoordArray.buffer.byteLength,\n byteOffset: 0\n });\n const accessors = gltfData.json.accessors;\n if (!accessors) {\n return;\n }\n accessors.push({\n bufferView: bufferViews?.length - 1,\n byteOffset: 0,\n componentType: 5126,\n count: originalAccessor.count,\n type: 'VEC2'\n });\n primitive.attributes[`TEXCOORD_${newTexCoord}`] = accessors.length - 1;\n}\n/**\n * Construct transformation matrix from the extension data (transition, rotation, scale)\n * @param extensionData extension data\n * @returns transformation matrix\n */\nfunction makeTransformationMatrix(extensionData) {\n const { offset = [0, 0], rotation = 0, scale = [1, 1] } = extensionData;\n const translationMatrix = new Matrix3().set(1, 0, 0, 0, 1, 0, offset[0], offset[1], 1);\n const rotationMatrix = scratchRotationMatrix.set(Math.cos(rotation), Math.sin(rotation), 0, -Math.sin(rotation), Math.cos(rotation), 0, 0, 0, 1);\n const scaleMatrix = scratchScaleMatrix.set(scale[0], 0, 0, 0, scale[1], 0, 0, 0, 1);\n return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);\n}\n", "// GLTF EXTENSION: KHR_lights_punctual\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\nimport { assert } from \"../../utils/assert.js\";\nimport { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nconst KHR_LIGHTS_PUNCTUAL = 'KHR_lights_punctual';\nexport const name = KHR_LIGHTS_PUNCTUAL;\nexport async function decode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Move the light array out of the extension and remove the extension\n const extension = gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);\n if (extension) {\n // @ts-ignore\n gltfScenegraph.json.lights = extension.lights;\n gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);\n }\n // Any nodes that have the extension, add lights field pointing to light object\n // and remove the extension\n for (const node of json.nodes || []) {\n const nodeExtension = gltfScenegraph.getObjectExtension(node, KHR_LIGHTS_PUNCTUAL);\n if (nodeExtension) {\n // @ts-ignore\n node.light = nodeExtension.light;\n }\n gltfScenegraph.removeObjectExtension(node, KHR_LIGHTS_PUNCTUAL);\n }\n}\n// Move the light ar ray out of the extension and remove the extension\nexport async function encode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // @ts-ignore\n if (json.lights) {\n const extension = gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);\n // @ts-ignore\n assert(!extension.lights);\n // @ts-ignore\n extension.lights = json.lights;\n // @ts-ignore\n delete json.lights;\n }\n // Any nodes that have lights field pointing to light object\n // add the extension\n // @ts-ignore\n if (gltfScenegraph.json.lights) {\n // @ts-ignore\n for (const light of gltfScenegraph.json.lights) {\n const node = light.node;\n gltfScenegraph.addObjectExtension(node, KHR_LIGHTS_PUNCTUAL, light);\n }\n // @ts-ignore\n delete gltfScenegraph.json.lights;\n }\n}\n", "// GLTF EXTENSION: KHR_materials_unlit\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\nimport { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nconst KHR_MATERIALS_UNLIT = 'KHR_materials_unlit';\nexport const name = KHR_MATERIALS_UNLIT;\nexport async function decode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Any nodes that have the extension, add lights field pointing to light object\n // and remove the extension\n for (const material of json.materials || []) {\n const extension = material.extensions && material.extensions.KHR_materials_unlit;\n if (extension) {\n // @ts-ignore TODO\n material.unlit = true;\n }\n gltfScenegraph.removeObjectExtension(material, KHR_MATERIALS_UNLIT);\n }\n // Remove the top-level extension\n gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);\n}\nexport function encode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Any nodes that have lights field pointing to light object\n // add the extension\n // @ts-ignore\n if (gltfScenegraph.materials) {\n for (const material of json.materials || []) {\n // @ts-ignore\n if (material.unlit) {\n // @ts-ignore\n delete material.unlit;\n gltfScenegraph.addObjectExtension(material, KHR_MATERIALS_UNLIT, {});\n gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);\n }\n }\n }\n}\n", "// GLTF EXTENSION: KHR_techniques_webgl\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_techniques_webgl\nimport { GLTFScenegraph } from \"../../api/gltf-scenegraph.js\";\nconst KHR_TECHNIQUES_WEBGL = 'KHR_techniques_webgl';\nexport const name = KHR_TECHNIQUES_WEBGL;\nexport async function decode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n const extension = gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);\n if (extension) {\n const techniques = resolveTechniques(extension, gltfScenegraph);\n for (const material of json.materials || []) {\n const materialExtension = gltfScenegraph.getObjectExtension(material, KHR_TECHNIQUES_WEBGL);\n if (materialExtension) {\n // @ts-ignore TODO\n material.technique = Object.assign({}, materialExtension, \n // @ts-ignore\n techniques[materialExtension.technique]);\n // @ts-ignore TODO\n material.technique.values = resolveValues(material.technique, gltfScenegraph);\n }\n gltfScenegraph.removeObjectExtension(material, KHR_TECHNIQUES_WEBGL);\n }\n // Remove the top-level extension\n gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);\n }\n}\n// eslint-disable-next-line\nexport async function encode(gltfData, options) {\n // TODO\n}\nfunction resolveTechniques(techniquesExtension, \n// programs: {[key: string]: any}[],\n// shaders: {[key: string]: any}[],\n// techniques: {[key: string]: any}[]\ngltfScenegraph) {\n const { programs = [], shaders = [], techniques = [] } = techniquesExtension;\n const textDecoder = new TextDecoder();\n shaders.forEach((shader) => {\n if (Number.isFinite(shader.bufferView)) {\n shader.code = textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));\n }\n else {\n // TODO: handle URI shader\n throw new Error('KHR_techniques_webgl: no shader code');\n }\n });\n programs.forEach((program) => {\n program.fragmentShader = shaders[program.fragmentShader];\n program.vertexShader = shaders[program.vertexShader];\n });\n techniques.forEach((technique) => {\n technique.program = programs[technique.program];\n });\n return techniques;\n}\nfunction resolveValues(technique, gltfScenegraph) {\n const values = Object.assign({}, technique.values);\n // merge values from uniforms\n Object.keys(technique.uniforms || {}).forEach((uniform) => {\n if (technique.uniforms[uniform].value && !(uniform in values)) {\n values[uniform] = technique.uniforms[uniform].value;\n }\n });\n // resolve textures\n Object.keys(values).forEach((uniform) => {\n if (typeof values[uniform] === 'object' && values[uniform].index !== undefined) {\n // Assume this is a texture\n // TODO: find if there are any other types that can be referenced\n values[uniform].texture = gltfScenegraph.getTexture(values[uniform].index);\n }\n });\n return values;\n}\n", "// GLTF 1.0 extensions (decode only)\n// import * as KHR_binary_gltf from './KHR_draco_mesh_compression';\n// GLTF 2.0 Vendor extensions\nimport * as EXT_mesh_features from \"../extensions/EXT_mesh_features.js\";\nimport * as EXT_structural_metadata from \"../extensions/EXT_structural_metadata.js\";\n// GLTF 2.0 Khronos extensions (decode/encode)\nimport * as EXT_meshopt_compression from \"../extensions/EXT_meshopt_compression.js\";\nimport * as EXT_texture_webp from \"../extensions/EXT_texture_webp.js\";\nimport * as KHR_texture_basisu from \"../extensions/KHR_texture_basisu.js\";\nimport * as KHR_draco_mesh_compression from \"../extensions/KHR_draco_mesh_compression.js\";\nimport * as KHR_texture_transform from \"../extensions/KHR_texture_transform.js\";\n// Deprecated. These should be handled by rendering library (e.g. luma.gl), not the loader.\nimport * as KHR_lights_punctual from \"../extensions/deprecated/KHR_lights_punctual.js\";\nimport * as KHR_materials_unlit from \"../extensions/deprecated/KHR_materials_unlit.js\";\nimport * as KHR_techniques_webgl from \"../extensions/deprecated/KHR_techniques_webgl.js\";\nimport * as EXT_feature_metadata from \"../extensions/deprecated/EXT_feature_metadata.js\";\n/**\n * List of extensions processed by the GLTFLoader\n * Note that may extensions can only be handled on the rendering stage and are left out here\n * These are just extensions that can be handled fully or partially during loading.\n */\nexport const EXTENSIONS = [\n // 1.0\n // KHR_binary_gltf is handled separately - must be processed before other parsing starts\n // KHR_binary_gltf,\n // 2.0\n EXT_structural_metadata,\n EXT_mesh_features,\n EXT_meshopt_compression,\n EXT_texture_webp,\n // Basisu should come after webp, we want basisu to be preferred if both are provided\n KHR_texture_basisu,\n KHR_draco_mesh_compression,\n KHR_lights_punctual,\n KHR_materials_unlit,\n KHR_techniques_webgl,\n KHR_texture_transform,\n EXT_feature_metadata\n];\n/**\n * List of extensions processed by the GLTFWriter\n */\nconst EXTENSIONS_ENCODING = [EXT_structural_metadata, EXT_mesh_features];\n/** Call before any resource loading starts */\nexport function preprocessExtensions(gltf, options = {}, context) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n extension.preprocess?.(gltf, options, context);\n }\n}\n/** Call after resource loading */\nexport async function decodeExtensions(gltf, options = {}, context) {\n const extensions = EXTENSIONS.filter((extension) => useExtension(extension.name, options));\n for (const extension of extensions) {\n // Note: We decode async extensions sequentially, this might not be necessary\n // Currently we only have Draco, but when we add Basis we may revisit\n await extension.decode?.(gltf, options, context);\n }\n}\n/** Call before resource writing */\nexport function encodeExtensions(gltf, options = {}) {\n for (const extension of EXTENSIONS_ENCODING) {\n gltf = extension.encode?.(gltf, options) ?? gltf;\n }\n return gltf;\n}\nfunction useExtension(extensionName, options) {\n const excludes = options?.gltf?.excludeExtensions || {};\n const exclude = extensionName in excludes && !excludes[extensionName];\n return !exclude;\n}\n", "// GLTF 1.0 EXTENSION: KHR_binary_glTF\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\n/* eslint-disable camelcase */\nimport { GLTFScenegraph } from \"../api/gltf-scenegraph.js\";\nconst KHR_BINARY_GLTF = 'KHR_binary_glTF';\n/** Extension name */\nexport const name = KHR_BINARY_GLTF;\nexport function preprocess(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const { json } = gltfScenegraph;\n // Note: json.buffers.binary_glTF also needs to be replaced\n // This is currently done during gltf normalization\n // Image and shader nodes can have the extension\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/1.0/Khronos/KHR_binary_glTF/schema/image.KHR_binary_glTF.schema.json\n for (const image of json.images || []) {\n const extension = gltfScenegraph.getObjectExtension(image, KHR_BINARY_GLTF);\n // The data in the extension is valid as glTF 2.0 data inside the object, so just copy it in\n if (extension) {\n Object.assign(image, extension);\n }\n gltfScenegraph.removeObjectExtension(image, KHR_BINARY_GLTF);\n }\n // TODO shaders - At least traverse and throw error if used?\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/1.0/Khronos/KHR_binary_glTF/schema/shader.KHR_binary_glTF.schema.json\n // glTF v1 one files have a partially formed URI field that is not expected in (and causes problems in) 2.0\n if (json.buffers && json.buffers[0]) {\n delete json.buffers[0].uri;\n }\n // Remove the top-level extension as it has now been processed\n gltfScenegraph.removeExtension(KHR_BINARY_GLTF);\n}\n// KHR_binary_gltf is a 1.0 extension that is supported natively by 2.0\n// export function encode() {\n// throw new Error(KHR_BINARY_GLTF);\n// }\n", "/* eslint-disable camelcase */\nimport * as KHR_binary_glTF from \"../extensions/KHR_binary_gltf.js\";\n// Binary format changes (mainly implemented by GLBLoader)\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\n// JSON format changes:\n// https://github.com/khronosgroup/gltf/issues/605\n// - [x] Top-level JSON objects are arrays now\n// - [ ] Removed indirection from animation: sampler now refers directly to accessors, #712\n// - [ ] material.parameter.value and technique.parameter.value must be an array, #690\n// - [ ] Node can have only one mesh #821\n// - [ ] Added reqs on JSON encoding\n// - [ ] Added reqs on binary data alignment #802 (comment)\n// Additions:\n// - [ ] Added accessor.normalized, #691, #706\n// - [ ] Added glExtensionsUsed property and 5125 (UNSIGNED_INT) accessor.componentType value, #619\n// - [ ] Added extensionsRequired property, #720, #721\n// - [ ] Added \"STEP\" as valid animation.sampler.interpolation value, #712\n// Removals:\n// - [x] Removed buffer.type, #786, #629\n// - [ ] Removed revision number from profile.version, #709\n// - [ ] Removed technique.functions.scissor and removed 3089 (SCISSOR_TEST) as a valid value for technique.states.enable, #681\n// - [ ] Techniques, programs, and shaders were moved out to KHR_technique_webgl extension.\n// Other edits:\n// - [x] asset is now required, #642\n// - [ ] buffer.byteLength and bufferView.byteLength are now required, #560.\n// - [ ] accessor.min and accessor.max are now required, #593, and clarified that the JSON value and binary data must be the same, #628.\n// - [ ] Clarified animation.sampler and animation.channel restrictions, #712\n// - [ ] skin.inverseBindMatrices is now optional, #461.\n// - [ ] Attribute parameters can't have a value defined in the technique or parameter, #563 (comment).\n// - [ ] Only TEXCOORD and COLOR attribute semantics can be written in the form [semantic]_[set_index], #563 (comment).\n// - [ ] TEXCOORD and COLOR attribute semantics must be written in the form [semantic]_[set_index], e.g., just TEXCOORD should be TEXCOORD_0, and just COLOR should be COLOR_0, #649\n// - [ ] camera.perspective.aspectRatio and camera.perspective.yfov must now be > 0, not >= 0, #563 (comment).\n// - [ ] Application-specific parameter semantics must start with an underscore, e.g., _TEMPERATURE and _SIMULATION_TIME, #563 (comment).\n// - [ ] Properties in technique.parameters must be defined in technique.uniforms or technique.attributes,\n// #563 (comment).\n// - [ ] technique.parameter.count can only be defined when the semantic is JOINTMATRIX or an application-specific semantic is used. It can never be defined for attribute parameters; only uniforms, d2f6945\n// - [ ] technique.parameter.semantic is required when the parameter is an attribute, 28e113d\n// - [ ] Mesh-only models are allowed, e.g., without materials, #642\n// - [ ] Skeleton hierarchies (nodes containing jointName) must be separated from non-skeleton hierarchies., #647\n// - [ ] technique.states.functions.blendColor and technique.states.functions.depthRange parameters now must match WebGL function min/max, #707\nconst GLTF_ARRAYS = {\n accessors: 'accessor',\n animations: 'animation',\n buffers: 'buffer',\n bufferViews: 'bufferView',\n images: 'image',\n materials: 'material',\n meshes: 'mesh',\n nodes: 'node',\n samplers: 'sampler',\n scenes: 'scene',\n skins: 'skin',\n textures: 'texture'\n};\nconst GLTF_KEYS = {\n accessor: 'accessors',\n animations: 'animation',\n buffer: 'buffers',\n bufferView: 'bufferViews',\n image: 'images',\n material: 'materials',\n mesh: 'meshes',\n node: 'nodes',\n sampler: 'samplers',\n scene: 'scenes',\n skin: 'skins',\n texture: 'textures'\n};\n/**\n * Converts (normalizes) glTF v1 to v2\n */\nclass GLTFV1Normalizer {\n idToIndexMap = {\n animations: {},\n accessors: {},\n buffers: {},\n bufferViews: {},\n images: {},\n materials: {},\n meshes: {},\n nodes: {},\n samplers: {},\n scenes: {},\n skins: {},\n textures: {}\n };\n json;\n // constructor() {}\n /**\n * Convert (normalize) glTF < 2.0 to glTF 2.0\n * @param gltf - object with json and binChunks\n * @param options\n * @param options normalize Whether to actually normalize\n */\n normalize(gltf, options) {\n this.json = gltf.json;\n const json = gltf.json;\n // Check version\n switch (json.asset && json.asset.version) {\n // We are converting to v2 format. Return if there is nothing to do\n case '2.0':\n return;\n // This class is written to convert 1.0\n case undefined:\n case '1.0':\n break;\n default:\n // eslint-disable-next-line no-undef, no-console\n console.warn(`glTF: Unknown version ${json.asset.version}`);\n return;\n }\n if (!options.normalize) {\n // We are still missing a few conversion tricks, remove once addressed\n throw new Error('glTF v1 is not supported.');\n }\n // eslint-disable-next-line no-undef, no-console\n console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');\n this._addAsset(json);\n // In glTF2 top-level fields are Arrays not Object maps\n this._convertTopLevelObjectsToArrays(json);\n // Extract bufferView indices for images\n // (this extension needs to be invoked early in the normalization process)\n // TODO can this be handled by standard extension processing instead of called explicitly?\n KHR_binary_glTF.preprocess(gltf);\n // Convert object references from ids to indices\n this._convertObjectIdsToArrayIndices(json);\n this._updateObjects(json);\n this._updateMaterial(json);\n }\n // asset is now required, #642 https://github.com/KhronosGroup/glTF/issues/639\n _addAsset(json) {\n json.asset = json.asset || {};\n // We are normalizing to glTF v2, so change version to \"2.0\"\n json.asset.version = '2.0';\n json.asset.generator = json.asset.generator || 'Normalized to glTF 2.0 by loaders.gl';\n }\n _convertTopLevelObjectsToArrays(json) {\n // TODO check that all arrays are covered\n for (const arrayName in GLTF_ARRAYS) {\n this._convertTopLevelObjectToArray(json, arrayName);\n }\n }\n /** Convert one top level object to array */\n _convertTopLevelObjectToArray(json, mapName) {\n const objectMap = json[mapName];\n if (!objectMap || Array.isArray(objectMap)) {\n return;\n }\n // Rewrite the top-level field as an array\n json[mapName] = [];\n // Copy the map key into object.id\n for (const id in objectMap) {\n const object = objectMap[id];\n object.id = object.id || id; // Mutates the loaded object\n const index = json[mapName].length;\n json[mapName].push(object);\n this.idToIndexMap[mapName][id] = index;\n }\n }\n /** Go through all objects in all top-level arrays and replace ids with indices */\n _convertObjectIdsToArrayIndices(json) {\n for (const arrayName in GLTF_ARRAYS) {\n this._convertIdsToIndices(json, arrayName);\n }\n if ('scene' in json) {\n json.scene = this._convertIdToIndex(json.scene, 'scene');\n }\n // Convert any index references that are not using array names\n // texture.source (image)\n for (const texture of json.textures) {\n this._convertTextureIds(texture);\n }\n for (const mesh of json.meshes) {\n this._convertMeshIds(mesh);\n }\n for (const node of json.nodes) {\n this._convertNodeIds(node);\n }\n for (const node of json.scenes) {\n this._convertSceneIds(node);\n }\n }\n _convertTextureIds(texture) {\n if (texture.source) {\n texture.source = this._convertIdToIndex(texture.source, 'image');\n }\n }\n _convertMeshIds(mesh) {\n for (const primitive of mesh.primitives) {\n const { attributes, indices, material } = primitive;\n for (const attributeName in attributes) {\n attributes[attributeName] = this._convertIdToIndex(attributes[attributeName], 'accessor');\n }\n if (indices) {\n primitive.indices = this._convertIdToIndex(indices, 'accessor');\n }\n if (material) {\n primitive.material = this._convertIdToIndex(material, 'material');\n }\n }\n }\n _convertNodeIds(node) {\n if (node.children) {\n node.children = node.children.map((child) => this._convertIdToIndex(child, 'node'));\n }\n if (node.meshes) {\n node.meshes = node.meshes.map((mesh) => this._convertIdToIndex(mesh, 'mesh'));\n }\n }\n _convertSceneIds(scene) {\n if (scene.nodes) {\n scene.nodes = scene.nodes.map((node) => this._convertIdToIndex(node, 'node'));\n }\n }\n /** Go through all objects in a top-level array and replace ids with indices */\n _convertIdsToIndices(json, topLevelArrayName) {\n if (!json[topLevelArrayName]) {\n console.warn(`gltf v1: json doesn't contain attribute ${topLevelArrayName}`); // eslint-disable-line no-console, no-undef\n json[topLevelArrayName] = [];\n }\n for (const object of json[topLevelArrayName]) {\n for (const key in object) {\n const id = object[key];\n const index = this._convertIdToIndex(id, key);\n object[key] = index;\n }\n }\n }\n _convertIdToIndex(id, key) {\n const arrayName = GLTF_KEYS[key];\n if (arrayName in this.idToIndexMap) {\n const index = this.idToIndexMap[arrayName][id];\n if (!Number.isFinite(index)) {\n throw new Error(`gltf v1: failed to resolve ${key} with id ${id}`);\n }\n return index;\n }\n return id;\n }\n /**\n *\n * @param {*} json\n */\n _updateObjects(json) {\n for (const buffer of this.json.buffers) {\n // - [x] Removed buffer.type, #786, #629\n delete buffer.type;\n }\n }\n /**\n * Update material (set pbrMetallicRoughness)\n * @param {*} json\n */\n _updateMaterial(json) {\n for (const material of json.materials) {\n material.pbrMetallicRoughness = {\n baseColorFactor: [1, 1, 1, 1],\n metallicFactor: 1,\n roughnessFactor: 1\n };\n const textureId = material.values?.tex || material.values?.texture2d_0 || material.values?.diffuseTex;\n const textureIndex = json.textures.findIndex((texture) => texture.id === textureId);\n if (textureIndex !== -1) {\n material.pbrMetallicRoughness.baseColorTexture = { index: textureIndex };\n }\n }\n }\n}\nexport function normalizeGLTFV1(gltf, options = {}) {\n return new GLTFV1Normalizer().normalize(gltf, options);\n}\n", "import { VERSION } from \"./lib/utils/version.js\";\nimport { parseGLTF } from \"./lib/parsers/parse-gltf.js\";\n/**\n * GLTF loader\n */\nexport const GLTFLoader = {\n dataType: null,\n batchType: null,\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n extensions: ['gltf', 'glb'],\n mimeTypes: ['model/gltf+json', 'model/gltf-binary'],\n text: true,\n binary: true,\n tests: ['glTF'],\n parse,\n options: {\n gltf: {\n normalize: true, // Normalize glTF v1 to glTF v2 format (not yet stable)\n loadBuffers: true, // Fetch any linked .BIN buffers, decode base64\n loadImages: true, // Create image objects\n decompressMeshes: true // Decompress Draco encoded meshes\n },\n // common?\n log: console // eslint-disable-line\n }\n};\nexport async function parse(arrayBuffer, options = {}, context) {\n // Apps can call the parse method directly, we so apply default options here\n options = { ...GLTFLoader.options, ...options };\n // @ts-ignore\n options.gltf = { ...GLTFLoader.options.gltf, ...options.gltf };\n const { byteOffset = 0 } = options;\n const gltf = {};\n return await parseGLTF(gltf, arrayBuffer, byteOffset, options, context);\n}\n", "/* eslint-disable camelcase, max-statements */\nimport { copyPaddedStringToDataView, copyPaddedArrayBufferToDataView } from '@loaders.gl/loader-utils';\n// import type {GLB} from '../types/glb-types';\nconst MAGIC_glTF = 0x46546c67; // glTF in ASCII\nconst MAGIC_JSON = 0x4e4f534a; // JSON in ASCII\nconst MAGIC_BIN = 0x004e4942; // BIN\\0 in ASCII\nconst LE = true; // Binary GLTF is little endian.\n/**\n * Encode the full GLB buffer with header etc\n *\n * @param glb\n * @param dataView - if `null`, does not encode but just calculates length\n * @param byteOffset\n * @param options\n * @returns\n *\n * @see https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#glb-file-format-specification\n * @todo type GLB argument\n */\nexport function encodeGLBSync(glb, dataView, byteOffset = 0, options = {}) {\n const { magic = MAGIC_glTF, version = 2, json = {}, binary } = glb;\n const byteOffsetStart = byteOffset;\n // Write GLB Header\n if (dataView) {\n dataView.setUint32(byteOffset + 0, magic, LE); // Magic number (the ASCII string 'glTF').\n dataView.setUint32(byteOffset + 4, version, LE); // Version 2 of binary glTF container format uint32\n dataView.setUint32(byteOffset + 8, 0, LE); // Total byte length of generated file (uint32), will be set last\n }\n const byteOffsetFileLength = byteOffset + 8;\n byteOffset += 12; // GLB_FILE_HEADER_SIZE\n // Write the JSON chunk header\n const byteOffsetJsonHeader = byteOffset;\n if (dataView) {\n dataView.setUint32(byteOffset + 0, 0, LE); // Byte length of json chunk (will be written later)\n dataView.setUint32(byteOffset + 4, MAGIC_JSON, LE); // Chunk type\n }\n byteOffset += 8; // GLB_CHUNK_HEADER_SIZE\n // Write the JSON chunk\n const jsonString = JSON.stringify(json);\n byteOffset = copyPaddedStringToDataView(dataView, byteOffset, jsonString, 4);\n // Now we know the JSON chunk length so we can write it.\n if (dataView) {\n const jsonByteLength = byteOffset - byteOffsetJsonHeader - 8; // GLB_CHUNK_HEADER_SIZE\n dataView.setUint32(byteOffsetJsonHeader + 0, jsonByteLength, LE); // Byte length of json chunk (uint32)\n }\n // Write the BIN chunk if present. The BIN chunk is optional.\n if (binary) {\n const byteOffsetBinHeader = byteOffset;\n // Write the BIN chunk header\n if (dataView) {\n dataView.setUint32(byteOffset + 0, 0, LE); // Byte length BIN (uint32)\n dataView.setUint32(byteOffset + 4, MAGIC_BIN, LE); // Chunk type\n }\n byteOffset += 8; // GLB_CHUNK_HEADER_SIZE\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, binary, 4);\n // Now we know the BIN chunk length so we can write it.\n if (dataView) {\n const binByteLength = byteOffset - byteOffsetBinHeader - 8; // GLB_CHUNK_HEADER_SIZE\n dataView.setUint32(byteOffsetBinHeader + 0, binByteLength, LE); // Byte length BIN (uint32)\n }\n }\n // Now we know the glb file length so we can write it.\n if (dataView) {\n const fileByteLength = byteOffset - byteOffsetStart;\n dataView.setUint32(byteOffsetFileLength, fileByteLength, LE); // Total byte length of generated file (uint32)\n }\n return byteOffset;\n}\n", "import { encodeGLBSync } from \"./encode-glb.js\";\n/**\n * Encode the full glTF file as a binary GLB file\n * Returns an ArrayBuffer that represents the complete GLB image that can be saved to file\n *\n * @todo - Does not support encoding to non-GLB versions of glTF format. Other formats\n * - Encode as a textual JSON file with binary data in base64 data URLs.\n * - Encode as a JSON with all images (and buffers?) in separate binary files\n *\n * glb-file-format-specification\n * @see https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#\n *\n * @param gltf\n * @param arrayBuffer\n * @param byteOffset\n * @param options\n * @returns\n */\nexport function encodeGLTFSync(gltf, arrayBuffer, byteOffset, options) {\n validateGltf(gltf);\n // TODO: Copy buffers to binary\n return encodeGLBSync(gltf, arrayBuffer, byteOffset, options);\n}\nfunction validateGltf(gltf) {\n if (gltf.buffers && gltf.buffers.length > 1) {\n throw new Error('encodeGLTF: multiple buffers not yet implemented');\n }\n}\n", "import { VERSION } from \"./lib/utils/version.js\";\nimport { encodeGLTFSync } from \"./lib/encoders/encode-gltf.js\";\nimport { encodeExtensions } from \"./lib/api/gltf-extensions.js\";\n/**\n * GLTF exporter\n */\nexport const GLTFWriter = {\n dataType: null,\n batchType: null,\n name: 'glTF',\n id: 'gltf',\n module: 'gltf',\n version: VERSION,\n extensions: ['glb'], // We only support encoding to binary GLB, not to JSON GLTF\n mimeTypes: ['model/gltf-binary'], // 'model/gltf+json',\n binary: true,\n options: {\n gltf: {}\n },\n encode: async (gltf, options = {}) => encodeSync(gltf, options),\n encodeSync\n};\nfunction encodeSync(gltf, options = {}) {\n const { byteOffset = 0 } = options;\n const gltfToEncode = encodeExtensions(gltf);\n // Calculate length, then create arraybuffer and encode\n const byteLength = encodeGLTFSync(gltfToEncode, null, byteOffset, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n const dataView = new DataView(arrayBuffer);\n encodeGLTFSync(gltfToEncode, dataView, byteOffset, options);\n return arrayBuffer;\n}\n", "import { VERSION } from \"./lib/utils/version.js\";\nimport { parseGLBSync } from \"./lib/parsers/parse-glb.js\";\n/**\n * GLB Loader -\n * GLB is the binary container format for GLTF\n */\nexport const GLBLoader = {\n dataType: null,\n batchType: null,\n name: 'GLB',\n id: 'glb',\n module: 'gltf',\n version: VERSION,\n extensions: ['glb'],\n mimeTypes: ['model/gltf-binary'],\n binary: true,\n parse,\n parseSync,\n options: {\n glb: {\n strict: false // Enables deprecated XVIZ support (illegal CHUNK formats)\n }\n }\n};\nasync function parse(arrayBuffer, options) {\n return parseSync(arrayBuffer, options);\n}\nfunction parseSync(arrayBuffer, options) {\n const { byteOffset = 0 } = options || {};\n const glb = {};\n parseGLBSync(glb, arrayBuffer, byteOffset, options?.glb);\n return glb;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { encodeGLBSync } from \"./lib/encoders/encode-glb.js\";\nimport { VERSION } from \"./lib/utils/version.js\";\n/**\n * GLB exporter\n * GLB is the binary container format for GLTF\n */\nexport const GLBWriter = {\n name: 'GLB',\n id: 'glb',\n module: 'gltf',\n version: VERSION,\n extensions: ['glb'],\n mimeTypes: ['model/gltf-binary'],\n binary: true,\n options: {\n glb: {}\n },\n encode: async (glb, options = {}) => encodeSync(glb, options),\n encodeSync\n};\nfunction encodeSync(glb, options) {\n const { byteOffset = 0 } = options ?? {};\n // Calculate length and allocate buffer\n const byteLength = encodeGLBSync(glb, null, byteOffset, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n // Encode into buffer\n const dataView = new DataView(arrayBuffer);\n encodeGLBSync(glb, dataView, byteOffset, options);\n return arrayBuffer;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { assert } from \"../utils/assert.js\";\nimport { getAccessorArrayTypeAndLength } from \"../gltf-utils/gltf-utils.js\";\n// This is a post processor for loaded glTF files\n// The goal is to make the loaded data easier to use in WebGL applications\n//\n// Functions:\n// * Resolve indexed arrays structure of glTF into a linked tree.\n// * Translate stringified enum keys and values into WebGL constants.\n// * Load images (optional)\n// ENUM LOOKUP\nconst COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nconst BYTES = {\n 5120: 1, // BYTE\n 5121: 1, // UNSIGNED_BYTE\n 5122: 2, // SHORT\n 5123: 2, // UNSIGNED_SHORT\n 5125: 4, // UNSIGNED_INT\n 5126: 4 // FLOAT\n};\nconst GL_SAMPLER = {\n // Sampler parameters\n TEXTURE_MAG_FILTER: 0x2800,\n TEXTURE_MIN_FILTER: 0x2801,\n TEXTURE_WRAP_S: 0x2802,\n TEXTURE_WRAP_T: 0x2803,\n // Sampler default values\n REPEAT: 0x2901,\n LINEAR: 0x2601,\n NEAREST_MIPMAP_LINEAR: 0x2702\n};\nconst SAMPLER_PARAMETER_GLTF_TO_GL = {\n magFilter: GL_SAMPLER.TEXTURE_MAG_FILTER,\n minFilter: GL_SAMPLER.TEXTURE_MIN_FILTER,\n wrapS: GL_SAMPLER.TEXTURE_WRAP_S,\n wrapT: GL_SAMPLER.TEXTURE_WRAP_T\n};\n// When undefined, a sampler with repeat wrapping and auto filtering should be used.\n// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture\nconst DEFAULT_SAMPLER_PARAMETERS = {\n [GL_SAMPLER.TEXTURE_MAG_FILTER]: GL_SAMPLER.LINEAR,\n [GL_SAMPLER.TEXTURE_MIN_FILTER]: GL_SAMPLER.NEAREST_MIPMAP_LINEAR,\n [GL_SAMPLER.TEXTURE_WRAP_S]: GL_SAMPLER.REPEAT,\n [GL_SAMPLER.TEXTURE_WRAP_T]: GL_SAMPLER.REPEAT\n};\nfunction makeDefaultSampler() {\n return {\n id: 'default-sampler',\n parameters: DEFAULT_SAMPLER_PARAMETERS\n };\n}\nfunction getBytesFromComponentType(componentType) {\n return BYTES[componentType];\n}\nfunction getSizeFromAccessorType(type) {\n return COMPONENTS[type];\n}\nclass GLTFPostProcessor {\n baseUri = '';\n // @ts-expect-error\n jsonUnprocessed;\n // @ts-expect-error\n json;\n buffers = [];\n images = [];\n postProcess(gltf, options = {}) {\n const { json, buffers = [], images = [] } = gltf;\n // @ts-expect-error\n const { baseUri = '' } = gltf;\n assert(json);\n this.baseUri = baseUri;\n this.buffers = buffers;\n this.images = images;\n this.jsonUnprocessed = json;\n this.json = this._resolveTree(gltf.json, options);\n return this.json;\n }\n // Convert indexed glTF structure into tree structure\n // cross-link index resolution, enum lookup, convenience calculations\n // eslint-disable-next-line complexity, max-statements\n _resolveTree(gltf, options = {}) {\n // @ts-expect-error\n const json = { ...gltf };\n this.json = json;\n if (gltf.bufferViews) {\n json.bufferViews = gltf.bufferViews.map((bufView, i) => this._resolveBufferView(bufView, i));\n }\n if (gltf.images) {\n json.images = gltf.images.map((image, i) => this._resolveImage(image, i));\n }\n if (gltf.samplers) {\n json.samplers = gltf.samplers.map((sampler, i) => this._resolveSampler(sampler, i));\n }\n if (gltf.textures) {\n json.textures = gltf.textures.map((texture, i) => this._resolveTexture(texture, i));\n }\n if (gltf.accessors) {\n json.accessors = gltf.accessors.map((accessor, i) => this._resolveAccessor(accessor, i));\n }\n if (gltf.materials) {\n json.materials = gltf.materials.map((material, i) => this._resolveMaterial(material, i));\n }\n if (gltf.meshes) {\n json.meshes = gltf.meshes.map((mesh, i) => this._resolveMesh(mesh, i));\n }\n if (gltf.nodes) {\n json.nodes = gltf.nodes.map((node, i) => this._resolveNode(node, i));\n json.nodes = json.nodes.map((node, i) => this._resolveNodeChildren(node));\n }\n if (gltf.skins) {\n json.skins = gltf.skins.map((skin, i) => this._resolveSkin(skin, i));\n }\n if (gltf.scenes) {\n json.scenes = gltf.scenes.map((scene, i) => this._resolveScene(scene, i));\n }\n if (typeof this.json.scene === 'number' && json.scenes) {\n json.scene = json.scenes[this.json.scene];\n }\n return json;\n }\n getScene(index) {\n return this._get(this.json.scenes, index);\n }\n getNode(index) {\n return this._get(this.json.nodes, index);\n }\n getSkin(index) {\n return this._get(this.json.skins, index);\n }\n getMesh(index) {\n return this._get(this.json.meshes, index);\n }\n getMaterial(index) {\n return this._get(this.json.materials, index);\n }\n getAccessor(index) {\n return this._get(this.json.accessors, index);\n }\n getCamera(index) {\n return this._get(this.json.cameras, index);\n }\n getTexture(index) {\n return this._get(this.json.textures, index);\n }\n getSampler(index) {\n return this._get(this.json.samplers, index);\n }\n getImage(index) {\n return this._get(this.json.images, index);\n }\n getBufferView(index) {\n return this._get(this.json.bufferViews, index);\n }\n getBuffer(index) {\n return this._get(this.json.buffers, index);\n }\n _get(array, index) {\n // check if already resolved\n if (typeof index === 'object') {\n return index;\n }\n const object = array && array[index];\n if (!object) {\n console.warn(`glTF file error: Could not find ${array}[${index}]`); // eslint-disable-line\n }\n return object;\n }\n // PARSING HELPERS\n _resolveScene(scene, index) {\n return {\n ...scene,\n // @ts-ignore\n id: scene.id || `scene-${index}`,\n nodes: (scene.nodes || []).map((node) => this.getNode(node))\n };\n }\n _resolveNode(gltfNode, index) {\n // @ts-expect-error\n const node = {\n ...gltfNode,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfNode?.id || `node-${index}`\n };\n if (gltfNode.mesh !== undefined) {\n node.mesh = this.getMesh(gltfNode.mesh);\n }\n if (gltfNode.camera !== undefined) {\n node.camera = this.getCamera(gltfNode.camera);\n }\n if (gltfNode.skin !== undefined) {\n node.skin = this.getSkin(gltfNode.skin);\n }\n // TODO deprecated - Delete in v4.0?\n // @ts-expect-error node.meshes does not seem to be part of the GLTF standard\n if (gltfNode.meshes !== undefined && gltfNode.meshes.length) {\n // @ts-expect-error\n node.mesh = gltfNode.meshes.reduce((accum, meshIndex) => {\n const mesh = this.getMesh(meshIndex);\n accum.id = mesh.id;\n accum.primitives = accum.primitives.concat(mesh.primitives);\n return accum;\n }, { primitives: [] });\n }\n return node;\n }\n _resolveNodeChildren(node) {\n if (node.children) {\n // @ts-expect-error node.children are numbers at this stage\n node.children = node.children.map((child) => this.getNode(child));\n }\n return node;\n }\n _resolveSkin(gltfSkin, index) {\n const inverseBindMatrices = typeof gltfSkin.inverseBindMatrices === 'number'\n ? this.getAccessor(gltfSkin.inverseBindMatrices)\n : undefined;\n return {\n ...gltfSkin,\n id: gltfSkin.id || `skin-${index}`,\n inverseBindMatrices\n };\n }\n _resolveMesh(gltfMesh, index) {\n const mesh = {\n ...gltfMesh,\n id: gltfMesh.id || `mesh-${index}`,\n primitives: []\n };\n if (gltfMesh.primitives) {\n mesh.primitives = gltfMesh.primitives.map((gltfPrimitive) => {\n const primitive = {\n ...gltfPrimitive,\n attributes: {},\n indices: undefined,\n material: undefined\n };\n const attributes = gltfPrimitive.attributes;\n for (const attribute in attributes) {\n primitive.attributes[attribute] = this.getAccessor(attributes[attribute]);\n }\n if (gltfPrimitive.indices !== undefined) {\n primitive.indices = this.getAccessor(gltfPrimitive.indices);\n }\n if (gltfPrimitive.material !== undefined) {\n primitive.material = this.getMaterial(gltfPrimitive.material);\n }\n return primitive;\n });\n }\n return mesh;\n }\n _resolveMaterial(gltfMaterial, index) {\n // @ts-expect-error\n const material = {\n ...gltfMaterial,\n // @ts-expect-error\n id: gltfMaterial.id || `material-${index}`\n };\n if (material.normalTexture) {\n material.normalTexture = { ...material.normalTexture };\n material.normalTexture.texture = this.getTexture(material.normalTexture.index);\n }\n if (material.occlusionTexture) {\n material.occlusionTexture = { ...material.occlusionTexture };\n material.occlusionTexture.texture = this.getTexture(material.occlusionTexture.index);\n }\n if (material.emissiveTexture) {\n material.emissiveTexture = { ...material.emissiveTexture };\n material.emissiveTexture.texture = this.getTexture(material.emissiveTexture.index);\n }\n if (!material.emissiveFactor) {\n material.emissiveFactor = material.emissiveTexture ? [1, 1, 1] : [0, 0, 0];\n }\n if (material.pbrMetallicRoughness) {\n material.pbrMetallicRoughness = { ...material.pbrMetallicRoughness };\n const mr = material.pbrMetallicRoughness;\n if (mr.baseColorTexture) {\n mr.baseColorTexture = { ...mr.baseColorTexture };\n mr.baseColorTexture.texture = this.getTexture(mr.baseColorTexture.index);\n }\n if (mr.metallicRoughnessTexture) {\n mr.metallicRoughnessTexture = { ...mr.metallicRoughnessTexture };\n mr.metallicRoughnessTexture.texture = this.getTexture(mr.metallicRoughnessTexture.index);\n }\n }\n return material;\n }\n _resolveAccessor(gltfAccessor, index) {\n // Look up enums\n const bytesPerComponent = getBytesFromComponentType(gltfAccessor.componentType);\n const components = getSizeFromAccessorType(gltfAccessor.type);\n const bytesPerElement = bytesPerComponent * components;\n const accessor = {\n ...gltfAccessor,\n // @ts-expect-error\n id: gltfAccessor.id || `accessor-${index}`,\n bytesPerComponent,\n components,\n bytesPerElement,\n value: undefined,\n bufferView: undefined,\n sparse: undefined\n };\n if (gltfAccessor.bufferView !== undefined) {\n // Draco encoded meshes don't have bufferView\n accessor.bufferView = this.getBufferView(gltfAccessor.bufferView);\n }\n // Create TypedArray for the accessor\n // Note: The canonical way to instantiate is to ignore this array and create\n // WebGLBuffer's using the bufferViews.\n if (accessor.bufferView) {\n const buffer = accessor.bufferView.buffer;\n const { ArrayType, byteLength } = getAccessorArrayTypeAndLength(accessor, accessor.bufferView);\n const byteOffset = (accessor.bufferView.byteOffset || 0) + (accessor.byteOffset || 0) + buffer.byteOffset;\n let cutBuffer = buffer.arrayBuffer.slice(byteOffset, byteOffset + byteLength);\n if (accessor.bufferView.byteStride) {\n cutBuffer = this._getValueFromInterleavedBuffer(buffer, byteOffset, accessor.bufferView.byteStride, accessor.bytesPerElement, accessor.count);\n }\n accessor.value = new ArrayType(cutBuffer);\n }\n return accessor;\n }\n /**\n * Take values of particular accessor from interleaved buffer\n * various parts of the buffer\n * @param buffer\n * @param byteOffset\n * @param byteStride\n * @param bytesPerElement\n * @param count\n * @returns\n */\n _getValueFromInterleavedBuffer(buffer, byteOffset, byteStride, bytesPerElement, count) {\n const result = new Uint8Array(count * bytesPerElement);\n for (let i = 0; i < count; i++) {\n const elementOffset = byteOffset + i * byteStride;\n result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset, elementOffset + bytesPerElement)), i * bytesPerElement);\n }\n return result.buffer;\n }\n _resolveTexture(gltfTexture, index) {\n return {\n ...gltfTexture,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfTexture.id || `texture-${index}`,\n sampler: typeof gltfTexture.sampler === 'number'\n ? this.getSampler(gltfTexture.sampler)\n : makeDefaultSampler(),\n source: typeof gltfTexture.source === 'number' ? this.getImage(gltfTexture.source) : undefined\n };\n }\n _resolveSampler(gltfSampler, index) {\n const sampler = {\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfSampler.id || `sampler-${index}`,\n ...gltfSampler,\n parameters: {}\n };\n // Map textual parameters to GL parameter values\n for (const key in sampler) {\n const glEnum = this._enumSamplerParameter(key);\n if (glEnum !== undefined) {\n sampler.parameters[glEnum] = sampler[key];\n }\n }\n return sampler;\n }\n _enumSamplerParameter(key) {\n return SAMPLER_PARAMETER_GLTF_TO_GL[key];\n }\n _resolveImage(gltfImage, index) {\n const image = {\n ...gltfImage,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfImage.id || `image-${index}`,\n image: null,\n bufferView: gltfImage.bufferView !== undefined ? this.getBufferView(gltfImage.bufferView) : undefined\n };\n // Check if image has been preloaded by the GLTFLoader\n // If so, link it into the JSON and drop the URI\n const preloadedImage = this.images[index];\n if (preloadedImage) {\n image.image = preloadedImage;\n }\n return image;\n }\n _resolveBufferView(gltfBufferView, index) {\n const bufferIndex = gltfBufferView.buffer;\n const arrayBuffer = this.buffers[bufferIndex].arrayBuffer;\n // Add offset of buffer, then offset of buffer view\n let byteOffset = this.buffers[bufferIndex].byteOffset || 0;\n if (gltfBufferView.byteOffset) {\n byteOffset += gltfBufferView.byteOffset;\n }\n const bufferView = {\n // // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: `bufferView-${index}`,\n ...gltfBufferView,\n // ...this.buffers[bufferIndex],\n buffer: this.buffers[bufferIndex],\n data: new Uint8Array(arrayBuffer, byteOffset, gltfBufferView.byteLength)\n };\n return bufferView;\n }\n _resolveCamera(gltfCamera, index) {\n const camera = {\n ...gltfCamera,\n // @ts-expect-error id could already be present, glTF standard does not prevent it\n id: gltfCamera.id || `camera-${index}`\n };\n // TODO - create 4x4 matrices\n if (camera.perspective) {\n // camera.matrix = createPerspectiveMatrix(camera.perspective);\n }\n if (camera.orthographic) {\n // camera.matrix = createOrthographicMatrix(camera.orthographic);\n }\n return camera;\n }\n}\nexport function postProcessGLTF(gltf, options) {\n return new GLTFPostProcessor().postProcess(gltf, options);\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,8BAAAA;AAAA,EAAA;AAAA,iCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,oBAAuC;AACvC,0BAAyC;;;ACDlC,SAAS,OAAO,WAAW,SAAS;AACvC,MAAI,CAAC,WAAW;AACZ,UAAM,IAAI,MAAM,WAAW,qBAAqB;AAAA,EACpD;AACJ;;;ACPO,IAAM,aAAa;AAAA,EACtB,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACV;AACO,IAAM,QAAQ;AAAA,EACjB,MAAM;AAAA;AAAA,EACN,MAAM;AAAA;AAAA,EACN,MAAM;AAAA;AAAA,EACN,MAAM;AAAA;AAAA,EACN,MAAM;AAAA;AAAA,EACN,MAAM;AAAA;AACV;;;ACVA,IAAM,gBAAgB;AACtB,IAAM,QAAQ,CAAC,UAAU,QAAQ,QAAQ,MAAM;AAC/C,IAAM,sCAAsC;AAAA,EACxC,CAAC,WAAW,IAAI;AAAA,EAChB,CAAC,YAAY,IAAI;AAAA,EACjB,CAAC,YAAY,IAAI;AAAA,EACjB,CAAC,aAAa,IAAI;AAAA,EAClB,CAAC,aAAa,IAAI;AAAA,EAClB,CAAC,cAAc,IAAI;AAAA,EACnB,CAAC,cAAc,IAAI;AACvB;AACA,IAAM,0BAA0B,IAAI,IAAI,mCAAmC;AAC3E,IAAM,+BAA+B;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACV;AACA,IAAM,wCA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AO,KAAK;AACxC,QAAI,gBAAgB;AAChB,YAAM,QAAQ;AAAA,IAClB;AACA,WAAO;AAAA,EACX;AAAA,EACA,mBAAmB,gBAAgB,OAAO;AACtC,UAAM,cAAc,eAAe;AACnC,UAAM,cAAc,KAAK,QAAQ,WAAW,EAAE;AAE9C,QAAI,aAAa,KAAK,QAAQ,WAAW,EAAE,cAAc;AACzD,QAAI,eAAe,YAAY;AAC3B,oBAAc,eAAe;AAAA,IACjC;AACA,UAAM,aAAa;AAAA;AAAA,MAEf,IAAI,cAAc;AAAA,MAClB,GAAG;AAAA;AAAA,MAEH,QAAQ,KAAK,QAAQ,WAAW;AAAA,MAChC,MAAM,IAAI,WAAW,aAAa,YAAY,eAAe,UAAU;AAAA,IAC3E;AACA,WAAO;AAAA,EACX;AAAA,EACA,eAAe,YAAY,OAAO;AAC9B,UAAM,SAAS;AAAA,MACX,GAAG;AAAA;AAAA,MAEH,IAAI,WAAW,MAAM,UAAU;AAAA,IACnC;AAEA,QAAI,OAAO,aAAa;AAAA,IAExB;AACA,QAAI,OAAO,cAAc;AAAA,IAEzB;AACA,WAAO;AAAA,EACX;AACJ;AACO,SAAS,gBAAgB,MAAM,SAAS;AAC3C,SAAO,IAAI,kBAAkB,EAAE,YAAY,MAAM,OAAO;AAC5D;", "names": ["name", "result", "name", "import_images", "ATTRIBUTE_TYPE_TO_COMPONENTS", "ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY", "ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE", "decode", "encode", "name", "name", "decode", "encode", "decode", "name", "name", "decode", "decodePropertyTextures", "decodePropertyTables", "findPropertyTableByClass", "processPropertyTable", "getPropertyDataFromBinarySource", "getArrayOffsetsForProperty", "getStringOffsetsForProperty", "getPropertyDataNumeric", "import_loader_utils", "import_images", "import_loader_utils", "decode", "name", "decode", "name", "decode", "name", "import_images", "name", "name", "preprocess", "name", "preprocess", "decode", "encode", "name", "preprocess", "import_loader_utils", "name", "name", "preprocess", "decode", "encode", "decode", "name", "name", "decode", "decode", "encode", "name", "name", "decode", "encode", "decode", "encode", "name", "name", "decode", "encode", "decode", "encode", "name", "name", "decode", "encode", "preprocess", "preprocess", "import_loader_utils", "MAGIC_glTF", "parse", "encodeSync", "COMPONENTS", "BYTES"] }