mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
examples/shader: make the default shader deterministic
Updates #1431 Updates #2638
This commit is contained in:
parent
1de600e397
commit
038cacf97f
@ -21,8 +21,12 @@ var Cursor vec2
|
||||
var ScreenSize vec2
|
||||
|
||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||
// Note that the value of position.xy is indeterministic as the destination image is somewhere on a texture atlas.
|
||||
pos := position.xy/imageDstTextureSize() + Cursor/ScreenSize/4
|
||||
// Normalize the position to [0, 1].
|
||||
pos := position.xy / imageDstTextureSize()
|
||||
origin, size := imageDstRegionOnTexture()
|
||||
pos -= origin
|
||||
pos /= size
|
||||
pos += Cursor / ScreenSize / 4
|
||||
clr := 0.0
|
||||
clr += sin(pos.x*cos(Time/15)*80) + cos(pos.y*cos(Time/15)*10)
|
||||
clr += sin(pos.y*sin(Time/10)*40) + cos(pos.x*sin(Time/25)*40)
|
||||
|
Loading…
Reference in New Issue
Block a user