Final adjustment to forest and farmland rendering.

This commit is contained in:
Marcus Str. 2025-02-02 22:50:40 +01:00
parent 6b66715334
commit 6bfec00846

View File

@ -420,6 +420,19 @@ class mstr_layergen:
frst_pix[nx,ny] = nc
frst_noise = frst_noise.filter(ImageFilter.GaussianBlur(radius=1))
layer.alpha_composite(frst_noise)
# Same for farmlands... but not as intensive
if (self._tag == "landuse" and self._value == "farmland") or (self._tag == "landuse" and self._value == "farmyard"):
frst_noise = Image.new("RGBA", (self._imgsize, self._imgsize))
frst_pix = frst_noise.load()
for n in range(0, 1500000):
nx = randrange(0, self._imgsize)
ny = randrange(0, self._imgsize)
na = randrange(25, 65)
nc = (0,0,0,na)
frst_pix[nx,ny] = nc
frst_noise = frst_noise.filter(ImageFilter.GaussianBlur(radius=1))
layer.alpha_composite(frst_noise)
mstr_msg("layergen", "Layer image generated")
@ -431,7 +444,7 @@ class mstr_layergen:
self._tag == "natural" and self._value == "heath") or (
self._tag == "landuse" and self._value == "cemetery") or (
self._tag == "landuse" and self._value == "residential"):
amt = randrange(150, 301)
amt = randrange(50,101)
masks = glob.glob(mstr_datafolder + "textures/tile/completion/*.png")
patchtags = [
["landuse", "meadow"],
@ -442,8 +455,8 @@ class mstr_layergen:
for i in range(1, amt + 1):
layerpatch = Image.open(mstr_datafolder + "textures/tile/completion_color/p" + str(randrange(1,14)) + ".png")
if self._zoomlevel == 16:
lpw = int(layerpatch.width/4)
lph = int(layerpatch.height/4)
lpw = int(layerpatch.width/3)
lph = int(layerpatch.height/3)
layerpatch = layerpatch.resize((lpw,lph), resample=Image.Resampling.BILINEAR)
layerpatch = layerpatch.rotate(randrange(0, 360), expand=True)
lx = randrange(0, mstr_photores-layerpatch.width)