Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix weird PolygonGeometry perPositionHeight edge case #6790

Merged
merged 2 commits into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Change Log

#### Fixes :wrench:
* Fixed bug causing billboards and labels to appear the wrong size when switching scene modes [#6745](https://github.com/AnalyticalGraphicsInc/cesium/issues/6745)
* Fixed `PolygonGeometry` when using `VertexFormat.POSITION_ONLY`, `perPositionHeight` and `extrudedHeight` [#6790](expect(https://github.com/AnalyticalGraphicsInc/cesium/pull/6790)
* Fixed a bug that was preventing 3D Tilesets on the opposite side of the globe from being occluded [#6714](https://github.com/AnalyticalGraphicsInc/cesium/issues/6714)

### 1.47 - 2018-07-02
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/PolygonGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ define([
}

topGeo.attributes.position.values = topBottomPositions;
if (perPositionHeight) {
if (perPositionHeight && vertexFormat.normal) {
var normals = topGeo.attributes.normal.values;
topGeo.attributes.normal.values = new Float32Array(topBottomPositions.length);
topGeo.attributes.normal.values.set(normals);
Expand Down
18 changes: 18 additions & 0 deletions Specs/Core/PolygonGeometrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,24 @@ defineSuite([
expect(notEqualCount).toEqual(6);
});

it('computes geometry with position only vertex format with perPositionHeight and extrudedHeight', function() {
var positions = Cartesian3.fromDegreesArrayHeights([
-1.0, -1.0, 100.0,
1.0, -1.0, 0.0,
1.0, 1.0, 100.0,
-1.0, 1.0, 0.0
]);
var geometry = PolygonGeometry.createGeometry(PolygonGeometry.fromPositions({
positions : positions,
extrudedHeight: 0,
vertexFormat : VertexFormat.POSITION_ONLY,
perPositionHeight : true
}));
expect(geometry).toBeDefined();
expect(geometry.attributes.position).toBeDefined();
expect(geometry.attributes.normal).toBeUndefined();
});

it('computing rectangle property', function() {
var p = new PolygonGeometry({
vertexFormat : VertexFormat.POSITION_AND_ST,
Expand Down