From dc810637c9652b4467520e80cf7eaf9ea0f4cdab Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Tue, 12 Apr 2016 15:41:01 -0400 Subject: [PATCH] Remove DistanceDisplayCondition --- Source/Scene/DistanceDisplayCondition.js | 73 ------------------------ Source/Scene/Model.js | 22 +------ 2 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 Source/Scene/DistanceDisplayCondition.js diff --git a/Source/Scene/DistanceDisplayCondition.js b/Source/Scene/DistanceDisplayCondition.js deleted file mode 100644 index 873d33636c65..000000000000 --- a/Source/Scene/DistanceDisplayCondition.js +++ /dev/null @@ -1,73 +0,0 @@ -/*global define*/ -define([ - '../Core/Cartesian3', - '../Core/defaultValue', - '../Core/defineProperties', - '../Core/Matrix4' - ], function( - Cartesian3, - defaultValue, - defineProperties, - Matrix4) { - 'use strict'; - - /** - * DOC_TBA - * - * @alias DistanceDisplayCondition - * @constructor - */ - function DistanceDisplayCondition(near, far) { - /** - * DOC_TBA - */ - near = defaultValue(near, 0.0); - this._near = near; - this._near2 = near * near; - - /** - * DOC_TBA - */ - far = defaultValue(far, Number.MAX_VALUE); - this._far = far; - this._far2 = far * far; - } - - defineProperties(DistanceDisplayCondition.prototype, { - near : { - get : function() { - return this._near; - }, - set : function(value) { - this._near = value; - this._near2 = value * value; - } - }, - - far : { - get : function() { - return this._far; - }, - set : function(value) { - this._far = value; - this._far2 = value * value; - } - } - }); - - var scratchPosition = new Cartesian3(); - - /** - * DOC_TBA - */ - DistanceDisplayCondition.prototype.isVisible = function(primitive, frameState) { - // TODO: need to consider positions, e.g., for a polyline - - // Distance to center of primitive's reference frame - var position = Matrix4.getTranslation(primitive.modelMatrix, scratchPosition); - var distance2 = Cartesian3.distanceSquared(position, frameState.camera.positionWC); - return (distance2 >= this._near2) && (distance2 <= this._far2); - }; - - return DistanceDisplayCondition; -}); diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index a594168e4b97..065cf1de7746 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -324,8 +324,6 @@ define([ * @param {Object|ArrayBuffer|Uint8Array} [options.gltf] The object for the glTF JSON or an arraybuffer of Binary glTF defined by the KHR_binary_glTF extension. * @param {String} [options.basePath=''] The base path that paths in the glTF JSON are relative to. * @param {Boolean} [options.show=true] Determines if the model primitive will be shown. - * @param {DisplayCondition} [options.displayCondition] DOC_TBA - * @param {Boolean} [options.loadOnlyIfDisplayCondition] DOC_TBA * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 transformation matrix that transforms the model from model to world coordinates. * @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. @@ -411,16 +409,6 @@ define([ */ this.show = defaultValue(options.show, true); - /** - * DOC_TBA - */ - this.displayCondition = options.displayCondition; - - /** - * DOC_TBA - */ - this.loadOnlyIfDisplayCondition = defaultValue(options.loadOnlyIfDisplayCondition, false); - /** * The 4x4 transformation matrix that transforms the model from model to world coordinates. * When this is the identity matrix, the model is drawn in world coordinates, i.e., Earth's WGS84 coordinates. @@ -920,8 +908,6 @@ define([ * @param {String} options.url The url to the .gltf file. * @param {Object} [options.headers] HTTP headers to send with the request. * @param {Boolean} [options.show=true] Determines if the model primitive will be shown. - * @param {DisplayCondition} [options.displayCondition] DOC_TBA - * @param {Boolean} [options.loadOnlyIfDisplayCondition] DOC_TBA * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 transformation matrix that transforms the model from model to world coordinates. * @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. @@ -3388,12 +3374,6 @@ define([ return; } - var displayConditionPassed = defined(this.displayCondition) ? this.displayCondition.isVisible(this, frameState) : true; - if (this.loadOnlyIfDisplayCondition && !displayConditionPassed) { - // Don't even try to load until the display condition is true - return; - } - var context = frameState.context; this._defaultTexture = context.defaultTexture; @@ -3498,7 +3478,7 @@ define([ } } - var show = this.show && (this.scale !== 0.0) && displayConditionPassed && (!defined(loadResources) || !loadResources.decompressionInFlight); + var show = this.show && (this.scale !== 0.0) && (!defined(loadResources) || !loadResources.decompressionInFlight); if ((show && this._state === ModelState.LOADED) || justLoaded) { var animated = this.activeAnimations.update(frameState) || this._cesiumAnimationsDirty;