[LayaAir 2.0]如何拓展材质shader?

比如 BlinnPhong 这个材质
我现在要增加一个 BlinnPhongExt,多一个小功能
 
如何在不改laya.d3 这个类下拓展?
 
我尝试BlinnPhongExt extends Laya.BlinnPhongMaterial
 
但在做材质属性拷贝的时候会出现不正确的结果
 
export default class LayaBlinnPhongExt extends Laya.BlinnPhongMaterial {
    public CopyAttribute_ASKLaya(baseMat: Laya.BlinnPhongMaterial) {
      
        var layaBlinnPhongExt:LayaBlinnPhongExt=this;
        var layaBlinnPhong:Laya.BlinnPhongMaterial=baseMat;
      
        layaBlinnPhongExt.albedoTexture = layaBlinnPhong.albedoTexture;
        layaBlinnPhongExt.albedoIntensity = layaBlinnPhong.albedoIntensity;
        layaBlinnPhongExt.albedoColor = layaBlinnPhong.albedoColor;
        layaBlinnPhongExt.enableLighting = true;
        layaBlinnPhongExt.shininess = layaBlinnPhong.shininess;
        layaBlinnPhongExt.cull = layaBlinnPhong.cull;
        layaBlinnPhongExt.name = layaBlinnPhong.name;
        //enableLighting=false时顶点会出错
        layaBlinnPhong.enableLighting=layaBlinnPhong.enableLighting;
    }
}
 
 
已邀请:

要回复问题请先

商务合作
商务合作