@loaders.gl/gltf 4.0.0-alpha.22 → 4.0.0-alpha.24
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/dist.min.js +3626 -3028
- package/dist/es5/index.js +21 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/api/gltf-extensions.js +3 -1
- package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_mesh_features.js +111 -0
- package/dist/es5/lib/extensions/EXT_mesh_features.js.map +1 -0
- package/dist/es5/lib/extensions/EXT_structural_metadata.js +388 -0
- package/dist/es5/lib/extensions/EXT_structural_metadata.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +32 -22
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/es5/lib/extensions/utils/3d-tiles-utils.js +200 -0
- package/dist/es5/lib/extensions/utils/3d-tiles-utils.js.map +1 -0
- package/dist/es5/lib/types/gltf-ext-mesh-features-schema.js +2 -0
- package/dist/es5/lib/types/gltf-ext-mesh-features-schema.js.map +1 -0
- package/dist/es5/lib/types/gltf-ext-structural-metadata-schema.js +2 -0
- package/dist/es5/lib/types/gltf-ext-structural-metadata-schema.js.map +1 -0
- package/dist/es5/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api/gltf-extensions.js +3 -1
- package/dist/esm/lib/api/gltf-extensions.js.map +1 -1
- package/dist/esm/lib/extensions/EXT_mesh_features.js +55 -0
- package/dist/esm/lib/extensions/EXT_mesh_features.js.map +1 -0
- package/dist/esm/lib/extensions/EXT_structural_metadata.js +324 -0
- package/dist/esm/lib/extensions/EXT_structural_metadata.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +30 -20
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/esm/lib/extensions/utils/3d-tiles-utils.js +164 -0
- package/dist/esm/lib/extensions/utils/3d-tiles-utils.js.map +1 -0
- package/dist/esm/lib/types/gltf-ext-mesh-features-schema.js +2 -0
- package/dist/esm/lib/types/gltf-ext-mesh-features-schema.js.map +1 -0
- package/dist/esm/lib/types/gltf-ext-structural-metadata-schema.js +2 -0
- package/dist/esm/lib/types/gltf-ext-structural-metadata-schema.js.map +1 -0
- package/dist/esm/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/lib/extensions/EXT_mesh_features.d.ts +7 -0
- package/dist/lib/extensions/EXT_mesh_features.d.ts.map +1 -0
- package/dist/lib/extensions/EXT_structural_metadata.d.ts +17 -0
- package/dist/lib/extensions/EXT_structural_metadata.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -1
- package/dist/lib/extensions/utils/3d-tiles-utils.d.ts +52 -0
- package/dist/lib/extensions/utils/3d-tiles-utils.d.ts.map +1 -0
- package/dist/lib/types/gltf-ext-mesh-features-schema.d.ts +45 -0
- package/dist/lib/types/gltf-ext-mesh-features-schema.d.ts.map +1 -0
- package/dist/lib/types/gltf-ext-structural-metadata-schema.d.ts +310 -0
- package/dist/lib/types/gltf-ext-structural-metadata-schema.d.ts.map +1 -0
- package/dist/lib/types/gltf-json-schema.d.ts +12 -58
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +11 -3
- package/src/lib/api/gltf-extensions.ts +6 -2
- package/src/lib/extensions/EXT_mesh_features.ts +117 -0
- package/src/lib/extensions/EXT_structural_metadata.ts +797 -0
- package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +129 -36
- package/src/lib/extensions/utils/3d-tiles-utils.ts +325 -0
- package/src/lib/types/gltf-ext-mesh-features-schema.ts +48 -0
- package/src/lib/types/gltf-ext-structural-metadata-schema.ts +359 -0
- package/src/lib/types/gltf-json-schema.ts +13 -61
- package/dist/bundle.js +0 -5
- package/dist/glb-loader.js +0 -34
- package/dist/glb-writer.js +0 -35
- package/dist/gltf-loader.js +0 -50
- package/dist/gltf-writer.js +0 -32
- package/dist/index.js +0 -28
- package/dist/lib/api/gltf-extensions.js +0 -83
- package/dist/lib/api/gltf-scenegraph.js +0 -580
- package/dist/lib/api/normalize-gltf-v1.js +0 -299
- package/dist/lib/api/post-process-gltf.js +0 -433
- package/dist/lib/encoders/encode-glb.js +0 -72
- package/dist/lib/encoders/encode-gltf.js +0 -32
- package/dist/lib/extensions/EXT_meshopt_compression.js +0 -41
- package/dist/lib/extensions/EXT_texture_webp.js +0 -36
- package/dist/lib/extensions/KHR_binary_gltf.js +0 -39
- package/dist/lib/extensions/KHR_draco_mesh_compression.js +0 -137
- package/dist/lib/extensions/KHR_texture_basisu.js +0 -29
- package/dist/lib/extensions/KHR_texture_transform.js +0 -227
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +0 -291
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.js +0 -59
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +0 -44
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +0 -79
- package/dist/lib/gltf-utils/get-typed-array.js +0 -41
- package/dist/lib/gltf-utils/gltf-attribute-utils.js +0 -73
- package/dist/lib/gltf-utils/gltf-constants.js +0 -43
- package/dist/lib/gltf-utils/gltf-utils.js +0 -90
- package/dist/lib/gltf-utils/resolve-url.js +0 -18
- package/dist/lib/parsers/parse-glb.js +0 -166
- package/dist/lib/parsers/parse-gltf.js +0 -185
- package/dist/lib/types/glb-types.js +0 -2
- package/dist/lib/types/gltf-json-schema.js +0 -4
- package/dist/lib/types/gltf-postprocessed-schema.js +0 -4
- package/dist/lib/types/gltf-types.js +0 -3
- package/dist/lib/utils/assert.js +0 -12
- package/dist/lib/utils/version.js +0 -7
- package/dist/meshopt/meshopt-decoder.js +0 -118
- package/dist/webp/webp.js +0 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EXT_feature_metadata.js","names":["_gltfScenegraph","require","_images","_gltfUtils","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","EXT_FEATURE_METADATA","exports","decode","_x","_x2","_decode","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","gltfData","options","scenegraph","wrap","_callee$","_context","prev","GLTFScenegraph","decodeExtFeatureMetadata","stop","_extension$schema","_options$gltf","extension","getExtension","schemaClasses","schema","classes","featureTables","schemaName","schemaClass","featureTable","findFeatureTableByName","handleFeatureTableProperties","featureTextures","gltf","loadImages","featureTexture","findFeatureTextureByName","handleFeatureTextureProperties","propertyName","properties","_featureTable$propert","schemaProperty","featureTableProperty","numberOfFeatures","count","data","getPropertyDataFromBinarySource","attributeName","class","_featureTexture$prope","featureTextureProperty","getPropertyDataFromTexture","bufferView","dataArray","getTypedArrayForBufferView","type","stringOffsetBufferView","offsetsData","getStringAttributes","json","meshes","featureTextureTable","_iterator","_step","mesh","_iterator2","primitives","_step2","primitive","processPrimitiveTextures","_json$textures","textureData","texCoordAccessorKey","concat","texture","texCoord","texCoordAccessorIndex","attributes","texCoordBufferView","getBufferView","texCoordArray","textureCoordinates","Float32Array","buffer","byteOffset","textureIndex","index","textures","imageIndex","source","_json$images","_scenegraph$gltf$imag","image","images","mimeType","parsedImage","getImageValueByCoordinates","channels","push","featureIndices","_loop","texelData","_textureData","_i","findIndex","item","typedArray","Uint32Array","bufferIndex","buffers","arrayBuffer","byteLength","bufferViewIndex","addBufferView","accessorIndex","addAccessor","size","componentType","getComponentTypeFromArray","CHANNELS_MAP","r","offset","shift","g","b","a","u","v","components","indexOf","coordinatesToOffset","_iterator3","_step3","c","map","val","getVal","imageData","getImageData","Error","componentsCount","undefined","w","width","iX","emod","indX","Math","round","h","height","iY","indY","schemaClassName","featureTableName","featureTexturesName","stringsCount","stringsArray","textDecoder","TextDecoder","stringOffset","bytesPerStringSize","stringByteSize","stringData","subarray","stringAttribute"],"sources":["../../../../../src/lib/extensions/deprecated/EXT_feature_metadata.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport type {\n GLTF,\n GLTF_EXT_feature_metadata_Class,\n GLTF_EXT_feature_metadata_ClassProperty,\n GLTF_EXT_feature_metadata_FeatureTable,\n GLTF_EXT_feature_metadata_FeatureTableProperty,\n GLTF_EXT_feature_metadata_FeatureTexture,\n GLTF_EXT_feature_metadata_GLTF,\n GLTF_EXT_feature_metadata_TextureAccessor\n} from '../../types/gltf-json-schema';\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\nimport {getImageData} from '@loaders.gl/images';\nimport {GLTFMeshPrimitive} from '../../types/gltf-json-schema';\nimport {getComponentTypeFromArray} from '../../gltf-utils/gltf-utils';\nimport {GLTFLoaderOptions} from '../../../gltf-loader';\n\n/** Extension name */\nconst EXT_FEATURE_METADATA = 'EXT_feature_metadata';\n\nexport const name = EXT_FEATURE_METADATA;\n\nexport async function decode(gltfData: {json: GLTF}, options: GLTFLoaderOptions): Promise<void> {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtFeatureMetadata(scenegraph, options);\n}\n\n/**\n * Decodes feature metadata from extension\n * @param scenegraph\n */\nfunction decodeExtFeatureMetadata(scenegraph: GLTFScenegraph, options: GLTFLoaderOptions): void {\n const extension: GLTF_EXT_feature_metadata_GLTF | null =\n scenegraph.getExtension(EXT_FEATURE_METADATA);\n if (!extension) return;\n\n const schemaClasses = extension.schema?.classes;\n\n const {featureTables} = extension;\n if (schemaClasses && featureTables) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTable = findFeatureTableByName(featureTables, schemaName);\n\n if (featureTable) {\n handleFeatureTableProperties(scenegraph, featureTable, schemaClass);\n }\n }\n }\n\n const {featureTextures} = extension;\n if (schemaClasses && featureTextures && options.gltf?.loadImages) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTexture = findFeatureTextureByName(featureTextures, schemaName);\n\n if (featureTexture) {\n handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);\n }\n }\n }\n}\n\n/**\n * Navigate throw all properies in feature table and gets properties data.\n * @param scenegraph\n * @param featureTable\n * @param schemaClass\n */\nfunction handleFeatureTableProperties(\n scenegraph: GLTFScenegraph,\n featureTable: GLTF_EXT_feature_metadata_FeatureTable,\n schemaClass: GLTF_EXT_feature_metadata_Class\n): void {\n for (const propertyName in schemaClass.properties) {\n const schemaProperty = schemaClass.properties[propertyName];\n const featureTableProperty = featureTable?.properties?.[propertyName];\n const numberOfFeatures = featureTable.count;\n\n if (featureTableProperty) {\n const data = getPropertyDataFromBinarySource(\n scenegraph,\n schemaProperty,\n numberOfFeatures,\n featureTableProperty\n );\n featureTableProperty.data = data;\n }\n }\n}\n\n/**\n * Navigate throw all properies in feature texture and gets properties data.\n * Data will be stored in featureTexture.properties[propertyName].data\n * @param scenegraph\n * @param featureTexture\n * @param schemaClass\n */\nfunction handleFeatureTextureProperties(\n scenegraph: GLTFScenegraph,\n featureTexture: GLTF_EXT_feature_metadata_FeatureTexture,\n schemaClass: GLTF_EXT_feature_metadata_Class\n): void {\n const attributeName = featureTexture.class;\n\n for (const propertyName in schemaClass.properties) {\n const featureTextureProperty = featureTexture?.properties?.[propertyName];\n\n if (featureTextureProperty) {\n const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);\n featureTextureProperty.data = data;\n }\n }\n}\n\n/**\n * Decode properties from binary sourse based on property type.\n * @param scenegraph\n * @param schemaProperty\n * @param numberOfFeatures\n * @param featureTableProperty\n */\nfunction getPropertyDataFromBinarySource(\n scenegraph: GLTFScenegraph,\n schemaProperty: GLTF_EXT_feature_metadata_ClassProperty,\n numberOfFeatures: number,\n featureTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty\n): Uint8Array | string[] {\n const bufferView = featureTableProperty.bufferView;\n // TODO think maybe we shouldn't get data only in Uint8Array format.\n const dataArray: Uint8Array = scenegraph.getTypedArrayForBufferView(bufferView);\n\n switch (schemaProperty.type) {\n case 'STRING': {\n // stringOffsetBufferView should be available for string type.\n const stringOffsetBufferView = featureTableProperty.stringOffsetBufferView!;\n const offsetsData = scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);\n return getStringAttributes(dataArray, offsetsData, numberOfFeatures);\n }\n default:\n }\n\n return dataArray;\n}\n\n/**\n * Get properties from texture associated with all mesh primitives.\n * @param scenegraph\n * @param featureTextureProperty\n * @param attributeName\n * @returns Feature texture data\n */\nfunction getPropertyDataFromTexture(\n scenegraph: GLTFScenegraph,\n featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,\n attributeName: string\n): number[] {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return [];\n }\n const featureTextureTable: number[] = [];\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitiveTextures(\n scenegraph,\n attributeName,\n featureTextureProperty,\n featureTextureTable,\n primitive\n );\n }\n }\n return featureTextureTable;\n}\n\n// eslint-disable-next-line max-statements\n/**\n * Processes data encoded in the texture associated with the primitive. This data will be accessible through the attributes.\n * @param scenegraph\n * @param attributeName\n * @param featureTextureProperty\n * @param featureTextureTable\n * @param primitive\n */\n// eslint-disable-next-line max-statements\nfunction processPrimitiveTextures(\n scenegraph: GLTFScenegraph,\n attributeName: string,\n featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,\n featureTextureTable: number[],\n primitive: GLTFMeshPrimitive\n): void {\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. These data are 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. These coordinates ared used to get data from the image.\n */\n const json = scenegraph.gltf.json;\n const textureData: number[] = [];\n const texCoordAccessorKey = `TEXCOORD_${featureTextureProperty.texture.texCoord}`;\n const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];\n const texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);\n const texCoordArray: Uint8Array = scenegraph.getTypedArrayForBufferView(texCoordBufferView);\n\n const textureCoordinates: Float32Array = new Float32Array(\n texCoordArray.buffer,\n texCoordArray.byteOffset,\n texCoordArray.length / 4\n );\n // textureCoordinates contains UV coordinates of the actual data stored in the texture\n // accessor.count is a number of UV pairs (they are stored as VEC2)\n\n const textureIndex = featureTextureProperty.texture.index;\n const texture = json.textures?.[textureIndex];\n const imageIndex = texture?.source;\n if (typeof imageIndex !== 'undefined') {\n const image = json.images?.[imageIndex];\n const mimeType = image?.mimeType;\n const parsedImage = scenegraph.gltf.images?.[imageIndex];\n if (parsedImage) {\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const value = getImageValueByCoordinates(\n parsedImage,\n mimeType,\n textureCoordinates,\n index,\n featureTextureProperty.channels\n );\n textureData.push(value);\n }\n }\n }\n /*\n featureTextureTable will contain unique values, e.g.\n textureData = [24, 35, 28, 24]\n featureTextureTable = [24, 35, 28]\n featureIndices will contain indices hat refer featureTextureTable, e.g.\n featureIndices = [0, 1, 2, 0]\n */\n const featureIndices: number[] = [];\n for (const texelData of textureData) {\n let index = featureTextureTable.findIndex((item) => item === texelData);\n if (index === -1) {\n index = featureTextureTable.push(texelData) - 1;\n }\n featureIndices.push(index);\n }\n const typedArray = new Uint32Array(featureIndices);\n const bufferIndex =\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: 0,\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\nfunction getImageValueByCoordinates(\n parsedImage: any,\n mimeType: string | undefined,\n textureCoordinates: Float32Array,\n index: number,\n channels: string\n) {\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\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n\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 const map = CHANNELS_MAP[c];\n const val = getVal(parsedImage, offset + map.offset);\n value |= val << map.shift;\n }\n return value;\n}\n\nfunction getVal(parsedImage: any, offset: number): number {\n const imageData = getImageData(parsedImage);\n if (imageData.data.length <= offset) {\n throw new Error(`${imageData.data.length} <= ${offset}`);\n }\n return imageData.data[offset];\n}\n\nfunction coordinatesToOffset(\n u: number,\n v: number,\n parsedImage: any,\n componentsCount: number = 1\n): number {\n const w = parsedImage.width;\n const iX = emod(u) * (w - 1);\n const indX = Math.round(iX);\n\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// The following is taken from tile-converter\\src\\i3s-converter\\helpers\\batch-ids-extensions.ts\n/**\n * Handle UVs if they are out of range [0,1].\n * @param n\n * @param m\n */\nfunction emod(n: number): number {\n const a = ((n % 1) + 1) % 1;\n return a;\n}\n\n/**\n * Find the feature table by class name.\n * @param featureTables\n * @param schemaClassName\n */\nfunction findFeatureTableByName(\n featureTables: {[key: string]: GLTF_EXT_feature_metadata_FeatureTable},\n schemaClassName: string\n): GLTF_EXT_feature_metadata_FeatureTable | null {\n for (const featureTableName in featureTables) {\n const featureTable = featureTables[featureTableName];\n\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n\n return null;\n}\n\nfunction findFeatureTextureByName(\n featureTextures: {[key: string]: GLTF_EXT_feature_metadata_FeatureTexture},\n schemaClassName: string\n): GLTF_EXT_feature_metadata_FeatureTexture | null {\n for (const featureTexturesName in featureTextures) {\n const featureTable = featureTextures[featureTexturesName];\n\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n\n return null;\n}\n\n/**\n * Getting string attributes from binary data.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata#strings\n * @param data\n * @param offsetsData\n * @param stringsCount\n */\nfunction getStringAttributes(\n data: Uint8Array,\n offsetsData: Uint8Array,\n stringsCount: number\n): string[] {\n const stringsArray: string[] = [];\n const textDecoder = new TextDecoder('utf8');\n\n let stringOffset = 0;\n const bytesPerStringSize = 4;\n\n for (let index = 0; index < stringsCount; index++) {\n // TODO check if it is multiplication on bytesPerStringSize is valid operation?\n const stringByteSize =\n offsetsData[(index + 1) * bytesPerStringSize] - offsetsData[index * bytesPerStringSize];\n const stringData = data.subarray(stringOffset, stringByteSize + stringOffset);\n const stringAttribute = textDecoder.decode(stringData);\n\n stringsArray.push(stringAttribute);\n stringOffset += stringByteSize;\n }\n\n return stringsArray;\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAAsE,SAAAG,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAA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IAAIC,WAAW,CAAC,MAAM,CAAC;EAE3C,IAAIC,YAAY,GAAG,CAAC;EACpB,IAAMC,kBAAkB,GAAG,CAAC;EAE5B,KAAK,IAAI3E,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGsE,YAAY,EAAEtE,KAAK,EAAE,EAAE;IAEjD,IAAM4E,cAAc,GAClBzG,WAAW,CAAC,CAAC6B,KAAK,GAAG,CAAC,IAAI2E,kBAAkB,CAAC,GAAGxG,WAAW,CAAC6B,KAAK,GAAG2E,kBAAkB,CAAC;IACzF,IAAME,UAAU,GAAGtH,IAAI,CAACuH,QAAQ,CAACJ,YAAY,EAAEE,cAAc,GAAGF,YAAY,CAAC;IAC7E,IAAMK,eAAe,GAAGP,WAAW,CAAChK,MAAM,CAACqK,UAAU,CAAC;IAEtDN,YAAY,CAAC3D,IAAI,CAACmE,eAAe,CAAC;IAClCL,YAAY,IAAIE,cAAc;EAChC;EAEA,OAAOL,YAAY;AACrB"}
|
|
1
|
+
{"version":3,"file":"EXT_feature_metadata.js","names":["_gltfScenegraph","require","_images","_gltfUtils","_math","_dTilesUtils","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","EXT_FEATURE_METADATA_NAME","exports","decode","_x","_x2","_decode","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","gltfData","options","scenegraph","wrap","_callee$","_context","prev","GLTFScenegraph","decodeExtFeatureMetadata","stop","_extension$schema","_options$gltf","extension","getExtension","schemaClasses","schema","classes","featureTables","schemaName","schemaClass","featureTable","findFeatureTableByName","handleFeatureTableProperties","featureTextures","gltf","loadImages","featureTexture","findFeatureTextureByName","handleFeatureTextureProperties","propertyName","properties","_featureTable$propert","schemaProperty","featureTableProperty","numberOfFeatures","count","data","getPropertyDataFromBinarySource","attributeName","class","_featureTexture$prope","featureTextureProperty","getPropertyDataFromTexture","bufferView","dataArray","getTypedArrayForBufferView","type","offsetsData","getStringOffsets","getStringAttributes","isNumericProperty","getNumericAttributes","schemaPropertyType","includes","numberOfElements","stringOffsetBufferView","getOffsetsForProperty","offsetType","valuesDataBytes","propertyType","elementCount","valuesData","convertRawBufferToMetadataArray","json","meshes","featureTextureTable","_iterator","_step","mesh","_iterator2","primitives","_step2","primitive","processPrimitiveTextures","_json$textures","textureData","texCoordAccessorKey","concat","texture","texCoord","texCoordAccessorIndex","attributes","texCoordBufferView","getBufferView","texCoordArray","textureCoordinates","Float32Array","buffer","byteOffset","textureIndex","index","textures","imageIndex","source","_json$images","_scenegraph$gltf$imag","image","images","mimeType","parsedImage","getImageValueByCoordinates","channels","push","featureIndices","_loop","texelData","_textureData","_i","findIndex","item","typedArray","Uint32Array","bufferIndex","buffers","arrayBuffer","byteLength","bufferViewIndex","addBufferView","accessorIndex","addAccessor","size","componentType","getComponentTypeFromArray","CHANNELS_MAP","r","offset","shift","g","b","a","u","v","components","indexOf","coordinatesToOffset","_iterator3","_step3","c","map","val","getVal","imageData","getImageData","Error","componentsCount","undefined","w","width","iX","emod","indX","Math","round","h","height","iY","indY","schemaClassName","featureTableName","featureTexturesName","stringsCount","stringsArray","textDecoder","TextDecoder","stringData","stringAttribute"],"sources":["../../../../../src/lib/extensions/deprecated/EXT_feature_metadata.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport type {\n GLTF,\n GLTF_EXT_feature_metadata_Class,\n GLTF_EXT_feature_metadata_ClassProperty,\n GLTF_EXT_feature_metadata_FeatureTable,\n GLTF_EXT_feature_metadata_FeatureTableProperty,\n GLTF_EXT_feature_metadata_FeatureTexture,\n GLTF_EXT_feature_metadata_GLTF,\n GLTF_EXT_feature_metadata_TextureAccessor\n} from '../../types/gltf-json-schema';\nimport type {BigTypedArray, TypedArray} from '@loaders.gl/schema';\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\nimport {getImageData} from '@loaders.gl/images';\nimport {GLTFMeshPrimitive} from '../../types/gltf-json-schema';\nimport {getComponentTypeFromArray} from '../../gltf-utils/gltf-utils';\nimport {GLTFLoaderOptions} from '../../../gltf-loader';\nimport {emod} from '@loaders.gl/math';\nimport {convertRawBufferToMetadataArray, getOffsetsForProperty} from '../utils/3d-tiles-utils';\n\n/** Extension name */\nconst EXT_FEATURE_METADATA_NAME = 'EXT_feature_metadata';\nexport const name = EXT_FEATURE_METADATA_NAME;\n\nexport async function decode(gltfData: {json: GLTF}, options: GLTFLoaderOptions): Promise<void> {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtFeatureMetadata(scenegraph, options);\n}\n\n/**\n * Decodes feature metadata from extension\n * @param scenegraph\n */\nfunction decodeExtFeatureMetadata(scenegraph: GLTFScenegraph, options: GLTFLoaderOptions): void {\n const extension: GLTF_EXT_feature_metadata_GLTF | null =\n scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);\n if (!extension) return;\n\n const schemaClasses = extension.schema?.classes;\n\n const {featureTables} = extension;\n if (schemaClasses && featureTables) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTable = findFeatureTableByName(featureTables, schemaName);\n\n if (featureTable) {\n handleFeatureTableProperties(scenegraph, featureTable, schemaClass);\n }\n }\n }\n\n const {featureTextures} = extension;\n if (schemaClasses && featureTextures && options.gltf?.loadImages) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTexture = findFeatureTextureByName(featureTextures, schemaName);\n\n if (featureTexture) {\n handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);\n }\n }\n }\n}\n\n/**\n * Navigates through all properies in feature table and gets properties data.\n * @param scenegraph\n * @param featureTable\n * @param schemaClass\n */\nfunction handleFeatureTableProperties(\n scenegraph: GLTFScenegraph,\n featureTable: GLTF_EXT_feature_metadata_FeatureTable,\n schemaClass: GLTF_EXT_feature_metadata_Class\n): void {\n for (const propertyName in schemaClass.properties) {\n const schemaProperty = schemaClass.properties[propertyName];\n const featureTableProperty = featureTable?.properties?.[propertyName];\n const numberOfFeatures = featureTable.count;\n\n if (featureTableProperty) {\n const data = getPropertyDataFromBinarySource(\n scenegraph,\n schemaProperty,\n numberOfFeatures,\n featureTableProperty\n );\n featureTableProperty.data = data;\n }\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\n * @param featureTexture\n * @param schemaClass\n */\nfunction handleFeatureTextureProperties(\n scenegraph: GLTFScenegraph,\n featureTexture: GLTF_EXT_feature_metadata_FeatureTexture,\n schemaClass: GLTF_EXT_feature_metadata_Class\n): void {\n const attributeName = featureTexture.class;\n\n for (const propertyName in schemaClass.properties) {\n const featureTextureProperty = featureTexture?.properties?.[propertyName];\n\n if (featureTextureProperty) {\n const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);\n featureTextureProperty.data = data;\n }\n }\n}\n\n/**\n * Decode properties from binary sourse based on property type.\n * @param scenegraph\n * @param schemaProperty\n * @param numberOfFeatures\n * @param featureTableProperty\n */\nfunction getPropertyDataFromBinarySource(\n scenegraph: GLTFScenegraph,\n schemaProperty: GLTF_EXT_feature_metadata_ClassProperty,\n numberOfFeatures: number,\n featureTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty\n): BigTypedArray | string[] {\n const bufferView = featureTableProperty.bufferView;\n const dataArray: Uint8Array = scenegraph.getTypedArrayForBufferView(bufferView);\n\n if (schemaProperty.type === 'STRING') {\n const offsetsData = getStringOffsets(scenegraph, featureTableProperty, numberOfFeatures);\n if (!offsetsData) {\n return [];\n }\n return getStringAttributes(dataArray, offsetsData, numberOfFeatures);\n } else if (isNumericProperty(schemaProperty.type)) {\n return getNumericAttributes(\n dataArray,\n schemaProperty.type as\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64',\n numberOfFeatures\n );\n }\n\n return dataArray;\n}\n\n/**\n * Check 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(\n schemaPropertyType:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM'\n | 'ARRAY'\n | string\n): boolean {\n return [\n 'UINT8',\n 'INT16',\n 'UINT16',\n 'INT32',\n 'UINT32',\n 'INT64',\n 'UINT64',\n 'FLOAT32',\n 'FLOAT64'\n ].includes(schemaPropertyType);\n}\n\n/**\n * Parse featureTable.property.stringOffsetBufferView.\n * String offsets is an array of offsets of strings in the united array of charactersz\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/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.property.schema.json#L50C10-L50C32\n */\nfunction getStringOffsets(\n scenegraph: GLTFScenegraph,\n featureTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty,\n numberOfElements: number\n): TypedArray | null {\n if (typeof featureTableProperty.stringOffsetBufferView !== 'undefined') {\n // Data are in a FIXED-length array\n return getOffsetsForProperty(\n scenegraph,\n featureTableProperty.stringOffsetBufferView,\n featureTableProperty.offsetType || 'UINT32', // UINT32 is the default by the spec\n numberOfElements\n );\n }\n return null;\n}\n\n/**\n * Parse numeric property values\n * @param valuesDataBytes - values data array\n * @param propertyType - type of the property\n * @param elementCount - number of rows in the featureTable\n * @returns Number data in a typed array\n */\nfunction getNumericAttributes(\n valuesDataBytes: Uint8Array,\n propertyType:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64',\n elementCount: number\n): BigTypedArray {\n let valuesData = convertRawBufferToMetadataArray(\n valuesDataBytes,\n 'SCALAR',\n // The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n propertyType,\n elementCount\n );\n if (!valuesData) {\n valuesData = valuesDataBytes;\n }\n return valuesData;\n}\n\n/**\n * Get properties from texture associated with all mesh primitives.\n * @param scenegraph\n * @param featureTextureProperty\n * @param attributeName\n * @returns Feature texture data\n */\nfunction getPropertyDataFromTexture(\n scenegraph: GLTFScenegraph,\n featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,\n attributeName: string\n): number[] {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return [];\n }\n const featureTextureTable: number[] = [];\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitiveTextures(\n scenegraph,\n attributeName,\n featureTextureProperty,\n featureTextureTable,\n primitive\n );\n }\n }\n return featureTextureTable;\n}\n\n// eslint-disable-next-line max-statements\n/**\n * Processes data encoded in the texture associated with the primitive. This data will be accessible through the attributes.\n * @param scenegraph\n * @param attributeName\n * @param featureTextureProperty\n * @param featureTextureTable\n * @param primitive\n */\n// eslint-disable-next-line max-statements\nfunction processPrimitiveTextures(\n scenegraph: GLTFScenegraph,\n attributeName: string,\n featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,\n featureTextureTable: number[],\n primitive: GLTFMeshPrimitive\n): void {\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. These data are 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. These coordinates ared used to get data from the image.\n */\n const json = scenegraph.gltf.json;\n const textureData: number[] = [];\n const texCoordAccessorKey = `TEXCOORD_${featureTextureProperty.texture.texCoord}`;\n const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];\n const texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);\n const texCoordArray: Uint8Array = scenegraph.getTypedArrayForBufferView(texCoordBufferView);\n\n const textureCoordinates: Float32Array = new Float32Array(\n texCoordArray.buffer,\n texCoordArray.byteOffset,\n texCoordArray.length / 4\n );\n // textureCoordinates contains UV coordinates of the actual data stored in the texture\n // accessor.count is a number of UV pairs (they are stored as VEC2)\n\n const textureIndex = featureTextureProperty.texture.index;\n const texture = json.textures?.[textureIndex];\n const imageIndex = texture?.source;\n if (typeof imageIndex !== 'undefined') {\n const image = json.images?.[imageIndex];\n const mimeType = image?.mimeType;\n const parsedImage = scenegraph.gltf.images?.[imageIndex];\n if (parsedImage) {\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const value = getImageValueByCoordinates(\n parsedImage,\n mimeType,\n textureCoordinates,\n index,\n featureTextureProperty.channels\n );\n textureData.push(value);\n }\n }\n }\n /*\n featureTextureTable will contain unique values, e.g.\n textureData = [24, 35, 28, 24]\n featureTextureTable = [24, 35, 28]\n featureIndices will contain indices hat refer featureTextureTable, e.g.\n featureIndices = [0, 1, 2, 0]\n */\n const featureIndices: number[] = [];\n for (const texelData of textureData) {\n let index = featureTextureTable.findIndex((item) => item === texelData);\n if (index === -1) {\n index = featureTextureTable.push(texelData) - 1;\n }\n featureIndices.push(index);\n }\n const typedArray = new Uint32Array(featureIndices);\n const bufferIndex =\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: 0,\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\nfunction getImageValueByCoordinates(\n parsedImage: any,\n mimeType: string | undefined,\n textureCoordinates: Float32Array,\n index: number,\n channels: string\n) {\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\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n\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 const map = CHANNELS_MAP[c];\n const val = getVal(parsedImage, offset + map.offset);\n value |= val << map.shift;\n }\n return value;\n}\n\nfunction getVal(parsedImage: any, offset: number): number {\n const imageData = getImageData(parsedImage);\n if (imageData.data.length <= offset) {\n throw new Error(`${imageData.data.length} <= ${offset}`);\n }\n return imageData.data[offset];\n}\n\nfunction coordinatesToOffset(\n u: number,\n v: number,\n parsedImage: any,\n componentsCount: number = 1\n): number {\n const w = parsedImage.width;\n const iX = emod(u) * (w - 1);\n const indX = Math.round(iX);\n\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/**\n * Find the feature table by class name.\n * @param featureTables\n * @param schemaClassName\n */\nfunction findFeatureTableByName(\n featureTables: {[key: string]: GLTF_EXT_feature_metadata_FeatureTable},\n schemaClassName: string\n): GLTF_EXT_feature_metadata_FeatureTable | null {\n for (const featureTableName in featureTables) {\n const featureTable = featureTables[featureTableName];\n\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n\n return null;\n}\n\nfunction findFeatureTextureByName(\n featureTextures: {[key: string]: GLTF_EXT_feature_metadata_FeatureTexture},\n schemaClassName: string\n): GLTF_EXT_feature_metadata_FeatureTexture | null {\n for (const featureTexturesName in featureTextures) {\n const featureTable = featureTextures[featureTexturesName];\n\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n\n return null;\n}\n\n/**\n * Getting string attributes from binary data.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata#strings\n * @param data\n * @param offsetsData\n * @param stringsCount\n */\nfunction getStringAttributes(\n data: Uint8Array,\n offsetsData: TypedArray,\n stringsCount: number\n): string[] {\n const stringsArray: string[] = [];\n const textDecoder = new TextDecoder('utf8');\n\n for (let index = 0; index < stringsCount; index++) {\n const stringData = data.slice(offsetsData[index], offsetsData[index + 1]);\n const stringAttribute = textDecoder.decode(stringData);\n stringsArray.push(stringAttribute);\n }\n\n return stringsArray;\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAA+F,SAAAK,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAO,CAAA,UAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,QAAAH,CAAA,IAAAT,CAAA,CAAAQ,MAAA,WAAAK,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAS,CAAA,UAAAM,CAAA,WAAAA,EAAAC,EAAA,UA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BA,CAC/BJ,eAA0E,EAC1EsI,eAAuB,EAC0B;EACjD,KAAK,IAAME,mBAAmB,IAAIxI,eAAe,EAAE;IACjD,IAAMH,YAAY,GAAGG,eAAe,CAACwI,mBAAmB,CAAC;IAEzD,IAAI3I,YAAY,CAACmB,KAAK,KAAKsH,eAAe,EAAE;MAC1C,OAAOzI,YAAY;IACrB;EACF;EAEA,OAAO,IAAI;AACb;AASA,SAAS6B,mBAAmBA,CAC1Bb,IAAgB,EAChBW,WAAuB,EACvBiH,YAAoB,EACV;EACV,IAAMC,YAAsB,GAAG,EAAE;EACjC,IAAMC,WAAW,GAAG,IAAIC,WAAW,CAAC,MAAM,CAAC;EAE3C,KAAK,IAAIzE,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGsE,YAAY,EAAEtE,KAAK,EAAE,EAAE;IACjD,IAAM0E,UAAU,GAAGhI,IAAI,CAACzD,KAAK,CAACoE,WAAW,CAAC2C,KAAK,CAAC,EAAE3C,WAAW,CAAC2C,KAAK,GAAG,CAAC,CAAC,CAAC;IACzE,IAAM2E,eAAe,GAAGH,WAAW,CAAC7K,MAAM,CAAC+K,UAAU,CAAC;IACtDH,YAAY,CAAC3D,IAAI,CAAC+D,eAAe,CAAC;EACpC;EAEA,OAAOJ,YAAY;AACrB"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertRawBufferToMetadataArray = convertRawBufferToMetadataArray;
|
|
7
|
+
exports.getArrayElementByteSize = getArrayElementByteSize;
|
|
8
|
+
exports.getOffsetsForProperty = getOffsetsForProperty;
|
|
9
|
+
exports.getPrimitiveTextureData = getPrimitiveTextureData;
|
|
10
|
+
exports.primitivePropertyDataToAttributes = primitivePropertyDataToAttributes;
|
|
11
|
+
var _gltfUtils = require("../../gltf-utils/gltf-utils");
|
|
12
|
+
var _images = require("@loaders.gl/images");
|
|
13
|
+
var _math = require("@loaders.gl/math");
|
|
14
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
var ATTRIBUTE_TYPE_TO_COMPONENTS = {
|
|
18
|
+
SCALAR: 1,
|
|
19
|
+
VEC2: 2,
|
|
20
|
+
VEC3: 3,
|
|
21
|
+
VEC4: 4,
|
|
22
|
+
MAT2: 4,
|
|
23
|
+
MAT3: 9,
|
|
24
|
+
MAT4: 16,
|
|
25
|
+
BOOLEAN: 1,
|
|
26
|
+
STRING: 1,
|
|
27
|
+
ENUM: 1
|
|
28
|
+
};
|
|
29
|
+
var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {
|
|
30
|
+
INT8: Int8Array,
|
|
31
|
+
UINT8: Uint8Array,
|
|
32
|
+
INT16: Int16Array,
|
|
33
|
+
UINT16: Uint16Array,
|
|
34
|
+
INT32: Int32Array,
|
|
35
|
+
UINT32: Uint32Array,
|
|
36
|
+
INT64: BigInt64Array,
|
|
37
|
+
UINT64: BigUint64Array,
|
|
38
|
+
FLOAT32: Float32Array,
|
|
39
|
+
FLOAT64: Float64Array
|
|
40
|
+
};
|
|
41
|
+
var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {
|
|
42
|
+
INT8: 1,
|
|
43
|
+
UINT8: 1,
|
|
44
|
+
INT16: 2,
|
|
45
|
+
UINT16: 2,
|
|
46
|
+
INT32: 4,
|
|
47
|
+
UINT32: 4,
|
|
48
|
+
INT64: 8,
|
|
49
|
+
UINT64: 8,
|
|
50
|
+
FLOAT32: 4,
|
|
51
|
+
FLOAT64: 8
|
|
52
|
+
};
|
|
53
|
+
function getArrayElementByteSize(attributeType, componentType) {
|
|
54
|
+
return ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType] * ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType];
|
|
55
|
+
}
|
|
56
|
+
function getOffsetsForProperty(scenegraph, bufferViewIndex, offsetType, numberOfElements) {
|
|
57
|
+
if (offsetType !== 'UINT8' && offsetType !== 'UINT16' && offsetType !== 'UINT32' && offsetType !== 'UINT64') {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
var arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);
|
|
61
|
+
var arrayOffsets = convertRawBufferToMetadataArray(arrayOffsetsBytes, 'SCALAR', offsetType, numberOfElements + 1);
|
|
62
|
+
if (arrayOffsets instanceof BigInt64Array || arrayOffsets instanceof BigUint64Array) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return arrayOffsets;
|
|
66
|
+
}
|
|
67
|
+
function convertRawBufferToMetadataArray(data, attributeType, componentType) {
|
|
68
|
+
var elementCount = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
69
|
+
var numberOfComponents = ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType];
|
|
70
|
+
var ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[componentType];
|
|
71
|
+
var size = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType];
|
|
72
|
+
var length = elementCount * numberOfComponents;
|
|
73
|
+
var byteLength = length * size;
|
|
74
|
+
var buffer = data.buffer;
|
|
75
|
+
var offset = data.byteOffset;
|
|
76
|
+
if (offset % size !== 0) {
|
|
77
|
+
var bufferArray = new Uint8Array(buffer);
|
|
78
|
+
buffer = bufferArray.slice(offset, offset + byteLength).buffer;
|
|
79
|
+
offset = 0;
|
|
80
|
+
}
|
|
81
|
+
return new ArrayType(buffer, offset, length);
|
|
82
|
+
}
|
|
83
|
+
function getPrimitiveTextureData(scenegraph, textureInfo, primitive) {
|
|
84
|
+
var _json$textures, _json$textures$textur;
|
|
85
|
+
var json = scenegraph.gltf.json;
|
|
86
|
+
var texCoordAccessorKey = "TEXCOORD_".concat(textureInfo.texCoord || 0);
|
|
87
|
+
var texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];
|
|
88
|
+
var texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);
|
|
89
|
+
var texCoordArray = scenegraph.getTypedArrayForBufferView(texCoordBufferView);
|
|
90
|
+
var textureCoordinates = new Float32Array(texCoordArray.buffer, texCoordArray.byteOffset, texCoordArray.length / 4);
|
|
91
|
+
var textureIndex = textureInfo.index;
|
|
92
|
+
var imageIndex = (_json$textures = json.textures) === null || _json$textures === void 0 ? void 0 : (_json$textures$textur = _json$textures[textureIndex]) === null || _json$textures$textur === void 0 ? void 0 : _json$textures$textur.source;
|
|
93
|
+
if (typeof imageIndex !== 'undefined') {
|
|
94
|
+
var _json$images, _json$images$imageInd, _scenegraph$gltf$imag;
|
|
95
|
+
var mimeType = (_json$images = json.images) === null || _json$images === void 0 ? void 0 : (_json$images$imageInd = _json$images[imageIndex]) === null || _json$images$imageInd === void 0 ? void 0 : _json$images$imageInd.mimeType;
|
|
96
|
+
var parsedImage = (_scenegraph$gltf$imag = scenegraph.gltf.images) === null || _scenegraph$gltf$imag === void 0 ? void 0 : _scenegraph$gltf$imag[imageIndex];
|
|
97
|
+
if (parsedImage && typeof parsedImage.width !== 'undefined') {
|
|
98
|
+
var textureData = [];
|
|
99
|
+
for (var index = 0; index < textureCoordinates.length; index += 2) {
|
|
100
|
+
var value = getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, textureInfo.channels);
|
|
101
|
+
textureData.push(value);
|
|
102
|
+
}
|
|
103
|
+
return textureData;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTable, primitive) {
|
|
109
|
+
if (propertyData === null) return;
|
|
110
|
+
var featureIndices = [];
|
|
111
|
+
var _iterator = _createForOfIteratorHelper(propertyData),
|
|
112
|
+
_step;
|
|
113
|
+
try {
|
|
114
|
+
var _loop = function _loop() {
|
|
115
|
+
var texelData = _step.value;
|
|
116
|
+
var index = featureTable.findIndex(function (item) {
|
|
117
|
+
return item === texelData;
|
|
118
|
+
});
|
|
119
|
+
if (index === -1) {
|
|
120
|
+
index = featureTable.push(texelData) - 1;
|
|
121
|
+
}
|
|
122
|
+
featureIndices.push(index);
|
|
123
|
+
};
|
|
124
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
125
|
+
_loop();
|
|
126
|
+
}
|
|
127
|
+
} catch (err) {
|
|
128
|
+
_iterator.e(err);
|
|
129
|
+
} finally {
|
|
130
|
+
_iterator.f();
|
|
131
|
+
}
|
|
132
|
+
var typedArray = new Uint32Array(featureIndices);
|
|
133
|
+
var bufferIndex = scenegraph.gltf.buffers.push({
|
|
134
|
+
arrayBuffer: typedArray.buffer,
|
|
135
|
+
byteOffset: typedArray.byteOffset,
|
|
136
|
+
byteLength: typedArray.byteLength
|
|
137
|
+
}) - 1;
|
|
138
|
+
var bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);
|
|
139
|
+
var accessorIndex = scenegraph.addAccessor(bufferViewIndex, {
|
|
140
|
+
size: 1,
|
|
141
|
+
componentType: (0, _gltfUtils.getComponentTypeFromArray)(typedArray),
|
|
142
|
+
count: typedArray.length
|
|
143
|
+
});
|
|
144
|
+
primitive.attributes[attributeName] = accessorIndex;
|
|
145
|
+
}
|
|
146
|
+
function getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index) {
|
|
147
|
+
var channels = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [0];
|
|
148
|
+
var CHANNELS_MAP = [{
|
|
149
|
+
offset: 0,
|
|
150
|
+
shift: 0
|
|
151
|
+
}, {
|
|
152
|
+
offset: 1,
|
|
153
|
+
shift: 8
|
|
154
|
+
}, {
|
|
155
|
+
offset: 2,
|
|
156
|
+
shift: 16
|
|
157
|
+
}, {
|
|
158
|
+
offset: 3,
|
|
159
|
+
shift: 24
|
|
160
|
+
}];
|
|
161
|
+
var u = textureCoordinates[index];
|
|
162
|
+
var v = textureCoordinates[index + 1];
|
|
163
|
+
var components = 1;
|
|
164
|
+
if (mimeType && (mimeType.indexOf('image/jpeg') !== -1 || mimeType.indexOf('image/png') !== -1)) components = 4;
|
|
165
|
+
var offset = coordinatesToOffset(u, v, parsedImage, components);
|
|
166
|
+
var value = 0;
|
|
167
|
+
var _iterator2 = _createForOfIteratorHelper(channels),
|
|
168
|
+
_step2;
|
|
169
|
+
try {
|
|
170
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
171
|
+
var c = _step2.value;
|
|
172
|
+
var map = CHANNELS_MAP[c];
|
|
173
|
+
var imageOffset = offset + map.offset;
|
|
174
|
+
var imageData = (0, _images.getImageData)(parsedImage);
|
|
175
|
+
if (imageData.data.length <= imageOffset) {
|
|
176
|
+
throw new Error("".concat(imageData.data.length, " <= ").concat(imageOffset));
|
|
177
|
+
}
|
|
178
|
+
var imageValue = imageData.data[imageOffset];
|
|
179
|
+
value |= imageValue << map.shift;
|
|
180
|
+
}
|
|
181
|
+
} catch (err) {
|
|
182
|
+
_iterator2.e(err);
|
|
183
|
+
} finally {
|
|
184
|
+
_iterator2.f();
|
|
185
|
+
}
|
|
186
|
+
return value;
|
|
187
|
+
}
|
|
188
|
+
function coordinatesToOffset(u, v, parsedImage) {
|
|
189
|
+
var componentsCount = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
190
|
+
var w = parsedImage.width;
|
|
191
|
+
var iX = (0, _math.emod)(u) * (w - 1);
|
|
192
|
+
var indX = Math.round(iX);
|
|
193
|
+
var h = parsedImage.height;
|
|
194
|
+
var iY = (0, _math.emod)(v) * (h - 1);
|
|
195
|
+
var indY = Math.round(iY);
|
|
196
|
+
var components = parsedImage.components ? parsedImage.components : componentsCount;
|
|
197
|
+
var offset = (indY * w + indX) * components;
|
|
198
|
+
return offset;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=3d-tiles-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3d-tiles-utils.js","names":["_gltfUtils","require","_images","_math","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ATTRIBUTE_TYPE_TO_COMPONENTS","SCALAR","VEC2","VEC3","VEC4","MAT2","MAT3","MAT4","BOOLEAN","STRING","ENUM","ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY","INT8","Int8Array","UINT8","Uint8Array","INT16","Int16Array","UINT16","Uint16Array","INT32","Int32Array","UINT32","Uint32Array","INT64","BigInt64Array","UINT64","BigUint64Array","FLOAT32","Float32Array","FLOAT64","Float64Array","ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE","getArrayElementByteSize","attributeType","componentType","getOffsetsForProperty","scenegraph","bufferViewIndex","offsetType","numberOfElements","arrayOffsetsBytes","getTypedArrayForBufferView","arrayOffsets","convertRawBufferToMetadataArray","data","elementCount","arguments","undefined","numberOfComponents","ArrayType","size","byteLength","buffer","offset","byteOffset","bufferArray","getPrimitiveTextureData","textureInfo","primitive","_json$textures","_json$textures$textur","json","gltf","texCoordAccessorKey","concat","texCoord","texCoordAccessorIndex","attributes","texCoordBufferView","getBufferView","texCoordArray","textureCoordinates","textureIndex","index","imageIndex","textures","source","_json$images","_json$images$imageInd","_scenegraph$gltf$imag","mimeType","images","parsedImage","width","textureData","getImageValueByCoordinates","channels","push","primitivePropertyDataToAttributes","attributeName","propertyData","featureTable","featureIndices","_iterator","_step","_loop","texelData","findIndex","item","typedArray","bufferIndex","buffers","arrayBuffer","addBufferView","accessorIndex","addAccessor","getComponentTypeFromArray","count","CHANNELS_MAP","shift","u","v","components","indexOf","coordinatesToOffset","_iterator2","_step2","c","map","imageOffset","imageData","getImageData","Error","imageValue","componentsCount","w","iX","emod","indX","Math","round","h","height","iY","indY"],"sources":["../../../../../src/lib/extensions/utils/3d-tiles-utils.ts"],"sourcesContent":["/**\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 */\n\nimport type {GLTFTextureInfoMetadata, GLTFMeshPrimitive} from '../../types/gltf-json-schema';\nimport type {BigTypedArray, TypedArray} from '@loaders.gl/schema';\nimport type {ImageType} from '@loaders.gl/images';\n\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\nimport {getComponentTypeFromArray} from '../../gltf-utils/gltf-utils';\nimport {getImageData} from '@loaders.gl/images';\nimport {emod} from '@loaders.gl/math';\n\nexport type NumericComponentType =\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64';\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};\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};\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};\n\nexport function getArrayElementByteSize(attributeType, componentType): number {\n return (\n ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType] *\n ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType]\n );\n}\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 with values offsets\n */\nexport function getOffsetsForProperty(\n scenegraph: GLTFScenegraph,\n bufferViewIndex: number,\n offsetType: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string,\n numberOfElements: number\n): TypedArray | null {\n if (\n offsetType !== 'UINT8' &&\n offsetType !== 'UINT16' &&\n offsetType !== 'UINT32' &&\n offsetType !== 'UINT64'\n ) {\n return null;\n }\n const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);\n const arrayOffsets = convertRawBufferToMetadataArray(\n arrayOffsetsBytes,\n 'SCALAR', // offsets consist of ONE component\n offsetType,\n numberOfElements + 1 // The number of offsets is equal to the property table `count` plus one.\n );\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/**\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(\n data: Uint8Array,\n attributeType: string,\n componentType: NumericComponentType,\n elementCount: number = 1\n): BigTypedArray | null {\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/**\n * Processes data encoded in the texture associated with the primitive.\n * If Ext_mesh_featues is combined with the Ext_structural_metadata, propertyTable will also be processed.\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(\n scenegraph: GLTFScenegraph,\n textureInfo: GLTFTextureInfoMetadata,\n primitive: GLTFMeshPrimitive\n): number[] | null {\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. These data are 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. These coordinates are being used to get data from the image.\n */\n const json = scenegraph.gltf.json;\n\n const texCoordAccessorKey = `TEXCOORD_${textureInfo.texCoord || 0}`;\n const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];\n const texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);\n const texCoordArray: Uint8Array = scenegraph.getTypedArrayForBufferView(texCoordBufferView);\n\n // textureCoordinates array contains UV coordinates of the actual data stored in the texture\n const textureCoordinates: Float32Array = new Float32Array(\n texCoordArray.buffer,\n texCoordArray.byteOffset,\n texCoordArray.length / 4\n );\n\n const textureIndex: number = 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: number[] = [];\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const value = getImageValueByCoordinates(\n parsedImage,\n mimeType,\n textureCoordinates,\n index,\n textureInfo.channels\n );\n textureData.push(value);\n }\n return textureData;\n }\n }\n return null;\n}\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 - an array where unique data from the property data are being stored\n * @param primitive - primitive object\n */\nexport function primitivePropertyDataToAttributes(\n scenegraph: GLTFScenegraph,\n attributeName: string,\n propertyData: number[],\n featureTable: number[],\n primitive: GLTFMeshPrimitive\n): void {\n if (propertyData === null) return;\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: number[] = [];\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 =\n 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/**\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. Channels of an RGBA texture are numbered 0..3 respectively.\n * @returns Value taken from the image.\n */\nfunction getImageValueByCoordinates(\n parsedImage: ImageType,\n mimeType: string | undefined,\n textureCoordinates: Float32Array,\n index: number,\n channels: number[] = [0]\n) {\n const CHANNELS_MAP = [\n {offset: 0, shift: 0},\n {offset: 1, shift: 8},\n {offset: 2, shift: 16},\n {offset: 3, shift: 24}\n ];\n\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n\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: number = 0;\n for (const c of channels) {\n const map = 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/**\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(\n u: number,\n v: number,\n parsedImage: any,\n componentsCount: number = 1\n): number {\n const w = parsedImage.width;\n const iX = emod(u) * (w - 1);\n const indX = Math.round(iX);\n\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"],"mappings":";;;;;;;;;;AAcA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAsC,SAAAG,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAO,CAAA,UAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,QAAAH,CAAA,IAAAT,CAAA,CAAAQ,MAAA,WAAAK,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAS,CAAA,UAAAM,CAAA,WAAAA,EAAAC,EAAA,UAAAA,EAAA,KAAAC,C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C,eAAuB,GAAA9E,SAAA,CAAA/E,MAAA,QAAA+E,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC;EAE3B,IAAM+E,CAAC,GAAG3C,WAAW,CAACC,KAAK;EAC3B,IAAM2C,EAAE,GAAG,IAAAC,UAAI,EAACjB,CAAC,CAAC,IAAIe,CAAC,GAAG,CAAC,CAAC;EAC5B,IAAMG,IAAI,GAAGC,IAAI,CAACC,KAAK,CAACJ,EAAE,CAAC;EAE3B,IAAMK,CAAC,GAAGjD,WAAW,CAACkD,MAAM;EAC5B,IAAMC,EAAE,GAAG,IAAAN,UAAI,EAAChB,CAAC,CAAC,IAAIoB,CAAC,GAAG,CAAC,CAAC;EAC5B,IAAMG,IAAI,GAAGL,IAAI,CAACC,KAAK,CAACG,EAAE,CAAC;EAC3B,IAAMrB,UAAU,GAAG9B,WAAW,CAAC8B,UAAU,GAAG9B,WAAW,CAAC8B,UAAU,GAAGY,eAAe;EAEpF,IAAMvE,MAAM,GAAG,CAACiF,IAAI,GAAGT,CAAC,GAAGG,IAAI,IAAIhB,UAAU;EAC7C,OAAO3D,MAAM;AACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-ext-mesh-features-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-ext-mesh-features-schema.ts"],"sourcesContent":["import {GLTFTextureInfoMetadata} from './gltf-json-schema';\n/* eslint-disable camelcase */\n\n/**\n * EXT_mesh_features extension types\n * This is a primitive-level extension\n * @see https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features\n * or https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/mesh.primitive.EXT_mesh_features.schema.json\n * An object describing feature IDs for a mesh primitive.\n */\nexport type GLTF_EXT_mesh_features = {\n /** An array of feature ID sets. */\n featureIds: GLTF_EXT_mesh_features_featureId[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n /** For internal usage */\n dataAttributeNames?: string[];\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/featureId.schema.json\n * Feature IDs stored in an attribute or texture.\n */\nexport type GLTF_EXT_mesh_features_featureId = {\n /** The number of unique features in the attribute or texture. */\n featureCount: number;\n /** A value that indicates that no feature is associated with this vertex or texel. */\n nullFeatureId?: number;\n /** A label assigned to this feature ID set. Labels must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */\n label?: string;\n /**\n * An attribute containing feature IDs.\n * When `attribute` and `texture` are omitted the feature IDs are assigned to vertices by their index.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdAttribute.schema.json\n * An integer value used to construct a string in the format `_FEATURE_ID_<set index>` which is a reference to a key in `mesh.primitives.attributes`\n * (e.g. a value of `0` corresponds to `_FEATURE_ID_0`).\n */\n attribute?: number;\n /** A texture containing feature IDs. */\n texture?: GLTFTextureInfoMetadata;\n /** The index of the property table containing per-feature property values. Only applicable when using the `EXT_structural_metadata` extension. */\n propertyTable?: number;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n\n /** For internal usage */\n data?: unknown;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-ext-structural-metadata-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-ext-structural-metadata-schema.ts"],"sourcesContent":["import {GLTFTextureInfoMetadata} from './gltf-json-schema';\n\n/* eslint-disable camelcase */\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/glTF.EXT_structural_metadata.schema.json\n */\nexport type GLTF_EXT_structural_metadata = {\n /** An object defining classes and enums. */\n schema?: GLTF_EXT_structural_metadata_Schema;\n /** A uri to an external schema file. */\n schemaUri?: string;\n /** An array of property table definitions, which may be referenced by index. */\n propertyTables?: GLTF_EXT_structural_metadata_PropertyTable[];\n /** An array of property texture definitions, which may be referenced by index. */\n propertyTextures?: GLTF_EXT_structural_metadata_PropertyTexture[];\n /** \"An array of property attribute definitions, which may be referenced by index. */\n propertyAttributes?: GLTF_EXT_structural_metadata_PropertyAttribute[];\n /** For internal usage */\n dataAttributeNames?: string[];\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/schema.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Schema = {\n /** Unique identifier for the schema. Schema IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */\n id: string;\n /** The name of the schema. */\n name?: string;\n /** The description of the schema. */\n description?: string;\n /** Application-specific version of the schema. */\n version?: string;\n /** A dictionary, where each key is a class ID and each value is an object defining the class. */\n classes?: {\n [key: string]: GLTF_EXT_structural_metadata_Class;\n };\n /** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */\n enums?: {\n [key: string]: GLTF_EXT_structural_metadata_Enum;\n };\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * An object defining the values of an enum.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Enum = {\n /** The name of the enum, e.g. for display purposes. */\n name?: string;\n /** The description of the enum. */\n description?: string;\n /** The type of the integer enum value. */\n valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64'; // default: \"UINT16\"\n /** An array of enum values. Duplicate names or duplicate integer values are not allowed. */\n values: GLTF_EXT_structural_metadata_EnumValue[];\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.value.schema.json\n */\nexport type GLTF_EXT_structural_metadata_EnumValue = {\n /** The name of the enum value. */\n name: string;\n /** The description of the enum value. */\n description?: string;\n /** The integer enum value. */\n value: number;\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Class = {\n /** The name of the class, e.g. for display purposes. */\n name?: string;\n /** The description of the class. */\n description?: string;\n /**\n * A dictionary, where each key is a property ID and each value is an object defining the property.\n * Property IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.\n */\n properties: {\n [key: string]: GLTF_EXT_structural_metadata_ClassProperty;\n };\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.property.schema.json\n */\nexport type GLTF_EXT_structural_metadata_ClassProperty = {\n /** The name of the property, e.g. for display purposes. */\n name?: string;\n\n /** The description of the property. */\n description?: string;\n\n /** The element type. */\n type:\n | 'SCALAR'\n | 'VEC2'\n | 'VEC3'\n | 'VEC4'\n | 'MAT2'\n | 'MAT3'\n | 'MAT4'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM'\n | string;\n\n /** The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types. */\n componentType?:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | string;\n\n /** Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`. */\n enumType?: string;\n\n /**\n * Whether the property is an array.\n * When `count` is defined the property is a fixed-length array. Otherwise the property is a variable-length array.\n */\n array?: boolean;\n\n /** The number of array elements. May only be defined when `array` is true. */\n count?: number;\n\n /**\n * Specifies whether integer values are normalized.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types with integer component types.\n * For unsigned integer component types, values are normalized between `[0.0, 1.0]`.\n * For signed integer component types, values are normalized between `[-1.0, 1.0]`.\n * For all other component types, this property must be false.\n */\n normalized?: boolean;\n\n /**\n * An offset to apply to property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n */\n offset?: number | number[];\n\n /**\n * A scale to apply to property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n */\n scale?: number | number[];\n\n /**\n * Maximum allowed value for the property.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n max?: number | number[];\n\n /**\n * Minimum allowed value for the property.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n min?: number | number[];\n\n default?: boolean | number | string | number[];\n /**\n * If required, the property must be present in every entity conforming to the class.\n * If not required, individual entities may include `noData` values, or the entire property may be omitted.\n * As a result, `noData` has no effect on a required property.\n * Client implementations may use required properties to make performance optimizations.\n */\n required?: boolean; // default false;\n\n /**\n * A `noData` value represents missing data — also known as a sentinel value — wherever it appears.\n * `BOOLEAN` properties may not specify `noData` values.\n * This is given as the plain property value, without the transforms from the `normalized`, `offset`, and `scale` properties.\n * Must not be defined if `required` is true.\n */\n noData?: number | string | number[] | string[];\n\n /**\n * An identifier that describes how this property should be interpreted.\n * The semantic cannot be used by other properties in the class.\n */\n semantic?: string;\n extensions?: Record<string, any>;\n extras?: any;\n};\n\nexport type GLTF_EXT_structural_metadata_PropertyTable = {\n /** The name of the property table, e.g. for display purposes. */\n name?: string;\n /** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */\n class: string;\n /** The number of elements in each property array. */\n count: number;\n /**\n * A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary\n * and each value is an object describing where property values are stored.\n * Required properties must be included in this dictionary.\n */\n properties?: {\n [key: string]: GLTF_EXT_structural_metadata_PropertyTable_Property;\n };\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyTable_Property = {\n /**\n * The index of the buffer view containing property values.\n * The data type of property values is determined by the property definition:\n * When `type` is `BOOLEAN` values are packed into a bitstream.\n * When `type` is `STRING` values are stored as byte sequences and decoded as UTF-8 strings.\n * When `type` is `SCALAR`, `VECN`, or `MATN` the values are stored as the provided `componentType`\n * and the buffer view `byteOffset` must be aligned to a multiple of the `componentType` size.\n * When `type` is `ENUM` values are stored as the enum's `valueType`\n * and the buffer view `byteOffset` must be aligned to a multiple of the `valueType` size.\n * Each enum value in the array must match one of the allowed values in the enum definition.\n * `arrayOffsets` is required for variable-length arrays and `stringOffsets` is required for strings (for variable-length arrays of strings, both are required).\n */\n values: number;\n /**\n * The index of the buffer view containing offsets for variable-length arrays.\n * The number of offsets is equal to the property table `count` plus one.\n * The offsets represent the start positions of each array, with the last offset representing the position after the last array.\n * The array length is computed using the difference between the subsequent offset and the current offset.\n * If `type` is `STRING` the offsets index into the string offsets array (stored in `stringOffsets`), otherwise they index into the property array (stored in `values`).\n * The data type of these offsets is determined by `arrayOffsetType`.\n * The buffer view `byteOffset` must be aligned to a multiple of the `arrayOffsetType` size.\n */\n arrayOffsets?: number;\n /**\n * The index of the buffer view containing offsets for strings.\n * The number of offsets is equal to the number of string elements plus one.\n * The offsets represent the byte offsets of each string in the property array (stored in `values`), with the last offset representing the byte offset after the last string.\n * The string byte length is computed using the difference between the subsequent offset and the current offset.\n * The data type of these offsets is determined by `stringOffsetType`.\n * The buffer view `byteOffset` must be aligned to a multiple of the `stringOffsetType` size.\n */\n stringOffsets?: number;\n /**\n * The type of values in `arrayOffsets`.\n */\n arrayOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string;\n\n /**\n * The type of values in `stringOffsets`.\n */\n stringOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string;\n /**\n * An offset to apply to property values.\n * Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n * Overrides the class property's `offset` if both are defined.\n */\n offset?: number | number[];\n /**\n * A scale to apply to property values.\n * Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n * Overrides the class property's `scale` if both are defined.\n */\n scale?: number | number[];\n /**\n * Maximum value present in the property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n max?: number | number[];\n /**\n * Minimum value present in the property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n min?: number | number[];\n extensions?: Record<string, any>;\n extras?: any;\n /** For internal usage */\n data?: unknown;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTexture.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyTexture = {\n /** The name of the property texture, e.g. for display purposes. */\n name?: string;\n /** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */\n class: string;\n /**\n * A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary\n * and each value is an object describing where property values are stored.\n * Required properties must be included in this dictionary.\n *\n * https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata\n * Each property that is defined in the propertyTexture object extends the glTF textureInfo object.\n * The texCoord specifies a texture coordinate set in the referring primitive.\n * The index is the index of the glTF texture object that stores the actual data. Additionally,\n * each property specifies an array of channels, which are the indices of the texture channels providing data for the respective property.\n * Channels of an RGBA texture are numbered 0..3 respectively.\n */\n properties?: {\n [key: string]: GLTFTextureInfoMetadata;\n };\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyAttribute.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyAttribute = {\n /** The name of the property attribute, e.g. for display purposes. */\n name?: string;\n /** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */\n class: string;\n /**\n * \"A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary\n * and each value is an object describing where property values are stored.\n * Required properties must be included in this dictionary.\n */\n properties?: {\n [key: string]: any;\n };\n extensions?: Record<string, any>;\n extras?: any;\n};\n\n/**\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/mesh.primitive.EXT_structural_metadata.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Primitive = {\n /** An array of indexes of property textures in the root `EXT_structural_metadata` object. */\n propertyTextures?: number[];\n /** An array of indexes of property attributes in the root `EXT_structural_metadata` object. */\n propertyAttributes?: number[];\n extensions?: Record<string, any>;\n extras?: any;\n};\n"],"mappings":""}
|