mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/shader: refactoring
This commit is contained in:
parent
00e45affe9
commit
01bb42526a
@ -29,5 +29,5 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
clr.r = imageSrc2At(texCoord + amount).r
|
clr.r = imageSrc2At(texCoord + amount).r
|
||||||
clr.g = imageSrc2UnsafeAt(texCoord).g
|
clr.g = imageSrc2UnsafeAt(texCoord).g
|
||||||
clr.b = imageSrc2At(texCoord - amount).b
|
clr.b = imageSrc2At(texCoord - amount).b
|
||||||
return vec4(clr, 1.0)
|
return vec4(clr, 1)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
// TODO: This is confusing. Add a function to treat pixels (#1431).
|
// TODO: This is confusing. Add a function to treat pixels (#1431).
|
||||||
srcTexSize := imageSrcTextureSize()
|
srcTexSize := imageSrcTextureSize()
|
||||||
xoffset := (4 / srcTexSize.x) * cos(Time*3+pos.y/10)
|
xoffset := (4 / srcTexSize.x) * cos(Time*3+pos.y/10)
|
||||||
yoffset := (20 / srcTexSize.y) * (1.0 + cos(Time*3+pos.y/40))
|
yoffset := (20 / srcTexSize.y) * (1 + cos(Time*3+pos.y/40))
|
||||||
bordertex := border / srcTexSize.y
|
bordertex := border / srcTexSize.y
|
||||||
clr := imageSrc2At(vec2(
|
clr := imageSrc2At(vec2(
|
||||||
texCoord.x+xoffset,
|
texCoord.x+xoffset,
|
||||||
|
Loading…
Reference in New Issue
Block a user