Production-ready change to building rendering
This commit is contained in:
parent
3bdf595173
commit
b29bc3b0d2
24
layergen.py
24
layergen.py
@ -704,14 +704,19 @@ class mstr_layergen:
|
||||
|
||||
# Patch and border sources. There can only be one for each.
|
||||
brd_src = None
|
||||
numbers = list(range(1, len(srclist)))
|
||||
res = random.sample(numbers, 4)
|
||||
ptc_src = []
|
||||
ptc_img = Image.open(mstr_datafolder + "textures/" + self._tag + "/" + self._value + "/" + str(srcnum) + ".png")
|
||||
|
||||
for p in range(0, len(res)):
|
||||
ptc_src.append(Image.open(mstr_datafolder + "textures/" + self._tag + "/" + self._value + "/" + str(res[p]) + ".png"))
|
||||
|
||||
# Set some contrast
|
||||
lyr_contrast = randrange(1, 4)
|
||||
lyr_contrast = 0.85
|
||||
|
||||
# Open the images
|
||||
ptc_src.append( ptc_img ) # Used to be an array, so let's keep it
|
||||
|
||||
#ptc_src.append( ptc_img ) # Used to be an array, so let's keep it
|
||||
#brd_src = bldg_src[1]
|
||||
|
||||
# Begin producing a largely random image
|
||||
@ -720,12 +725,13 @@ class mstr_layergen:
|
||||
imgid = 0
|
||||
if len(ptc_src) == 1: imgid = 0
|
||||
if len(ptc_src) >= 2:
|
||||
imgid = randrange(1, len(ptc_src) + 1) - 1
|
||||
l = 0 - int(ptc_src[imgid].width / 2)
|
||||
r = layer.width - int(ptc_src[imgid].width / 2)
|
||||
t = 0 - int(ptc_src[imgid].height / 2)
|
||||
b = layer.height - int(ptc_src[imgid].height / 2)
|
||||
bld_src.alpha_composite(ptc_src[imgid], (randrange(l, r), randrange(t, b)))
|
||||
imgid = randrange(0, len(ptc_src))
|
||||
i = ptc_src[imgid].rotate(randrange(0, 360), expand=True)
|
||||
l = 0 - int(i.width / 2)
|
||||
r = layer.width - int(i.width / 2)
|
||||
t = 0 - int(i.height / 2)
|
||||
b = layer.height - int(i.height / 2)
|
||||
bld_src.alpha_composite(i, (randrange(l, r), randrange(t, b)))
|
||||
mstr_msg("layergen", "Layer image generated")
|
||||
|
||||
bld_src_pix = bld_src.load()
|
||||
|
@ -225,7 +225,7 @@ class mstr_orthographic:
|
||||
osmxml.acquire_osm(grid_lat, grid_lng)
|
||||
|
||||
# Let the user know
|
||||
mstr_msg("orthographic", "Generating missing orthophoto " + str(grid_lat) + "-" + str(grid_lng))
|
||||
mstr_important_msg("orthographic", "Generating missing orthophoto " + str(grid_lat) + "-" + str(grid_lng))
|
||||
|
||||
# Check for work to be done
|
||||
layers = self.determineLayerWork(osmxml)
|
||||
|
@ -353,7 +353,7 @@ class mstr_photogen:
|
||||
lx = randrange(0, self._imgsize)
|
||||
ly = randrange(0, self._imgsize)
|
||||
lp = lyrmask[lx,ly]
|
||||
if lp[3] > 0:
|
||||
if lp[3] == 255:
|
||||
tree = self.generate_tree()
|
||||
trees.alpha_composite(tree, (lx, ly))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user