]> marstr Code Repo - marstr/orthographic.git/commitdiff
Final adjustment to forest and farmland rendering.
authorMarcus Str. <marcus@marstr.online>
Sun, 2 Feb 2025 21:50:40 +0000 (22:50 +0100)
committerMarcus Str. <marcus@marstr.online>
Sun, 2 Feb 2025 21:50:40 +0000 (22:50 +0100)
layergen.py

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