I’m trying to flat shade my extruded geojson polygons.
I can loop through the entities and set the color like so:
var dataSource = Cesium.GeoJsonDataSource.load('buildings.geojson').then(
function(dataSource) {
var p = dataSource.entities.values;
for (var i = 0; i < p.length; i++) {
p[i].polygon.extrudedHeight = -15;
p[i].polygon.flat = true;
var colorProperty = Cesium.Color.YELLOW;
p[i].polygon.material = new Cesium.ColorMaterialProperty(colorProperty);
}
viewer.dataSources.add(dataSource);
}
When creating objects manually using Cesium.Primitive it seems you can flat shade by setting the flat property on the appearance as in the Star Burst example:
http://localhost:8080/Apps/Sandcastle/index.html?src=Star%20Burst.html
new Cesium.Primitive({
geometryInstances: instances,
appearance: new Cesium.PerInstanceColorAppearance({
flat: true
})
})
Is there a way to do something similar with datasources to set the appearance of the geojson datasource entities to flat shade the polygons?