mirror of
https://github.com/minetest-mods/nether.git
synced 2024-12-28 20:00:30 +01:00
Use voxelmanip data buffer memory optimisation
Reuse a single table for content ids to reduce memory use. Add DEBUG parameter to control printing of mapchunk generation time, set to false as default. Add missing noise parameters (parameters are default and unchanged).
This commit is contained in:
parent
7cf89b2889
commit
bc2ccfbaea
16
init.lua
16
init.lua
@ -3,6 +3,7 @@
|
|||||||
local NETHER_DEPTH = -5000
|
local NETHER_DEPTH = -5000
|
||||||
local TCAVE = 0.6
|
local TCAVE = 0.6
|
||||||
local BLEND = 128
|
local BLEND = 128
|
||||||
|
local DEBUG = false
|
||||||
|
|
||||||
|
|
||||||
-- 3D noise
|
-- 3D noise
|
||||||
@ -13,7 +14,9 @@ local np_cave = {
|
|||||||
spread = {x = 384, y = 128, z = 384}, -- squashed 3:1
|
spread = {x = 384, y = 128, z = 384}, -- squashed 3:1
|
||||||
seed = 59033,
|
seed = 59033,
|
||||||
octaves = 5,
|
octaves = 5,
|
||||||
persist = 0.7
|
persist = 0.7,
|
||||||
|
lacunarity = 2.0,
|
||||||
|
--flags = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -534,10 +537,11 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- Mapgen
|
-- Mapgen
|
||||||
|
|
||||||
-- Initialize noise object and localise noise buffer
|
-- Initialize noise object, localise noise and data buffers
|
||||||
|
|
||||||
local nobj_cave = nil
|
local nobj_cave = nil
|
||||||
local nbuf_cave
|
local nbuf_cave
|
||||||
|
local dbuf
|
||||||
|
|
||||||
|
|
||||||
-- Content ids
|
-- Content ids
|
||||||
@ -589,7 +593,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
|
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
|
||||||
local data = vm:get_data()
|
local data = vm:get_data(dbuf)
|
||||||
|
|
||||||
local x11 = emax.x -- Limits of mapchunk plus mapblock shell
|
local x11 = emax.x -- Limits of mapchunk plus mapblock shell
|
||||||
local y11 = emax.y
|
local y11 = emax.y
|
||||||
@ -678,6 +682,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
vm:update_liquids()
|
vm:update_liquids()
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
|
|
||||||
local chugent = math.ceil((os.clock() - t1) * 1000)
|
if DEBUG then
|
||||||
print ("[nether] generate chunk " .. chugent .. " ms")
|
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||||
|
print ("[nether] generate chunk " .. chugent .. " ms")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user