mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
Add circle brush, but it isn't working right just yet.
This commit is contained in:
parent
a2a9108d36
commit
2da0f2dcc2
6 changed files with 34 additions and 5 deletions
|
@ -35,7 +35,7 @@ local function apply_heightmap(brush, brush_size, height, position, heightmap, h
|
|||
local hi = z*heightmap_size.x + x
|
||||
local pos_brush = Vector3.new(x, 0, z) - pos_start
|
||||
local bi = pos_brush.z*brush_size.x + pos_brush.x
|
||||
print("hi", hi, "heightmap[hi]", heightmap[hi], "bi", bi, "brush[bi]", brush[bi])
|
||||
|
||||
local adjustment = math.floor(brush[bi]*height)
|
||||
if adjustment > 0 then
|
||||
added = added + adjustment
|
||||
|
|
28
worldeditadditions/lib/sculpt/brushes/circle.lua
Normal file
28
worldeditadditions/lib/sculpt/brushes/circle.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
|
||||
local __smooth = dofile(wea.modpath.."/lib/sculpt/brushes/__smooth.lua")
|
||||
|
||||
return function(size)
|
||||
local brush = {}
|
||||
|
||||
local centre = (size / 2):floor()
|
||||
local minsize = math.floor(math.min(size.x, size.y) / 2)
|
||||
|
||||
print("centre", centre, "minsize", minsize)
|
||||
|
||||
for y = size.y - 1, 0, -1 do
|
||||
for x = size.x - 1, 0, -1 do
|
||||
local i = y*size.x + x
|
||||
|
||||
|
||||
if math.floor((centre - Vector3.new(x, y, 0)):abs():length()) < minsize - 2 then
|
||||
brush[i] = 1
|
||||
else
|
||||
brush[i] = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true, brush, size
|
||||
end
|
|
@ -3,6 +3,6 @@ local wea = worldeditadditions
|
|||
local __smooth = dofile(wea.modpath.."/lib/sculpt/brushes/__smooth.lua")
|
||||
|
||||
return function(size)
|
||||
local success, brush, size_actual = __smooth(size, 2)
|
||||
local success, brush, size_actual = __smooth(size, 3)
|
||||
return success, brush, size_actual
|
||||
end
|
||||
|
|
|
@ -3,6 +3,6 @@ local wea = worldeditadditions
|
|||
local __smooth = dofile(wea.modpath.."/lib/sculpt/brushes/__smooth.lua")
|
||||
|
||||
return function(size)
|
||||
local success, brush, size_actual = __smooth(size, 1.25)
|
||||
local success, brush, size_actual = __smooth(size, 2)
|
||||
return success, brush, size_actual
|
||||
end
|
||||
|
|
|
@ -3,6 +3,6 @@ local wea = worldeditadditions
|
|||
local __smooth = dofile(wea.modpath.."/lib/sculpt/brushes/__smooth.lua")
|
||||
|
||||
return function(size)
|
||||
local success, brush, size_actual = __smooth(size, 3)
|
||||
local success, brush, size_actual = __smooth(size, 5)
|
||||
return success, brush, size_actual
|
||||
end
|
||||
|
|
|
@ -5,7 +5,8 @@ local sculpt = {
|
|||
default_hard = dofile(wea.modpath.."/lib/sculpt/brushes/default_hard.lua"),
|
||||
default = dofile(wea.modpath.."/lib/sculpt/brushes/default.lua"),
|
||||
default_soft = dofile(wea.modpath.."/lib/sculpt/brushes/default_soft.lua"),
|
||||
square = dofile(wea.modpath.."/lib/sculpt/brushes/square.lua")
|
||||
square = dofile(wea.modpath.."/lib/sculpt/brushes/square.lua"),
|
||||
circle = dofile(wea.modpath.."/lib/sculpt/brushes/circle.lua")
|
||||
},
|
||||
make_brush = dofile(wea.modpath.."/lib/sculpt/make_brush.lua"),
|
||||
preview_brush = dofile(wea.modpath.."/lib/sculpt/preview_brush.lua"),
|
||||
|
|
Loading…
Reference in a new issue