Compare commits

...

2 Commits

Author SHA1 Message Date
Hajime Hoshi
f6cd2beacf internal/buildinshader: refactoring 2024-10-24 12:16:05 +09:00
Hajime Hoshi
98d386f249 ebiten: fix typo
Updates #3139
2024-10-24 11:29:56 +09:00
2 changed files with 8 additions and 8 deletions

View File

@ -129,7 +129,7 @@ func (g *gameForUI) DrawFinalScreen(scale, offsetX, offsetY float64) {
return
}
DefaultDrawFinalsScreen(g.screen, g.offscreen, geoM)
DefaultDrawFinalScreen(g.screen, g.offscreen, geoM)
}
var (
@ -137,12 +137,12 @@ var (
theScreenShaderOnce sync.Once
)
// DefaultDrawFinalsScreen is the default implementation of [FinalScreenDrawer.DrawFinalScreen],
// DefaultDrawFinalScreen is the default implementation of [FinalScreenDrawer.DrawFinalScreen],
// used when a [Game] doesn't implement [FinalScreenDrawer].
//
// You can use DefaultDrawFinalsScreen when you need the default implementation of [FinalScreenDrawer.DrawFinalScreen]
// You can use DefaultDrawFinalScreen when you need the default implementation of [FinalScreenDrawer.DrawFinalScreen]
// in your implementation of [FinalScreenDrawer], for example.
func DefaultDrawFinalsScreen(screen *Image, offscreen *Image, geoM GeoM) {
func DefaultDrawFinalScreen(screen *Image, offscreen *Image, geoM GeoM) {
theScreenShaderOnce.Do(func() {
s, err := newShader(builtinshader.ScreenShaderSource, "screen")
if err != nil {

View File

@ -60,7 +60,7 @@ var ColorMTranslation vec4
{{end}}
{{if eq .Address .AddressRepeat}}
func adjustTexelForAddressRepeat(p vec2) vec2 {
func adjustSrcPosForAddressRepeat(p vec2) vec2 {
origin := imageSrc0Origin()
size := imageSrc0Size()
return mod(p - origin, size) + origin
@ -74,15 +74,15 @@ func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
{{else if eq .Address .AddressClampToZero}}
clr := imageSrc0At(srcPos)
{{else if eq .Address .AddressRepeat}}
clr := imageSrc0At(adjustTexelForAddressRepeat(srcPos))
clr := imageSrc0At(adjustSrcPosForAddressRepeat(srcPos))
{{end}}
{{else if eq .Filter .FilterLinear}}
p0 := srcPos - 1/2.0
p1 := srcPos + 1/2.0
{{if eq .Address .AddressRepeat}}
p0 = adjustTexelForAddressRepeat(p0)
p1 = adjustTexelForAddressRepeat(p1)
p0 = adjustSrcPosForAddressRepeat(p0)
p1 = adjustSrcPosForAddressRepeat(p1)
{{end}}
{{if eq .Address .AddressUnsafe}}