From 0fdb2570d5a0588944553149d4230edd99dba6d7 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Thu, 17 Jul 2014 13:14:17 -0400 Subject: [PATCH] Clean up sensor API This are changes needed ahead of #1887 to ensure API/CZML compatibility with 1.0 --- Apps/SampleData/LotsOfSensors.czml | 62 +++---- Apps/SampleData/simple.czml | 2 +- Apps/Sandcastle/gallery/Sensors.html | 32 ++-- Source/DataSources/ConeGraphics.js | 47 +---- Source/DataSources/ConeVisualizer.js | 116 +++++-------- Source/DataSources/CzmlDataSource.js | 30 ++-- Source/DataSources/PyramidGraphics.js | 60 ++++--- Source/DataSources/PyramidVisualizer.js | 115 +++++-------- Source/Scene/CustomSensorVolume.js | 63 +++---- .../Scene/RectangularPyramidSensorVolume.js | 14 +- Source/Scene/SensorVolumeCollection.js | 161 ------------------ Specs/DataSources/ConeGraphicsSpec.js | 58 ++----- Specs/DataSources/ConeVisualizerSpec.js | 13 +- Specs/DataSources/CzmlDataSourceSpec.js | 99 +++-------- Specs/DataSources/PyramidGraphicsSpec.js | 16 +- Specs/DataSources/PyramidVisualizerSpec.js | 11 +- 16 files changed, 274 insertions(+), 625 deletions(-) delete mode 100644 Source/Scene/SensorVolumeCollection.js diff --git a/Apps/SampleData/LotsOfSensors.czml b/Apps/SampleData/LotsOfSensors.czml index 967525b00ea1..837aa5a53d6f 100644 --- a/Apps/SampleData/LotsOfSensors.czml +++ b/Apps/SampleData/LotsOfSensors.czml @@ -9418,7 +9418,7 @@ 0,255,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -11055,7 +11055,7 @@ 0,255,255,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -12692,7 +12692,7 @@ 255,0,255,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -14329,7 +14329,7 @@ 255,255,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -15966,7 +15966,7 @@ 0,0,255,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -17603,7 +17603,7 @@ 255,0,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -19240,7 +19240,7 @@ 65,105,225,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -20877,7 +20877,7 @@ 135,206,250,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -22514,7 +22514,7 @@ 107,142,35,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -24151,7 +24151,7 @@ 143,188,143,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -25788,7 +25788,7 @@ 255,215,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -27425,7 +27425,7 @@ 186,85,211,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -29062,7 +29062,7 @@ 255,105,180,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -30699,7 +30699,7 @@ 210,105,30,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -32336,7 +32336,7 @@ 255,240,245,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -33973,7 +33973,7 @@ 127,255,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -35610,7 +35610,7 @@ 255,106,106,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -37247,7 +37247,7 @@ 155,48,255,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -38884,7 +38884,7 @@ 255,165,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -40521,7 +40521,7 @@ 240,128,128,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -42158,7 +42158,7 @@ 240,230,140,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -43795,7 +43795,7 @@ 153,153,153,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -45432,7 +45432,7 @@ 64,128,128,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -47068,7 +47068,7 @@ 255,0,128,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -47102,7 +47102,7 @@ 255,128,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -48739,7 +48739,7 @@ 203,132,52,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -50376,7 +50376,7 @@ 127,255,0,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -52013,7 +52013,7 @@ 163,143,239,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -53650,7 +53650,7 @@ 201,193,54,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -55287,7 +55287,7 @@ 210,105,30,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ @@ -56924,7 +56924,7 @@ 155,48,255,255 ] }, - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ diff --git a/Apps/SampleData/simple.czml b/Apps/SampleData/simple.czml index 685149f8f8de..8c487a8527c9 100644 --- a/Apps/SampleData/simple.czml +++ b/Apps/SampleData/simple.czml @@ -846,7 +846,7 @@ } }, "portionToDisplay":"COMPLETE", - "material":{ + "lateralSurfaceMaterial":{ "solidColor":{ "color":{ "rgba":[ diff --git a/Apps/Sandcastle/gallery/Sensors.html b/Apps/Sandcastle/gallery/Sensors.html index 3518202fec13..ac61afc909d9 100644 --- a/Apps/Sandcastle/gallery/Sensors.html +++ b/Apps/Sandcastle/gallery/Sensors.html @@ -87,8 +87,8 @@ return Cesium.Matrix4.multiply(modelMatrix, Cesium.Matrix4.fromRotationTranslation(orientation, Cesium.Cartesian3.ZERO), new Cesium.Matrix4()); } - function addRectangularSensor(sensors, ellipsoid, scene) { - var rectangularPyramidSensor = sensors.addRectangularPyramid(); + function addRectangularSensor(primitives, ellipsoid, scene) { + var rectangularPyramidSensor = new Cesium.RectangularPyramidSensorVolume(); Sandcastle.declare(rectangularPyramidSensor); // For highlighting in Sandcastle. rectangularPyramidSensor.modelMatrix = getModelMatrix(ellipsoid); @@ -96,17 +96,18 @@ rectangularPyramidSensor.xHalfAngle = Cesium.Math.toRadians(40.0); rectangularPyramidSensor.yHalfAngle = Cesium.Math.toRadians(20.0); - rectangularPyramidSensor.material = Cesium.Material.fromType('Color'); - rectangularPyramidSensor.material.uniforms.color = { + rectangularPyramidSensor.lateralSurfaceMaterial = Cesium.Material.fromType('Color'); + rectangularPyramidSensor.lateralSurfaceMaterial.uniforms.color = { red : 0.0, green : 1.0, blue : 1.0, alpha : 0.5 }; + primitives.add(rectangularPyramidSensor); } - function addCustomSensor(sensors, ellipsoid, scene) { - var customSensor = sensors.addCustom(); + function addCustomSensor(primitives, ellipsoid, scene) { + var customSensor = new Cesium.CustomSensorVolume(); Sandcastle.declare(customSensor); // For highlighting in Sandcastle. var directions = []; @@ -119,10 +120,11 @@ customSensor.modelMatrix = getModelMatrix(ellipsoid); customSensor.radius = 20000000.0; - customSensor.setDirections(directions); + customSensor.directions = directions; + primitives.add(customSensor); } - function createUserInterface(viewer, sensors) { + function createUserInterface(viewer) { var tp = new TitlePane({ title: 'Manipulate Sensor', id:'title-pane', @@ -135,23 +137,22 @@ var scene = viewer.scene; var ellipsoid = scene.globe.ellipsoid; var primitives = scene.primitives; - primitives.add(sensors); var sensorMenu = new DropDownMenu({ style: 'display: none;'}); function updateSensor() { - sensors.removeAll(); + primitives.removeAll(); switch (selection) { case 'Rectangular': - addRectangularSensor(sensors, ellipsoid, scene); + addRectangularSensor(primitives, ellipsoid, scene); break; case 'Custom': - addCustomSensor(sensors, ellipsoid, scene); + addCustomSensor(primitives, ellipsoid, scene); break; case 'Rectangular': - addRectangularSensor(sensors, ellipsoid, scene); + addRectangularSensor(primitives, ellipsoid, scene); } } @@ -258,7 +259,7 @@ } var viewer = new Cesium.Viewer('cesiumContainer', { - sceneModePicker : false //sensors currently only work in 3D + sceneModePicker : false }); viewer.screenSpaceEventHandler.setInputAction(function(movement) { @@ -266,8 +267,7 @@ Sandcastle.highlight(pickedPrimitive); }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); - var sensors = new Cesium.SensorVolumeCollection(); - createUserInterface(viewer, sensors); + createUserInterface(viewer); }); //Sandcastle_End Sandcastle.finishedLoading(); diff --git a/Source/DataSources/ConeGraphics.js b/Source/DataSources/ConeGraphics.js index 84c176a3f702..29a1854b8925 100644 --- a/Source/DataSources/ConeGraphics.js +++ b/Source/DataSources/ConeGraphics.js @@ -30,14 +30,8 @@ define([ this._innerHalfAngleSubscription = undefined; this._outerHalfAngle = undefined; this._outerHalfAngleSubscription = undefined; - this._capMaterial = undefined; - this._capMaterialSubscription = undefined; - this._innerMaterial = undefined; - this._innerMaterialSubscription = undefined; - this._outerMaterial = undefined; - this._outerMaterialSubscription = undefined; - this._silhouetteMaterial = undefined; - this._silhouetteMaterialSubscription = undefined; + this._lateralSurfaceMaterial = undefined; + this._lateralSurfaceMaterialSubscription = undefined; this._intersectionColor = undefined; this._intersectionColorSubscription = undefined; this._intersectionWidth = undefined; @@ -94,32 +88,11 @@ define([ outerHalfAngle : createPropertyDescriptor('outerHalfAngle'), /** - * Gets or sets the {@link MaterialProperty} specifying the the cone's cap material. + * Gets or sets the {@link MaterialProperty} specifying the the cone's appearance. * @memberof ConeGraphics.prototype * @type {MaterialProperty} */ - capMaterial : createPropertyDescriptor('capMaterial'), - - /** - * Gets or sets the {@link MaterialProperty} specifying the the cone's inner material. - * @memberof ConeGraphics.prototype - * @type {MaterialProperty} - */ - innerMaterial : createPropertyDescriptor('innerMaterial'), - - /** - * Gets or sets the {@link MaterialProperty} specifying the the cone's outer material. - * @memberof ConeGraphics.prototype - * @type {MaterialProperty} - */ - outerMaterial : createPropertyDescriptor('outerMaterial'), - - /** - * Gets or sets the {@link MaterialProperty} specifying the the cone's silhouette material. - * @memberof ConeGraphics.prototype - * @type {MaterialProperty} - */ - silhouetteMaterial : createPropertyDescriptor('silhouetteMaterial'), + lateralSurfaceMaterial : createPropertyDescriptor('lateralSurfaceMaterial'), /** * Gets or sets the {@link Color} {@link Property} specifying the color of the line formed by the intersection of the cone and other central bodies. @@ -176,10 +149,7 @@ define([ result.showIntersection = this.showIntersection; result.intersectionColor = this.intersectionColor; result.intersectionWidth = this.intersectionWidth; - result.capMaterial = this.capMaterial; - result.innerMaterial = this.innerMaterial; - result.outerMaterial = this.outerMaterial; - result.silhouetteMaterial = this.silhouetteMaterial; + result.lateralSurfaceMaterial = this.lateralSurfaceMaterial; return result; }; @@ -205,11 +175,8 @@ define([ this.showIntersection = defaultValue(this.showIntersection, source.showIntersection); this.intersectionColor = defaultValue(this.intersectionColor, source.intersectionColor); this.intersectionWidth = defaultValue(this.intersectionWidth, source.intersectionWidth); - this.capMaterial = defaultValue(this.capMaterial, source.capMaterial); - this.innerMaterial = defaultValue(this.innerMaterial, source.innerMaterial); - this.outerMaterial = defaultValue(this.outerMaterial, source.outerMaterial); - this.silhouetteMaterial = defaultValue(this.silhouetteMaterial, source.silhouetteMaterial); + this.lateralSurfaceMaterial = defaultValue(this.lateralSurfaceMaterial, source.lateralSurfaceMaterial); }; return ConeGraphics; -}); +}); \ No newline at end of file diff --git a/Source/DataSources/ConeVisualizer.js b/Source/DataSources/ConeVisualizer.js index 43ef7b7793dc..ab74a8ea541a 100644 --- a/Source/DataSources/ConeVisualizer.js +++ b/Source/DataSources/ConeVisualizer.js @@ -41,7 +41,8 @@ define([ spherical.magnitude = 1.0; } - function computeDirections(minimumClockAngle, maximumClockAngle, innerHalfAngle, outerHalfAngle, result) { + function computeDirections(cone, minimumClockAngle, maximumClockAngle, innerHalfAngle, outerHalfAngle) { + var directions = cone.directions; var angle; var i = 0; var angleStep = CesiumMath.toRadians(2.0); @@ -49,25 +50,25 @@ define([ // No clock angle limits, so this is just a circle. // There might be a hole but we're ignoring it for now. for (angle = 0.0; angle < CesiumMath.TWO_PI; angle += angleStep) { - assignSpherical(i++, result, angle, outerHalfAngle); + assignSpherical(i++, directions, angle, outerHalfAngle); } } else { // There are clock angle limits. for (angle = minimumClockAngle; angle < maximumClockAngle; angle += angleStep) { - assignSpherical(i++, result, angle, outerHalfAngle); + assignSpherical(i++, directions, angle, outerHalfAngle); } - assignSpherical(i++, result, maximumClockAngle, outerHalfAngle); + assignSpherical(i++, directions, maximumClockAngle, outerHalfAngle); if (innerHalfAngle) { for (angle = maximumClockAngle; angle > minimumClockAngle; angle -= angleStep) { - assignSpherical(i++, result, angle, innerHalfAngle); + assignSpherical(i++, directions, angle, innerHalfAngle); } - assignSpherical(i++, result, minimumClockAngle, innerHalfAngle); + assignSpherical(i++, directions, minimumClockAngle, innerHalfAngle); } else { - assignSpherical(i++, result, maximumClockAngle, 0.0); + assignSpherical(i++, directions, maximumClockAngle, 0.0); } } - result.length = i; - return result; + directions.length = i; + cone.directions = directions; } /** @@ -91,9 +92,7 @@ define([ entityCollection.collectionChanged.addEventListener(ConeVisualizer.prototype._onObjectsRemoved, this); this._scene = scene; - this._unusedIndexes = []; this._primitives = scene.primitives; - this._coneCollection = []; this._entityCollection = entityCollection; }; @@ -133,27 +132,15 @@ define([ ConeVisualizer.prototype.destroy = function() { var entityCollection = this._entityCollection; entityCollection.collectionChanged.removeEventListener(ConeVisualizer.prototype._onObjectsRemoved, this); - - var i; - var entities = entityCollection.entities; - var length = entities.length; - for (i = 0; i < length; i++) { - entities[i]._coneVisualizerIndex = undefined; - } - - length = this._coneCollection.length; - for (i = 0; i < length; i++) { - this._primitives.remove(this._coneCollection[i]); - } - + this._onObjectsRemoved(entityCollection, undefined, entityCollection.entities); return destroyObject(this); }; var cachedPosition = new Cartesian3(); var cachedOrientation = new Quaternion(); - function updateObject(coneVisualizer, time, entity) { - var coneGraphics = entity._cone; - if (!defined(coneGraphics)) { + function updateObject(visualizer, time, entity) { + var dynamicCone = entity._cone; + if (!defined(dynamicCone)) { return; } @@ -167,51 +154,29 @@ define([ return; } - var cone; - var showProperty = coneGraphics._show; - var coneVisualizerIndex = entity._coneVisualizerIndex; + var cone = entity._conePrimitive; + var showProperty = dynamicCone._show; var show = entity.isAvailable(time) && (!defined(showProperty) || showProperty.getValue(time)); if (!show) { //don't bother creating or updating anything else - if (defined(coneVisualizerIndex)) { - cone = coneVisualizer._coneCollection[coneVisualizerIndex]; + if (defined(cone)) { cone.show = false; - entity._coneVisualizerIndex = undefined; - coneVisualizer._unusedIndexes.push(coneVisualizerIndex); } return; } - if (!defined(coneVisualizerIndex)) { - var unusedIndexes = coneVisualizer._unusedIndexes; - var length = unusedIndexes.length; - if (length > 0) { - coneVisualizerIndex = unusedIndexes.pop(); - cone = coneVisualizer._coneCollection[coneVisualizerIndex]; - } else { - coneVisualizerIndex = coneVisualizer._coneCollection.length; - cone = new CustomSensorVolume(); - cone._directionsScratch = []; - coneVisualizer._coneCollection.push(cone); - coneVisualizer._primitives.add(cone); - } - entity._coneVisualizerIndex = coneVisualizerIndex; + if (!defined(cone)) { + cone = new CustomSensorVolume(); cone.id = entity; - - cone.material = Material.fromType(Material.ColorType); - cone.intersectionColor = Color.clone(Color.YELLOW); - cone.intersectionWidth = 5.0; - cone.radius = Number.POSITIVE_INFINITY; - cone.showIntersection = true; - } else { - cone = coneVisualizer._coneCollection[coneVisualizerIndex]; + cone.lateralSurfaceMaterial = Material.fromType(Material.ColorType); + entity._conePrimitive = cone; + visualizer._primitives.add(cone); } - cone.show = true; var minimumClockAngle; - var property = coneGraphics._minimumClockAngle; + var property = dynamicCone._minimumClockAngle; if (defined(property)) { minimumClockAngle = property.getValue(time); } @@ -220,7 +185,7 @@ define([ } var maximumClockAngle; - property = coneGraphics._maximumClockAngle; + property = dynamicCone._maximumClockAngle; if (defined(property)) { maximumClockAngle = property.getValue(time); } @@ -229,7 +194,7 @@ define([ } var innerHalfAngle; - property = coneGraphics._innerHalfAngle; + property = dynamicCone._innerHalfAngle; if (defined(property)) { innerHalfAngle = property.getValue(time); } @@ -238,7 +203,7 @@ define([ } var outerHalfAngle; - property = coneGraphics._outerHalfAngle; + property = dynamicCone._outerHalfAngle; if (defined(property)) { outerHalfAngle = property.getValue(time); } @@ -251,14 +216,14 @@ define([ innerHalfAngle !== cone.innerHalfAngle || outerHalfAngle !== cone.outerHalfAngle) { - cone.setDirections(computeDirections(minimumClockAngle, maximumClockAngle, innerHalfAngle, outerHalfAngle, cone._directionsScratch)); + computeDirections(cone, minimumClockAngle, maximumClockAngle, innerHalfAngle, outerHalfAngle); cone.innerHalfAngle = innerHalfAngle; cone.maximumClockAngle = maximumClockAngle; cone.outerHalfAngle = outerHalfAngle; cone.minimumClockAngle = minimumClockAngle; } - property = coneGraphics._radius; + property = dynamicCone._radius; if (defined(property)) { var radius = property.getValue(time); if (defined(radius)) { @@ -278,14 +243,14 @@ define([ cone._visualizerOrientation = Quaternion.clone(orientation, cone._visualizerOrientation); } - cone.material = MaterialProperty.getValue(time, coneGraphics._outerMaterial, cone.material); + cone.lateralSurfaceMaterial = MaterialProperty.getValue(time, dynamicCone._lateralSurfaceMaterial, cone.lateralSurfaceMaterial); - property = coneGraphics._intersectionColor; + property = dynamicCone._intersectionColor; if (defined(property)) { property.getValue(time, cone.intersectionColor); } - property = coneGraphics._intersectionWidth; + property = dynamicCone._intersectionWidth; if (defined(property)) { var intersectionWidth = property.getValue(time); if (defined(intersectionWidth)) { @@ -294,17 +259,14 @@ define([ } } - ConeVisualizer.prototype._onObjectsRemoved = function(entityCollection, added, entities) { - var thisConeCollection = this._coneCollection; - var thisUnusedIndexes = this._unusedIndexes; - for (var i = entities.length - 1; i > -1; i--) { - var entity = entities[i]; - var coneVisualizerIndex = entity._coneVisualizerIndex; - if (defined(coneVisualizerIndex)) { - var cone = thisConeCollection[coneVisualizerIndex]; - cone.show = false; - thisUnusedIndexes.push(coneVisualizerIndex); - entity._coneVisualizerIndex = undefined; + ConeVisualizer.prototype._onObjectsRemoved = function(entityCollection, added, removed) { + var primitives = this._primitives; + for (var i = removed.length - 1; i > -1; i--) { + var entity = removed[i]; + var cone = entity._conePrimitive; + if (defined(cone)) { + primitives.remove(cone); + entity._conePrimitive = undefined; } } }; diff --git a/Source/DataSources/CzmlDataSource.js b/Source/DataSources/CzmlDataSource.js index 71dfe04a876a..f64e0dbb3670 100644 --- a/Source/DataSources/CzmlDataSource.js +++ b/Source/DataSources/CzmlDataSource.js @@ -1071,10 +1071,7 @@ define([ processPacketData(Number, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri, entityCollection); processPacketData(Number, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri, entityCollection); processPacketData(Number, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri, entityCollection); - processMaterialPacketData(cone, 'capMaterial', coneData.capMaterial, interval, sourceUri, entityCollection); - processMaterialPacketData(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri, entityCollection); - processMaterialPacketData(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri, entityCollection); - processMaterialPacketData(cone, 'silhouetteMaterial', coneData.silhouetteMaterial, interval, sourceUri, entityCollection); + processMaterialPacketData(cone, 'lateralSurfaceMaterial', coneData.lateralSurfaceMaterial, interval, sourceUri, entityCollection); } function processEllipse(entity, packet, entityCollection, sourceUri) { @@ -1373,18 +1370,23 @@ define([ var i; var len; var values = []; - var tmp = directions.unitSpherical; - if (defined(tmp)) { - for (i = 0, len = tmp.length; i < len; i += 2) { - values.push(new Spherical(tmp[i], tmp[i + 1])); + var unitSphericals = directions.unitSpherical; + var sphericals = directions.spherical; + var unitCartesians = directions.unitCartesian; + + if (defined(unitSphericals)) { + for (i = 0, len = unitSphericals.length; i < len; i += 2) { + values.push(new Spherical(unitSphericals[i], unitSphericals[i + 1])); } directions.array = values; + } else if (defined(sphericals)) { + for (i = 0, len = sphericals.length; i < len; i += 3) { + values.push(new Spherical(sphericals[i], sphericals[i + 1], sphericals[i + 2])); } - - tmp = directions.unitCartesian; - if (defined(tmp)) { - for (i = 0, len = tmp.length; i < len; i += 3) { - values.push(Spherical.fromCartesian3(new Cartesian3(tmp[i], tmp[i + 1], tmp[i + 2]))); + directions.array = values; + } else if (defined(unitCartesians)) { + for (i = 0, len = unitCartesians.length; i < len; i += 3) { + values.push(Spherical.fromCartesian3(new Cartesian3(unitCartesians[i], unitCartesians[i + 1], unitCartesians[i + 2]))); } directions.array = values; } @@ -1414,7 +1416,7 @@ define([ processPacketData(Boolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri, entityCollection); processPacketData(Color, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri, entityCollection); processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri, entityCollection); - processMaterialPacketData(pyramid, 'material', pyramidData.material, interval, sourceUri, entityCollection); + processMaterialPacketData(pyramid, 'lateralSurfaceMaterial', pyramidData.lateralSurfaceMaterial, interval, sourceUri, entityCollection); //The directions property is a special case value that can be an array of unitSpherical or unit Cartesians. //We pre-process this into Spherical instances and then process it like any other array. diff --git a/Source/DataSources/PyramidGraphics.js b/Source/DataSources/PyramidGraphics.js index a5cc95fa08ed..1877bd57c4a0 100644 --- a/Source/DataSources/PyramidGraphics.js +++ b/Source/DataSources/PyramidGraphics.js @@ -22,20 +22,24 @@ define([ * @constructor */ var PyramidGraphics = function() { - this._show = undefined; - this._showSubscription = undefined; this._directions = undefined; this._directionsSubscription = undefined; - this._radius = undefined; - this._radiusSubscription = undefined; - this._showIntersection = undefined; - this._showIntersectionSubscription = undefined; + + this._lateralSurfaceMaterial = undefined; + this._lateralSurfaceMaterialSubscription = undefined; + + this._portionToDisplay = undefined; + this._portionToDisplaySubscription = undefined; this._intersectionColor = undefined; this._intersectionColorSubscription = undefined; this._intersectionWidth = undefined; this._intersectionWidthSubscription = undefined; - this._material = undefined; - this._materialSubscription = undefined; + this._showIntersection = undefined; + this._showIntersectionSubscription = undefined; + this._radius = undefined; + this._radiusSubscription = undefined; + this._show = undefined; + this._showSubscription = undefined; this._definitionChanged = new Event(); }; @@ -54,53 +58,53 @@ define([ }, /** - * Gets or sets the boolean {@link Property} specifying the visibility of the pyramid. + * A {@link Property} which returns an array of {@link Spherical} instances representing the pyramid's projection. * @memberof PyramidGraphics.prototype * @type {Property} */ - show : createPropertyDescriptor('show'), + directions : createPropertyDescriptor('directions'), /** - * A {@link Property} which returns an array of {@link Spherical} instances representing the pyramid's projection. + * Gets or sets the {@link MaterialProperty} specifying the the pyramid's appearance. * @memberof PyramidGraphics.prototype - * @type {Property} + * @type {MaterialProperty} */ - directions : createPropertyDescriptor('directions'), + lateralSurfaceMaterial : createPropertyDescriptor('lateralSurfaceMaterial'), /** - * Gets or sets the numeric {@link Property} specifying the radius of the pyramid's projection. + * Gets or sets the {@link Color} {@link Property} specifying the color of the line formed by the intersection of the pyramid and other central bodies. * @memberof PyramidGraphics.prototype * @type {Property} */ - radius : createPropertyDescriptor('radius'), + intersectionColor : createPropertyDescriptor('intersectionColor'), /** - * Gets or sets the boolean {@link Property} specifying the visibility of the line formed by the intersection of the pyramid and other central bodies. + * Gets or sets the numeric {@link Property} specifying the width of the line formed by the intersection of the pyramid and other central bodies. * @memberof PyramidGraphics.prototype * @type {Property} */ - showIntersection : createPropertyDescriptor('showIntersection'), + intersectionWidth : createPropertyDescriptor('intersectionWidth'), /** - * Gets or sets the {@link Color} {@link Property} specifying the color of the line formed by the intersection of the pyramid and other central bodies. + * Gets or sets the boolean {@link Property} specifying the visibility of the line formed by the intersection of the pyramid and other central bodies. * @memberof PyramidGraphics.prototype * @type {Property} */ - intersectionColor : createPropertyDescriptor('intersectionColor'), + showIntersection : createPropertyDescriptor('showIntersection'), /** - * Gets or sets the numeric {@link Property} specifying the width of the line formed by the intersection of the pyramid and other central bodies. + * Gets or sets the numeric {@link Property} specifying the radius of the pyramid's projection. * @memberof PyramidGraphics.prototype * @type {Property} */ - intersectionWidth : createPropertyDescriptor('intersectionWidth'), + radius : createPropertyDescriptor('radius'), /** - * Gets or sets the {@link MaterialProperty} specifying the the pyramid's appearance. + * Gets or sets the boolean {@link Property} specifying the visibility of the pyramid. * @memberof PyramidGraphics.prototype - * @type {MaterialProperty} + * @type {Property} */ - material : createPropertyDescriptor('material') + show : createPropertyDescriptor('show') }); /** @@ -113,13 +117,13 @@ define([ if (!defined(result)) { result = new PyramidGraphics(); } - result.show = this.show; result.directions = this.directions; result.radius = this.radius; + result.show = this.show; result.showIntersection = this.showIntersection; result.intersectionColor = this.intersectionColor; result.intersectionWidth = this.intersectionWidth; - result.material = this.material; + result.lateralSurfaceMaterial = this.lateralSurfaceMaterial; return result; }; @@ -136,13 +140,13 @@ define([ } //>>includeEnd('debug'); - this.show = defaultValue(this.show, source.show); this.directions = defaultValue(this.directions, source.directions); this.radius = defaultValue(this.radius, source.radius); + this.show = defaultValue(this.show, source.show); this.showIntersection = defaultValue(this.showIntersection, source.showIntersection); this.intersectionColor = defaultValue(this.intersectionColor, source.intersectionColor); this.intersectionWidth = defaultValue(this.intersectionWidth, source.intersectionWidth); - this.material = defaultValue(this.material, source.material); + this.lateralSurfaceMaterial = defaultValue(this.lateralSurfaceMaterial, source.lateralSurfaceMaterial); }; return PyramidGraphics; diff --git a/Source/DataSources/PyramidVisualizer.js b/Source/DataSources/PyramidVisualizer.js index c0001cfa73b6..95456d9ad343 100644 --- a/Source/DataSources/PyramidVisualizer.js +++ b/Source/DataSources/PyramidVisualizer.js @@ -50,9 +50,7 @@ define([ entityCollection.collectionChanged.addEventListener(PyramidVisualizer.prototype._onObjectsRemoved, this); this._scene = scene; - this._unusedIndexes = []; this._primitives = scene.primitives; - this._pyramidCollection = []; this._entityCollection = entityCollection; }; @@ -90,31 +88,21 @@ define([ * Removes and destroys all primitives created by this instance. */ PyramidVisualizer.prototype.destroy = function() { - var i; - var length = this._pyramidCollection.length; - var primitives = this._primitives; - for (i = 0; i < length; i++) { - primitives.remove(this._pyramidCollection[i]); - } - - var entities = this._entityCollection.entities; - length = entities.length; - for (i = 0; i < length; i++) { - entities[i]._pyramidVisualizerIndex = undefined; - } - + var entityCollection = this._entityCollection; + entityCollection.collectionChanged.removeEventListener(PyramidVisualizer.prototype._onObjectsRemoved, this); + this._onObjectsRemoved(entityCollection, undefined, entityCollection.entities); return destroyObject(this); }; var position; var orientation; - function updateObject(pyramidVisualizer, time, entity) { - var pyramidGraphics = entity._pyramid; - if (!defined(pyramidGraphics)) { + function updateObject(visualizer, time, entity) { + var dynamicPyramid = entity._pyramid; + if (!defined(dynamicPyramid)) { return; } - var directionsProperty = pyramidGraphics._directions; + var directionsProperty = dynamicPyramid._directions; if (!defined(directionsProperty)) { return; } @@ -129,55 +117,41 @@ define([ return; } - var pyramid; - var showProperty = pyramidGraphics._show; - var pyramidVisualizerIndex = entity._pyramidVisualizerIndex; + var pyramid = entity._pyramidPrimitive; + var showProperty = dynamicPyramid._show; var show = entity.isAvailable(time) && (!defined(showProperty) || showProperty.getValue(time)); if (!show) { //don't bother creating or updating anything else - if (defined(pyramidVisualizerIndex)) { - pyramid = pyramidVisualizer._pyramidCollection[pyramidVisualizerIndex]; + if (defined(pyramid)) { pyramid.show = false; - entity._pyramidVisualizerIndex = undefined; - pyramidVisualizer._unusedIndexes.push(pyramidVisualizerIndex); } return; } - if (!defined(pyramidVisualizerIndex)) { - var unusedIndexes = pyramidVisualizer._unusedIndexes; - var length = unusedIndexes.length; - if (length > 0) { - pyramidVisualizerIndex = unusedIndexes.pop(); - pyramid = pyramidVisualizer._pyramidCollection[pyramidVisualizerIndex]; - } else { - pyramidVisualizerIndex = pyramidVisualizer._pyramidCollection.length; - pyramid = new CustomSensorVolume(); - - pyramidVisualizer._pyramidCollection.push(pyramid); - pyramidVisualizer._primitives.add(pyramid); - } - entity._pyramidVisualizerIndex = pyramidVisualizerIndex; + if (!defined(pyramid)) { + pyramid = new CustomSensorVolume(); pyramid.id = entity; - - pyramid.radius = Number.POSITIVE_INFINITY; - pyramid.showIntersection = true; - pyramid.intersectionColor = Color.YELLOW; - pyramid.intersectionWidth = 5.0; - pyramid.material = Material.fromType(Material.ColorType); - } else { - pyramid = pyramidVisualizer._pyramidCollection[pyramidVisualizerIndex]; + pyramid.lateralSurfaceMaterial = Material.fromType(Material.ColorType); + entity._pyramidPrimitive = pyramid; + visualizer._primitives.add(pyramid); } - pyramid.show = true; var directions = directionsProperty.getValue(time); if (defined(directions) && pyramid._visualizerDirections !== directions) { - pyramid.setDirections(directions); + pyramid.directions = directions; pyramid._visualizerDirections = directions; } + var property = dynamicPyramid._radius; + if (defined(property)) { + var radius = property.getValue(time); + if (defined(radius)) { + pyramid.radius = radius; + } + } + position = defaultValue(positionProperty.getValue(time, position), pyramid._visualizerPosition); orientation = defaultValue(orientationProperty.getValue(time, orientation), pyramid._visualizerOrientation); @@ -186,48 +160,37 @@ define([ (!Cartesian3.equals(position, pyramid._visualizerPosition) || !Quaternion.equals(orientation, pyramid._visualizerOrientation))) { Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(orientation, matrix3Scratch), position, pyramid.modelMatrix); - Cartesian3.clone(position, pyramid._visualizerPosition); - Quaternion.clone(orientation, pyramid._visualizerOrientation); + pyramid._visualizerPosition = Cartesian3.clone(position, pyramid._visualizerPosition); + pyramid._visualizerOrientation = Quaternion.clone(orientation, pyramid._visualizerOrientation); } - pyramid.material = MaterialProperty.getValue(time, pyramidGraphics._material, pyramid.material); + pyramid.lateralSurfaceMaterial = MaterialProperty.getValue(time, dynamicPyramid._lateralSurfaceMaterial, pyramid.lateralSurfaceMaterial); - var property = pyramidGraphics._intersectionColor; + property = dynamicPyramid._intersectionColor; if (defined(property)) { - var intersectionColor = property.getValue(time, intersectionColor); + var intersectionColor = property.getValue(time, pyramid.intersectionColor); if (defined(intersectionColor)) { pyramid.intersectionColor = intersectionColor; } } - property = pyramidGraphics._intersectionWidth; + property = dynamicPyramid._intersectionWidth; if (defined(property)) { - var intersectionWidth = property.getValue(time, intersectionWidth); + var intersectionWidth = property.getValue(time); if (defined(intersectionWidth)) { pyramid.intersectionWidth = intersectionWidth; } } - - property = pyramidGraphics._radius; - if (defined(property)) { - var radius = property.getValue(time, radius); - if (defined(radius)) { - pyramid.radius = radius; - } - } } - PyramidVisualizer.prototype._onObjectsRemoved = function(entityCollection, added, entities) { - var thisPyramidCollection = this._pyramidCollection; - var thisUnusedIndexes = this._unusedIndexes; - for (var i = entities.length - 1; i > -1; i--) { - var entity = entities[i]; - var pyramidVisualizerIndex = entity._pyramidVisualizerIndex; - if (defined(pyramidVisualizerIndex)) { - var pyramid = thisPyramidCollection[pyramidVisualizerIndex]; - pyramid.show = false; - thisUnusedIndexes.push(pyramidVisualizerIndex); - entity._pyramidVisualizerIndex = undefined; + PyramidVisualizer.prototype._onObjectsRemoved = function(entityCollection, added, removed) { + var primitives = this._primitives; + for (var i = removed.length - 1; i > -1; i--) { + var entity = removed[i]; + var pyramid = entity._pyramidPrimitive; + if (defined(pyramid)) { + primitives.remove(pyramid); + entity._pyramidPrimitive = undefined; } } }; diff --git a/Source/Scene/CustomSensorVolume.js b/Source/Scene/CustomSensorVolume.js index 8391077359d3..ffcd7ef31de3 100644 --- a/Source/Scene/CustomSensorVolume.js +++ b/Source/Scene/CustomSensorVolume.js @@ -7,6 +7,7 @@ define([ '../Core/ComponentDatatype', '../Core/defaultValue', '../Core/defined', + '../Core/defineProperties', '../Core/destroyObject', '../Core/DeveloperError', '../Core/Matrix4', @@ -30,6 +31,7 @@ define([ ComponentDatatype, defaultValue, defined, + defineProperties, destroyObject, DeveloperError, Matrix4, @@ -59,8 +61,6 @@ define([ * * @alias CustomSensorVolume * @constructor - * - * @see SensorVolumeCollection#addCustom */ var CustomSensorVolume = function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -151,7 +151,7 @@ define([ this._directions = undefined; this._directionsDirty = false; - this.setDirections(options.directions); + this.directions = defined(options.directions) ? options.directions : []; /** * The surface appearance of the sensor. This can be one of several built-in {@link Material} objects or a custom material, scripted with @@ -172,8 +172,8 @@ define([ * // 2. Change material to horizontal stripes * sensor.material = Cesium.Material.fromType(Material.StripeType); */ - this.material = defined(options.material) ? options.material : Material.fromType(Material.ColorType); - this._material = undefined; + this.lateralSurfaceMaterial = defined(options.lateralSurfaceMaterial) ? options.lateralSurfaceMaterial : Material.fromType(Material.ColorType); + this._lateralSurfaceMaterial = undefined; this._translucent = undefined; /** @@ -233,24 +233,17 @@ define([ this._mode = SceneMode.SCENE3D; }; - /** - * DOC_TBA - * - * @see CustomSensorVolume#getDirections - */ - CustomSensorVolume.prototype.setDirections = function(directions) { - this._directions = directions; - this._directionsDirty = true; - }; - - /** - * DOC_TBA - * - * @see CustomSensorVolume#setDirections - */ - CustomSensorVolume.prototype.getDirections = function() { - return this._directions; - }; + defineProperties(CustomSensorVolume.prototype, { + directions : { + get : function() { + return this._directions; + }, + set : function(value) { + this._directions = value; + this._directionsDirty = true; + } + } + }); var n0Scratch = new Cartesian3(); var n1Scratch = new Cartesian3(); @@ -352,7 +345,7 @@ define([ *

* * @exception {DeveloperError} this.radius must be greater than or equal to zero. - * @exception {DeveloperError} this.material must be defined. + * @exception {DeveloperError} this.lateralSurfaceMaterial must be defined. */ CustomSensorVolume.prototype.update = function(context, frameState, commandList) { this._mode = frameState.mode; @@ -364,12 +357,12 @@ define([ if (this.radius < 0.0) { throw new DeveloperError('this.radius must be greater than or equal to zero.'); } - if (!defined(this.material)) { - throw new DeveloperError('this.material must be defined.'); + if (!defined(this.lateralSurfaceMaterial)) { + throw new DeveloperError('this.lateralSurfaceMaterial must be defined.'); } //>>includeEnd('debug'); - var translucent = this.material.isTranslucent(); + var translucent = this.lateralSurfaceMaterial.isTranslucent(); // Initial render state creation if ((this._showThroughEllipsoid !== this.showThroughEllipsoid) || @@ -476,9 +469,9 @@ define([ this._backFaceColorCommand.modelMatrix = this._frontFaceColorCommand.modelMatrix; this._pickCommand.modelMatrix = this._frontFaceColorCommand.modelMatrix; - var materialChanged = this._material !== this.material; - this._material = this.material; - this._material.update(context); + var materialChanged = this._lateralSurfaceMaterial !== this.lateralSurfaceMaterial; + this._lateralSurfaceMaterial = this.lateralSurfaceMaterial; + this._lateralSurfaceMaterial.update(context); if (pass.render) { var frontFaceColorCommand = this._frontFaceColorCommand; @@ -487,15 +480,15 @@ define([ // Recompile shader when material changes if (materialChanged || !defined(frontFaceColorCommand.shaderProgram)) { var fsSource = createShaderSource({ - sources : [ShadersSensorVolume, this._material.shaderSource, CustomSensorVolumeFS] + sources : [ShadersSensorVolume, this._lateralSurfaceMaterial.shaderSource, CustomSensorVolumeFS] }); frontFaceColorCommand.shaderProgram = context.replaceShaderProgram( frontFaceColorCommand.shaderProgram, CustomSensorVolumeVS, fsSource, attributeLocations); - frontFaceColorCommand.uniformMap = combine(this._uniforms, this._material._uniforms); + frontFaceColorCommand.uniformMap = combine(this._uniforms, this._lateralSurfaceMaterial._uniforms); backFaceColorCommand.shaderProgram = frontFaceColorCommand.shaderProgram; - backFaceColorCommand.uniformMap = combine(this._uniforms, this._material._uniforms); + backFaceColorCommand.uniformMap = combine(this._uniforms, this._lateralSurfaceMaterial._uniforms); backFaceColorCommand.uniformMap.u_normalDirection = function() { return -1.0; }; @@ -523,7 +516,7 @@ define([ // Recompile shader when material changes if (materialChanged || !defined(pickCommand.shaderProgram)) { var pickFS = createShaderSource({ - sources : [ShadersSensorVolume, this._material.shaderSource, CustomSensorVolumeFS], + sources : [ShadersSensorVolume, this._lateralSurfaceMaterial.shaderSource, CustomSensorVolumeFS], pickColorQualifier : 'uniform' }); @@ -536,7 +529,7 @@ define([ return that._pickId.color; } }; - pickCommand.uniformMap = combine(combine(this._uniforms, this._material._uniforms), uniforms); + pickCommand.uniformMap = combine(combine(this._uniforms, this._lateralSurfaceMaterial._uniforms), uniforms); } pickCommand.pass = translucent ? Pass.TRANSLUCENT : Pass.OPAQUE; diff --git a/Source/Scene/RectangularPyramidSensorVolume.js b/Source/Scene/RectangularPyramidSensorVolume.js index 21c7c7c57fef..251bfed5062a 100644 --- a/Source/Scene/RectangularPyramidSensorVolume.js +++ b/Source/Scene/RectangularPyramidSensorVolume.js @@ -28,8 +28,6 @@ define([ * * @alias RectangularPyramidSensorVolume * @constructor - * - * @see SensorVolumeCollection#addRectangularPyramid */ var RectangularPyramidSensorVolume = function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); @@ -131,12 +129,12 @@ define([ * * @example * // 1. Change the color of the default material to yellow - * sensor.material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0); + * sensor.lateralSurfaceMaterial.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0); * * // 2. Change material to horizontal stripes - * sensor.material = Cesium.Material.fromType(Cesium.Material.StripeType); + * sensor.lateralSurfaceMaterial = Cesium.Material.fromType(Cesium.Material.StripeType); */ - this.material = defined(options.material) ? options.material : Material.fromType(Material.ColorType); + this.lateralSurfaceMaterial = defined(options.lateralSurfaceMaterial) ? options.lateralSurfaceMaterial : Material.fromType(Material.ColorType); /** * The color of the polyline where the sensor outline intersects the globe. The default is {@link Color.WHITE}. @@ -199,7 +197,7 @@ define([ s.showThroughEllipsoid = this.showThroughEllipsoid; s.modelMatrix = this.modelMatrix; s.radius = this.radius; - s.material = this.material; + s.lateralSurfaceMaterial = this.lateralSurfaceMaterial; s.intersectionColor = this.intersectionColor; s.intersectionWidth = this.intersectionWidth; s.id = this.id; @@ -215,7 +213,7 @@ define([ var theta = Math.atan(tanX / tanY); var cone = Math.atan(Math.sqrt(tanX * tanX + tanY * tanY)); - s.setDirections([{ + s.directions = [{ clock : theta, cone : cone }, { @@ -227,7 +225,7 @@ define([ }, { clock : -theta, cone : cone - }]); + }]; } s.update(context, frameState, commandList); diff --git a/Source/Scene/SensorVolumeCollection.js b/Source/Scene/SensorVolumeCollection.js deleted file mode 100644 index f6527ca983b9..000000000000 --- a/Source/Scene/SensorVolumeCollection.js +++ /dev/null @@ -1,161 +0,0 @@ -/*global define*/ -define([ - '../Core/defined', - '../Core/defineProperties', - '../Core/destroyObject', - '../Core/DeveloperError', - './CustomSensorVolume', - './RectangularPyramidSensorVolume', - './SceneMode' - ], function( - defined, - defineProperties, - destroyObject, - DeveloperError, - CustomSensorVolume, - RectangularPyramidSensorVolume, - SceneMode) { - "use strict"; - - /** - * DOC_TBA - * - * @alias SensorVolumeCollection - * @constructor - * - * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Sensors.html|Cesium Sandcastle Sensors Demo} - */ - var SensorVolumeCollection = function() { - this._sensors = []; - }; - - defineProperties(SensorVolumeCollection.prototype, { - /** - * DOC_TBA - * @memberof SensorVolumeCollection.prototype - * @type {Event} - */ - length : { - get : function() { - return this._sensors.length; - } - } - }); - - /** - * DOC_TBA - * - * @see SensorVolumeCollection#addCustom - * @see SensorVolumeCollection#addComplexConic - */ - SensorVolumeCollection.prototype.addRectangularPyramid = function(options) { - var sensor = new RectangularPyramidSensorVolume(options); - this._sensors.push(sensor); - return sensor; - }; - - /** - * DOC_TBA - * - * @see SensorVolumeCollection#addRectangularPyramid - * @see SensorVolumeCollection#addComplexConic - */ - SensorVolumeCollection.prototype.addCustom = function(options) { - var sensor = new CustomSensorVolume(options); - this._sensors.push(sensor); - return sensor; - }; - - /** - * DOC_TBA - * - * @see SensorVolumeCollection#removeAll - */ - SensorVolumeCollection.prototype.remove = function(sensor) { - if (sensor) { - var sensors = this._sensors; - var i = sensors.indexOf(sensor); - if (i !== -1) { - sensors[i].destroy(); - sensors.splice(i, 1); - return true; - } - } - - return false; - }; - - /** - * DOC_TBA - * - * @see SensorVolumeCollection#remove - */ - SensorVolumeCollection.prototype.removeAll = function() { - var sensors = this._sensors; - var length = sensors.length; - for ( var i = 0; i < length; ++i) { - sensors[i].destroy(); - } - - this._sensors = []; - }; - - /** - * DOC_TBA - */ - SensorVolumeCollection.prototype.contains = function(sensor) { - if (sensor) { - return (this._sensors.indexOf(sensor) !== -1); - } - - return false; - }; - - /** - * DOC_TBA - * - * @see SensorVolumeCollection#length - */ - SensorVolumeCollection.prototype.get = function(index) { - //>>includeStart('debug', pragmas.debug); - if (!defined(index)) { - throw new DeveloperError('index is required.'); - } - //>>includeEnd('debug'); - - return this._sensors[index]; - }; - - /** - * @private - */ - SensorVolumeCollection.prototype.update = function(context, frameState, commandList) { - var mode = frameState.mode; - if (mode !== SceneMode.SCENE3D) { - return; - } - - var sensors = this._sensors; - var length = sensors.length; - for (var i = 0; i < length; ++i) { - sensors[i].update(context, frameState, commandList); - } - }; - - /** - * DOC_TBA - */ - SensorVolumeCollection.prototype.isDestroyed = function() { - return false; - }; - - /** - * DOC_TBA - */ - SensorVolumeCollection.prototype.destroy = function() { - this.removeAll(); - return destroyObject(this); - }; - - return SensorVolumeCollection; -}); diff --git a/Specs/DataSources/ConeGraphicsSpec.js b/Specs/DataSources/ConeGraphicsSpec.js index 7e9860756a01..f8c6d07d0aae 100644 --- a/Specs/DataSources/ConeGraphicsSpec.js +++ b/Specs/DataSources/ConeGraphicsSpec.js @@ -14,10 +14,7 @@ defineSuite([ it('merge assigns unassigned properties', function() { var source = new ConeGraphics(); - source.capMaterial = new ColorMaterialProperty(); - source.innerMaterial = new ColorMaterialProperty(); - source.silhouetteMaterial = new ColorMaterialProperty(); - source.outerMaterial = new ColorMaterialProperty(); + source.lateralSurfaceMaterial = new ColorMaterialProperty(); source.innerHalfAngle = new ConstantProperty(1); source.maximumClockAngle = new ConstantProperty(1); source.minimumClockAngle = new ConstantProperty(1); @@ -32,10 +29,7 @@ defineSuite([ var target = new ConeGraphics(); target.merge(source); - expect(target.capMaterial).toBe(source.capMaterial); - expect(target.innerMaterial).toBe(source.innerMaterial); - expect(target.silhouetteMaterial).toBe(source.silhouetteMaterial); - expect(target.outerMaterial).toBe(source.outerMaterial); + expect(target.lateralSurfaceMaterial).toBe(source.lateralSurfaceMaterial); expect(target.innerHalfAngle).toBe(source.innerHalfAngle); expect(target.maximumClockAngle).toBe(source.maximumClockAngle); expect(target.minimumClockAngle).toBe(source.minimumClockAngle); @@ -49,10 +43,7 @@ defineSuite([ it('merge does not assign assigned properties', function() { var source = new ConeGraphics(); - source.capMaterial = new ColorMaterialProperty(); - source.innerMaterial = new ColorMaterialProperty(); - source.silhouetteMaterial = new ColorMaterialProperty(); - source.outerMaterial = new ColorMaterialProperty(); + source.lateralSurfaceMaterial = new ColorMaterialProperty(); source.innerHalfAngle = new ConstantProperty(1); source.maximumClockAngle = new ConstantProperty(1); source.minimumClockAngle = new ConstantProperty(1); @@ -63,10 +54,7 @@ defineSuite([ source.showIntersection = new ConstantProperty(true); source.intersectionWidth = new ConstantProperty(1); - var capMaterial = new ColorMaterialProperty(); - var innerMaterial = new ColorMaterialProperty(); - var silhouetteMaterial = new ColorMaterialProperty(); - var outerMaterial = new ColorMaterialProperty(); + var lateralSurfaceMaterial = new ColorMaterialProperty(); var innerHalfAngle = new ConstantProperty(1); var maximumClockAngle = new ConstantProperty(1); var minimumClockAngle = new ConstantProperty(1); @@ -78,26 +66,20 @@ defineSuite([ var intersectionWidth = new ConstantProperty(1); var target = new ConeGraphics(); - source.capMaterial = capMaterial; - source.innerMaterial = innerMaterial; - source.silhouetteMaterial = silhouetteMaterial; - source.outerMaterial = outerMaterial; - source.innerHalfAngle = innerHalfAngle; - source.maximumClockAngle = maximumClockAngle; - source.minimumClockAngle = minimumClockAngle; - source.outerHalfAngle = outerHalfAngle; - source.intersectionColor = intersectionColor; - source.radius = radius; - source.show = show; - source.showIntersection = showIntersection; - source.intersectionWidth = intersectionWidth; + target.lateralSurfaceMaterial = lateralSurfaceMaterial; + target.innerHalfAngle = innerHalfAngle; + target.maximumClockAngle = maximumClockAngle; + target.minimumClockAngle = minimumClockAngle; + target.outerHalfAngle = outerHalfAngle; + target.intersectionColor = intersectionColor; + target.radius = radius; + target.show = show; + target.showIntersection = showIntersection; + target.intersectionWidth = intersectionWidth; target.merge(source); - expect(target.capMaterial).toBe(capMaterial); - expect(target.innerMaterial).toBe(innerMaterial); - expect(target.silhouetteMaterial).toBe(silhouetteMaterial); - expect(target.outerMaterial).toBe(outerMaterial); + expect(target.lateralSurfaceMaterial).toBe(lateralSurfaceMaterial); expect(target.innerHalfAngle).toBe(innerHalfAngle); expect(target.maximumClockAngle).toBe(maximumClockAngle); expect(target.minimumClockAngle).toBe(minimumClockAngle); @@ -111,10 +93,7 @@ defineSuite([ it('clone works', function() { var source = new ConeGraphics(); - source.capMaterial = new ColorMaterialProperty(); - source.innerMaterial = new ColorMaterialProperty(); - source.silhouetteMaterial = new ColorMaterialProperty(); - source.outerMaterial = new ColorMaterialProperty(); + source.lateralSurfaceMaterial = new ColorMaterialProperty(); source.innerHalfAngle = new ConstantProperty(1); source.maximumClockAngle = new ConstantProperty(1); source.minimumClockAngle = new ConstantProperty(1); @@ -126,10 +105,7 @@ defineSuite([ source.intersectionWidth = new ConstantProperty(1); var result = source.clone(); - expect(result.capMaterial).toBe(source.capMaterial); - expect(result.innerMaterial).toBe(source.innerMaterial); - expect(result.silhouetteMaterial).toBe(source.silhouetteMaterial); - expect(result.outerMaterial).toBe(source.outerMaterial); + expect(result.lateralSurfaceMaterial).toBe(source.lateralSurfaceMaterial); expect(result.innerHalfAngle).toBe(source.innerHalfAngle); expect(result.maximumClockAngle).toBe(source.maximumClockAngle); expect(result.minimumClockAngle).toBe(source.minimumClockAngle); diff --git a/Specs/DataSources/ConeVisualizerSpec.js b/Specs/DataSources/ConeVisualizerSpec.js index 2f1f7c339397..dc20577fcbe4 100644 --- a/Specs/DataSources/ConeVisualizerSpec.js +++ b/Specs/DataSources/ConeVisualizerSpec.js @@ -126,11 +126,11 @@ defineSuite([ cone.showIntersection = new ConstantProperty(true); cone.radius = new ConstantProperty(123.5); cone.show = new ConstantProperty(true); + cone.lateralSurfaceMaterial = new ColorMaterialProperty.fromColor(Color.WHITE); - cone.outerMaterial = new ColorMaterialProperty(); visualizer.update(time); - expect(scene.primitives.length).toEqual(1); + var c = scene.primitives.get(0); expect(c.minimumClockAngle).toEqual(testObject.cone.minimumClockAngle.getValue(time)); expect(c.maximumClockAngle).toEqual(testObject.cone.maximumClockAngle.getValue(time)); @@ -140,9 +140,9 @@ defineSuite([ expect(c.intersectionWidth).toEqual(testObject.cone.intersectionWidth.getValue(time)); expect(c.showIntersection).toEqual(testObject.cone.showIntersection.getValue(time)); expect(c.radius).toEqual(testObject.cone.radius.getValue(time)); - expect(c.show).toEqual(testObject.cone.show.getValue(time)); - expect(c.material.uniforms).toEqual(testObject.cone.outerMaterial.getValue(time)); expect(c.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time)), testObject.position.getValue(time))); + expect(c.show).toEqual(testObject.cone.show.getValue(time)); + expect(c.lateralSurfaceMaterial.uniforms).toEqual(testObject.cone.lateralSurfaceMaterial.getValue(time)); cone.show.value = false; visualizer.update(time); @@ -200,7 +200,7 @@ defineSuite([ expect(c.show).toEqual(true); }); - it('clear hides cones.', function() { + it('clear removed primitives.', function() { var entityCollection = new EntityCollection(); visualizer = new ConeVisualizer(scene, entityCollection); @@ -218,8 +218,7 @@ defineSuite([ expect(scene.primitives.get(0).show).toEqual(true); entityCollection.removeAll(); visualizer.update(time); - expect(scene.primitives.length).toEqual(1); - expect(scene.primitives.get(0).show).toEqual(false); + expect(scene.primitives.length).toEqual(0); }); it('Visualizer sets entity property.', function() { diff --git a/Specs/DataSources/CzmlDataSourceSpec.js b/Specs/DataSources/CzmlDataSourceSpec.js index 6df8deb2e545..39472f4506cb 100644 --- a/Specs/DataSources/CzmlDataSourceSpec.js +++ b/Specs/DataSources/CzmlDataSourceSpec.js @@ -637,38 +637,17 @@ defineSuite([ maximumClockAngle : 1.3, radius : 2.0, show : true, + intersectionColor : { + rgbaf : [0.5, 0.5, 0.5, 0.5] + }, showIntersection : false, intersectionWidth : 6.0, - capMaterial : { + lateralSurfaceMaterial : { solidColor : { color : { rgbaf : [0.1, 0.1, 0.1, 0.1] } } - }, - innerMaterial : { - solidColor : { - color : { - rgbaf : [0.2, 0.2, 0.2, 0.2] - } - } - }, - outerMaterial : { - solidColor : { - color : { - rgbaf : [0.3, 0.3, 0.3, 0.3] - } - } - }, - silhouetteMaterial : { - solidColor : { - color : { - rgbaf : [0.4, 0.4, 0.4, 0.4] - } - } - }, - intersectionColor : { - rgbaf : [0.5, 0.5, 0.5, 0.5] } } }; @@ -685,12 +664,7 @@ defineSuite([ expect(entity.cone.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.radius); expect(entity.cone.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.show); expect(entity.cone.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.showIntersection); - expect(entity.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); - expect(entity.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); - expect(entity.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3)); - expect(entity.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4)); - expect(entity.cone.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5)); - expect(entity.cone.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.intersectionWidth); + expect(entity.cone.lateralSurfaceMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); }); it('CZML adds data for constrained cone.', function() { @@ -703,38 +677,17 @@ defineSuite([ maximumClockAngle : 1.3, radius : 2.0, show : true, + intersectionColor : { + rgbaf : [0.5, 0.5, 0.5, 0.5] + }, showIntersection : false, - intersectionWidth : 4.0, - capMaterial : { + intersectionWidth : 6.0, + lateralSurfaceMaterial : { solidColor : { color : { rgbaf : [0.1, 0.1, 0.1, 0.1] } } - }, - innerMaterial : { - solidColor : { - color : { - rgbaf : [0.2, 0.2, 0.2, 0.2] - } - } - }, - outerMaterial : { - solidColor : { - color : { - rgbaf : [0.3, 0.3, 0.3, 0.3] - } - } - }, - silhouetteMaterial : { - solidColor : { - color : { - rgbaf : [0.4, 0.4, 0.4, 0.4] - } - } - }, - intersectionColor : { - rgbaf : [0.5, 0.5, 0.5, 0.5] } } }; @@ -756,10 +709,7 @@ defineSuite([ expect(entity.cone.radius.getValue(validTime)).toEqual(conePacket.cone.radius); expect(entity.cone.show.getValue(validTime)).toEqual(conePacket.cone.show); expect(entity.cone.showIntersection.getValue(validTime)).toEqual(conePacket.cone.showIntersection); - expect(entity.cone.capMaterial.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); - expect(entity.cone.innerMaterial.getValue(validTime).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); - expect(entity.cone.outerMaterial.getValue(validTime).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3)); - expect(entity.cone.silhouetteMaterial.getValue(validTime).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4)); + expect(entity.cone.lateralSurfaceMaterial.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); expect(entity.cone.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5)); expect(entity.cone.intersectionWidth.getValue(validTime)).toEqual(conePacket.cone.intersectionWidth); @@ -770,10 +720,7 @@ defineSuite([ expect(entity.cone.radius.getValue(invalidTime)).toBeUndefined(); expect(entity.cone.show.getValue(invalidTime)).toBeUndefined(); expect(entity.cone.showIntersection.getValue(invalidTime)).toBeUndefined(); - expect(entity.cone.capMaterial.getValue(invalidTime)).toBeUndefined(); - expect(entity.cone.innerMaterial.getValue(invalidTime)).toBeUndefined(); - expect(entity.cone.outerMaterial.getValue(invalidTime)).toBeUndefined(); - expect(entity.cone.silhouetteMaterial.getValue(invalidTime)).toBeUndefined(); + expect(entity.cone.lateralSurfaceMaterial.getValue(invalidTime)).toBeUndefined(); expect(entity.cone.intersectionColor.getValue(invalidTime)).toBeUndefined(); expect(entity.cone.intersectionWidth.getValue(invalidTime)).toBeUndefined(); }); @@ -1679,17 +1626,17 @@ defineSuite([ }, radius : 2.0, show : true, + intersectionColor : { + rgbaf : [0.5, 0.5, 0.5, 0.5] + }, showIntersection : false, intersectionWidth : 7.0, - material : { + lateralSurfaceMaterial : { solidColor : { color : { rgbaf : [0.1, 0.1, 0.1, 0.1] } } - }, - intersectionColor : { - rgbaf : [0.5, 0.5, 0.5, 0.5] } } }; @@ -1703,7 +1650,7 @@ defineSuite([ expect(entity.pyramid.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.radius); expect(entity.pyramid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.show); expect(entity.pyramid.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.showIntersection); - expect(entity.pyramid.material.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); + expect(entity.pyramid.lateralSurfaceMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); expect(entity.pyramid.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5)); expect(entity.pyramid.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(7.0); }); @@ -1740,17 +1687,17 @@ defineSuite([ }, radius : 2.0, show : true, + intersectionColor : { + rgbaf : [0.5, 0.5, 0.5, 0.5] + }, showIntersection : false, intersectionWidth : 8.0, - material : { + lateralSurfaceMaterial : { solidColor : { color : { rgbaf : [0.1, 0.1, 0.1, 0.1] } } - }, - intersectionColor : { - rgbaf : [0.5, 0.5, 0.5, 0.5] } } }; @@ -1769,7 +1716,7 @@ defineSuite([ expect(entity.pyramid.radius.getValue(validTime)).toEqual(pyramidPacket.pyramid.radius); expect(entity.pyramid.show.getValue(validTime)).toEqual(pyramidPacket.pyramid.show); expect(entity.pyramid.showIntersection.getValue(validTime)).toEqual(pyramidPacket.pyramid.showIntersection); - expect(entity.pyramid.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); + expect(entity.pyramid.lateralSurfaceMaterial.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); expect(entity.pyramid.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5)); expect(entity.pyramid.intersectionWidth.getValue(validTime)).toEqual(8.0); @@ -1777,7 +1724,7 @@ defineSuite([ expect(entity.pyramid.radius.getValue(invalidTime)).toBeUndefined(); expect(entity.pyramid.show.getValue(invalidTime)).toBeUndefined(); expect(entity.pyramid.showIntersection.getValue(invalidTime)).toBeUndefined(); - expect(entity.pyramid.material.getValue(invalidTime)).toBeUndefined(); + expect(entity.pyramid.lateralSurfaceMaterial.getValue(invalidTime)).toBeUndefined(); expect(entity.pyramid.intersectionColor.getValue(invalidTime)).toBeUndefined(); expect(entity.pyramid.intersectionWidth.getValue(invalidTime)).toBeUndefined(); }); diff --git a/Specs/DataSources/PyramidGraphicsSpec.js b/Specs/DataSources/PyramidGraphicsSpec.js index 84ba333326d7..c657bea0c1f4 100644 --- a/Specs/DataSources/PyramidGraphicsSpec.js +++ b/Specs/DataSources/PyramidGraphicsSpec.js @@ -14,7 +14,7 @@ defineSuite([ it('merge assigns unassigned properties', function() { var source = new PyramidGraphics(); - source.material = new ColorMaterialProperty(); + source.lateralSurfaceMaterial = new ColorMaterialProperty(); source.directions = new ConstantProperty([]); source.intersectionColor = new ConstantProperty(Color.WHITE); source.radius = new ConstantProperty(1); @@ -25,7 +25,7 @@ defineSuite([ var target = new PyramidGraphics(); target.merge(source); - expect(target.material).toBe(source.material); + expect(target.lateralSurfaceMaterial).toBe(source.lateralSurfaceMaterial); expect(target.directions).toBe(source.directions); expect(target.intersectionColor).toBe(source.intersectionColor); expect(target.radius).toBe(source.radius); @@ -36,7 +36,7 @@ defineSuite([ it('merge does not assign assigned properties', function() { var source = new PyramidGraphics(); - source.material = new ColorMaterialProperty(); + source.lateralSurfaceMaterial = new ColorMaterialProperty(); source.directions = new ConstantProperty([]); source.intersectionColor = new ConstantProperty(Color.WHITE); source.radius = new ConstantProperty(1); @@ -44,7 +44,7 @@ defineSuite([ source.showIntersection = new ConstantProperty(true); source.intersectionWidth = new ConstantProperty(1); - var material = new ColorMaterialProperty(); + var lateralSurfaceMaterial = new ColorMaterialProperty(); var directions = new ConstantProperty([]); var intersectionColor = new ConstantProperty(Color.WHITE); var radius = new ConstantProperty(1); @@ -53,7 +53,7 @@ defineSuite([ var intersectionWidth = new ConstantProperty(1); var target = new PyramidGraphics(); - target.material = material; + target.lateralSurfaceMaterial = lateralSurfaceMaterial; target.directions = directions; target.intersectionColor = intersectionColor; target.radius = radius; @@ -63,7 +63,7 @@ defineSuite([ target.merge(source); - expect(target.material).toBe(material); + expect(target.lateralSurfaceMaterial).toBe(lateralSurfaceMaterial); expect(target.directions).toBe(directions); expect(target.intersectionColor).toBe(intersectionColor); expect(target.radius).toBe(radius); @@ -74,7 +74,7 @@ defineSuite([ it('clone works', function() { var source = new PyramidGraphics(); - source.material = new ColorMaterialProperty(); + source.lateralSurfaceMaterial = new ColorMaterialProperty(); source.directions = new ConstantProperty([]); source.intersectionColor = new ConstantProperty(Color.WHITE); source.radius = new ConstantProperty(1); @@ -83,7 +83,7 @@ defineSuite([ source.intersectionWidth = new ConstantProperty(1); var result = source.clone(); - expect(result.material).toBe(source.material); + expect(result.lateralSurfaceMaterial).toBe(source.lateralSurfaceMaterial); expect(result.directions).toBe(source.directions); expect(result.intersectionColor).toBe(source.intersectionColor); expect(result.radius).toBe(source.radius); diff --git a/Specs/DataSources/PyramidVisualizerSpec.js b/Specs/DataSources/PyramidVisualizerSpec.js index 6adbd7fb0d54..b66adc14868a 100644 --- a/Specs/DataSources/PyramidVisualizerSpec.js +++ b/Specs/DataSources/PyramidVisualizerSpec.js @@ -123,7 +123,7 @@ defineSuite([ pyramid.showIntersection = new ConstantProperty(true); pyramid.radius = new ConstantProperty(123.5); pyramid.show = new ConstantProperty(true); - pyramid.material = new ColorMaterialProperty(); + pyramid.lateralSurfaceMaterial = ColorMaterialProperty.fromColor(Color.WHITE); visualizer.update(time); expect(scene.primitives.length).toEqual(1); @@ -132,16 +132,16 @@ defineSuite([ expect(p.intersectionWidth).toEqual(testObject.pyramid.intersectionWidth.getValue(time)); expect(p.showIntersection).toEqual(testObject.pyramid.showIntersection.getValue(time)); expect(p.radius).toEqual(testObject.pyramid.radius.getValue(time)); - expect(p.show).toEqual(testObject.pyramid.show.getValue(time)); - expect(p.material.uniforms).toEqual(testObject.pyramid.material.getValue(time)); expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time)), testObject.position.getValue(time))); + expect(p.show).toEqual(testObject.pyramid.show.getValue(time)); + expect(p.lateralSurfaceMaterial.uniforms).toEqual(testObject.pyramid.lateralSurfaceMaterial.getValue(time)); pyramid.show.value = false; visualizer.update(time); expect(p.show).toEqual(testObject.pyramid.show.getValue(time)); }); - it('clear hides pyramids.', function() { + it('clear removes pyramids.', function() { var entityCollection = new EntityCollection(); visualizer = new PyramidVisualizer(scene, entityCollection); @@ -158,8 +158,7 @@ defineSuite([ expect(scene.primitives.get(0).show).toEqual(true); entityCollection.removeAll(); visualizer.update(time); - expect(scene.primitives.length).toEqual(1); - expect(scene.primitives.get(0).show).toEqual(false); + expect(scene.primitives.length).toEqual(0); }); it('Visualizer sets entity property.', function() {