Files
imgui-luau/backends/roblox/worker.luau
T

26 lines
815 B
Luau

-- Parallel raster worker (Actor LocalScript). The build inlines raster.lua for the Raster line.
local Actor = script:GetActor()
if not Actor then
return
end
local Raster = require(script.Parent:WaitForChild("Raster"))
local Done = Actor:WaitForChild("Done")
local Textures = {}
Actor:BindToMessageParallel("job", function(Id, Prims, Tiles, TexUpdates, TileLength)
for _, Texture in TexUpdates do
if Texture[2] then
Textures[Texture[1]] = { Buffer = Texture[2], Width = Texture[3], Height = Texture[4] }
else -- rows changed since the copy this Actor has
local T = Textures[Texture[1]]
buffer.copy(T.Buffer, Texture[5], Texture[6])
end
end
local Results = Raster.RasterJobs(Prims, Tiles, TileLength, Textures)
task.synchronize()
Done:Fire(Id, Results)
end)
Actor:SetAttribute("Ready", true)