mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-11 01:10:17 +01:00
Simplified mask embedding in parent calculation of pyramid tiles.
This commit is contained in:
parent
da2a6a82d4
commit
496a60aa29
@ -54,7 +54,7 @@ type xzc struct {
|
||||
}
|
||||
|
||||
type xzm struct {
|
||||
P xz
|
||||
xz
|
||||
Mask uint16
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ func (c xz) parent() xzm {
|
||||
xp, xr := c.X>>1, uint16(c.X&1)
|
||||
zp, zr := c.Z>>1, uint16(c.Z&1)
|
||||
return xzm{
|
||||
P: xz{X: xp, Z: zp},
|
||||
Mask: 1 << (zr<<1 | xr)}
|
||||
xz{X: xp, Z: zp},
|
||||
1 << (zr<<1 | xr)}
|
||||
}
|
||||
|
||||
func newTileUpdater(
|
||||
@ -224,7 +224,7 @@ func (tu *tileUpdater) doUpdates() {
|
||||
parentJobs := make(map[xz]uint16)
|
||||
for i := range actChs {
|
||||
pxz := actChs[i].parent()
|
||||
parentJobs[pxz.P] |= pxz.Mask
|
||||
parentJobs[pxz.xz] |= pxz.Mask
|
||||
}
|
||||
|
||||
for level := 7; level >= 0; level-- {
|
||||
@ -235,9 +235,9 @@ func (tu *tileUpdater) doUpdates() {
|
||||
}
|
||||
ppJobs := make(map[xz]uint16)
|
||||
for c, mask := range parentJobs {
|
||||
pJobs <- xzm{P: c, Mask: mask}
|
||||
pJobs <- xzm{c, mask}
|
||||
pxz := c.parent()
|
||||
ppJobs[pxz.P] |= pxz.Mask
|
||||
ppJobs[pxz.xz] |= pxz.Mask
|
||||
}
|
||||
close(pJobs)
|
||||
done.Wait()
|
||||
@ -291,8 +291,8 @@ func (tu *tileUpdater) updatePyramidTile(scratch, resized *image.RGBA, level int
|
||||
origPath := filepath.Join(
|
||||
tu.mapDir,
|
||||
strconv.Itoa(level),
|
||||
strconv.Itoa(int(j.P.X)),
|
||||
strconv.Itoa(int(j.P.Z))+".png")
|
||||
strconv.Itoa(int(j.X)),
|
||||
strconv.Itoa(int(j.Z))+".png")
|
||||
|
||||
sr := resized.Bounds()
|
||||
levelDir := strconv.Itoa(level + 1)
|
||||
@ -300,7 +300,7 @@ func (tu *tileUpdater) updatePyramidTile(scratch, resized *image.RGBA, level int
|
||||
if j.Mask&(1<<i) != 0 {
|
||||
//log.Printf("level %d: modified %d\n", level, i)
|
||||
o := ofs[i]
|
||||
bx, bz := int(2*j.P.X), int(2*j.P.Z)
|
||||
bx, bz := int(2*j.X), int(2*j.Z)
|
||||
path := filepath.Join(
|
||||
tu.mapDir,
|
||||
levelDir,
|
||||
|
Loading…
Reference in New Issue
Block a user