fix some wrong map rendering
This commit is contained in:
parent
cef4a5dbfe
commit
47fd5cc2ec
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ go 1.20
|
|||
replace github.com/sandertv/gophertunnel => github.com/olebeck/gophertunnel v1.28.1-1
|
||||
|
||||
//replace github.com/df-mc/dragonfly => ./dragonfly
|
||||
replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.9.3-9
|
||||
replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.9.3-10
|
||||
|
||||
replace gioui.org => github.com/olebeck/gio v0.0.0-20230321105529-d424f1a59af9
|
||||
|
||||
|
|
2
go.sum
2
go.sum
|
@ -96,6 +96,8 @@ github.com/olebeck/dragonfly v0.9.3-8 h1:w514gGVTK2iv3TDI8EuzSCDHrF2Hv2f+/lIicW0
|
|||
github.com/olebeck/dragonfly v0.9.3-8/go.mod h1:nnnmYWgSTNQb9x33nBthqN/2vyHlUaijfo+e2y3W5j4=
|
||||
github.com/olebeck/dragonfly v0.9.3-9 h1:S386vtOMbS82cuJnTvYsbGYhaQksEMyfkd8JPRtx9Qk=
|
||||
github.com/olebeck/dragonfly v0.9.3-9/go.mod h1:nnnmYWgSTNQb9x33nBthqN/2vyHlUaijfo+e2y3W5j4=
|
||||
github.com/olebeck/dragonfly v0.9.3-10 h1:USruaK+8c3gsX9CtDzInLbwsdoZxcYjmnC8t/H4/Zjw=
|
||||
github.com/olebeck/dragonfly v0.9.3-10/go.mod h1:nnnmYWgSTNQb9x33nBthqN/2vyHlUaijfo+e2y3W5j4=
|
||||
github.com/olebeck/gio v0.0.0-20230321105529-d424f1a59af9 h1:TqDsMHwjW5ZYfh+RE8ussT62m0qXqo+QjzSXb7BCVA4=
|
||||
github.com/olebeck/gio v0.0.0-20230321105529-d424f1a59af9/go.mod h1:+W1Kpf96YcfissZocFqIp6O42FDTuphkObbEybp+Ffc=
|
||||
github.com/olebeck/gophertunnel v1.27.4-3 h1:RktAdTNTvCFn6PQou0H3RyqrTo3/xH0bqODrHb/oXAs=
|
||||
|
|
|
@ -29,27 +29,29 @@ func blockColorAt(c *chunk.Chunk, x uint8, y int16, z uint8) (blockColor color.R
|
|||
} else {
|
||||
b, found := world.BlockByRuntimeID(rid)
|
||||
if found {
|
||||
if !isBlockLightblocking(b) {
|
||||
return blockColorAt(c, x, y-1, z)
|
||||
}
|
||||
_, isWater := b.(block.Water)
|
||||
if !isWater {
|
||||
return b.Color()
|
||||
}
|
||||
// get the first non water block at the position
|
||||
heightBlock := c.HeightMap().At(x, z)
|
||||
depth := y - heightBlock
|
||||
if depth > 0 {
|
||||
blockColor = blockColorAt(c, x, heightBlock, z)
|
||||
}
|
||||
if _, isWater := b.(block.Water); isWater {
|
||||
// get the first non water block at the position
|
||||
heightBlock := c.HeightMap().At(x, z)
|
||||
depth := y - heightBlock
|
||||
if depth > 0 {
|
||||
blockColor = blockColorAt(c, x, heightBlock, z)
|
||||
}
|
||||
|
||||
// blend that blocks color with water depending on depth
|
||||
waterColor := (&block.Water{}).Color()
|
||||
waterColor.A = uint8(utils.Clamp(int(150+depth*7), 255))
|
||||
blockColor = utils.BlendColors(blockColor, waterColor)
|
||||
blockColor.R -= uint8(depth * 2)
|
||||
blockColor.G -= uint8(depth * 2)
|
||||
blockColor.B -= uint8(depth * 2)
|
||||
// blend that blocks color with water depending on depth
|
||||
waterColor := (&block.Water{}).Color()
|
||||
waterColor.A = uint8(utils.Clamp(int(150+depth*7), 255))
|
||||
blockColor = utils.BlendColors(blockColor, waterColor)
|
||||
blockColor.R -= uint8(depth * 2)
|
||||
blockColor.G -= uint8(depth * 2)
|
||||
blockColor.B -= uint8(depth * 2)
|
||||
return blockColor
|
||||
} else {
|
||||
col := b.Color()
|
||||
if col.A != 255 {
|
||||
col = utils.BlendColors(blockColorAt(c, x, y-1, z), col)
|
||||
}
|
||||
return col
|
||||
}
|
||||
}
|
||||
/*
|
||||
if blockColor.R == 0 || blockColor.R == 255 && blockColor.B == 255 {
|
||||
|
|
Loading…
Reference in New Issue