public async Task CalculateLocalLight(NeighborChunkGenData nei) { // yes, this is a native array or 27 nativearrays or uints var job = new VertexLocalLightJob(); Allocator allo = Allocator.TempJob; //var cubeOfExists = NativeNeighbors27<NativeArray<uint>>.FromNeighbor27(nei.nieghbors, allo); new Neighbors27<NativeArray<uint>>(nei.center), allo); SetUp(nei, job, 0, allo); await jobCall.ScheduleParallelAwaitable(job, job.display.Length, 1, allo); job.DisposeAll(); }
private void SetUp(NeighborChunkGenData nei, VertexLocalLightJob job, int lodIndex, Allocator allo) { job.locks = new object[nei.centerChunkData.displays.getLengths()[lodIndex]]; job.display = new NativeArray <VoxelGeomDataMirror>(nei.centerChunkData.displays[lodIndex], allo); job.chunkSize = vGenConfig.ChunkSize; job.SizeOfHLSLUInt = VGenConfig.SizeOfHLSLInt; var cubeOfExists27 = new NativeNeighbors27 <NativeArray <uint> >(nei.center, allo); foreach (var pos in Cube27.NeighborsOfIncludingCenter(nei.center)) { cubeOfExists27.Set(pos, new NativeArray <uint>(nei.Get(pos).ExistsMap, allo)); } job.cubeOfExists = cubeOfExists27; }