mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
parent
0776a54712
commit
1c14ba8eeb
@ -22,6 +22,8 @@ var ScreenSize vec2
|
|||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
center := ScreenSize / 2
|
center := ScreenSize / 2
|
||||||
|
// Convert a pixel to a texel by dividing by the texture size.
|
||||||
|
// TODO: This is confusing. Add a function to treat pixels (#1431).
|
||||||
amount := (center - Cursor) / 10 / imageSrcTextureSize()
|
amount := (center - Cursor) / 10 / imageSrcTextureSize()
|
||||||
var clr vec3
|
var clr vec3
|
||||||
clr.r = imageSrc2At(texCoord + amount).r
|
clr.r = imageSrc2At(texCoord + amount).r
|
||||||
|
@ -30,6 +30,8 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
return imageSrc2UnsafeAt(texCoord)
|
return imageSrc2UnsafeAt(texCoord)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert a pixel to a texel by dividing by the texture size.
|
||||||
|
// 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.0 + cos(Time*3+pos.y/40))
|
||||||
|
Loading…
Reference in New Issue
Block a user