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