Cesium中遇到 materialProperty.getType is not a function
需求描述为使用callbackProperty不断更新纹理,于是我写下了如下代码
this._rectangle = this._viewer.entities.add({rectangle: {show: this._show,coordinates: Cesium.Rectangle.fromDegrees(this._positions[0], this._positions[1],this._positions[2],this._positions[3]),heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,material: new Cesium.CallbackProperty(() => {return new Cesium.ImageMaterialProperty({image: this._dataMap.get(this._dataKey),//是一个map根据type获取iamgecolor: Cesium.Color.WHITE.withAlpha(1.0)}) }, true),}})
于是就报错了,正确的代码应为
this._rectangle = this._viewer.entities.add({rectangle: {show: this._show,coordinates: Cesium.Rectangle.fromDegrees(this._positions[0], this._positions[1],this._positions[2],this._positions[3]),heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,material: new Cesium.ImageMaterialProperty({image: new Cesium.CallbackProperty(() => {return this._dataMap.get(this._dataKey)}, true),color: Cesium.Color.WHITE.withAlpha(1.0)})}})
可以看到应该先创建ImageMaterialProperty,再创建callbackProperty,但是cesium文档并没有说明,但是可以看到,image的类型是Property,而material类型是MaterialProperty,难道是因为这个?但是他们都属于Property啊
原文地址:https://blog.csdn.net/a374682949/article/details/143358598
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mrgr.cn/news/61707.html 如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mrgr.cn/news/61707.html 如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!