Skip to content

Commit

Permalink
Merge pull request #6920 from AnalyticalGraphicsInc/fix-show-crash
Browse files Browse the repository at this point in the history
Fix crash when setting ground polyline entity show to false
  • Loading branch information
Hannah authored Aug 14, 2018
2 parents a8d38aa + 81f0896 commit 1032209
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/PolylineVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
47 changes: 47 additions & 0 deletions Specs/DataSources/PolylineVisualizerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

0 comments on commit 1032209

Please sign in to comment.