Collect more statistics about number of solid and transparent blocks and print them in mttilemapper.

This commit is contained in:
Sascha L. Teichmann 2014-10-26 17:09:23 +01:00
parent 99ff99a8f4
commit 2aa9ee0e24
2 changed files with 21 additions and 11 deletions

View File

@ -117,5 +117,7 @@ func main() {
}
log.Printf("num blocks: %d\n", numBlocks)
log.Printf("rejected blocks: %d\n", renderer.Rejected)
log.Printf("rejected blocks: %d\n", renderer.RejectedBlocks)
log.Printf("transparent blocks: %d\n", renderer.TransparentBlocks)
log.Printf("solid blocks: %d\n", renderer.SolidBlocks)
}

View File

@ -17,14 +17,16 @@ type Area struct {
}
type Renderer struct {
width int
height int
xOfs int16
zOfs int16
yBuffer []int32
yMin []int32
cBuffer []int32
Rejected int
width int
height int
xOfs int16
zOfs int16
yBuffer []int32
yMin []int32
cBuffer []int32
RejectedBlocks int
SolidBlocks int
TransparentBlocks int
}
type YOrder struct {
@ -172,7 +174,7 @@ func (r *Renderer) RenderBlock(block *Block, colors *Colors) (err error) {
blockY := int32(block.Coord.Y) << 4
pos := int(bz)*r.width + int(bx)
if blockY < r.yMin[pos] {
r.Rejected++
r.RejectedBlocks++
return
}
@ -183,10 +185,16 @@ func (r *Renderer) RenderBlock(block *Block, colors *Colors) (err error) {
}
if db.AirOnly {
r.Rejected++
r.RejectedBlocks++
return
}
if db.Transparent {
r.TransparentBlocks++
} else {
r.SolidBlocks++
}
w := r.width << 4
ofs := int(bz)*w<<4 + int(bx)<<4
yB := r.yBuffer