Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----- parameters -----
- floors = 40 :: int_slider("Floors", 1, 100)
- setback = 3 :: int_slider("Setback every", 1, 100)
- sides = 6:: int_slider("Sides", 3, 36)
- circles = 4:: int_slider("Circles", 1, 10)
- pillar_width = 1:: float_slider("Pillar Width", 0.2, 10, 0.2)
- pillar_height = 6:: float_slider("Pillar Height", 0.2, 10, 0.2)
- pillar_spacing = 10:: float_slider("Pillar Spacing", 0.5, 40, 0.5)
- beam_height = 1:: float_slider("Beam Height", 0.2, 10, 0.2)
- ----------------------
- c=col()
- c.dim = vec(pillar_width,pillar_height,pillar_width)
- cbeam = col()
- cbeam.dim = vec(pillar_spacing,beam_height,pillar_width)
- cbeamh = col()
- cbeamh.dim = vec(pillar_spacing + 0.5*pillar_width,beam_height,pillar_width)
- cbeam1 = col()
- cbeam1.dim = vec(pillar_spacing + pillar_width,beam_height,pillar_width)
- t = math.rad(360.0/sides)
- a = math.sin(t/2) * pillar_width / 2.0
- alpha = math.pi/2 - t/2
- mitershort = math.sin(alpha)*a
- miterout = math.cos(alpha)*a
- for r=1,circles do
- local _r = pillar_spacing * r
- local cspan = col()
- cspan.dim = vec(2*math.sin(t/2)*(r - 0.5)*pillar_spacing - 2*mitershort,beam_height,pillar_width)
- for s=1,sides do
- local y0 = 0
- for y=1,math.min(floors, (circles + 1 - r)*setback) do
- local max_r = circles - math.floor((y-1)/setback)
- local _t = s*360.0/sides
- _x = math.cos(math.rad(_t))
- _z = math.sin(math.rad(_t))
- local _c = brk(c)
- _rc = _r - pillar_spacing * 0.5
- _c.pos = vec(_x*_rc, y0 + c.dim.y * 0.5, _z*_rc)
- _c.rot.y = -_t
- y0 = y0 + c.dim.y
- if max_r > r then
- local _cbeam
- local _adj = 0
- if max_r == 2 then
- _cbeam = brk(cbeam1)
- elseif r == 1 then
- _cbeam = brk(cbeamh)
- _adj = -0.25*pillar_width
- elseif r == max_r - 1 then
- _cbeam = brk(cbeamh)
- _adj = 0.25*pillar_width
- else
- _cbeam = brk(cbeam)
- end
- _cbeam.pos = vec(_x*(_r+_adj), y0 + cbeam.dim.y * 0.5, _z*(_r+_adj))
- _cbeam.rot.y = -_t
- end
- if max_r > 1 then
- y0 = y0 + cbeam.dim.y
- end
- _ts = math.rad(_t) + t/2
- _xs = math.cos(_ts)
- _zs = math.sin(_ts)
- _rs = _rc * math.cos(t/2) + miterout
- local _cspan = brk(cspan)
- _cspan.pos = vec(_xs*_rs, y0 + cspan.dim.y * 0.5, _zs*_rs)
- _cspan.rot.y = -math.deg(_ts) + 90
- y0 = y0 + cspan.dim.y
- end
- end
- end
- randomize_colors()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement