Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/3d-tiles

Package Overview
Dependencies
Maintainers
10
Versions
321
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/3d-tiles - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

343

dist/es5/lib/ion/ion.js

@@ -16,2 +16,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _core = require("@loaders.gl/core");

@@ -27,208 +29,229 @@

function getIonTilesetMetadata(accessToken, assetId) {
var assets, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, ionAssetMetadata, type, url;
function getIonTilesetMetadata(_x, _x2) {
return _getIonTilesetMetadata.apply(this, arguments);
}
return _regenerator["default"].async(function getIonTilesetMetadata$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (assetId) {
_context.next = 23;
break;
}
function _getIonTilesetMetadata() {
_getIonTilesetMetadata = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(accessToken, assetId) {
var assets, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, ionAssetMetadata, type, url;
_context.next = 3;
return _regenerator["default"].awrap(getIonAssets(accessToken));
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (assetId) {
_context.next = 23;
break;
}
case 3:
assets = _context.sent;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 7;
_context.next = 3;
return getIonAssets(accessToken);
for (_iterator = assets.items[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
item = _step.value;
case 3:
assets = _context.sent;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 7;
if (item.type === '3DTILES') {
assetId = item.id;
for (_iterator = assets.items[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
item = _step.value;
if (item.type === '3DTILES') {
assetId = item.id;
}
}
}
_context.next = 15;
break;
_context.next = 15;
break;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](7);
_didIteratorError = true;
_iteratorError = _context.t0;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](7);
_didIteratorError = true;
_iteratorError = _context.t0;
case 15:
_context.prev = 15;
_context.prev = 16;
case 15:
_context.prev = 15;
_context.prev = 16;
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
case 18:
_context.prev = 18;
case 18:
_context.prev = 18;
if (!_didIteratorError) {
_context.next = 21;
break;
}
if (!_didIteratorError) {
_context.next = 21;
break;
}
throw _iteratorError;
throw _iteratorError;
case 21:
return _context.finish(18);
case 21:
return _context.finish(18);
case 22:
return _context.finish(15);
case 22:
return _context.finish(15);
case 23:
_context.next = 25;
return _regenerator["default"].awrap(getIonAssetMetadata(accessToken, assetId));
case 23:
_context.next = 25;
return getIonAssetMetadata(accessToken, assetId);
case 25:
ionAssetMetadata = _context.sent;
type = ionAssetMetadata.type, url = ionAssetMetadata.url;
(0, _assert["default"])(type === '3DTILES' && url);
ionAssetMetadata.headers = {
Authorization: "Bearer ".concat(ionAssetMetadata.accessToken)
};
return _context.abrupt("return", ionAssetMetadata);
case 25:
ionAssetMetadata = _context.sent;
type = ionAssetMetadata.type, url = ionAssetMetadata.url;
(0, _assert["default"])(type === '3DTILES' && url);
ionAssetMetadata.headers = {
Authorization: "Bearer ".concat(ionAssetMetadata.accessToken)
};
return _context.abrupt("return", ionAssetMetadata);
case 30:
case "end":
return _context.stop();
case 30:
case "end":
return _context.stop();
}
}
}
}, null, null, [[7, 11, 15, 23], [16,, 18, 22]]);
}, _callee, null, [[7, 11, 15, 23], [16,, 18, 22]]);
}));
return _getIonTilesetMetadata.apply(this, arguments);
}
function getIonAssets(accessToken) {
var url, headers, response;
return _regenerator["default"].async(function getIonAssets$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
(0, _assert["default"])(accessToken);
url = CESIUM_ION_URL;
headers = {
Authorization: "Bearer ".concat(accessToken)
};
_context2.next = 5;
return _regenerator["default"].awrap(fetch(url, {
headers: headers
}));
function getIonAssets(_x3) {
return _getIonAssets.apply(this, arguments);
}
case 5:
response = _context2.sent;
function _getIonAssets() {
_getIonAssets = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(accessToken) {
var url, headers, response;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
(0, _assert["default"])(accessToken);
url = CESIUM_ION_URL;
headers = {
Authorization: "Bearer ".concat(accessToken)
};
_context2.next = 5;
return fetch(url, {
headers: headers
});
if (response.ok) {
_context2.next = 12;
break;
}
case 5:
response = _context2.sent;
_context2.t0 = Error;
_context2.next = 10;
return _regenerator["default"].awrap((0, _core._getErrorMessageFromResponse)(response));
if (response.ok) {
_context2.next = 12;
break;
}
case 10:
_context2.t1 = _context2.sent;
throw new _context2.t0(_context2.t1);
_context2.t0 = Error;
_context2.next = 10;
return (0, _core._getErrorMessageFromResponse)(response);
case 12:
_context2.next = 14;
return _regenerator["default"].awrap(response.json());
case 10:
_context2.t1 = _context2.sent;
throw new _context2.t0(_context2.t1);
case 14:
return _context2.abrupt("return", _context2.sent);
case 12:
_context2.next = 14;
return response.json();
case 15:
case "end":
return _context2.stop();
case 14:
return _context2.abrupt("return", _context2.sent);
case 15:
case "end":
return _context2.stop();
}
}
}
});
}, _callee2);
}));
return _getIonAssets.apply(this, arguments);
}
function getIonAssetMetadata(accessToken, assetId) {
var headers, url, response, metadata, tilesetInfo;
return _regenerator["default"].async(function getIonAssetMetadata$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
(0, _assert["default"])(accessToken, assetId);
headers = {
Authorization: "Bearer ".concat(accessToken)
};
url = "".concat(CESIUM_ION_URL, "/").concat(assetId);
_context3.next = 5;
return _regenerator["default"].awrap(fetch("".concat(url), {
headers: headers
}));
function getIonAssetMetadata(_x4, _x5) {
return _getIonAssetMetadata.apply(this, arguments);
}
case 5:
response = _context3.sent;
function _getIonAssetMetadata() {
_getIonAssetMetadata = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(accessToken, assetId) {
var headers, url, response, metadata, tilesetInfo;
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
(0, _assert["default"])(accessToken, assetId);
headers = {
Authorization: "Bearer ".concat(accessToken)
};
url = "".concat(CESIUM_ION_URL, "/").concat(assetId);
_context3.next = 5;
return fetch("".concat(url), {
headers: headers
});
if (response.ok) {
_context3.next = 12;
break;
}
case 5:
response = _context3.sent;
_context3.t0 = Error;
_context3.next = 10;
return _regenerator["default"].awrap((0, _core._getErrorMessageFromResponse)(response));
if (response.ok) {
_context3.next = 12;
break;
}
case 10:
_context3.t1 = _context3.sent;
throw new _context3.t0(_context3.t1);
_context3.t0 = Error;
_context3.next = 10;
return (0, _core._getErrorMessageFromResponse)(response);
case 12:
_context3.next = 14;
return _regenerator["default"].awrap(response.json());
case 10:
_context3.t1 = _context3.sent;
throw new _context3.t0(_context3.t1);
case 14:
metadata = _context3.sent;
_context3.next = 17;
return _regenerator["default"].awrap(fetch("".concat(url, "/endpoint"), {
headers: headers
}));
case 12:
_context3.next = 14;
return response.json();
case 17:
response = _context3.sent;
case 14:
metadata = _context3.sent;
_context3.next = 17;
return fetch("".concat(url, "/endpoint"), {
headers: headers
});
if (response.ok) {
_context3.next = 24;
break;
}
case 17:
response = _context3.sent;
_context3.t2 = Error;
_context3.next = 22;
return _regenerator["default"].awrap((0, _core._getErrorMessageFromResponse)(response));
if (response.ok) {
_context3.next = 24;
break;
}
case 22:
_context3.t3 = _context3.sent;
throw new _context3.t2(_context3.t3);
_context3.t2 = Error;
_context3.next = 22;
return (0, _core._getErrorMessageFromResponse)(response);
case 24:
_context3.next = 26;
return _regenerator["default"].awrap(response.json());
case 22:
_context3.t3 = _context3.sent;
throw new _context3.t2(_context3.t3);
case 26:
tilesetInfo = _context3.sent;
metadata = _objectSpread({}, metadata, {}, tilesetInfo);
return _context3.abrupt("return", metadata);
case 24:
_context3.next = 26;
return response.json();
case 29:
case "end":
return _context3.stop();
case 26:
tilesetInfo = _context3.sent;
metadata = _objectSpread({}, metadata, {}, tilesetInfo);
return _context3.abrupt("return", metadata);
case 29:
case "end":
return _context3.stop();
}
}
}
});
}, _callee3);
}));
return _getIonAssetMetadata.apply(this, arguments);
}
//# sourceMappingURL=ion.js.map

@@ -15,2 +15,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _gltf = require("@loaders.gl/gltf");

@@ -45,50 +47,57 @@

function extractGLTF(tile, gltfFormat, options, context) {
var parse, fetch;
return _regenerator["default"].async(function extractGLTF$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
extractGLTFBufferOrURL(tile, gltfFormat, options);
function extractGLTF(_x, _x2, _x3, _x4) {
return _extractGLTF.apply(this, arguments);
}
if (!options.loadGLTF) {
_context.next = 15;
break;
}
function _extractGLTF() {
_extractGLTF = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tile, gltfFormat, options, context) {
var parse, fetch;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
extractGLTFBufferOrURL(tile, gltfFormat, options);
parse = context.parse, fetch = context.fetch;
if (!options.loadGLTF) {
_context.next = 15;
break;
}
if (!tile.gltfUrl) {
_context.next = 8;
break;
}
parse = context.parse, fetch = context.fetch;
_context.next = 6;
return _regenerator["default"].awrap(fetch(tile.gltfUrl, options));
if (!tile.gltfUrl) {
_context.next = 8;
break;
}
case 6:
tile.gltfArrayBuffer = _context.sent;
tile.gltfByteOffset = 0;
_context.next = 6;
return fetch(tile.gltfUrl, options);
case 8:
if (!tile.gltfArrayBuffer) {
_context.next = 15;
break;
}
case 6:
tile.gltfArrayBuffer = _context.sent;
tile.gltfByteOffset = 0;
_context.next = 11;
return _regenerator["default"].awrap(parse(tile.gltfArrayBuffer, _gltf.GLTFLoader, options, context));
case 8:
if (!tile.gltfArrayBuffer) {
_context.next = 15;
break;
}
case 11:
tile.gltf = _context.sent;
delete tile.gltfArrayBuffer;
delete tile.gltfByteOffset;
delete tile.gltfByteLength;
_context.next = 11;
return parse(tile.gltfArrayBuffer, _gltf.GLTFLoader, options, context);
case 15:
case "end":
return _context.stop();
case 11:
tile.gltf = _context.sent;
delete tile.gltfArrayBuffer;
delete tile.gltfByteOffset;
delete tile.gltfByteLength;
case 15:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _extractGLTF.apply(this, arguments);
}

@@ -95,0 +104,0 @@

@@ -13,2 +13,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _math = require("@loaders.gl/math");

@@ -24,20 +26,27 @@

function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
return _regenerator["default"].async(function parseBatchedModel3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return _regenerator["default"].awrap((0, _parse3dTileGltfView.extractGLTF)(tile, _parse3dTileGltfView.GLTF_FORMAT.EMBEDDED, options, context));
function parseBatchedModel3DTile(_x, _x2, _x3, _x4, _x5) {
return _parseBatchedModel3DTile.apply(this, arguments);
}
case 3:
return _context.abrupt("return", byteOffset);
function _parseBatchedModel3DTile() {
_parseBatchedModel3DTile = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return (0, _parse3dTileGltfView.extractGLTF)(tile, _parse3dTileGltfView.GLTF_FORMAT.EMBEDDED, options, context);
case 4:
case "end":
return _context.stop();
case 3:
return _context.abrupt("return", byteOffset);
case 4:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parseBatchedModel3DTile.apply(this, arguments);
}

@@ -44,0 +53,0 @@

@@ -12,42 +12,51 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _parse3dTileHeader = require("./helpers/parse-3d-tile-header");
function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile) {
var view, subtile;
return _regenerator["default"].async(function parseComposite3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset, options);
view = new DataView(arrayBuffer);
tile.tilesLength = view.getUint32(byteOffset, true);
byteOffset += 4;
tile.tiles = [];
function parseComposite3DTile(_x, _x2, _x3, _x4, _x5, _x6) {
return _parseComposite3DTile.apply(this, arguments);
}
case 5:
if (!(tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12)) {
_context.next = 13;
break;
}
function _parseComposite3DTile() {
_parseComposite3DTile = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tile, arrayBuffer, byteOffset, options, context, parse3DTile) {
var view, subtile;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset, options);
view = new DataView(arrayBuffer);
tile.tilesLength = view.getUint32(byteOffset, true);
byteOffset += 4;
tile.tiles = [];
subtile = {};
tile.tiles.push(subtile);
_context.next = 10;
return _regenerator["default"].awrap(parse3DTile(arrayBuffer, byteOffset, options, context, subtile));
case 5:
if (!(tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12)) {
_context.next = 13;
break;
}
case 10:
byteOffset = _context.sent;
_context.next = 5;
break;
subtile = {};
tile.tiles.push(subtile);
_context.next = 10;
return parse3DTile(arrayBuffer, byteOffset, options, context, subtile);
case 13:
return _context.abrupt("return", byteOffset);
case 10:
byteOffset = _context.sent;
_context.next = 5;
break;
case 14:
case "end":
return _context.stop();
case 13:
return _context.abrupt("return", byteOffset);
case 14:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parseComposite3DTile.apply(this, arguments);
}
//# sourceMappingURL=parse-3d-tile-composite.js.map

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _math = require("math.gl");

@@ -29,20 +31,27 @@

function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
return _regenerator["default"].async(function parseInstancedModel3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return _regenerator["default"].awrap((0, _parse3dTileGltfView.extractGLTF)(tile, tile.gltfFormat, options, context));
function parseInstancedModel3DTile(_x, _x2, _x3, _x4, _x5) {
return _parseInstancedModel3DTile.apply(this, arguments);
}
case 3:
return _context.abrupt("return", byteOffset);
function _parseInstancedModel3DTile() {
_parseInstancedModel3DTile = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return (0, _parse3dTileGltfView.extractGLTF)(tile, tile.gltfFormat, options, context);
case 4:
case "end":
return _context.stop();
case 3:
return _context.abrupt("return", byteOffset);
case 4:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parseInstancedModel3DTile.apply(this, arguments);
}

@@ -49,0 +58,0 @@

@@ -15,2 +15,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _math = require("math.gl");

@@ -38,29 +40,36 @@

function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
var _parsePointCloudTable, featureTable, batchTable;
function parsePointCloud3DTile(_x, _x2, _x3, _x4, _x5) {
return _parsePointCloud3DTile.apply(this, arguments);
}
return _regenerator["default"].async(function parsePointCloud3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset, options);
byteOffset = (0, _parse3dTileTables.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset, options);
byteOffset = (0, _parse3dTileTables.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
initializeTile(tile);
_parsePointCloudTable = parsePointCloudTables(tile), featureTable = _parsePointCloudTable.featureTable, batchTable = _parsePointCloudTable.batchTable;
_context.next = 7;
return _regenerator["default"].awrap(parseDraco(tile, featureTable, batchTable, options, context));
function _parsePointCloud3DTile() {
_parsePointCloud3DTile = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
var _parsePointCloudTable, featureTable, batchTable;
case 7:
parsePositions(tile, featureTable, options);
parseColors(tile, featureTable, batchTable, options);
parseNormals(tile, featureTable, options);
return _context.abrupt("return", byteOffset);
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset, options);
byteOffset = (0, _parse3dTileTables.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset, options);
byteOffset = (0, _parse3dTileTables.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
initializeTile(tile);
_parsePointCloudTable = parsePointCloudTables(tile), featureTable = _parsePointCloudTable.featureTable, batchTable = _parsePointCloudTable.batchTable;
_context.next = 7;
return parseDraco(tile, featureTable, batchTable, options, context);
case 11:
case "end":
return _context.stop();
case 7:
parsePositions(tile, featureTable, options);
parseColors(tile, featureTable, batchTable, options);
parseNormals(tile, featureTable, options);
return _context.abrupt("return", byteOffset);
case 11:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parsePointCloud3DTile.apply(this, arguments);
}

@@ -189,117 +198,131 @@

function parseDraco(tile, featureTable, batchTable, options, context) {
var dracoBuffer, dracoFeatureTableProperties, dracoBatchTableProperties, batchTableDraco, featureTableDraco, dracoByteOffset, dracoByteLength, dracoData;
return _regenerator["default"].async(function parseDraco$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
batchTableDraco = batchTable && batchTable.getExtension('3DTILES_draco_point_compression');
function parseDraco(_x6, _x7, _x8, _x9, _x10) {
return _parseDraco.apply(this, arguments);
}
if (batchTableDraco) {
dracoBatchTableProperties = batchTableDraco.properties;
}
function _parseDraco() {
_parseDraco = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(tile, featureTable, batchTable, options, context) {
var dracoBuffer, dracoFeatureTableProperties, dracoBatchTableProperties, batchTableDraco, featureTableDraco, dracoByteOffset, dracoByteLength, dracoData;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
batchTableDraco = batchTable && batchTable.getExtension('3DTILES_draco_point_compression');
featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
if (batchTableDraco) {
dracoBatchTableProperties = batchTableDraco.properties;
}
if (!featureTableDraco) {
_context2.next = 15;
break;
}
featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
dracoFeatureTableProperties = featureTableDraco.properties;
dracoByteOffset = featureTableDraco.byteOffset;
dracoByteLength = featureTableDraco.byteLength;
if (!featureTableDraco) {
_context2.next = 15;
break;
}
if (!(!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength)) {
_context2.next = 9;
break;
}
dracoFeatureTableProperties = featureTableDraco.properties;
dracoByteOffset = featureTableDraco.byteOffset;
dracoByteLength = featureTableDraco.byteLength;
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
if (!(!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength)) {
_context2.next = 9;
break;
}
case 9:
dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
case 15:
if (dracoBuffer) {
_context2.next = 17;
break;
}
case 9:
dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
return _context2.abrupt("return", true);
case 15:
if (dracoBuffer) {
_context2.next = 17;
break;
}
case 17:
dracoData = {
buffer: dracoBuffer,
properties: _objectSpread({}, dracoFeatureTableProperties, {}, dracoBatchTableProperties),
featureTableProperties: dracoFeatureTableProperties,
batchTableProperties: dracoBatchTableProperties,
dequantizeInShader: false
};
_context2.next = 20;
return _regenerator["default"].awrap(loadDraco(tile, dracoData, options, context));
return _context2.abrupt("return", true);
case 20:
return _context2.abrupt("return", _context2.sent);
case 17:
dracoData = {
buffer: dracoBuffer,
properties: _objectSpread({}, dracoFeatureTableProperties, {}, dracoBatchTableProperties),
featureTableProperties: dracoFeatureTableProperties,
batchTableProperties: dracoBatchTableProperties,
dequantizeInShader: false
};
_context2.next = 20;
return loadDraco(tile, dracoData, options, context);
case 21:
case "end":
return _context2.stop();
case 20:
return _context2.abrupt("return", _context2.sent);
case 21:
case "end":
return _context2.stop();
}
}
}
});
}, _callee2);
}));
return _parseDraco.apply(this, arguments);
}
function loadDraco(tile, dracoData, options, context) {
var parse, data, decodedPositions, decodedColors, decodedNormals, decodedBatchIds, isQuantizedDraco, isOctEncodedDraco, quantization, range;
return _regenerator["default"].async(function loadDraco$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
parse = context.parse;
_context3.next = 3;
return _regenerator["default"].awrap(parse(dracoData.buffer, {}));
function loadDraco(_x11, _x12, _x13, _x14) {
return _loadDraco.apply(this, arguments);
}
case 3:
data = _context3.sent;
decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
function _loadDraco() {
_loadDraco = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(tile, dracoData, options, context) {
var parse, data, decodedPositions, decodedColors, decodedNormals, decodedBatchIds, isQuantizedDraco, isOctEncodedDraco, quantization, range;
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
parse = context.parse;
_context3.next = 3;
return parse(dracoData.buffer, {});
if (isQuantizedDraco) {
quantization = data.POSITION.data.quantization;
range = quantization.range;
tile.quantizedVolumeScale = new _math.Vector3(range, range, range);
tile.quantizedVolumeOffset = new _math.Vector3(quantization.minValues);
tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
tile.isQuantizedDraco = true;
}
case 3:
data = _context3.sent;
decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
if (isOctEncodedDraco) {
tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
tile.isOctEncodedDraco = true;
}
if (isQuantizedDraco) {
quantization = data.POSITION.data.quantization;
range = quantization.range;
tile.quantizedVolumeScale = new _math.Vector3(range, range, range);
tile.quantizedVolumeOffset = new _math.Vector3(quantization.minValues);
tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
tile.isQuantizedDraco = true;
}
tile.attributes = {
positions: decodedPositions,
colors: (0, _normalize3dTileColors.normalize3DTileColorAttribute)(tile, decodedColors),
normals: decodedNormals,
batchIds: decodedBatchIds
};
if (isOctEncodedDraco) {
tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
tile.isOctEncodedDraco = true;
}
case 13:
case "end":
return _context3.stop();
tile.attributes = {
positions: decodedPositions,
colors: (0, _normalize3dTileColors.normalize3DTileColorAttribute)(tile, decodedColors),
normals: decodedNormals,
batchIds: decodedBatchIds
};
case 13:
case "end":
return _context3.stop();
}
}
}
});
}, _callee3);
}));
return _loadDraco.apply(this, arguments);
}
//# sourceMappingURL=parse-3d-tile-point-cloud.js.map

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _constants = require("../constants");

@@ -25,61 +27,68 @@

function parse3DTile(arrayBuffer) {
var byteOffset,
options,
context,
tile,
_args = arguments;
return _regenerator["default"].async(function parse3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
options = _args.length > 2 ? _args[2] : undefined;
context = _args.length > 3 ? _args[3] : undefined;
tile = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
options = options['3d-tiles'] || {};
tile.byteOffset = byteOffset;
tile.type = (0, _parseUtils.getMagicString)(arrayBuffer, byteOffset);
_context.t0 = tile.type;
_context.next = _context.t0 === _constants.TILE3D_TYPE.COMPOSITE ? 10 : _context.t0 === _constants.TILE3D_TYPE.BATCHED_3D_MODEL ? 13 : _context.t0 === _constants.TILE3D_TYPE.INSTANCED_3D_MODEL ? 16 : _context.t0 === _constants.TILE3D_TYPE.POINT_CLOUD ? 19 : 22;
break;
function parse3DTile(_x) {
return _parse3DTile.apply(this, arguments);
}
case 10:
_context.next = 12;
return _regenerator["default"].awrap((0, _parse3dTileComposite.parseComposite3DTile)(tile, arrayBuffer, byteOffset, options, context, parse3DTile));
function _parse3DTile() {
_parse3DTile = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(arrayBuffer) {
var byteOffset,
options,
context,
tile,
_args = arguments;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
options = _args.length > 2 ? _args[2] : undefined;
context = _args.length > 3 ? _args[3] : undefined;
tile = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
options = options['3d-tiles'] || {};
tile.byteOffset = byteOffset;
tile.type = (0, _parseUtils.getMagicString)(arrayBuffer, byteOffset);
_context.t0 = tile.type;
_context.next = _context.t0 === _constants.TILE3D_TYPE.COMPOSITE ? 10 : _context.t0 === _constants.TILE3D_TYPE.BATCHED_3D_MODEL ? 13 : _context.t0 === _constants.TILE3D_TYPE.INSTANCED_3D_MODEL ? 16 : _context.t0 === _constants.TILE3D_TYPE.POINT_CLOUD ? 19 : 22;
break;
case 12:
return _context.abrupt("return", _context.sent);
case 10:
_context.next = 12;
return (0, _parse3dTileComposite.parseComposite3DTile)(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
case 13:
_context.next = 15;
return _regenerator["default"].awrap((0, _parse3dTileBatchedModel.parseBatchedModel3DTile)(tile, arrayBuffer, byteOffset, options, context));
case 12:
return _context.abrupt("return", _context.sent);
case 15:
return _context.abrupt("return", _context.sent);
case 13:
_context.next = 15;
return (0, _parse3dTileBatchedModel.parseBatchedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
case 16:
_context.next = 18;
return _regenerator["default"].awrap((0, _parse3dTileInstancedModel.parseInstancedModel3DTile)(tile, arrayBuffer, byteOffset, options, context));
case 15:
return _context.abrupt("return", _context.sent);
case 18:
return _context.abrupt("return", _context.sent);
case 16:
_context.next = 18;
return (0, _parse3dTileInstancedModel.parseInstancedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
case 19:
_context.next = 21;
return _regenerator["default"].awrap((0, _parse3dTilePointCloud.parsePointCloud3DTile)(tile, arrayBuffer, byteOffset, options, context));
case 18:
return _context.abrupt("return", _context.sent);
case 21:
return _context.abrupt("return", _context.sent);
case 19:
_context.next = 21;
return (0, _parse3dTilePointCloud.parsePointCloud3DTile)(tile, arrayBuffer, byteOffset, options, context);
case 22:
throw new Error("3DTileLoader: unknown type ".concat(tile.type));
case 21:
return _context.abrupt("return", _context.sent);
case 23:
case "end":
return _context.stop();
case 22:
throw new Error("3DTileLoader: unknown type ".concat(tile.type));
case 23:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parse3DTile.apply(this, arguments);
}
//# sourceMappingURL=parse-3d-tile.js.map

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

@@ -200,132 +202,140 @@

key: "update",
value: function update(frameState) {
var requestedTiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tile, tilesRenderable, pointsRenderable, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _tile;
value: function () {
var _update = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(frameState) {
var requestedTiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tile, tilesRenderable, pointsRenderable, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _tile;
return _regenerator["default"].async(function update$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this._updatedVisibilityFrame++;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this._updatedVisibilityFrame++;
this._cache.reset();
this._cache.reset();
_context.next = 4;
return _regenerator["default"].awrap(this._traverser.traverse(this.root, frameState, this.options));
_context.next = 4;
return this._traverser.traverse(this.root, frameState, this.options);
case 4:
this._requestedTiles = Object.values(this._traverser.requestedTiles);
this.selectedTiles = Object.values(this._traverser.selectedTiles);
this._emptyTiles = Object.values(this._traverser.emptyTiles);
requestedTiles = this._requestedTiles;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 11;
case 4:
this._requestedTiles = Object.values(this._traverser.requestedTiles);
this.selectedTiles = Object.values(this._traverser.selectedTiles);
this._emptyTiles = Object.values(this._traverser.emptyTiles);
requestedTiles = this._requestedTiles;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 11;
for (_iterator = requestedTiles[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
tile = _step.value;
for (_iterator = requestedTiles[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
tile = _step.value;
this._loadTile(tile, frameState);
}
this._loadTile(tile, frameState);
}
_context.next = 19;
break;
_context.next = 19;
break;
case 15:
_context.prev = 15;
_context.t0 = _context["catch"](11);
_didIteratorError = true;
_iteratorError = _context.t0;
case 15:
_context.prev = 15;
_context.t0 = _context["catch"](11);
_didIteratorError = true;
_iteratorError = _context.t0;
case 19:
_context.prev = 19;
_context.prev = 20;
case 19:
_context.prev = 19;
_context.prev = 20;
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
case 22:
_context.prev = 22;
case 22:
_context.prev = 22;
if (!_didIteratorError) {
_context.next = 25;
break;
}
if (!_didIteratorError) {
_context.next = 25;
break;
}
throw _iteratorError;
throw _iteratorError;
case 25:
return _context.finish(22);
case 25:
return _context.finish(22);
case 26:
return _context.finish(19);
case 26:
return _context.finish(19);
case 27:
this._unloadTiles();
case 27:
this._unloadTiles();
tilesRenderable = 0;
pointsRenderable = 0;
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 33;
tilesRenderable = 0;
pointsRenderable = 0;
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 33;
for (_iterator2 = this.selectedTiles[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
_tile = _step2.value;
for (_iterator2 = this.selectedTiles[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
_tile = _step2.value;
if (_tile.contentAvailable) {
tilesRenderable++;
if (_tile.contentAvailable) {
tilesRenderable++;
if (_tile.content.pointCount) {
pointsRenderable += _tile.content.pointCount;
if (_tile.content.pointCount) {
pointsRenderable += _tile.content.pointCount;
}
}
}
}
_context.next = 41;
break;
_context.next = 41;
break;
case 37:
_context.prev = 37;
_context.t1 = _context["catch"](33);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 37:
_context.prev = 37;
_context.t1 = _context["catch"](33);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 41:
_context.prev = 41;
_context.prev = 42;
case 41:
_context.prev = 41;
_context.prev = 42;
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
case 44:
_context.prev = 44;
case 44:
_context.prev = 44;
if (!_didIteratorError2) {
_context.next = 47;
break;
}
if (!_didIteratorError2) {
_context.next = 47;
break;
}
throw _iteratorError2;
throw _iteratorError2;
case 47:
return _context.finish(44);
case 47:
return _context.finish(44);
case 48:
return _context.finish(41);
case 48:
return _context.finish(41);
case 49:
this.stats.get(TILES_IN_VIEW).count = this.selectedTiles.length;
this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
this.stats.get(POINTS_COUNT).count = pointsRenderable;
case 49:
this.stats.get(TILES_IN_VIEW).count = this.selectedTiles.length;
this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
this.stats.get(POINTS_COUNT).count = pointsRenderable;
case 52:
case "end":
return _context.stop();
case 52:
case "end":
return _context.stop();
}
}
}
}, null, this, [[11, 15, 19, 27], [20,, 22, 26], [33, 37, 41, 49], [42,, 44, 48]]);
}
}, _callee, this, [[11, 15, 19, 27], [20,, 22, 26], [33, 37, 41, 49], [42,, 44, 48]]);
}));
function update(_x) {
return _update.apply(this, arguments);
}
return update;
}()
}, {

@@ -456,54 +466,62 @@ key: "trimLoadedTiles",

key: "_loadTile",
value: function _loadTile(tile, frameState) {
var loaded, message, url;
return _regenerator["default"].async(function _loadTile$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context2.prev = 1;
_context2.next = 4;
return _regenerator["default"].awrap(tile.loadContent(frameState));
value: function () {
var _loadTile2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(tile, frameState) {
var loaded, message, url;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context2.prev = 1;
_context2.next = 4;
return tile.loadContent(frameState);
case 4:
loaded = _context2.sent;
_context2.next = 16;
break;
case 4:
loaded = _context2.sent;
_context2.next = 16;
break;
case 7:
_context2.prev = 7;
_context2.t0 = _context2["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context2.t0.message || _context2.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileLoadFail(tile, message, url);
return _context2.abrupt("return");
case 7:
_context2.prev = 7;
_context2.t0 = _context2["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context2.t0.message || _context2.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileLoadFail(tile, message, url);
return _context2.abrupt("return");
case 16:
this.stats.get(TILES_LOADING).decrementCount();
case 16:
this.stats.get(TILES_LOADING).decrementCount();
if (loaded) {
_context2.next = 19;
break;
}
if (loaded) {
_context2.next = 19;
break;
}
return _context2.abrupt("return");
return _context2.abrupt("return");
case 19:
if (tile && tile._content) {
(0, _transformUtils.calculateTransformProps)(tile, tile._content);
}
case 19:
if (tile && tile._content) {
(0, _transformUtils.calculateTransformProps)(tile, tile._content);
}
this.addTileToCache(tile);
this.options.onTileLoad(tile);
this.addTileToCache(tile);
this.options.onTileLoad(tile);
case 22:
case "end":
return _context2.stop();
case 22:
case "end":
return _context2.stop();
}
}
}
}, null, this, [[1, 7]]);
}
}, _callee2, this, [[1, 7]]);
}));
function _loadTile(_x2, _x3) {
return _loadTile2.apply(this, arguments);
}
return _loadTile;
}()
}, {

@@ -510,0 +528,0 @@ key: "_addTileToCache",

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));

@@ -128,107 +130,115 @@

key: "loadContent",
value: function loadContent(frameState) {
var expired, updatePriority, cancelled, contentUri, response;
return _regenerator["default"].async(function loadContent$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
updatePriority = function _ref(tile) {
if (!tile._visible) {
return -1;
}
value: function () {
var _loadContent = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(frameState) {
var expired, updatePriority, cancelled, contentUri, response;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
updatePriority = function _ref(tile) {
if (!tile._visible) {
return -1;
}
if (tile._contentState === _constants.TILE3D_CONTENT_STATE.UNLOADED) {
return -1;
if (tile._contentState === _constants.TILE3D_CONTENT_STATE.UNLOADED) {
return -1;
}
return Math.max(1e7 - tile._priority, 0) || 0;
};
if (!this.hasEmptyContent) {
_context.next = 3;
break;
}
return Math.max(1e7 - tile._priority, 0) || 0;
};
return _context.abrupt("return", false);
if (!this.hasEmptyContent) {
_context.next = 3;
break;
}
case 3:
if (!this._content) {
_context.next = 5;
break;
}
return _context.abrupt("return", false);
return _context.abrupt("return", true);
case 3:
if (!this._content) {
_context.next = 5;
break;
}
case 5:
expired = this.contentExpired;
return _context.abrupt("return", true);
if (expired) {
this.expireDate = undefined;
}
case 5:
expired = this.contentExpired;
this._contentState = _constants.TILE3D_CONTENT_STATE.LOADING;
_context.next = 10;
return this.tileset._requestScheduler.scheduleRequest(this, updatePriority);
if (expired) {
this.expireDate = undefined;
}
case 10:
cancelled = !_context.sent;
this._contentState = _constants.TILE3D_CONTENT_STATE.LOADING;
_context.next = 10;
return _regenerator["default"].awrap(this.tileset._requestScheduler.scheduleRequest(this, updatePriority));
if (!cancelled) {
_context.next = 14;
break;
}
case 10:
cancelled = !_context.sent;
this._contentState = _constants.TILE3D_CONTENT_STATE.UNLOADED;
return _context.abrupt("return", false);
if (!cancelled) {
_context.next = 14;
break;
}
case 14:
_context.prev = 14;
contentUri = this.uri;
_context.prev = 16;
this._contentState = _constants.TILE3D_CONTENT_STATE.UNLOADED;
return _context.abrupt("return", false);
this.tileset._requestScheduler.startRequest(this);
case 14:
_context.prev = 14;
contentUri = this.uri;
_context.prev = 16;
_context.next = 20;
return (0, _core.fetchFile)(contentUri, this.tileset.options.fetchOptions);
this.tileset._requestScheduler.startRequest(this);
case 20:
response = _context.sent;
_context.next = 20;
return _regenerator["default"].awrap((0, _core.fetchFile)(contentUri, this.tileset.options.fetchOptions));
case 21:
_context.prev = 21;
case 20:
response = _context.sent;
this.tileset._requestScheduler.endRequest(this);
case 21:
_context.prev = 21;
return _context.finish(21);
this.tileset._requestScheduler.endRequest(this);
case 24:
_context.next = 26;
return (0, _core.parse)(response, [_tile3dLoader["default"], _tileset3dLoader["default"]]);
return _context.finish(21);
case 26:
this._content = _context.sent;
case 24:
_context.next = 26;
return _regenerator["default"].awrap((0, _core.parse)(response, [_tile3dLoader["default"], _tileset3dLoader["default"]]));
if (contentUri.indexOf('.json') !== -1) {
this._tileset._initializeTileHeaders(this._content, this, _core.path.dirname(this.uri));
}
case 26:
this._content = _context.sent;
this._contentState = _constants.TILE3D_CONTENT_STATE.READY;
if (contentUri.indexOf('.json') !== -1) {
this._tileset._initializeTileHeaders(this._content, this, _core.path.dirname(this.uri));
}
this._contentLoaded();
this._contentState = _constants.TILE3D_CONTENT_STATE.READY;
return _context.abrupt("return", true);
this._contentLoaded();
case 33:
_context.prev = 33;
_context.t0 = _context["catch"](14);
this._contentState = _constants.TILE3D_CONTENT_STATE.FAILED;
throw _context.t0;
return _context.abrupt("return", true);
case 37:
case "end":
return _context.stop();
}
}
}, _callee, this, [[14, 33], [16,, 21, 24]]);
}));
case 33:
_context.prev = 33;
_context.t0 = _context["catch"](14);
this._contentState = _constants.TILE3D_CONTENT_STATE.FAILED;
throw _context.t0;
function loadContent(_x) {
return _loadContent.apply(this, arguments);
}
case 37:
case "end":
return _context.stop();
}
}
}, null, this, [[14, 33], [16,, 21, 24]]);
}
return loadContent;
}()
}, {

@@ -235,0 +245,0 @@ key: "unloadContent",

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

@@ -411,53 +413,61 @@

key: "_loadTile",
value: function _loadTile(tile, frameState) {
var loaded, message, url;
return _regenerator["default"].async(function _loadTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context.prev = 1;
_context.next = 4;
return _regenerator["default"].awrap(tile.loadContent(frameState));
value: function () {
var _loadTile2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tile, frameState) {
var loaded, message, url;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context.prev = 1;
_context.next = 4;
return tile.loadContent(frameState);
case 4:
loaded = _context.sent;
_context.next = 16;
break;
case 4:
loaded = _context.sent;
_context.next = 16;
break;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context.t0.message || _context.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileError(tile, message, url);
return _context.abrupt("return");
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context.t0.message || _context.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileError(tile, message, url);
return _context.abrupt("return");
case 16:
this.stats.get(TILES_LOADING).decrementCount();
case 16:
this.stats.get(TILES_LOADING).decrementCount();
if (loaded) {
_context.next = 19;
break;
}
if (loaded) {
_context.next = 19;
break;
}
return _context.abrupt("return");
return _context.abrupt("return");
case 19:
if (tile && tile._content) {
(0, _transformUtils.calculateTransformProps)(tile, tile._content);
}
case 19:
if (tile && tile._content) {
(0, _transformUtils.calculateTransformProps)(tile, tile._content);
}
this.options.onTileLoad(tile);
this.options.onTileLoad(tile);
case 21:
case "end":
return _context.stop();
case 21:
case "end":
return _context.stop();
}
}
}
}, null, this, [[1, 7]]);
}
}, _callee, this, [[1, 7]]);
}));
function _loadTile(_x, _x2) {
return _loadTile2.apply(this, arguments);
}
return _loadTile;
}()
}, {

@@ -464,0 +474,0 @@ key: "_addTileToCache",

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _parse3dTile = require("./lib/parsers/parse-3d-tile");

@@ -17,22 +19,29 @@

function parse(arrayBuffer, options, context, loader) {
var tile, byteOffset;
return _regenerator["default"].async(function parse$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
tile = {};
byteOffset = 0;
_context.next = 4;
return _regenerator["default"].awrap((0, _parse3dTile.parse3DTile)(arrayBuffer, byteOffset, options, context, tile));
function parse(_x, _x2, _x3, _x4) {
return _parse.apply(this, arguments);
}
case 4:
return _context.abrupt("return", tile);
function _parse() {
_parse = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(arrayBuffer, options, context, loader) {
var tile, byteOffset;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
tile = {};
byteOffset = 0;
_context.next = 4;
return (0, _parse3dTile.parse3DTile)(arrayBuffer, byteOffset, options, context, tile);
case 5:
case "end":
return _context.stop();
case 4:
return _context.abrupt("return", tile);
case 5:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parse.apply(this, arguments);
}

@@ -39,0 +48,0 @@

@@ -12,2 +12,4 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _default = {

@@ -17,16 +19,24 @@ id: '3d-tileset',

extensions: ['json'],
parse: function parse(arrayBuffer) {
return _regenerator["default"].async(function parse$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", JSON.parse(new TextDecoder().decode(arrayBuffer)));
parse: function () {
var _parse = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(arrayBuffer) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", JSON.parse(new TextDecoder().decode(arrayBuffer)));
case 1:
case "end":
return _context.stop();
case 1:
case "end":
return _context.stop();
}
}
}
});
},
}, _callee);
}));
function parse(_x) {
return _parse.apply(this, arguments);
}
return parse;
}(),
parseTextSync: JSON.parse,

@@ -33,0 +43,0 @@ testText: function testText(text) {

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

@@ -11,206 +12,229 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

var CESIUM_ION_URL = 'https://api.cesium.com/v1/assets';
export function getIonTilesetMetadata(accessToken, assetId) {
var assets, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, ionAssetMetadata, type, url;
export function getIonTilesetMetadata(_x, _x2) {
return _getIonTilesetMetadata.apply(this, arguments);
}
return _regeneratorRuntime.async(function getIonTilesetMetadata$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (assetId) {
_context.next = 23;
break;
}
function _getIonTilesetMetadata() {
_getIonTilesetMetadata = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(accessToken, assetId) {
var assets, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, ionAssetMetadata, type, url;
_context.next = 3;
return _regeneratorRuntime.awrap(getIonAssets(accessToken));
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (assetId) {
_context.next = 23;
break;
}
case 3:
assets = _context.sent;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 7;
_context.next = 3;
return getIonAssets(accessToken);
for (_iterator = assets.items[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
item = _step.value;
case 3:
assets = _context.sent;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 7;
if (item.type === '3DTILES') {
assetId = item.id;
for (_iterator = assets.items[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
item = _step.value;
if (item.type === '3DTILES') {
assetId = item.id;
}
}
}
_context.next = 15;
break;
_context.next = 15;
break;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](7);
_didIteratorError = true;
_iteratorError = _context.t0;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](7);
_didIteratorError = true;
_iteratorError = _context.t0;
case 15:
_context.prev = 15;
_context.prev = 16;
case 15:
_context.prev = 15;
_context.prev = 16;
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
case 18:
_context.prev = 18;
case 18:
_context.prev = 18;
if (!_didIteratorError) {
_context.next = 21;
break;
}
if (!_didIteratorError) {
_context.next = 21;
break;
}
throw _iteratorError;
throw _iteratorError;
case 21:
return _context.finish(18);
case 21:
return _context.finish(18);
case 22:
return _context.finish(15);
case 22:
return _context.finish(15);
case 23:
_context.next = 25;
return _regeneratorRuntime.awrap(getIonAssetMetadata(accessToken, assetId));
case 23:
_context.next = 25;
return getIonAssetMetadata(accessToken, assetId);
case 25:
ionAssetMetadata = _context.sent;
type = ionAssetMetadata.type, url = ionAssetMetadata.url;
assert(type === '3DTILES' && url);
ionAssetMetadata.headers = {
Authorization: "Bearer ".concat(ionAssetMetadata.accessToken)
};
return _context.abrupt("return", ionAssetMetadata);
case 25:
ionAssetMetadata = _context.sent;
type = ionAssetMetadata.type, url = ionAssetMetadata.url;
assert(type === '3DTILES' && url);
ionAssetMetadata.headers = {
Authorization: "Bearer ".concat(ionAssetMetadata.accessToken)
};
return _context.abrupt("return", ionAssetMetadata);
case 30:
case "end":
return _context.stop();
case 30:
case "end":
return _context.stop();
}
}
}
}, null, null, [[7, 11, 15, 23], [16,, 18, 22]]);
}, _callee, null, [[7, 11, 15, 23], [16,, 18, 22]]);
}));
return _getIonTilesetMetadata.apply(this, arguments);
}
export function getIonAssets(accessToken) {
var url, headers, response;
return _regeneratorRuntime.async(function getIonAssets$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
assert(accessToken);
url = CESIUM_ION_URL;
headers = {
Authorization: "Bearer ".concat(accessToken)
};
_context2.next = 5;
return _regeneratorRuntime.awrap(fetch(url, {
headers: headers
}));
case 5:
response = _context2.sent;
export function getIonAssets(_x3) {
return _getIonAssets.apply(this, arguments);
}
if (response.ok) {
_context2.next = 12;
break;
}
function _getIonAssets() {
_getIonAssets = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(accessToken) {
var url, headers, response;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
assert(accessToken);
url = CESIUM_ION_URL;
headers = {
Authorization: "Bearer ".concat(accessToken)
};
_context2.next = 5;
return fetch(url, {
headers: headers
});
_context2.t0 = Error;
_context2.next = 10;
return _regeneratorRuntime.awrap(_getErrorMessageFromResponse(response));
case 5:
response = _context2.sent;
case 10:
_context2.t1 = _context2.sent;
throw new _context2.t0(_context2.t1);
if (response.ok) {
_context2.next = 12;
break;
}
case 12:
_context2.next = 14;
return _regeneratorRuntime.awrap(response.json());
_context2.t0 = Error;
_context2.next = 10;
return _getErrorMessageFromResponse(response);
case 14:
return _context2.abrupt("return", _context2.sent);
case 10:
_context2.t1 = _context2.sent;
throw new _context2.t0(_context2.t1);
case 15:
case "end":
return _context2.stop();
case 12:
_context2.next = 14;
return response.json();
case 14:
return _context2.abrupt("return", _context2.sent);
case 15:
case "end":
return _context2.stop();
}
}
}
});
}, _callee2);
}));
return _getIonAssets.apply(this, arguments);
}
export function getIonAssetMetadata(accessToken, assetId) {
var headers, url, response, metadata, tilesetInfo;
return _regeneratorRuntime.async(function getIonAssetMetadata$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
assert(accessToken, assetId);
headers = {
Authorization: "Bearer ".concat(accessToken)
};
url = "".concat(CESIUM_ION_URL, "/").concat(assetId);
_context3.next = 5;
return _regeneratorRuntime.awrap(fetch("".concat(url), {
headers: headers
}));
case 5:
response = _context3.sent;
export function getIonAssetMetadata(_x4, _x5) {
return _getIonAssetMetadata.apply(this, arguments);
}
if (response.ok) {
_context3.next = 12;
break;
}
function _getIonAssetMetadata() {
_getIonAssetMetadata = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(accessToken, assetId) {
var headers, url, response, metadata, tilesetInfo;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
assert(accessToken, assetId);
headers = {
Authorization: "Bearer ".concat(accessToken)
};
url = "".concat(CESIUM_ION_URL, "/").concat(assetId);
_context3.next = 5;
return fetch("".concat(url), {
headers: headers
});
_context3.t0 = Error;
_context3.next = 10;
return _regeneratorRuntime.awrap(_getErrorMessageFromResponse(response));
case 5:
response = _context3.sent;
case 10:
_context3.t1 = _context3.sent;
throw new _context3.t0(_context3.t1);
if (response.ok) {
_context3.next = 12;
break;
}
case 12:
_context3.next = 14;
return _regeneratorRuntime.awrap(response.json());
_context3.t0 = Error;
_context3.next = 10;
return _getErrorMessageFromResponse(response);
case 14:
metadata = _context3.sent;
_context3.next = 17;
return _regeneratorRuntime.awrap(fetch("".concat(url, "/endpoint"), {
headers: headers
}));
case 10:
_context3.t1 = _context3.sent;
throw new _context3.t0(_context3.t1);
case 17:
response = _context3.sent;
case 12:
_context3.next = 14;
return response.json();
if (response.ok) {
_context3.next = 24;
break;
}
case 14:
metadata = _context3.sent;
_context3.next = 17;
return fetch("".concat(url, "/endpoint"), {
headers: headers
});
_context3.t2 = Error;
_context3.next = 22;
return _regeneratorRuntime.awrap(_getErrorMessageFromResponse(response));
case 17:
response = _context3.sent;
case 22:
_context3.t3 = _context3.sent;
throw new _context3.t2(_context3.t3);
if (response.ok) {
_context3.next = 24;
break;
}
case 24:
_context3.next = 26;
return _regeneratorRuntime.awrap(response.json());
_context3.t2 = Error;
_context3.next = 22;
return _getErrorMessageFromResponse(response);
case 26:
tilesetInfo = _context3.sent;
metadata = _objectSpread({}, metadata, {}, tilesetInfo);
return _context3.abrupt("return", metadata);
case 22:
_context3.t3 = _context3.sent;
throw new _context3.t2(_context3.t3);
case 29:
case "end":
return _context3.stop();
case 24:
_context3.next = 26;
return response.json();
case 26:
tilesetInfo = _context3.sent;
metadata = _objectSpread({}, metadata, {}, tilesetInfo);
return _context3.abrupt("return", metadata);
case 29:
case "end":
return _context3.stop();
}
}
}
});
}, _callee3);
}));
return _getIonAssetMetadata.apply(this, arguments);
}
//# sourceMappingURL=ion.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { GLTFLoader } from '@loaders.gl/gltf';

@@ -26,51 +27,59 @@ import { getZeroOffsetArrayBuffer } from '@loaders.gl/loader-utils';

}
export function extractGLTF(tile, gltfFormat, options, context) {
var parse, fetch;
return _regeneratorRuntime.async(function extractGLTF$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
extractGLTFBufferOrURL(tile, gltfFormat, options);
export function extractGLTF(_x, _x2, _x3, _x4) {
return _extractGLTF.apply(this, arguments);
}
if (!options.loadGLTF) {
_context.next = 15;
break;
}
function _extractGLTF() {
_extractGLTF = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tile, gltfFormat, options, context) {
var parse, fetch;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
extractGLTFBufferOrURL(tile, gltfFormat, options);
parse = context.parse, fetch = context.fetch;
if (!options.loadGLTF) {
_context.next = 15;
break;
}
if (!tile.gltfUrl) {
_context.next = 8;
break;
}
parse = context.parse, fetch = context.fetch;
_context.next = 6;
return _regeneratorRuntime.awrap(fetch(tile.gltfUrl, options));
if (!tile.gltfUrl) {
_context.next = 8;
break;
}
case 6:
tile.gltfArrayBuffer = _context.sent;
tile.gltfByteOffset = 0;
_context.next = 6;
return fetch(tile.gltfUrl, options);
case 8:
if (!tile.gltfArrayBuffer) {
_context.next = 15;
break;
}
case 6:
tile.gltfArrayBuffer = _context.sent;
tile.gltfByteOffset = 0;
_context.next = 11;
return _regeneratorRuntime.awrap(parse(tile.gltfArrayBuffer, GLTFLoader, options, context));
case 8:
if (!tile.gltfArrayBuffer) {
_context.next = 15;
break;
}
case 11:
tile.gltf = _context.sent;
delete tile.gltfArrayBuffer;
delete tile.gltfByteOffset;
delete tile.gltfByteLength;
_context.next = 11;
return parse(tile.gltfArrayBuffer, GLTFLoader, options, context);
case 15:
case "end":
return _context.stop();
case 11:
tile.gltf = _context.sent;
delete tile.gltfArrayBuffer;
delete tile.gltfByteOffset;
delete tile.gltfByteLength;
case 15:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _extractGLTF.apply(this, arguments);
}
export function extractGLTFSync(tile, gltfFormat, options, context) {

@@ -77,0 +86,0 @@ extractGLTFBufferOrURL(tile, gltfFormat, options);

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { GL } from '@loaders.gl/math';

@@ -7,21 +8,29 @@ import Tile3DFeatureTable from '../classes/tile-3d-feature-table';

import { parse3DTileGLTFViewSync, extractGLTF, GLTF_FORMAT } from './helpers/parse-3d-tile-gltf-view';
export function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
return _regeneratorRuntime.async(function parseBatchedModel3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return _regeneratorRuntime.awrap(extractGLTF(tile, GLTF_FORMAT.EMBEDDED, options, context));
export function parseBatchedModel3DTile(_x, _x2, _x3, _x4, _x5) {
return _parseBatchedModel3DTile.apply(this, arguments);
}
case 3:
return _context.abrupt("return", byteOffset);
function _parseBatchedModel3DTile() {
_parseBatchedModel3DTile = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return extractGLTF(tile, GLTF_FORMAT.EMBEDDED, options, context);
case 4:
case "end":
return _context.stop();
case 3:
return _context.abrupt("return", byteOffset);
case 4:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parseBatchedModel3DTile.apply(this, arguments);
}
export function parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {

@@ -28,0 +37,0 @@ byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset, options);

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { parse3DTileHeaderSync } from './helpers/parse-3d-tile-header';
export function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile) {
var view, subtile;
return _regeneratorRuntime.async(function parseComposite3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset, options);
view = new DataView(arrayBuffer);
tile.tilesLength = view.getUint32(byteOffset, true);
byteOffset += 4;
tile.tiles = [];
export function parseComposite3DTile(_x, _x2, _x3, _x4, _x5, _x6) {
return _parseComposite3DTile.apply(this, arguments);
}
case 5:
if (!(tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12)) {
_context.next = 13;
break;
}
function _parseComposite3DTile() {
_parseComposite3DTile = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tile, arrayBuffer, byteOffset, options, context, parse3DTile) {
var view, subtile;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset, options);
view = new DataView(arrayBuffer);
tile.tilesLength = view.getUint32(byteOffset, true);
byteOffset += 4;
tile.tiles = [];
subtile = {};
tile.tiles.push(subtile);
_context.next = 10;
return _regeneratorRuntime.awrap(parse3DTile(arrayBuffer, byteOffset, options, context, subtile));
case 5:
if (!(tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12)) {
_context.next = 13;
break;
}
case 10:
byteOffset = _context.sent;
_context.next = 5;
break;
subtile = {};
tile.tiles.push(subtile);
_context.next = 10;
return parse3DTile(arrayBuffer, byteOffset, options, context, subtile);
case 13:
return _context.abrupt("return", byteOffset);
case 10:
byteOffset = _context.sent;
_context.next = 5;
break;
case 14:
case "end":
return _context.stop();
case 13:
return _context.abrupt("return", byteOffset);
case 14:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parseComposite3DTile.apply(this, arguments);
}
//# sourceMappingURL=parse-3d-tile-composite.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { Vector3, Matrix3, Matrix4, Quaternion } from 'math.gl';

@@ -10,20 +11,27 @@ import { Ellipsoid } from '@math.gl/geospatial';

import { parse3DTileGLTFViewSync, extractGLTF } from './helpers/parse-3d-tile-gltf-view';
export function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
return _regeneratorRuntime.async(function parseInstancedModel3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return _regeneratorRuntime.awrap(extractGLTF(tile, tile.gltfFormat, options, context));
export function parseInstancedModel3DTile(_x, _x2, _x3, _x4, _x5) {
return _parseInstancedModel3DTile.apply(this, arguments);
}
case 3:
return _context.abrupt("return", byteOffset);
function _parseInstancedModel3DTile() {
_parseInstancedModel3DTile = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
_context.next = 3;
return extractGLTF(tile, tile.gltfFormat, options, context);
case 4:
case "end":
return _context.stop();
case 3:
return _context.abrupt("return", byteOffset);
case 4:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parseInstancedModel3DTile.apply(this, arguments);
}

@@ -30,0 +38,0 @@

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

@@ -17,29 +18,36 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

import { normalize3DTilePositionAttribute } from './helpers/normalize-3d-tile-positions';
export function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
var _parsePointCloudTable, featureTable, batchTable;
export function parsePointCloud3DTile(_x, _x2, _x3, _x4, _x5) {
return _parsePointCloud3DTile.apply(this, arguments);
}
return _regeneratorRuntime.async(function parsePointCloud3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset, options);
byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset, options);
byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);
initializeTile(tile);
_parsePointCloudTable = parsePointCloudTables(tile), featureTable = _parsePointCloudTable.featureTable, batchTable = _parsePointCloudTable.batchTable;
_context.next = 7;
return _regeneratorRuntime.awrap(parseDraco(tile, featureTable, batchTable, options, context));
function _parsePointCloud3DTile() {
_parsePointCloud3DTile = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
var _parsePointCloudTable, featureTable, batchTable;
case 7:
parsePositions(tile, featureTable, options);
parseColors(tile, featureTable, batchTable, options);
parseNormals(tile, featureTable, options);
return _context.abrupt("return", byteOffset);
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset, options);
byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset, options);
byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);
initializeTile(tile);
_parsePointCloudTable = parsePointCloudTables(tile), featureTable = _parsePointCloudTable.featureTable, batchTable = _parsePointCloudTable.batchTable;
_context.next = 7;
return parseDraco(tile, featureTable, batchTable, options, context);
case 11:
case "end":
return _context.stop();
case 7:
parsePositions(tile, featureTable, options);
parseColors(tile, featureTable, batchTable, options);
parseNormals(tile, featureTable, options);
return _context.abrupt("return", byteOffset);
case 11:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parsePointCloud3DTile.apply(this, arguments);
}

@@ -168,117 +176,131 @@

function parseDraco(tile, featureTable, batchTable, options, context) {
var dracoBuffer, dracoFeatureTableProperties, dracoBatchTableProperties, batchTableDraco, featureTableDraco, dracoByteOffset, dracoByteLength, dracoData;
return _regeneratorRuntime.async(function parseDraco$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
batchTableDraco = batchTable && batchTable.getExtension('3DTILES_draco_point_compression');
function parseDraco(_x6, _x7, _x8, _x9, _x10) {
return _parseDraco.apply(this, arguments);
}
if (batchTableDraco) {
dracoBatchTableProperties = batchTableDraco.properties;
}
function _parseDraco() {
_parseDraco = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(tile, featureTable, batchTable, options, context) {
var dracoBuffer, dracoFeatureTableProperties, dracoBatchTableProperties, batchTableDraco, featureTableDraco, dracoByteOffset, dracoByteLength, dracoData;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
batchTableDraco = batchTable && batchTable.getExtension('3DTILES_draco_point_compression');
featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
if (batchTableDraco) {
dracoBatchTableProperties = batchTableDraco.properties;
}
if (!featureTableDraco) {
_context2.next = 15;
break;
}
featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
dracoFeatureTableProperties = featureTableDraco.properties;
dracoByteOffset = featureTableDraco.byteOffset;
dracoByteLength = featureTableDraco.byteLength;
if (!featureTableDraco) {
_context2.next = 15;
break;
}
if (!(!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength)) {
_context2.next = 9;
break;
}
dracoFeatureTableProperties = featureTableDraco.properties;
dracoByteOffset = featureTableDraco.byteOffset;
dracoByteLength = featureTableDraco.byteLength;
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
if (!(!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength)) {
_context2.next = 9;
break;
}
case 9:
dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
case 15:
if (dracoBuffer) {
_context2.next = 17;
break;
}
case 9:
dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
return _context2.abrupt("return", true);
case 15:
if (dracoBuffer) {
_context2.next = 17;
break;
}
case 17:
dracoData = {
buffer: dracoBuffer,
properties: _objectSpread({}, dracoFeatureTableProperties, {}, dracoBatchTableProperties),
featureTableProperties: dracoFeatureTableProperties,
batchTableProperties: dracoBatchTableProperties,
dequantizeInShader: false
};
_context2.next = 20;
return _regeneratorRuntime.awrap(loadDraco(tile, dracoData, options, context));
return _context2.abrupt("return", true);
case 20:
return _context2.abrupt("return", _context2.sent);
case 17:
dracoData = {
buffer: dracoBuffer,
properties: _objectSpread({}, dracoFeatureTableProperties, {}, dracoBatchTableProperties),
featureTableProperties: dracoFeatureTableProperties,
batchTableProperties: dracoBatchTableProperties,
dequantizeInShader: false
};
_context2.next = 20;
return loadDraco(tile, dracoData, options, context);
case 21:
case "end":
return _context2.stop();
case 20:
return _context2.abrupt("return", _context2.sent);
case 21:
case "end":
return _context2.stop();
}
}
}
});
}, _callee2);
}));
return _parseDraco.apply(this, arguments);
}
export function loadDraco(tile, dracoData, options, context) {
var parse, data, decodedPositions, decodedColors, decodedNormals, decodedBatchIds, isQuantizedDraco, isOctEncodedDraco, quantization, range;
return _regeneratorRuntime.async(function loadDraco$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
parse = context.parse;
_context3.next = 3;
return _regeneratorRuntime.awrap(parse(dracoData.buffer, {}));
export function loadDraco(_x11, _x12, _x13, _x14) {
return _loadDraco.apply(this, arguments);
}
case 3:
data = _context3.sent;
decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
function _loadDraco() {
_loadDraco = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(tile, dracoData, options, context) {
var parse, data, decodedPositions, decodedColors, decodedNormals, decodedBatchIds, isQuantizedDraco, isOctEncodedDraco, quantization, range;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
parse = context.parse;
_context3.next = 3;
return parse(dracoData.buffer, {});
if (isQuantizedDraco) {
quantization = data.POSITION.data.quantization;
range = quantization.range;
tile.quantizedVolumeScale = new Vector3(range, range, range);
tile.quantizedVolumeOffset = new Vector3(quantization.minValues);
tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
tile.isQuantizedDraco = true;
}
case 3:
data = _context3.sent;
decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
if (isOctEncodedDraco) {
tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
tile.isOctEncodedDraco = true;
}
if (isQuantizedDraco) {
quantization = data.POSITION.data.quantization;
range = quantization.range;
tile.quantizedVolumeScale = new Vector3(range, range, range);
tile.quantizedVolumeOffset = new Vector3(quantization.minValues);
tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
tile.isQuantizedDraco = true;
}
tile.attributes = {
positions: decodedPositions,
colors: normalize3DTileColorAttribute(tile, decodedColors),
normals: decodedNormals,
batchIds: decodedBatchIds
};
if (isOctEncodedDraco) {
tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
tile.isOctEncodedDraco = true;
}
case 13:
case "end":
return _context3.stop();
tile.attributes = {
positions: decodedPositions,
colors: normalize3DTileColorAttribute(tile, decodedColors),
normals: decodedNormals,
batchIds: decodedBatchIds
};
case 13:
case "end":
return _context3.stop();
}
}
}
});
}, _callee3);
}));
return _loadDraco.apply(this, arguments);
}
//# sourceMappingURL=parse-3d-tile-point-cloud.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { TILE3D_TYPE } from '../constants';

@@ -8,61 +9,68 @@ import { getMagicString } from './helpers/parse-utils';

import { parseComposite3DTile } from './parse-3d-tile-composite';
export function parse3DTile(arrayBuffer) {
var byteOffset,
options,
context,
tile,
_args = arguments;
return _regeneratorRuntime.async(function parse3DTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
options = _args.length > 2 ? _args[2] : undefined;
context = _args.length > 3 ? _args[3] : undefined;
tile = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
options = options['3d-tiles'] || {};
tile.byteOffset = byteOffset;
tile.type = getMagicString(arrayBuffer, byteOffset);
_context.t0 = tile.type;
_context.next = _context.t0 === TILE3D_TYPE.COMPOSITE ? 10 : _context.t0 === TILE3D_TYPE.BATCHED_3D_MODEL ? 13 : _context.t0 === TILE3D_TYPE.INSTANCED_3D_MODEL ? 16 : _context.t0 === TILE3D_TYPE.POINT_CLOUD ? 19 : 22;
break;
export function parse3DTile(_x) {
return _parse3DTile.apply(this, arguments);
}
case 10:
_context.next = 12;
return _regeneratorRuntime.awrap(parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile));
function _parse3DTile() {
_parse3DTile = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(arrayBuffer) {
var byteOffset,
options,
context,
tile,
_args = arguments;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
byteOffset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
options = _args.length > 2 ? _args[2] : undefined;
context = _args.length > 3 ? _args[3] : undefined;
tile = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
options = options['3d-tiles'] || {};
tile.byteOffset = byteOffset;
tile.type = getMagicString(arrayBuffer, byteOffset);
_context.t0 = tile.type;
_context.next = _context.t0 === TILE3D_TYPE.COMPOSITE ? 10 : _context.t0 === TILE3D_TYPE.BATCHED_3D_MODEL ? 13 : _context.t0 === TILE3D_TYPE.INSTANCED_3D_MODEL ? 16 : _context.t0 === TILE3D_TYPE.POINT_CLOUD ? 19 : 22;
break;
case 12:
return _context.abrupt("return", _context.sent);
case 10:
_context.next = 12;
return parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
case 13:
_context.next = 15;
return _regeneratorRuntime.awrap(parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context));
case 12:
return _context.abrupt("return", _context.sent);
case 15:
return _context.abrupt("return", _context.sent);
case 13:
_context.next = 15;
return parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
case 16:
_context.next = 18;
return _regeneratorRuntime.awrap(parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context));
case 15:
return _context.abrupt("return", _context.sent);
case 18:
return _context.abrupt("return", _context.sent);
case 16:
_context.next = 18;
return parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
case 19:
_context.next = 21;
return _regeneratorRuntime.awrap(parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context));
case 18:
return _context.abrupt("return", _context.sent);
case 21:
return _context.abrupt("return", _context.sent);
case 19:
_context.next = 21;
return parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);
case 22:
throw new Error("3DTileLoader: unknown type ".concat(tile.type));
case 21:
return _context.abrupt("return", _context.sent);
case 23:
case "end":
return _context.stop();
case 22:
throw new Error("3DTileLoader: unknown type ".concat(tile.type));
case 23:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parse3DTile.apply(this, arguments);
}
//# sourceMappingURL=parse-3d-tile.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

@@ -178,132 +179,140 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

key: "update",
value: function update(frameState) {
var requestedTiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tile, tilesRenderable, pointsRenderable, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _tile;
value: function () {
var _update = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(frameState) {
var requestedTiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tile, tilesRenderable, pointsRenderable, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _tile;
return _regeneratorRuntime.async(function update$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this._updatedVisibilityFrame++;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this._updatedVisibilityFrame++;
this._cache.reset();
this._cache.reset();
_context.next = 4;
return _regeneratorRuntime.awrap(this._traverser.traverse(this.root, frameState, this.options));
_context.next = 4;
return this._traverser.traverse(this.root, frameState, this.options);
case 4:
this._requestedTiles = Object.values(this._traverser.requestedTiles);
this.selectedTiles = Object.values(this._traverser.selectedTiles);
this._emptyTiles = Object.values(this._traverser.emptyTiles);
requestedTiles = this._requestedTiles;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 11;
case 4:
this._requestedTiles = Object.values(this._traverser.requestedTiles);
this.selectedTiles = Object.values(this._traverser.selectedTiles);
this._emptyTiles = Object.values(this._traverser.emptyTiles);
requestedTiles = this._requestedTiles;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 11;
for (_iterator = requestedTiles[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
tile = _step.value;
for (_iterator = requestedTiles[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
tile = _step.value;
this._loadTile(tile, frameState);
}
this._loadTile(tile, frameState);
}
_context.next = 19;
break;
_context.next = 19;
break;
case 15:
_context.prev = 15;
_context.t0 = _context["catch"](11);
_didIteratorError = true;
_iteratorError = _context.t0;
case 15:
_context.prev = 15;
_context.t0 = _context["catch"](11);
_didIteratorError = true;
_iteratorError = _context.t0;
case 19:
_context.prev = 19;
_context.prev = 20;
case 19:
_context.prev = 19;
_context.prev = 20;
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
case 22:
_context.prev = 22;
case 22:
_context.prev = 22;
if (!_didIteratorError) {
_context.next = 25;
break;
}
if (!_didIteratorError) {
_context.next = 25;
break;
}
throw _iteratorError;
throw _iteratorError;
case 25:
return _context.finish(22);
case 25:
return _context.finish(22);
case 26:
return _context.finish(19);
case 26:
return _context.finish(19);
case 27:
this._unloadTiles();
case 27:
this._unloadTiles();
tilesRenderable = 0;
pointsRenderable = 0;
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 33;
tilesRenderable = 0;
pointsRenderable = 0;
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 33;
for (_iterator2 = this.selectedTiles[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
_tile = _step2.value;
for (_iterator2 = this.selectedTiles[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
_tile = _step2.value;
if (_tile.contentAvailable) {
tilesRenderable++;
if (_tile.contentAvailable) {
tilesRenderable++;
if (_tile.content.pointCount) {
pointsRenderable += _tile.content.pointCount;
if (_tile.content.pointCount) {
pointsRenderable += _tile.content.pointCount;
}
}
}
}
_context.next = 41;
break;
_context.next = 41;
break;
case 37:
_context.prev = 37;
_context.t1 = _context["catch"](33);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 37:
_context.prev = 37;
_context.t1 = _context["catch"](33);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 41:
_context.prev = 41;
_context.prev = 42;
case 41:
_context.prev = 41;
_context.prev = 42;
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
case 44:
_context.prev = 44;
case 44:
_context.prev = 44;
if (!_didIteratorError2) {
_context.next = 47;
break;
}
if (!_didIteratorError2) {
_context.next = 47;
break;
}
throw _iteratorError2;
throw _iteratorError2;
case 47:
return _context.finish(44);
case 47:
return _context.finish(44);
case 48:
return _context.finish(41);
case 48:
return _context.finish(41);
case 49:
this.stats.get(TILES_IN_VIEW).count = this.selectedTiles.length;
this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
this.stats.get(POINTS_COUNT).count = pointsRenderable;
case 49:
this.stats.get(TILES_IN_VIEW).count = this.selectedTiles.length;
this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
this.stats.get(POINTS_COUNT).count = pointsRenderable;
case 52:
case "end":
return _context.stop();
case 52:
case "end":
return _context.stop();
}
}
}
}, null, this, [[11, 15, 19, 27], [20,, 22, 26], [33, 37, 41, 49], [42,, 44, 48]]);
}
}, _callee, this, [[11, 15, 19, 27], [20,, 22, 26], [33, 37, 41, 49], [42,, 44, 48]]);
}));
function update(_x) {
return _update.apply(this, arguments);
}
return update;
}()
}, {

@@ -434,54 +443,62 @@ key: "trimLoadedTiles",

key: "_loadTile",
value: function _loadTile(tile, frameState) {
var loaded, message, url;
return _regeneratorRuntime.async(function _loadTile$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context2.prev = 1;
_context2.next = 4;
return _regeneratorRuntime.awrap(tile.loadContent(frameState));
value: function () {
var _loadTile2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(tile, frameState) {
var loaded, message, url;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context2.prev = 1;
_context2.next = 4;
return tile.loadContent(frameState);
case 4:
loaded = _context2.sent;
_context2.next = 16;
break;
case 4:
loaded = _context2.sent;
_context2.next = 16;
break;
case 7:
_context2.prev = 7;
_context2.t0 = _context2["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context2.t0.message || _context2.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileLoadFail(tile, message, url);
return _context2.abrupt("return");
case 7:
_context2.prev = 7;
_context2.t0 = _context2["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context2.t0.message || _context2.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileLoadFail(tile, message, url);
return _context2.abrupt("return");
case 16:
this.stats.get(TILES_LOADING).decrementCount();
case 16:
this.stats.get(TILES_LOADING).decrementCount();
if (loaded) {
_context2.next = 19;
break;
}
if (loaded) {
_context2.next = 19;
break;
}
return _context2.abrupt("return");
return _context2.abrupt("return");
case 19:
if (tile && tile._content) {
calculateTransformProps(tile, tile._content);
}
case 19:
if (tile && tile._content) {
calculateTransformProps(tile, tile._content);
}
this.addTileToCache(tile);
this.options.onTileLoad(tile);
this.addTileToCache(tile);
this.options.onTileLoad(tile);
case 22:
case "end":
return _context2.stop();
case 22:
case "end":
return _context2.stop();
}
}
}
}, null, this, [[1, 7]]);
}
}, _callee2, this, [[1, 7]]);
}));
function _loadTile(_x2, _x3) {
return _loadTile2.apply(this, arguments);
}
return _loadTile;
}()
}, {

@@ -488,0 +505,0 @@ key: "_addTileToCache",

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import _typeof from "@babel/runtime/helpers/esm/typeof";

@@ -108,107 +109,115 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

key: "loadContent",
value: function loadContent(frameState) {
var expired, updatePriority, cancelled, contentUri, response;
return _regeneratorRuntime.async(function loadContent$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
updatePriority = function _ref(tile) {
if (!tile._visible) {
return -1;
}
value: function () {
var _loadContent = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(frameState) {
var expired, updatePriority, cancelled, contentUri, response;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
updatePriority = function _ref(tile) {
if (!tile._visible) {
return -1;
}
if (tile._contentState === TILE3D_CONTENT_STATE.UNLOADED) {
return -1;
if (tile._contentState === TILE3D_CONTENT_STATE.UNLOADED) {
return -1;
}
return Math.max(1e7 - tile._priority, 0) || 0;
};
if (!this.hasEmptyContent) {
_context.next = 3;
break;
}
return Math.max(1e7 - tile._priority, 0) || 0;
};
return _context.abrupt("return", false);
if (!this.hasEmptyContent) {
_context.next = 3;
break;
}
case 3:
if (!this._content) {
_context.next = 5;
break;
}
return _context.abrupt("return", false);
return _context.abrupt("return", true);
case 3:
if (!this._content) {
_context.next = 5;
break;
}
case 5:
expired = this.contentExpired;
return _context.abrupt("return", true);
if (expired) {
this.expireDate = undefined;
}
case 5:
expired = this.contentExpired;
this._contentState = TILE3D_CONTENT_STATE.LOADING;
_context.next = 10;
return this.tileset._requestScheduler.scheduleRequest(this, updatePriority);
if (expired) {
this.expireDate = undefined;
}
case 10:
cancelled = !_context.sent;
this._contentState = TILE3D_CONTENT_STATE.LOADING;
_context.next = 10;
return _regeneratorRuntime.awrap(this.tileset._requestScheduler.scheduleRequest(this, updatePriority));
if (!cancelled) {
_context.next = 14;
break;
}
case 10:
cancelled = !_context.sent;
this._contentState = TILE3D_CONTENT_STATE.UNLOADED;
return _context.abrupt("return", false);
if (!cancelled) {
_context.next = 14;
break;
}
case 14:
_context.prev = 14;
contentUri = this.uri;
_context.prev = 16;
this._contentState = TILE3D_CONTENT_STATE.UNLOADED;
return _context.abrupt("return", false);
this.tileset._requestScheduler.startRequest(this);
case 14:
_context.prev = 14;
contentUri = this.uri;
_context.prev = 16;
_context.next = 20;
return fetchFile(contentUri, this.tileset.options.fetchOptions);
this.tileset._requestScheduler.startRequest(this);
case 20:
response = _context.sent;
_context.next = 20;
return _regeneratorRuntime.awrap(fetchFile(contentUri, this.tileset.options.fetchOptions));
case 21:
_context.prev = 21;
case 20:
response = _context.sent;
this.tileset._requestScheduler.endRequest(this);
case 21:
_context.prev = 21;
return _context.finish(21);
this.tileset._requestScheduler.endRequest(this);
case 24:
_context.next = 26;
return parse(response, [Tile3DLoader, Tileset3DLoader]);
return _context.finish(21);
case 26:
this._content = _context.sent;
case 24:
_context.next = 26;
return _regeneratorRuntime.awrap(parse(response, [Tile3DLoader, Tileset3DLoader]));
if (contentUri.indexOf('.json') !== -1) {
this._tileset._initializeTileHeaders(this._content, this, path.dirname(this.uri));
}
case 26:
this._content = _context.sent;
this._contentState = TILE3D_CONTENT_STATE.READY;
if (contentUri.indexOf('.json') !== -1) {
this._tileset._initializeTileHeaders(this._content, this, path.dirname(this.uri));
}
this._contentLoaded();
this._contentState = TILE3D_CONTENT_STATE.READY;
return _context.abrupt("return", true);
this._contentLoaded();
case 33:
_context.prev = 33;
_context.t0 = _context["catch"](14);
this._contentState = TILE3D_CONTENT_STATE.FAILED;
throw _context.t0;
return _context.abrupt("return", true);
case 37:
case "end":
return _context.stop();
}
}
}, _callee, this, [[14, 33], [16,, 21, 24]]);
}));
case 33:
_context.prev = 33;
_context.t0 = _context["catch"](14);
this._contentState = TILE3D_CONTENT_STATE.FAILED;
throw _context.t0;
function loadContent(_x) {
return _loadContent.apply(this, arguments);
}
case 37:
case "end":
return _context.stop();
}
}
}, null, this, [[14, 33], [16,, 21, 24]]);
}
return loadContent;
}()
}, {

@@ -215,0 +224,0 @@ key: "unloadContent",

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

@@ -389,53 +390,61 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

key: "_loadTile",
value: function _loadTile(tile, frameState) {
var loaded, message, url;
return _regeneratorRuntime.async(function _loadTile$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context.prev = 1;
_context.next = 4;
return _regeneratorRuntime.awrap(tile.loadContent(frameState));
value: function () {
var _loadTile2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tile, frameState) {
var loaded, message, url;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.stats.get(TILES_LOADING).incrementCount();
_context.prev = 1;
_context.next = 4;
return tile.loadContent(frameState);
case 4:
loaded = _context.sent;
_context.next = 16;
break;
case 4:
loaded = _context.sent;
_context.next = 16;
break;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context.t0.message || _context.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileError(tile, message, url);
return _context.abrupt("return");
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
this.stats.get(TILES_LOADING).decrementCount();
this.stats.get(TILES_LOAD_FAILED).incrementCount();
message = _context.t0.message || _context.t0.toString();
url = tile.url;
console.error("A 3D tile failed to load: ".concat(tile.url, " ").concat(message));
this.options.onTileError(tile, message, url);
return _context.abrupt("return");
case 16:
this.stats.get(TILES_LOADING).decrementCount();
case 16:
this.stats.get(TILES_LOADING).decrementCount();
if (loaded) {
_context.next = 19;
break;
}
if (loaded) {
_context.next = 19;
break;
}
return _context.abrupt("return");
return _context.abrupt("return");
case 19:
if (tile && tile._content) {
calculateTransformProps(tile, tile._content);
}
case 19:
if (tile && tile._content) {
calculateTransformProps(tile, tile._content);
}
this.options.onTileLoad(tile);
this.options.onTileLoad(tile);
case 21:
case "end":
return _context.stop();
case 21:
case "end":
return _context.stop();
}
}
}
}, null, this, [[1, 7]]);
}
}, _callee, this, [[1, 7]]);
}));
function _loadTile(_x, _x2) {
return _loadTile2.apply(this, arguments);
}
return _loadTile;
}()
}, {

@@ -442,0 +451,0 @@ key: "_addTileToCache",

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
var VERSION = typeof "2.0.0" !== 'undefined' ? "2.0.0" : 'latest';
import { parse3DTile } from './lib/parsers/parse-3d-tile';
function parse(arrayBuffer, options, context, loader) {
var tile, byteOffset;
return _regeneratorRuntime.async(function parse$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
tile = {};
byteOffset = 0;
_context.next = 4;
return _regeneratorRuntime.awrap(parse3DTile(arrayBuffer, byteOffset, options, context, tile));
function parse(_x, _x2, _x3, _x4) {
return _parse.apply(this, arguments);
}
case 4:
return _context.abrupt("return", tile);
function _parse() {
_parse = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(arrayBuffer, options, context, loader) {
var tile, byteOffset;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
tile = {};
byteOffset = 0;
_context.next = 4;
return parse3DTile(arrayBuffer, byteOffset, options, context, tile);
case 5:
case "end":
return _context.stop();
case 4:
return _context.abrupt("return", tile);
case 5:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
return _parse.apply(this, arguments);
}

@@ -26,0 +34,0 @@

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
export default {

@@ -6,16 +7,24 @@ id: '3d-tileset',

extensions: ['json'],
parse: function parse(arrayBuffer) {
return _regeneratorRuntime.async(function parse$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", JSON.parse(new TextDecoder().decode(arrayBuffer)));
parse: function () {
var _parse = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(arrayBuffer) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", JSON.parse(new TextDecoder().decode(arrayBuffer)));
case 1:
case "end":
return _context.stop();
case 1:
case "end":
return _context.stop();
}
}
}
});
},
}, _callee);
}));
function parse(_x) {
return _parse.apply(this, arguments);
}
return parse;
}(),
parseTextSync: JSON.parse,

@@ -22,0 +31,0 @@ testText: function testText(text) {

{
"name": "@loaders.gl/3d-tiles",
"version": "2.0.0",
"version": "2.0.1",
"description": "3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.",

@@ -37,6 +37,6 @@ "license": "MIT",

"dependencies": {
"@loaders.gl/core": "2.0.0",
"@loaders.gl/gltf": "2.0.0",
"@loaders.gl/loader-utils": "2.0.0",
"@loaders.gl/math": "2.0.0",
"@loaders.gl/core": "2.0.1",
"@loaders.gl/gltf": "2.0.1",
"@loaders.gl/loader-utils": "2.0.1",
"@loaders.gl/math": "2.0.1",
"@math.gl/culling": "^3.1.2",

@@ -47,3 +47,6 @@ "@math.gl/geospatial": "^3.1.2",

},
"gitHead": "addaa8e2e634bd0c9e96da200d0388f62a669666"
"devDependencies": {
"@deck.gl/core": "^8.0.0"
},
"gitHead": "ae0763bd05bbe9b14aedf2a99e5873db16739bb7"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc