mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/airship: Improve z values
This commit is contained in:
parent
a335b0c5a3
commit
a36ea971b4
@ -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)
|
||||||
|
2
image.go
2
image.go
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user