When an tile is rendered the writing to disk can be done in background

concurrently to the rendering of the next tile.
This commit is contained in:
Sascha L. Teichmann
2017-03-06 15:43:30 +01:00
parent 2cba483d32
commit 6a1356f0eb
5 changed files with 118 additions and 58 deletions

View File

@ -7,7 +7,6 @@ package common
import (
"image"
"image/color"
"image/draw"
"math"
)
@ -59,6 +58,10 @@ func (r *Renderer) SetPos(xOfs, zOfs int16) {
r.zOfs = zOfs
}
func (r *Renderer) GetPos() (int16, int16) {
return r.xOfs, r.zOfs
}
func (r *Renderer) initBuffers() {
yb := r.yBuffer
yb = yb[:len(yb)]
@ -269,12 +272,6 @@ func safeColor(x int32) uint8 {
}
}
func BackgroundImage(width, height int, bg color.RGBA) *image.RGBA {
m := image.NewRGBA(image.Rect(0, 0, width, height))
draw.Draw(m, m.Bounds(), &image.Uniform{bg}, image.ZP, draw.Src)
return m
}
func (r *Renderer) CreateShadedImage(
xOfs, zOfs, width, height int,
cols *Colors, background color.RGBA) *image.RGBA {