Hello all,
In the examples below, it draws 2592 rectangles with unique color, then combine all the rectangles together to one geometry.
I debug through the code, and I saw that combining all the 2592 rectangles into one geometry is very time consuming. In my application, I need to draw way more than 2592 rectangles. So is there a way that I can only draw one geometry with a lot of different colors? Thanks in advance.
var widget = new Cesium.CesiumWidget('cesiumContainer');
var scene = widget.scene;
var instances = [];
for (var lon = -180.0; lon < 180.0; lon += 5.0) {
for (var lat = -90.0; lat < 90.0; lat += 5.0) {
instances.push(new Cesium.GeometryInstance({
geometry : new Cesium.ExtentGeometry({
extent : Cesium.Extent.fromDegrees(lon, lat, lon + 5.0, lat + 5.0)
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromRandom({alpha : 0.5}))
}
}));
}
}
scene.getPrimitives().add(new Cesium.Primitive({
geometryInstances : instances,
appearance : new Cesium.PerInstanceColorAppearance()
}));