diff --git a/tilemapper/renderer.go b/tilemapper/renderer.go index 9c2d6f5..f79e522 100644 --- a/tilemapper/renderer.go +++ b/tilemapper/renderer.go @@ -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++ {