Add timer checkpoints

Bram van den Heuvel 2024-04-30 17:37:34 +02:00
parent 312ab54a46
commit 18fecc7eae
1 changed files with 13 additions and 1 deletions

View File

@ -693,6 +693,8 @@ function internal.generate_caves(data, minp, maxp)
-- Get cave bools -- Get cave bools
local bools = internal.flat_from_cave_bools(bminp, bmaxp) local bools = internal.flat_from_cave_bools(bminp, bmaxp)
timer.checkpoint("Calculate cave shape")
-- Get node types -- Get node types
local nts = internal.flat_from_node_types(bools, bminp, bmaxp) local nts = internal.flat_from_node_types(bools, bminp, bmaxp)
@ -704,6 +706,8 @@ function internal.generate_caves(data, minp, maxp)
internal.humidity_noise_params(), bminp, bmaxp internal.humidity_noise_params(), bminp, bmaxp
) )
timer.checkpoint("Calculate block types & biomes")
local air = minetest.get_content_id("air") local air = minetest.get_content_id("air")
local schems = {} local schems = {}
@ -1176,10 +1180,15 @@ end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)
timer.start()
math.randomseed(blockseed) math.randomseed(blockseed)
local vm = minetest.get_mapgen_object("voxelmanip") local vm = minetest.get_mapgen_object("voxelmanip")
local flat, schems = internal.generate_caves(vm:get_data(), minp, maxp) local data = vm:get_data()
local flat, schems = internal.generate_caves(data, minp, maxp)
timer.checkpoint("Place caves")
internal.place_simple_decorations(flat, schems) internal.place_simple_decorations(flat, schems)
@ -1187,6 +1196,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm:write_to_map() vm:write_to_map()
internal.place_schematic_decorations(vm, schems) internal.place_schematic_decorations(vm, schems)
timer.checkpoint("Place decorations")
timer.stop()
end) end)
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
------------------------------------------------------------------------------- -------------------------------------------------------------------------------