Skip to content

Commit

Permalink
Allow external tilesets in multiple contents
Browse files Browse the repository at this point in the history
  • Loading branch information
javagl committed Jan 17, 2025
1 parent dc667cd commit 34ef08d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
41 changes: 20 additions & 21 deletions packages/engine/Source/Scene/Cesium3DTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,24 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
*/
this.hasImplicitContent = false;

/**
* Determines whether the tile has renderable content.
*
* The loading starts with the assumption that the tile does have
* renderable content, if the content is not empty.<br>
* <br>
* This turns <code>false</code> only when the tile content is loaded
* and turns out to be a single content that points to an external
* tileset or implicit content
* </p>
*
* @type {boolean}
* @readonly
*
* @private
*/
this.hasRenderableContent = !hasEmptyContent;

/**
* When <code>true</code>, the tile contains content metadata from implicit tiling. This flag is set
* for tiles transcoded by <code>Implicit3DTileContent</code>.
Expand Down Expand Up @@ -653,27 +671,6 @@ Object.defineProperties(Cesium3DTile.prototype, {
},
},

/**
* Determines if the tile's content is renderable. <code>false</code> if the
* tile has empty content or if it points to an external tileset or implicit content
*
* @memberof Cesium3DTile.prototype
*
* @type {boolean}
* @readonly
*
* @private
*/
hasRenderableContent: {
get: function () {
return (
!this.hasEmptyContent &&
!this.hasTilesetContent &&
!this.hasImplicitContent
);
},
},

/**
* Determines if the tile has available content to render. <code>true</code> if the tile's
* content is ready or if it has expired content that renders while new content loads; otherwise,
Expand Down Expand Up @@ -1346,10 +1343,12 @@ async function makeContent(tile, arrayBuffer) {
preprocessed.contentType === Cesium3DTileContentType.IMPLICIT_SUBTREE_JSON
) {
tile.hasImplicitContent = true;
tile.hasRenderableContent = false;
}

if (preprocessed.contentType === Cesium3DTileContentType.EXTERNAL_TILESET) {
tile.hasTilesetContent = true;
tile.hasRenderableContent = false;
}

let content;
Expand Down
13 changes: 5 additions & 8 deletions packages/engine/Source/Scene/Multiple3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Request from "../Core/Request.js";
import RequestScheduler from "../Core/RequestScheduler.js";
import RequestState from "../Core/RequestState.js";
import RequestType from "../Core/RequestType.js";
import RuntimeError from "../Core/RuntimeError.js";
import Cesium3DContentGroup from "./Cesium3DContentGroup.js";
import Cesium3DTileContentType from "./Cesium3DTileContentType.js";
import Cesium3DTileContentFactory from "./Cesium3DTileContentFactory.js";
Expand Down Expand Up @@ -518,21 +517,19 @@ async function createInnerContent(multipleContents, arrayBuffer, index) {
try {
const preprocessed = preprocess3DTileContent(arrayBuffer);

const tileset = multipleContents._tileset;
const resource = multipleContents._innerContentResources[index];
const tile = multipleContents._tile;

if (preprocessed.contentType === Cesium3DTileContentType.EXTERNAL_TILESET) {
throw new RuntimeError(
"External tilesets are disallowed inside multiple contents",
);
tile.hasTilesetContent = true;
}

multipleContents._disableSkipLevelOfDetail =
multipleContents._disableSkipLevelOfDetail ||
preprocessed.contentType === Cesium3DTileContentType.GEOMETRY ||
preprocessed.contentType === Cesium3DTileContentType.VECTOR;

const tileset = multipleContents._tileset;
const resource = multipleContents._innerContentResources[index];
const tile = multipleContents._tile;

let content;
const contentFactory = Cesium3DTileContentFactory[preprocessed.contentType];
if (defined(preprocessed.binaryPayload)) {
Expand Down

0 comments on commit 34ef08d

Please sign in to comment.