-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 ellipse triangulation #3326
Conversation
Try this example code that doesn't generate that many triangles: var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
scene.primitives.add(new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : Cesium.GeometryPipeline.toWireframe(Cesium.EllipseGeometry.createGeometry(new Cesium.EllipseGeometry({
center : Cesium.Cartesian3.fromDegrees(-100.0, 40.0),
semiMinorAxis : 300000.0,
semiMajorAxis : 400000.0,
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
granularity : Cesium.Math.PI / 32
}))),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
}),
appearance : new Cesium.PerInstanceColorAppearance({
translucent : false,
closed : true
}),
asynchronous : false
})); It looks like there are 22 triangles and 16 vertices. If you put a breakpoint in |
@bagnell that's because there are duplicate positions at the points on the left and right end. It was that way before I changed the code. I'll see if I can fix it though. |
@bagnell ready |
@bagnell any update here? |
Looks good. Thanks @hpinkos! |
Fixes #3078
This also fixes a crash if you tried to create an ellipse with
VertexFormat.ALL
. The tangents and binormals weren't normalized.Before:
After: