mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-11 09:20:17 +01:00
Do multiple queries in descending y order to make better use of the block rejection.
This commit is contained in:
parent
ab767a97bb
commit
e2070c8b94
@ -59,20 +59,28 @@ func main() {
|
||||
|
||||
q1x, q1y, q1z := int16(x), int16(y), int16(z)
|
||||
q2x, q2y, q2z := q1x+int16(width)-1, q1y+int16(depth)-1, q1z+int16(height)-1
|
||||
c1 := common.Coord{X: q1x, Y: q1y, Z: q1z}
|
||||
c2 := common.Coord{X: q2x, Y: q2y, Z: q2z}
|
||||
cuboid := common.Cuboid{P1: common.MinCoord(c1, c2), P2: common.MaxCoord(c1, c2)}
|
||||
|
||||
renderer := NewRenderer(q1x, q1z, width, height)
|
||||
|
||||
numBlocks := 0
|
||||
drawBlock := func(block *common.Block) {
|
||||
if err := renderer.RenderBlock(block, colors.NameIndex); err != nil {
|
||||
log.Printf("WARN: rendering block failed: %s", err)
|
||||
}
|
||||
numBlocks++
|
||||
}
|
||||
|
||||
if err = client.QueryCuboid(cuboid, drawBlock); err != nil {
|
||||
log.Fatalf("query failed: %s", err)
|
||||
c1 := common.Coord{X: q1x, Z: q1z}
|
||||
c2 := common.Coord{X: q2x, Z: q2z}
|
||||
for c2.Y = q2y; c2.Y > q1y; c2.Y -= 16 {
|
||||
c1.Y = c2.Y - 15
|
||||
if c1.Y < q1y {
|
||||
c1.Y = q1y
|
||||
}
|
||||
cuboid := common.Cuboid{P1: common.MinCoord(c1, c2), P2: common.MaxCoord(c1, c2)}
|
||||
if err = client.QueryCuboid(cuboid, drawBlock); err != nil {
|
||||
log.Fatalf("query failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
image := renderer.CreateImage(
|
||||
@ -83,4 +91,5 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Printf("Rejected blocks: %d\n", renderer.RejectedBlocks)
|
||||
fmt.Printf("num blocks: %d\n", numBlocks)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user