Render transparent tiles if command line flag is set.

This commit is contained in:
Sascha L. Teichmann
2014-10-26 18:36:47 +01:00
parent 2aa9ee0e24
commit 8452a26fcd
8 changed files with 198 additions and 77 deletions

View File

@ -23,6 +23,7 @@ func main() {
colorsfile string
outfile string
shaded bool
transparent bool
)
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
@ -41,6 +42,7 @@ func main() {
flag.StringVar(&outfile, "output", "out.png", "image file of result")
flag.StringVar(&outfile, "o", "out.png", "image file of result (shorthand)")
flag.BoolVar(&shaded, "shaded", true, "draw relief")
flag.BoolVar(&transparent, "transparent", false, "render transparent blocks")
flag.Parse()
@ -70,7 +72,7 @@ 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
renderer := common.NewRenderer(width, height)
renderer := common.NewRenderer(width, height, transparent)
renderer.SetPos(q1x, q1z)
yOrder := common.NewYOrder(renderer, 512)
@ -106,7 +108,7 @@ func main() {
if shaded {
image = renderer.CreateShadedImage(
16, 16, (width-2)*16, (height-2)*16,
colors.Colors, color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff})
colors, color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff})
} else {
image = renderer.CreateImage(
colors.Colors, color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff})