diff --git a/CHANGES.md b/CHANGES.md index 31b15f03dd6b..52c342efdb0c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Change Log * Improved `Plane` entities so they are better aligned with the globe surface [#6887](https://github.com/AnalyticalGraphicsInc/cesium/pull/6887) * Fixed crash when rendering translucent objects when all shadow maps in the scene set `fromLightSource` to false. [#6883](https://github.com/AnalyticalGraphicsInc/cesium/pull/6883) * Fixed night shading in 2D and Columbus view. [#4122](https://github.com/AnalyticalGraphicsInc/cesium/issues/4122) +* Fixed a crash when setting show to `false` on a polyline clamped to the ground. [#6912](https://github.com/AnalyticalGraphicsInc/cesium/issues/6912) * Fixed crash that happened when calling `scene.pick` after setting a new terrain provider [#6918](https://github.com/AnalyticalGraphicsInc/cesium/pull/6918) ### 1.48 - 2018-08-01 diff --git a/Source/DataSources/PolylineVisualizer.js b/Source/DataSources/PolylineVisualizer.js index a4bfc58c8ae5..7bf86fc489ae 100644 --- a/Source/DataSources/PolylineVisualizer.js +++ b/Source/DataSources/PolylineVisualizer.js @@ -51,7 +51,7 @@ define([ return; } - if (updater.clampToGround) { // Also checks for support + if (updater.clampToGround && updater.fillEnabled) { // Also checks for support that._groundBatch.add(time, updater); return; } diff --git a/Specs/DataSources/PolylineVisualizerSpec.js b/Specs/DataSources/PolylineVisualizerSpec.js index 78ac465f8c74..34722cf0a608 100644 --- a/Specs/DataSources/PolylineVisualizerSpec.js +++ b/Specs/DataSources/PolylineVisualizerSpec.js @@ -712,4 +712,51 @@ defineSuite([ visualizer.destroy(); }); }); + + it('Sets static geometry primitive show attribute when clamped to ground', function() { + if (!Entity.supportsPolylinesOnTerrain(scene)) { + return; + } + + var objects = new EntityCollection(); + var visualizer = new PolylineVisualizer(scene, objects, scene.groundPrimitives); + + var polyline = new PolylineGraphics(); + polyline.positions = new ConstantProperty([Cartesian3.fromDegrees(0.0, 0.0), Cartesian3.fromDegrees(0.0, 1.0)]); + polyline.material = new ColorMaterialProperty(); + polyline.clampToGround = new ConstantProperty(true); + + var entity = new Entity(); + entity.polyline = polyline; + objects.add(entity); + + return pollToPromise(function() { + scene.initializeFrame(); + var isUpdated = visualizer.update(time); + scene.render(time); + return isUpdated; + }).then(function() { + var primitive = scene.groundPrimitives.get(0); + var attributes = primitive.getGeometryInstanceAttributes(entity); + expect(attributes).toBeDefined(); + expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true)); + expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.WHITE)); + expect(primitive.appearance).toBeInstanceOf(PolylineColorAppearance); + expect(primitive.appearance.closed).toBe(false); + + entity.polyline.show = false; + + return pollToPromise(function() { + scene.initializeFrame(); + var isUpdated = visualizer.update(time); + scene.render(time); + return isUpdated; + }); + }).then(function() { + expect(scene.primitives.length).toEqual(0); + + objects.remove(entity); + visualizer.destroy(); + }); + }); }, 'WebGL');