diff --git a/world_maker/data/building_moutain.png b/world_maker/data/building_moutain.png index 25fedbb..aa920ae 100644 Binary files a/world_maker/data/building_moutain.png and b/world_maker/data/building_moutain.png differ diff --git a/world_maker/data/city_map.png b/world_maker/data/city_map.png index 2dca294..16d5ffa 100644 Binary files a/world_maker/data/city_map.png and b/world_maker/data/city_map.png differ diff --git a/world_maker/data/district.png b/world_maker/data/district.png index fff7286..fcc6821 100644 Binary files a/world_maker/data/district.png and b/world_maker/data/district.png differ diff --git a/world_maker/data/heightmap.png b/world_maker/data/heightmap.png index 5da15f8..70cc3a6 100644 Binary files a/world_maker/data/heightmap.png and b/world_maker/data/heightmap.png differ diff --git a/world_maker/data/heightmap_smooth.png b/world_maker/data/heightmap_smooth.png index 62999a1..1282d61 100644 Binary files a/world_maker/data/heightmap_smooth.png and b/world_maker/data/heightmap_smooth.png differ diff --git a/world_maker/data/heightmap_with_building.png b/world_maker/data/heightmap_with_building.png index d6902ee..bab97c0 100644 Binary files a/world_maker/data/heightmap_with_building.png and b/world_maker/data/heightmap_with_building.png differ diff --git a/world_maker/data/highwaymap.png b/world_maker/data/highwaymap.png index 9de071a..896f10b 100644 Binary files a/world_maker/data/highwaymap.png and b/world_maker/data/highwaymap.png differ diff --git a/world_maker/data/mountain_map.png b/world_maker/data/mountain_map.png index 67a6fe6..3ef750a 100644 Binary files a/world_maker/data/mountain_map.png and b/world_maker/data/mountain_map.png differ diff --git a/world_maker/data/removed_treesmap.png b/world_maker/data/removed_treesmap.png index 35dd1f5..dabd1f7 100644 Binary files a/world_maker/data/removed_treesmap.png and b/world_maker/data/removed_treesmap.png differ diff --git a/world_maker/data/skeleton_highway.png b/world_maker/data/skeleton_highway.png index cd2f09f..13a1ae8 100644 Binary files a/world_maker/data/skeleton_highway.png and b/world_maker/data/skeleton_highway.png differ diff --git a/world_maker/data/skeleton_mountain.png b/world_maker/data/skeleton_mountain.png index 4c93e1d..dcdcf2b 100644 Binary files a/world_maker/data/skeleton_mountain.png and b/world_maker/data/skeleton_mountain.png differ diff --git a/world_maker/data/skeleton_mountain_area.png b/world_maker/data/skeleton_mountain_area.png index c9b40c2..5a025e6 100644 Binary files a/world_maker/data/skeleton_mountain_area.png and b/world_maker/data/skeleton_mountain_area.png differ diff --git a/world_maker/data/smooth_sobel_watermap.png b/world_maker/data/smooth_sobel_watermap.png index 196fd0a..2027431 100644 Binary files a/world_maker/data/smooth_sobel_watermap.png and b/world_maker/data/smooth_sobel_watermap.png differ diff --git a/world_maker/data/smooth_terrain_delta.png b/world_maker/data/smooth_terrain_delta.png index 0465ede..dfd1969 100644 Binary files a/world_maker/data/smooth_terrain_delta.png and b/world_maker/data/smooth_terrain_delta.png differ diff --git a/world_maker/data/sobelmap.png b/world_maker/data/sobelmap.png index 7b3b89b..1d9ca7a 100644 Binary files a/world_maker/data/sobelmap.png and b/world_maker/data/sobelmap.png differ diff --git a/world_maker/data/treemap.png b/world_maker/data/treemap.png index 3875abb..7bd52e0 100644 Binary files a/world_maker/data/treemap.png and b/world_maker/data/treemap.png differ diff --git a/world_maker/data/watermap.png b/world_maker/data/watermap.png index e882724..abac2de 100644 Binary files a/world_maker/data/watermap.png and b/world_maker/data/watermap.png differ diff --git a/world_maker/data_analysis.py b/world_maker/data_analysis.py index b5c228c..e6c3a1b 100644 --- a/world_maker/data_analysis.py +++ b/world_maker/data_analysis.py @@ -169,13 +169,13 @@ def overide_map(base: Image, top: Image) -> Image: for x in range(width): for y in range(height): - pixel1 = base.getpixel((x, y)) - pixel2 = top.getpixel((x, y)) + base_pixel = base.getpixel((x, y)) + top_pixel = top.getpixel((x, y)) - if pixel1 != 0: - result_image.putpixel((x, y), pixel1) + if top_pixel != 0: + result_image.putpixel((x, y), top_pixel) else: - result_image.putpixel((x, y), pixel2) + result_image.putpixel((x, y), base_pixel) return result_image @@ -247,7 +247,8 @@ def create_volume(surface: np.ndarray, heightmap: np.ndarray, make_it_flat: bool def convert_2D_to_3D(image: Union[str, Image], make_it_flat: bool = False) -> np.ndarray: image = handle_import_image(image) - heightmap = Image.open('./world_maker/data/heightmap.png').convert('L') + heightmap = Image.open( + './world_maker/data/heightmap_smooth.png').convert('L') heightmap = np.array(heightmap) surface = np.array(image) volume = create_volume(surface, heightmap, make_it_flat) diff --git a/world_maker/pack_rectangle.py b/world_maker/pack_rectangle.py index 79afe60..c279d94 100644 --- a/world_maker/pack_rectangle.py +++ b/world_maker/pack_rectangle.py @@ -97,9 +97,14 @@ def draw_rectangles(rectangles, grid, heightmap): image = Image.new('L', (len(grid[0]), len(grid)), (0)) for rectangle in rectangles: start, end = rectangle + height = [] for x in range(start[0], end[0]): for y in range(start[1], end[1]): - image.putpixel((x, y), heightmap.getpixel((x, y))) + height.append(heightmap.getpixel((x, y))) + height_average = sum(height)/len(height) + for x in range(start[0], end[0]): + for y in range(start[1], end[1]): + image.putpixel((x, y), round(height_average)) return image diff --git a/world_maker/world_maker.py b/world_maker/world_maker.py index 2210234..e393c3e 100644 --- a/world_maker/world_maker.py +++ b/world_maker/world_maker.py @@ -12,9 +12,6 @@ def world_maker(): world = World() heightmap, watermap, treemap = get_data(world) - filter_smooth( - './world_maker/data/heightmap.png', 4).save('./world_maker/data/heightmap_smooth.png') - filter_sobel( "./world_maker/data/heightmap.png").save('./world_maker/data/sobelmap.png') @@ -53,4 +50,18 @@ def world_maker(): './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') overide_map('./world_maker/data/heightmap_with_building.png', './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') + filter_smooth( + './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') + overide_map('./world_maker/data/heightmap_with_building.png', + './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') + overide_map('./world_maker/data/heightmap_with_building.png', + './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') + filter_smooth( + './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') + overide_map('./world_maker/data/heightmap_with_building.png', + './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') + overide_map('./world_maker/data/heightmap_with_building.png', + './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') + filter_smooth( + './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') return rectangle_mountain, rectangle_building, skeleton_highway, skeleton_mountain, road_grid