CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.97k stars 3.5k forks source link

Winding order bug in extruded polygons with holes? #2404

Closed mramato closed 9 years ago

mramato commented 9 years ago

Are extruded polygons with holes considered opened or closed? Right now the DataSource layer sets them to closed, (which I assume is correct) but this results in interior walls being culled as in the below image:

image

My assumption is that this a bug in the geometry; specifically I think this line is flipped and should be if (windingOrder === WindingOrder.COUNTER_CLOCKWISE)

If @pjcozzi or @bagnell can confirm either way, I'll open a fix (either in the Polygon code or the DataSource primitive batching code depending on the answer).

pjcozzi commented 9 years ago

@bagnell can you confirm please? I believe @mramato is right since when ear clipping polygons with holes by finding mutually visible vertices, the winding order needs to be consistent for the newly formed polygon, which would mean CCW outer and CW inner.

bagnell commented 9 years ago

I can confirm that it should be COUNTER_CLOCKWISE.