I am trying to add an Entity whose has several varying properties such as material (alpha, mostly) and rotation. RectangleGraphics has rotation covered, and works when I set the material to represent a texture.
viewer.entities.add({
name: 'Site Layer',
rectangle: {
coordinates: rectangle,
material: 'Image.jpg',
rotation: Cesium.Math.toRadians(13)
}
});
However, when I tried to implement transparency by using a custom Material (using https://github.com/AnalyticalGraphicsInc/cesium/issues/2484) it shows up as a white texture instead of the desired result ... something like:
material = new Cesium.Material({
fabric : {
type : 'Color',
uniforms : {
image : 'Image.jpg',
alpha : 0.5
}
components : {
diffuse : 'texture2D(image, materialInput.st).rgb',
alpha : 'texture2D(image, materialInput.st).a * alpha'
}
}
}
);
viewer.entities.add({
name: 'Site Layer',
rectangle: {
coordinates: rectangle,
material: material,
rotation: Cesium.Math.toRadians(13)
}
});
Reading the docs, the material in rectangle seems to be a Cesium.MaterialProperty rather than Cesium.Material ... does that mean I can't simply assign a Material to a Rectangle? And if not, can I somehow wrap the Material inside a custom MaterialProperty to make it work?
And for curiosity, why is the functional difference between Material and MaterialProperty?
p.s. GroundPrimitive doesn't work for me because one of the main browsers I need to support (Safari) reports GroundPrimitives.isSupported = false