From 92ea7c12967b33a113d841aa4fe6003bd43a2be3 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 10 Jul 2018 17:36:27 -0400 Subject: [PATCH 1/2] Fix `PolygonGeometry` when using vertexFormat.POSITION_ONLY, perPositionHeight and extrudedHeight --- CHANGES.md | 1 + Source/Core/PolygonGeometry.js | 2 +- Specs/Core/PolygonGeometrySpec.js | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7414ce2bb570..d82c8cc4fcd1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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` [#6789](expect(https://github.com/AnalyticalGraphicsInc/cesium/pull/6789) * 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 diff --git a/Source/Core/PolygonGeometry.js b/Source/Core/PolygonGeometry.js index 6d6477cbf709..9bc451172d88 100644 --- a/Source/Core/PolygonGeometry.js +++ b/Source/Core/PolygonGeometry.js @@ -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); diff --git a/Specs/Core/PolygonGeometrySpec.js b/Specs/Core/PolygonGeometrySpec.js index bad73ddb70c1..15601a327dc1 100644 --- a/Specs/Core/PolygonGeometrySpec.js +++ b/Specs/Core/PolygonGeometrySpec.js @@ -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, From 28db75f69cf62eb894d6c8b2da97f7043a646fa4 Mon Sep 17 00:00:00 2001 From: Hannah Date: Tue, 10 Jul 2018 17:39:53 -0400 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d82c8cc4fcd1..338ed2f49b91 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +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` [#6789](expect(https://github.com/AnalyticalGraphicsInc/cesium/pull/6789) +* 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