Skip to content

Commit

Permalink
Merge pull request #9982 from CesiumGS/tileset-model-experimental
Browse files Browse the repository at this point in the history
Make enableModelExperimental a per-tileset setting
  • Loading branch information
lilleyse authored Dec 17, 2021
2 parents 2995ac2 + bd2e180 commit 4c29dd2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Added a `pointSize` field to custom vertex shaders for more control over shading point clouds. [#9960](https://github.com/CesiumGS/cesium/pull/9960)
- Added `lambertDiffuseMultiplier` property to Globe object to enhance terrain lighting. [#9878](https://github.com/CesiumGS/cesium/pull/9878)
- Added `getFeatureInfoUrl` option to `WebMapServiceImageryProvider` which reads the getFeatureInfo request URL for WMS service if it differs with the getCapabilities URL. [#9563](https://github.com/CesiumGS/cesium/pull/9563)
- Added `tileset.enableModelExperimental` so tilesets with `Model` and `ModelExperimental` can be mixed in the same scene. [#9982](https://github.com/CesiumGS/cesium/pull/9982)

##### Fixes :wrench:

Expand Down
7 changes: 3 additions & 4 deletions Source/Scene/Cesium3DTileContentFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import PointCloud3DTileContent from "./PointCloud3DTileContent.js";
import Tileset3DTileContent from "./Tileset3DTileContent.js";
import Vector3DTileContent from "./Vector3DTileContent.js";
import RuntimeError from "../Core/RuntimeError.js";
import ExperimentalFeatures from "../Core/ExperimentalFeatures.js";
import ModelExperimental3DTileContent from "./ModelExperimental/ModelExperimental3DTileContent.js";

/**
Expand All @@ -18,7 +17,7 @@ import ModelExperimental3DTileContent from "./ModelExperimental/ModelExperimenta
*/
var Cesium3DTileContentFactory = {
b3dm: function (tileset, tile, resource, arrayBuffer, byteOffset) {
if (ExperimentalFeatures.enableModelExperimental) {
if (tileset.enableModelExperimental) {
return ModelExperimental3DTileContent.fromB3dm(
tileset,
tile,
Expand Down Expand Up @@ -102,7 +101,7 @@ var Cesium3DTileContentFactory = {
var dataView = new DataView(arrayBuffer, byteOffset);
var byteLength = dataView.getUint32(8, true);
var glb = new Uint8Array(arrayBuffer, byteOffset, byteLength);
if (ExperimentalFeatures.enableModelExperimental) {
if (tileset.enableModelExperimental) {
return ModelExperimental3DTileContent.fromGltf(
tileset,
tile,
Expand All @@ -113,7 +112,7 @@ var Cesium3DTileContentFactory = {
return new Gltf3DTileContent(tileset, tile, resource, glb);
},
gltf: function (tileset, tile, resource, json) {
if (ExperimentalFeatures.enableModelExperimental) {
if (tileset.enableModelExperimental) {
return ModelExperimental3DTileContent.fromGltf(
tileset,
tile,
Expand Down
17 changes: 16 additions & 1 deletion Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import destroyObject from "../Core/destroyObject.js";
import DeveloperError from "../Core/DeveloperError.js";
import Ellipsoid from "../Core/Ellipsoid.js";
import Event from "../Core/Event.js";
import ExperimentalFeatures from "../Core/ExperimentalFeatures.js";
import JulianDate from "../Core/JulianDate.js";
import ManagedArray from "../Core/ManagedArray.js";
import CesiumMath from "../Core/Math.js";
Expand Down Expand Up @@ -953,6 +954,20 @@ function Cesium3DTileset(options) {

this._customShader = options.customShader;

/**
* If true, {@link ModelExperimental} will be used instead of {@link Model}
* for each tile with a glTF or 3D Tiles 1.0 content (where applicable).
* <p>
* The value defaults to {@link ExperimentalFeatures.enableModelExperimental}.
* </p>
* @type {Boolean}
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
*/
this.enableModelExperimental = defaultValue(
options.enableModelExperimental,
ExperimentalFeatures.enableModelExperimental
);

this._schemaLoader = undefined;

var that = this;
Expand Down Expand Up @@ -1320,7 +1335,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
* contents that use {@link ModelExperimental}. Using custom shaders with a
* {@link Cesium3DTileStyle} may lead to undefined behavior.
* <p>
* To enable {@link ModelExperimental}, set {@link ExperimentalFeatures.enableModelExperimental} to <code>true</code>.
* To enable {@link ModelExperimental}, set {@link ExperimentalFeatures.enableModelExperimental} or tileset.enableModelExperimental to <code>true</code>.
* </p>
*
* @memberof Cesium3DTileset.prototype
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/ModelExperimental/CustomShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import TextureManager from "./TextureManager.js";
* </li>
* </ul>
* <p>
* To enable the use of {@link ModelExperimental} in {@link Cesium3DTileset}, set {@link ExperimentalFeatures.enableModelExperimental} to <code>true</code>.
* To enable the use of {@link ModelExperimental} in {@link Cesium3DTileset}, set {@link ExperimentalFeatures.enableModelExperimental} to <code>true</code> or tileset.enableModelExperimental to <code>true</code>.
* </p>
*
* @param {Object} options An object with the following options
Expand Down

0 comments on commit 4c29dd2

Please sign in to comment.