diff --git a/Apps/Sandcastle/gallery/Shadows.html b/Apps/Sandcastle/gallery/Shadows.html index dfbfeb42a9a1..d0f56443c4f5 100644 --- a/Apps/Sandcastle/gallery/Shadows.html +++ b/Apps/Sandcastle/gallery/Shadows.html @@ -190,6 +190,14 @@ viewer.shadows = !viewer.shadows; }); +var entityShadows = true; +Sandcastle.addToolbarButton('Toggle Entity Shadows', function() { + entityShadows = !entityShadows; + for (i = 0; i < entitiesLength; ++i) { + entities[i].model.shadows = entityShadows; + } +}); + Sandcastle.addToolbarButton('Toggle Terrain Shadows', function() { viewer.terrainShadows = !viewer.terrainShadows; }); @@ -220,35 +228,6 @@ } }]); -function setShadows(castShadows, receiveShadows) { - for (i = 0; i < entitiesLength; ++i) { - entities[i].model.castShadows = castShadows; - entities[i].model.receiveShadows = receiveShadows; - } -} - -Sandcastle.addToolbarMenu([{ - text : 'Entity Shadows', - onselect : function() { - setShadows(true, true); - } -}, { - text : 'Cast Only', - onselect : function() { - setShadows(true, false); - } -}, { - text : 'Receive Only', - onselect : function() { - setShadows(false, true); - } -}, { - text : 'Off', - onselect : function() { - setShadows(false, false); - } -}]); - setLocation(locations.Exton); setEntity(cesiumAir); diff --git a/CHANGES.md b/CHANGES.md index 465e85390cc7..dfdb47209384 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ Change Log * Fix some large polygon triangulations. [#2788](https://github.com/AnalyticalGraphicsInc/cesium/issues/2788) * Improved performance and accuracy of polygon triangulation by using the [earcut](https://github.com/mapbox/earcut) library. Loading a GeoJSON with polygons for each country was 2x faster. * Added CZML support for Box, Corridor and Cylinder +* Added `shadows` property to the entity API for models, boxes, corridors, cylinders, ellipses, ellipsoids, polygons, polylines, polyline volumes, rectangles, and walls. [#4005](https://github.com/AnalyticalGraphicsInc/cesium/pull/4005) ### 1.22 - 2016-06-01 diff --git a/Source/DataSources/BoxGeometryUpdater.js b/Source/DataSources/BoxGeometryUpdater.js index 40bc2b9f4ce7..eb90fc7e5214 100644 --- a/Source/DataSources/BoxGeometryUpdater.js +++ b/Source/DataSources/BoxGeometryUpdater.js @@ -50,6 +50,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -90,6 +91,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'box', entity.box, undefined); } @@ -217,6 +219,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof BoxGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -436,6 +451,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(box.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(box.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(box.shadows, defaultShadows); var outlineWidth = box.outlineWidth; @@ -521,6 +537,8 @@ define([ options.dimensions = dimensions; + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (Property.getValueOrDefault(box.fill, time, true)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -539,7 +557,9 @@ define([ modelMatrix : modelMatrix }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -566,7 +586,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/BoxGraphics.js b/Source/DataSources/BoxGraphics.js index c2a7d11ed423..0315b170ff54 100644 --- a/Source/DataSources/BoxGraphics.js +++ b/Source/DataSources/BoxGraphics.js @@ -31,6 +31,7 @@ define([ * @param {Property} [options.outline=false] A boolean Property specifying whether the box is outlined. * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the box casts and receives shadows from each light source. * * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Box.html|Cesium Sandcastle Box Demo} */ @@ -49,6 +50,8 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -120,7 +123,16 @@ define([ * @type {Property} * @default 1.0 */ - outlineWidth : createPropertyDescriptor('outlineWidth') + outlineWidth : createPropertyDescriptor('outlineWidth'), + + /** + * Get or sets the boolean Property specifying whether the box + * casts and receives shadows from each light source. + * @memberof BoxGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -140,6 +152,7 @@ define([ result.outline = this.outline; result.outlineColor = this.outlineColor; result.outlineWidth = this.outlineWidth; + result.shadows = this.shadows; return result; }; @@ -163,6 +176,7 @@ define([ this.outline = defaultValue(this.outline, source.outline); this.outlineColor = defaultValue(this.outlineColor, source.outlineColor); this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); + this.shadows = defaultValue(this.shadows, source.shadows); }; return BoxGraphics; diff --git a/Source/DataSources/CorridorGeometryUpdater.js b/Source/DataSources/CorridorGeometryUpdater.js index 4897292bb902..c46d4910cc82 100644 --- a/Source/DataSources/CorridorGeometryUpdater.js +++ b/Source/DataSources/CorridorGeometryUpdater.js @@ -50,6 +50,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -96,6 +97,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'corridor', entity.corridor, undefined); } @@ -223,6 +225,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof CorridorGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -442,6 +457,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(corridor.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(corridor.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(corridor.shadows, defaultShadows); var height = corridor.height; var extrudedHeight = corridor.extrudedHeight; @@ -546,6 +562,8 @@ define([ options.granularity = Property.getValueOrUndefined(corridor.granularity, time); options.cornerType = Property.getValueOrUndefined(corridor.cornerType, time); + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (!defined(corridor.fill) || corridor.fill.getValue(time)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -563,7 +581,9 @@ define([ geometry : new CorridorGeometry(options) }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -589,7 +609,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/CorridorGraphics.js b/Source/DataSources/CorridorGraphics.js index e15ab9b6347a..e4795a6eac04 100644 --- a/Source/DataSources/CorridorGraphics.js +++ b/Source/DataSources/CorridorGraphics.js @@ -38,6 +38,7 @@ define([ * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the corridor casts and receives shadows from each light source. * * @see Entity * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo} @@ -67,6 +68,8 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -178,7 +181,16 @@ define([ * @type {Property} * @default CornerType.ROUNDED */ - cornerType : createPropertyDescriptor('cornerType') + cornerType : createPropertyDescriptor('cornerType'), + + /** + * Get or sets the boolean Property specifying whether the corridor + * casts and receives shadows from each light source. + * @memberof CorridorGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -203,6 +215,7 @@ define([ result.outlineColor = this.outlineColor; result.outlineWidth = this.outlineWidth; result.cornerType = this.cornerType; + result.shadows = this.shadows; return result; }; @@ -231,6 +244,7 @@ define([ this.outlineColor = defaultValue(this.outlineColor, source.outlineColor); this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); this.cornerType = defaultValue(this.cornerType, source.cornerType); + this.shadows = defaultValue(this.shadows, source.shadows); }; return CorridorGraphics; diff --git a/Source/DataSources/CylinderGeometryUpdater.js b/Source/DataSources/CylinderGeometryUpdater.js index bd5f7ba199f4..7d6deea9bb07 100644 --- a/Source/DataSources/CylinderGeometryUpdater.js +++ b/Source/DataSources/CylinderGeometryUpdater.js @@ -52,6 +52,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); @@ -97,6 +98,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'cylinder', entity.cylinder, undefined); } @@ -224,6 +226,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof CylinderGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -446,6 +461,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(cylinder.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(cylinder.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(cylinder.shadows, defaultShadows); var slices = cylinder.slices; var outlineWidth = cylinder.outlineWidth; @@ -547,6 +563,8 @@ define([ options.slices = Property.getValueOrUndefined(cylinder.slices, time); options.numberOfVerticalLines = Property.getValueOrUndefined(cylinder.numberOfVerticalLines, time); + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (Property.getValueOrDefault(cylinder.fill, time, true)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -565,7 +583,9 @@ define([ modelMatrix : modelMatrix }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -592,7 +612,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/CylinderGraphics.js b/Source/DataSources/CylinderGraphics.js index 8b8af756d82a..7c3f465a16a0 100644 --- a/Source/DataSources/CylinderGraphics.js +++ b/Source/DataSources/CylinderGraphics.js @@ -36,6 +36,7 @@ define([ * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. * @param {Property} [options.numberOfVerticalLines=16] A numeric Property specifying the number of vertical lines to draw along the perimeter for the outline. * @param {Property} [options.slices=128] The number of edges around perimeter of the cylinder. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the cylinder casts and receives shadows from each light source. * */ function CylinderGraphics(options) { @@ -61,6 +62,8 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -165,7 +168,16 @@ define([ * @type {Property} * @default 1.0 */ - outlineWidth : createPropertyDescriptor('outlineWidth') + outlineWidth : createPropertyDescriptor('outlineWidth'), + + /** + * Get or sets the boolean Property specifying whether the cylinder + * casts and receives shadows from each light source. + * @memberof CylinderGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -189,6 +201,7 @@ define([ result.outline = this.outline; result.outlineColor = this.outlineColor; result.outlineWidth = this.outlineWidth; + result.shadows = this.shadows; return result; }; @@ -216,6 +229,7 @@ define([ this.outline = defaultValue(this.outline, source.outline); this.outlineColor = defaultValue(this.outlineColor, source.outlineColor); this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); + this.shadows = defaultValue(this.shadows, source.shadows); }; return CylinderGraphics; diff --git a/Source/DataSources/CzmlDataSource.js b/Source/DataSources/CzmlDataSource.js index f09ae0f65a98..41c7528ff0f4 100644 --- a/Source/DataSources/CzmlDataSource.js +++ b/Source/DataSources/CzmlDataSource.js @@ -1059,6 +1059,7 @@ define([ processPacketData(Boolean, box, 'outline', boxData.outline, interval, sourceUri, entityCollection); processPacketData(Color, box, 'outlineColor', boxData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, box, 'outlineWidth', boxData.outlineWidth, interval, sourceUri, entityCollection); + processPacketData(Boolean, box, 'shadows', boxData.shadows, interval, sourceUri, entityCollection); } function processCylinder(entity, packet, entityCollection, sourceUri) { @@ -1088,6 +1089,7 @@ define([ processPacketData(Boolean, cylinder, 'outline', cylinderData.outline, interval, sourceUri, entityCollection); processPacketData(Color, cylinder, 'outlineColor', cylinderData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, cylinder, 'outlineWidth', cylinderData.outlineWidth, interval, sourceUri, entityCollection); + processPacketData(Boolean, cylinder, 'shadows', cylinderData.shadows, interval, sourceUri, entityCollection); } function processDocument(packet, dataSource) { @@ -1167,6 +1169,7 @@ define([ processPacketData(Color, ellipse, 'outlineColor', ellipseData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, ellipse, 'outlineWidth', ellipseData.outlineWidth, interval, sourceUri, entityCollection); processPacketData(Number, ellipse, 'numberOfVerticalLines', ellipseData.numberOfVerticalLines, interval, sourceUri, entityCollection); + processPacketData(Boolean, ellipse, 'shadows', ellipseData.shadows, interval, sourceUri, entityCollection); } function processEllipsoid(entity, packet, entityCollection, sourceUri) { @@ -1194,6 +1197,7 @@ define([ processPacketData(Boolean, ellipsoid, 'outline', ellipsoidData.outline, interval, sourceUri, entityCollection); processPacketData(Color, ellipsoid, 'outlineColor', ellipsoidData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, ellipsoid, 'outlineWidth', ellipsoidData.outlineWidth, interval, sourceUri, entityCollection); + processPacketData(Boolean, ellipsoid, 'shadows', ellipsoidData.shadows, interval, sourceUri, entityCollection); } function processLabel(entity, packet, entityCollection, sourceUri) { @@ -1250,8 +1254,7 @@ define([ processPacketData(Number, model, 'scale', modelData.scale, interval, sourceUri, entityCollection); processPacketData(Number, model, 'minimumPixelSize', modelData.minimumPixelSize, interval, sourceUri, entityCollection); processPacketData(Boolean, model, 'incrementallyLoadTextures', modelData.incrementallyLoadTextures, interval, sourceUri, entityCollection); - processPacketData(Boolean, model, 'castShadows', modelData.castShadows, interval, sourceUri, entityCollection); - processPacketData(Boolean, model, 'receiveShadows', modelData.receiveShadows, interval, sourceUri, entityCollection); + processPacketData(Boolean, model, 'shadows', modelData.shadows, interval, sourceUri, entityCollection); processPacketData(Uri, model, 'uri', modelData.gltf, interval, sourceUri, entityCollection); processPacketData(Boolean, model, 'runAnimations', modelData.runAnimations, interval, sourceUri, entityCollection); @@ -1396,6 +1399,7 @@ define([ processPacketData(Boolean, polygon, 'perPositionHeight', polygonData.perPositionHeight, interval, sourceUri, entityCollection); processPacketData(Boolean, polygon, 'closeTop', polygonData.closeTop, interval, sourceUri, entityCollection); processPacketData(Boolean, polygon, 'closeBottom', polygonData.closeBottom, interval, sourceUri, entityCollection); + processPacketData(Boolean, polygon, 'shadows', polygonData.shadows, interval, sourceUri, entityCollection); processPositions(polygon, 'hierarchy', polygonData.positions, entityCollection); } @@ -1431,6 +1435,7 @@ define([ processPacketData(Number, rectangle, 'outlineWidth', rectangleData.outlineWidth, interval, sourceUri, entityCollection); processPacketData(Boolean, rectangle, 'closeBottom', rectangleData.closeBottom, interval, sourceUri, entityCollection); processPacketData(Boolean, rectangle, 'closeTop', rectangleData.closeTop, interval, sourceUri, entityCollection); + processPacketData(Boolean, rectangle, 'shadows', rectangleData.shadows, interval, sourceUri, entityCollection); } function processCorridor(entity, packet, entityCollection, sourceUri) { @@ -1463,6 +1468,7 @@ define([ processPacketData(Boolean, corridor, 'outline', corridorData.outline, interval, sourceUri, entityCollection); processPacketData(Color, corridor, 'outlineColor', corridorData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, corridor, 'outlineWidth', corridorData.outlineWidth, interval, sourceUri, entityCollection); + processPacketData(Boolean, corridor, 'shadows', corridorData.shadows, interval, sourceUri, entityCollection); } function processWall(entity, packet, entityCollection, sourceUri) { @@ -1492,6 +1498,7 @@ define([ processPacketData(Boolean, wall, 'outline', wallData.outline, interval, sourceUri, entityCollection); processPacketData(Color, wall, 'outlineColor', wallData.outlineColor, interval, sourceUri, entityCollection); processPacketData(Number, wall, 'outlineWidth', wallData.outlineWidth, interval, sourceUri, entityCollection); + processPacketData(Boolean, wall, 'shadows', wallData.shadows, interval, sourceUri, entityCollection); processPositions(wall, 'positions', wallData.positions, entityCollection); } @@ -1518,6 +1525,7 @@ define([ processMaterialPacketData(polyline, 'material', polylineData.material, interval, sourceUri, entityCollection); processPacketData(Boolean, polyline, 'followSurface', polylineData.followSurface, interval, sourceUri, entityCollection); processPacketData(Number, polyline, 'granularity', polylineData.granularity, interval, sourceUri, entityCollection); + processPacketData(Boolean, polyline, 'shadows', polylineData.shadows, interval, sourceUri, entityCollection); processPositions(polyline, 'positions', polylineData.positions, entityCollection); } diff --git a/Source/DataSources/EllipseGeometryUpdater.js b/Source/DataSources/EllipseGeometryUpdater.js index 93f0c7fb2cf6..41fd5a14e184 100644 --- a/Source/DataSources/EllipseGeometryUpdater.js +++ b/Source/DataSources/EllipseGeometryUpdater.js @@ -50,6 +50,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -99,6 +100,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'ellipse', entity.ellipse, undefined); } @@ -226,6 +228,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof EllipseGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -447,6 +462,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(ellipse.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(ellipse.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(ellipse.shadows, defaultShadows); var rotation = ellipse.rotation; var height = ellipse.height; @@ -562,6 +578,8 @@ define([ options.stRotation = Property.getValueOrUndefined(ellipse.stRotation, time); options.numberOfVerticalLines = Property.getValueOrUndefined(ellipse.numberOfVerticalLines, time); + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (Property.getValueOrDefault(ellipse.fill, time, true)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -579,7 +597,9 @@ define([ geometry : new EllipseGeometry(options) }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -605,7 +625,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/EllipseGraphics.js b/Source/DataSources/EllipseGraphics.js index 10a365b2a1d4..18451c9ddc4e 100644 --- a/Source/DataSources/EllipseGraphics.js +++ b/Source/DataSources/EllipseGraphics.js @@ -41,6 +41,7 @@ define([ * @param {Property} [options.rotation=0.0] A numeric property specifying the rotation of the ellipse counter-clockwise from north. * @param {Property} [options.stRotation=0.0] A numeric property specifying the rotation of the ellipse texture counter-clockwise from north. * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the ellipse. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the ellipse casts and receives shadows from each light source. * * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Circles and Ellipses.html|Cesium Sandcastle Circles and Ellipses Demo} */ @@ -73,6 +74,8 @@ define([ this._outlineWidthSubscription = undefined; this._numberOfVerticalLines = undefined; this._numberOfVerticalLinesSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -200,7 +203,16 @@ define([ * @type {Property} * @default 16 */ - numberOfVerticalLines : createPropertyDescriptor('numberOfVerticalLines') + numberOfVerticalLines : createPropertyDescriptor('numberOfVerticalLines'), + + /** + * Get or sets the boolean Property specifying whether the ellipse + * casts and receives shadows from each light source. + * @memberof EllipseGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -227,6 +239,7 @@ define([ result.outlineColor = this.outlineColor; result.outlineWidth = this.outlineWidth; result.numberOfVerticalLines = this.numberOfVerticalLines; + result.shadows = this.shadows; return result; }; @@ -257,6 +270,7 @@ define([ this.outlineColor = defaultValue(this.outlineColor, source.outlineColor); this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); this.numberOfVerticalLines = defaultValue(this.numberOfVerticalLines, source.numberOfVerticalLines); + this.shadows = defaultValue(this.shadows, source.shadows); }; return EllipseGraphics; diff --git a/Source/DataSources/EllipsoidGeometryUpdater.js b/Source/DataSources/EllipsoidGeometryUpdater.js index 373c3f1ed7bc..600f503c2e6a 100644 --- a/Source/DataSources/EllipsoidGeometryUpdater.js +++ b/Source/DataSources/EllipsoidGeometryUpdater.js @@ -56,6 +56,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var radiiScratch = new Cartesian3(); var scratchColor = new Color(); @@ -102,6 +103,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'ellipsoid', entity.ellipsoid, undefined); } @@ -229,6 +231,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof EllipsoidGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -450,6 +465,8 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(ellipsoid.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(ellipsoid.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(ellipsoid.shadows, defaultShadows); + this._fillEnabled = fillEnabled; this._outlineEnabled = outlineEnabled; @@ -577,6 +594,9 @@ define([ var in3D = sceneMode === SceneMode.SCENE3D; var options = this._options; + + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + //We only rebuild the primitive if something other than the radii has changed //For the radii, we use unit sphere and then deform it with a scale matrix. var rebuildPrimitives = !in3D || this._lastSceneMode !== sceneMode || !defined(this._primitive) || // @@ -614,7 +634,9 @@ define([ } }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); options.vertexFormat = PerInstanceColorAppearance.VERTEX_FORMAT; @@ -636,7 +658,9 @@ define([ lineWidth : this._geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); this._lastShow = showFill; diff --git a/Source/DataSources/EllipsoidGraphics.js b/Source/DataSources/EllipsoidGraphics.js index 58f03b6f0b76..beadeb7ae277 100644 --- a/Source/DataSources/EllipsoidGraphics.js +++ b/Source/DataSources/EllipsoidGraphics.js @@ -34,6 +34,7 @@ define([ * @param {Property} [options.subdivisions=128] A Property specifying the number of samples per outline ring, determining the granularity of the curvature. * @param {Property} [options.stackPartitions=64] A Property specifying the number of stacks. * @param {Property} [options.slicePartitions=64] A Property specifying the number of radial slices. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the ellipsoid casts and receives shadows from each light source. * * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Spheres%20and%20Ellipsoids.html|Cesium Sandcastle Spheres and Ellipsoids Demo} */ @@ -58,6 +59,7 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -154,7 +156,16 @@ define([ * @type {Property} * @default 128 */ - subdivisions : createPropertyDescriptor('subdivisions') + subdivisions : createPropertyDescriptor('subdivisions'), + + /** + * Get or sets the boolean Property specifying whether the ellipsoid + * casts and receives shadows from each light source. + * @memberof EllipsoidGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -177,6 +188,7 @@ define([ result.stackPartitions = this.stackPartitions; result.slicePartitions = this.slicePartitions; result.subdivisions = this.subdivisions; + result.shadows = this.shadows; return result; }; @@ -204,6 +216,7 @@ define([ this.stackPartitions = defaultValue(this.stackPartitions, source.stackPartitions); this.slicePartitions = defaultValue(this.slicePartitions, source.slicePartitions); this.subdivisions = defaultValue(this.subdivisions, source.subdivisions); + this.shadows = defaultValue(this.shadows, source.shadows); }; return EllipsoidGraphics; diff --git a/Source/DataSources/GeometryVisualizer.js b/Source/DataSources/GeometryVisualizer.js index 51985159a58c..40e3ade01420 100644 --- a/Source/DataSources/GeometryVisualizer.js +++ b/Source/DataSources/GeometryVisualizer.js @@ -81,22 +81,47 @@ define([ return; } + var shadows = false; + if (updater.outlineEnabled || updater.fillEnabled) { + shadows = updater.shadowsProperty.getValue(time); + } + if (updater.outlineEnabled) { - that._outlineBatch.add(time, updater); + if (shadows) { + that._shadowsOutlineBatch.add(time, updater); + } else { + that._outlineBatch.add(time, updater); + } } if (updater.fillEnabled) { if (updater.isClosed) { if (updater.fillMaterialProperty instanceof ColorMaterialProperty) { - that._closedColorBatch.add(time, updater); + if (shadows) { + that._shadowsClosedColorBatch.add(time, updater); + } else { + that._closedColorBatch.add(time, updater); + } } else { - that._closedMaterialBatch.add(time, updater); + if (shadows) { + that._shadowsClosedMaterialBatch.add(time, updater); + } else { + that._closedMaterialBatch.add(time, updater); + } } } else { if (updater.fillMaterialProperty instanceof ColorMaterialProperty) { - that._openColorBatch.add(time, updater); + if (shadows) { + that._shadowsOpenColorBatch.add(time, updater); + } else { + that._openColorBatch.add(time, updater); + } } else { - that._openMaterialBatch.add(time, updater); + if (shadows) { + that._shadowsOpenMaterialBatch.add(time, updater); + } else { + that._openMaterialBatch.add(time, updater); + } } } } @@ -134,13 +159,20 @@ define([ this._removedObjects = new AssociativeArray(); this._changedObjects = new AssociativeArray(); - this._outlineBatch = new StaticOutlineGeometryBatch(primitives, scene); - this._closedColorBatch = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, true); - this._closedMaterialBatch = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, true); - this._openColorBatch = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, false); - this._openMaterialBatch = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, false); + this._outlineBatch = new StaticOutlineGeometryBatch(primitives, scene, false); + this._closedColorBatch = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, true, false); + this._closedMaterialBatch = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, true, false); + this._openColorBatch = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, false, false); + this._openMaterialBatch = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, false, false); + this._shadowsOutlineBatch = new StaticOutlineGeometryBatch(primitives, scene, true); + this._shadowsClosedColorBatch = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, true, true); + this._shadowsClosedMaterialBatch = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, true, true); + this._shadowsOpenColorBatch = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, false, true); + this._shadowsOpenMaterialBatch = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, false, true); + this._dynamicBatch = new DynamicGeometryBatch(primitives); - this._batches = [this._closedColorBatch, this._closedMaterialBatch, this._openColorBatch, this._openMaterialBatch, this._dynamicBatch, this._outlineBatch]; + this._batches = [this._dynamicBatch, this._outlineBatch, this._closedColorBatch, this._closedMaterialBatch, this._openColorBatch, this._openMaterialBatch, + this._shadowsOutlineBatch, this._shadowsClosedColorBatch, this._shadowsClosedMaterialBatch, this._shadowsOpenColorBatch, this._shadowsOpenMaterialBatch]; this._subscriptions = new AssociativeArray(); this._updaters = new AssociativeArray(); diff --git a/Source/DataSources/ModelGraphics.js b/Source/DataSources/ModelGraphics.js index 5b6051586b36..e940761db341 100644 --- a/Source/DataSources/ModelGraphics.js +++ b/Source/DataSources/ModelGraphics.js @@ -45,8 +45,7 @@ define([ * @param {Property} [options.minimumPixelSize=0.0] A numeric Property specifying the approximate minimum pixel size of the model regardless of zoom. * @param {Property} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize. * @param {Property} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded. - * @param {Property} [options.castShadows=true] A boolean Property specifying whether the model casts shadows from each light source. - * @param {Property} [options.receiveShadows=true] A boolean Property specifying whether the model receives shadows from shadow casters in the scene. + * @param {Property} [options.shadows=true] A boolean Property specifying whether the model casts and receives shadows from each light source. * @param {Property} [options.runAnimations=true] A boolean Property specifying if glTF animations specified in the model should be started. * @param {Property} [options.nodeTransformations] An object, where keys are names of nodes, and values are {@link TranslationRotationScale} Properties describing the transformation to apply to that node. * @@ -64,10 +63,8 @@ define([ this._maximumScaleSubscription = undefined; this._incrementallyLoadTextures = undefined; this._incrementallyLoadTexturesSubscription = undefined; - this._castShadows = undefined; - this._castShadowsSubscription = undefined; - this._receiveShadows = undefined; - this._receiveShadowsSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._uri = undefined; this._uriSubscription = undefined; this._runAnimations = undefined; @@ -140,19 +137,12 @@ define([ /** * Get or sets the boolean Property specifying whether the model - * casts shadows from each light source. - * @memberof ModelGraphics.prototype - * @type {Property} - */ - castShadows : createPropertyDescriptor('castShadows'), - - /** - * Get or sets the boolean Property specifying whether the model - * receives shadows from shadow casters in the scene. + * casts and receives shadows from each light source. * @memberof ModelGraphics.prototype * @type {Property} + * @default true */ - receiveShadows : createPropertyDescriptor('receiveShadows'), + shadows : createPropertyDescriptor('shadows'), /** * Gets or sets the string Property specifying the URI of the glTF asset. @@ -193,8 +183,7 @@ define([ result.minimumPixelSize = this.minimumPixelSize; result.maximumScale = this.maximumScale; result.incrementallyLoadTextures = this.incrementallyLoadTextures; - result.castShadows = this.castShadows; - result.receiveShadows = this.receiveShadows; + result.shadows = this.shadows; result.uri = this.uri; result.runAnimations = this.runAnimations; result.nodeTransformations = this.nodeTransformations; @@ -220,8 +209,7 @@ define([ this.minimumPixelSize = defaultValue(this.minimumPixelSize, source.minimumPixelSize); this.maximumScale = defaultValue(this.maximumScale, source.maximumScale); this.incrementallyLoadTextures = defaultValue(this.incrementallyLoadTextures, source.incrementallyLoadTextures); - this.castShadows = defaultValue(this.castShadows, source.castShadows); - this.receiveShadows = defaultValue(this.receiveShadows, source.receiveShadows); + this.shadows = defaultValue(this.shadows, source.shadows); this.uri = defaultValue(this.uri, source.uri); this.runAnimations = defaultValue(this.runAnimations, source.runAnimations); diff --git a/Source/DataSources/ModelVisualizer.js b/Source/DataSources/ModelVisualizer.js index ed4ce430e360..7e757490c528 100644 --- a/Source/DataSources/ModelVisualizer.js +++ b/Source/DataSources/ModelVisualizer.js @@ -26,8 +26,7 @@ define([ var defaultScale = 1.0; var defaultMinimumPixelSize = 0.0; var defaultIncrementallyLoadTextures = true; - var defaultCastShadows = true; - var defaultReceiveShadows = true; + var defaultShadows = true; var modelMatrixScratch = new Matrix4(); var nodeMatrixScratch = new Matrix4(); @@ -126,12 +125,14 @@ define([ modelHash[entity.id] = modelData; } + var shadows = Property.getValueOrDefault(modelGraphics._shadows, time, defaultShadows); + model.show = true; model.scale = Property.getValueOrDefault(modelGraphics._scale, time, defaultScale); model.minimumPixelSize = Property.getValueOrDefault(modelGraphics._minimumPixelSize, time, defaultMinimumPixelSize); model.maximumScale = Property.getValueOrUndefined(modelGraphics._maximumScale, time); - model.castShadows = Property.getValueOrDefault(modelGraphics._castShadows, time, defaultCastShadows); - model.receiveShadows = Property.getValueOrDefault(modelGraphics._receiveShadows, time, defaultReceiveShadows); + model.castShadows = shadows; + model.receiveShadows = shadows; model.modelMatrix = Matrix4.clone(modelMatrix, model.modelMatrix); if (model.ready) { diff --git a/Source/DataSources/PolygonGeometryUpdater.js b/Source/DataSources/PolygonGeometryUpdater.js index 8bb71ebcb9bf..30b80ec23c96 100644 --- a/Source/DataSources/PolygonGeometryUpdater.js +++ b/Source/DataSources/PolygonGeometryUpdater.js @@ -54,6 +54,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -102,6 +103,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'polygon', entity.polygon, undefined); } @@ -229,6 +231,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof PolygonGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -448,6 +463,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(polygon.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(polygon.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(polygon.shadows, defaultShadows); var height = polygon.height; var extrudedHeight = polygon.extrudedHeight; @@ -579,6 +595,8 @@ define([ options.closeTop = closeTopValue; options.closeBottom = closeBottomValue; + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (Property.getValueOrDefault(polygon.fill, time, true)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -596,7 +614,8 @@ define([ geometry : new PolygonGeometry(options) }), appearance : appearance, - asynchronous : false + asynchronous : false, + shadows : shadows })); } @@ -622,7 +641,8 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + shadows : shadows })); } }; diff --git a/Source/DataSources/PolygonGraphics.js b/Source/DataSources/PolygonGraphics.js index bf0e6f6562d9..6a4ab794e7ee 100644 --- a/Source/DataSources/PolygonGraphics.js +++ b/Source/DataSources/PolygonGraphics.js @@ -40,6 +40,7 @@ define([ * @param {Property} [options.perPositionHeight=false] A boolean specifying whether or not the the height of each position is used. * @param {Boolean} [options.closeTop=true] When false, leaves off the top of an extruded polygon open. * @param {Boolean} [options.closeBottom=true] When false, leaves off the bottom of an extruded polygon open. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the polygon casts and receives shadows from each light source. * * @see Entity * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polygon.html|Cesium Sandcastle Polygon Demo} @@ -74,6 +75,8 @@ define([ this._closeTopSubscription = undefined; this._closeBottom = undefined; this._closeBottomSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); } @@ -201,7 +204,16 @@ define([ * @memberof PolygonGraphics.prototype * @type {Property} */ - closeBottom : createPropertyDescriptor('closeBottom') + closeBottom : createPropertyDescriptor('closeBottom'), + + /** + * Get or sets the boolean Property specifying whether the polygon + * casts and receives shadows from each light source. + * @memberof PolygonGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -228,6 +240,7 @@ define([ result.perPositionHeight = this.perPositionHeight; result.closeTop = this.closeTop; result.closeBottom = this.closeBottom; + result.shadows = this.shadows; return result; }; @@ -258,6 +271,7 @@ define([ this.perPositionHeight = defaultValue(this.perPositionHeight, source.perPositionHeight); this.closeTop = defaultValue(this.closeTop, source.closeTop); this.closeBottom = defaultValue(this.closeBottom, source.closeBottom); + this.shadows = defaultValue(this.shadows, source.shadows); }; return PolygonGraphics; diff --git a/Source/DataSources/PolylineGeometryUpdater.js b/Source/DataSources/PolylineGeometryUpdater.js index 0f6e1c499912..60e05eda98db 100644 --- a/Source/DataSources/PolylineGeometryUpdater.js +++ b/Source/DataSources/PolylineGeometryUpdater.js @@ -54,6 +54,7 @@ define([ var defaultMaterial = new ColorMaterialProperty(Color.WHITE); var defaultShow = new ConstantProperty(true); + var defaultShadows = new ConstantProperty(false); function GeometryOptions(entity) { this.id = entity; @@ -91,6 +92,7 @@ define([ this._geometryChanged = new Event(); this._showProperty = undefined; this._materialProperty = undefined; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'polyline', entity.polyline, undefined); } @@ -193,6 +195,19 @@ define([ outlineColorProperty : { value : undefined }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof PolylineGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -202,6 +217,7 @@ define([ * @type {Boolean} * @readonly */ + isDynamic : { get : function() { return this._dynamic; @@ -366,6 +382,7 @@ define([ var isColorMaterial = material instanceof ColorMaterialProperty; this._materialProperty = material; this._showProperty = defaultValue(show, defaultShow); + this._shadowsProperty = defaultValue(polyline.shadows, defaultShadows); this._fillEnabled = true; var width = polyline.width; diff --git a/Source/DataSources/PolylineGraphics.js b/Source/DataSources/PolylineGraphics.js index a4bc4922ea7b..bdde28e20e06 100644 --- a/Source/DataSources/PolylineGraphics.js +++ b/Source/DataSources/PolylineGraphics.js @@ -32,6 +32,7 @@ define([ * @param {Property} [options.show=true] A boolean Property specifying the visibility of the polyline. * @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to draw the polyline. * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude if followSurface is true. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the polyline casts and receives shadows from each light source. * * @see Entity * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polyline.html|Cesium Sandcastle Polyline Demo} @@ -50,6 +51,8 @@ define([ this._widthSubscription = undefined; this._width = undefined; this._widthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -116,7 +119,16 @@ define([ * @type {Property} * @default Cesium.Math.RADIANS_PER_DEGREE */ - granularity : createPropertyDescriptor('granularity') + granularity : createPropertyDescriptor('granularity'), + + /** + * Get or sets the boolean Property specifying whether the polyline + * casts and receives shadows from each light source. + * @memberof PolylineGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -135,6 +147,7 @@ define([ result.width = this.width; result.followSurface = this.followSurface; result.granularity = this.granularity; + result.shadows = this.shadows; return result; }; @@ -157,6 +170,7 @@ define([ this.width = defaultValue(this.width, source.width); this.followSurface = defaultValue(this.followSurface, source.followSurface); this.granularity = defaultValue(this.granularity, source.granularity); + this.shadows = defaultValue(this.shadows, source.shadows); }; return PolylineGraphics; diff --git a/Source/DataSources/PolylineVolumeGeometryUpdater.js b/Source/DataSources/PolylineVolumeGeometryUpdater.js index 525b036f53a8..2acbcd8ef80f 100644 --- a/Source/DataSources/PolylineVolumeGeometryUpdater.js +++ b/Source/DataSources/PolylineVolumeGeometryUpdater.js @@ -50,6 +50,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -93,6 +94,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'polylineVolume', entity.polylineVolume, undefined); } @@ -220,6 +222,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts shadows from each light source. + * @memberof PolylineVolumeGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -437,6 +452,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(polylineVolume.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(polylineVolume.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(polylineVolume.shadows, defaultShadows); var granularity = polylineVolume.granularity; var outlineWidth = polylineVolume.outlineWidth; @@ -531,6 +547,8 @@ define([ options.granularity = Property.getValueOrUndefined(polylineVolume.granularity, time); options.cornerType = Property.getValueOrUndefined(polylineVolume.cornerType, time); + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (!defined(polylineVolume.fill) || polylineVolume.fill.getValue(time)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -548,7 +566,9 @@ define([ geometry : new PolylineVolumeGeometry(options) }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -574,7 +594,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/PolylineVolumeGraphics.js b/Source/DataSources/PolylineVolumeGraphics.js index acf3be4bc9a5..a3cb3b7c1119 100644 --- a/Source/DataSources/PolylineVolumeGraphics.js +++ b/Source/DataSources/PolylineVolumeGraphics.js @@ -35,6 +35,7 @@ define([ * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the volume casts and receives shadows from each light source. * * @see Entity * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polyline%20Volume.html|Cesium Sandcastle Polyline Volume Demo} @@ -60,6 +61,8 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -155,7 +158,16 @@ define([ * @type {Property} * @default CornerType.ROUNDED */ - cornerType : createPropertyDescriptor('cornerType') + cornerType : createPropertyDescriptor('cornerType'), + + /** + * Get or sets the boolean Property specifying whether the volume + * casts and receives shadows from each light source. + * @memberof PolylineVolumeGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -178,6 +190,7 @@ define([ result.outlineColor = this.outlineColor; result.outlineWidth = this.outlineWidth; result.cornerType = this.cornerType; + result.shadows = this.shadows; return result; }; @@ -204,6 +217,7 @@ define([ this.outlineColor = defaultValue(this.outlineColor, source.outlineColor); this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); this.cornerType = defaultValue(this.cornerType, source.cornerType); + this.shadows = defaultValue(this.shadows, source.shadows); }; return PolylineVolumeGraphics; diff --git a/Source/DataSources/RectangleGeometryUpdater.js b/Source/DataSources/RectangleGeometryUpdater.js index d6bbdc4ee469..af8679618908 100644 --- a/Source/DataSources/RectangleGeometryUpdater.js +++ b/Source/DataSources/RectangleGeometryUpdater.js @@ -50,6 +50,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -98,6 +99,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'rectangle', entity.rectangle, undefined); } @@ -225,6 +227,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof RectangleGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -444,6 +459,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(rectangle.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(rectangle.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(rectangle.shadows, defaultShadows); var height = rectangle.height; var extrudedHeight = rectangle.extrudedHeight; @@ -555,6 +571,8 @@ define([ options.closeBottom = Property.getValueOrUndefined(rectangle.closeBottom, time); options.closeTop = Property.getValueOrUndefined(rectangle.closeTop, time); + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (Property.getValueOrDefault(rectangle.fill, time, true)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -572,7 +590,9 @@ define([ geometry : new RectangleGeometry(options) }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -598,7 +618,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/RectangleGraphics.js b/Source/DataSources/RectangleGraphics.js index 124bd9da6f38..9198f62902f3 100644 --- a/Source/DataSources/RectangleGraphics.js +++ b/Source/DataSources/RectangleGraphics.js @@ -40,6 +40,7 @@ define([ * @param {Property} [options.rotation=0.0] A numeric property specifying the rotation of the rectangle clockwise from north. * @param {Property} [options.stRotation=0.0] A numeric property specifying the rotation of the rectangle texture counter-clockwise from north. * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the rectangle. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the rectangle casts and receives shadows from each light source. * * @see Entity * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Rectangle.html|Cesium Sandcastle Rectangle Demo} @@ -73,6 +74,8 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -201,7 +204,16 @@ define([ * @type {Property} * @default true */ - closeBottom : createPropertyDescriptor('closeBottom') + closeBottom : createPropertyDescriptor('closeBottom'), + + /** + * Get or sets the boolean Property specifying whether the rectangle + * casts and receives shadows from each light source. + * @memberof RectangleGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -228,6 +240,7 @@ define([ result.outlineWidth = this.outlineWidth; result.closeTop = this.closeTop; result.closeBottom = this.closeBottom; + result.shadows = this.shadows; return result; }; @@ -258,6 +271,7 @@ define([ this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); this.closeTop = defaultValue(this.closeTop, source.closeTop); this.closeBottom = defaultValue(this.closeBottom, source.closeBottom); + this.shadows = defaultValue(this.shadows, source.shadows); }; return RectangleGraphics; diff --git a/Source/DataSources/StaticGeometryColorBatch.js b/Source/DataSources/StaticGeometryColorBatch.js index 6e6583e575e3..fba9c203e829 100644 --- a/Source/DataSources/StaticGeometryColorBatch.js +++ b/Source/DataSources/StaticGeometryColorBatch.js @@ -19,10 +19,11 @@ define([ var colorScratch = new Color(); - function Batch(primitives, translucent, appearanceType, closed) { + function Batch(primitives, translucent, appearanceType, closed, shadows) { this.translucent = translucent; this.appearanceType = appearanceType; this.closed = closed; + this.shadows = shadows; this.primitives = primitives; this.createPrimitive = false; this.waitingOnCreate = false; @@ -107,7 +108,9 @@ define([ appearance : new this.appearanceType({ translucent : this.translucent, closed : this.closed - }) + }), + castShadows : this.shadows, + receiveShadows : this.shadows }); primitives.add(primitive); isUpdated = false; @@ -234,9 +237,9 @@ define([ /** * @private */ - function StaticGeometryColorBatch(primitives, appearanceType, closed) { - this._solidBatch = new Batch(primitives, false, appearanceType, closed); - this._translucentBatch = new Batch(primitives, true, appearanceType, closed); + function StaticGeometryColorBatch(primitives, appearanceType, closed, shadows) { + this._solidBatch = new Batch(primitives, false, appearanceType, closed, shadows); + this._translucentBatch = new Batch(primitives, true, appearanceType, closed, shadows); } StaticGeometryColorBatch.prototype.add = function(time, updater) { var instance = updater.createFillGeometryInstance(time); diff --git a/Source/DataSources/StaticGeometryPerMaterialBatch.js b/Source/DataSources/StaticGeometryPerMaterialBatch.js index 869d18e78eff..c66090e3db59 100644 --- a/Source/DataSources/StaticGeometryPerMaterialBatch.js +++ b/Source/DataSources/StaticGeometryPerMaterialBatch.js @@ -15,11 +15,12 @@ define([ MaterialProperty) { 'use strict'; - function Batch(primitives, appearanceType, materialProperty, closed) { + function Batch(primitives, appearanceType, materialProperty, closed, shadows) { this.primitives = primitives; this.appearanceType = appearanceType; this.materialProperty = materialProperty; this.closed = closed; + this.shadows = shadows; this.updaters = new AssociativeArray(); this.createPrimitive = true; this.primitive = undefined; @@ -125,7 +126,9 @@ define([ material : this.material, translucent : this.material.isTranslucent(), closed : this.closed - }) + }), + castShadows : this.shadows, + receiveShadows : this.shadows }); primitives.add(primitive); @@ -238,11 +241,12 @@ define([ /** * @private */ - function StaticGeometryPerMaterialBatch(primitives, appearanceType, closed) { + function StaticGeometryPerMaterialBatch(primitives, appearanceType, closed, shadows) { this._items = []; this._primitives = primitives; this._appearanceType = appearanceType; this._closed = closed; + this._shadows = shadows; } StaticGeometryPerMaterialBatch.prototype.add = function(time, updater) { var items = this._items; @@ -254,7 +258,7 @@ define([ return; } } - var batch = new Batch(this._primitives, this._appearanceType, updater.fillMaterialProperty, this._closed); + var batch = new Batch(this._primitives, this._appearanceType, updater.fillMaterialProperty, this._closed, this._shadows); batch.add(time, updater); items.push(batch); }; diff --git a/Source/DataSources/StaticOutlineGeometryBatch.js b/Source/DataSources/StaticOutlineGeometryBatch.js index fbeff43dff86..fedde93635e1 100644 --- a/Source/DataSources/StaticOutlineGeometryBatch.js +++ b/Source/DataSources/StaticOutlineGeometryBatch.js @@ -19,8 +19,10 @@ define([ BoundingSphereState) { 'use strict'; - function Batch(primitives, translucent, width) { + function Batch(primitives, translucent, width, shadows) { this.translucent = translucent; + this.width = width; + this.shadows = shadows; this.primitives = primitives; this.createPrimitive = false; this.waitingOnCreate = false; @@ -31,7 +33,6 @@ define([ this.updatersWithAttributes = new AssociativeArray(); this.attributes = new AssociativeArray(); this.itemsToRemove = []; - this.width = width; this.subscriptions = new AssociativeArray(); this.showsUpdated = new AssociativeArray(); } @@ -110,7 +111,9 @@ define([ renderState : { lineWidth : this.width } - }) + }), + castShadows : this.shadows, + receiveShadows : this.shadows }); primitives.add(primitive); @@ -240,9 +243,10 @@ define([ /** * @private */ - function StaticOutlineGeometryBatch(primitives, scene) { + function StaticOutlineGeometryBatch(primitives, scene, shadows) { this._primitives = primitives; this._scene = scene; + this._shadows = shadows; this._solidBatches = new AssociativeArray(); this._translucentBatches = new AssociativeArray(); } @@ -255,7 +259,7 @@ define([ batches = this._solidBatches; batch = batches.get(width); if (!defined(batch)) { - batch = new Batch(this._primitives, false, width); + batch = new Batch(this._primitives, false, width, this._shadows); batches.set(width, batch); } batch.add(updater, instance); @@ -263,7 +267,7 @@ define([ batches = this._translucentBatches; batch = batches.get(width); if (!defined(batch)) { - batch = new Batch(this._primitives, true, width); + batch = new Batch(this._primitives, true, width, this._shadows); batches.set(width, batch); } batch.add(updater, instance); diff --git a/Source/DataSources/WallGeometryUpdater.js b/Source/DataSources/WallGeometryUpdater.js index e1dbb2eff1d0..c309059118a8 100644 --- a/Source/DataSources/WallGeometryUpdater.js +++ b/Source/DataSources/WallGeometryUpdater.js @@ -50,6 +50,7 @@ define([ var defaultFill = new ConstantProperty(true); var defaultOutline = new ConstantProperty(false); var defaultOutlineColor = new ConstantProperty(Color.BLACK); + var defaultShadows = new ConstantProperty(false); var scratchColor = new Color(); function GeometryOptions(entity) { @@ -93,6 +94,7 @@ define([ this._showOutlineProperty = undefined; this._outlineColorProperty = undefined; this._outlineWidth = 1.0; + this._shadowsProperty = undefined; this._options = new GeometryOptions(entity); this._onEntityPropertyChanged(entity, 'wall', entity.wall, undefined); } @@ -220,6 +222,19 @@ define([ return this._outlineWidth; } }, + /** + * Gets the boolean property specifying whether the geometry + * casts and receives shadows from each light source. + * @memberof WallGeometryUpdater.prototype + * + * @type {Property} + * @readonly + */ + shadowsProperty : { + get : function() { + return this._shadowsProperty; + } + }, /** * Gets a value indicating if the geometry is time-varying. * If true, all visualization is delegated to the {@link DynamicGeometryUpdater} @@ -439,6 +454,7 @@ define([ this._showProperty = defaultValue(show, defaultShow); this._showOutlineProperty = defaultValue(wall.outline, defaultOutline); this._outlineColorProperty = outlineEnabled ? defaultValue(wall.outlineColor, defaultOutlineColor) : undefined; + this._shadowsProperty = defaultValue(wall.shadows, defaultShadows); var minimumHeights = wall.minimumHeights; var maximumHeights = wall.maximumHeights; @@ -533,6 +549,8 @@ define([ options.maximumHeights = Property.getValueOrUndefined(wall.maximumHeights, time, options.maximumHeights); options.granularity = Property.getValueOrUndefined(wall.granularity, time); + var shadows = this._geometryUpdater.shadowsProperty.getValue(time); + if (Property.getValueOrDefault(wall.fill, time, true)) { var material = MaterialProperty.getValue(time, geometryUpdater.fillMaterialProperty, this._material); this._material = material; @@ -550,7 +568,9 @@ define([ geometry : new WallGeometry(options) }), appearance : appearance, - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } @@ -576,7 +596,9 @@ define([ lineWidth : geometryUpdater._scene.clampLineWidth(outlineWidth) } }), - asynchronous : false + asynchronous : false, + castShadows : shadows, + receiveShadows : shadows })); } }; diff --git a/Source/DataSources/WallGraphics.js b/Source/DataSources/WallGraphics.js index 3bac99635c44..b75fd1c02fac 100644 --- a/Source/DataSources/WallGraphics.js +++ b/Source/DataSources/WallGraphics.js @@ -35,6 +35,7 @@ define([ * @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline. * @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline. * @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude point. + * @param {Property} [options.shadows=false] A boolean Property specifying whether the wall casts and receives shadows from each light source. * * @see Entity * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Wall.html|Cesium Sandcastle Wall Demo} @@ -60,6 +61,8 @@ define([ this._outlineColorSubscription = undefined; this._outlineWidth = undefined; this._outlineWidthSubscription = undefined; + this._shadows = undefined; + this._shadowsSubscription = undefined; this._definitionChanged = new Event(); this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); @@ -156,7 +159,16 @@ define([ * @type {Property} * @default 1.0 */ - outlineWidth : createPropertyDescriptor('outlineWidth') + outlineWidth : createPropertyDescriptor('outlineWidth'), + + /** + * Get or sets the boolean Property specifying whether the wall + * casts and receives shadows from each light source. + * @memberof WallGraphics.prototype + * @type {Property} + * @default false + */ + shadows : createPropertyDescriptor('shadows') }); /** @@ -179,6 +191,7 @@ define([ result.outline = this.outline; result.outlineColor = this.outlineColor; result.outlineWidth = this.outlineWidth; + result.shadows = this.shadows; return result; }; @@ -205,6 +218,7 @@ define([ this.outline = defaultValue(this.outline, source.outline); this.outlineColor = defaultValue(this.outlineColor, source.outlineColor); this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth); + this.shadows = defaultValue(this.shadows, source.shadows); }; return WallGraphics; diff --git a/Specs/DataSources/BoxGeometryUpdaterSpec.js b/Specs/DataSources/BoxGeometryUpdaterSpec.js index 315b8c7422fe..024408343e1a 100644 --- a/Specs/DataSources/BoxGeometryUpdaterSpec.js +++ b/Specs/DataSources/BoxGeometryUpdaterSpec.js @@ -78,6 +78,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -118,6 +119,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/BoxGraphicsSpec.js b/Specs/DataSources/BoxGraphicsSpec.js index fd2ee1d65449..e092f3f0cd68 100644 --- a/Specs/DataSources/BoxGraphicsSpec.js +++ b/Specs/DataSources/BoxGraphicsSpec.js @@ -25,7 +25,8 @@ defineSuite([ outline : false, outlineColor : Color.RED, outlineWidth : 1, - dimensions : new Cartesian3(2, 3, 4) + dimensions : new Cartesian3(2, 3, 4), + shadows : false }; var box = new BoxGraphics(options); @@ -36,6 +37,7 @@ defineSuite([ expect(box.outlineColor).toBeInstanceOf(ConstantProperty); expect(box.outlineWidth).toBeInstanceOf(ConstantProperty); expect(box.dimensions).toBeInstanceOf(ConstantProperty); + expect(box.shadows).toBeInstanceOf(ConstantProperty); expect(box.material.color.getValue()).toEqual(options.material); expect(box.show.getValue()).toEqual(options.show); @@ -44,6 +46,7 @@ defineSuite([ expect(box.outlineColor.getValue()).toEqual(options.outlineColor); expect(box.outlineWidth.getValue()).toEqual(options.outlineWidth); expect(box.dimensions.getValue()).toEqual(options.dimensions); + expect(box.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -55,6 +58,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.dimensions = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new BoxGraphics(); target.merge(source); @@ -66,6 +70,7 @@ defineSuite([ expect(target.outlineColor).toBe(source.outlineColor); expect(target.outlineWidth).toBe(source.outlineWidth); expect(target.dimensions).toBe(source.dimensions); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -78,6 +83,7 @@ defineSuite([ var outlineColor = new ConstantProperty(); var outlineWidth = new ConstantProperty(); var dimensions = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new BoxGraphics(); target.material = material; @@ -87,6 +93,7 @@ defineSuite([ target.outlineColor = outlineColor; target.outlineWidth = outlineWidth; target.dimensions = dimensions; + target.shadows = shadows; target.merge(source); @@ -97,6 +104,7 @@ defineSuite([ expect(target.outlineColor).toBe(outlineColor); expect(target.outlineWidth).toBe(outlineWidth); expect(target.dimensions).toBe(dimensions); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -108,6 +116,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.dimensions = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -117,6 +126,7 @@ defineSuite([ expect(result.outlineColor).toBe(source.outlineColor); expect(result.outlineWidth).toBe(source.outlineWidth); expect(result.dimensions).toBe(source.dimensions); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -135,5 +145,6 @@ defineSuite([ testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'dimensions', new Cartesian3(0, 0, 0), new Cartesian3(1, 1, 1)); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/CorridorGeometryUpdaterSpec.js b/Specs/DataSources/CorridorGeometryUpdaterSpec.js index 44de7bc37f39..677bb8c53f5f 100644 --- a/Specs/DataSources/CorridorGeometryUpdaterSpec.js +++ b/Specs/DataSources/CorridorGeometryUpdaterSpec.js @@ -87,6 +87,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -127,6 +128,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/CorridorGraphicsSpec.js b/Specs/DataSources/CorridorGraphicsSpec.js index 7092b6a3900c..db5fa2d26d21 100644 --- a/Specs/DataSources/CorridorGraphicsSpec.js +++ b/Specs/DataSources/CorridorGraphicsSpec.js @@ -30,7 +30,8 @@ defineSuite([ outline : false, outlineColor : Color.RED, outlineWidth : 5, - cornerType : CornerType.BEVELED + cornerType : CornerType.BEVELED, + shadows : false }; var corridor = new CorridorGraphics(options); @@ -46,6 +47,7 @@ defineSuite([ expect(corridor.outlineColor).toBeInstanceOf(ConstantProperty); expect(corridor.outlineWidth).toBeInstanceOf(ConstantProperty); expect(corridor.cornerType).toBeInstanceOf(ConstantProperty); + expect(corridor.shadows).toBeInstanceOf(ConstantProperty); expect(corridor.material.color.getValue()).toEqual(options.material); expect(corridor.positions.getValue()).toEqual(options.positions); @@ -59,6 +61,7 @@ defineSuite([ expect(corridor.outlineColor.getValue()).toEqual(options.outlineColor); expect(corridor.outlineWidth.getValue()).toEqual(options.outlineWidth); expect(corridor.cornerType.getValue()).toEqual(options.cornerType); + expect(corridor.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -75,6 +78,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.cornerType = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new CorridorGraphics(); target.merge(source); @@ -91,6 +95,7 @@ defineSuite([ expect(target.outlineColor).toBe(source.outlineColor); expect(target.outlineWidth).toBe(source.outlineWidth); expect(target.cornerType).toBe(source.cornerType); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -108,6 +113,7 @@ defineSuite([ var outlineColor = new ConstantProperty(); var outlineWidth = new ConstantProperty(); var cornerType = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new CorridorGraphics(); target.material = material; @@ -122,6 +128,7 @@ defineSuite([ target.outlineColor = outlineColor; target.outlineWidth = outlineWidth; target.cornerType = cornerType; + target.shadows = shadows; target.merge(source); @@ -137,6 +144,7 @@ defineSuite([ expect(target.outlineColor).toBe(outlineColor); expect(target.outlineWidth).toBe(outlineWidth); expect(target.cornerType).toBe(cornerType); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -153,6 +161,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.cornerType = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -167,6 +176,7 @@ defineSuite([ expect(result.outlineColor).toBe(source.outlineColor); expect(result.outlineWidth).toBe(source.outlineWidth); expect(result.cornerType).toBe(source.cornerType); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -190,5 +200,6 @@ defineSuite([ testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'cornerType', CornerType.BEVELED, CornerType.MITERED); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/CylinderGeometryUpdaterSpec.js b/Specs/DataSources/CylinderGeometryUpdaterSpec.js index b023798d2915..2589279d90bd 100644 --- a/Specs/DataSources/CylinderGeometryUpdaterSpec.js +++ b/Specs/DataSources/CylinderGeometryUpdaterSpec.js @@ -85,6 +85,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -145,6 +146,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/CylinderGraphicsSpec.js b/Specs/DataSources/CylinderGraphicsSpec.js index 698e7b16f2e3..fb991b36b10c 100644 --- a/Specs/DataSources/CylinderGraphicsSpec.js +++ b/Specs/DataSources/CylinderGraphicsSpec.js @@ -27,7 +27,8 @@ defineSuite([ fill : false, outline : false, outlineColor : Color.RED, - outlineWidth : 6 + outlineWidth : 6, + shadows : false }; var cylinder = new CylinderGraphics(options); @@ -42,6 +43,7 @@ defineSuite([ expect(cylinder.outline).toBeInstanceOf(ConstantProperty); expect(cylinder.outlineColor).toBeInstanceOf(ConstantProperty); expect(cylinder.outlineWidth).toBeInstanceOf(ConstantProperty); + expect(cylinder.shadows).toBeInstanceOf(ConstantProperty); expect(cylinder.material.color.getValue()).toEqual(options.material); expect(cylinder.show.getValue()).toEqual(options.show); @@ -54,6 +56,7 @@ defineSuite([ expect(cylinder.outline.getValue()).toEqual(options.outline); expect(cylinder.outlineColor.getValue()).toEqual(options.outlineColor); expect(cylinder.outlineWidth.getValue()).toEqual(options.outlineWidth); + expect(cylinder.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -68,6 +71,7 @@ defineSuite([ source.outline = new ConstantProperty(); source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new CylinderGraphics(); target.merge(source); @@ -82,6 +86,7 @@ defineSuite([ expect(target.outline).toBe(source.outline); expect(target.outlineColor).toBe(source.outlineColor); expect(target.outlineWidth).toBe(source.outlineWidth); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -97,6 +102,7 @@ defineSuite([ var outline = new ConstantProperty(); var outlineColor = new ConstantProperty(); var outlineWidth = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new CylinderGraphics(); target.material = material; @@ -109,6 +115,7 @@ defineSuite([ target.outline = outline; target.outlineColor = outlineColor; target.outlineWidth = outlineWidth; + target.shadows = shadows; target.merge(source); @@ -122,6 +129,7 @@ defineSuite([ expect(target.outline).toBe(outline); expect(target.outlineColor).toBe(outlineColor); expect(target.outlineWidth).toBe(outlineWidth); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -136,6 +144,7 @@ defineSuite([ source.outline = new ConstantProperty(); source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -148,6 +157,7 @@ defineSuite([ expect(result.outline).toBe(source.outline); expect(result.outlineColor).toBe(source.outlineColor); expect(result.outlineWidth).toBe(source.outlineWidth); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -169,5 +179,6 @@ defineSuite([ testDefinitionChanged(property, 'outline', true, false); testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/CzmlDataSourceSpec.js b/Specs/DataSources/CzmlDataSourceSpec.js index dca7deef4c7e..01ab1d560709 100644 --- a/Specs/DataSources/CzmlDataSourceSpec.js +++ b/Specs/DataSources/CzmlDataSourceSpec.js @@ -772,7 +772,8 @@ defineSuite([ outlineColor : { rgbaf : [0.2, 0.2, 0.2, 0.2] }, - outlineWidth : 6 + outlineWidth : 6, + shadows : true, } }; @@ -787,6 +788,7 @@ defineSuite([ expect(entity.ellipse.outline.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); expect(entity.ellipse.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); expect(entity.ellipse.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6); + expect(entity.ellipse.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); }); it('CZML adds data for constrained ellipse.', function() { @@ -795,7 +797,8 @@ defineSuite([ interval : '2000-01-01/2001-01-01', semiMajorAxis : 10, semiMinorAxis : 20, - rotation : 1.0 + rotation : 1.0, + shadows : true } }; @@ -812,10 +815,12 @@ defineSuite([ expect(entity.ellipse.semiMajorAxis.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.semiMajorAxis); expect(entity.ellipse.semiMinorAxis.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.semiMinorAxis); expect(entity.ellipse.rotation.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.rotation); + expect(entity.ellipse.shadows.getValue(validTime)).toEqual(true); expect(entity.ellipse.semiMajorAxis.getValue(invalidTime)).toBeUndefined(); expect(entity.ellipse.semiMinorAxis.getValue(invalidTime)).toBeUndefined(); expect(entity.ellipse.rotation.getValue(invalidTime)).toBeUndefined(); + expect(entity.ellipse.shadows.getValue(invalidTime)).toBeUndefined(); }); it('CZML adds data for infinite ellipsoid.', function() { @@ -838,7 +843,8 @@ defineSuite([ outlineColor : { rgbaf : [0.2, 0.2, 0.2, 0.2] }, - outlineWidth : 6 + outlineWidth : 6, + shadows : true } }; @@ -853,6 +859,7 @@ defineSuite([ expect(entity.ellipsoid.outline.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); expect(entity.ellipsoid.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); expect(entity.ellipsoid.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6); + expect(entity.ellipsoid.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); }); it('CZML adds data for constrained ellipsoid.', function() { @@ -871,7 +878,8 @@ defineSuite([ rgbaf : [0.1, 0.1, 0.1, 0.1] } } - } + }, + shadows : true } }; @@ -888,10 +896,12 @@ defineSuite([ expect(entity.ellipsoid.radii.getValue(validTime)).toEqual(expectedRadii); expect(entity.ellipsoid.show.getValue(validTime)).toEqual(ellipsoidPacketInterval.ellipsoid.show); expect(entity.ellipsoid.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); + expect(entity.ellipsoid.shadows.getValue(validTime)).toEqual(true); expect(entity.ellipsoid.radii.getValue(invalidTime)).toBeUndefined(); expect(entity.ellipsoid.show.getValue(invalidTime)).toBeUndefined(); expect(entity.ellipsoid.material.getValue(invalidTime)).toBeUndefined(); + expect(entity.ellipsoid.shadows.getValue(invalidTime)).toBeUndefined(); }); it('CZML adds data for infinite label.', function() { @@ -1407,7 +1417,8 @@ defineSuite([ }, outlineWidth : 6, closeTop : false, - closeBottom : false + closeBottom : false, + shadows : true } }; @@ -1427,6 +1438,7 @@ defineSuite([ expect(entity.polygon.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6); expect(entity.polygon.closeTop.getValue(Iso8601.MINIMUM_VALUE)).toEqual(false); expect(entity.polygon.closeBottom.getValue(Iso8601.MINIMUM_VALUE)).toEqual(false); + expect(entity.polygon.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); }); it('CZML adds data for constrained polygon.', function() { @@ -1440,7 +1452,8 @@ defineSuite([ } } }, - show : true + show : true, + shadows : true } }; @@ -1456,9 +1469,12 @@ defineSuite([ expect(entity.polygon).toBeDefined(); expect(entity.polygon.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1)); expect(entity.polygon.show.getValue(validTime)).toEqual(true); + expect(entity.polygon.shadows.getValue(validTime)).toEqual(true); expect(entity.polygon.material.getValue(invalidTime)).toBeUndefined(); expect(entity.polygon.show.getValue(invalidTime)).toBeUndefined(); + expect(entity.polygon.shadows.getValue(invalidTime)).toBeUndefined(); + }); it('CZML adds data for infinite polyline.', function() { @@ -1476,7 +1492,8 @@ defineSuite([ } }, width : 1.0, - show : true + show : true, + shadows : true } }; @@ -1490,6 +1507,7 @@ defineSuite([ expect(entity.polyline.material.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); expect(entity.polyline.material.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(1.0); expect(entity.polyline.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); + expect(entity.polyline.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); }); it('CZML adds data for constrained polyline.', function() { @@ -1508,7 +1526,8 @@ defineSuite([ } }, width : 1.0, - show : true + show : true, + shadows : true } }; @@ -1527,10 +1546,13 @@ defineSuite([ expect(entity.polyline.material.getValue(validTime).outlineColor).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); expect(entity.polyline.material.getValue(validTime).outlineWidth).toEqual(1.0); expect(entity.polyline.show.getValue(validTime)).toEqual(true); + expect(entity.polyline.shadows.getValue(validTime)).toEqual(true); expect(entity.polyline.material.getValue(invalidTime)).toBeUndefined(); expect(entity.polyline.width.getValue(invalidTime)).toBeUndefined(); expect(entity.polyline.show.getValue(invalidTime)).toBeUndefined(); + expect(entity.polyline.shadows.getValue(invalidTime)).toBeUndefined(); + }); it('CZML adds data for infinite model.', function() { @@ -1541,8 +1563,7 @@ defineSuite([ minimumPixelSize : 5.0, gltf : './Data/Models/Box/CesiumBoxTest.gltf', incrementallyLoadTextures : true, - castShadows : true, - receiveShadows : true, + shadows : true, nodeTransformations : { Mesh : { scale : { @@ -1569,8 +1590,7 @@ defineSuite([ expect(entity.model.minimumPixelSize.getValue(Iso8601.MINIMUM_VALUE)).toEqual(5.0); expect(entity.model.uri.getValue(Iso8601.MINIMUM_VALUE)).toEqual('./Data/Models/Box/CesiumBoxTest.gltf'); expect(entity.model.incrementallyLoadTextures.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); - expect(entity.model.castShadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); - expect(entity.model.receiveShadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); + expect(entity.model.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); var nodeTransform = entity.model.nodeTransformations.getValue(Iso8601.MINIMUM_VALUE).Mesh; expect(nodeTransform).toBeDefined(); @@ -1595,8 +1615,7 @@ defineSuite([ minimumPixelSize : 5.0, gltf : './Data/Models/Box/CesiumBoxTest.gltf', incrementallyLoadTextures : true, - castShadows : true, - receiveShadows : true, + shadows : true, nodeTransformations : { Mesh : { scale : { @@ -1628,8 +1647,7 @@ defineSuite([ expect(entity.model.minimumPixelSize.getValue(validTime)).toEqual(5.0); expect(entity.model.uri.getValue(validTime)).toEqual('./Data/Models/Box/CesiumBoxTest.gltf'); expect(entity.model.incrementallyLoadTextures.getValue(validTime)).toEqual(true); - expect(entity.model.castShadows.getValue(validTime)).toEqual(true); - expect(entity.model.receiveShadows.getValue(validTime)).toEqual(true); + expect(entity.model.shadows.getValue(validTime)).toEqual(true); var nodeTransform = entity.model.nodeTransformations.getValue(validTime).Mesh; expect(nodeTransform).toBeDefined(); @@ -1649,8 +1667,7 @@ defineSuite([ expect(entity.model.minimumPixelSize.getValue(invalidTime)).toBeUndefined(); expect(entity.model.uri.getValue(invalidTime)).toBeUndefined(); expect(entity.model.incrementallyLoadTextures.getValue(invalidTime)).toBeUndefined(); - expect(entity.model.castShadows.getValue(invalidTime)).toBeUndefined(); - expect(entity.model.receiveShadows.getValue(invalidTime)).toBeUndefined(); + expect(entity.model.shadows.getValue(invalidTime)).toBeUndefined(); expect(entity.model.nodeTransformations.Mesh.getValue(invalidTime)).toEqual(new TranslationRotationScale()); expect(entity.model.nodeTransformations.Mesh.scale.getValue(invalidTime)).toBeUndefined(); @@ -1870,7 +1887,8 @@ defineSuite([ outlineColor : { rgbaf : [0.2, 0.2, 0.2, 0.2] }, - outlineWidth : 6 + outlineWidth : 6, + shadows : true } }; @@ -1894,6 +1912,7 @@ defineSuite([ expect(entity.rectangle.outline.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); expect(entity.rectangle.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); expect(entity.rectangle.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6); + expect(entity.rectangle.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); }); it('CZML adds data for rectangle in degrees.', function() { @@ -1933,7 +1952,8 @@ defineSuite([ outlineColor : { rgbaf : [0.2, 0.2, 0.2, 0.2] }, - outlineWidth : 6 + outlineWidth : 6, + shadows : true } }; @@ -1952,6 +1972,7 @@ defineSuite([ expect(entity.wall.outline.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); expect(entity.wall.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2)); expect(entity.wall.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6); + expect(entity.wall.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true); }); it('CZML adds data for box.', function() { diff --git a/Specs/DataSources/EllipseGeometryUpdaterSpec.js b/Specs/DataSources/EllipseGeometryUpdaterSpec.js index e4528e0cd78e..0ed6e1d8b2d7 100644 --- a/Specs/DataSources/EllipseGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipseGeometryUpdaterSpec.js @@ -85,6 +85,7 @@ defineSuite([ expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); + expect(updater.shadowsProperty).toBe(undefined); updater.destroy(); expect(updater.isDestroyed()).toBe(true); }); @@ -143,6 +144,7 @@ defineSuite([ expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); expect(updater.isDynamic).toBe(false); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); }); it('Ellipse material is correctly exposed.', function() { diff --git a/Specs/DataSources/EllipseGraphicsSpec.js b/Specs/DataSources/EllipseGraphicsSpec.js index 7dba5c335213..7a1e259037b1 100644 --- a/Specs/DataSources/EllipseGraphicsSpec.js +++ b/Specs/DataSources/EllipseGraphicsSpec.js @@ -30,7 +30,8 @@ defineSuite([ fill : false, outline : false, outlineColor : Color.RED, - outlineWidth : 9 + outlineWidth : 9, + shadows : false }; var ellipse = new EllipseGraphics(options); @@ -48,6 +49,7 @@ defineSuite([ expect(ellipse.outline).toBeInstanceOf(ConstantProperty); expect(ellipse.outlineColor).toBeInstanceOf(ConstantProperty); expect(ellipse.outlineWidth).toBeInstanceOf(ConstantProperty); + expect(ellipse.shadows).toBeInstanceOf(ConstantProperty); expect(ellipse.material.color.getValue()).toEqual(options.material); expect(ellipse.show.getValue()).toEqual(options.show); @@ -63,6 +65,7 @@ defineSuite([ expect(ellipse.outline.getValue()).toEqual(options.outline); expect(ellipse.outlineColor.getValue()).toEqual(options.outlineColor); expect(ellipse.outlineWidth.getValue()).toEqual(options.outlineWidth); + expect(ellipse.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -81,6 +84,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.numberOfVerticalLines = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new EllipseGraphics(); target.merge(source); @@ -99,6 +103,7 @@ defineSuite([ expect(target.outlineColor).toBe(source.outlineColor); expect(target.outlineWidth).toBe(source.outlineWidth); expect(target.numberOfVerticalLines).toBe(source.numberOfVerticalLines); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -118,6 +123,7 @@ defineSuite([ var outlineColor = new ConstantProperty(); var outlineWidth = new ConstantProperty(); var numberOfVerticalLines = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new EllipseGraphics(); target.material = material; @@ -134,6 +140,7 @@ defineSuite([ target.outlineColor = outlineColor; target.outlineWidth = outlineWidth; target.numberOfVerticalLines = numberOfVerticalLines; + target.shadows = shadows; target.merge(source); @@ -151,6 +158,7 @@ defineSuite([ expect(target.outlineColor).toBe(outlineColor); expect(target.outlineWidth).toBe(outlineWidth); expect(target.numberOfVerticalLines).toBe(numberOfVerticalLines); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -169,6 +177,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.numberOfVerticalLines = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -185,6 +194,7 @@ defineSuite([ expect(result.outlineColor).toBe(source.outlineColor); expect(result.outlineWidth).toBe(source.outlineWidth); expect(result.numberOfVerticalLines).toBe(source.numberOfVerticalLines); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -210,5 +220,6 @@ defineSuite([ testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'numberOfVerticalLines', 16, 32); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js b/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js index 080fb029a537..666df7df8f31 100644 --- a/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js @@ -82,6 +82,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -131,6 +132,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/EllipsoidGraphicsSpec.js b/Specs/DataSources/EllipsoidGraphicsSpec.js index 9e26bab8e4a0..0c6bcffca4b0 100644 --- a/Specs/DataSources/EllipsoidGraphicsSpec.js +++ b/Specs/DataSources/EllipsoidGraphicsSpec.js @@ -27,7 +27,8 @@ defineSuite([ fill : false, outline : false, outlineColor : Color.RED, - outlineWidth : 4 + outlineWidth : 4, + shadows : false }; var ellipsoid = new EllipsoidGraphics(options); @@ -40,6 +41,7 @@ defineSuite([ expect(ellipsoid.outline).toBeInstanceOf(ConstantProperty); expect(ellipsoid.outlineColor).toBeInstanceOf(ConstantProperty); expect(ellipsoid.outlineWidth).toBeInstanceOf(ConstantProperty); + expect(ellipsoid.shadows).toBeInstanceOf(ConstantProperty); expect(ellipsoid.material.color.getValue()).toEqual(options.material); expect(ellipsoid.show.getValue()).toEqual(options.show); @@ -50,6 +52,7 @@ defineSuite([ expect(ellipsoid.outline.getValue()).toEqual(options.outline); expect(ellipsoid.outlineColor.getValue()).toEqual(options.outlineColor); expect(ellipsoid.outlineWidth.getValue()).toEqual(options.outlineWidth); + expect(ellipsoid.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -64,6 +67,7 @@ defineSuite([ source.outline = new ConstantProperty(); source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new EllipsoidGraphics(); target.merge(source); @@ -78,6 +82,7 @@ defineSuite([ expect(target.outline).toBe(source.outline); expect(target.outlineColor).toBe(source.outlineColor); expect(target.outlineWidth).toBe(source.outlineWidth); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -93,6 +98,7 @@ defineSuite([ var outline = new ConstantProperty(); var outlineColor = new ConstantProperty(); var outlineWidth = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new EllipsoidGraphics(); target.material = material; @@ -101,6 +107,8 @@ defineSuite([ target.stackPartitions = stackPartitions; target.slicePartitions = slicePartitions; target.subdivisions = subdivisions; + target.shadows = shadows; + source.fill = fill; source.outline = outline; source.outlineColor = outlineColor; @@ -118,6 +126,7 @@ defineSuite([ expect(target.outline).toBe(outline); expect(target.outlineColor).toBe(outlineColor); expect(target.outlineWidth).toBe(outlineWidth); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -132,6 +141,7 @@ defineSuite([ source.outline = new ConstantProperty(); source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -144,6 +154,7 @@ defineSuite([ expect(result.outline).toBe(source.outline); expect(result.outlineColor).toBe(source.outlineColor); expect(result.outlineWidth).toBe(source.outlineWidth); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -165,5 +176,6 @@ defineSuite([ testDefinitionChanged(property, 'outline', true, false); testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/GeometryVisualizerSpec.js b/Specs/DataSources/GeometryVisualizerSpec.js index 0904204213f9..dd4f8d3357cb 100644 --- a/Specs/DataSources/GeometryVisualizerSpec.js +++ b/Specs/DataSources/GeometryVisualizerSpec.js @@ -280,6 +280,49 @@ defineSuite([ }); }); + function createAndRemoveGeometryWithShadows(shadows) { + var objects = new EntityCollection(); + var visualizer = new GeometryVisualizer(EllipseGeometryUpdater, scene, objects); + + var ellipse = new EllipseGraphics(); + ellipse.semiMajorAxis = new ConstantProperty(2); + ellipse.semiMinorAxis = new ConstantProperty(1); + ellipse.material = new ColorMaterialProperty(); + ellipse.shadows = new ConstantProperty(shadows); + + var entity = new Entity(); + entity.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112)); + entity.ellipse = ellipse; + objects.add(entity); + + return pollToPromise(function() { + scene.initializeFrame(); + var isUpdated = visualizer.update(time); + scene.render(time); + return isUpdated; + }).then(function() { + var primitive = scene.primitives.get(0); + expect(primitive.castShadows).toBe(shadows); + expect(primitive.receiveShadows).toBe(shadows); + + objects.remove(entity); + + return pollToPromise(function() { + scene.initializeFrame(); + expect(visualizer.update(time)).toBe(true); + scene.render(time); + return scene.primitives.length === 0; + }).then(function(){ + visualizer.destroy(); + }); + }); + } + + it('Creates and removes geometry with shadows', function() { + createAndRemoveGeometryWithShadows(true); + createAndRemoveGeometryWithShadows(false); + }); + it('Correctly handles geometry changing batches', function() { var objects = new EntityCollection(); var visualizer = new GeometryVisualizer(EllipseGeometryUpdater, scene, objects); @@ -697,7 +740,7 @@ defineSuite([ }); }); - it('Sets static geometry primitive show attribute when using dynamic fill color', function() { + it('Sets static geometry primitive show attribute when using dynamic fill color', function() { var entities = new EntityCollection(); var visualizer = new GeometryVisualizer(EllipseGeometryUpdater, scene, entities); @@ -740,7 +783,7 @@ defineSuite([ }); }); - it('Sets static geometry primitive show attribute when using dynamic outline color', function() { + it('Sets static geometry primitive show attribute when using dynamic outline color', function() { var entities = new EntityCollection(); var visualizer = new GeometryVisualizer(EllipseGeometryUpdater, scene, entities); diff --git a/Specs/DataSources/ModelGraphicsSpec.js b/Specs/DataSources/ModelGraphicsSpec.js index c7a2d6378e7f..a470092cdb67 100644 --- a/Specs/DataSources/ModelGraphicsSpec.js +++ b/Specs/DataSources/ModelGraphicsSpec.js @@ -25,8 +25,7 @@ defineSuite([ minimumPixelSize : 2, maximumScale : 200, incrementallyLoadTextures : false, - castShadows : false, - receiveShadows : false, + shadows : false, runAnimations : false, nodeTransformations : { node1 : { @@ -44,8 +43,7 @@ defineSuite([ expect(model.minimumPixelSize).toBeInstanceOf(ConstantProperty); expect(model.maximumScale).toBeInstanceOf(ConstantProperty); expect(model.incrementallyLoadTextures).toBeInstanceOf(ConstantProperty); - expect(model.castShadows).toBeInstanceOf(ConstantProperty); - expect(model.receiveShadows).toBeInstanceOf(ConstantProperty); + expect(model.shadows).toBeInstanceOf(ConstantProperty); expect(model.runAnimations).toBeInstanceOf(ConstantProperty); expect(model.nodeTransformations).toBeInstanceOf(PropertyBag); @@ -56,8 +54,7 @@ defineSuite([ expect(model.minimumPixelSize.getValue()).toEqual(options.minimumPixelSize); expect(model.maximumScale.getValue()).toEqual(options.maximumScale); expect(model.incrementallyLoadTextures.getValue()).toEqual(options.incrementallyLoadTextures); - expect(model.castShadows.getValue()).toEqual(options.castShadows); - expect(model.receiveShadows.getValue()).toEqual(options.receiveShadows); + expect(model.shadows.getValue()).toEqual(options.shadows); expect(model.runAnimations.getValue()).toEqual(options.runAnimations); var actualNodeTransformations = model.nodeTransformations.getValue(new JulianDate()); @@ -77,8 +74,7 @@ defineSuite([ source.minimumPixelSize = new ConstantProperty(2.0); source.maximumScale = new ConstantProperty(200.0); source.incrementallyLoadTextures = new ConstantProperty(true); - source.castShadows = new ConstantProperty(true); - source.receiveShadows = new ConstantProperty(true); + source.shadows = new ConstantProperty(true); source.runAnimations = new ConstantProperty(true); source.nodeTransformations = { node1 : new NodeTransformationProperty({ @@ -100,8 +96,7 @@ defineSuite([ expect(target.minimumPixelSize).toBe(source.minimumPixelSize); expect(target.maximumScale).toBe(source.maximumScale); expect(target.incrementallyLoadTextures).toBe(source.incrementallyLoadTextures); - expect(target.castShadows).toBe(source.castShadows); - expect(target.receiveShadows).toBe(source.receiveShadows); + expect(target.shadows).toBe(source.shadows); expect(target.runAnimations).toBe(source.runAnimations); expect(target.nodeTransformations).toEqual(source.nodeTransformations); }); @@ -114,8 +109,7 @@ defineSuite([ source.minimumPixelSize = new ConstantProperty(2.0); source.maximumScale = new ConstantProperty(200.0); source.incrementallyLoadTextures = new ConstantProperty(true); - source.castShadows = new ConstantProperty(true); - source.receiveShadows = new ConstantProperty(true); + source.shadows = new ConstantProperty(true); source.runAnimations = new ConstantProperty(true); source.nodeTransformations = { transform : new NodeTransformationProperty() @@ -127,8 +121,7 @@ defineSuite([ var minimumPixelSize = new ConstantProperty(2.0); var maximumScale = new ConstantProperty(200.0); var incrementallyLoadTextures = new ConstantProperty(true); - var castShadows = new ConstantProperty(true); - var receiveShadows = new ConstantProperty(true); + var shadows = new ConstantProperty(true); var runAnimations = new ConstantProperty(true); var nodeTransformations = new PropertyBag({ transform : new NodeTransformationProperty() @@ -141,8 +134,7 @@ defineSuite([ target.minimumPixelSize = minimumPixelSize; target.maximumScale = maximumScale; target.incrementallyLoadTextures = incrementallyLoadTextures; - target.castShadows = castShadows; - target.receiveShadows = receiveShadows; + target.shadows = shadows; target.runAnimations = runAnimations; target.nodeTransformations = nodeTransformations; @@ -154,8 +146,7 @@ defineSuite([ expect(target.minimumPixelSize).toBe(minimumPixelSize); expect(target.maximumScale).toBe(maximumScale); expect(target.incrementallyLoadTextures).toBe(incrementallyLoadTextures); - expect(target.castShadows).toBe(castShadows); - expect(target.receiveShadows).toBe(receiveShadows); + expect(target.shadows).toBe(shadows); expect(target.runAnimations).toBe(runAnimations); expect(target.nodeTransformations).toBe(nodeTransformations); }); @@ -168,8 +159,7 @@ defineSuite([ source.minimumPixelSize = new ConstantProperty(2.0); source.maximumScale = new ConstantProperty(200.0); source.incrementallyLoadTextures = new ConstantProperty(true); - source.castShadows = new ConstantProperty(true); - source.receiveShadows = new ConstantProperty(true); + source.shadows = new ConstantProperty(true); source.runAnimations = new ConstantProperty(true); source.nodeTransformations = { node1 : new NodeTransformationProperty(), @@ -183,8 +173,7 @@ defineSuite([ expect(result.minimumPixelSize).toBe(source.minimumPixelSize); expect(result.maximumScale).toBe(source.maximumScale); expect(result.incrementallyLoadTextures).toBe(source.incrementallyLoadTextures); - expect(result.castShadows).toBe(source.castShadows); - expect(result.receiveShadows).toBe(source.receiveShadows); + expect(result.shadows).toBe(source.shadows); expect(result.runAnimations).toBe(source.runAnimations); expect(result.nodeTransformations).toEqual(source.nodeTransformations); }); diff --git a/Specs/DataSources/PolygonGeometryUpdaterSpec.js b/Specs/DataSources/PolygonGeometryUpdaterSpec.js index 0bf7cace26c5..7980ddbc7926 100644 --- a/Specs/DataSources/PolygonGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolygonGeometryUpdaterSpec.js @@ -86,6 +86,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -126,6 +127,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/PolygonGraphicsSpec.js b/Specs/DataSources/PolygonGraphicsSpec.js index 1e6632fe2199..63bc6864fedf 100644 --- a/Specs/DataSources/PolygonGraphicsSpec.js +++ b/Specs/DataSources/PolygonGraphicsSpec.js @@ -32,7 +32,8 @@ defineSuite([ outlineColor : Color.RED, outlineWidth : 7, closeTop : true, - closeBottom : true + closeBottom : true, + shadows : false }; var polygon = new PolygonGraphics(options); @@ -50,6 +51,7 @@ defineSuite([ expect(polygon.outlineWidth).toBeInstanceOf(ConstantProperty); expect(polygon.closeTop).toBeInstanceOf(ConstantProperty); expect(polygon.closeBottom).toBeInstanceOf(ConstantProperty); + expect(polygon.shadows).toBeInstanceOf(ConstantProperty); expect(polygon.material.color.getValue()).toEqual(options.material); expect(polygon.show.getValue()).toEqual(options.show); @@ -65,6 +67,7 @@ defineSuite([ expect(polygon.outlineWidth.getValue()).toEqual(options.outlineWidth); expect(polygon.closeTop.getValue()).toEqual(options.closeTop); expect(polygon.closeBottom.getValue()).toEqual(options.closeBottom); + expect(polygon.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -83,6 +86,7 @@ defineSuite([ source.perPositionHeight = new ConstantProperty(); source.closeTop = new ConstantProperty(); source.closeBottom = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new PolygonGraphics(); target.merge(source); @@ -101,6 +105,7 @@ defineSuite([ expect(target.perPositionHeight).toBe(source.perPositionHeight); expect(target.closeTop).toBe(source.closeTop); expect(target.closeBottom).toBe(source.closeBottom); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -120,6 +125,7 @@ defineSuite([ var perPositionHeight = new ConstantProperty(); var closeTop = new ConstantProperty(); var closeBottom = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new PolygonGraphics(); target.material = material; @@ -136,6 +142,7 @@ defineSuite([ target.perPositionHeight = perPositionHeight; target.closeTop = closeTop; target.closeBottom = closeBottom; + target.shadows = shadows; target.merge(source); @@ -153,6 +160,7 @@ defineSuite([ expect(target.perPositionHeight).toBe(perPositionHeight); expect(target.closeTop).toBe(closeTop); expect(target.closeBottom).toBe(closeBottom); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -171,6 +179,7 @@ defineSuite([ source.perPositionHeight = new ConstantProperty(); source.closeTop = new ConstantProperty(); source.closeBottom = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -187,6 +196,7 @@ defineSuite([ expect(result.perPositionHeight).toBe(source.perPositionHeight); expect(result.closeTop).toBe(source.closeTop); expect(result.closeBottom).toBe(source.closeBottom); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -212,5 +222,6 @@ defineSuite([ testDefinitionChanged(property, 'perPositionHeight', false, true); testDefinitionChanged(property, 'closeTop', true, false); testDefinitionChanged(property, 'closeBottom', true, false); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/PolylineGeometryUpdaterSpec.js b/Specs/DataSources/PolylineGeometryUpdaterSpec.js index dd7e5e03a4bc..9e78dc859bcb 100644 --- a/Specs/DataSources/PolylineGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolylineGeometryUpdaterSpec.js @@ -91,6 +91,7 @@ defineSuite([ expect(updater.hasConstantFill).toBe(true); expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -129,6 +130,7 @@ defineSuite([ expect(updater.hasConstantFill).toBe(true); expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/PolylineGraphicsSpec.js b/Specs/DataSources/PolylineGraphicsSpec.js index 44088e111c0e..4621eca7b981 100644 --- a/Specs/DataSources/PolylineGraphicsSpec.js +++ b/Specs/DataSources/PolylineGraphicsSpec.js @@ -22,7 +22,8 @@ defineSuite([ show : true, width : 1, followSurface : false, - granularity : 2 + granularity : 2, + shadows : false }; var polyline = new PolylineGraphics(options); @@ -32,6 +33,7 @@ defineSuite([ expect(polyline.width).toBeInstanceOf(ConstantProperty); expect(polyline.followSurface).toBeInstanceOf(ConstantProperty); expect(polyline.granularity).toBeInstanceOf(ConstantProperty); + expect(polyline.shadows).toBeInstanceOf(ConstantProperty); expect(polyline.material.color.getValue()).toEqual(options.material); expect(polyline.positions.getValue()).toEqual(options.positions); @@ -39,6 +41,7 @@ defineSuite([ expect(polyline.width.getValue()).toEqual(options.width); expect(polyline.followSurface.getValue()).toEqual(options.followSurface); expect(polyline.granularity.getValue()).toEqual(options.granularity); + expect(polyline.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -49,6 +52,7 @@ defineSuite([ source.show = new ConstantProperty(); source.followSurface = new ConstantProperty(); source.granularity = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new PolylineGraphics(); target.merge(source); @@ -58,6 +62,7 @@ defineSuite([ expect(target.show).toBe(source.show); expect(target.followSurface).toBe(source.followSurface); expect(target.granularity).toBe(source.granularity); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -68,6 +73,7 @@ defineSuite([ source.show = new ConstantProperty(); source.followSurface = new ConstantProperty(); source.granularity = new ConstantProperty(); + source.shadows = new ConstantProperty(); var color = new ColorMaterialProperty(); var positions = new ConstantProperty(); @@ -75,6 +81,7 @@ defineSuite([ var show = new ConstantProperty(); var followSurface = new ConstantProperty(); var granularity = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new PolylineGraphics(); target.material = color; @@ -83,6 +90,7 @@ defineSuite([ target.show = show; target.followSurface = followSurface; target.granularity = granularity; + target.shadows = shadows; target.merge(source); expect(target.material).toBe(color); @@ -91,6 +99,7 @@ defineSuite([ expect(target.show).toBe(show); expect(target.followSurface).toBe(followSurface); expect(target.granularity).toBe(granularity); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -101,6 +110,7 @@ defineSuite([ source.show = new ConstantProperty(); source.followSurface = new ConstantProperty(); source.granularity = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -109,6 +119,7 @@ defineSuite([ expect(result.show).toBe(source.show); expect(result.followSurface).toBe(source.followSurface); expect(result.granularity).toBe(source.granularity); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -126,5 +137,6 @@ defineSuite([ testDefinitionChanged(property, 'width', 3, 4); testDefinitionChanged(property, 'followSurface', false, true); testDefinitionChanged(property, 'granularity', 2, 1); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js b/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js index be9ee8302894..929d23985093 100644 --- a/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js @@ -89,6 +89,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -128,6 +129,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/PolylineVolumeGraphicsSpec.js b/Specs/DataSources/PolylineVolumeGraphicsSpec.js index 5c451d730b08..0e274b123169 100644 --- a/Specs/DataSources/PolylineVolumeGraphicsSpec.js +++ b/Specs/DataSources/PolylineVolumeGraphicsSpec.js @@ -28,7 +28,8 @@ defineSuite([ outline : false, outlineColor : Color.RED, outlineWidth : 2, - cornerType : CornerType.BEVELED + cornerType : CornerType.BEVELED, + shadows : false }; var polylineVolume = new PolylineVolumeGraphics(options); @@ -42,6 +43,7 @@ defineSuite([ expect(polylineVolume.outlineColor).toBeInstanceOf(ConstantProperty); expect(polylineVolume.outlineWidth).toBeInstanceOf(ConstantProperty); expect(polylineVolume.cornerType).toBeInstanceOf(ConstantProperty); + expect(polylineVolume.shadows).toBeInstanceOf(ConstantProperty); expect(polylineVolume.material.color.getValue()).toEqual(options.material); expect(polylineVolume.positions.getValue()).toEqual(options.positions); @@ -53,6 +55,7 @@ defineSuite([ expect(polylineVolume.outlineColor.getValue()).toEqual(options.outlineColor); expect(polylineVolume.outlineWidth.getValue()).toEqual(options.outlineWidth); expect(polylineVolume.cornerType.getValue()).toEqual(options.cornerType); + expect(polylineVolume.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -67,6 +70,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.cornerType = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new PolylineVolumeGraphics(); target.merge(source); @@ -81,6 +85,7 @@ defineSuite([ expect(target.outlineColor).toBe(source.outlineColor); expect(target.outlineWidth).toBe(source.outlineWidth); expect(target.cornerType).toBe(source.cornerType); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -96,6 +101,7 @@ defineSuite([ var outlineColor = new ConstantProperty(); var outlineWidth = new ConstantProperty(); var cornerType = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new PolylineVolumeGraphics(); target.material = material; @@ -108,6 +114,7 @@ defineSuite([ target.outlineColor = outlineColor; target.outlineWidth = outlineWidth; target.cornerType = cornerType; + target.shadows = shadows; target.merge(source); @@ -121,6 +128,7 @@ defineSuite([ expect(target.outlineColor).toBe(outlineColor); expect(target.outlineWidth).toBe(outlineWidth); expect(target.cornerType).toBe(cornerType); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -135,6 +143,7 @@ defineSuite([ source.outlineColor = new ConstantProperty(); source.outlineWidth = new ConstantProperty(); source.cornerType = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -147,6 +156,7 @@ defineSuite([ expect(result.outlineColor).toBe(source.outlineColor); expect(result.outlineWidth).toBe(source.outlineWidth); expect(result.cornerType).toBe(source.cornerType); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -168,5 +178,6 @@ defineSuite([ testDefinitionChanged(property, 'outlineColor', Color.RED, Color.BLUE); testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'cornerType', CornerType.BEVELED, CornerType.MITERED); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/RectangleGeometryUpdaterSpec.js b/Specs/DataSources/RectangleGeometryUpdaterSpec.js index 39bc93b07394..b7773f358149 100644 --- a/Specs/DataSources/RectangleGeometryUpdaterSpec.js +++ b/Specs/DataSources/RectangleGeometryUpdaterSpec.js @@ -81,6 +81,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -121,6 +122,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/RectangleGraphicsSpec.js b/Specs/DataSources/RectangleGraphicsSpec.js index fa6b177f8611..d0acde42f741 100644 --- a/Specs/DataSources/RectangleGraphicsSpec.js +++ b/Specs/DataSources/RectangleGraphicsSpec.js @@ -32,7 +32,8 @@ defineSuite([ outlineColor : Color.RED, outlineWidth : 10, closeTop : false, - closeBottom : false + closeBottom : false, + shadows : false }; var ellipse = new RectangleGraphics(options); @@ -50,7 +51,8 @@ defineSuite([ expect(ellipse.outlineWidth).toBeInstanceOf(ConstantProperty); expect(ellipse.closeTop).toBeInstanceOf(ConstantProperty); expect(ellipse.closeBottom).toBeInstanceOf(ConstantProperty); - + expect(ellipse.shadows).toBeInstanceOf(ConstantProperty); + expect(ellipse.material.color.getValue()).toEqual(options.material); expect(ellipse.show.getValue()).toEqual(options.show); expect(ellipse.coordinates.getValue()).toEqual(options.coordinates); @@ -65,6 +67,7 @@ defineSuite([ expect(ellipse.outlineWidth.getValue()).toEqual(options.outlineWidth); expect(ellipse.closeTop.getValue()).toEqual(options.closeTop); expect(ellipse.closeBottom.getValue()).toEqual(options.closeBottom); + expect(ellipse.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -83,6 +86,7 @@ defineSuite([ source.outlineWidth = new ConstantProperty(); source.closeTop = new ConstantProperty(); source.closeBottom = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new RectangleGraphics(); target.merge(source); @@ -101,6 +105,7 @@ defineSuite([ expect(target.outlineWidth).toBe(source.outlineWidth); expect(target.closeTop).toBe(source.closeTop); expect(target.closeBottom).toBe(source.closeBottom); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -120,6 +125,7 @@ defineSuite([ var outlineWidth = new ConstantProperty(); var closeTop = new ConstantProperty(); var closeBottom = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new RectangleGraphics(); target.material = material; @@ -136,6 +142,7 @@ defineSuite([ target.outlineWidth = outlineWidth; target.closeTop = closeTop; target.closeBottom = closeBottom; + target.shadows = shadows; target.merge(source); @@ -153,6 +160,7 @@ defineSuite([ expect(target.outlineWidth).toBe(outlineWidth); expect(target.closeTop).toBe(closeTop); expect(target.closeBottom).toBe(closeBottom); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -171,6 +179,7 @@ defineSuite([ source.outlineWidth = new ConstantProperty(); source.closeTop = new ConstantProperty(); source.closeBottom = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -187,6 +196,7 @@ defineSuite([ expect(result.outlineWidth).toBe(source.outlineWidth); expect(result.closeTop).toBe(source.closeTop); expect(result.closeBottom).toBe(source.closeBottom); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -212,5 +222,6 @@ defineSuite([ testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'closeTop', false, true); testDefinitionChanged(property, 'closeBottom', false, true); + testDefinitionChanged(property, 'shadows', true, false); }); }); diff --git a/Specs/DataSources/WallGeometryUpdaterSpec.js b/Specs/DataSources/WallGeometryUpdaterSpec.js index 123cfb0c217a..590764a8d55d 100644 --- a/Specs/DataSources/WallGeometryUpdaterSpec.js +++ b/Specs/DataSources/WallGeometryUpdaterSpec.js @@ -88,6 +88,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toBe(undefined); expect(updater.isDynamic).toBe(false); expect(updater.isOutlineVisible(time)).toBe(false); expect(updater.isFilled(time)).toBe(false); @@ -128,6 +129,7 @@ defineSuite([ expect(updater.hasConstantOutline).toBe(true); expect(updater.outlineColorProperty).toBe(undefined); expect(updater.outlineWidth).toBe(1.0); + expect(updater.shadowsProperty).toEqual(new ConstantProperty(false)); expect(updater.isDynamic).toBe(false); }); diff --git a/Specs/DataSources/WallGraphicsSpec.js b/Specs/DataSources/WallGraphicsSpec.js index 1ea35d4c71c1..9c86190f65fa 100644 --- a/Specs/DataSources/WallGraphicsSpec.js +++ b/Specs/DataSources/WallGraphicsSpec.js @@ -26,7 +26,8 @@ defineSuite([ outlineColor : Color.RED, outlineWidth : 2, minimumHeights : [3, 4, 5], - maximumHeights : [6, 7, 8] + maximumHeights : [6, 7, 8], + shadows : false }; var wall = new WallGraphics(options); @@ -41,6 +42,7 @@ defineSuite([ expect(wall.outlineWidth).toBeInstanceOf(ConstantProperty); expect(wall.minimumHeights).toBeInstanceOf(ConstantProperty); expect(wall.maximumHeights).toBeInstanceOf(ConstantProperty); + expect(wall.shadows).toBeInstanceOf(ConstantProperty); expect(wall.material.color.getValue()).toEqual(options.material); expect(wall.positions.getValue()).toEqual(options.positions); @@ -53,6 +55,7 @@ defineSuite([ expect(wall.outlineWidth.getValue()).toEqual(options.outlineWidth); expect(wall.minimumHeights.getValue()).toEqual(options.minimumHeights); expect(wall.maximumHeights.getValue()).toEqual(options.maximumHeights); + expect(wall.shadows.getValue()).toEqual(options.shadows); }); it('merge assigns unassigned properties', function() { @@ -67,6 +70,7 @@ defineSuite([ source.outlineWidth = new ConstantProperty(); source.minimumHeights = new ConstantProperty(); source.maximumHeights = new ConstantProperty(); + source.shadows = new ConstantProperty(true); var target = new WallGraphics(); target.merge(source); @@ -81,6 +85,7 @@ defineSuite([ expect(target.outlineWidth).toBe(source.outlineWidth); expect(target.minimumHeights).toBe(source.minimumHeights); expect(target.maximumHeights).toBe(source.maximumHeights); + expect(target.shadows).toBe(source.shadows); }); it('merge does not assign assigned properties', function() { @@ -96,6 +101,7 @@ defineSuite([ var outlineWidth = new ConstantProperty(); var minimumHeights = new ConstantProperty(); var maximumHeights = new ConstantProperty(); + var shadows = new ConstantProperty(); var target = new WallGraphics(); target.material = material; @@ -108,6 +114,7 @@ defineSuite([ target.outlineWidth = outlineWidth; target.minimumHeights = minimumHeights; target.maximumHeights = maximumHeights; + target.shadows = shadows; target.merge(source); @@ -121,6 +128,7 @@ defineSuite([ expect(target.outlineWidth).toBe(outlineWidth); expect(target.minimumHeights).toBe(minimumHeights); expect(target.maximumHeights).toBe(maximumHeights); + expect(target.shadows).toBe(shadows); }); it('clone works', function() { @@ -135,6 +143,7 @@ defineSuite([ source.outlineWidth = new ConstantProperty(); source.minimumHeights = new ConstantProperty(); source.maximumHeights = new ConstantProperty(); + source.shadows = new ConstantProperty(); var result = source.clone(); expect(result.material).toBe(source.material); @@ -147,6 +156,7 @@ defineSuite([ expect(result.outlineWidth).toBe(source.outlineWidth); expect(result.minimumHeights).toBe(source.minimumHeights); expect(result.maximumHeights).toBe(source.maximumHeights); + expect(result.shadows).toBe(source.shadows); }); it('merge throws if source undefined', function() { @@ -168,5 +178,6 @@ defineSuite([ testDefinitionChanged(property, 'outlineWidth', 2, 3); testDefinitionChanged(property, 'minimumHeights', [0, 1], [2, 3]); testDefinitionChanged(property, 'maximumHeights', [3, 5], [7, 8]); + testDefinitionChanged(property, 'shadows', true, false); }); });