限制着色器们输入的时间范围防止精度问题导致掉帧(略暴力,会导致一个背景连续40分钟左右后会闪烁一次)

This commit is contained in:
MrZ_26
2022-04-03 00:40:21 +08:00
parent 286e330077
commit a6c63c41b6
5 changed files with 10 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ local shader=SHADER.aura
local t
function back.init()
t=math.random()*2600
t=math.random()*260
BG.resize(SCR.w,SCR.h)
end
function back.resize(_,h)
@@ -13,7 +13,7 @@ function back.resize(_,h)
shader:send('h',h*SCR.dpi)
end
function back.update(dt)
t=t+dt
t=(t+dt)%2600
end
function back.draw()
gc.clear(.08,.08,.084)

View File

@@ -5,14 +5,14 @@ local shader=SHADER.grad1
local t
function back.init()
t=math.random()*2600
t=math.random()*260
back.resize()
end
function back.resize()
shader:send('w',SCR.W)
end
function back.update(dt)
t=t+dt
t=(t+dt)%2600
end
function back.draw()
gc.clear(.08,.08,.084)

View File

@@ -5,14 +5,14 @@ local shader=SHADER.grad2
local t
function back.init()
t=math.random()*2600
t=math.random()*260
BG.resize(nil,SCR.h)
end
function back.resize(_,h)
shader:send('h',h*SCR.dpi)
end
function back.update(dt)
t=t+dt
t=(t+dt)%2600
end
function back.draw()
gc.clear(.08,.08,.084)

View File

@@ -5,7 +5,7 @@ local shader=SHADER.rgb1
local t
function back.init()
t=math.random()*2600
t=math.random()*260
BG.resize(SCR.w,SCR.h)
end
function back.resize(_,h)
@@ -13,7 +13,7 @@ function back.resize(_,h)
shader:send('h',h*SCR.dpi)
end
function back.update(dt)
t=t+dt
t=(t+dt)%2600
end
function back.draw()
gc.clear(.08,.08,.084)

View File

@@ -5,7 +5,7 @@ local shader=SHADER.rgb2
local t
function back.init()
t=math.random()*2600
t=math.random()*260
BG.resize(SCR.w,SCR.h)
end
function back.resize(_,h)
@@ -13,7 +13,7 @@ function back.resize(_,h)
shader:send('h',h*SCR.dpi)
end
function back.update(dt)
t=t+dt
t=(t+dt)%2600
end
function back.draw()
gc.clear(.08,.08,.084)