diff --git a/Source/DataSources/CorridorGeometryUpdater.js b/Source/DataSources/CorridorGeometryUpdater.js index 391b121e5bd3..79bf46bca8a7 100644 --- a/Source/DataSources/CorridorGeometryUpdater.js +++ b/Source/DataSources/CorridorGeometryUpdater.js @@ -527,7 +527,8 @@ define([ !Property.isConstant(granularity) || // !Property.isConstant(width) || // !Property.isConstant(outlineWidth) || // - !Property.isConstant(cornerType)) { + !Property.isConstant(cornerType) || // + (onTerrain && !Property.isConstant(material))) { if (!this._dynamic) { this._dynamic = true; this._geometryChanged.raiseEvent(this); diff --git a/Source/DataSources/EllipseGeometryUpdater.js b/Source/DataSources/EllipseGeometryUpdater.js index 4808d717ef4d..59176bb1004a 100644 --- a/Source/DataSources/EllipseGeometryUpdater.js +++ b/Source/DataSources/EllipseGeometryUpdater.js @@ -538,7 +538,8 @@ define([ !Property.isConstant(granularity) || // !Property.isConstant(stRotation) || // !Property.isConstant(outlineWidth) || // - !Property.isConstant(numberOfVerticalLines)) { + !Property.isConstant(numberOfVerticalLines) || // + (onTerrain && !Property.isConstant(material))) { if (!this._dynamic) { this._dynamic = true; this._geometryChanged.raiseEvent(this); diff --git a/Source/DataSources/PolygonGeometryUpdater.js b/Source/DataSources/PolygonGeometryUpdater.js index c9fbd76c0faf..cd98be03885f 100644 --- a/Source/DataSources/PolygonGeometryUpdater.js +++ b/Source/DataSources/PolygonGeometryUpdater.js @@ -542,7 +542,8 @@ define([ !Property.isConstant(perPositionHeightProperty) || // !Property.isConstant(perPositionHeight) || // !Property.isConstant(closeTop) || // - !Property.isConstant(closeBottom)) { + !Property.isConstant(closeBottom) || // + (onTerrain && !Property.isConstant(material))) { if (!this._dynamic) { this._dynamic = true; diff --git a/Source/DataSources/RectangleGeometryUpdater.js b/Source/DataSources/RectangleGeometryUpdater.js index 679d489ed38b..b444ec05b8cb 100644 --- a/Source/DataSources/RectangleGeometryUpdater.js +++ b/Source/DataSources/RectangleGeometryUpdater.js @@ -534,7 +534,8 @@ define([ !Property.isConstant(rotation) || // !Property.isConstant(outlineWidth) || // !Property.isConstant(closeBottom) || // - !Property.isConstant(closeTop)) { + !Property.isConstant(closeTop) || // + (onTerrain && !Property.isConstant(material))) { if (!this._dynamic) { this._dynamic = true; this._geometryChanged.raiseEvent(this); diff --git a/Source/DataSources/StaticGroundGeometryColorBatch.js b/Source/DataSources/StaticGroundGeometryColorBatch.js index a3efcf6b05cc..aa19dc270bba 100644 --- a/Source/DataSources/StaticGroundGeometryColorBatch.js +++ b/Source/DataSources/StaticGroundGeometryColorBatch.js @@ -316,12 +316,13 @@ define([ var batchesCopyCount = batchesArrayCopy.length; for (i = 0; i < batchesCopyCount; ++i) { var batch = batchesArrayCopy[i]; - if (batch.geometry.length === 0) { - batches.remove(batch.key); - } else if (batch.isDirty) { + if (batch.isDirty) { isUpdated = batchesArrayCopy[i].update(time) && isUpdated; batch.isDirty = false; } + if (batch.geometry.length === 0) { + batches.remove(batch.key); + } } return isUpdated; diff --git a/Specs/DataSources/CorridorGeometryUpdaterSpec.js b/Specs/DataSources/CorridorGeometryUpdaterSpec.js index 4ca42465d2d5..528ea91386ec 100644 --- a/Specs/DataSources/CorridorGeometryUpdaterSpec.js +++ b/Specs/DataSources/CorridorGeometryUpdaterSpec.js @@ -242,6 +242,15 @@ defineSuite([ expect(updater.isDynamic).toBe(true); }); + it('A time-varying color causes ground geometry to be dynamic', function() { + var entity = createBasicCorridorWithoutHeight(); + var updater = new CorridorGeometryUpdater(entity, scene); + var color = new SampledProperty(Color); + color.addSample(time, Color.WHITE); + entity.corridor.material = new ColorMaterialProperty(color); + expect(updater.isDynamic).toBe(true); + }); + function validateGeometryInstance(options) { var entity = createBasicCorridor(); diff --git a/Specs/DataSources/EllipseGeometryUpdaterSpec.js b/Specs/DataSources/EllipseGeometryUpdaterSpec.js index 6b2068239e6e..29946057615d 100644 --- a/Specs/DataSources/EllipseGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipseGeometryUpdaterSpec.js @@ -268,6 +268,15 @@ defineSuite([ expect(updater.isDynamic).toBe(true); }); + it('A time-varying color causes ground geometry to be dynamic', function() { + var entity = createBasicEllipseWithoutHeight(); + var updater = new EllipseGeometryUpdater(entity, scene); + var color = new SampledProperty(Color); + color.addSample(time, Color.WHITE); + entity.ellipse.material = new ColorMaterialProperty(color); + expect(updater.isDynamic).toBe(true); + }); + function validateGeometryInstance(options) { var entity = new Entity(); entity.position = new ConstantPositionProperty(options.center); diff --git a/Specs/DataSources/PolygonGeometryUpdaterSpec.js b/Specs/DataSources/PolygonGeometryUpdaterSpec.js index 6f8efe50d750..4874434e2154 100644 --- a/Specs/DataSources/PolygonGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolygonGeometryUpdaterSpec.js @@ -253,6 +253,15 @@ defineSuite([ expect(updater.isDynamic).toBe(true); }); + it('A time-varying color causes ground geometry to be dynamic', function() { + var entity = createBasicPolygonWithoutHeight(); + var updater = new PolygonGeometryUpdater(entity, scene); + var color = new SampledProperty(Color); + color.addSample(time, Color.WHITE); + entity.polygon.material = new ColorMaterialProperty(color); + expect(updater.isDynamic).toBe(true); + }); + function validateGeometryInstance(options) { var entity = createBasicPolygon(); diff --git a/Specs/DataSources/RectangleGeometryUpdaterSpec.js b/Specs/DataSources/RectangleGeometryUpdaterSpec.js index 155924ff19f1..1ccc8b2434a1 100644 --- a/Specs/DataSources/RectangleGeometryUpdaterSpec.js +++ b/Specs/DataSources/RectangleGeometryUpdaterSpec.js @@ -239,6 +239,15 @@ defineSuite([ expect(updater.isDynamic).toBe(true); }); + it('A time-varying color causes ground geometry to be dynamic', function() { + var entity = createBasicRectangleWithoutHeight(); + var updater = new RectangleGeometryUpdater(entity, scene); + var color = new SampledProperty(Color); + color.addSample(time, Color.WHITE); + entity.rectangle.material = new ColorMaterialProperty(color); + expect(updater.isDynamic).toBe(true); + }); + function validateGeometryInstance(options) { var entity = createBasicRectangle();