cesium 自定义属性方法
Cesium.Cesium3DTileset.prototype.setObjsColor = function (ids) { let currentStyle = this.style && this.style.style || {}; this.style = new Cesium.Cesium3DTileStyle({ ...currentStyle, color: { evaluateColor: function (feature) { console.log(feature.myId, feature._batchId, ids.includes(feature._batchId)); if (ids.includes(feature._batchId)) { return Cesium.Color.RED; } } } }) };
style 相关资料网址:
http://cesium.xin/cesium/cn/Documentation1.62/Cesium3DTileStyle.html?classFilter=Cesium3DTileStyle
https://github.com/CesiumGS/3d-tiles/blob/main/specification/Specification.adoc
evaluateColor 方法会遍历场景中所有 Cesium3DTileset 对象,个人觉得性能比较差,还是自己控制比较高效