examples/airship: Improve z values

This commit is contained in:
Hajime Hoshi 2018-03-12 03:18:07 +09:00
parent a335b0c5a3
commit a36ea971b4
2 changed files with 5 additions and 3 deletions

View File

@ -195,12 +195,12 @@ func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) {
gw, _ := ground.Size() gw, _ := ground.Size()
pw, ph := perspectiveGroundImage.Size() pw, ph := perspectiveGroundImage.Size()
for j := 0; j < ph; j++ { for j := 0; j < ph; j++ {
// z is in [1.5, 0.01] // z is in [1, -1]
rate := float64(j) / float64(ph) rate := float64(j) / float64(ph)
z := (1-rate)*1.5 + rate*0.01 z := (1-rate)*1 + rate*-1
op := &ebiten.DrawImageOptions{} op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(-float64(pw)/2, 0) op.GeoM.Translate(-float64(pw)/2, 0)
op.GeoM.Scale(1/z, 4) // 4 is an arbitrary number not to make empty lines. op.GeoM.Scale(1/z, 8) // 8 is an arbitrary number not to make empty lines.
op.GeoM.Translate(float64(pw)/2, float64(j)/z) op.GeoM.Translate(float64(pw)/2, float64(j)/z)
src := image.Rect(0, j, gw, j+1) src := image.Rect(0, j, gw, j+1)

View File

@ -439,6 +439,8 @@ func newImageWithScreenFramebuffer(width, height int) *Image {
return i return i
} }
var GuaranteedMaxImageSize = 4096
// MaxImageSize is deprecated as of 1.7.0-alpha. No replacement so far. // MaxImageSize is deprecated as of 1.7.0-alpha. No replacement so far.
// //
// TODO: Make this replacement (#541) // TODO: Make this replacement (#541)