Fixed tilerenderer.

This commit is contained in:
Sascha L. Teichmann 2014-09-11 22:38:01 +02:00
parent 09b321de02
commit 6306a9acb7

View File

@ -50,7 +50,8 @@ func NewRenderer(xOfs, zOfs int16, width, height int) (renderer *Renderer) {
xOfs: xOfs,
zOfs: zOfs,
yBuffer: yBuffer,
cBuffer: cBuffer}
cBuffer: cBuffer,
yMin: yMin}
return
}
@ -65,11 +66,9 @@ func (r *Renderer) RenderBlock(block *common.Block, nameIndex map[string]int32)
// We do not need to render the block if the whole 16x16 area
// is already filled and the block is strictly below.
w := r.width << 4
ofs := int(bz)*w<<4 + int(bx)<<4
blockY := int32(block.Coord.Y) << 4
pos := int(bz)*r.width + int(bx)
//fmt.Printf("pos: %d %d\n", pos, len(r.yMin))
if blockY < r.yMin[pos] {
r.Rejected++
return
@ -81,6 +80,9 @@ func (r *Renderer) RenderBlock(block *common.Block, nameIndex map[string]int32)
return
}
w := r.width << 4
ofs := int(bz)*w<<4 + int(bx)<<4
yMin := int32(math.MaxInt32)
for z := 0; z < 16; z++ {
for x := 0; x < 16; x++ {