Skip to content

Commit

Permalink
Ensure latest tests work with webgl stub
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Nov 13, 2023
1 parent bbdcac1 commit 21c64e6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
2 changes: 2 additions & 0 deletions packages/engine/Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ import Ray from "../Core/Ray.js";
* @property {boolean} [showCreditsOnScreen=false] Whether to display the credits of this tileset on screen.
* @property {SplitDirection} [splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this tileset.
* @property {boolean} [projectTo2D=false] Whether to accurately project the tileset to 2D. If this is true, the tileset will be projected accurately to 2D, but it will use more memory to do so. If this is false, the tileset will use less memory and will still render in 2D / CV mode, but its projected positions may be inaccurate. This cannot be set after the tileset has loaded.
* @property {boolean} [options.enablePick=false] Whether to allow with CPU picking with <code>pick</code> when not using WebGL 2 or above. If using WebGL 2 or above, this option will be ignored. If using WebGL 1 and this is true, the <code>pick</code> operation will work correctly, but it will use more memory to do so. If running with WebGL 1 and this is false, the model will use less memory, but <code>pick</code> will always return <code>undefined</code>. This cannot be set after the tileset has loaded.
* @property {string} [debugHeatmapTilePropertyName] The tile variable to colorize as a heatmap. All rendered tiles will be colorized relative to each other's specified variable value.
* @property {boolean} [debugFreezeFrame=false] For debugging only. Determines if only the tiles from last frame should be used for rendering.
* @property {boolean} [debugColorizeTiles=false] For debugging only. When true, assigns a random color to each tile.
Expand Down Expand Up @@ -826,6 +827,7 @@ function Cesium3DTileset(options) {
);

this._projectTo2D = defaultValue(options.projectTo2D, false);
this._enablePick = defaultValue(options.enablePick, false);

/**
* This property is for debugging only; it is not optimized for production use.
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Scene/Model/B3dmLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function B3dmLoader(options) {
false
);
const loadAttributesFor2D = defaultValue(options.loadAttributesFor2D, false);
const enablePick = defaultValue(options.enablePick);
const enablePick = defaultValue(options.enablePick, false);
const loadIndicesForWireframe = defaultValue(
options.loadIndicesForWireframe,
false
Expand Down
3 changes: 3 additions & 0 deletions packages/engine/Source/Scene/Model/I3dmLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function I3dmLoader(options) {
false
);
const loadPrimitiveOutline = defaultValue(options.loadPrimitiveOutline, true);
const enablePick = defaultValue(options.enablePick, false);

//>>includeStart('debug', pragmas.debug);
Check.typeOf.object("options.i3dmResource", i3dmResource);
Expand All @@ -111,6 +112,7 @@ function I3dmLoader(options) {
this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
this._loadIndicesForWireframe = loadIndicesForWireframe;
this._loadPrimitiveOutline = loadPrimitiveOutline;
this._enablePick = enablePick;

this._state = I3dmLoaderState.NOT_LOADED;
this._promise = undefined;
Expand Down Expand Up @@ -240,6 +242,7 @@ I3dmLoader.prototype.load = function () {
releaseGltfJson: this._releaseGltfJson,
incrementallyLoadTextures: this._incrementallyLoadTextures,
loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
enablePick: this._enablePick,
loadIndicesForWireframe: this._loadIndicesForWireframe,
loadPrimitiveOutline: this._loadPrimitiveOutline,
};
Expand Down
1 change: 1 addition & 0 deletions packages/engine/Source/Scene/Model/Model3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ function makeModelOptions(tileset, tile, content, additionalOptions) {
enableDebugWireframe: tileset._enableDebugWireframe,
debugWireframe: tileset.debugWireframe,
projectTo2D: tileset._projectTo2D,
enablePick: tileset._enablePick,
enableShowOutline: tileset._enableShowOutline,
showOutline: tileset.showOutline,
outlineColor: tileset.outlineColor,
Expand Down
29 changes: 23 additions & 6 deletions packages/engine/Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,9 @@ describe(
});

it("picks", async function () {
const tileset = await Cesium3DTilesTester.loadTileset(scene, tilesetUrl);
const tileset = await Cesium3DTilesTester.loadTileset(scene, tilesetUrl, {
enablePick: !scene.frameState.context.webgl2,
});
viewRootOnly();
scene.renderForSpecs();

Expand All @@ -2440,7 +2442,10 @@ describe(
it("picks tileset of tilesets", async function () {
const tileset = await Cesium3DTilesTester.loadTileset(
scene,
tilesetOfTilesetsUrl
tilesetOfTilesetsUrl,
{
enablePick: !scene.frameState.context.webgl2,
}
);
viewRootOnly();
scene.renderForSpecs();
Expand All @@ -2466,7 +2471,10 @@ describe(
it("picks instanced tileset", async function () {
const tileset = await Cesium3DTilesTester.loadTileset(
scene,
instancedUrl
instancedUrl,
{
enablePick: !scene.frameState.context.webgl2,
}
);
viewInstances();
scene.renderForSpecs();
Expand All @@ -2492,7 +2500,10 @@ describe(
it("picks translucent tileset", async function () {
const tileset = await Cesium3DTilesTester.loadTileset(
scene,
translucentUrl
translucentUrl,
{
enablePick: !scene.frameState.context.webgl2,
}
);
viewAllTiles();
scene.renderForSpecs();
Expand All @@ -2518,7 +2529,10 @@ describe(
it("picks tileset with transforms", async function () {
const tileset = await Cesium3DTilesTester.loadTileset(
scene,
tilesetWithTransformsUrl
tilesetWithTransformsUrl,
{
enablePick: !scene.frameState.context.webgl2,
}
);
viewAllTiles();
scene.renderForSpecs();
Expand All @@ -2544,7 +2558,10 @@ describe(
it("picking point cloud tileset returns undefined", async function () {
const tileset = await Cesium3DTilesTester.loadTileset(
scene,
pointCloudUrl
pointCloudUrl,
{
enablePick: !scene.frameState.context.webgl2,
}
);
viewAllTiles();
scene.renderForSpecs();
Expand Down

0 comments on commit 21c64e6

Please sign in to comment.