Testing
|
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 525 B |
|
Before Width: | Height: | Size: 889 B After Width: | Height: | Size: 863 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 811 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 760 B |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 563 B After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 769 B |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 891 B After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 154 B |
@@ -97,7 +97,7 @@ def area_of_rectangles(rectangles):
|
||||
|
||||
|
||||
def generate_building(image: str | Image.Image, heightmap: str | Image.Image, output: str = './world_maker/data/building.png',
|
||||
number_of_try: int = 1, min_width: int = 10, max_width: int = 25):
|
||||
number_of_try: int = 3, min_width: int = 10, max_width: int = 25):
|
||||
print("[Building] Start generating building position...")
|
||||
image = handle_import_image(image).convert('L')
|
||||
rectangles_output = []
|
||||
|
||||
@@ -46,7 +46,7 @@ def world_maker():
|
||||
'./world_maker/data/mountain_map.png').save('./world_maker/data/city_map.png')
|
||||
|
||||
rectangle_building = generate_building(
|
||||
'./world_maker/data/city_map.png', './world_maker/data/heightmap.png', output='./world_maker/data/building.png')
|
||||
'./world_maker/data/city_map.png', './world_maker/data/heightmap.png', output='./world_maker/data/building.png', min_width=16, max_width=30)
|
||||
rectangle_building = rectangle_2D_to_3D(rectangle_building)
|
||||
|
||||
# Houses
|
||||
@@ -60,7 +60,8 @@ def world_maker():
|
||||
|
||||
rectangle_mountain = generate_building(
|
||||
'./world_maker/data/mountain_map.png', './world_maker/data/heightmap.png', output='./world_maker/data/building_moutain.png')
|
||||
rectangle_mountain = rectangle_2D_to_3D(rectangle_mountain)
|
||||
rectangle_mountain = rectangle_2D_to_3D(
|
||||
rectangle_mountain)
|
||||
|
||||
# Road
|
||||
heightmap_smooth_2 = filter_smooth(heightmap, 4)
|
||||
|
||||