1
0
forked from MTSR/mapserver

transparency flag

This commit is contained in:
NatureFreshMilk 2019-02-27 17:36:30 +01:00
parent ce44b5b8c4
commit 873843ee54
2 changed files with 12 additions and 8 deletions

View File

@ -13,6 +13,7 @@ type Config struct {
Port int `json:"port"`
EnablePrometheus bool `json:"enableprometheus"`
EnableRendering bool `json:"enablerendering"`
EnableTransparency bool `json:"enabletransparency"`
Webdev bool `json:"webdev"`
WebApi *WebApiConfig `json:"webapi"`
Layers []*layer.Layer `json:"layers"`
@ -133,6 +134,7 @@ func ParseConfig(filename string) (*Config, error) {
Port: 8080,
EnableRendering: true,
EnablePrometheus: true,
EnableTransparency: true,
Webdev: false,
WebApi: &webapi,
Layers: layers,

View File

@ -15,16 +15,18 @@ import (
)
type MapBlockRenderer struct {
accessor *mapblockaccessor.MapBlockAccessor
colors *colormapping.ColorMapping
enableShadow bool
accessor *mapblockaccessor.MapBlockAccessor
colors *colormapping.ColorMapping
enableShadow bool
enableTransparency bool
}
func NewMapBlockRenderer(accessor *mapblockaccessor.MapBlockAccessor, colors *colormapping.ColorMapping) *MapBlockRenderer {
return &MapBlockRenderer{
accessor: accessor,
colors: colors,
enableShadow: true,
accessor: accessor,
colors: colors,
enableShadow: true,
enableTransparency: false,
}
}
@ -211,12 +213,12 @@ func (r *MapBlockRenderer) Render(pos1, pos2 *coords.MapBlockCoords) (*image.NRG
imgX+IMG_SCALE, imgY+IMG_SCALE,
)
if c.A != 0xFF {
if c.A != 0xFF || !r.enableTransparency {
//not transparent, mark as rendered
foundBlocks++
xzOccupationMap[x][z] = true
}
draw.Draw(img, rect, &image.Uniform{c}, image.ZP, draw.Src)
if foundBlocks == EXPECTED_BLOCKS_PER_FLAT_MAPBLOCK {