mirror of
git://repo.or.cz/rocks.git
synced 2025-01-04 07:10:28 +01:00
Sphere as motherlode of veins.
This commit is contained in:
parent
b183c489ee
commit
b203d77ffe
@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
local pr
|
local pr
|
||||||
|
|
||||||
|
local function draw_sphere(data,area,pos,radius,with)
|
||||||
|
local rsq=radius^2
|
||||||
|
radius=radius+2
|
||||||
|
for x=-radius, radius do
|
||||||
|
for y=-radius, radius do
|
||||||
|
for z=-radius, radius do
|
||||||
|
if (x^2)+(y^2)+(z^2)<=rsq then
|
||||||
|
data[area:index(x+pos.x,y+pos.y,z+pos.z)]=with
|
||||||
|
end
|
||||||
|
end end end
|
||||||
|
end
|
||||||
|
|
||||||
rocksl.genvein=function(minp,maxp,seed,vm,area)
|
rocksl.genvein=function(minp,maxp,seed,vm,area)
|
||||||
local t1 = os.clock()
|
local t1 = os.clock()
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
@ -22,6 +34,7 @@ rocksl.genvein=function(minp,maxp,seed,vm,area)
|
|||||||
print("maxp="..maxp.x..","..maxp.y..","..maxp.z)
|
print("maxp="..maxp.x..","..maxp.y..","..maxp.z)
|
||||||
--local pointA=vector.add(minp,chunksize/2)
|
--local pointA=vector.add(minp,chunksize/2)
|
||||||
local pointA=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
local pointA=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||||
|
draw_sphere(data,area,pointA,5,c_sample)
|
||||||
|
|
||||||
for vc=1, numveins do
|
for vc=1, numveins do
|
||||||
--local pointA=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
--local pointA=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||||
@ -40,6 +53,7 @@ rocksl.genvein=function(minp,maxp,seed,vm,area)
|
|||||||
p=vector.round(p)
|
p=vector.round(p)
|
||||||
local di=area:index(p.x,p.y,p.z)
|
local di=area:index(p.x,p.y,p.z)
|
||||||
data[di]=c_sample
|
data[di]=c_sample
|
||||||
|
--draw_sphere(data,area,p,1,c_sample)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user