CustomRenderRule

new Cesium.CustomRenderRule(options)

自定义渲染规则
Name Type Description
options Object 对象具有如下属性:
Name Type Description
customFunctionName String optional 自定义函数名称,其中该名称必须保证与customFunction的函数名一致
customFunction String optional 自定义函数执行体,函数的参数定义详见示例说明
Example:
let filterRule =new   Cesium.CustomRenderRule({
   customFunction:`
   void computenewproperty(FragmentInput fsInput, inout czm_modelMaterial material,inout bool selected){//selected是经过多层条件筛选后的结果
     float newProperty = (fsInput.metadata.pro1[3]+fsInput.metadata.pro1[2]);
     if(newProperty>0.0&&newProperty<20.0)
     {
       material.diffuse = vec3(1.0,0.0,0.0);
       material.alpha =0.8;
     }
     else if(newProperty>=20.0&&newProperty<40.0)
     {
       material.diffuse =1.0;
       material.alpha = 0.6;
     }
     else
     {
       material.diffuse = vec3(0.0,0.0,1.0);
       material.alpha = 0.3;
     }
   }
   `,
   customFunctionName:"computenewproperty",
 });

Members

customFunction : String

设置/获取自定义函数体

customFunctionName : String

设置/获取自定义函数名称

Methods

获取渲染规则类型
Returns:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.