[0]2.x的2Dshader在laya3.x已经无法使用了

private shaderValue: Laya.Value2D;
static DissolveSurfaceSaveName: number = 9999;

constructor() {
super();
this.init();
}

public init(): void {
this.shaderValue = new Laya.Value2D(DissolveSurfaceSprite.DissolveSurfaceSaveName, DissolveSurfaceSprite.DissolveSurfaceSaveName);
//重要的一步 将渲染设置为自定义
this.customRenderEnable = true;
this.shaderValue.shader = new Laya.Shader2X(vs, ps, DissolveSurfaceSprite.DissolveSurfaceSaveName);
}

// 自定义渲染提交
public customRender(context: Context, x: number, y: number) {
if (this.texture) {
context.drawTarget(this.texture as any, x, y, this.texture.width, this.texture.height, null, this.shaderValue);
} else {
// context.drawTarget(this.texture as any, x, y, 0, 0, null, this.shaderValue);
}
}
是否可以在官方demo出个简单的2Dshader,现在按找到的shader来实现会报错
已邀请:

zon

赞同来自:

Laya.Shader2X.preCompile2D(0, DissolveSurfaceSaveName, vs, ps, "SSA");
增加一句在初始化的时候就可以了

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作