1
0
mirror of git://repo.or.cz/rocks.git synced 2025-12-19 22:25:55 +01:00

Vein generator working with 1 3d perlin per vein and 1 prng per ore.

This commit is contained in:
Tomáš Brada
2014-12-29 21:47:55 +01:00
parent 0d5facc4c5
commit 80d7db8d44
3 changed files with 61 additions and 33 deletions

View File

@@ -22,7 +22,7 @@ rocks.register_layer=function(name,params,rock)
maxheight=maxheight,
limit=params.limit,
seed=params.seed,
rock={ block=rock },
rock={ node=rock },
veins={}
}
print("[rocks] layer "..name)
@@ -35,7 +35,9 @@ rocks.register_vein=function(name,params)
rocks.veins[name]={
np={
offset=0, scale=1, octaves=1, presist=0.8,
spread=params.spread, seed=params.seed
spread={x=params.spread.y, y=params.spread.z, z=params.spread.x},
-- swapped, becouse we generate by horizontal layers
seed=params.seed
},
treshold=params.treshold,
hmin=params.hmin, hmax=params.hmax,
@@ -51,12 +53,8 @@ end
rocks.register_ore=function( vein, node, params )
-- params= {treshold=0, chance=1 }
ore={ node=node }
if params.treshold and (params.treshold>rocks.veins[vein].treshold) then
ore.treshold=params.treshold
end
if params.chance and (params.chance<1) then
ore.chance=params.chance
end
ore.treshold=(params.treshold or rocks.veins[vein].treshold)
ore.chance= (params.chance or 1)
table.insert(rocks.veins[vein].ores, ore)
print("[rocks] ore "..node.." in "..vein.." chance="..(ore.chance or "1").." treshold="..(ore.treshold or rocks.veins[vein].treshold))
print("[rocks] ore "..node.." in "..vein.." chance="..ore.chance.." treshold="..ore.treshold)
end