From 2d6fb1d9ff6b0f77d9749b48f1c67273c7028949 Mon Sep 17 00:00:00 2001 From: Janine Liu Date: Fri, 24 Jun 2022 16:02:44 -0400 Subject: [PATCH 1/3] Add distanceDisplayCondition to ModelExperimental --- .../ModelExperimental/ModelExperimental.js | 102 ++++++++++++++++-- .../ModelExperimentalSpec.js | 87 +++++++++++++++ .../loadAndZoomToModelExperimental.js | 1 + 3 files changed, 179 insertions(+), 11 deletions(-) diff --git a/Source/Scene/ModelExperimental/ModelExperimental.js b/Source/Scene/ModelExperimental/ModelExperimental.js index e2902e3ca976..77f7a3a06669 100644 --- a/Source/Scene/ModelExperimental/ModelExperimental.js +++ b/Source/Scene/ModelExperimental/ModelExperimental.js @@ -7,6 +7,7 @@ import ClippingPlaneCollection from "../ClippingPlaneCollection.js"; import defined from "../../Core/defined.js"; import defaultValue from "../../Core/defaultValue.js"; import DeveloperError from "../../Core/DeveloperError.js"; +import DistanceDisplayCondition from "../../Core/DistanceDisplayCondition.js"; import GltfLoader from "../GltfLoader.js"; import HeightReference from "../HeightReference.js"; import ImageBasedLighting from "../ImageBasedLighting.js"; @@ -49,33 +50,34 @@ import SplitDirection from "../SplitDirection.js"; * @param {Number} [options.scale=1.0] A uniform scale applied to this model. * @param {Number} [options.minimumPixelSize=0.0] The approximate minimum pixel size of the model regardless of zoom. * @param {Number} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize. + * @param {Boolean} [options.allowPicking=true] When true, each primitive is pickable with {@link Scene#pick}. * @param {Boolean} [options.clampAnimations=true] Determines if the model's animations should hold a pose over frames where no keyframes are specified. + * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from light sources. * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each draw command in the model. * @param {Boolean} [options.enableDebugWireframe=false] For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded. * @param {Boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe. Will only work for WebGL1 if enableDebugWireframe is set to true. * @param {Boolean} [options.cull=true] Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used. * @param {Boolean} [options.opaquePass=Pass.OPAQUE] The pass to use in the {@link DrawCommand} for the opaque portions of the model. - * @param {Boolean} [options.allowPicking=true] When true, each primitive is pickable with {@link Scene#pick}. * @param {CustomShader} [options.customShader] A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a {@link Cesium3DTileStyle} may lead to undefined behavior. * @param {Cesium3DTileContent} [options.content] The tile content this model belongs to. This property will be undefined if model is not loaded as part of a tileset. * @param {HeightReference} [options.heightReference=HeightReference.NONE] Determines how the model is drawn relative to terrain. * @param {Scene} [options.scene] Must be passed in for models that use the height reference property. + * @param {DistanceDisplayCondition} [options.distanceDisplayCondition] The condition specifying at what distance from the camera that this model will be displayed. * @param {Color} [options.color] A color that blends with the model's rendered color. * @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] Defines how the color blends with the model. * @param {Number} [options.colorBlendAmount=0.5] Value used to determine the color strength when the colorBlendMode is MIX. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. * @param {Color} [options.silhouetteColor=Color.RED] The silhouette color. If more than 256 models have silhouettes enabled, there is a small chance that overlapping models will have minor artifacts. * @param {Number} [options.silhouetteSize=0.0] The size of the silhouette in pixels. - * @param {String|Number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. - * @param {String|Number} [options.instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. - * @param {Object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting. * @param {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model. * @param {Cartesian3} [options.lightColor] The light color when shading the model. When undefined the scene's light color is used instead. * @param {ImageBasedLighting} [options.imageBasedLighting] The properties for managing image-based lighting on this model. * @param {Boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent. - * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from light sources. * @param {Boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen. * @param {SplitDirection} [options.splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this model. * @param {Boolean} [options.projectTo2D=false] Whether to accurately project the model's positions in 2D. If this is true, the model will be projected accurately to 2D, but it will use more memory to do so. If this is false, the model will use less memory and will still render in 2D / CV mode, but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to the model matrix. This also cannot be set after the model has loaded. + * @param {String|Number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. + * @param {String|Number} [options.instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. + * @param {Object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting. * @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. */ export default function ModelExperimental(options) { @@ -248,6 +250,8 @@ export default function ModelExperimental(options) { } this._scene = scene; + this._distanceDisplayCondition = options.distanceDisplayCondition; + const pointCloudShading = new PointCloudShading(options.pointCloudShading); this._attenuation = pointCloudShading.attenuation; this._pointCloudShading = pointCloudShading; @@ -685,6 +689,33 @@ Object.defineProperties(ModelExperimental.prototype, { }, }, + /** + * Gets or sets the distance display condition, which specifies at what distance + * from the camera this model will be displayed. + * + * @memberof ModelExperimental.prototype + * + * @type {DistanceDisplayCondition} + * @default undefined + * + */ + distanceDisplayCondition: { + get: function () { + return this._distanceDisplayCondition; + }, + set: function (value) { + //>>includeStart('debug', pragmas.debug); + if (defined(value) && value.far <= value.near) { + throw new DeveloperError("far must be greater than near"); + } + //>>includeEnd('debug'); + this._distanceDisplayCondition = DistanceDisplayCondition.clone( + value, + this._distanceDisplayCondition + ); + }, + }, + /** * The structural metadata from the EXT_structural_metadata extension * @@ -1672,13 +1703,22 @@ function submitDrawCommands(model, frameState) { // we want the user to be able to instantly see the model // when show is set to true. + const displayConditionPassed = passesDistanceDisplayCondition( + model, + frameState + ); + const invisible = model.isInvisible(); const silhouette = model.hasSilhouette(frameState); + // If the model is invisible but has a silhouette, it still // needs to draw in order to write to the stencil buffer and // render the silhouette. const showModel = - model._show && model._computedScale !== 0 && (!invisible || silhouette); + model._show && + model._computedScale !== 0 && + displayConditionPassed && + (!invisible || silhouette); if (showModel) { const asset = model._sceneGraph.components.asset; @@ -1776,6 +1816,43 @@ function getUpdateHeightCallback(model, ellipsoid, cartoPosition) { }; } +const scratchDisplayConditionCartesian = new Cartesian3(); + +function passesDistanceDisplayCondition(model, frameState) { + const ddc = model.distanceDisplayCondition; + if (!defined(ddc)) { + return true; + } + + const nearSquared = ddc.near * ddc.near; + const farSquared = ddc.far * ddc.far; + let distanceSquared; + + if (frameState.mode === SceneMode.SCENE2D) { + const frustum2DWidth = + frameState.camera.frustum.right - frameState.camera.frustum.left; + const distance = frustum2DWidth * 0.5; + distanceSquared = distance * distance; + } else { + // Distance to center of primitive's reference frame + const position = Matrix4.getTranslation( + model.modelMatrix, + scratchDisplayConditionCartesian + ); + + // This will project the position if the scene is in Columbus View, + // but leave the position as-is in 3D mode. + SceneTransforms.computeActualWgs84Position(frameState, position, position); + + distanceSquared = Cartesian3.distanceSquared( + position, + frameState.camera.positionWC + ); + } + + return distanceSquared >= nearSquared && distanceSquared <= farSquared; +} + /** * Gets whether or not the model is translucent based on its assigned model color. * If the model color's alpha is equal to zero, then it is considered invisible, @@ -1959,6 +2036,9 @@ ModelExperimental.prototype.destroyModelResources = function () { * @param {Number} [options.minimumPixelSize=0.0] The approximate minimum pixel size of the model regardless of zoom. * @param {Number} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize. * @param {Boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded. + * @param {Boolean} [options.allowPicking=true] When true, each primitive is pickable with {@link Scene#pick}. + * @param {Boolean} [options.clampAnimations=true] Determines if the model's animations should hold a pose over frames where no keyframes are specified. + * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from light sources. * @param {Boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective. * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each draw command in the model. * @param {Boolean} [options.enableDebugWireframe=false] For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded. @@ -1967,27 +2047,26 @@ ModelExperimental.prototype.destroyModelResources = function () { * @param {Boolean} [options.opaquePass=Pass.OPAQUE] The pass to use in the {@link DrawCommand} for the opaque portions of the model. * @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model. * @param {Axis} [options.forwardAxis=Axis.Z] The forward-axis of the glTF model. - * @param {Boolean} [options.allowPicking=true] When true, each primitive is pickable with {@link Scene#pick}. * @param {CustomShader} [options.customShader] A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a {@link Cesium3DTileStyle} may lead to undefined behavior. * @param {Cesium3DTileContent} [options.content] The tile content this model belongs to. This property will be undefined if model is not loaded as part of a tileset. * @param {HeightReference} [options.heightReference=HeightReference.NONE] Determines how the model is drawn relative to terrain. * @param {Scene} [options.scene] Must be passed in for models that use the height reference property. + * @param {DistanceDisplayCondition} [options.distanceDisplayCondition] The condition specifying at what distance from the camera that this model will be displayed. * @param {Color} [options.color] A color that blends with the model's rendered color. * @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] Defines how the color blends with the model. * @param {Number} [options.colorBlendAmount=0.5] Value used to determine the color strength when the colorBlendMode is MIX. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. * @param {Color} [options.silhouetteColor=Color.RED] The silhouette color. If more than 256 models have silhouettes enabled, there is a small chance that overlapping models will have minor artifacts. * @param {Number} [options.silhouetteSize=0.0] The size of the silhouette in pixels. - * @param {String|Number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. - * @param {String|Number} [options.instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. - * @param {Object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation and lighting. * @param {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model. * @param {Cartesian3} [options.lightColor] The light color when shading the model. When undefined the scene's light color is used instead. * @param {ImageBasedLighting} [options.imageBasedLighting] The properties for managing image-based lighting on this model. * @param {Boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent. - * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from light sources. * @param {Boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen. * @param {SplitDirection} [options.splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this model. * @param {Boolean} [options.projectTo2D=false] Whether to accurately project the model's positions in 2D. If this is true, the model will be projected accurately to 2D, but it will use more memory to do so. If this is false, the model will use less memory and will still render in 2D / CV mode, but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to the model matrix. This also cannot be set after the model has loaded. + * @param {String|Number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. + * @param {String|Number} [options.instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. + * @param {Object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation and lighting. * @returns {ModelExperimental} The newly created model. */ ModelExperimental.fromGltf = function (options) { @@ -2200,5 +2279,6 @@ function makeModelOptions(loader, modelType, options) { showCreditsOnScreen: options.showCreditsOnScreen, splitDirection: options.splitDirection, projectTo2D: options.projectTo2D, + distanceDisplayCondition: options.distanceDisplayCondition, }; } diff --git a/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js b/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js index 05eff23ef5e1..87d886661c39 100644 --- a/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js +++ b/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js @@ -9,6 +9,7 @@ import { Color, defaultValue, defined, + DistanceDisplayCondition, Ellipsoid, Event, FeatureDetection, @@ -1534,6 +1535,92 @@ describe( }); }); + it("initializes with distance display condition", function () { + const near = 10.0; + const far = 100.0; + const ddc = new DistanceDisplayCondition(near, far); + return loadAndZoomToModelExperimental( + { + gltf: boxTexturedGltfUrl, + distanceDisplayCondition: ddc, + }, + scene + ).then(function (model) { + verifyRender(model, false); + }); + }); + + it("changing distance display condition works", function () { + const near = 10.0; + const far = 100.0; + const ddc = new DistanceDisplayCondition(near, far); + return loadAndZoomToModelExperimental( + { + gltf: boxTexturedGltfUrl, + }, + scene + ).then(function (model) { + verifyRender(model, true); + + model.distanceDisplayCondition = ddc; + verifyRender(model, false); + }); + }); + + it("distanceDisplayCondition works with camera movement", function () { + const near = 10.0; + const far = 100.0; + const ddc = new DistanceDisplayCondition(near, far); + return loadAndZoomToModelExperimental( + { + gltf: boxTexturedGltfUrl, + }, + scene + ).then(function (model) { + verifyRender(model, true); + + // Model distance is smaller than near value, should not render + model.distanceDisplayCondition = ddc; + verifyRender(model, false); + + const frameState = scene.frameState; + + // Model distance is between near and far values, should render + frameState.camera.lookAt( + Cartesian3.ZERO, + new HeadingPitchRange(0.0, 0.0, (far + near) * 0.5) + ); + verifyRender(model, true, { + zoomToModel: false, + }); + + // Model distance is greater than far value, should not render + frameState.camera.lookAt( + Cartesian3.ZERO, + new HeadingPitchRange(0.0, 0.0, far + 10.0) + ); + verifyRender(model, false, { + zoomToModel: false, + }); + }); + }); + + it("distanceDisplayCondition throws when near >= far", function () { + const near = 101.0; + const far = 100.0; + const ddc = new DistanceDisplayCondition(near, far); + return loadAndZoomToModelExperimental( + { + gltf: boxTexturedGltfUrl, + }, + scene + ).then(function (model) { + expect(function () { + model.distanceDisplayCondition = ddc; + }).toThrowDeveloperError(); + }); + }); + it("initializes with model color", function () { return loadAndZoomToModelExperimental( { gltf: boxTexturedGltfUrl, color: Color.BLACK }, diff --git a/Specs/Scene/ModelExperimental/loadAndZoomToModelExperimental.js b/Specs/Scene/ModelExperimental/loadAndZoomToModelExperimental.js index 3ac08c8c4ff6..f9555e1ea490 100644 --- a/Specs/Scene/ModelExperimental/loadAndZoomToModelExperimental.js +++ b/Specs/Scene/ModelExperimental/loadAndZoomToModelExperimental.js @@ -38,6 +38,7 @@ function loadAndZoomToModelExperimental(options, scene) { projectTo2D: options.projectTo2D, heightReference: options.heightReference, scene: options.scene, + distanceDisplayCondition: options.distanceDisplayCondition, }); } catch (error) { reject(error); From d4fcd8a829cb1fb43f0a6942003f071e3218c2b9 Mon Sep 17 00:00:00 2001 From: Janine Liu Date: Fri, 24 Jun 2022 16:15:12 -0400 Subject: [PATCH 2/3] Update changelog and unit test --- CHANGES.md | 1 + Specs/Scene/ModelExperimental/ModelExperimentalSpec.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 77853e7b6404..d1e7744926e4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ - Added `modelUpAxis` and `modelForwardAxis` constructor options to `Cesium3DTileset` [#10439](https://github.com/CesiumGS/cesium/pull/10439) - Added `heightReference` to `ModelExperimental`. [#10448](https://github.com/CesiumGS/cesium/pull/10448) - Added `silhouetteSize` and `silhouetteColor` to `ModelExperimental`. [#10457](https://github.com/CesiumGS/cesium/pull/10457) +- Added `distanceDisplayCondition` to `ModelExperimental`. [#10481](https://github.com/CesiumGS/cesium/pull/10481) ##### Fixes :wrench: diff --git a/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js b/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js index 87d886661c39..c6c16ea9c53c 100644 --- a/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js +++ b/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js @@ -1564,6 +1564,9 @@ describe( model.distanceDisplayCondition = ddc; verifyRender(model, false); + + model.distanceDisplayCondition = undefined; + verifyRender(model, true); }); }); From 324b3d88391417fd2142aca3e9a7f2ea884ee4af Mon Sep 17 00:00:00 2001 From: Janine Liu Date: Mon, 27 Jun 2022 13:09:37 -0400 Subject: [PATCH 3/3] Rename abbreviated variable --- .../Scene/ModelExperimental/ModelExperimental.js | 8 ++++---- .../ModelExperimental/ModelExperimentalSpec.js | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Scene/ModelExperimental/ModelExperimental.js b/Source/Scene/ModelExperimental/ModelExperimental.js index 77f7a3a06669..01e34639a270 100644 --- a/Source/Scene/ModelExperimental/ModelExperimental.js +++ b/Source/Scene/ModelExperimental/ModelExperimental.js @@ -1819,13 +1819,13 @@ function getUpdateHeightCallback(model, ellipsoid, cartoPosition) { const scratchDisplayConditionCartesian = new Cartesian3(); function passesDistanceDisplayCondition(model, frameState) { - const ddc = model.distanceDisplayCondition; - if (!defined(ddc)) { + const condition = model.distanceDisplayCondition; + if (!defined(condition)) { return true; } - const nearSquared = ddc.near * ddc.near; - const farSquared = ddc.far * ddc.far; + const nearSquared = condition.near * condition.near; + const farSquared = condition.far * condition.far; let distanceSquared; if (frameState.mode === SceneMode.SCENE2D) { diff --git a/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js b/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js index c6c16ea9c53c..5d2cfb285548 100644 --- a/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js +++ b/Specs/Scene/ModelExperimental/ModelExperimentalSpec.js @@ -1538,11 +1538,11 @@ describe( it("initializes with distance display condition", function () { const near = 10.0; const far = 100.0; - const ddc = new DistanceDisplayCondition(near, far); + const condition = new DistanceDisplayCondition(near, far); return loadAndZoomToModelExperimental( { gltf: boxTexturedGltfUrl, - distanceDisplayCondition: ddc, + distanceDisplayCondition: condition, }, scene ).then(function (model) { @@ -1553,7 +1553,7 @@ describe( it("changing distance display condition works", function () { const near = 10.0; const far = 100.0; - const ddc = new DistanceDisplayCondition(near, far); + const condition = new DistanceDisplayCondition(near, far); return loadAndZoomToModelExperimental( { gltf: boxTexturedGltfUrl, @@ -1562,7 +1562,7 @@ describe( ).then(function (model) { verifyRender(model, true); - model.distanceDisplayCondition = ddc; + model.distanceDisplayCondition = condition; verifyRender(model, false); model.distanceDisplayCondition = undefined; @@ -1573,7 +1573,7 @@ describe( it("distanceDisplayCondition works with camera movement", function () { const near = 10.0; const far = 100.0; - const ddc = new DistanceDisplayCondition(near, far); + const condition = new DistanceDisplayCondition(near, far); return loadAndZoomToModelExperimental( { gltf: boxTexturedGltfUrl, @@ -1583,7 +1583,7 @@ describe( verifyRender(model, true); // Model distance is smaller than near value, should not render - model.distanceDisplayCondition = ddc; + model.distanceDisplayCondition = condition; verifyRender(model, false); const frameState = scene.frameState; @@ -1611,7 +1611,7 @@ describe( it("distanceDisplayCondition throws when near >= far", function () { const near = 101.0; const far = 100.0; - const ddc = new DistanceDisplayCondition(near, far); + const condition = new DistanceDisplayCondition(near, far); return loadAndZoomToModelExperimental( { gltf: boxTexturedGltfUrl, @@ -1619,7 +1619,7 @@ describe( scene ).then(function (model) { expect(function () { - model.distanceDisplayCondition = ddc; + model.distanceDisplayCondition = condition; }).toThrowDeveloperError(); }); });