mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 08:40:18 +01:00
unexport common area type
This commit is contained in:
parent
1df81c3e1d
commit
79d36d6dd8
@ -8,20 +8,20 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Area struct {
|
type area struct {
|
||||||
X1, Z1 int16
|
X1, Z1 int16
|
||||||
X2, Z2 int16
|
X2, Z2 int16
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Area) contains(x, z int16) bool {
|
func (a area) contains(x, z int16) bool {
|
||||||
return x >= a.X1 && x <= a.X2 && z >= a.Z1 && z <= a.Z2
|
return x >= a.X1 && x <= a.X2 && z >= a.Z1 && z <= a.Z2
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Area) higher() bool {
|
func (a area) higher() bool {
|
||||||
return a.Z2-a.Z1 > a.X2-a.X1
|
return a.Z2-a.Z1 > a.X2-a.X1
|
||||||
}
|
}
|
||||||
|
|
||||||
func areasContain(areas []Area, x, z int16) bool {
|
func areasContain(areas []area, x, z int16) bool {
|
||||||
for _, r := range areas {
|
for _, r := range areas {
|
||||||
if r.contains(x, z) {
|
if r.contains(x, z) {
|
||||||
return true
|
return true
|
||||||
@ -37,7 +37,7 @@ func areasContain(areas []Area, x, z int16) bool {
|
|||||||
// to newAreas which ist return.
|
// to newAreas which ist return.
|
||||||
// This is useful to spatial query only blocks from db
|
// This is useful to spatial query only blocks from db
|
||||||
// that are not below already rendered blocks.
|
// that are not below already rendered blocks.
|
||||||
func (a Area) recalculate(r *Renderer, nareas []Area) []Area {
|
func (a area) recalculate(r *Renderer, nareas []area) []area {
|
||||||
yM := r.yMin
|
yM := r.yMin
|
||||||
|
|
||||||
const ex = 1
|
const ex = 1
|
||||||
@ -52,7 +52,7 @@ func (a Area) recalculate(r *Renderer, nareas []Area) []Area {
|
|||||||
if yM[row+x] > math.MinInt32 || areasContain(nareas[nas:], x, z) {
|
if yM[row+x] > math.MinInt32 || areasContain(nareas[nas:], x, z) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ar := Area{X1: x, Z1: z, X2: x, Z2: z}
|
ar := area{X1: x, Z1: z, X2: x, Z2: z}
|
||||||
// Try to extend the area in x and/or z till no further extension is possible.
|
// Try to extend the area in x and/or z till no further extension is possible.
|
||||||
ext:
|
ext:
|
||||||
for extend := ex | ez; extend != 0; {
|
for extend := ex | ez; extend != 0; {
|
||||||
|
@ -111,10 +111,10 @@ func (btc *BaseTileCreator) RenderArea(x, z int16) error {
|
|||||||
|
|
||||||
var c1, c2 Coord
|
var c1, c2 Coord
|
||||||
|
|
||||||
nareas := make([]Area, 0, tileWidth*tileHeight/2)
|
nareas := make([]area, 0, tileWidth*tileHeight/2)
|
||||||
areas := make([]Area, 1, tileWidth*tileHeight/2)
|
areas := make([]area, 1, tileWidth*tileHeight/2)
|
||||||
|
|
||||||
areas[0] = Area{
|
areas[0] = area{
|
||||||
X1: 0, Z1: 0,
|
X1: 0, Z1: 0,
|
||||||
X2: int16(tileWidth) - 1, Z2: int16(tileHeight) - 1}
|
X2: int16(tileWidth) - 1, Z2: int16(tileHeight) - 1}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user