我的纹理是经常要变的,所以不太可能在材质里面去设置,因为太多了。
传其他参数,比如数字,我在shader fs里面:
uniform input_param {
float other_alpha;
};
在ts里:
let mask = this.node.getComponent(cc.Sprite).getMaterial(0);
mask.setProperty(“other_alpha”,this.other_alpha);
但是纹理这样设置不可以。
我的纹理是经常要变的,所以不太可能在材质里面去设置,因为太多了。
传其他参数,比如数字,我在shader fs里面:
uniform input_param {
float other_alpha;
};
在ts里:
let mask = this.node.getComponent(cc.Sprite).getMaterial(0);
mask.setProperty(“other_alpha”,this.other_alpha);
但是纹理这样设置不可以。
cc.assetmanager 请求纹理资源然后更换 和以前cc.loader一样呀
解决了。在ts中:
@property(cc.Sprite)
mask_sprite:cc.Sprite = null;
mask.setProperty(“texture_mask”,this.mask_sprite.spriteFrame.getTexture());
其中在shader中:
#if USE_TEXTURE
in vec2 v_uv0;
uniform sampler2D texture;
uniform sampler2D texture_mask;
#endif
该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。