Add depth to building map

This commit is contained in:
2024-06-16 20:47:27 +02:00
parent 66d6cd17e6
commit 8f3c92bd1d
24 changed files with 50 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ from world_maker.data_analysis import handle_import_image
def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask: Union[str, Image]):
print(["Remove tree"] Starting...)
print("[Remove tree] Starting...")
editor = Editor(buffering=True)
build_area = editor.getBuildArea()
build_rectangle = build_area.toRect()
@@ -44,7 +44,6 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask
for x in range(0, distance[0]):
for z in range(0, distance[1]):
print("removing tree in ", start[0] + x, start[1] + z)
if removed_treesmap.getpixel((x, z)) != 0:
y = heightmap.getpixel((x, z))
y_top = removed_treesmap.getpixel((x, z))
@@ -52,12 +51,12 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask
editor, (start[0] + x, y+1, start[1] + z), (start[0] + x, y_top, start[1] + z), Block('air'))
removed_treesmap.save('./world_maker/data/removed_treesmap.png')
print(["Remove tree"] Done.)
print("[Remove tree] Done.")
def smooth_terrain(heightmap: Union[str, Image], heightmap_smooth: Union[str, Image], mask: Union[str, Image]):
print(["Smooth terrain"] Starting...)
print("[Smooth terrain] Starting...")
editor = Editor()
build_area = editor.getBuildArea()
build_rectangle = build_area.toRect()
@@ -99,4 +98,4 @@ def smooth_terrain(heightmap: Union[str, Image], heightmap_smooth: Union[str, Im
editor, (start[0] + x, y, start[1] + z), (start[0] + x, y_smooth, start[1] + z), block)
smooth_terrain_delta.save('./world_maker/data/smooth_terrain_delta.png')
print(["Smoothing terrain"] Done.)
print("[Smooth terrain] Done.")