gltf-parser-plugin 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils/worker-pool.ts","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/utilities/ClassPropertyHelpers.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/ClassProperty.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/PropertySetAccessor.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/PropertyAttributeAccessor.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/PropertyTableAccessor.js","../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/utilities/TextureReadUtility.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/utilities/TexCoordUtilities.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/PropertyTextureAccessor.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/StructuralMetadata.js","../node_modules/.pnpm/3d-tiles-renderer@0.4.19_three@0.182.0/node_modules/3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/MeshFeatures.js","../src/GLTFWorkerLoader.ts","../src/utils/build-textures.ts","../src/utils/build-materials.ts","../src/utils/build-mesh-primitives.ts","../src/GLTFParserPlugin.ts"],"sourcesContent":["// 导入内联 Worker (Vite 会将 worker 代码编译打包成 base64 data URL)\nimport GLTFWorkerClass from \"../worker/index?worker&inline\";\n\n// Worker 池管理\nlet workerPool: Worker[] = [];\nlet maxWorkers = 1;\nlet currentWorkerIndex = 0;\n\n/**\n * 设置最大 Worker 数量(必须在初始化之前调用)\n */\nexport function setMaxWorkers(count: number): void {\n maxWorkers = Math.max(1, Math.min(count, navigator.hardwareConcurrency || 4));\n}\n\n/**\n * 创建单个 Worker 并等待其就绪\n */\nfunction createWorker(): Worker {\n return new GLTFWorkerClass();\n}\n\n/**\n * 初始化 Worker 池\n */\nfunction initWorkerPool() {\n if (workerPool.length === 0) {\n // 创建所有 Worker\n for (let i = 0; i < maxWorkers; i++) {\n workerPool.push(createWorker());\n }\n }\n}\n\nexport function getWorkers(): Worker[] {\n initWorkerPool();\n return workerPool;\n}\n\n/**\n * 获取一个 Worker(如果没有空闲的则等待)\n * @returns Promise 解析为可用的 Worker\n */\nexport function acquireWorker() {\n initWorkerPool();\n\n const worker = workerPool[currentWorkerIndex];\n currentWorkerIndex = (currentWorkerIndex + 1) % workerPool.length;\n return worker;\n}\n","import {\n\tVector2,\n\tVector3,\n\tVector4,\n\tMatrix2,\n\tMatrix3,\n\tMatrix4,\n} from 'three';\n\n// returns the field in the object with a resolved default\nexport function getField( object, key, def ) {\n\n\treturn object && key in object ? object[ key ] : def;\n\n}\n\n// checks the structural metadata type\nexport function isNumericType( type ) {\n\n\treturn type !== 'BOOLEAN' && type !== 'STRING' && type !== 'ENUM';\n\n}\n\n// check if the class property type is a float component type value\nexport function isFloatComponentType( type ) {\n\n\treturn /^FLOAT/.test( type );\n\n}\n\n// check if the class property type is a vector type\nexport function isVectorType( type ) {\n\n\treturn /^VEC/.test( type );\n\n}\n\n// check if the class property type is a matrix type\nexport function isMatrixType( type ) {\n\n\treturn /^MAT/.test( type );\n\n}\n\n// returns a value from the given buffer of the given type\nexport function readDataFromBufferToType( buffer, offset, type, target = null ) {\n\n\tif ( isMatrixType( type ) ) {\n\n\t\treturn target.fromArray( buffer, offset );\n\n\t} else if ( isVectorType( type ) ) {\n\n\t\treturn target.fromArray( buffer, offset );\n\n\t} else {\n\n\t\treturn buffer[ offset ];\n\n\t}\n\n}\n\n// gets a new instance of the given structural metadata type\nexport function getTypeInstance( property ) {\n\n\tconst { type, componentType } = property;\n\tswitch ( type ) {\n\n\t\tcase 'SCALAR': return componentType === 'INT64' ? 0n : 0;\n\t\tcase 'VEC2': return new Vector2();\n\t\tcase 'VEC3': return new Vector3();\n\t\tcase 'VEC4': return new Vector4();\n\t\tcase 'MAT2': return new Matrix2();\n\t\tcase 'MAT3': return new Matrix3();\n\t\tcase 'MAT4': return new Matrix4();\n\t\tcase 'BOOLEAN': return false;\n\t\tcase 'STRING': return '';\n\n\t\t// the final value for enums is a string but are represented as integers\n\t\t// during intermediate steps\n\t\tcase 'ENUM': return 0;\n\n\t}\n\n}\n\n// returns false if the given value is not of \"type\"\nexport function isTypeInstance( type, value ) {\n\n\tif ( value === null || value === undefined ) {\n\n\t\treturn false;\n\n\t}\n\n\tswitch ( type ) {\n\n\t\tcase 'SCALAR': return typeof value === 'number' || typeof value === 'bigint';\n\t\tcase 'VEC2': return value.isVector2;\n\t\tcase 'VEC3': return value.isVector3;\n\t\tcase 'VEC4': return value.isVector4;\n\t\tcase 'MAT2': return value.isMatrix2;\n\t\tcase 'MAT3': return value.isMatrix3;\n\t\tcase 'MAT4': return value.isMatrix4;\n\t\tcase 'BOOLEAN': return typeof value === 'boolean';\n\t\tcase 'STRING': return typeof value === 'string';\n\t\tcase 'ENUM': return typeof value === 'number' || typeof value === 'bigint';\n\n\t}\n\n\tthrow new Error( 'ClassProperty: invalid type.' );\n\n}\n\n// gets a new numeric array constructor from the given structural metadata type\nexport function getArrayConstructorFromComponentType( componentType, type = null ) {\n\n\tswitch ( componentType ) {\n\n\t\tcase 'INT8': return Int8Array;\n\t\tcase 'INT16': return Int16Array;\n\t\tcase 'INT32': return Int32Array;\n\t\tcase 'INT64': return BigInt64Array;\n\n\t\tcase 'UINT8': return Uint8Array;\n\t\tcase 'UINT16': return Uint16Array;\n\t\tcase 'UINT32': return Uint32Array;\n\t\tcase 'UINT64': return BigUint64Array;\n\n\t\tcase 'FLOAT32': return Float32Array;\n\t\tcase 'FLOAT64': return Float64Array;\n\n\t}\n\n\tswitch ( type ) {\n\n\t\tcase 'BOOLEAN': return Uint8Array;\n\t\tcase 'STRING': return Uint8Array;\n\n\t}\n\n\tthrow new Error( 'ClassProperty: invalid type.' );\n\n}\n\n// resolve a full default value for the given property including arrays\nexport function resolveDefault( property, target = null ) {\n\n\tconst array = property.array;\n\tif ( array ) {\n\n\t\ttarget = target && Array.isArray( target ) ? target : [];\n\t\ttarget.length = property.count;\n\t\tfor ( let i = 0, l = target.length; i < l; i ++ ) {\n\n\t\t\ttarget[ i ] = resolveDefaultElement( property, target[ i ] );\n\n\t\t}\n\n\t} else {\n\n\t\ttarget = resolveDefaultElement( property, target );\n\n\t}\n\n\treturn target;\n\n}\n\n// gets the default value of the given type\nexport function resolveDefaultElement( property, target = null ) {\n\n\tconst defaultValue = property.default;\n\tconst type = property.type;\n\n\ttarget = target || getTypeInstance( property );\n\n\tif ( defaultValue === null ) {\n\n\t\tswitch ( type ) {\n\n\t\t\tcase 'SCALAR': return 0;\n\t\t\tcase 'VEC2': return target.set( 0, 0 );\n\t\t\tcase 'VEC3': return target.set( 0, 0, 0 );\n\t\t\tcase 'VEC4': return target.set( 0, 0, 0, 0 );\n\t\t\tcase 'MAT2': return target.identity();\n\t\t\tcase 'MAT3': return target.identity();\n\t\t\tcase 'MAT4': return target.identity();\n\t\t\tcase 'BOOLEAN': return false;\n\t\t\tcase 'STRING': return '';\n\t\t\tcase 'ENUM': return '';\n\n\t\t}\n\n\t\tthrow new Error( 'ClassProperty: invalid type.' );\n\n\t} else {\n\n\t\tif ( isMatrixType( type ) ) {\n\n\t\t\ttarget.fromArray( defaultValue );\n\n\t\t} else if ( isVectorType( type ) ) {\n\n\t\t\ttarget.fromArray( defaultValue );\n\n\t\t} else {\n\n\t\t\treturn defaultValue;\n\n\t\t}\n\n\t}\n\n}\n\n// check for of instances of \"no data\" in the given target value and adjust them to the\n// default value.\nexport function resolveNoData( property, target ) {\n\n\tif ( property.noData === null ) {\n\n\t\treturn target;\n\n\t}\n\n\tconst noData = property.noData;\n\tconst type = property.type;\n\tif ( Array.isArray( target ) ) {\n\n\t\tfor ( let i = 0, l = target.length; i < l; i ++ ) {\n\n\t\t\ttarget[ i ] = performResolution( target[ i ] );\n\n\t\t}\n\n\t} else {\n\n\t\ttarget = performResolution( target );\n\n\t}\n\n\treturn target;\n\n\t// replace the value with a default if no data is encountered\n\tfunction performResolution( target ) {\n\n\t\tif ( isNoDataEqual( target ) ) {\n\n\t\t\ttarget = resolveDefaultElement( property, target );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t// checks if the given value is equal to the no data value\n\tfunction isNoDataEqual( value ) {\n\n\t\tif ( isMatrixType( type ) ) {\n\n\t\t\tconst elements = value.elements;\n\t\t\tfor ( let i = 0, l = noData.length; i < l; i ++ ) {\n\n\t\t\t\tif ( noData[ i ] !== elements[ i ] ) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else if ( isVectorType( type ) ) {\n\n\t\t\tfor ( let i = 0, l = noData.length; i < l; i ++ ) {\n\n\t\t\t\tif ( noData[ i ] !== value.getComponent( i ) ) {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\treturn noData === value;\n\n\t\t}\n\n\t}\n\n}\n\nexport function normalizeValue( componentType, v ) {\n\n\t// formulas defined here but normalizing 64 bit ints will result in precision loss:\n\t// https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata/#normalized-values\n\tswitch ( componentType ) {\n\n\t\tcase 'INT8': return Math.max( v / 127.0, - 1.0 );\n\t\tcase 'INT16': return Math.max( v, 32767.0, - 1.0 );\n\t\tcase 'INT32': return Math.max( v / 2147483647.0, - 1.0 );\n\t\tcase 'INT64': return Math.max( Number( v ) / 9223372036854775807.0, - 1.0 ); // eslint-disable-line no-loss-of-precision\n\n\t\tcase 'UINT8': return v / 255.0;\n\t\tcase 'UINT16': return v / 65535.0;\n\t\tcase 'UINT32': return v / 4294967295.0;\n\t\tcase 'UINT64': return Number( v ) / 18446744073709551615.0; // eslint-disable-line no-loss-of-precision\n\n\t}\n\n}\n\n// scales the value based on property settings\n// the provided target value is normalized, scaled, and then offset if numeric\nexport function adjustValueScaleOffset( property, target ) {\n\n\tconst {\n\t\ttype,\n\t\tcomponentType,\n\t\tscale,\n\t\toffset,\n\t\tnormalized,\n\t} = property;\n\n\tif ( Array.isArray( target ) ) {\n\n\t\tfor ( let i = 0, l = target.length; i < l; i ++ ) {\n\n\t\t\ttarget[ i ] = adjustFromType( target[ i ] );\n\n\t\t}\n\n\t} else {\n\n\t\ttarget = adjustFromType( target );\n\n\t}\n\n\treturn target;\n\n\tfunction adjustFromType( value ) {\n\n\t\tif ( isMatrixType( type ) ) {\n\n\t\t\tvalue = adjustMatrix( value );\n\n\t\t} else if ( isVectorType( type ) ) {\n\n\t\t\tvalue = adjustVector( value );\n\n\t\t} else {\n\n\t\t\tvalue = adjustScalar( value );\n\n\t\t}\n\n\t\treturn value;\n\n\t}\n\n\tfunction adjustVector( value ) {\n\n\t\tvalue.x = adjustScalar( value.x );\n\t\tvalue.y = adjustScalar( value.y );\n\t\tif ( 'z' in value ) value.z = adjustScalar( value.z );\n\t\tif ( 'w' in value ) value.w = adjustScalar( value.w );\n\t\treturn value;\n\n\t}\n\n\tfunction adjustMatrix( value ) {\n\n\t\tconst elements = value.elements;\n\t\tfor ( let i = 0, l = elements.length; i < l; i ++ ) {\n\n\t\t\telements[ i ] = adjustScalar( elements[ i ] );\n\n\t\t}\n\n\t\treturn value;\n\n\t}\n\n\tfunction adjustScalar( value ) {\n\n\t\tif ( normalized ) {\n\n\t\t\tvalue = normalizeValue( componentType, value );\n\n\t\t}\n\n\t\tif ( normalized || isFloatComponentType( componentType ) ) {\n\n\t\t\tvalue = value * scale + offset;\n\n\t\t}\n\n\t\treturn value;\n\n\t}\n\n}\n\n// Shape the given target object based on the provided property. If overrideCount is\n// provided then it will be used to specify the array length.\nexport function initializeFromProperty( property, target, overrideCount = null ) {\n\n\tif ( property.array ) {\n\n\t\tif ( ! Array.isArray( target ) ) {\n\n\t\t\ttarget = new Array( property.count || 0 );\n\n\t\t}\n\n\t\ttarget.length = overrideCount !== null ? overrideCount : property.count;\n\n\t\tfor ( let i = 0, l = target.length; i < l; i ++ ) {\n\n\t\t\tif ( ! isTypeInstance( property.type, target[ i ] ) ) {\n\n\t\t\t\ttarget[ i ] = getTypeInstance( property );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\tif ( ! isTypeInstance( property.type, target ) ) {\n\n\t\t\ttarget = getTypeInstance( property );\n\n\t\t}\n\n\t}\n\n\treturn target;\n\n}\n\n// Shape the \"target\" object based on the provided set of properties\nexport function initializeFromClass( properties, target ) {\n\n\t// remove unused fields\n\tfor ( const key in target ) {\n\n\t\tif ( ! ( key in properties ) ) {\n\n\t\t\tdelete target[ key ];\n\n\t\t}\n\n\t}\n\n\t// add and adjust any fields required by the set of properties\n\tfor ( const key in properties ) {\n\n\t\tconst prop = properties[ key ];\n\t\ttarget[ key ] = initializeFromProperty( prop, target[ key ] );\n\n\t}\n\n}\n\n// Returns the number of components required for the given type\nexport function typeToComponentCount( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 'ENUM': return 1;\n\t\tcase 'SCALAR': return 1;\n\t\tcase 'VEC2': return 2;\n\t\tcase 'VEC3': return 3;\n\t\tcase 'VEC4': return 4;\n\t\tcase 'MAT2': return 4;\n\t\tcase 'MAT3': return 9;\n\t\tcase 'MAT4': return 16;\n\n\t\t// unused\n\t\tcase 'BOOLEAN': return - 1;\n\t\tcase 'STRING': return - 1;\n\t\tdefault: return - 1;\n\n\t}\n\n}\n","import {\n\tinitializeFromProperty,\n\tadjustValueScaleOffset,\n\tgetField,\n\tisNumericType,\n\tresolveDefaultElement,\n\tresolveNoData,\n\tresolveDefault,\n} from '../utilities/ClassPropertyHelpers.js';\n\nexport class ClassProperty {\n\n\tconstructor( enums, property, accessorProperty = null ) {\n\n\t\t// initialize defaults for class property info\n\t\tthis.name = property.name || null;\n\t\tthis.description = property.description || null;\n\t\tthis.type = property.type;\n\t\tthis.componentType = property.componentType || null;\n\t\tthis.enumType = property.enumType || null;\n\t\tthis.array = property.array || false;\n\t\tthis.count = property.count || 0;\n\t\tthis.normalized = property.normalized || false;\n\t\tthis.offset = property.offset || 0;\n\t\tthis.scale = getField( property, 'scale', 1 );\n\t\tthis.max = getField( property, 'max', Infinity );\n\t\tthis.min = getField( property, 'min', - Infinity );\n\t\tthis.required = property.required || false;\n\t\tthis.noData = getField( property, 'noData', null );\n\t\tthis.default = getField( property, 'default', null );\n\t\tthis.semantic = getField( property, 'semantic', null );\n\t\tthis.enumSet = null;\n\t\tthis.accessorProperty = accessorProperty;\n\n\t\t// accessor properties can override min, max, offset, and scale values\n\t\tif ( accessorProperty ) {\n\n\t\t\tthis.offset = getField( accessorProperty, 'offset', this.offset );\n\t\t\tthis.scale = getField( accessorProperty, 'scale', this.scale );\n\t\t\tthis.max = getField( accessorProperty, 'max', this.max );\n\t\t\tthis.min = getField( accessorProperty, 'min', this.min );\n\n\t\t}\n\n\t\t// get the component type for the provided enum\n\t\tif ( property.type === 'ENUM' ) {\n\n\t\t\tthis.enumSet = enums[ this.enumType ];\n\t\t\tif ( this.componentType === null ) {\n\n\t\t\t\tthis.componentType = getField( this.enumSet, 'valueType', 'UINT16' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// shape the given target to match the data type of the property\n\t// enums are set to their integer value\n\tshapeToProperty( target, countOverride = null ) {\n\n\t\treturn initializeFromProperty( this, target, countOverride );\n\n\t}\n\n\t// resolve the given object to the default value for the property for a single element\n\t// enums are set to a default string\n\tresolveDefaultElement( target ) {\n\n\t\treturn resolveDefaultElement( this, target );\n\n\t}\n\n\t// resolve the target to the default value for the property for every element if it's an array\n\t// enums are set to a default string\n\tresolveDefault( target ) {\n\n\t\treturn resolveDefault( this, target );\n\n\t}\n\n\t// converts any instances of no data to the default value\n\tresolveNoData( target ) {\n\n\t\treturn resolveNoData( this, target );\n\n\t}\n\n\t// converts enums integers in the given target to strings\n\tresolveEnumsToStrings( target ) {\n\n\t\tconst enumSet = this.enumSet;\n\t\tif ( this.type === 'ENUM' ) {\n\n\t\t\tif ( Array.isArray( target ) ) {\n\n\t\t\t\tfor ( let i = 0, l = target.length; i < l; i ++ ) {\n\n\t\t\t\t\ttarget[ i ] = getEnumName( target[ i ] );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\ttarget = getEnumName( target );\n\n\t\t\t}\n\n\n\t\t}\n\n\t\treturn target;\n\n\t\tfunction getEnumName( index ) {\n\n\t\t\tconst match = enumSet.values.find( e => e.value === index );\n\t\t\tif ( match === null ) {\n\n\t\t\t\t// the default \"default enum\" value is an empty string when we can't find a match\n\t\t\t\t// in a case where enums are defined correctly we should never get here.\n\t\t\t\treturn '';\n\n\t\t\t} else {\n\n\t\t\t\treturn match.name;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// apply scales\n\tadjustValueScaleOffset( target ) {\n\n\t\tif ( isNumericType( this.type ) ) {\n\n\t\t\treturn adjustValueScaleOffset( this, target );\n\n\t\t} else {\n\n\t\t\treturn target;\n\n\t\t}\n\n\t}\n\n}\n","import { ClassProperty } from './ClassProperty.js';\n\nexport class PropertySetAccessor {\n\n\tconstructor( definition, classes = {}, enums = {}, data = null ) {\n\n\t\tthis.definition = definition;\n\t\tthis.class = classes[ definition.class ];\n\t\tthis.className = definition.class;\n\t\tthis.enums = enums;\n\t\tthis.data = data;\n\t\tthis.name = 'name' in definition ? definition.name : null;\n\n\t\tthis.properties = null;\n\n\t}\n\n\tgetPropertyNames() {\n\n\t\treturn Object.keys( this.class.properties );\n\n\t}\n\n\tincludesData( name ) {\n\n\t\treturn Boolean( this.definition.properties[ name ] );\n\n\t}\n\n\tdispose() {}\n\n\t_initProperties( propertyClass = ClassProperty ) {\n\n\t\tconst properties = {};\n\t\tfor ( const key in this.class.properties ) {\n\n\t\t\tproperties[ key ] = new propertyClass( this.enums, this.class.properties[ key ], this.definition.properties[ key ] );\n\n\t\t}\n\n\t\tthis.properties = properties;\n\n\t}\n\n}\n","import { initializeFromClass, isMatrixType, isVectorType } from '../utilities/ClassPropertyHelpers.js';\nimport { ClassProperty } from './ClassProperty.js';\nimport { PropertySetAccessor } from './PropertySetAccessor.js';\n\nclass PropertyAttributeClassProperty extends ClassProperty {\n\n\tconstructor( enums, classProperty, attributeProperty = null ) {\n\n\t\tsuper( enums, classProperty, attributeProperty );\n\n\t\tthis.attribute = attributeProperty?.attribute ?? null;\n\n\t}\n\n}\n\nexport class PropertyAttributeAccessor extends PropertySetAccessor {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isPropertyAttributeAccessor = true;\n\t\tthis._initProperties( PropertyAttributeClassProperty );\n\n\t}\n\n\tgetData( id, geometry, target = {} ) {\n\n\t\tconst properties = this.properties;\n\t\tinitializeFromClass( properties, target );\n\n\t\tfor ( const name in properties ) {\n\n\t\t\ttarget[ name ] = this.getPropertyValue( name, id, geometry, target[ name ] );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetPropertyValue( name, id, geometry, target = null ) {\n\n\t\t// NOTE: arrays are not supported via attribute accessors\n\t\tif ( id >= this.count ) {\n\n\t\t\tthrow new Error( 'PropertyAttributeAccessor: Requested index is outside the range of the buffer.' );\n\n\t\t}\n\n\t\t// use a default of the texture accessor definition does not include the value\n\t\tconst property = this.properties[ name ];\n\t\tconst type = property.type;\n\t\tif ( ! property ) {\n\n\t\t\tthrow new Error( 'PropertyAttributeAccessor: Requested class property does not exist.' );\n\n\t\t} else if ( ! this.definition.properties[ name ] ) {\n\n\t\t\treturn property.resolveDefault( target );\n\n\t\t}\n\n\t\t// initialize the array\n\t\ttarget = property.shapeToProperty( target );\n\n\t\t// Read the data values from the attribute\n\t\tconst attribute = geometry.getAttribute( property.attribute.toLowerCase() );\n\t\tif ( isMatrixType( type ) ) {\n\n\t\t\tconst elements = target.elements;\n\t\t\tfor ( let i = 0, l = elements.length; i < l; i < l ) {\n\n\t\t\t\telements[ i ] = attribute.getComponent( id, i );\n\n\t\t\t}\n\n\t\t} else if ( isVectorType( type ) ) {\n\n\t\t\ttarget.fromBufferAttribute( attribute, id );\n\n\t\t} else if ( type === 'SCALAR' || type === 'ENUM' ) {\n\n\t\t\ttarget = attribute.getX( id );\n\n\t\t} else {\n\n\t\t\t// BOOLEAN, STRING not supported\n\t\t\tthrow new Error( 'StructuredMetadata.PropertyAttributeAccessor: BOOLEAN and STRING types are not supported by property attributes.' );\n\n\t\t}\n\n\t\t// scale the numeric values\n\t\ttarget = property.adjustValueScaleOffset( target );\n\n\t\t// convert to enum strings - no data enum values are stored as strings\n\t\ttarget = property.resolveEnumsToStrings( target );\n\n\t\t// resolve to default values\n\t\ttarget = property.resolveNoData( target );\n\n\t\treturn target;\n\n\t}\n\n}\n","import { ClassProperty } from './ClassProperty.js';\nimport { PropertySetAccessor } from './PropertySetAccessor.js';\nimport {\n\tinitializeFromClass,\n\tgetArrayConstructorFromComponentType,\n\treadDataFromBufferToType,\n\tgetField,\n\tisNumericType,\n\ttypeToComponentCount,\n} from '../utilities/ClassPropertyHelpers.js';\n\nclass PropertyTableClassProperty extends ClassProperty {\n\n\tconstructor( enums, classProperty, tableProperty = null ) {\n\n\t\tsuper( enums, classProperty, tableProperty );\n\n\t\tthis.values = tableProperty?.values ?? null;\n\t\tthis.valueLength = typeToComponentCount( this.type );\n\t\tthis.arrayOffsets = getField( tableProperty, 'arrayOffsets', null );\n\t\tthis.stringOffsets = getField( tableProperty, 'stringOffsets', null );\n\t\tthis.arrayOffsetType = getField( tableProperty, 'arrayOffsetType', 'UINT32' );\n\t\tthis.stringOffsetType = getField( tableProperty, 'stringOffsetType', 'UINT32' );\n\n\t}\n\n\t// returns the necessary array length based on the array offsets if present\n\tgetArrayLengthFromId( buffers, id ) {\n\n\t\tlet count = this.count;\n\t\tif ( this.arrayOffsets !== null ) {\n\n\t\t\tconst { arrayOffsets, arrayOffsetType } = this;\n\t\t\tconst bufferCons = getArrayConstructorFromComponentType( arrayOffsetType );\n\t\t\tconst arr = new bufferCons( buffers[ arrayOffsets ] );\n\t\t\tcount = arr[ id + 1 ] - arr[ id ];\n\n\t\t}\n\n\t\treturn count;\n\n\t}\n\n\t// returns the index offset into the data buffer for the given id based on the\n\t// the array offsets if present\n\tgetIndexOffsetFromId( buffers, id ) {\n\n\t\tlet indexOffset = id;\n\t\tif ( this.arrayOffsets ) {\n\n\t\t\tconst { arrayOffsets, arrayOffsetType } = this;\n\t\t\tconst bufferCons = getArrayConstructorFromComponentType( arrayOffsetType );\n\t\t\tconst arr = new bufferCons( buffers[ arrayOffsets ] );\n\t\t\tindexOffset = arr[ indexOffset ];\n\n\t\t} else if ( this.array ) {\n\n\t\t\t// TODO: why do this? Revisit\n\t\t\tindexOffset *= this.count;\n\n\t\t}\n\n\t\treturn indexOffset;\n\n\t}\n\n}\n\nexport class PropertyTableAccessor extends PropertySetAccessor {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isPropertyTableAccessor = true;\n\t\tthis.count = this.definition.count;\n\n\t\tthis._initProperties( PropertyTableClassProperty );\n\n\t}\n\n\tgetData( id, target = {} ) {\n\n\t\tconst properties = this.properties;\n\t\tinitializeFromClass( properties, target );\n\n\t\tfor ( const name in properties ) {\n\n\t\t\ttarget[ name ] = this.getPropertyValue( name, id, target[ name ] );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t// reads an individual element\n\t_readValueAtIndex( name, id, index, target = null ) {\n\n\t\tconst property = this.properties[ name ];\n\t\tconst { componentType, type } = property;\n\n\t\tconst buffers = this.data;\n\t\tconst bufferView = buffers[ property.values ];\n\t\tconst bufferCons = getArrayConstructorFromComponentType( componentType, type );\n\t\tconst dataArray = new bufferCons( bufferView );\n\n\t\t// array offsets contain element offsets, not byte offsets\n\t\tconst indexOffset = property.getIndexOffsetFromId( buffers, id );\n\n\t\tif ( isNumericType( type ) || type === 'ENUM' ) {\n\n\t\t\t// \"readDataFromBufferToType\" takes the start offset to read from so we multiply the\n\t\t\t// index by the final value length\n\t\t\treturn readDataFromBufferToType( dataArray, ( indexOffset + index ) * property.valueLength, type, target );\n\n\t\t} else if ( type === 'STRING' ) {\n\n\t\t\t// https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata/#variable-length-arrays\n\n\t\t\tlet stringIndex = indexOffset + index;\n\t\t\tlet stringLength = 0;\n\t\t\tif ( property.stringOffsets !== null ) {\n\n\t\t\t\t// get the string lengths and beginning offsets if variable\n\t\t\t\tconst { stringOffsets, stringOffsetType } = property;\n\t\t\t\tconst bufferCons = getArrayConstructorFromComponentType( stringOffsetType );\n\t\t\t\tconst stringOffsetBuffer = new bufferCons( buffers[ stringOffsets ] );\n\t\t\t\tstringLength = stringOffsetBuffer[ stringIndex + 1 ] - stringOffsetBuffer[ stringIndex ];\n\t\t\t\tstringIndex = stringOffsetBuffer[ stringIndex ];\n\n\t\t\t}\n\n\t\t\tconst byteArray = new Uint8Array( dataArray.buffer, stringIndex, stringLength );\n\t\t\ttarget = new TextDecoder().decode( byteArray );\n\n\t\t} else if ( type === 'BOOLEAN' ) {\n\n\t\t\tconst offset = indexOffset + index;\n\t\t\tconst byteIndex = Math.floor( offset / 8 );\n\t\t\tconst bitIndex = offset % 8;\n\t\t\tconst bitValue = ( dataArray[ byteIndex ] >> bitIndex ) & 1;\n\t\t\ttarget = bitValue === 1;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\t// Reads the data for the given table index\n\tgetPropertyValue( name, id, target = null ) {\n\n\t\t// check if the requested id is outside of the size of the table\n\t\tif ( id >= this.count ) {\n\n\t\t\tthrow new Error( 'PropertyTableAccessor: Requested index is outside the range of the table.' );\n\n\t\t}\n\n\t\t// check to see if we skip this field since its not in the table\n\t\tconst property = this.properties[ name ];\n\t\tif ( ! property ) {\n\n\t\t\tthrow new Error( 'PropertyTableAccessor: Requested property does not exist.' );\n\n\t\t} else if ( ! this.definition.properties[ name ] ) {\n\n\t\t\treturn property.resolveDefault( target );\n\n\t\t}\n\n\t\t// get the dynamic array count from the property buffer\n\t\tconst array = property.array;\n\t\tconst buffers = this.data;\n\t\tconst count = property.getArrayLengthFromId( buffers, id );\n\n\t\t// initialize the array\n\t\ttarget = property.shapeToProperty( target, count );\n\n\t\t// read all data\n\t\tif ( array ) {\n\n\t\t\tfor ( let i = 0, l = target.length; i < l; i ++ ) {\n\n\t\t\t\ttarget[ i ] = this._readValueAtIndex( name, id, i, target[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\ttarget = this._readValueAtIndex( name, id, 0, target );\n\n\t\t}\n\n\t\t// scale the numeric values\n\t\ttarget = property.adjustValueScaleOffset( target );\n\n\t\t// convert to enum strings - no data enum values are stored as strings\n\t\ttarget = property.resolveEnumsToStrings( target );\n\n\t\t// resolve to default values\n\t\ttarget = property.resolveNoData( target );\n\n\t\treturn target;\n\n\t}\n\n}\n","import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLRenderer}.\n *\n * @augments Mesh\n * @three_import import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';\n */\nclass FullScreenQuad {\n\n\t/**\n\t * Constructs a new full screen quad.\n\t *\n\t * @param {?Material} material - The material to render te full screen quad with.\n\t */\n\tconstructor( material ) {\n\n\t\tthis._mesh = new Mesh( _geometry, material );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the instance is no longer used in your app.\n\t */\n\tdispose() {\n\n\t\tthis._mesh.geometry.dispose();\n\n\t}\n\n\t/**\n\t * Renders the full screen quad.\n\t *\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t */\n\trender( renderer ) {\n\n\t\trenderer.render( this._mesh, _camera );\n\n\t}\n\n\t/**\n\t * The quad's material.\n\t *\n\t * @type {?Material}\n\t */\n\tget material() {\n\n\t\treturn this._mesh.material;\n\n\t}\n\n\tset material( value ) {\n\n\t\tthis._mesh.material = value;\n\n\t}\n\n}\n\nexport { Pass, FullScreenQuad };\n","import { WebGLRenderTarget, WebGLRenderer, Box2, Vector2, ShaderMaterial, CustomBlending, ZeroFactor, OneFactor } from 'three';\nimport { FullScreenQuad } from 'three/examples/jsm/postprocessing/Pass.js';\n\nconst _box = /* @__PURE__ */ new Box2();\n\n// Utility for reading sets of individual pixel values from textures\nclass _TextureReadUtility {\n\n\tconstructor() {\n\n\t\tthis._renderer = new WebGLRenderer();\n\t\tthis._target = new WebGLRenderTarget( 1, 1 );\n\t\tthis._texTarget = new WebGLRenderTarget();\n\n\t\t// quad to render just a single pixel from the provided texture\n\t\tthis._quad = new FullScreenQuad( new ShaderMaterial( {\n\n\t\t\tblending: CustomBlending,\n\t\t\tblendDst: ZeroFactor,\n\t\t\tblendSrc: OneFactor,\n\n\t\t\tuniforms: {\n\n\t\t\t\tmap: { value: null },\n\t\t\t\tpixel: { value: new Vector2() }\n\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\t\t\t\tuniform sampler2D map;\n\t\t\t\tuniform ivec2 pixel;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = texelFetch( map, pixel, 0 );\n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t} ) );\n\n\t}\n\n\t// increases the width of the target render target to support more data\n\tincreaseSizeTo( width ) {\n\n\t\tthis._target.setSize( Math.max( this._target.width, width ), 1 );\n\n\t}\n\n\t// read data from the rendered texture asynchronously\n\treadDataAsync( buffer ) {\n\n\t\tconst { _renderer, _target } = this;\n\t\treturn _renderer.readRenderTargetPixelsAsync( _target, 0, 0, buffer.length / 4, 1, buffer );\n\n\t}\n\n\t// read data from the rendered texture\n\treadData( buffer ) {\n\n\t\tconst { _renderer, _target } = this;\n\t\t_renderer.readRenderTargetPixels( _target, 0, 0, buffer.length / 4, 1, buffer );\n\n\t}\n\n\t// render a single pixel from the source at the destination point on the render target\n\t// takes the texture, pixel to read from, and pixel to render in to\n\trenderPixelToTarget( texture, pixel, dstPixel ) {\n\n\t\tconst { _renderer, _target } = this;\n\n\t\t// copies the pixel directly to the target buffer\n\t\t_box.min.copy( pixel );\n\t\t_box.max.copy( pixel );\n\t\t_box.max.x += 1;\n\t\t_box.max.y += 1;\n\t\t_renderer.initRenderTarget( _target );\n\t\t_renderer.copyTextureToTexture( texture, _target.texture, _box, dstPixel, 0 );\n\n\t}\n\n}\n\n// Create a wrapper class to defer instantiation of the WebGLRenderer until it's needed\n// See NASA-AMMOS/3DTilesRendererJS#905\nexport const TextureReadUtility = /* @__PURE__ */ new ( class {\n\n\tconstructor() {\n\n\t\tlet reader = null;\n\t\tObject\n\t\t\t.getOwnPropertyNames( _TextureReadUtility.prototype )\n\t\t\t.forEach( key => {\n\n\t\t\t\tif ( key !== 'constructor' ) {\n\n\t\t\t\t\tthis[ key ] = ( ...args ) => {\n\n\t\t\t\t\t\treader = reader || new _TextureReadUtility();\n\t\t\t\t\t\treturn reader[ key ]( ...args );\n\n\t\t\t\t\t};\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t}\n\n} )();\n","import { Vector2 } from 'three';\n\nconst _uv0 = /* @__PURE__ */ new Vector2();\nconst _uv1 = /* @__PURE__ */ new Vector2();\nconst _uv2 = /* @__PURE__ */ new Vector2();\n\n// returns the uv attribute of the given index\nexport function getTextureCoordAttribute( geometry, index ) {\n\n\tif ( index === 0 ) {\n\n\t\treturn geometry.getAttribute( 'uv' );\n\n\t} else {\n\n\t\treturn geometry.getAttribute( `uv${ index }` );\n\n\t}\n\n}\n\n// returns the vertex indices associated with the triangle index\nexport function getTriangleVertexIndices( geometry, faceIndex, target = new Array( 3 ) ) {\n\n\t// get the attribute indices\n\tlet i0 = 3 * faceIndex;\n\tlet i1 = 3 * faceIndex + 1;\n\tlet i2 = 3 * faceIndex + 2;\n\tif ( geometry.index ) {\n\n\t\ti0 = geometry.index.getX( i0 );\n\t\ti1 = geometry.index.getX( i1 );\n\t\ti2 = geometry.index.getX( i2 );\n\n\t}\n\n\ttarget[ 0 ] = i0;\n\ttarget[ 1 ] = i1;\n\ttarget[ 2 ] = i2;\n\treturn target;\n\n}\n\n// takes a tex coord index, barycoord, vertex indices, and target to set\n// sets target to the interpolated uv value\nexport function getTexCoord( geometry, texCoord, barycoord, indices, target ) {\n\n\tconst [ i0, i1, i2 ] = indices;\n\tconst attr = getTextureCoordAttribute( geometry, texCoord );\n\t_uv0.fromBufferAttribute( attr, i0 );\n\t_uv1.fromBufferAttribute( attr, i1 );\n\t_uv2.fromBufferAttribute( attr, i2 );\n\n\ttarget\n\t\t.set( 0, 0, 0 )\n\t\t.addScaledVector( _uv0, barycoord.x )\n\t\t.addScaledVector( _uv1, barycoord.y )\n\t\t.addScaledVector( _uv2, barycoord.z );\n\n}\n\n// gets the x, y index of the pixel at the given uv coordinate\nexport function getTexelIndices( uv, width, height, target ) {\n\n\tconst fx = uv.x - Math.floor( uv.x );\n\tconst fy = uv.y - Math.floor( uv.y );\n\tconst px = Math.floor( ( fx * width ) % width );\n\tconst py = Math.floor( ( fy * height ) % height );\n\ttarget.set( px, py );\n\treturn target;\n\n}\n","import { Vector2 } from 'three';\nimport { PropertySetAccessor } from './PropertySetAccessor.js';\nimport { ClassProperty } from './ClassProperty.js';\nimport { TextureReadUtility } from '../utilities/TextureReadUtility.js';\nimport { getTexCoord, getTexelIndices, getTriangleVertexIndices } from '../utilities/TexCoordUtilities.js';\nimport {\n\tinitializeFromClass,\n\tinitializeFromProperty,\n\tgetArrayConstructorFromComponentType,\n\treadDataFromBufferToType,\n\tgetField\n} from '../utilities/ClassPropertyHelpers.js';\n\nconst _uv = /* @__PURE__ */ new Vector2();\nconst _srcPixel = /* @__PURE__ */ new Vector2();\nconst _dstPixel = /* @__PURE__ */ new Vector2();\n\nclass PropertyTextureClassProperty extends ClassProperty {\n\n\tconstructor( enums, classProperty, textureProperty = null ) {\n\n\t\tsuper( enums, classProperty, textureProperty );\n\n\t\tthis.channels = getField( textureProperty, 'channels', [ 0 ] );\n\t\tthis.index = getField( textureProperty, 'index', null );\n\t\tthis.texCoord = getField( textureProperty, 'texCoord', null );\n\t\tthis.valueLength = parseInt( this.type.replace( /[^0-9]/g, '' ) ) || 1;\n\n\t}\n\n\t// takes the buffer to read from and the value index to read\n\treadDataFromBuffer( buffer, index, target = null ) {\n\n\t\tconst type = this.type;\n\t\tif ( type === 'BOOLEAN' || type === 'STRING' ) {\n\n\t\t\tthrow new Error( 'PropertyTextureAccessor: BOOLEAN and STRING types not supported.' );\n\n\t\t}\n\n\t\t// \"readDataFromBufferToType\" takes the start offset to read from so we multiply the index by the\n\t\t// final value length\n\t\treturn readDataFromBufferToType( buffer, index * this.valueLength, type, target );\n\n\t}\n\n}\n\n// Reads and accesses data encoded to textures\nexport class PropertyTextureAccessor extends PropertySetAccessor {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isPropertyTextureAccessor = true;\n\t\tthis._asyncRead = false;\n\n\t\tthis._initProperties( PropertyTextureClassProperty );\n\n\t}\n\n\t// Reads the full set of property data\n\tgetData( faceIndex, barycoord, geometry, target = {} ) {\n\n\t\tconst properties = this.properties;\n\t\tinitializeFromClass( properties, target );\n\n\t\tconst names = Object.keys( properties );\n\t\tconst results = names.map( n => target[ n ] );\n\t\tthis.getPropertyValuesAtTexel( names, faceIndex, barycoord, geometry, results );\n\n\t\tnames.forEach( ( n, i ) => target[ n ] = results[ i ] );\n\t\treturn target;\n\n\t}\n\n\t// Reads the full set of property data asynchronously\n\tasync getDataAsync( faceIndex, barycoord, geometry, target = {} ) {\n\n\t\tconst properties = this.properties;\n\t\tinitializeFromClass( properties, target );\n\n\t\tconst names = Object.keys( properties );\n\t\tconst results = names.map( n => target[ n ] );\n\t\tawait this.getPropertyValuesAtTexelAsync( names, faceIndex, barycoord, geometry, results );\n\n\t\tnames.forEach( ( n, i ) => target[ n ] = results[ i ] );\n\t\treturn target;\n\n\t}\n\n\t// Reads values asynchronously\n\tgetPropertyValuesAtTexelAsync( ...args ) {\n\n\t\tthis._asyncRead = true;\n\t\tconst result = this.getPropertyValuesAtTexel( ...args );\n\t\tthis._asyncRead = false;\n\t\treturn result;\n\n\t}\n\n\t// Reads values from the textures synchronously\n\tgetPropertyValuesAtTexel( names, faceIndex, barycoord, geometry, target = [] ) {\n\n\t\t// resize our targets appropriately\n\t\twhile ( target.length < names.length ) target.push( null );\n\t\ttarget.length = names.length;\n\t\tTextureReadUtility.increaseSizeTo( target.length );\n\n\t\t// get the attribute indices\n\t\tconst textures = this.data;\n\t\tconst accessorProperties = this.definition.properties;\n\t\tconst properties = this.properties;\n\t\tconst indices = getTriangleVertexIndices( geometry, faceIndex );\n\t\tfor ( let i = 0, l = names.length; i < l; i ++ ) {\n\n\t\t\t// skip any requested class schema properties that are not provided via the accessor\n\t\t\tconst name = names[ i ];\n\t\t\tif ( ! accessorProperties[ name ] ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// get the attribute of the target tex coord\n\t\t\tconst property = properties[ name ];\n\t\t\tconst texture = textures[ property.index ];\n\t\t\tgetTexCoord( geometry, property.texCoord, barycoord, indices, _uv );\n\t\t\tgetTexelIndices( _uv, texture.image.width, texture.image.height, _srcPixel );\n\t\t\t_dstPixel.set( i, 0 );\n\n\t\t\tTextureReadUtility.renderPixelToTarget( texture, _srcPixel, _dstPixel );\n\n\t\t}\n\n\t\t// read the data\n\t\tconst buffer = new Uint8Array( names.length * 4 );\n\t\tif ( this._asyncRead ) {\n\n\t\t\treturn TextureReadUtility\n\t\t\t\t.readDataAsync( buffer )\n\t\t\t\t.then( () => {\n\n\t\t\t\t\treadTextureSampleResults.call( this );\n\t\t\t\t\treturn target;\n\n\t\t\t\t} );\n\n\t\t} else {\n\n\t\t\tTextureReadUtility.readData( buffer );\n\t\t\treadTextureSampleResults.call( this );\n\n\t\t\treturn target;\n\n\t\t}\n\n\t\tfunction readTextureSampleResults() {\n\n\t\t\tfor ( let i = 0, l = names.length; i < l; i ++ ) {\n\n\t\t\t\tconst name = names[ i ];\n\t\t\t\tconst property = properties[ name ];\n\t\t\t\tconst type = property.type;\n\n\t\t\t\t// initialize the output value\n\t\t\t\ttarget[ i ] = initializeFromProperty( property, target[ i ] );\n\n\t\t\t\t// use a default of the texture accessor definition does not include the value\n\t\t\t\tif ( ! property ) {\n\n\t\t\t\t\tthrow new Error( 'PropertyTextureAccessor: Requested property does not exist.' );\n\n\t\t\t\t} else if ( ! accessorProperties[ name ] ) {\n\n\t\t\t\t\ttarget[ i ] = property.resolveDefault( target );\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// get the final array length to read all data based on used buffer data\n\t\t\t\tconst length = property.valueLength * ( property.count || 1 );\n\n\t\t\t\t// set the data read back from the texture to the target type\n\t\t\t\tconst data = property.channels.map( c => buffer[ 4 * i + c ] );\n\t\t\t\tconst componentType = property.componentType;\n\t\t\t\tconst BufferCons = getArrayConstructorFromComponentType( componentType, type );\n\t\t\t\tconst readBuffer = new BufferCons( length );\n\t\t\t\tnew Uint8Array( readBuffer.buffer ).set( data );\n\n\t\t\t\t// read all the data\n\t\t\t\tif ( property.array ) {\n\n\t\t\t\t\tconst arr = target[ i ];\n\t\t\t\t\tfor ( let j = 0, lj = arr.length; j < lj; j ++ ) {\n\n\t\t\t\t\t\tarr[ j ] = property.readDataFromBuffer( readBuffer, j, arr[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget[ i ] = property.readDataFromBuffer( readBuffer, 0, target[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t// scale the numeric values\n\t\t\t\ttarget[ i ] = property.adjustValueScaleOffset( target[ i ] );\n\n\t\t\t\t// convert to enum strings - no data enum values are stored as strings\n\t\t\t\ttarget[ i ] = property.resolveEnumsToStrings( target[ i ] );\n\n\t\t\t\t// resolve to default values\n\t\t\t\ttarget[ i ] = property.resolveNoData( target[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// dispose all of the texture data used\n\tdispose() {\n\n\t\tthis.data.forEach( texture => {\n\n\t\t\tif ( texture ) {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tif ( texture.image instanceof ImageBitmap ) {\n\n\t\t\t\t\ttexture.image.close();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n","import { PropertyAttributeAccessor } from './PropertyAttributeAccessor.js';\nimport { PropertyTableAccessor } from './PropertyTableAccessor.js';\nimport { PropertyTextureAccessor } from './PropertyTextureAccessor.js';\n\nexport class StructuralMetadata {\n\n\tconstructor( definition, textures, buffers, nodeMetadata = null, object = null ) {\n\n\t\tconst {\n\t\t\tschema,\n\t\t\tpropertyTables = [],\n\t\t\tpropertyTextures = [],\n\t\t\tpropertyAttributes = [],\n\t\t} = definition;\n\n\t\tconst { enums, classes } = schema;\n\t\tconst tableAccessors = propertyTables.map( t => new PropertyTableAccessor( t, classes, enums, buffers ) );\n\t\tlet textureAccessors = [];\n\t\tlet attributeAccessors = [];\n\n\t\tif ( nodeMetadata ) {\n\n\t\t\tif ( nodeMetadata.propertyTextures ) {\n\n\t\t\t\ttextureAccessors = nodeMetadata.propertyTextures.map( i => new PropertyTextureAccessor( propertyTextures[ i ], classes, enums, textures ) );\n\n\t\t\t}\n\n\t\t\tif ( nodeMetadata.propertyAttributes ) {\n\n\t\t\t\tattributeAccessors = nodeMetadata.propertyAttributes.map( i => new PropertyAttributeAccessor( propertyAttributes[ i ], classes, enums ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.schema = schema;\n\t\tthis.tableAccessors = tableAccessors;\n\t\tthis.textureAccessors = textureAccessors;\n\t\tthis.attributeAccessors = attributeAccessors;\n\t\tthis.object = object;\n\t\tthis.textures = textures;\n\t\tthis.nodeMetadata = nodeMetadata;\n\n\t}\n\n\t// Property Tables\n\tgetPropertyTableData( tableIndices, ids, target = null ) {\n\n\t\tif ( ! Array.isArray( tableIndices ) || ! Array.isArray( ids ) ) {\n\n\t\t\t// only return a single tables data\n\t\t\ttarget = target || {};\n\n\t\t\tconst table = this.tableAccessors[ tableIndices ];\n\t\t\ttarget = table.getData( ids, target );\n\n\t\t} else {\n\n\t\t\t// return data from an array of tables and ids\n\t\t\ttarget = target || [];\n\n\t\t\tconst length = Math.min( tableIndices.length, ids.length );\n\t\t\ttarget.length = length;\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst table = this.tableAccessors[ tableIndices[ i ] ];\n\t\t\t\ttarget[ i ] = table.getData( ids[ i ], target[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetPropertyTableInfo( tableIndices = null ) {\n\n\t\t// default to all table information\n\t\tif ( tableIndices === null ) {\n\n\t\t\ttableIndices = this.tableAccessors.map( ( t, i ) => i );\n\n\t\t}\n\n\t\tif ( Array.isArray( tableIndices ) ) {\n\n\t\t\t// return all table information from the requested list\n\t\t\treturn tableIndices.map( i => {\n\n\t\t\t\tconst table = this.tableAccessors[ i ];\n\t\t\t\treturn {\n\t\t\t\t\tname: table.name,\n\t\t\t\t\tclassName: table.definition.class,\n\t\t\t\t};\n\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\t// return the one piece of table information\n\t\t\tconst table = this.tableAccessors[ tableIndices ];\n\t\t\treturn {\n\t\t\t\tname: table.name,\n\t\t\t\tclassName: table.definition.class,\n\t\t\t};\n\n\t\t}\n\n\t}\n\n\t// Property Textures\n\tgetPropertyTextureData( triangle, barycoord, target = [] ) {\n\n\t\tconst textureAccessors = this.textureAccessors;\n\t\ttarget.length = textureAccessors.length;\n\n\t\tfor ( let i = 0; i < textureAccessors.length; i ++ ) {\n\n\t\t\tconst accessor = textureAccessors[ i ];\n\t\t\ttarget[ i ] = accessor.getData( triangle, barycoord, this.object.geometry, target[ i ] );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tasync getPropertyTextureDataAsync( triangle, barycoord, target = [] ) {\n\n\t\tconst textureAccessors = this.textureAccessors;\n\t\ttarget.length = textureAccessors.length;\n\n\t\tconst promises = [];\n\t\tfor ( let i = 0; i < textureAccessors.length; i ++ ) {\n\n\t\t\tconst accessor = textureAccessors[ i ];\n\t\t\tconst promise = accessor\n\t\t\t\t.getDataAsync( triangle, barycoord, this.object.geometry, target[ i ] )\n\t\t\t\t.then( result => {\n\n\t\t\t\t\ttarget[ i ] = result;\n\n\t\t\t\t} );\n\n\t\t\tpromises.push( promise );\n\n\t\t}\n\n\t\tawait Promise.all( promises );\n\n\t\treturn target;\n\n\t}\n\n\tgetPropertyTextureInfo() {\n\n\t\treturn this.textureAccessors;\n\n\t}\n\n\t// Property Attributes\n\tgetPropertyAttributeData( attributeIndex, target = [] ) {\n\n\t\tconst attributeAccessors = this.attributeAccessors;\n\t\ttarget.length = attributeAccessors.length;\n\n\t\tfor ( let i = 0; i < attributeAccessors.length; i ++ ) {\n\n\t\t\tconst accessor = attributeAccessors[ i ];\n\t\t\ttarget[ i ] = accessor.getData( attributeIndex, this.object.geometry, target[ i ] );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetPropertyAttributeInfo() {\n\n\t\treturn this.attributeAccessors.map( acc => {\n\n\t\t\treturn {\n\t\t\t\tname: acc.name,\n\t\t\t\tclassName: acc.definition.class,\n\t\t\t};\n\n\t\t} );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.textureAccessors.forEach( acc => acc.dispose() );\n\t\tthis.tableAccessors.forEach( acc => acc.dispose() );\n\t\tthis.attributeAccessors.forEach( acc => acc.dispose() );\n\n\t}\n\n}\n","import { Vector2 } from 'three';\nimport { TextureReadUtility } from '../utilities/TextureReadUtility.js';\nimport { getTexCoord, getTexelIndices, getTriangleVertexIndices } from '../utilities/TexCoordUtilities.js';\n\nconst _uv = /* @__PURE__ */ new Vector2();\nconst _pixel = /* @__PURE__ */ new Vector2();\nconst _dstPixel = /* @__PURE__ */ new Vector2();\n\n// retrieve the appropriate UV attribute based on the tex coord index\nfunction getMaxBarycoordIndex( barycoord ) {\n\n\tif ( barycoord.x > barycoord.y && barycoord.x > barycoord.z ) {\n\n\t\treturn 0;\n\n\t} else if ( barycoord.y > barycoord.z ) {\n\n\t\treturn 1;\n\n\t} else {\n\n\t\treturn 2;\n\n\t}\n\n}\n\nexport class MeshFeatures {\n\n\tconstructor( geometry, textures, data ) {\n\n\t\tthis.geometry = geometry;\n\t\tthis.textures = textures;\n\t\tthis.data = data;\n\t\tthis._asyncRead = false;\n\n\t\t// fill out feature id default values\n\t\tthis.featureIds = data.featureIds.map( info => {\n\n\t\t\tconst { texture, ...rest } = info;\n\t\t\tconst result = {\n\t\t\t\tlabel: null,\n\t\t\t\tpropertyTable: null,\n\t\t\t\tnullFeatureId: null,\n\t\t\t\t...rest,\n\t\t\t};\n\n\t\t\tif ( texture ) {\n\n\t\t\t\tresult.texture = {\n\t\t\t\t\ttexCoord: 0,\n\t\t\t\t\tchannels: [ 0 ],\n\t\t\t\t\t...texture,\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\treturn result;\n\n\t\t} );\n\n\t}\n\n\t// returns list of textures\n\tgetTextures() {\n\n\t\treturn this.textures;\n\n\t}\n\n\t// returns a set of info for each feature\n\tgetFeatureInfo() {\n\n\t\treturn this.featureIds;\n\n\t}\n\n\t// performs texture data read back asynchronously\n\tgetFeaturesAsync( ...args ) {\n\n\t\tthis._asyncRead = true;\n\t\tconst result = this.getFeatures( ...args );\n\t\tthis._asyncRead = false;\n\t\treturn result;\n\n\t}\n\n\t// returns all features for the given point on the given triangle\n\tgetFeatures( triangle, barycoord ) {\n\n\t\tconst { geometry, textures, featureIds } = this;\n\t\tconst result = new Array( featureIds.length ).fill( null );\n\n\t\t// prep the canvas width\n\t\tconst width = featureIds.length;\n\t\tTextureReadUtility.increaseSizeTo( width );\n\n\t\t// get the attribute indices\n\t\tconst indices = getTriangleVertexIndices( geometry, triangle );\n\t\tconst closestIndex = indices[ getMaxBarycoordIndex( barycoord ) ];\n\t\tfor ( let i = 0, l = featureIds.length; i < l; i ++ ) {\n\n\t\t\t// the feature id from the closest point is returned\n\t\t\tconst featureId = featureIds[ i ];\n\t\t\tconst nullFeatureId = 'nullFeatureId' in featureId ? featureId.nullFeatureId : null;\n\t\t\tif ( 'texture' in featureId ) {\n\n\t\t\t\tconst texture = textures[ featureId.texture.index ];\n\n\t\t\t\t// get the attribute of the target tex coord and pixel\n\t\t\t\tgetTexCoord( geometry, featureId.texture.texCoord, barycoord, indices, _uv );\n\t\t\t\tgetTexelIndices( _uv, texture.image.width, texture.image.height, _pixel );\n\t\t\t\t_dstPixel.set( i, 0 );\n\n\t\t\t\t// draw the image\n\t\t\t\tTextureReadUtility.renderPixelToTarget( textures[ featureId.texture.index ], _pixel, _dstPixel );\n\n\t\t\t} else if ( 'attribute' in featureId ) {\n\n\t\t\t\tconst attr = geometry.getAttribute( `_feature_id_${ featureId.attribute }` );\n\t\t\t\tconst value = attr.getX( closestIndex );\n\t\t\t\tif ( value !== nullFeatureId ) {\n\n\t\t\t\t\tresult[ i ] = value;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// implicit id is based on vertex attributes, see 3d-tiles#763\n\t\t\t\tconst value = closestIndex;\n\t\t\t\tif ( value !== nullFeatureId ) {\n\n\t\t\t\t\tresult[ i ] = value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// read the buffer data\n\t\tconst buffer = new Uint8Array( width * 4 );\n\t\tif ( this._asyncRead ) {\n\n\t\t\treturn TextureReadUtility\n\t\t\t\t.readDataAsync( buffer )\n\t\t\t\t.then( () => {\n\n\t\t\t\t\treadTextureSampleResults();\n\t\t\t\t\treturn result;\n\n\t\t\t\t} );\n\n\t\t} else {\n\n\t\t\tTextureReadUtility.readData( buffer );\n\t\t\treadTextureSampleResults();\n\n\t\t\treturn result;\n\n\t\t}\n\n\t\tfunction readTextureSampleResults() {\n\n\t\t\t// get data based on the texture information\n\t\t\tconst readBuffer = new Uint32Array( 1 );\n\t\t\tfor ( let i = 0, l = featureIds.length; i < l; i ++ ) {\n\n\t\t\t\tconst featureId = featureIds[ i ];\n\t\t\t\tconst nullFeatureId = 'nullFeatureId' in featureId ? featureId.nullFeatureId : null;\n\t\t\t\tif ( 'texture' in featureId ) {\n\n\t\t\t\t\t// TODO: do we need to handle big-endian here?\n\t\t\t\t\tconst { channels } = featureId.texture;\n\t\t\t\t\tconst data = channels.map( c => buffer[ 4 * i + c ] );\n\t\t\t\t\tnew Uint8Array( readBuffer.buffer ).set( data );\n\n\t\t\t\t\tconst value = readBuffer[ 0 ];\n\t\t\t\t\tif ( value !== nullFeatureId ) {\n\n\t\t\t\t\t\tresult[ i ] = value;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// dispose all of the texture data used\n\tdispose() {\n\n\t\tthis.textures.forEach( texture => {\n\n\t\t\tif ( texture ) {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tif ( texture.image instanceof ImageBitmap ) {\n\n\t\t\t\t\ttexture.image.close();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n","import {\n Group,\n LoadingManager,\n Matrix4,\n Mesh,\n MeshStandardMaterial,\n Scene,\n Texture,\n Loader,\n} from \"three\";\nimport {\n acquireWorker,\n buildTextures,\n buildMaterials,\n buildMeshPrimitives,\n type PrimitiveData,\n getWorkers,\n} from \"./utils\";\nimport type { GLTFNodeData, GLTFWorkerData } from \"./types\";\nimport { StructuralMetadata } from \"3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/StructuralMetadata.js\";\nimport { MeshFeatures } from \"3d-tiles-renderer/src/three/plugins/gltf/metadata/classes/MeshFeatures.js\";\n\n// Extension names\nconst EXT_STRUCTURAL_METADATA = \"EXT_structural_metadata\";\nconst EXT_MESH_FEATURES = \"EXT_mesh_features\";\n\n/**\n * GLTFWorkerLoader 配置选项\n */\nexport interface GLTFWorkerLoaderOptions {\n /** 是否启用 metadata 支持 (EXT_mesh_features, EXT_structural_metadata) */\n metadata?: boolean;\n}\n\nlet uuid = 0;\n\n/**\n * 使用 Worker 解析 GLTF 的自定义 Loader\n */\nexport class GLTFWorkerLoader extends Loader {\n private _metadata: boolean = true;\n private _loaderId = uuid++;\n private _callbacks = new Map<\n number,\n { resolve: (data: any) => void; reject: (err: Error) => void }\n >();\n private _nextRequestId = 1;\n\n constructor(manager?: LoadingManager, options?: GLTFWorkerLoaderOptions) {\n super(manager);\n this._metadata = options?.metadata ?? true;\n\n this.addListeners();\n }\n\n addListeners() {\n const workers = getWorkers();\n workers.forEach((worker) => {\n worker.addEventListener(\"message\", this._onMessage);\n });\n }\n\n removeListeners() {\n const workers = getWorkers();\n workers.forEach((worker) => {\n worker.removeEventListener(\"message\", this._onMessage);\n });\n }\n\n /**\n * 异步解析 GLTF buffer\n */\n async parseAsync(buffer: ArrayBuffer, path: string): Promise<any> {\n // 获取可用 Worker(如果都忙则等待)\n const worker = acquireWorker();\n\n // 使用 worker 解析\n const data = await this.parseWithWorker(worker, buffer, path);\n\n // 构建 Three.js 场景\n const scene = this.buildSceneFromGLTFData(data);\n\n // 返回与GLTFLoader相同的格式\n return {\n scene: scene,\n scenes: [scene],\n animations: [],\n cameras: [],\n asset: {\n generator: \"GLTFWorkerLoader\",\n version: \"2.0\",\n },\n parser: null as any,\n userData: {},\n };\n }\n\n /**\n * 使用 Worker 解析 GLTF 数据\n */\n private parseWithWorker(\n worker: Worker,\n buffer: ArrayBuffer,\n workingPath: string,\n ): Promise<GLTFWorkerData> {\n return new Promise((resolve, reject) => {\n const requestId = this._nextRequestId++;\n this._callbacks.set(requestId, { resolve, reject });\n\n // 发送 buffer 和工作路径给 worker\n worker.postMessage(\n {\n method: \"parseTile\",\n buffer: buffer,\n root: workingPath,\n loaderId: this._loaderId, // Use requestId as loaderId for the worker\n requestId,\n },\n [buffer],\n );\n });\n }\n\n private _onMessage = (event: MessageEvent) => {\n const { type, data, error, loaderId, requestId } = event.data;\n\n // loaderId here is our requestId\n if (loaderId !== this._loaderId) return;\n const callback = this._callbacks.get(requestId);\n if (!callback) return;\n\n this._callbacks.delete(requestId);\n\n if (type === \"success\") {\n callback.resolve(data);\n } else if (type === \"error\") {\n callback.reject(new Error(error));\n }\n };\n\n /**\n * 将 Worker 返回的 GLTF 数据转换成 Three.js Scene\n */\n private buildSceneFromGLTFData(data: GLTFWorkerData): Scene {\n const scene = new Scene();\n\n // 构建纹理\n const { textureMap, textureArray } = buildTextures(data);\n\n // 构建材质\n const materialMap = buildMaterials(data, textureMap);\n\n // 创建默认材质\n const defaultMaterial = new MeshStandardMaterial({ color: 0xcccccc });\n\n // 构建 mesh primitives\n const meshMap = buildMeshPrimitives(data, materialMap, defaultMaterial);\n\n // 解析节点\n const parseNodeData = (nodeData: GLTFNodeData): Group => {\n const node = new Group();\n\n const primitiveDataList = meshMap.get(nodeData.mesh);\n if (primitiveDataList) {\n for (const {\n geometry,\n material,\n primitiveIndex,\n } of primitiveDataList) {\n const mesh = new Mesh(geometry, material);\n // 记录 mesh 对应的原始 GLTF 索引\n mesh.userData._gltfMeshIndex = nodeData.mesh;\n mesh.userData._gltfPrimitiveIndex = primitiveIndex;\n node.add(mesh);\n }\n }\n\n // 设置节点名称\n if (nodeData.name) {\n node.name = nodeData.name;\n }\n\n // 应用变换\n if (nodeData.matrix) {\n const m = new Matrix4();\n m.fromArray(nodeData.matrix);\n node.applyMatrix4(m);\n } else {\n if (nodeData.translation) {\n node.position.set(\n nodeData.translation[0],\n nodeData.translation[1],\n nodeData.translation[2],\n );\n }\n if (nodeData.rotation) {\n node.quaternion.set(\n nodeData.rotation[0],\n nodeData.rotation[1],\n nodeData.rotation[2],\n nodeData.rotation[3],\n );\n }\n if (nodeData.scale) {\n node.scale.set(\n nodeData.scale[0],\n nodeData.scale[1],\n nodeData.scale[2],\n );\n }\n }\n\n // 递归处理子节点\n if (nodeData.children && Array.isArray(nodeData.children)) {\n for (const child of nodeData.children) {\n const childNode = parseNodeData(child);\n node.add(childNode);\n }\n }\n\n return node;\n };\n\n // 添加场景节点\n const sceneData = data.scenes[0];\n for (const nodeData of sceneData.nodes) {\n const node = parseNodeData(nodeData);\n scene.add(node);\n }\n\n // 处理 metadata (如果启用)\n if (this._metadata) {\n this.processMetadata(scene, data, textureArray, meshMap);\n }\n\n return scene;\n }\n\n /**\n * 处理并挂载 metadata 到场景和 mesh 对象\n */\n private processMetadata(\n scene: Scene,\n data: GLTFWorkerData,\n textures: (Texture | null)[],\n meshMap: Map<number, PrimitiveData[]>,\n ): void {\n const extensionsUsed = data.json?.extensionsUsed || [];\n const hasStructuralMetadata = extensionsUsed.includes(\n EXT_STRUCTURAL_METADATA,\n );\n const hasMeshFeatures = extensionsUsed.includes(EXT_MESH_FEATURES);\n\n if (!hasStructuralMetadata && !hasMeshFeatures) {\n return;\n }\n\n // 处理 EXT_structural_metadata\n let rootMetadata: any = null;\n if (hasStructuralMetadata && data.structuralMetadata) {\n const rootExtension = data.json?.extensions?.[EXT_STRUCTURAL_METADATA];\n if (rootExtension) {\n const definition = {\n schema: data.structuralMetadata.schema,\n propertyTables: data.structuralMetadata.propertyTables || [],\n propertyTextures: rootExtension.propertyTextures || [],\n propertyAttributes: rootExtension.propertyAttributes || [],\n };\n\n const buffers = data.structuralMetadata.buffers || [];\n rootMetadata = new StructuralMetadata(definition, textures, buffers);\n scene.userData.structuralMetadata = rootMetadata;\n }\n }\n\n // 遍历场景中的所有 mesh,处理 mesh-level metadata\n scene.traverse((child) => {\n if (!(child instanceof Mesh)) return;\n\n const meshIndex = child.userData._gltfMeshIndex as number | undefined;\n const primitiveIndex = child.userData._gltfPrimitiveIndex as number | undefined;\n if (meshIndex === undefined || primitiveIndex === undefined) return;\n\n const primitiveDataList = meshMap.get(meshIndex);\n if (!primitiveDataList) return;\n\n const primitiveData = primitiveDataList.find(\n (p) => p.primitiveIndex === primitiveIndex,\n );\n if (!primitiveData) return;\n\n const extensions = primitiveData.extensions;\n\n // 处理 EXT_structural_metadata (primitive level)\n if (hasStructuralMetadata && rootMetadata) {\n const primMetadataExt = extensions?.[EXT_STRUCTURAL_METADATA];\n if (primMetadataExt) {\n const rootExtension =\n data.json?.extensions?.[EXT_STRUCTURAL_METADATA];\n if (rootExtension) {\n const definition = {\n schema: data.structuralMetadata!.schema,\n propertyTables: data.structuralMetadata!.propertyTables || [],\n propertyTextures: rootExtension.propertyTextures || [],\n propertyAttributes: rootExtension.propertyAttributes || [],\n };\n const buffers = data.structuralMetadata!.buffers || [];\n\n child.userData.structuralMetadata = new StructuralMetadata(\n definition,\n textures,\n buffers,\n primMetadataExt,\n child,\n );\n }\n } else {\n child.userData.structuralMetadata = rootMetadata;\n }\n }\n\n // 处理 EXT_mesh_features\n if (hasMeshFeatures) {\n const meshFeaturesExt = extensions?.[EXT_MESH_FEATURES];\n if (meshFeaturesExt) {\n child.userData.meshFeatures = new MeshFeatures(\n child.geometry,\n textures,\n meshFeaturesExt,\n );\n }\n }\n });\n }\n}\n","import {\n DataTexture,\n RGBAFormat,\n SRGBColorSpace,\n Texture,\n UnsignedByteType,\n} from \"three\";\nimport type { GLTFWorkerData } from \"../types\";\n\nexport interface TextureBuildResult {\n textureMap: Map<number, Texture>;\n textureArray: (Texture | null)[];\n}\n\n/**\n * 从 GLTF 数据构建纹理\n */\nexport function buildTextures(data: GLTFWorkerData): TextureBuildResult {\n const textureMap = new Map<number, Texture>();\n const textureArray: (Texture | null)[] = [];\n\n if (!data.textures) {\n return { textureMap, textureArray };\n }\n\n for (const [index, textureData] of data.textures.entries()) {\n if (textureData.image && textureData.image.array) {\n const imageData = textureData.image;\n const tex = new DataTexture(\n imageData.array,\n imageData.width,\n imageData.height,\n RGBAFormat,\n UnsignedByteType,\n );\n tex.flipY = false;\n tex.colorSpace = SRGBColorSpace;\n tex.needsUpdate = true;\n textureMap.set(index, tex);\n textureArray[index] = tex;\n continue;\n }\n\n // 默认空纹理\n const texture = new Texture();\n texture.flipY = false;\n textureMap.set(index, texture);\n textureArray[index] = texture;\n }\n\n return { textureMap, textureArray };\n}\n","import {\n DoubleSide,\n FrontSide,\n MeshStandardMaterial,\n Texture,\n} from \"three\";\nimport type { GLTFWorkerData } from \"../types\";\n\n/**\n * 从 GLTF 数据构建材质\n */\nexport function buildMaterials(\n data: GLTFWorkerData,\n textureMap: Map<number, Texture>,\n): Map<number, MeshStandardMaterial> {\n const materialMap = new Map<number, MeshStandardMaterial>();\n\n if (!data.materials) {\n return materialMap;\n }\n\n for (const [index, matData] of data.materials.entries()) {\n const material = new MeshStandardMaterial();\n\n // PBR材质属性\n if (matData.pbrMetallicRoughness) {\n const pbr = matData.pbrMetallicRoughness;\n\n // 基础颜色\n if (pbr.baseColorFactor) {\n material.color.setRGB(\n pbr.baseColorFactor[0],\n pbr.baseColorFactor[1],\n pbr.baseColorFactor[2],\n );\n if (pbr.baseColorFactor[3] !== undefined) {\n material.opacity = pbr.baseColorFactor[3];\n if (material.opacity < 1) material.transparent = true;\n }\n }\n\n // 基础颜色纹理\n if (pbr.baseColorTexture && pbr.baseColorTexture.index !== undefined) {\n const tex = textureMap.get(pbr.baseColorTexture.index);\n if (tex) {\n material.map = tex;\n }\n }\n\n // 金属度和粗糙度\n material.metalness =\n pbr.metallicFactor !== undefined ? pbr.metallicFactor : 1.0;\n material.roughness =\n pbr.roughnessFactor !== undefined ? pbr.roughnessFactor : 1.0;\n\n // 金属粗糙度纹理\n if (\n pbr.metallicRoughnessTexture &&\n pbr.metallicRoughnessTexture.index !== undefined\n ) {\n const tex = textureMap.get(pbr.metallicRoughnessTexture.index);\n if (tex) {\n material.metalnessMap = material.roughnessMap = tex;\n }\n }\n }\n\n // 法线贴图\n if (matData.normalTexture && matData.normalTexture.index !== undefined) {\n const tex = textureMap.get(matData.normalTexture.index);\n if (tex) {\n material.normalMap = tex;\n if (matData.normalTexture.scale !== undefined) {\n material.normalScale.set(\n matData.normalTexture.scale,\n matData.normalTexture.scale,\n );\n }\n }\n }\n\n // 遮蔽贴图\n if (\n matData.occlusionTexture &&\n matData.occlusionTexture.index !== undefined\n ) {\n const tex = textureMap.get(matData.occlusionTexture.index);\n if (tex) {\n material.aoMap = tex;\n }\n }\n\n // 自发光\n if (\n matData.emissiveTexture &&\n matData.emissiveTexture.index !== undefined\n ) {\n const tex = textureMap.get(matData.emissiveTexture.index);\n if (tex) {\n material.emissiveMap = tex;\n }\n }\n if (matData.emissiveFactor) {\n material.emissive.setRGB(\n matData.emissiveFactor[0],\n matData.emissiveFactor[1],\n matData.emissiveFactor[2],\n );\n }\n\n // 双面渲染\n material.side = matData.doubleSided ? DoubleSide : FrontSide;\n\n // Alpha模式\n if (matData.alphaMode === \"BLEND\") {\n material.transparent = true;\n } else if (matData.alphaMode === \"MASK\") {\n material.alphaTest =\n matData.alphaCutoff !== undefined ? matData.alphaCutoff : 0.5;\n }\n\n materialMap.set(index, material);\n }\n\n return materialMap;\n}\n","import { BufferAttribute, BufferGeometry, MeshStandardMaterial } from \"three\";\nimport type { GLTFWorkerData, PrimitiveExtensions } from \"../types\";\n\nexport interface PrimitiveData {\n geometry: BufferGeometry;\n material: MeshStandardMaterial;\n primitiveIndex: number;\n extensions?: PrimitiveExtensions;\n}\n\n/**\n * 从 GLTF 数据构建 Mesh Primitives\n */\nexport function buildMeshPrimitives(\n data: GLTFWorkerData,\n materialMap: Map<number, MeshStandardMaterial>,\n defaultMaterial: MeshStandardMaterial,\n): Map<number, PrimitiveData[]> {\n const meshMap = new Map<number, PrimitiveData[]>();\n\n if (!data.meshes) {\n return meshMap;\n }\n\n for (const meshIndex in data.meshes) {\n const meshData = data.meshes[meshIndex];\n const primitiveDataList: PrimitiveData[] = [];\n const primitives = meshData.primitives;\n\n for (\n let primitiveIndex = 0;\n primitiveIndex < primitives.length;\n primitiveIndex++\n ) {\n const primitive = primitives[primitiveIndex];\n const geometry = new BufferGeometry();\n\n // 处理顶点属性\n if (primitive.attributes) {\n // 位置\n const posData = primitive.attributes.POSITION;\n if (posData && posData.array) {\n geometry.setAttribute(\n \"position\",\n new BufferAttribute(posData.array, posData.itemSize || 3),\n );\n }\n\n // 法线\n const normalData = primitive.attributes.NORMAL;\n if (normalData && normalData.array) {\n geometry.setAttribute(\n \"normal\",\n new BufferAttribute(normalData.array, normalData.itemSize || 3),\n );\n }\n\n // UV坐标\n const uvData = primitive.attributes.TEXCOORD_0;\n if (uvData && uvData.array) {\n geometry.setAttribute(\n \"uv\",\n new BufferAttribute(uvData.array, uvData.itemSize || 2),\n );\n }\n\n // 顶点颜色\n const colorData = primitive.attributes.COLOR_0;\n if (colorData && colorData.array) {\n geometry.setAttribute(\n \"color\",\n new BufferAttribute(colorData.array, colorData.itemSize || 3),\n );\n }\n\n // 切线\n const tangentData = primitive.attributes.TANGENT;\n if (tangentData && tangentData.array) {\n geometry.setAttribute(\n \"tangent\",\n new BufferAttribute(tangentData.array, tangentData.itemSize || 4),\n );\n }\n\n // Feature ID 属性 (用于 EXT_mesh_features)\n for (const attrName in primitive.attributes) {\n if (attrName.startsWith(\"_FEATURE_ID_\")) {\n const featureIdData = primitive.attributes[attrName];\n if (featureIdData && featureIdData.array) {\n const normalizedName = attrName\n .toLowerCase()\n .replace(\"_feature_id_\", \"_feature_id_\");\n geometry.setAttribute(\n normalizedName,\n new BufferAttribute(featureIdData.array, featureIdData.itemSize || 1),\n );\n }\n }\n }\n }\n\n // 索引\n const indexData = primitive.indices;\n if (indexData && indexData.array) {\n geometry.setIndex(new BufferAttribute(indexData.array, 1));\n }\n\n // 获取材质\n const material =\n primitive.material !== undefined\n ? materialMap.get(primitive.material) || defaultMaterial\n : defaultMaterial;\n\n primitiveDataList.push({\n geometry,\n material,\n primitiveIndex,\n extensions: primitive.extensions,\n });\n }\n\n meshMap.set(Number(meshIndex), primitiveDataList);\n }\n\n return meshMap;\n}\n","import { GLTFWorkerLoader } from \"./GLTFWorkerLoader\";\r\nimport { setMaxWorkers } from \"./utils\";\r\n\r\n/**\r\n * GLTFParserPlugin 配置选项\r\n */\r\nexport interface GLTFParserPluginOptions {\r\n /**\r\n * 是否启用 metadata 支持\r\n * 包括 EXT_mesh_features 和 EXT_structural_metadata 扩展\r\n * @default true\r\n */\r\n metadata?: boolean;\r\n /**\r\n * Worker 池中最大 Worker 数量\r\n * 最大值为 navigator.hardwareConcurrency\r\n * @default navigator.hardwareConcurrency\r\n */\r\n maxWorkers?: number;\r\n}\r\n\r\nexport class GLTFParserPlugin {\r\n name = \"GLTFParserPlugin\";\r\n\r\n private tiles: any = null;\r\n private _loader: GLTFWorkerLoader | null = null;\r\n private readonly _gltfRegex = /\\.(gltf|glb)$/g;\r\n private readonly _options: GLTFParserPluginOptions;\r\n\r\n /**\r\n * 创建 GLTFParserPlugin 实例\r\n * @param options 配置选项\r\n */\r\n constructor(options?: GLTFParserPluginOptions) {\r\n console.log(\"GLTFParserPlugin constructor\");\r\n this._options = {\r\n metadata: true,\r\n maxWorkers: navigator.hardwareConcurrency || 4,\r\n ...options,\r\n };\r\n\r\n // 设置 Worker 池大小并初始化\r\n setMaxWorkers(this._options.maxWorkers!);\r\n }\r\n\r\n /**\r\n * 插件初始化,由 TilesRenderer 调用\r\n */\r\n init(tiles: any) {\r\n this.tiles = tiles;\r\n\r\n // 创建自定义 loader 并注册,传入 metadata 选项\r\n this._loader = new GLTFWorkerLoader(tiles.manager, {\r\n metadata: this._options.metadata,\r\n });\r\n\r\n // 使用正则表达式匹配 .gltf 和 .glb 文件\r\n tiles.manager.addHandler(this._gltfRegex, this._loader);\r\n }\r\n\r\n /**\r\n * 插件销毁\r\n */\r\n dispose() {\r\n // 移除 handler\r\n if (this.tiles) {\r\n this.tiles.manager.removeHandler(this._gltfRegex);\r\n }\r\n\r\n // 移除 Worker 监听器\r\n if (this._loader) {\r\n this._loader.removeListeners();\r\n }\r\n this._loader = null;\r\n this.tiles = null;\r\n }\r\n}\r\n"],"names":["workerPool","maxWorkers","currentWorkerIndex","createWorker","GLTFWorkerClass","initWorkerPool","length","i","push","getWorkers","getField","object","key","def","isNumericType","type","isVectorType","test","isMatrixType","readDataFromBufferToType","buffer","offset","target","fromArray","getTypeInstance","property","componentType","Vector2","Vector3","Vector4","Matrix2","Matrix3","Matrix4","isTypeInstance","value","isVector2","isVector3","isVector4","isMatrix2","isMatrix3","isMatrix4","Error","getArrayConstructorFromComponentType","Int8Array","Int16Array","Int32Array","BigInt64Array","Uint8Array","Uint16Array","Uint32Array","BigUint64Array","Float32Array","Float64Array","resolveDefaultElement","defaultValue","default","set","identity","initializeFromProperty","overrideCount","array","Array","isArray","count","l","initializeFromClass","properties","prop","ClassProperty","constructor","enums","accessorProperty","this","name","description","enumType","normalized","scale","max","Infinity","min","required","noData","semantic","enumSet","shapeToProperty","countOverride","resolveDefault","resolveNoData","performResolution","elements","getComponent","isNoDataEqual","resolveEnumsToStrings","getEnumName","index","match","values","find","e","adjustValueScaleOffset","adjustFromType","adjustScalar","adjustMatrix","x","y","z","w","adjustVector","v","Math","Number","normalizeValue","isFloatComponentType","PropertySetAccessor","definition","classes","data","class","className","getPropertyNames","Object","keys","includesData","Boolean","dispose","_initProperties","propertyClass","PropertyAttributeClassProperty","classProperty","attributeProperty","super","attribute","PropertyAttributeAccessor","args","isPropertyAttributeAccessor","getData","id","geometry","getPropertyValue","getAttribute","toLowerCase","fromBufferAttribute","getX","PropertyTableClassProperty","tableProperty","valueLength","typeToComponentCount","arrayOffsets","stringOffsets","arrayOffsetType","stringOffsetType","getArrayLengthFromId","buffers","arr","getIndexOffsetFromId","indexOffset","PropertyTableAccessor","isPropertyTableAccessor","_readValueAtIndex","bufferView","dataArray","stringIndex","stringLength","stringOffsetBuffer","byteArray","TextDecoder","decode","bitIndex","floor","_camera","OrthographicCamera","_geometry","BufferGeometry","setAttribute","Float32BufferAttribute","FullScreenQuad","material","_mesh","Mesh","render","renderer","_box","Box2","_TextureReadUtility","_renderer","WebGLRenderer","_target","WebGLRenderTarget","_texTarget","_quad","ShaderMaterial","blending","CustomBlending","blendDst","ZeroFactor","blendSrc","OneFactor","uniforms","map","pixel","vertexShader","fragmentShader","increaseSizeTo","width","setSize","readDataAsync","readRenderTargetPixelsAsync","readData","readRenderTargetPixels","renderPixelToTarget","texture","dstPixel","copy","initRenderTarget","copyTextureToTexture","TextureReadUtility","reader","getOwnPropertyNames","prototype","forEach","_uv0","_uv1","_uv2","getTriangleVertexIndices","faceIndex","i0","i1","i2","getTexCoord","texCoord","barycoord","indices","attr","getTextureCoordAttribute","addScaledVector","getTexelIndices","uv","height","fx","fy","px","py","_uv","_srcPixel","_dstPixel","PropertyTextureClassProperty","textureProperty","channels","parseInt","replace","readDataFromBuffer","PropertyTextureAccessor","isPropertyTextureAccessor","_asyncRead","names","results","n","getPropertyValuesAtTexel","getDataAsync","getPropertyValuesAtTexelAsync","result","textures","accessorProperties","image","then","readTextureSampleResults","call","c","readBuffer","j","lj","ImageBitmap","close","StructuralMetadata","nodeMetadata","schema","propertyTables","propertyTextures","propertyAttributes","tableAccessors","t","textureAccessors","attributeAccessors","getPropertyTableData","tableIndices","ids","table","getPropertyTableInfo","getPropertyTextureData","triangle","accessor","getPropertyTextureDataAsync","promises","promise","Promise","all","getPropertyTextureInfo","getPropertyAttributeData","attributeIndex","getPropertyAttributeInfo","acc","_pixel","MeshFeatures","featureIds","info","rest","label","propertyTable","nullFeatureId","getTextures","getFeatureInfo","getFeaturesAsync","getFeatures","fill","closestIndex","getMaxBarycoordIndex","featureId","EXT_STRUCTURAL_METADATA","EXT_MESH_FEATURES","uuid","GLTFWorkerLoader","Loader","_metadata","_loaderId","_callbacks","Map","_nextRequestId","manager","options","metadata","addListeners","worker","addEventListener","_onMessage","removeListeners","removeEventListener","parseAsync","path","acquireWorker","parseWithWorker","scene","buildSceneFromGLTFData","scenes","animations","cameras","asset","generator","version","parser","userData","workingPath","resolve","reject","requestId","postMessage","method","root","loaderId","event","error","callback","get","delete","Scene","textureMap","textureArray","textureData","entries","imageData","tex","DataTexture","RGBAFormat","UnsignedByteType","flipY","colorSpace","SRGBColorSpace","needsUpdate","Texture","buildTextures","materialMap","materials","matData","MeshStandardMaterial","pbrMetallicRoughness","pbr","baseColorFactor","color","setRGB","opacity","transparent","baseColorTexture","metalness","metallicFactor","roughness","roughnessFactor","metallicRoughnessTexture","metalnessMap","roughnessMap","normalTexture","normalMap","normalScale","occlusionTexture","aoMap","emissiveTexture","emissiveMap","emissiveFactor","emissive","side","doubleSided","DoubleSide","FrontSide","alphaMode","alphaTest","alphaCutoff","buildMaterials","meshMap","defaultMaterial","meshes","meshIndex","primitiveDataList","primitives","primitiveIndex","primitive","attributes","posData","POSITION","BufferAttribute","itemSize","normalData","NORMAL","uvData","TEXCOORD_0","colorData","COLOR_0","tangentData","TANGENT","attrName","startsWith","featureIdData","normalizedName","indexData","setIndex","extensions","buildMeshPrimitives","parseNodeData","nodeData","node","Group","mesh","_gltfMeshIndex","_gltfPrimitiveIndex","add","matrix","m","applyMatrix4","translation","position","rotation","quaternion","children","child","childNode","sceneData","nodes","processMetadata","extensionsUsed","json","hasStructuralMetadata","includes","hasMeshFeatures","rootMetadata","structuralMetadata","rootExtension","traverse","primitiveData","p","primMetadataExt","meshFeaturesExt","meshFeatures","GLTFParserPlugin","tiles","_loader","_gltfRegex","_options","navigator","hardwareConcurrency","init","addHandler","removeHandler"],"mappings":"usi/BAIA,IAAIA,EAAuB,GACvBC,EAAa,EACbC,EAAqB,EAYzB,SAASC,IACP,OAAO,IAAIC,CACb,CAKA,SAASC,IACP,GAA0B,IAAtBL,EAAWM,OAEb,IAAA,IAASC,EAAI,EAAGA,EAAIN,EAAYM,IAC9BP,EAAWQ,KAAKL,IAGtB,CAEO,SAASM,IAEd,OADAJ,IACOL,CACT,CC3BO,SAASU,EAAUC,EAAQC,EAAKC,GAEtC,OAAOF,GAAUC,KAAOD,EAASA,EAAQC,GAAQC,CAElD,CAGO,SAASC,EAAeC,GAE9B,MAAgB,YAATA,GAA+B,WAATA,GAA8B,SAATA,CAEnD,CAUO,SAASC,EAAcD,GAE7B,MAAO,OAAOE,KAAMF,EAErB,CAGO,SAASG,EAAcH,GAE7B,MA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