@loaders.gl/3d-tiles 4.0.0-alpha.12 → 4.0.0-alpha.13
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 +655 -39
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +14 -4
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +69 -44
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +14 -4
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +18 -14
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +33 -7
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +24 -18
- package/dist/types.d.ts +41 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +34 -8
- package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +43 -35
- package/src/types.ts +42 -4
|
@@ -12,6 +12,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _tile3dSubtreeLoader = require("../../../tile-3d-subtree-loader");
|
|
14
14
|
var _core = require("@loaders.gl/core");
|
|
15
|
+
var _log = _interopRequireDefault(require("@probe.gl/log"));
|
|
15
16
|
var _index = require("../../utils/s2/index");
|
|
16
17
|
var _s2CornersToObb = require("../../utils/obb/s2-corners-to-obb");
|
|
17
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -181,11 +182,20 @@ function _parseImplicitTiles() {
|
|
|
181
182
|
return _parseImplicitTiles.apply(this, arguments);
|
|
182
183
|
}
|
|
183
184
|
function getAvailabilityResult(availabilityData, index) {
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
var availabilityObject;
|
|
186
|
+
if (Array.isArray(availabilityData)) {
|
|
187
|
+
availabilityObject = availabilityData[0];
|
|
188
|
+
if (availabilityData.length > 1) {
|
|
189
|
+
_log.default.once('Not supported extension "3DTILES_multiple_contents" has been detected');
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
availabilityObject = availabilityData;
|
|
193
|
+
}
|
|
194
|
+
if ('constant' in availabilityObject) {
|
|
195
|
+
return Boolean(availabilityObject.constant);
|
|
186
196
|
}
|
|
187
|
-
if (
|
|
188
|
-
return getBooleanValueFromBitstream(index,
|
|
197
|
+
if (availabilityObject.explicitBitstream) {
|
|
198
|
+
return getBooleanValueFromBitstream(index, availabilityObject.explicitBitstream);
|
|
189
199
|
}
|
|
190
200
|
return false;
|
|
191
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-implicit-tiles.js","names":["_tile3dSubtreeLoader","require","_core","_index","_s2CornersToObb","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","QUADTREE_DEVISION_COUNT","OCTREE_DEVISION_COUNT","SUBDIVISION_COUNT_MAP","QUADTREE","OCTREE","getChildS2VolumeBox","s2VolumeBox","index","subdivisionScheme","box","cellId","getS2CellIdFromToken","s2VolumeInfo","token","childCellId","getS2ChildCellId","childToken","getS2TokenFromCellId","s2ChildVolumeInfo","delta","maximumHeight","minimumHeight","sizeZ","midZ","convertS2BoundingVolumetoOBB","childS2VolumeBox","undefined","parseImplicitTiles","_x","_parseImplicitTiles","_asyncToGenerator2","_regenerator","mark","_callee","params","options","_params$parentData","parentData","_params$childIndex","childIndex","_params$globalData","globalData","subtree","_params$level","level","subtreeLevels","maximumLevel","contentUrlTemplate","subtreesUriTemplate","basePath","tile","childrenPerTile","childX","childY","childZ","levelOffset","childTileMortonIndex","tileAvailabilityIndex","childTileX","childTileY","childTileZ","isChildSubtreeAvailable","x","y","z","lev","subtreePath","childSubtreeUrl","childSubtree","isTileAvailable","isContentAvailable","childTileLevel","pData","childTileParsed","globalLevel","childCoordinates","formattedTile","wrap","_callee$","_context","prev","next","mortonIndex","children","lodMetricValue","contentUrl","Math","pow","concatBits","getAvailabilityResult","childSubtreeAvailability","concat","replaceContentUrlTemplate","load","Tile3DSubtreeLoader","sent","tileAvailability","abrupt","contentAvailability","formatTileData","stop","availabilityData","Boolean","constant","explicitBitstream","getBooleanValueFromBitstream","refine","getRefine","lodMetricType","getTileType","rootLodMetricValue","rootBoundingVolume","uri","replace","boundingVolume","boundingVolumeForChildTile","calculateBoundingVolumeForChildTile","content","id","type","geometricError","transform","region","_rootBoundingVolume$r","_slicedToArray2","west","south","east","north","boundingVolumesCount","sizeX","sizeY","childWest","childEast","childSouth","childNorth","childMinimumHeight","childMaximumHeight","Error","first","second","parseInt","toString","templateUrl","mapUrl","generateMapUrl","matched","items","availabilityIndex","availabilityBuffer","byteIndex","floor","bitIndex","bitValue"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"],"sourcesContent":["import type {Availability, Tile3DBoundingVolume, Subtree} from '../../../types';\nimport {Tile3DSubtreeLoader} from '../../../tile-3d-subtree-loader';\nimport {load} from '@loaders.gl/core';\n\nimport {getS2CellIdFromToken, getS2ChildCellId, getS2TokenFromCellId} from '../../utils/s2/index';\nimport type {S2VolumeInfo} from '../../utils/obb/s2-corners-to-obb';\nimport {convertS2BoundingVolumetoOBB} from '../../utils/obb/s2-corners-to-obb';\nimport Long from 'long';\n\nconst QUADTREE_DEVISION_COUNT = 4;\nconst OCTREE_DEVISION_COUNT = 8;\n\nconst SUBDIVISION_COUNT_MAP = {\n QUADTREE: QUADTREE_DEVISION_COUNT,\n OCTREE: OCTREE_DEVISION_COUNT\n};\n\n/**\n * S2VolumeBox is an extention of BoundingVolume of type \"box\"\n */\nexport type S2VolumeBox = {\n /** BoundingVolume of type \"box\" has the \"box\" field. S2VolumeBox contains it as well. */\n box: number[];\n /** s2VolumeInfo provides additional info about the box - specifically the token, min and max height */\n s2VolumeInfo: S2VolumeInfo;\n};\n\nfunction getChildS2VolumeBox(\n s2VolumeBox: S2VolumeBox | undefined,\n index: number,\n subdivisionScheme: string\n): S2VolumeBox | undefined {\n if (s2VolumeBox?.box) {\n // Check if the BoundingVolume is of type \"box\"\n const cellId: Long = getS2CellIdFromToken(s2VolumeBox.s2VolumeInfo.token);\n const childCellId = getS2ChildCellId(cellId, index);\n const childToken = getS2TokenFromCellId(childCellId);\n\n // Clone object. Note, s2VolumeInfo is a plain object that doesn't contain any nested object.\n // So, we can use the Spread Operator to make a shallow copy of the object.\n const s2ChildVolumeInfo: S2VolumeInfo = {...s2VolumeBox.s2VolumeInfo};\n s2ChildVolumeInfo.token = childToken; // replace the token with the child's one\n\n // In case of QUADTREE the sizeZ should NOT be changed!\n // https://portal.ogc.org/files/102132\n // A quadtree divides space only on the x and y dimensions.\n // It divides each tile into 4 smaller tiles where the x and y dimensions are halved.\n // The quadtree z minimum and maximum remain unchanged.\n switch (subdivisionScheme) {\n case 'OCTREE':\n const s2VolumeInfo: S2VolumeInfo = s2VolumeBox.s2VolumeInfo;\n const delta = s2VolumeInfo.maximumHeight - s2VolumeInfo.minimumHeight;\n const sizeZ: number = delta / 2.0; // It's a next level (a child)\n const midZ: number = s2VolumeInfo.minimumHeight + delta / 2.0;\n s2VolumeInfo.minimumHeight = midZ - sizeZ;\n s2VolumeInfo.maximumHeight = midZ + sizeZ;\n break;\n default:\n break;\n }\n const box = convertS2BoundingVolumetoOBB(s2ChildVolumeInfo);\n const childS2VolumeBox: S2VolumeBox = {\n box,\n s2VolumeInfo: s2ChildVolumeInfo\n };\n return childS2VolumeBox;\n }\n return undefined;\n}\n\n/**\n * Recursively parse implicit tiles tree\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * TODO Check out do we able to use Tile3D class as return type here.\n * @param subtree\n * @param lodMetricValue\n * @param options\n * @param parentData\n * @param childIndex\n * @param level\n * @param globalData\n */\n// eslint-disable-next-line max-statements\nexport async function parseImplicitTiles(params: {\n subtree: Subtree;\n options: any;\n parentData?: {mortonIndex: number; x: number; y: number; z: number};\n childIndex?: number;\n level?: number;\n globalData?: {level: number; mortonIndex: number; x: number; y: number; z: number};\n s2VolumeBox?: S2VolumeBox;\n}) {\n const {\n options,\n parentData = {\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n },\n childIndex = 0,\n globalData = {\n level: 0,\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n },\n s2VolumeBox\n } = params;\n let {subtree, level = 0} = params;\n const {\n subdivisionScheme,\n subtreeLevels,\n maximumLevel,\n contentUrlTemplate,\n subtreesUriTemplate,\n basePath\n } = options;\n\n const tile = {children: [], lodMetricValue: 0, contentUrl: ''};\n\n const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];\n\n const childX = childIndex & 0b01;\n const childY = (childIndex >> 1) & 0b01;\n const childZ = (childIndex >> 2) & 0b01;\n\n const levelOffset = (childrenPerTile ** level - 1) / (childrenPerTile - 1);\n let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex);\n let tileAvailabilityIndex = levelOffset + childTileMortonIndex;\n\n // Local tile coordinates\n let childTileX = concatBits(parentData.x, childX);\n let childTileY = concatBits(parentData.y, childY);\n let childTileZ = concatBits(parentData.z, childZ);\n\n let isChildSubtreeAvailable = false;\n\n if (level + 1 > subtreeLevels) {\n isChildSubtreeAvailable = getAvailabilityResult(\n subtree.childSubtreeAvailability,\n childTileMortonIndex\n );\n }\n\n const x = concatBits(globalData.x, childTileX);\n const y = concatBits(globalData.y, childTileY);\n const z = concatBits(globalData.z, childTileZ);\n const lev = level + globalData.level;\n\n if (isChildSubtreeAvailable) {\n const subtreePath = `${basePath}/${subtreesUriTemplate}`;\n const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x, y, z);\n const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);\n\n subtree = childSubtree;\n\n globalData.mortonIndex = childTileMortonIndex;\n globalData.x = childTileX;\n globalData.y = childTileY;\n globalData.z = childTileZ;\n globalData.level = level;\n\n childTileMortonIndex = 0;\n tileAvailabilityIndex = 0;\n childTileX = 0;\n childTileY = 0;\n childTileZ = 0;\n level = 0;\n }\n\n const isTileAvailable = getAvailabilityResult(subtree.tileAvailability, tileAvailabilityIndex);\n\n if (!isTileAvailable || level > maximumLevel) {\n return tile;\n }\n\n const isContentAvailable = getAvailabilityResult(\n subtree.contentAvailability,\n tileAvailabilityIndex\n );\n\n if (isContentAvailable) {\n tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, lev, x, y, z);\n }\n\n const childTileLevel = level + 1;\n const pData = {mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ};\n\n for (let index = 0; index < childrenPerTile; index++) {\n const childS2VolumeBox: S2VolumeBox | undefined = getChildS2VolumeBox(\n s2VolumeBox,\n index,\n subdivisionScheme\n );\n\n // Recursive calling...\n const childTileParsed = await parseImplicitTiles({\n subtree,\n options,\n parentData: pData,\n childIndex: index,\n level: childTileLevel,\n globalData,\n s2VolumeBox: childS2VolumeBox\n });\n\n if (childTileParsed.contentUrl || childTileParsed.children.length) {\n const globalLevel = lev + 1;\n const childCoordinates = {childTileX, childTileY, childTileZ};\n const formattedTile = formatTileData(\n childTileParsed,\n globalLevel,\n childCoordinates,\n options,\n s2VolumeBox\n );\n // @ts-ignore\n tile.children.push(formattedTile);\n }\n }\n\n return tile;\n}\n\nfunction getAvailabilityResult(availabilityData: Availability, index: number): boolean {\n if ('constant' in availabilityData) {\n return Boolean(availabilityData.constant);\n }\n\n if (availabilityData.explicitBitstream) {\n return getBooleanValueFromBitstream(index, availabilityData.explicitBitstream);\n }\n\n return false;\n}\n\n/**\n * Do formatting of implicit tile data.\n * TODO Check out do we able to use Tile3D class as type here.\n * @param tile\n * @param lodMetricValue\n * @param options\n * @returns\n */\nfunction formatTileData(\n tile,\n level: number,\n childCoordinates: {childTileX: number; childTileY: number; childTileZ: number},\n options: any,\n s2VolumeBox?: S2VolumeBox\n) {\n const {\n basePath,\n refine,\n getRefine,\n lodMetricType,\n getTileType,\n rootLodMetricValue,\n rootBoundingVolume\n } = options;\n const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, '');\n const lodMetricValue = rootLodMetricValue / 2 ** level;\n\n const boundingVolume: Tile3DBoundingVolume = s2VolumeBox?.box\n ? {box: s2VolumeBox.box}\n : rootBoundingVolume;\n\n const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(\n level,\n boundingVolume,\n childCoordinates\n );\n\n return {\n children: tile.children,\n contentUrl: tile.contentUrl,\n content: {uri},\n id: tile.contentUrl,\n refine: getRefine(refine),\n type: getTileType(tile),\n lodMetricType,\n lodMetricValue,\n geometricError: lodMetricValue,\n transform: tile.transform,\n boundingVolume: boundingVolumeForChildTile\n };\n}\n\n/**\n * Calculate child bounding volume.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-rules\n * @param level\n * @param rootBoundingVolume\n * @param childCoordinates\n */\nfunction calculateBoundingVolumeForChildTile(\n level: number,\n rootBoundingVolume: Tile3DBoundingVolume,\n childCoordinates: {childTileX: number; childTileY: number; childTileZ: number}\n): Tile3DBoundingVolume {\n if (rootBoundingVolume.region) {\n const {childTileX, childTileY, childTileZ} = childCoordinates;\n const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;\n const boundingVolumesCount = 2 ** level;\n\n const sizeX = (east - west) / boundingVolumesCount;\n const sizeY = (north - south) / boundingVolumesCount;\n\n // TODO : Why is the subdivisionScheme not being checked here?\n\n // In case of QUADTREE the sizeZ should NOT be changed!\n // https://portal.ogc.org/files/102132\n // A quadtree divides space only on the x and y dimensions. It divides each tile into 4 smaller tiles where the x and y dimensions are halved. The quadtree z minimum and maximum remain unchanged.\n\n const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;\n\n const [childWest, childEast] = [west + sizeX * childTileX, west + sizeX * (childTileX + 1)];\n const [childSouth, childNorth] = [south + sizeY * childTileY, south + sizeY * (childTileY + 1)];\n const [childMinimumHeight, childMaximumHeight] = [\n minimumHeight + sizeZ * childTileZ,\n minimumHeight + sizeZ * (childTileZ + 1)\n ];\n\n return {\n region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]\n };\n }\n\n if (rootBoundingVolume.box) {\n return rootBoundingVolume;\n }\n\n throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);\n}\n\n/**\n * Do binary concatenation\n * @param first\n * @param second\n */\nfunction concatBits(first: number, second: number): number {\n return parseInt(first.toString(2) + second.toString(2), 2);\n}\n\n/**\n * Replace implicit tile content url with real coordinates.\n * @param templateUrl\n * @param level\n * @param x\n * @param y\n * @param z\n */\nexport function replaceContentUrlTemplate(\n templateUrl: string,\n level: number,\n x: number,\n y: number,\n z: number\n): string {\n const mapUrl = generateMapUrl({level, x, y, z});\n return templateUrl.replace(/{level}|{x}|{y}|{z}/gi, (matched) => mapUrl[matched]);\n}\n\n/**\n * Get Map object for content url generation\n * @param items\n */\nfunction generateMapUrl(items: {[key: string]: number}): {[key: string]: string} {\n const mapUrl = {};\n\n for (const key in items) {\n mapUrl[`{${key}}`] = items[key];\n }\n return mapUrl;\n}\n\n/**\n * Get boolean value from bistream by index\n * A boolean value is encoded as a single bit, either 0 (false) or 1 (true).\n * Multiple boolean values are packed tightly in the same buffer.\n * These buffers of tightly-packed bits are sometimes referred to as bitstreams.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/implicit-revisions/specification/Metadata#booleans\n * @param availabilitiIndex\n */\nfunction getBooleanValueFromBitstream(\n availabilityIndex: number,\n availabilityBuffer: Uint8Array\n): boolean {\n const byteIndex = Math.floor(availabilityIndex / 8);\n const bitIndex = availabilityIndex % 8;\n const bitValue = (availabilityBuffer[byteIndex] >> bitIndex) & 1;\n\n return bitValue === 1;\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AAA+E,SAAAI,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAA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;IAAA,OAAKF,MAAM,CAACE,OAAO,CAAC;EAAA,EAAC;AACnF;AAMA,SAASD,cAAcA,CAACE,KAA8B,EAA2B;EAC/E,IAAMH,MAAM,GAAG,CAAC,CAAC;EAEjB,KAAK,IAAMtJ,IAAG,IAAIyJ,KAAK,EAAE;IACvBH,MAAM,KAAArD,MAAA,CAAKjG,IAAG,OAAI,GAAGyJ,KAAK,CAACzJ,IAAG,CAAC;EACjC;EACA,OAAOsJ,MAAM;AACf;AAUA,SAASvC,4BAA4BA,CACnC2C,iBAAyB,EACzBC,kBAA8B,EACrB;EACT,IAAMC,SAAS,GAAGhE,IAAI,CAACiE,KAAK,CAACH,iBAAiB,GAAG,CAAC,CAAC;EACnD,IAAMI,QAAQ,GAAGJ,iBAAiB,GAAG,CAAC;EACtC,IAAMK,QAAQ,GAAIJ,kBAAkB,CAACC,SAAS,CAAC,IAAIE,QAAQ,GAAI,CAAC;EAEhE,OAAOC,QAAQ,KAAK,CAAC;AACvB"}
|
|
1
|
+
{"version":3,"file":"parse-3d-implicit-tiles.js","names":["_tile3dSubtreeLoader","require","_core","_log","_interopRequireDefault","_index","_s2CornersToObb","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","QUADTREE_DEVISION_COUNT","OCTREE_DEVISION_COUNT","SUBDIVISION_COUNT_MAP","QUADTREE","OCTREE","getChildS2VolumeBox","s2VolumeBox","index","subdivisionScheme","box","cellId","getS2CellIdFromToken","s2VolumeInfo","token","childCellId","getS2ChildCellId","childToken","getS2TokenFromCellId","s2ChildVolumeInfo","delta","maximumHeight","minimumHeight","sizeZ","midZ","convertS2BoundingVolumetoOBB","childS2VolumeBox","undefined","parseImplicitTiles","_x","_parseImplicitTiles","_asyncToGenerator2","_regenerator","mark","_callee","params","options","_params$parentData","parentData","_params$childIndex","childIndex","_params$globalData","globalData","subtree","_params$level","level","subtreeLevels","maximumLevel","contentUrlTemplate","subtreesUriTemplate","basePath","tile","childrenPerTile","childX","childY","childZ","levelOffset","childTileMortonIndex","tileAvailabilityIndex","childTileX","childTileY","childTileZ","isChildSubtreeAvailable","x","y","z","lev","subtreePath","childSubtreeUrl","childSubtree","isTileAvailable","isContentAvailable","childTileLevel","pData","childTileParsed","globalLevel","childCoordinates","formattedTile","wrap","_callee$","_context","prev","next","mortonIndex","children","lodMetricValue","contentUrl","Math","pow","concatBits","getAvailabilityResult","childSubtreeAvailability","concat","replaceContentUrlTemplate","load","Tile3DSubtreeLoader","sent","tileAvailability","abrupt","contentAvailability","formatTileData","stop","availabilityData","availabilityObject","Array","isArray","log","once","Boolean","constant","explicitBitstream","getBooleanValueFromBitstream","refine","getRefine","lodMetricType","getTileType","rootLodMetricValue","rootBoundingVolume","uri","replace","boundingVolume","boundingVolumeForChildTile","calculateBoundingVolumeForChildTile","content","id","type","geometricError","transform","region","_rootBoundingVolume$r","_slicedToArray2","west","south","east","north","boundingVolumesCount","sizeX","sizeY","childWest","childEast","childSouth","childNorth","childMinimumHeight","childMaximumHeight","Error","first","second","parseInt","toString","templateUrl","mapUrl","generateMapUrl","matched","items","availabilityIndex","availabilityBuffer","byteIndex","floor","bitIndex","bitValue"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"],"sourcesContent":["import type {Availability, Tile3DBoundingVolume, Subtree} from '../../../types';\nimport {Tile3DSubtreeLoader} from '../../../tile-3d-subtree-loader';\nimport {load} from '@loaders.gl/core';\nimport {default as log} from '@probe.gl/log';\n\nimport {getS2CellIdFromToken, getS2ChildCellId, getS2TokenFromCellId} from '../../utils/s2/index';\nimport type {S2VolumeInfo} from '../../utils/obb/s2-corners-to-obb';\nimport {convertS2BoundingVolumetoOBB} from '../../utils/obb/s2-corners-to-obb';\nimport Long from 'long';\n\nconst QUADTREE_DEVISION_COUNT = 4;\nconst OCTREE_DEVISION_COUNT = 8;\n\nconst SUBDIVISION_COUNT_MAP = {\n QUADTREE: QUADTREE_DEVISION_COUNT,\n OCTREE: OCTREE_DEVISION_COUNT\n};\n\n/**\n * S2VolumeBox is an extention of BoundingVolume of type \"box\"\n */\nexport type S2VolumeBox = {\n /** BoundingVolume of type \"box\" has the \"box\" field. S2VolumeBox contains it as well. */\n box: number[];\n /** s2VolumeInfo provides additional info about the box - specifically the token, min and max height */\n s2VolumeInfo: S2VolumeInfo;\n};\n\nfunction getChildS2VolumeBox(\n s2VolumeBox: S2VolumeBox | undefined,\n index: number,\n subdivisionScheme: string\n): S2VolumeBox | undefined {\n if (s2VolumeBox?.box) {\n // Check if the BoundingVolume is of type \"box\"\n const cellId: Long = getS2CellIdFromToken(s2VolumeBox.s2VolumeInfo.token);\n const childCellId = getS2ChildCellId(cellId, index);\n const childToken = getS2TokenFromCellId(childCellId);\n\n // Clone object. Note, s2VolumeInfo is a plain object that doesn't contain any nested object.\n // So, we can use the Spread Operator to make a shallow copy of the object.\n const s2ChildVolumeInfo: S2VolumeInfo = {...s2VolumeBox.s2VolumeInfo};\n s2ChildVolumeInfo.token = childToken; // replace the token with the child's one\n\n // In case of QUADTREE the sizeZ should NOT be changed!\n // https://portal.ogc.org/files/102132\n // A quadtree divides space only on the x and y dimensions.\n // It divides each tile into 4 smaller tiles where the x and y dimensions are halved.\n // The quadtree z minimum and maximum remain unchanged.\n switch (subdivisionScheme) {\n case 'OCTREE':\n const s2VolumeInfo: S2VolumeInfo = s2VolumeBox.s2VolumeInfo;\n const delta = s2VolumeInfo.maximumHeight - s2VolumeInfo.minimumHeight;\n const sizeZ: number = delta / 2.0; // It's a next level (a child)\n const midZ: number = s2VolumeInfo.minimumHeight + delta / 2.0;\n s2VolumeInfo.minimumHeight = midZ - sizeZ;\n s2VolumeInfo.maximumHeight = midZ + sizeZ;\n break;\n default:\n break;\n }\n const box = convertS2BoundingVolumetoOBB(s2ChildVolumeInfo);\n const childS2VolumeBox: S2VolumeBox = {\n box,\n s2VolumeInfo: s2ChildVolumeInfo\n };\n return childS2VolumeBox;\n }\n return undefined;\n}\n\n/**\n * Recursively parse implicit tiles tree\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * TODO Check out do we able to use Tile3D class as return type here.\n * @param subtree\n * @param lodMetricValue\n * @param options\n * @param parentData\n * @param childIndex\n * @param level\n * @param globalData\n */\n// eslint-disable-next-line max-statements\nexport async function parseImplicitTiles(params: {\n subtree: Subtree;\n options: any;\n parentData?: {mortonIndex: number; x: number; y: number; z: number};\n childIndex?: number;\n level?: number;\n globalData?: {level: number; mortonIndex: number; x: number; y: number; z: number};\n s2VolumeBox?: S2VolumeBox;\n}) {\n const {\n options,\n parentData = {\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n },\n childIndex = 0,\n globalData = {\n level: 0,\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n },\n s2VolumeBox\n } = params;\n let {subtree, level = 0} = params;\n const {\n subdivisionScheme,\n subtreeLevels,\n maximumLevel,\n contentUrlTemplate,\n subtreesUriTemplate,\n basePath\n } = options;\n\n const tile = {children: [], lodMetricValue: 0, contentUrl: ''};\n\n const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];\n\n // childIndex is in range [0, 7]\n const childX = childIndex & 0b01; // Get first bit for X\n const childY = (childIndex >> 1) & 0b01; // Get second bit for Y\n const childZ = (childIndex >> 2) & 0b01; // Get third bit for Z\n\n const levelOffset = (childrenPerTile ** level - 1) / (childrenPerTile - 1);\n let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex);\n let tileAvailabilityIndex = levelOffset + childTileMortonIndex;\n\n // Local tile coordinates\n let childTileX = concatBits(parentData.x, childX);\n let childTileY = concatBits(parentData.y, childY);\n let childTileZ = concatBits(parentData.z, childZ);\n\n let isChildSubtreeAvailable = false;\n\n if (level + 1 > subtreeLevels) {\n isChildSubtreeAvailable = getAvailabilityResult(\n subtree.childSubtreeAvailability,\n childTileMortonIndex\n );\n }\n\n const x = concatBits(globalData.x, childTileX);\n const y = concatBits(globalData.y, childTileY);\n const z = concatBits(globalData.z, childTileZ);\n const lev = level + globalData.level;\n\n if (isChildSubtreeAvailable) {\n const subtreePath = `${basePath}/${subtreesUriTemplate}`;\n const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x, y, z);\n const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);\n\n subtree = childSubtree;\n\n globalData.mortonIndex = childTileMortonIndex;\n globalData.x = childTileX;\n globalData.y = childTileY;\n globalData.z = childTileZ;\n globalData.level = level;\n\n childTileMortonIndex = 0;\n tileAvailabilityIndex = 0;\n childTileX = 0;\n childTileY = 0;\n childTileZ = 0;\n level = 0;\n }\n\n const isTileAvailable = getAvailabilityResult(subtree.tileAvailability, tileAvailabilityIndex);\n\n if (!isTileAvailable || level > maximumLevel) {\n return tile;\n }\n\n const isContentAvailable = getAvailabilityResult(\n subtree.contentAvailability,\n tileAvailabilityIndex\n );\n\n if (isContentAvailable) {\n tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, lev, x, y, z);\n }\n\n const childTileLevel = level + 1;\n const pData = {mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ};\n\n for (let index = 0; index < childrenPerTile; index++) {\n const childS2VolumeBox: S2VolumeBox | undefined = getChildS2VolumeBox(\n s2VolumeBox,\n index,\n subdivisionScheme\n );\n\n // Recursive calling...\n const childTileParsed = await parseImplicitTiles({\n subtree,\n options,\n parentData: pData,\n childIndex: index,\n level: childTileLevel,\n globalData,\n s2VolumeBox: childS2VolumeBox\n });\n\n if (childTileParsed.contentUrl || childTileParsed.children.length) {\n const globalLevel = lev + 1;\n const childCoordinates = {childTileX, childTileY, childTileZ};\n const formattedTile = formatTileData(\n childTileParsed,\n globalLevel,\n childCoordinates,\n options,\n s2VolumeBox\n );\n // @ts-ignore\n tile.children.push(formattedTile);\n }\n }\n\n return tile;\n}\n\n/**\n * Check tile availability in the bitstream array\n * @param availabilityData - tileAvailability / contentAvailability / childSubtreeAvailability object\n * @param index - index in the bitstream array\n * @returns\n */\nfunction getAvailabilityResult(\n availabilityData: Availability | Availability[],\n index: number\n): boolean {\n let availabilityObject: Availability;\n if (Array.isArray(availabilityData)) {\n /** TODO: we don't support `3DTILES_multiple_contents` extension at the moment.\n * https://github.com/CesiumGS/3d-tiles/blob/main/extensions/3DTILES_implicit_tiling/README.md#multiple-contents\n * Take first item in the array\n */\n availabilityObject = availabilityData[0];\n if (availabilityData.length > 1) {\n // eslint-disable-next-line no-console\n log.once('Not supported extension \"3DTILES_multiple_contents\" has been detected');\n }\n } else {\n availabilityObject = availabilityData;\n }\n\n if ('constant' in availabilityObject) {\n return Boolean(availabilityObject.constant);\n }\n\n if (availabilityObject.explicitBitstream) {\n return getBooleanValueFromBitstream(index, availabilityObject.explicitBitstream);\n }\n\n return false;\n}\n\n/**\n * Do formatting of implicit tile data.\n * TODO Check out do we able to use Tile3D class as type here.\n * @param tile\n * @param lodMetricValue\n * @param options\n * @returns\n */\nfunction formatTileData(\n tile,\n level: number,\n childCoordinates: {childTileX: number; childTileY: number; childTileZ: number},\n options: any,\n s2VolumeBox?: S2VolumeBox\n) {\n const {\n basePath,\n refine,\n getRefine,\n lodMetricType,\n getTileType,\n rootLodMetricValue,\n rootBoundingVolume\n } = options;\n const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, '');\n const lodMetricValue = rootLodMetricValue / 2 ** level;\n\n const boundingVolume: Tile3DBoundingVolume = s2VolumeBox?.box\n ? {box: s2VolumeBox.box}\n : rootBoundingVolume;\n\n const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(\n level,\n boundingVolume,\n childCoordinates\n );\n\n return {\n children: tile.children,\n contentUrl: tile.contentUrl,\n content: {uri},\n id: tile.contentUrl,\n refine: getRefine(refine),\n type: getTileType(tile),\n lodMetricType,\n lodMetricValue,\n geometricError: lodMetricValue,\n transform: tile.transform,\n boundingVolume: boundingVolumeForChildTile\n };\n}\n\n/**\n * Calculate child bounding volume.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-rules\n * @param level\n * @param rootBoundingVolume\n * @param childCoordinates\n */\nfunction calculateBoundingVolumeForChildTile(\n level: number,\n rootBoundingVolume: Tile3DBoundingVolume,\n childCoordinates: {childTileX: number; childTileY: number; childTileZ: number}\n): Tile3DBoundingVolume {\n if (rootBoundingVolume.region) {\n const {childTileX, childTileY, childTileZ} = childCoordinates;\n const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;\n const boundingVolumesCount = 2 ** level;\n\n const sizeX = (east - west) / boundingVolumesCount;\n const sizeY = (north - south) / boundingVolumesCount;\n\n // TODO : Why is the subdivisionScheme not being checked here?\n\n // In case of QUADTREE the sizeZ should NOT be changed!\n // https://portal.ogc.org/files/102132\n // A quadtree divides space only on the x and y dimensions. It divides each tile into 4 smaller tiles where the x and y dimensions are halved. The quadtree z minimum and maximum remain unchanged.\n\n const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;\n\n const [childWest, childEast] = [west + sizeX * childTileX, west + sizeX * (childTileX + 1)];\n const [childSouth, childNorth] = [south + sizeY * childTileY, south + sizeY * (childTileY + 1)];\n const [childMinimumHeight, childMaximumHeight] = [\n minimumHeight + sizeZ * childTileZ,\n minimumHeight + sizeZ * (childTileZ + 1)\n ];\n\n return {\n region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]\n };\n }\n\n if (rootBoundingVolume.box) {\n return rootBoundingVolume;\n }\n\n throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);\n}\n\n/**\n * Do binary concatenation\n * @param first\n * @param second\n */\nfunction concatBits(first: number, second: number): number {\n return parseInt(first.toString(2) + second.toString(2), 2);\n}\n\n/**\n * Replace implicit tile content url with real coordinates.\n * @param templateUrl\n * @param level\n * @param x\n * @param y\n * @param z\n */\nexport function replaceContentUrlTemplate(\n templateUrl: string,\n level: number,\n x: number,\n y: number,\n z: number\n): string {\n const mapUrl = generateMapUrl({level, x, y, z});\n return templateUrl.replace(/{level}|{x}|{y}|{z}/gi, (matched) => mapUrl[matched]);\n}\n\n/**\n * Get Map object for content url generation\n * @param items\n */\nfunction generateMapUrl(items: {[key: string]: number}): {[key: string]: string} {\n const mapUrl = {};\n\n for (const key in items) {\n mapUrl[`{${key}}`] = items[key];\n }\n return mapUrl;\n}\n\n/**\n * Get boolean value from bistream by index\n * A boolean value is encoded as a single bit, either 0 (false) or 1 (true).\n * Multiple boolean values are packed tightly in the same buffer.\n * These buffers of tightly-packed bits are sometimes referred to as bitstreams.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/implicit-revisions/specification/Metadata#booleans\n * @param availabilitiIndex\n */\nfunction getBooleanValueFromBitstream(\n availabilityIndex: number,\n availabilityBuffer: Uint8Array\n): boolean {\n const byteIndex = Math.floor(availabilityIndex / 8);\n const bitIndex = availabilityIndex % 8;\n const bitValue = (availabilityBuffer[byteIndex] >> bitIndex) & 1;\n\n return bitValue === 1;\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAL,OAAA;AAA+E,SAAAM,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAA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EAAEC,MAAc,EAAU;EACzD,OAAOC,QAAQ,CAACF,KAAK,CAACG,QAAQ,CAAC,CAAC,CAAC,GAAGF,MAAM,CAACE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC5D;AAUO,SAASvD,yBAAyBA,CACvCwD,WAAmB,EACnBxG,KAAa,EACbkB,CAAS,EACTC,CAAS,EACTC,CAAS,EACD;EACR,IAAMqF,MAAM,GAAGC,cAAc,CAAC;IAAC1G,KAAK,EAALA,KAAK;IAAEkB,CAAC,EAADA,CAAC;IAAEC,CAAC,EAADA,CAAC;IAAEC,CAAC,EAADA;EAAC,CAAC,CAAC;EAC/C,OAAOoF,WAAW,CAAC9B,OAAO,CAAC,uBAAuB,EAAE,UAACiC,OAAO;IAAA,OAAKF,MAAM,CAACE,OAAO,CAAC;EAAA,EAAC;AACnF;AAMA,SAASD,cAAcA,CAACE,KAA8B,EAA2B;EAC/E,IAAMH,MAAM,GAAG,CAAC,CAAC;EAEjB,KAAK,IAAM3J,IAAG,IAAI8J,KAAK,EAAE;IACvBH,MAAM,KAAA1D,MAAA,CAAKjG,IAAG,OAAI,GAAG8J,KAAK,CAAC9J,IAAG,CAAC;EACjC;EACA,OAAO2J,MAAM;AACf;AAUA,SAASvC,4BAA4BA,CACnC2C,iBAAyB,EACzBC,kBAA8B,EACrB;EACT,IAAMC,SAAS,GAAGrE,IAAI,CAACsE,KAAK,CAACH,iBAAiB,GAAG,CAAC,CAAC;EACnD,IAAMI,QAAQ,GAAGJ,iBAAiB,GAAG,CAAC;EACtC,IAAMK,QAAQ,GAAIJ,kBAAkB,CAACC,SAAS,CAAC,IAAIE,QAAQ,GAAI,CAAC;EAEhE,OAAOC,QAAQ,KAAK,CAAC;AACvB"}
|
|
@@ -7,6 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = parse3DTilesSubtree;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
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; } } }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
10
13
|
var SUBTREE_FILE_MAGIC = 0x74627573;
|
|
11
14
|
var SUBTREE_FILE_VERSION = 1;
|
|
12
15
|
function parse3DTilesSubtree(_x, _x2, _x3) {
|
|
@@ -14,7 +17,7 @@ function parse3DTilesSubtree(_x, _x2, _x3) {
|
|
|
14
17
|
}
|
|
15
18
|
function _parse3DTilesSubtree() {
|
|
16
19
|
_parse3DTilesSubtree = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
|
|
17
|
-
var magic, version, jsonByteLength, stringAttribute, textDecoder, string, subtree, binaryByteLength, internalBinaryBuffer;
|
|
20
|
+
var magic, version, jsonByteLength, stringAttribute, textDecoder, string, subtree, binaryByteLength, internalBinaryBuffer, _iterator, _step, contentAvailability;
|
|
18
21
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
19
22
|
while (1) switch (_context.prev = _context.next) {
|
|
20
23
|
case 0:
|
|
@@ -42,89 +45,111 @@ function _parse3DTilesSubtree() {
|
|
|
42
45
|
if (binaryByteLength) {
|
|
43
46
|
internalBinaryBuffer = data.slice(24 + jsonByteLength);
|
|
44
47
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return getExplicitBitstream(subtree, 'tileAvailability', internalBinaryBuffer, context);
|
|
51
|
-
case 17:
|
|
52
|
-
subtree.tileAvailability.explicitBitstream = _context.sent;
|
|
53
|
-
case 18:
|
|
54
|
-
if (!('bufferView' in subtree.contentAvailability)) {
|
|
55
|
-
_context.next = 22;
|
|
48
|
+
_context.next = 16;
|
|
49
|
+
return loadExplicitBitstream(subtree, subtree.tileAvailability, internalBinaryBuffer, context);
|
|
50
|
+
case 16:
|
|
51
|
+
if (!Array.isArray(subtree.contentAvailability)) {
|
|
52
|
+
_context.next = 36;
|
|
56
53
|
break;
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (!('bufferView' in subtree.childSubtreeAvailability)) {
|
|
55
|
+
_iterator = _createForOfIteratorHelper(subtree.contentAvailability);
|
|
56
|
+
_context.prev = 18;
|
|
57
|
+
_iterator.s();
|
|
58
|
+
case 20:
|
|
59
|
+
if ((_step = _iterator.n()).done) {
|
|
64
60
|
_context.next = 26;
|
|
65
61
|
break;
|
|
66
62
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
contentAvailability = _step.value;
|
|
64
|
+
_context.next = 24;
|
|
65
|
+
return loadExplicitBitstream(subtree, contentAvailability, internalBinaryBuffer, context);
|
|
66
|
+
case 24:
|
|
67
|
+
_context.next = 20;
|
|
68
|
+
break;
|
|
71
69
|
case 26:
|
|
70
|
+
_context.next = 31;
|
|
71
|
+
break;
|
|
72
|
+
case 28:
|
|
73
|
+
_context.prev = 28;
|
|
74
|
+
_context.t0 = _context["catch"](18);
|
|
75
|
+
_iterator.e(_context.t0);
|
|
76
|
+
case 31:
|
|
77
|
+
_context.prev = 31;
|
|
78
|
+
_iterator.f();
|
|
79
|
+
return _context.finish(31);
|
|
80
|
+
case 34:
|
|
81
|
+
_context.next = 38;
|
|
82
|
+
break;
|
|
83
|
+
case 36:
|
|
84
|
+
_context.next = 38;
|
|
85
|
+
return loadExplicitBitstream(subtree, subtree.contentAvailability, internalBinaryBuffer, context);
|
|
86
|
+
case 38:
|
|
87
|
+
_context.next = 40;
|
|
88
|
+
return loadExplicitBitstream(subtree, subtree.childSubtreeAvailability, internalBinaryBuffer, context);
|
|
89
|
+
case 40:
|
|
72
90
|
return _context.abrupt("return", subtree);
|
|
73
|
-
case
|
|
91
|
+
case 41:
|
|
74
92
|
case "end":
|
|
75
93
|
return _context.stop();
|
|
76
94
|
}
|
|
77
|
-
}, _callee);
|
|
95
|
+
}, _callee, null, [[18, 28, 31, 34]]);
|
|
78
96
|
}));
|
|
79
97
|
return _parse3DTilesSubtree.apply(this, arguments);
|
|
80
98
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
99
|
+
function loadExplicitBitstream(_x4, _x5, _x6, _x7) {
|
|
100
|
+
return _loadExplicitBitstream.apply(this, arguments);
|
|
83
101
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
102
|
+
function _loadExplicitBitstream() {
|
|
103
|
+
_loadExplicitBitstream = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(subtree, availabilityObject, internalBinaryBuffer, context) {
|
|
86
104
|
var bufferViewIndex, bufferView, buffer, bufferUri, response, data;
|
|
87
105
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
88
106
|
while (1) switch (_context2.prev = _context2.next) {
|
|
89
107
|
case 0:
|
|
90
|
-
bufferViewIndex =
|
|
108
|
+
bufferViewIndex = Number.isFinite(availabilityObject.bitstream) ? availabilityObject.bitstream : availabilityObject.bufferView;
|
|
109
|
+
if (!(typeof bufferViewIndex !== 'number')) {
|
|
110
|
+
_context2.next = 3;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
return _context2.abrupt("return");
|
|
114
|
+
case 3:
|
|
91
115
|
bufferView = subtree.bufferViews[bufferViewIndex];
|
|
92
116
|
buffer = subtree.buffers[bufferView.buffer];
|
|
93
|
-
if (
|
|
94
|
-
_context2.next =
|
|
117
|
+
if (context !== null && context !== void 0 && context.baseUrl) {
|
|
118
|
+
_context2.next = 7;
|
|
95
119
|
break;
|
|
96
120
|
}
|
|
97
121
|
throw new Error('Url is not provided');
|
|
98
|
-
case
|
|
122
|
+
case 7:
|
|
99
123
|
if (context.fetch) {
|
|
100
|
-
_context2.next =
|
|
124
|
+
_context2.next = 9;
|
|
101
125
|
break;
|
|
102
126
|
}
|
|
103
127
|
throw new Error('fetch is not provided');
|
|
104
|
-
case
|
|
128
|
+
case 9:
|
|
105
129
|
if (!buffer.uri) {
|
|
106
|
-
_context2.next =
|
|
130
|
+
_context2.next = 19;
|
|
107
131
|
break;
|
|
108
132
|
}
|
|
109
133
|
bufferUri = "".concat((context === null || context === void 0 ? void 0 : context.baseUrl) || '', "/").concat(buffer.uri);
|
|
110
|
-
_context2.next =
|
|
134
|
+
_context2.next = 13;
|
|
111
135
|
return context.fetch(bufferUri);
|
|
112
|
-
case
|
|
136
|
+
case 13:
|
|
113
137
|
response = _context2.sent;
|
|
114
|
-
_context2.next =
|
|
138
|
+
_context2.next = 16;
|
|
115
139
|
return response.arrayBuffer();
|
|
116
|
-
case 14:
|
|
117
|
-
data = _context2.sent;
|
|
118
|
-
return _context2.abrupt("return", new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength));
|
|
119
140
|
case 16:
|
|
120
|
-
|
|
121
|
-
|
|
141
|
+
data = _context2.sent;
|
|
142
|
+
availabilityObject.explicitBitstream = new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
|
|
143
|
+
return _context2.abrupt("return");
|
|
144
|
+
case 19:
|
|
145
|
+
availabilityObject.explicitBitstream = new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);
|
|
146
|
+
case 20:
|
|
122
147
|
case "end":
|
|
123
148
|
return _context2.stop();
|
|
124
149
|
}
|
|
125
150
|
}, _callee2);
|
|
126
151
|
}));
|
|
127
|
-
return
|
|
152
|
+
return _loadExplicitBitstream.apply(this, arguments);
|
|
128
153
|
}
|
|
129
154
|
function parseUint64Value(buffer) {
|
|
130
155
|
var dataView = new DataView(buffer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-subtree.js","names":["SUBTREE_FILE_MAGIC","SUBTREE_FILE_VERSION","parse3DTilesSubtree","_x","_x2","_x3","_parse3DTilesSubtree","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","options","context","magic","version","jsonByteLength","stringAttribute","textDecoder","string","subtree","binaryByteLength","internalBinaryBuffer","wrap","_callee$","_context","prev","next","Uint32Array","slice","Error","parseUint64Value","Uint8Array","TextDecoder","decode","JSON","parse","ArrayBuffer","tileAvailability","getExplicitBitstream","explicitBitstream","sent","contentAvailability","childSubtreeAvailability","abrupt","stop","_x4","_x5","_x6","_x7","_getExplicitBitstream","_callee2","name","bufferViewIndex","bufferView","buffer","bufferUri","response","_callee2$","_context2","bufferViews","buffers","url","fetch","uri","concat","baseUrl","arrayBuffer","byteOffset","byteLength","dataView","DataView","left","getUint32","right","Math","pow"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-subtree.ts"],"sourcesContent":["import type {Subtree, ExplicitBitstream} from '../../../types';\nimport type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';\n\nconst SUBTREE_FILE_MAGIC = 0x74627573;\nconst SUBTREE_FILE_VERSION = 1;\n\n/**\n * Parse subtree file\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subtree-file-format\n * @param data\n * @returns\n */\n// eslint-disable-next-line max-statements\nexport default async function parse3DTilesSubtree(\n data: ArrayBuffer,\n options: LoaderOptions | undefined,\n context: LoaderContext | undefined\n): Promise<Subtree> {\n const magic = new Uint32Array(data.slice(0, 4));\n\n if (magic[0] !== SUBTREE_FILE_MAGIC) {\n throw new Error('Wrong subtree file magic number');\n }\n\n const version = new Uint32Array(data.slice(4, 8));\n\n if (version[0] !== SUBTREE_FILE_VERSION) {\n throw new Error('Wrong subtree file verson, must be 1');\n }\n\n const jsonByteLength = parseUint64Value(data.slice(8, 16));\n const stringAttribute = new Uint8Array(data, 24, jsonByteLength);\n\n const textDecoder = new TextDecoder('utf8');\n const string = textDecoder.decode(stringAttribute);\n const subtree = JSON.parse(string);\n\n const binaryByteLength = parseUint64Value(data.slice(16, 24));\n let internalBinaryBuffer = new ArrayBuffer(0);\n\n if (binaryByteLength) {\n internalBinaryBuffer = data.slice(24 + jsonByteLength);\n }\n\n if ('bufferView' in subtree.tileAvailability) {\n subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'tileAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n if ('bufferView' in subtree.contentAvailability) {\n subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'contentAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n if ('bufferView' in subtree.childSubtreeAvailability) {\n subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'childSubtreeAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n return subtree;\n}\n\n/**\n * Get explicit bitstream for subtree availability data.\n * @param subtree\n * @param name\n * @param internalBinaryBuffer\n */\nasync function getExplicitBitstream(\n subtree: Subtree,\n name: string,\n internalBinaryBuffer: ArrayBuffer,\n context: LoaderContext | undefined\n): Promise<ExplicitBitstream> {\n const bufferViewIndex = subtree[name].bufferView;\n const bufferView = subtree.bufferViews[bufferViewIndex];\n const buffer = subtree.buffers[bufferView.buffer];\n\n if (!context?.url || !context.fetch) {\n throw new Error('Url is not provided');\n }\n\n if (!context.fetch) {\n throw new Error('fetch is not provided');\n }\n\n // External bitstream loading\n if (buffer.uri) {\n const bufferUri = `${context?.baseUrl || ''}/${buffer.uri}`;\n const response = await context.fetch(bufferUri);\n const data = await response.arrayBuffer();\n // Return view of bitstream.\n return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);\n }\n // Return view of bitstream.\n return new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);\n}\n\n/**\n * Parse buffer to return uint64 value\n * @param buffer\n * @returns 64-bit value until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Value(buffer: ArrayBuffer): number {\n const dataView = new DataView(buffer);\n const left = dataView.getUint32(0, true);\n const right = dataView.getUint32(4, true);\n // combine the two 32-bit values\n return left + 2 ** 32 * right;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAMA,kBAAkB,GAAG,UAAU;AACrC,IAAMC,oBAAoB,GAAG,CAAC;AAAC,SASDC,mBAAmBA,CAAAC,EAAA,EAAAC,GAAA,EAAAC,GAAA;EAAA,OAAAC,oBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,qBAAA;EAAAA,oBAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAlC,SAAAC,QACbC,IAAiB,EACjBC,OAAkC,EAClCC,OAAkC;IAAA,IAAAC,KAAA,EAAAC,OAAA,EAAAC,cAAA,EAAAC,eAAA,EAAAC,WAAA,EAAAC,MAAA,EAAAC,OAAA,EAAAC,gBAAA,EAAAC,oBAAA;IAAA,OAAAd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C;QAAA;UAAnCxD,IAAI,GAAAgD,SAAA,CAAAlB,IAAA;UAAA,OAAAkB,SAAA,CAAAf,MAAA,WAEH,IAAIZ,UAAU,CAACrB,IAAI,EAAE2C,UAAU,CAACc,UAAU,EAAEd,UAAU,CAACe,UAAU,CAAC;QAAA;UAAA,OAAAV,SAAA,CAAAf,MAAA,WAGpE,IAAIZ,UAAU,CAACV,oBAAoB,EAAEgC,UAAU,CAACc,UAAU,EAAEd,UAAU,CAACe,UAAU,CAAC;QAAA;QAAA;UAAA,OAAAV,SAAA,CAAAd,IAAA;MAAA;IAAA,GAAAM,QAAA;EAAA,CAC1F;EAAA,OAAAD,qBAAA,CAAA9C,KAAA,OAAAC,SAAA;AAAA;AAOD,SAAS0B,gBAAgBA,CAACwB,MAAmB,EAAU;EACrD,IAAMe,QAAQ,GAAG,IAAIC,QAAQ,CAAChB,MAAM,CAAC;EACrC,IAAMiB,IAAI,GAAGF,QAAQ,CAACG,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC;EACxC,IAAMC,KAAK,GAAGJ,QAAQ,CAACG,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC;EAEzC,OAAOD,IAAI,GAAGG,IAAA,CAAAC,GAAA,EAAC,EAAI,EAAE,IAAGF,KAAK;AAC/B"}
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-subtree.js","names":["SUBTREE_FILE_MAGIC","SUBTREE_FILE_VERSION","parse3DTilesSubtree","_x","_x2","_x3","_parse3DTilesSubtree","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","options","context","magic","version","jsonByteLength","stringAttribute","textDecoder","string","subtree","binaryByteLength","internalBinaryBuffer","_iterator","_step","contentAvailability","wrap","_callee$","_context","prev","next","Uint32Array","slice","Error","parseUint64Value","Uint8Array","TextDecoder","decode","JSON","parse","ArrayBuffer","loadExplicitBitstream","tileAvailability","Array","isArray","_createForOfIteratorHelper","s","n","done","value","t0","e","f","finish","childSubtreeAvailability","abrupt","stop","_x4","_x5","_x6","_x7","_loadExplicitBitstream","_callee2","availabilityObject","bufferViewIndex","bufferView","buffer","bufferUri","response","_callee2$","_context2","Number","isFinite","bitstream","bufferViews","buffers","baseUrl","fetch","uri","concat","sent","arrayBuffer","explicitBitstream","byteOffset","byteLength","dataView","DataView","left","getUint32","right","Math","pow"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-subtree.ts"],"sourcesContent":["import type {Subtree, Availability} from '../../../types';\nimport type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';\n\nconst SUBTREE_FILE_MAGIC = 0x74627573;\nconst SUBTREE_FILE_VERSION = 1;\n\n/**\n * Parse subtree file\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subtree-file-format\n * @param data\n * @returns\n */\n// eslint-disable-next-line max-statements\nexport default async function parse3DTilesSubtree(\n data: ArrayBuffer,\n options: LoaderOptions | undefined,\n context: LoaderContext | undefined\n): Promise<Subtree> {\n const magic = new Uint32Array(data.slice(0, 4));\n\n if (magic[0] !== SUBTREE_FILE_MAGIC) {\n throw new Error('Wrong subtree file magic number');\n }\n\n const version = new Uint32Array(data.slice(4, 8));\n\n if (version[0] !== SUBTREE_FILE_VERSION) {\n throw new Error('Wrong subtree file verson, must be 1');\n }\n\n const jsonByteLength = parseUint64Value(data.slice(8, 16));\n const stringAttribute = new Uint8Array(data, 24, jsonByteLength);\n\n const textDecoder = new TextDecoder('utf8');\n const string = textDecoder.decode(stringAttribute);\n const subtree = JSON.parse(string);\n\n const binaryByteLength = parseUint64Value(data.slice(16, 24));\n let internalBinaryBuffer = new ArrayBuffer(0);\n\n if (binaryByteLength) {\n internalBinaryBuffer = data.slice(24 + jsonByteLength);\n }\n\n await loadExplicitBitstream(subtree, subtree.tileAvailability, internalBinaryBuffer, context);\n if (Array.isArray(subtree.contentAvailability)) {\n for (const contentAvailability of subtree.contentAvailability) {\n await loadExplicitBitstream(subtree, contentAvailability, internalBinaryBuffer, context);\n }\n } else {\n await loadExplicitBitstream(\n subtree,\n subtree.contentAvailability,\n internalBinaryBuffer,\n context\n );\n }\n await loadExplicitBitstream(\n subtree,\n subtree.childSubtreeAvailability,\n internalBinaryBuffer,\n context\n );\n\n return subtree;\n}\n\n/**\n * Load explicit bitstream for subtree availability data.\n * @param subtree - subtree data\n * @param availabilityObject - tileAvailability / contentAvailability / childSubtreeAvailability object\n * @param internalBinaryBuffer - subtree binary buffer\n * @param context - loaders.gl context\n */\nasync function loadExplicitBitstream(\n subtree: Subtree,\n availabilityObject: Availability,\n internalBinaryBuffer: ArrayBuffer,\n context: LoaderContext | undefined\n): Promise<void> {\n const bufferViewIndex = Number.isFinite(availabilityObject.bitstream)\n ? availabilityObject.bitstream\n : availabilityObject.bufferView;\n\n if (typeof bufferViewIndex !== 'number') {\n return;\n }\n\n const bufferView = subtree.bufferViews[bufferViewIndex];\n const buffer = subtree.buffers[bufferView.buffer];\n\n if (!context?.baseUrl) {\n throw new Error('Url is not provided');\n }\n\n if (!context.fetch) {\n throw new Error('fetch is not provided');\n }\n\n // External bitstream loading\n if (buffer.uri) {\n const bufferUri = `${context?.baseUrl || ''}/${buffer.uri}`;\n const response = await context.fetch(bufferUri);\n const data = await response.arrayBuffer();\n availabilityObject.explicitBitstream = new Uint8Array(\n data,\n bufferView.byteOffset,\n bufferView.byteLength\n );\n return;\n }\n availabilityObject.explicitBitstream = new Uint8Array(\n internalBinaryBuffer,\n bufferView.byteOffset,\n bufferView.byteLength\n );\n}\n\n/**\n * Parse buffer to return uint64 value\n * @param buffer\n * @returns 64-bit value until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Value(buffer: ArrayBuffer): number {\n const dataView = new DataView(buffer);\n const left = dataView.getUint32(0, true);\n const right = dataView.getUint32(4, true);\n // combine the two 32-bit values\n return left + 2 ** 32 * right;\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAMA,kBAAkB,GAAG,UAAU;AACrC,IAAMC,oBAAoB,GAAG,CAAC;AAA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iB,GAAG,IAAI/C,UAAU,CACnDb,oBAAoB,EACpB2C,UAAU,CAACkB,UAAU,EACrBlB,UAAU,CAACmB,UACb,CAAC;QAAC;QAAA;UAAA,OAAAd,SAAA,CAAAd,IAAA;MAAA;IAAA,GAAAM,QAAA;EAAA,CACH;EAAA,OAAAD,sBAAA,CAAAzD,KAAA,OAAAC,SAAA;AAAA;AAOD,SAAS6B,gBAAgBA,CAACgC,MAAmB,EAAU;EACrD,IAAMmB,QAAQ,GAAG,IAAIC,QAAQ,CAACpB,MAAM,CAAC;EACrC,IAAMqB,IAAI,GAAGF,QAAQ,CAACG,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC;EACxC,IAAMC,KAAK,GAAGJ,QAAQ,CAACG,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC;EAEzC,OAAOD,IAAI,GAAGG,IAAA,CAAAC,GAAA,EAAC,EAAI,EAAE,IAAGF,KAAK;AAC/B"}
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = void 0;
|
|
7
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
7
|
+
var VERSION = typeof "4.0.0-alpha.13" !== 'undefined' ? "4.0.0-alpha.13" : 'latest';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
package/dist/es5/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {GLTFPostprocessed} from '@loaders.gl/gltf';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {Matrix4, Vector3} from '@math.gl/core';\nimport {TILESET_TYPE, LOD_METRIC_TYPE, TILE_TYPE, TILE_REFINEMENT} from '@loaders.gl/tiles';\n\nexport type FeatureTableJson = {\n [key: string]: any[];\n};\n\nexport type B3DMContent = {\n batchTableJson?: FeatureTableJson;\n byteLength: number;\n byteOffset: number;\n cartesianModelMatrix: Matrix4;\n cartesianOrigin: Vector3;\n cartographicModelMatrix: Matrix4;\n cartographicOrigin: Vector3;\n featureIds?: number[] | null;\n featureTableBinary?: Uint8Array;\n featureTableJson?: FeatureTableJson;\n gltf?: GLTFPostprocessed;\n gltfUpAxis: string;\n header: GLTFHeader;\n magic: number;\n modelMatrix: Matrix4;\n rotateYtoZ: boolean;\n rtcCenter: [number, number, number];\n type: string;\n version: number;\n};\n\nexport type GLTFHeader = {\n batchLength?: number;\n batchTableBinaryByteLength: number;\n batchTableJsonByteLength: number;\n featureTableBinaryByteLength: number;\n featureTableJsonByteLength: number;\n};\n\n/**\n * A 3D Tiles tileset JSON\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#property-reference\n */\nexport type Tiles3DTilesetJSON = {\n /** Metadata about the entire tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#asset\n */\n asset: {\n /** The 3D Tiles version. The version defines the JSON schema for the tileset JSON and the base set of tile formats. */\n version: string;\n /** Application-specific version of this tileset, e.g., for when an existing tileset is updated. */\n tilesetVersion?: string;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n /** Not mentioned in 1.0 spec but some tilesets contain this option */\n gltfUpAxis?: string;\n };\n /** A dictionary object of metadata about per-feature properties. */\n properties?: Record<string, TilesetProperty>;\n /** The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /** A tile in a 3D Tiles tileset. */\n root: Tiles3DTileJSON;\n /** Names of 3D Tiles extensions used somewhere in this tileset. */\n extensionsUsed?: string[];\n /** Names of 3D Tiles extensions required to properly load this tileset. */\n extensionsRequired?: string[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** TilesetJSON postprocessed by Tiles3DLoader */\nexport type Tiles3DTilesetJSONPostprocessed = Omit<Tiles3DTilesetJSON, 'root'> & {\n /**\n * Loader used\n * @deprecated\n */\n loader: LoaderWithParser;\n /** URL used to load a tileset resource */\n url: string;\n /** HTTP request query string */\n queryString: string;\n /** base path that non-absolute paths in tileset are relative to. */\n basePath: string;\n /** tileset type */\n type: TILESET_TYPE.TILES3D;\n /** LOD metric type */\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue: number;\n /** Postprocessed root */\n root: Tiles3DTileJSONPostprocessed;\n};\n\n/**\n * A tile in a 3D Tiles tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#tile\n */\nexport type Tiles3DTileJSON = {\n /** A bounding volume that encloses a tile or its content. */\n boundingVolume: Tile3DBoundingVolume;\n /** A bounding volume that encloses a tile or its content. */\n viewerRequestVolume?: object;\n /** The error, in meters, introduced if this tile is rendered and its children are not. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: string;\n /** A floating-point 4x4 affine transformation matrix, stored in column-major order, that transforms the tile's content */\n transform?: number[];\n /** Metadata about the tile's content and a link to the content. */\n content?: Tiles3DTileContentJSON;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSON[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n\n /** 3DTiles v1.1 properties\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.schema.json\n */\n /** This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally. */\n implicitTiling?: ImplicitTilingData;\n};\n\nexport type Tiles3DTileJSONPostprocessed = Omit<Tiles3DTileJSON, 'refine' | 'children'> & {\n /** Unique ID */\n id?: string;\n /** Content full URL */\n contentUrl?: string;\n /** LOD metric type */\n lodMetricType?: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue?: number;\n /** Duplicate of transform */\n transformMatrix?: number[];\n /** Type of tile */\n type?: TILE_TYPE | string;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: TILE_REFINEMENT | string;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSONPostprocessed[];\n};\n\n/** Metadata about the tile's content and a link to the content. */\nexport type Tiles3DTileContentJSON = {\n /** A uri that points to the tile's content. When the uri is relative, it is relative to the referring tileset JSON file. */\n uri: string;\n /** url doesn't allign the spec but we support it same way as uri */\n url?: string;\n /** A bounding volume that encloses a tile or its content. At least one bounding volume property is required. Bounding volumes include box, region, or sphere. */\n boundingVolume?: Tile3DBoundingVolume;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** A bounding volume that encloses a tile or its content.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#bounding-volume\n */\nexport type Tile3DBoundingVolume = {\n /** An array of 12 numbers that define an oriented bounding box. The first three elements define the x, y, and z values for the center of the box.\n * The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length. The next three elements (indices 6, 7, and 8) define\n * the y axis direction and half-length. The last three elements (indices 9, 10, and 11) define the z axis direction and half-length. */\n box?: number[];\n /** An array of four numbers that define a bounding sphere. The first three elements define the x, y, and z values for the center of the sphere.\n * The last element (with index 3) defines the radius in meters. */\n sphere?: number[];\n /** An array of six numbers that define a bounding geographic region in EPSG:4979 coordinates with the order [west, south, east, north, minimum height, maximum height].\n * Longitudes and latitudes are in radians, and heights are in meters above (or below) the WGS84 ellipsoid. */\n region?: number[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/**\n * A dictionary object of metadata about per-feature properties.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#properties\n */\nexport type TilesetProperty = {\n /** The maximum value of this property of all the features in the tileset. */\n maximum: number;\n /** The minimum value of this property of all the features in the tileset. */\n minimum: number;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\nexport type Tiles3DTileContent = {\n /** Common properties */\n byteOffset?: number;\n type?: string;\n featureIds?: null;\n\n /** 3DTile header */\n magic?: number;\n version?: number;\n byteLength?: number;\n\n /** 3DTile tables header */\n header?: {\n featureTableJsonByteLength?: number;\n featureTableBinaryByteLength?: number;\n batchTableJsonByteLength?: number;\n batchTableBinaryByteLength?: number;\n batchLength?: number;\n };\n\n /** 3DTile tables */\n featureTableJson?:\n | {\n BATCH_LENGTH?: number;\n }\n | Record<string, any>;\n featureTableBinary?: Uint8Array;\n batchTableJson?: Record<string, (string | number)[]>;\n batchTableBinary?: Uint8Array;\n rtcCenter?: number[];\n\n /** 3DTile glTF */\n gltfArrayBuffer?: ArrayBuffer;\n gltfByteOffset?: number;\n gltfByteLength?: number;\n rotateYtoZ?: boolean;\n gltfUpAxis?: 'x' | 'X' | 'y' | 'Y' | 'z' | 'Z';\n gltfUrl?: string;\n gpuMemoryUsageInBytes?: number;\n gltf?: GLTFPostprocessed;\n\n /** For Composite tiles */\n tilesLength?: number;\n tiles?: Tiles3DTileContent[];\n\n /** For Instances model and Pointcloud tiles */\n featuresLength?: number;\n\n /** For Instanced model tiles */\n gltfFormat?: number;\n eastNorthUp?: boolean;\n normalUp?: number[];\n normalRight?: number[];\n hasCustomOrientation?: boolean;\n octNormalUp?: number[];\n octNormalRight?: number[];\n instances?: {\n modelMatrix: Matrix4;\n batchId: number;\n }[];\n\n /** For Pointcloud tiles */\n attributes?: {\n positions: null | number[];\n colors:\n | null\n | number[]\n | {type: number; value: Uint8ClampedArray; size: number; normalized: boolean};\n normals: null | number[] | {type: number; size: number; value: Float32Array};\n batchIds: null | number[];\n };\n constantRGBA?: number[];\n isQuantized?: boolean;\n isTranslucent?: boolean;\n isRGB565?: boolean;\n isOctEncoded16P?: boolean;\n pointsLength?: number;\n pointCount?: number;\n batchIds?: number[];\n hasPositions?: boolean;\n hasColors?: boolean;\n hasNormals?: boolean;\n hasBatchIds?: boolean;\n quantizedVolumeScale?: Vector3;\n quantizedVolumeOffset?: Vector3;\n quantizedRange?: number;\n isQuantizedDraco?: boolean;\n octEncodedRange?: number;\n isOctEncodedDraco?: boolean;\n};\n\n/**\n * 3DTILES_implicit_tiling types\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subtree-file-format\n */\nexport type Subtree = {\n buffers: Buffer[];\n bufferViews: BufferView[];\n tileAvailability: Availability;\n contentAvailability: Availability;\n childSubtreeAvailability: Availability;\n};\n\nexport type Availability = {\n constant?: 0 | 1;\n bufferView?: number;\n // Internal bitstream type\n explicitBitstream?: ExplicitBitstream;\n};\n\nexport type ExplicitBitstream = Uint8Array;\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-scheme\n */\nexport type SubdivisionScheme = 'QUADTREE' | 'OCTREE';\n\ntype Buffer = {\n name: string;\n uri?: string;\n byteLength: number;\n};\n\ntype BufferView = {\n buffer: number;\n byteOffset: number;\n byteLength: number;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n */\nexport type ImplicitTilingExensionData = ImplicitTilingData & {\n maximumLevel?: number;\n};\n\n/** 3DTiles v1.1 types */\n\n/**\n * This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally.\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.implicitTiling.schema.json\n * */\ntype ImplicitTilingData = {\n /** A string describing the subdivision scheme used within the tileset. */\n subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;\n /** The number of distinct levels in each subtree. For example, a quadtree with `subtreeLevels = 2` will have subtrees with 5 nodes (one root and 4 children). */\n subtreeLevels: number;\n /** The numbers of the levels in the tree with available tiles. */\n availableLevels: number;\n /** An object describing the location of subtree files. */\n subtrees: {\n /** A template URI pointing to subtree files. A subtree is a fixed-depth (defined by `subtreeLevels`) portion of the tree to keep memory use bounded.\n * The URI of each file is substituted with the subtree root's global level, x, and y. For subdivision scheme `OCTREE`, z shall also be given. Relative paths are relative to the tileset JSON. */\n uri: string;\n };\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {GLTFPostprocessed} from '@loaders.gl/gltf';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {Matrix4, Vector3} from '@math.gl/core';\nimport {TILESET_TYPE, LOD_METRIC_TYPE, TILE_TYPE, TILE_REFINEMENT} from '@loaders.gl/tiles';\n\nexport type FeatureTableJson = {\n [key: string]: any[];\n};\n\nexport type B3DMContent = {\n batchTableJson?: FeatureTableJson;\n byteLength: number;\n byteOffset: number;\n cartesianModelMatrix: Matrix4;\n cartesianOrigin: Vector3;\n cartographicModelMatrix: Matrix4;\n cartographicOrigin: Vector3;\n featureIds?: number[] | null;\n featureTableBinary?: Uint8Array;\n featureTableJson?: FeatureTableJson;\n gltf?: GLTFPostprocessed;\n gltfUpAxis: string;\n header: GLTFHeader;\n magic: number;\n modelMatrix: Matrix4;\n rotateYtoZ: boolean;\n rtcCenter: [number, number, number];\n type: string;\n version: number;\n};\n\nexport type GLTFHeader = {\n batchLength?: number;\n batchTableBinaryByteLength: number;\n batchTableJsonByteLength: number;\n featureTableBinaryByteLength: number;\n featureTableJsonByteLength: number;\n};\n\n/**\n * A 3D Tiles tileset JSON\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#property-reference\n */\nexport type Tiles3DTilesetJSON = {\n /** Metadata about the entire tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#asset\n */\n asset: {\n /** The 3D Tiles version. The version defines the JSON schema for the tileset JSON and the base set of tile formats. */\n version: string;\n /** Application-specific version of this tileset, e.g., for when an existing tileset is updated. */\n tilesetVersion?: string;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n /** Not mentioned in 1.0 spec but some tilesets contain this option */\n gltfUpAxis?: string;\n };\n /** A dictionary object of metadata about per-feature properties. */\n properties?: Record<string, TilesetProperty>;\n /** The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /** A tile in a 3D Tiles tileset. */\n root: Tiles3DTileJSON;\n /** Names of 3D Tiles extensions used somewhere in this tileset. */\n extensionsUsed?: string[];\n /** Names of 3D Tiles extensions required to properly load this tileset. */\n extensionsRequired?: string[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** TilesetJSON postprocessed by Tiles3DLoader */\nexport type Tiles3DTilesetJSONPostprocessed = Omit<Tiles3DTilesetJSON, 'root'> & {\n /**\n * Loader used\n * @deprecated\n */\n loader: LoaderWithParser;\n /** URL used to load a tileset resource */\n url: string;\n /** HTTP request query string */\n queryString: string;\n /** base path that non-absolute paths in tileset are relative to. */\n basePath: string;\n /** tileset type */\n type: TILESET_TYPE.TILES3D;\n /** LOD metric type */\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue: number;\n /** Postprocessed root */\n root: Tiles3DTileJSONPostprocessed;\n};\n\n/**\n * A tile in a 3D Tiles tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#tile\n */\nexport type Tiles3DTileJSON = {\n /** A bounding volume that encloses a tile or its content. */\n boundingVolume: Tile3DBoundingVolume;\n /** A bounding volume that encloses a tile or its content. */\n viewerRequestVolume?: object;\n /** The error, in meters, introduced if this tile is rendered and its children are not. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: string;\n /** A floating-point 4x4 affine transformation matrix, stored in column-major order, that transforms the tile's content */\n transform?: number[];\n /** Metadata about the tile's content and a link to the content. */\n content?: Tiles3DTileContentJSON;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSON[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n\n /** 3DTiles v1.1 properties\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.schema.json\n */\n /** This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally. */\n implicitTiling?: ImplicitTilingData;\n};\n\nexport type Tiles3DTileJSONPostprocessed = Omit<Tiles3DTileJSON, 'refine' | 'children'> & {\n /** Unique ID */\n id?: string;\n /** Content full URL */\n contentUrl?: string;\n /** LOD metric type */\n lodMetricType?: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue?: number;\n /** Duplicate of transform */\n transformMatrix?: number[];\n /** Type of tile */\n type?: TILE_TYPE | string;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: TILE_REFINEMENT | string;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSONPostprocessed[];\n};\n\n/** Metadata about the tile's content and a link to the content. */\nexport type Tiles3DTileContentJSON = {\n /** A uri that points to the tile's content. When the uri is relative, it is relative to the referring tileset JSON file. */\n uri: string;\n /** url doesn't allign the spec but we support it same way as uri */\n url?: string;\n /** A bounding volume that encloses a tile or its content. At least one bounding volume property is required. Bounding volumes include box, region, or sphere. */\n boundingVolume?: Tile3DBoundingVolume;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** A bounding volume that encloses a tile or its content.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#bounding-volume\n */\nexport type Tile3DBoundingVolume = {\n /** An array of 12 numbers that define an oriented bounding box. The first three elements define the x, y, and z values for the center of the box.\n * The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length. The next three elements (indices 6, 7, and 8) define\n * the y axis direction and half-length. The last three elements (indices 9, 10, and 11) define the z axis direction and half-length. */\n box?: number[];\n /** An array of four numbers that define a bounding sphere. The first three elements define the x, y, and z values for the center of the sphere.\n * The last element (with index 3) defines the radius in meters. */\n sphere?: number[];\n /** An array of six numbers that define a bounding geographic region in EPSG:4979 coordinates with the order [west, south, east, north, minimum height, maximum height].\n * Longitudes and latitudes are in radians, and heights are in meters above (or below) the WGS84 ellipsoid. */\n region?: number[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/**\n * A dictionary object of metadata about per-feature properties.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#properties\n */\nexport type TilesetProperty = {\n /** The maximum value of this property of all the features in the tileset. */\n maximum: number;\n /** The minimum value of this property of all the features in the tileset. */\n minimum: number;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\nexport type Tiles3DTileContent = {\n /** Common properties */\n byteOffset?: number;\n type?: string;\n featureIds?: null;\n\n /** 3DTile header */\n magic?: number;\n version?: number;\n byteLength?: number;\n\n /** 3DTile tables header */\n header?: {\n featureTableJsonByteLength?: number;\n featureTableBinaryByteLength?: number;\n batchTableJsonByteLength?: number;\n batchTableBinaryByteLength?: number;\n batchLength?: number;\n };\n\n /** 3DTile tables */\n featureTableJson?:\n | {\n BATCH_LENGTH?: number;\n }\n | Record<string, any>;\n featureTableBinary?: Uint8Array;\n batchTableJson?: Record<string, (string | number)[]>;\n batchTableBinary?: Uint8Array;\n rtcCenter?: number[];\n\n /** 3DTile glTF */\n gltfArrayBuffer?: ArrayBuffer;\n gltfByteOffset?: number;\n gltfByteLength?: number;\n rotateYtoZ?: boolean;\n gltfUpAxis?: 'x' | 'X' | 'y' | 'Y' | 'z' | 'Z';\n gltfUrl?: string;\n gpuMemoryUsageInBytes?: number;\n gltf?: GLTFPostprocessed;\n\n /** For Composite tiles */\n tilesLength?: number;\n tiles?: Tiles3DTileContent[];\n\n /** For Instances model and Pointcloud tiles */\n featuresLength?: number;\n\n /** For Instanced model tiles */\n gltfFormat?: number;\n eastNorthUp?: boolean;\n normalUp?: number[];\n normalRight?: number[];\n hasCustomOrientation?: boolean;\n octNormalUp?: number[];\n octNormalRight?: number[];\n instances?: {\n modelMatrix: Matrix4;\n batchId: number;\n }[];\n\n /** For Pointcloud tiles */\n attributes?: {\n positions: null | number[];\n colors:\n | null\n | number[]\n | {type: number; value: Uint8ClampedArray; size: number; normalized: boolean};\n normals: null | number[] | {type: number; size: number; value: Float32Array};\n batchIds: null | number[];\n };\n constantRGBA?: number[];\n isQuantized?: boolean;\n isTranslucent?: boolean;\n isRGB565?: boolean;\n isOctEncoded16P?: boolean;\n pointsLength?: number;\n pointCount?: number;\n batchIds?: number[];\n hasPositions?: boolean;\n hasColors?: boolean;\n hasNormals?: boolean;\n hasBatchIds?: boolean;\n quantizedVolumeScale?: Vector3;\n quantizedVolumeOffset?: Vector3;\n quantizedRange?: number;\n isQuantizedDraco?: boolean;\n octEncodedRange?: number;\n isOctEncodedDraco?: boolean;\n};\n\n/**\n * 3DTILES_implicit_tiling types\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * JSON Schema v1.1 https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/specification/schema/Subtree/subtree.schema.json\n * JSON Schema vNext https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/extensions/3DTILES_implicit_tiling/schema/subtree/subtree.schema.json\n */\nexport type Subtree = {\n /** An array of buffers. */\n buffers: Buffer[];\n /** An array of buffer views. */\n bufferViews: BufferView[];\n /** The availability of tiles in the subtree. The availability bitstream is a 1D boolean array where tiles are ordered by their level in the subtree and Morton index\n * within that level. A tile's availability is determined by a single bit, 1 meaning a tile exists at that spatial index, and 0 meaning it does not.\n * The number of elements in the array is `(N^subtreeLevels - 1)/(N - 1)` where N is 4 for subdivision scheme `QUADTREE` and 8 for `OCTREE`.\n * Availability may be stored in a buffer view or as a constant value that applies to all tiles. If a non-root tile's availability is 1 its parent\n * tile's availability shall also be 1. `tileAvailability.constant: 0` is disallowed, as subtrees shall have at least one tile.\n */\n tileAvailability: Availability;\n /** It is array by spec but there are tiles that has a single object\n * An array of content availability objects. If the tile has a single content this array will have one element; if the tile has multiple contents -\n * as supported by 3DTILES_multiple_contents and 3D Tiles 1.1 - this array will have multiple elements.\n */\n contentAvailability: Availability | Availability[];\n /** The availability of children subtrees. The availability bitstream is a 1D boolean array where subtrees are ordered by their Morton index in the level of the tree\n * immediately below the bottom row of the subtree. A child subtree's availability is determined by a single bit, 1 meaning a subtree exists at that spatial index,\n * and 0 meaning it does not. The number of elements in the array is `N^subtreeLevels` where N is 4 for subdivision scheme `QUADTREE` and 8 for `OCTREE`.\n * Availability may be stored in a buffer view or as a constant value that applies to all child subtrees. If availability is 0 for all child subtrees,\n * then the tileset does not subdivide further.\n */\n childSubtreeAvailability: Availability;\n // TODO: These are unused properties. Improve types when they are required\n propertyTables: unknown;\n tileMetadata: unknown;\n contentMetadata: unknown;\n subtreeMetadata: unknown;\n};\n\nexport type Availability = {\n /** Integer indicating whether all of the elements are available (1) or all are unavailable (0). */\n constant?: 0 | 1;\n /** Index of a buffer view that indicates whether each element is available. The bitstream conforms to the boolean array encoding described\n * in the 3D Metadata specification. If an element is available, its bit is 1, and if it is unavailable, its bit is 0. */\n bitstream?: number;\n /**\n * v1.1 https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/specification/schema/Subtree/availability.schema.json\n * vNext https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/extensions/3DTILES_implicit_tiling/schema/subtree/availability.schema.json\n * The schemas of vNext and 1.1 are same but there are tiles with `bufferView` property instead of `bitstream`\n */\n bufferView?: number;\n /**\n * Postprocessing property\n * contain availability bits loaded from the bufferView\n */\n explicitBitstream?: ExplicitBitstream;\n};\n\nexport type ExplicitBitstream = Uint8Array;\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-scheme\n */\nexport type SubdivisionScheme = 'QUADTREE' | 'OCTREE';\n\ntype Buffer = {\n name: string;\n uri?: string;\n byteLength: number;\n};\n\n/** Subtree buffer view */\nexport type BufferView = {\n buffer: number;\n byteOffset: number;\n byteLength: number;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n */\nexport type ImplicitTilingExensionData = ImplicitTilingData & {\n maximumLevel?: number;\n};\n\n/** 3DTiles v1.1 types */\n\n/**\n * This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally.\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.implicitTiling.schema.json\n * */\ntype ImplicitTilingData = {\n /** A string describing the subdivision scheme used within the tileset. */\n subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;\n /** The number of distinct levels in each subtree. For example, a quadtree with `subtreeLevels = 2` will have subtrees with 5 nodes (one root and 4 children). */\n subtreeLevels: number;\n /** The numbers of the levels in the tree with available tiles. */\n availableLevels: number;\n /** An object describing the location of subtree files. */\n subtrees: {\n /** A template URI pointing to subtree files. A subtree is a fixed-depth (defined by `subtreeLevels`) portion of the tree to keep memory use bounded.\n * The URI of each file is substituted with the subtree root's global level, x, and y. For subdivision scheme `OCTREE`, z shall also be given. Relative paths are relative to the tileset JSON. */\n uri: string;\n };\n};\n"],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tile3DSubtreeLoader } from '../../../tile-3d-subtree-loader';
|
|
2
2
|
import { load } from '@loaders.gl/core';
|
|
3
|
+
import { default as log } from '@probe.gl/log';
|
|
3
4
|
import { getS2CellIdFromToken, getS2ChildCellId, getS2TokenFromCellId } from '../../utils/s2/index';
|
|
4
5
|
import { convertS2BoundingVolumetoOBB } from '../../utils/obb/s2-corners-to-obb';
|
|
5
6
|
const QUADTREE_DEVISION_COUNT = 4;
|
|
@@ -149,11 +150,20 @@ export async function parseImplicitTiles(params) {
|
|
|
149
150
|
return tile;
|
|
150
151
|
}
|
|
151
152
|
function getAvailabilityResult(availabilityData, index) {
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
let availabilityObject;
|
|
154
|
+
if (Array.isArray(availabilityData)) {
|
|
155
|
+
availabilityObject = availabilityData[0];
|
|
156
|
+
if (availabilityData.length > 1) {
|
|
157
|
+
log.once('Not supported extension "3DTILES_multiple_contents" has been detected');
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
availabilityObject = availabilityData;
|
|
161
|
+
}
|
|
162
|
+
if ('constant' in availabilityObject) {
|
|
163
|
+
return Boolean(availabilityObject.constant);
|
|
154
164
|
}
|
|
155
|
-
if (
|
|
156
|
-
return getBooleanValueFromBitstream(index,
|
|
165
|
+
if (availabilityObject.explicitBitstream) {
|
|
166
|
+
return getBooleanValueFromBitstream(index, availabilityObject.explicitBitstream);
|
|
157
167
|
}
|
|
158
168
|
return false;
|
|
159
169
|
}
|