@loaders.gl/3d-tiles 4.3.0-alpha.6 → 4.3.0-alpha.8
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/3d-tiles-archive-loader.js +1 -1
- package/dist/cesium-ion-loader.d.ts +1 -1
- package/dist/dist.dev.js +11624 -12546
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +71 -71
- package/dist/index.cjs.map +2 -2
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -1
- package/dist/lib/classes/tile-3d-batch-table.d.ts +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +35 -19
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +108 -85
- package/dist/lib/utils/version.js +1 -1
- package/package.json +14 -14
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +130 -116
package/dist/index.cjs
CHANGED
|
@@ -48,7 +48,7 @@ var import_loader_utils8 = require("@loaders.gl/loader-utils");
|
|
|
48
48
|
var import_tiles2 = require("@loaders.gl/tiles");
|
|
49
49
|
|
|
50
50
|
// dist/lib/utils/version.js
|
|
51
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
51
|
+
var VERSION = true ? "4.3.0-alpha.7" : "latest";
|
|
52
52
|
|
|
53
53
|
// dist/lib/constants.js
|
|
54
54
|
var TILE3D_TYPE = {
|
|
@@ -1810,95 +1810,89 @@ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
|
|
|
1810
1810
|
return void 0;
|
|
1811
1811
|
}
|
|
1812
1812
|
async function parseImplicitTiles(params) {
|
|
1813
|
-
const {
|
|
1814
|
-
mortonIndex: 0,
|
|
1815
|
-
x: 0,
|
|
1816
|
-
y: 0,
|
|
1817
|
-
z: 0
|
|
1818
|
-
}, childIndex = 0, s2VolumeBox, loaderOptions } = params;
|
|
1819
|
-
let { subtree, level = 0, globalData = {
|
|
1813
|
+
const { subtree, subtreeData = {
|
|
1820
1814
|
level: 0,
|
|
1821
|
-
mortonIndex: 0,
|
|
1822
1815
|
x: 0,
|
|
1823
1816
|
y: 0,
|
|
1824
1817
|
z: 0
|
|
1825
|
-
}
|
|
1818
|
+
}, parentData = {
|
|
1819
|
+
mortonIndex: 0,
|
|
1820
|
+
localLevel: -1,
|
|
1821
|
+
localX: 0,
|
|
1822
|
+
localY: 0,
|
|
1823
|
+
localZ: 0
|
|
1824
|
+
}, childIndex = 0, implicitOptions, loaderOptions, s2VolumeBox } = params;
|
|
1826
1825
|
const { subdivisionScheme, subtreeLevels, maximumLevel, contentUrlTemplate, subtreesUriTemplate, basePath } = implicitOptions;
|
|
1827
1826
|
const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
|
|
1828
1827
|
if (!maximumLevel) {
|
|
1829
1828
|
import_log.default.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
|
|
1830
1829
|
return tile;
|
|
1831
1830
|
}
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1831
|
+
const localLevel = parentData.localLevel + 1;
|
|
1832
|
+
const level = subtreeData.level + localLevel;
|
|
1833
|
+
if (level > maximumLevel) {
|
|
1834
1834
|
return tile;
|
|
1835
1835
|
}
|
|
1836
1836
|
const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];
|
|
1837
1837
|
const bitsPerTile = Math.log2(childrenPerTile);
|
|
1838
|
-
const
|
|
1839
|
-
const
|
|
1840
|
-
const
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
const z = concatBits(globalData.z, childTileZ, level);
|
|
1838
|
+
const lastBitX = childIndex & 1;
|
|
1839
|
+
const lastBitY = childIndex >> 1 & 1;
|
|
1840
|
+
const lastBitZ = childIndex >> 2 & 1;
|
|
1841
|
+
const localX = concatBits(parentData.localX, lastBitX, 1);
|
|
1842
|
+
const localY = concatBits(parentData.localY, lastBitY, 1);
|
|
1843
|
+
const localZ = concatBits(parentData.localZ, lastBitZ, 1);
|
|
1844
|
+
const x = concatBits(subtreeData.x, localX, localLevel);
|
|
1845
|
+
const y = concatBits(subtreeData.y, localY, localLevel);
|
|
1846
|
+
const z = concatBits(subtreeData.z, localZ, localLevel);
|
|
1847
|
+
const mortonIndex = concatBits(parentData.mortonIndex, childIndex, bitsPerTile);
|
|
1848
|
+
const isChildSubtreeAvailable = localLevel === subtreeLevels && getAvailabilityResult(subtree.childSubtreeAvailability, mortonIndex);
|
|
1849
|
+
let nextSubtree;
|
|
1850
|
+
let nextSubtreeData;
|
|
1851
|
+
let nextParentData;
|
|
1852
|
+
let tileAvailabilityIndex;
|
|
1854
1853
|
if (isChildSubtreeAvailable) {
|
|
1855
1854
|
const subtreePath = `${basePath}/${subtreesUriTemplate}`;
|
|
1856
|
-
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath,
|
|
1855
|
+
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, level, x, y, z);
|
|
1857
1856
|
const childSubtree = await (0, import_core7.load)(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
|
|
1858
|
-
|
|
1859
|
-
globalData = {
|
|
1860
|
-
mortonIndex: childTileMortonIndex,
|
|
1861
|
-
x: childTileX,
|
|
1862
|
-
y: childTileY,
|
|
1863
|
-
z: childTileZ,
|
|
1864
|
-
level
|
|
1865
|
-
};
|
|
1866
|
-
childTileMortonIndex = 0;
|
|
1857
|
+
nextSubtree = childSubtree;
|
|
1867
1858
|
tileAvailabilityIndex = 0;
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1859
|
+
nextSubtreeData = { level, x, y, z };
|
|
1860
|
+
nextParentData = { mortonIndex: 0, localLevel: 0, localX: 0, localY: 0, localZ: 0 };
|
|
1861
|
+
} else {
|
|
1862
|
+
nextSubtree = subtree;
|
|
1863
|
+
const levelOffset = (childrenPerTile ** localLevel - 1) / (childrenPerTile - 1);
|
|
1864
|
+
tileAvailabilityIndex = levelOffset + mortonIndex;
|
|
1865
|
+
nextSubtreeData = subtreeData;
|
|
1866
|
+
nextParentData = { mortonIndex, localLevel, localX, localY, localZ };
|
|
1872
1867
|
}
|
|
1873
|
-
const isTileAvailable = getAvailabilityResult(
|
|
1868
|
+
const isTileAvailable = getAvailabilityResult(nextSubtree.tileAvailability, tileAvailabilityIndex);
|
|
1874
1869
|
if (!isTileAvailable) {
|
|
1875
1870
|
return tile;
|
|
1876
1871
|
}
|
|
1877
|
-
const isContentAvailable = getAvailabilityResult(
|
|
1872
|
+
const isContentAvailable = getAvailabilityResult(nextSubtree.contentAvailability, tileAvailabilityIndex);
|
|
1878
1873
|
if (isContentAvailable) {
|
|
1879
|
-
tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate,
|
|
1874
|
+
tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, level, x, y, z);
|
|
1880
1875
|
}
|
|
1881
|
-
const childTileLevel = level + 1;
|
|
1882
|
-
const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
|
|
1883
1876
|
for (let index = 0; index < childrenPerTile; index++) {
|
|
1884
1877
|
const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
|
|
1885
|
-
const
|
|
1886
|
-
subtree,
|
|
1878
|
+
const childTile = await parseImplicitTiles({
|
|
1879
|
+
subtree: nextSubtree,
|
|
1880
|
+
subtreeData: nextSubtreeData,
|
|
1881
|
+
parentData: nextParentData,
|
|
1882
|
+
childIndex: index,
|
|
1887
1883
|
implicitOptions,
|
|
1888
1884
|
loaderOptions,
|
|
1889
|
-
parentData: pData,
|
|
1890
|
-
childIndex: index,
|
|
1891
|
-
level: childTileLevel,
|
|
1892
|
-
globalData: { ...globalData },
|
|
1893
1885
|
s2VolumeBox: childS2VolumeBox
|
|
1894
1886
|
});
|
|
1895
|
-
if (
|
|
1896
|
-
|
|
1897
|
-
const childCoordinates = { childTileX, childTileY, childTileZ };
|
|
1898
|
-
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
|
|
1899
|
-
tile.children.push(formattedTile);
|
|
1887
|
+
if (childTile.contentUrl || childTile.children.length) {
|
|
1888
|
+
tile.children.push(childTile);
|
|
1900
1889
|
}
|
|
1901
1890
|
}
|
|
1891
|
+
if (tile.contentUrl || tile.children.length) {
|
|
1892
|
+
const coordinates = { level, x, y, z };
|
|
1893
|
+
const formattedTile = formatTileData(tile, coordinates, implicitOptions, s2VolumeBox);
|
|
1894
|
+
return formattedTile;
|
|
1895
|
+
}
|
|
1902
1896
|
return tile;
|
|
1903
1897
|
}
|
|
1904
1898
|
function getAvailabilityResult(availabilityData, index) {
|
|
@@ -1919,12 +1913,12 @@ function getAvailabilityResult(availabilityData, index) {
|
|
|
1919
1913
|
}
|
|
1920
1914
|
return false;
|
|
1921
1915
|
}
|
|
1922
|
-
function formatTileData(tile,
|
|
1916
|
+
function formatTileData(tile, coordinates, options, s2VolumeBox) {
|
|
1923
1917
|
const { basePath, refine, getRefine: getRefine2, lodMetricType, getTileType: getTileType2, rootLodMetricValue, rootBoundingVolume } = options;
|
|
1924
1918
|
const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
|
|
1925
|
-
const lodMetricValue = rootLodMetricValue / 2 ** level;
|
|
1919
|
+
const lodMetricValue = rootLodMetricValue / 2 ** coordinates.level;
|
|
1926
1920
|
const boundingVolume = (s2VolumeBox == null ? void 0 : s2VolumeBox.box) ? { box: s2VolumeBox.box } : rootBoundingVolume;
|
|
1927
|
-
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(
|
|
1921
|
+
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(boundingVolume, coordinates, options.subdivisionScheme);
|
|
1928
1922
|
return {
|
|
1929
1923
|
children: tile.children,
|
|
1930
1924
|
contentUrl: tile.contentUrl,
|
|
@@ -1939,20 +1933,26 @@ function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
|
|
|
1939
1933
|
boundingVolume: boundingVolumeForChildTile
|
|
1940
1934
|
};
|
|
1941
1935
|
}
|
|
1942
|
-
function calculateBoundingVolumeForChildTile(
|
|
1936
|
+
function calculateBoundingVolumeForChildTile(rootBoundingVolume, coordinates, subdivisionScheme) {
|
|
1943
1937
|
if (rootBoundingVolume.region) {
|
|
1944
|
-
const {
|
|
1938
|
+
const { level, x, y, z } = coordinates;
|
|
1945
1939
|
const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;
|
|
1946
1940
|
const boundingVolumesCount = 2 ** level;
|
|
1947
1941
|
const sizeX = (east - west) / boundingVolumesCount;
|
|
1942
|
+
const [childWest, childEast] = [west + sizeX * x, west + sizeX * (x + 1)];
|
|
1948
1943
|
const sizeY = (north - south) / boundingVolumesCount;
|
|
1949
|
-
const
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1944
|
+
const [childSouth, childNorth] = [south + sizeY * y, south + sizeY * (y + 1)];
|
|
1945
|
+
let childMinimumHeight;
|
|
1946
|
+
let childMaximumHeight;
|
|
1947
|
+
if (subdivisionScheme === "OCTREE") {
|
|
1948
|
+
const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;
|
|
1949
|
+
[childMinimumHeight, childMaximumHeight] = [
|
|
1950
|
+
minimumHeight + sizeZ * z,
|
|
1951
|
+
minimumHeight + sizeZ * (z + 1)
|
|
1952
|
+
];
|
|
1953
|
+
} else {
|
|
1954
|
+
[childMinimumHeight, childMaximumHeight] = [minimumHeight, maximumHeight];
|
|
1955
|
+
}
|
|
1956
1956
|
return {
|
|
1957
1957
|
region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
|
|
1958
1958
|
};
|
|
@@ -2390,7 +2390,7 @@ var parse3DTilesArchive = async (fileProvider, cb) => {
|
|
|
2390
2390
|
};
|
|
2391
2391
|
|
|
2392
2392
|
// dist/3d-tiles-archive-loader.js
|
|
2393
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
2393
|
+
var VERSION2 = true ? "4.3.0-alpha.7" : "latest";
|
|
2394
2394
|
var Tiles3DArchiveFileLoader = {
|
|
2395
2395
|
dataType: null,
|
|
2396
2396
|
batchType: null,
|