In 1.16, we would update a polygon’s material just by changing the material and calling configurePolygonHierarchy:
polygon.material = Cesium.Material.fromType(‘Color’);
polygon.material.uniforms.color = {
red: rgb[0],
green: rgb[1],
blue: rgb[2],
alpha: alphaValue
};
var hierarchy = {
positions : positions,
holes : [{ positions : seaLevelInnerRingPositions }]
};
polygon.configureFromPolygonHierarchy(hierarchy);
``
With the removal of Polygon, how do we do this in 1.17? I tried the code below but I can’t get the polygon material to update (to the default red color). Is this the right idea?
//polygon is the original polygon we're trying to modify
var instance = new Cesium.GeometryInstance({
geometry : new Cesium.PolygonGeometry({
polygonHierarchy : hierarchy,
height : polygon.height,
vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
stRotation : polygon.textureRotationAngle,
ellipsoid : polygon.ellipsoid,
granularity : polygon.granularity,
extrudedHeight : polygon.extrudedHeight
}),
id : polygon.id,
pickPrimitive : polygon
});
polygon._primitive.destroy();
polygon._primitive = new Cesium.Primitive({
geometryInstances : instance,
appearance : new Cesium.EllipsoidSurfaceAppearance({
aboveGround : (polygon.height > 0.0),
material : Cesium.Material.fromType(‘Color’)
}),
asynchronous : polygon.asynchronous
});
``