[]我想动态改自定义shader里的值,应该怎么写??

我想动态改自定义shader里的值,
CustomMaterial.js应该怎么写??我这样写set的时候报错
Uncaught TypeError: this._setValue is not a function at CustomMaterial.setAlphaTestValue (CustomMaterial.js:34) at LayaAir3D.js:94CustomMaterial.setAlphaTestValue @ CustomMaterial.js:34
(anonymous)

function CustomMaterial() {
    CustomMaterial.__super.call(this);
    this.setShaderName("CustomShader");
}
 
Laya.class(CustomMaterial, "CustomMaterial", Laya.BaseMaterial);
 
CustomMaterial.DIFFUSETEXTURE = 1;
CustomMaterial.NORMALTEXTURE = 2;
CustomMaterial.ALPHATESTVALUE = 0;
 
CustomMaterial.prototype.getDiffuseTexture = function () {
    return this._getTexture(CustomMaterial.DIFFUSETEXTURE);
}
 
CustomMaterial.prototype.setDiffuseTexture = function (value) {
    this._setTexture(CustomMaterial.DIFFUSETEXTURE,value);
}

CustomMaterial.prototype.getNormalTexture = function () {
    return this._getTexture(CustomMaterial.NORMALTEXTURE);
}
 
CustomMaterial.prototype.setNormalTexture = function (value) {
    this._setTexture(CustomMaterial.NORMALTEXTURE,value);
}

CustomMaterial.prototype.getAlphaTestValue = function () {
    return this._getValue(CustomMaterial.ALPHATESTVALUE);
}
 
CustomMaterial.prototype.setAlphaTestValue = function (value) {
    this._setValue(CustomMaterial.ALPHATESTVALUE,value);
}
已邀请:

ebaww

赞同来自: cuixueying

我改成_setNumber可以了

Monica - 知识达人

赞同来自:

厉害~\(≧▽≦)/~

要回复问题请先

商务合作
商务合作