mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
graphics: Better texels adjusting for small textures (#317)
This commit is contained in:
parent
bb993a481b
commit
06394680c1
@ -57,8 +57,8 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 {
|
|||||||
}
|
}
|
||||||
u0, v0, u1, v1 := float64(sx0)/wf, float64(sy0)/hf, float64(sx1)/wf, float64(sy1)/hf
|
u0, v0, u1, v1 := float64(sx0)/wf, float64(sy0)/hf, float64(sx1)/wf, float64(sy1)/hf
|
||||||
// Adjust texels to fix a problem that outside texels are used (#317).
|
// Adjust texels to fix a problem that outside texels are used (#317).
|
||||||
u1 -= 1.0 / 16384.0
|
u1 -= 1.0 / wf / 256.0
|
||||||
v1 -= 1.0 / 16384.0
|
v1 -= 1.0 / hf / 256.0
|
||||||
vs.SetIndex(n, dx0)
|
vs.SetIndex(n, dx0)
|
||||||
vs.SetIndex(n+1, dy0)
|
vs.SetIndex(n+1, dy0)
|
||||||
vs.SetIndex(n+2, u0)
|
vs.SetIndex(n+2, u0)
|
||||||
|
@ -56,8 +56,8 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 {
|
|||||||
}
|
}
|
||||||
u0, v0, u1, v1 := float32(sx0)/wf, float32(sy0)/hf, float32(sx1)/wf, float32(sy1)/hf
|
u0, v0, u1, v1 := float32(sx0)/wf, float32(sy0)/hf, float32(sx1)/wf, float32(sy1)/hf
|
||||||
// Adjust texels to fix a problem that outside texels are used (#317).
|
// Adjust texels to fix a problem that outside texels are used (#317).
|
||||||
u1 -= 1.0 / 16384.0
|
u1 -= 1.0 / wf / 256.0
|
||||||
v1 -= 1.0 / 16384.0
|
v1 -= 1.0 / hf / 256.0
|
||||||
vs[n] = x0
|
vs[n] = x0
|
||||||
vs[n+1] = y0
|
vs[n+1] = y0
|
||||||
vs[n+2] = u0
|
vs[n+2] = u0
|
||||||
|
Loading…
Reference in New Issue
Block a user