[LayaAir 1.0]自定义渲染后,customRender里设置uniform值在ui节点下不生效
1.自定义一个精灵类,里面重写了渲染方法
// 重写渲染函数
public customRender(context:Laya.RenderContext,x:number,y:number):void{
if(this.shader._program)
{
let u_lightTime = gl.getUniformLocation(this.shader._program, "u_lightTime")
gl.uniform1f(u_lightTime, this.timerCount)
this.timerCount += Laya.timer.delta/1000
}
context.ctx.setIBVB(x, y,this.iBuffer, this.vBuffer,this.iNum,null,this.shader,this.shaderValue, 0, 0);
}
2.我将自定义的精灵类添加到ui根节点下,能达到我想要的效果gl.uniform1f(u_lightTime, this.timerCount)生效
3.我将自定义的精灵类添加到imgBg节点下,gl.uniform1f(u_lightTime, this.timerCount)不生效
1.添加到imgBg节点下gl.uniform1f(u_lightTime, this.timerCount)感觉没有生效, 图1的发光线没有呼吸效果
2.添加到ui根节点下,图2是我想要的效果
// 重写渲染函数
public customRender(context:Laya.RenderContext,x:number,y:number):void{
if(this.shader._program)
{
let u_lightTime = gl.getUniformLocation(this.shader._program, "u_lightTime")
gl.uniform1f(u_lightTime, this.timerCount)
this.timerCount += Laya.timer.delta/1000
}
context.ctx.setIBVB(x, y,this.iBuffer, this.vBuffer,this.iNum,null,this.shader,this.shaderValue, 0, 0);
}
2.我将自定义的精灵类添加到ui根节点下,能达到我想要的效果gl.uniform1f(u_lightTime, this.timerCount)生效
3.我将自定义的精灵类添加到imgBg节点下,gl.uniform1f(u_lightTime, this.timerCount)不生效
1.添加到imgBg节点下gl.uniform1f(u_lightTime, this.timerCount)感觉没有生效, 图1的发光线没有呼吸效果
2.添加到ui根节点下,图2是我想要的效果
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
chasel
赞同来自:
有解决方法吗?
chasel
赞同来自:
Aar0n
赞同来自: