public AsyncWork(Mesh mesh, Vector3Int section, float priority, Chunk3x3Accessor accessor) { Mesh = mesh; Section = section; Priority = priority; Accessor = accessor; }
public void ScheduleWork(Mesh mesh, Vector3Int section, Chunk3x3Accessor accessor) { Profiler.BeginSample("SectionMeshWorkScheduler.ScheduleWork"); AddWork(new MainThreadWork(section, accessor)); m_MeshBuffer.Add(mesh); Profiler.EndSample(); }
public static void AddSection <TIndex>(this BlockMeshBuilder <TIndex> builder, Vector3Int section, Chunk3x3Accessor accessor) where TIndex : unmanaged { for (int x = 0; x < ChunkWidth; x++) { for (int z = 0; z < ChunkWidth; z++) { int maxY = accessor.GetTopVisibleBlockY(x, z); for (int y = 0; y < SectionHeight; y++) { int worldY = y + section.y; if (worldY > maxY) { break; } BlockData block = accessor.GetBlock(x, worldY, z); if (block.EntityConversion != BlockEntityConversion.Initial) { Vector3Int pos = new Vector3Int(x, worldY, z); Vector3Int offset = new Vector3Int(0, -section.y, 0); builder.AddBlock(pos, offset, block, accessor); } } } } }
public MainThreadWork(Vector3Int section, Chunk3x3Accessor accessor) { Section = section; Accessor = accessor; }
public void ScheduleAsyncWork(Mesh mesh, Vector3Int section, float priority, Chunk3x3Accessor accessor) { Profiler.BeginSample("SectionMeshWorkScheduler.ScheduleAsyncWork"); AddWork(new AsyncWork(mesh, section, priority, accessor)); Profiler.EndSample(); }