mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/builtinshader: bug fix: wrong blending rate
The blending rate of colors in a square vertices should be calculated by the lower-right point, not the upper-left point. mix(a, b, rate) function calculates (1-rate)*a + rate*b, so a should be weighted if rate is close to 0, and b should be weighted if rate is close to 1. The current implementation was opposite. Rendering results don't seem to be changed so much actually, but the current implementation doesn't make sense.
This commit is contained in:
parent
9ad9bc9ed9
commit
7ed2d73406
@ -97,7 +97,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||
c3 := imageSrc0At(p1)
|
||||
{{end}}
|
||||
|
||||
rate := fract(p0)
|
||||
rate := fract(p1)
|
||||
clr := mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y)
|
||||
{{end}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user