diff --git a/menu/LoadingScreen.gd b/menu/LoadingScreen.gd index 662f126..7e9544f 100644 --- a/menu/LoadingScreen.gd +++ b/menu/LoadingScreen.gd @@ -12,9 +12,9 @@ func _ready(): func _process(_delta): $ProgressBar.value = Global.loading.get_percentage() - if (Global.loading.get_percentage() >= 100): - Global.loading.set_end_time() - print(Global.loading.get_elapsed_time("s")) + if (Global.loading.get_end_time() > 0): + + Global.print_debug("Elapsed time : %f seconds" % Global.loading.get_elapsed_time("s")) get_tree().change_scene("res://world/game.tscn") func _exit_tree(): diff --git a/ui/map/map.gd b/ui/map/map.gd index 890b4d2..786c358 100644 --- a/ui/map/map.gd +++ b/ui/map/map.gd @@ -87,7 +87,7 @@ func draw_voronoi_cells_convex_hull(): func _draw(): print("before drawing") - # heightmap() + heightmap() # draw_voronoi_cells() # draw_triangles_edges() # draw_voronoi_cells_convex_hull() diff --git a/utils/world_generation/WorldGeneration.gd b/utils/world_generation/WorldGeneration.gd index 3324070..df5d154 100644 --- a/utils/world_generation/WorldGeneration.gd +++ b/utils/world_generation/WorldGeneration.gd @@ -26,8 +26,18 @@ func _init(): Global.terrain.load(Global.terrain_name) else: Global.terrain.create(width,height,spacing,Global.terrain_name) - - Global.loading.set_max_step(Global.terrain.get_triangles().size() + height) + + var max_step = ( + Global.terrain.get_triangles().size() + # + height + ) + + if Global.terrain.is_created(): + max_step += Global.terrain.get_points().size() + max_step += Global.terrain.get_triangles().size() + Global.loading.set_step(Global.terrain.get_points().size()) + + Global.loading.set_max_step(max_step) if Global.terrain.is_created(): init_data() @@ -35,7 +45,7 @@ func _init(): if Global.terrain.is_created() or Global.terrain.is_loaded(): Global.terrain.set_data("mesh", create_mesh()) - create_map() + # create_map() # add_trees() # get_tree().change_scene("res://world/game.tscn") else: @@ -43,6 +53,8 @@ func _init(): Global.print_debug("Pas de construction ..., pas de palais ...") Global.print_debug("Pas de palais ..., pas de palais.") + Global.loading.set_end_time() + func init_data(): # for point in Global.terrain.get_points(): # point.set_elevation(point_find_elevation(point.point2d())) @@ -68,6 +80,7 @@ func init_data(): print(triangle.get_elevation()) if triangle.is_water(): triangle.set_elevation(0) + Global.loading.increment_step() # triangle.set_data("ocean", false) # for point in triangle.points(): # if point.get_data("ocean"): @@ -246,18 +259,16 @@ func create_mesh(): mi.cast_shadow = GeometryInstance.SHADOW_CASTING_SETTING_ON return mi +# Enregistrement de la map + intégration dans la génération du monde #32 + func create_map(): var img = Image.new() img.create(width, height, false, Image.FORMAT_RGBA8) img.lock() for y in height: - # print(y) Global.loading.increment_step() for x in width: img.set_pixel(x,y,Color(randf(), randf(), randf())) img.unlock() - - - pass