Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require('component')
- local ob = component.openperipheral_bridge
- local camera = component.camera
- local color = {}
- local r, g, b = 255, 0, 0
- for g = 0, 255, 8 do
- table.insert(color, r*65536+g*256+b)
- end
- g = 255
- for r = 255, 0, -8 do
- table.insert(color, r*65536+g*256+b)
- end
- r = 0
- for b = 0, 255, 8 do
- table.insert(color, r*65536+g*256+b)
- end
- b = 255
- for g = 255, 0, -8 do
- table.insert(color, r*65536+g*256+b)
- end
- function render(size, zoom, fog, side)
- local tbl, d, pix = {}
- if not fog then
- fog = 1.2
- end
- if side == 0 then
- look = camera.distanceDown
- elseif side == 1 then
- look = camera.distanceUp
- else
- look = camera.distance
- end
- local yp = 1
- for x = zoom, -zoom, -size do
- tbl[yp] = {}
- for y = -zoom, zoom, size do
- d = look(x, 0-y)
- if d < 0 then d = 32 end
- table.insert(tbl[yp], color[math.ceil(d*(#color/32))])
- end
- yp = yp + 1
- end
- return tbl
- end
- local function draw(data, size)
- if not size then
- size = 2
- end
- for j = 1, #data do
- for i = 1, #data[j] do
- ob.addBox(i*size, j*size, size, size, data[i][j])
- os.sleep()
- end
- ob.sync()
- end
- end
- ob.clear()
- draw(render(0.03, 1, 1), 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement