Put everything inside of main

This commit is contained in:
NichiHachi
2024-06-15 22:25:39 +02:00
parent f53d0d7402
commit f5201bc146
15 changed files with 29 additions and 73 deletions

View File

@@ -1,8 +1,8 @@
from District import District, Road
from Position import Position
from world_maker.District import District, Road
from world_maker.Position import Position
from PIL import Image
from random import randint
from data_analysis import handle_import_image, detect_mountain
from world_maker.data_analysis import handle_import_image, detect_mountain
from typing import Union
import numpy as np

View File

@@ -1,4 +1,4 @@
from Position import Position
from world_maker.Position import Position
from typing import Union
from random import randint
from PIL import Image

View File

@@ -1,7 +1,7 @@
from gdpc import Editor, geometry, lookup
import numpy as np
from PIL import Image
from Block import Block
from world_maker.Block import Block
waterBiomes = [
"minecraft:ocean",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,8 +1,8 @@
import World
from world_maker.World import World
from PIL import Image, ImageFilter
import numpy as np
from scipy import ndimage
from Skeleton import Skeleton
from world_maker.Skeleton import Skeleton
from typing import Union
from random import randint
import cv2

View File

@@ -1,7 +1,7 @@
from PIL import Image
import numpy as np
from typing import Union
from data_analysis import handle_import_image
from world_maker.data_analysis import handle_import_image
from random import randint

View File

@@ -1,18 +1,18 @@
import World
from world_maker.World import World
from PIL import Image
from data_analysis import get_data,filter_negative, rectangle_2D_to_3D, skeleton_mountain_map, highway_map, filter_sobel, skeleton_highway_map, \
smooth_sobel_water, subtract_map, detect_mountain
from City import City
from Position import Position
from world_maker.data_analysis import (get_data,filter_negative, rectangle_2D_to_3D, skeleton_mountain_map, highway_map, filter_sobel, skeleton_highway_map, \
smooth_sobel_water, subtract_map, detect_mountain)
from world_maker.City import City
from world_maker.Position import Position
from random import randint
from pack_rectangle import generate_building
from world_maker.pack_rectangle import generate_building
if __name__ == '__main__':
#world = World.World()
#heightmap, watermap, treemap = get_data(world)
#filter_sobel("./world_maker/data/heightmap.png").save('./world_maker/data/sobelmap.png')
smooth_sobel_water = smooth_sobel_water()
skeleton_highway_map(highway_map())
def world_maker():
world = World()
heightmap, watermap, treemap = get_data(world)
filter_sobel("./world_maker/data/heightmap.png").save('./world_maker/data/sobelmap.png')
smooth_sobel_water_map = smooth_sobel_water()
skeleton_highway = skeleton_highway_map(highway_map())
city = City()
city.generate_district()
city.loop_expend_district()
@@ -21,13 +21,14 @@ if __name__ == '__main__':
image_mountain_map = city.get_district_mountain_map()
road = city.draw_roads(4)
road.save('./world_maker/data/roadmap.png')
subtract_map(smooth_sobel_water, road).save('./world_maker/data/city_map.png')
subtract_map(smooth_sobel_water_map, road).save('./world_maker/data/city_map.png')
subtract_map('./world_maker/data/city_map.png', './world_maker/data/skeleton_highway_area.png').save('./world_maker/data/city_map.png')
subtract_map('./world_maker/data/city_map.png', './world_maker/data/mountain_map.png').save('./world_maker/data/city_map.png')
rectangle_building = generate_building('./world_maker/data/city_map.png')
rectangle_building = rectangle_2D_to_3D(rectangle_building)
skeleton_mountain_map(image_mountain_map)
skeleton_mountain = skeleton_mountain_map(image_mountain_map)
subtract_map('./world_maker/data/mountain_map.png', './world_maker/data/skeleton_mountain_area.png').save('./world_maker/data/mountain_map.png')
subtract_map(smooth_sobel_water, filter_negative('./world_maker/data/mountain_map.png')).save('./world_maker/data/mountain_map.png')
subtract_map(smooth_sobel_water_map, filter_negative('./world_maker/data/mountain_map.png')).save('./world_maker/data/mountain_map.png')
rectangle_mountain = generate_building('./world_maker/data/mountain_map.png')
return rectangle_building, rectangle_mountain, skeleton_highway, skeleton_mountain