Fixed Alexandre
21
main.py
@@ -1,11 +1,18 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
|
import gdpc.exceptions
|
||||||
|
|
||||||
from world_maker.world_maker import *
|
from world_maker.world_maker import *
|
||||||
from House import *
|
from House import *
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
rectangle_house_mountain, rectangle_building, skeleton_highway, skeleton_mountain = world_maker()
|
rectangle_house_mountain, rectangle_building, skeleton_highway, skeleton_mountain = world_maker()
|
||||||
|
|
||||||
editor = Editor()
|
|
||||||
|
editor = Editor(buffering=True)
|
||||||
|
buildArea = editor.getBuildArea()
|
||||||
|
|
||||||
blocks = {
|
blocks = {
|
||||||
"wall": "blackstone",
|
"wall": "blackstone",
|
||||||
"roof": "blackstone",
|
"roof": "blackstone",
|
||||||
@@ -23,15 +30,18 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
entranceDirection = ["N", "S", "E", "W"]
|
entranceDirection = ["N", "S", "E", "W"]
|
||||||
|
|
||||||
|
|
||||||
for houses in rectangle_house_mountain:
|
for houses in rectangle_house_mountain:
|
||||||
house = House(editor, houses[0], houses[1], entranceDirection[random.randint(0, 3)], blocks)
|
start = (houses[0][0]+buildArea.begin[0], houses[0][1], houses[0][2]+buildArea.begin[2])
|
||||||
|
end = (houses[1][0]+buildArea.begin[0], houses[1][1], houses[1][2]+buildArea.begin[2])
|
||||||
|
house = House(editor, start, end, entranceDirection[random.randint(0, 3)], blocks)
|
||||||
house.build()
|
house.build()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
"""
|
||||||
from gdpc import Editor, Block, geometry, Transform
|
from gdpc import Editor, Block, geometry, Transform
|
||||||
import networks.curve as curve
|
import networks.curve as curve
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -63,4 +73,5 @@ geometry.placeCuboid(editor, (-5,0,-8), (25,100,25), Block("air"))
|
|||||||
# create a building at the relative position 0,0 with 20 blocks length and 20 blocks width, with a normal shape and 10 floors
|
# create a building at the relative position 0,0 with 20 blocks length and 20 blocks width, with a normal shape and 10 floors
|
||||||
building = Building(random_data["buildings"], [(0,0,0), (20,30,20)], baseShape, DIRECTION.EAST)
|
building = Building(random_data["buildings"], [(0,0,0), (20,30,20)], baseShape, DIRECTION.EAST)
|
||||||
# build it with your custom materials
|
# build it with your custom materials
|
||||||
building.build(editor, ["stone_bricks","glass_pane","glass","cobblestone_wall","stone_brick_stairs","oak_planks","white_concrete","cobblestone","stone_brick_slab","iron_bars"])
|
building.build(editor, ["stone_bricks","glass_pane","glass","cobblestone_wall","stone_brick_stairs","oak_planks","white_concrete","cobblestone","stone_brick_slab","iron_bars"])
|
||||||
|
"""
|
||||||
|
Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 945 B |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -286,7 +286,7 @@ def rectangle_2D_to_3D(rectangle: list[tuple[tuple[int, int], tuple[int, int]]],
|
|||||||
for x in range(start[0], end[0]):
|
for x in range(start[0], end[0]):
|
||||||
for y in range(start[1], end[1]):
|
for y in range(start[1], end[1]):
|
||||||
avg_height += image.getpixel((x, y))
|
avg_height += image.getpixel((x, y))
|
||||||
avg_height = int(avg_height / ((end[0] - start[0]) * (end[1] - start[1])))
|
avg_height = int(avg_height / ((end[0] - start[0]) * (end[1] - start[1]))) + 1
|
||||||
new_rectangle.append(
|
new_rectangle.append(
|
||||||
((start[0], avg_height, start[1]), (end[0], avg_height + randint(height_min, height_max), end[1])))
|
((start[0], avg_height, start[1]), (end[0], avg_height + randint(height_min, height_max), end[1])))
|
||||||
return new_rectangle
|
return new_rectangle
|
||||||
|
|||||||