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

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented Jul 10, 2018

Fixes crash when perPositionHeight: true, extrudedHeight is defined, and vertexFormat: VertexFormat.POSITION_ONLY.

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;

var positions = Cesium.Cartesian3.fromDegreesArrayHeights([
    -108.0, 25.0, 100000,
    -100.0, 25.0, 100000,
    -100.0, 30.0, 100000,
    -108.0, 30.0, 300000
]);
var orangePolygonInstance = new Cesium.GeometryInstance({
    geometry : Cesium.PolygonGeometry.fromPositions({
        positions : positions,
        extrudedHeight: 0,
        vertexFormat : Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
        perPositionHeight : true
    }),
    attributes: {
        color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.ORANGE)
    }
});

scene.primitives.add(new Cesium.Primitive({
    geometryInstances : [orangePolygonInstance],
    appearance : new Cesium.PerInstanceColorAppearance({
        flat: true,
        closed : true,
        translucent : false
    })
}));

@cesium-concierge
Copy link

Thanks for the pull request @hpinkos!

  • ✔️ Signed CLA found.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@hpinkos hpinkos changed the title Fix PolygonGeometry perPositionHeight edge case Fix weird PolygonGeometry perPositionHeight edge case Jul 10, 2018
@bagnell
Copy link
Contributor

bagnell commented Jul 11, 2018

👍

@bagnell bagnell merged commit b32bc17 into master Jul 11, 2018
@bagnell bagnell deleted the polygon-edge-case branch July 11, 2018 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants