void GenerateChunkMesh(object o) { if (!WasAborted) { VoxelChunkMesh mesh = null; var chunk = (VoxelChunk)o; mesh = new VoxelChunkMesh(chunk); mesh.GenerateGeometryAndLighting(); _dirtyMeshes.Enqueue(mesh); } }
public void SetMesh(VoxelChunkMesh mesh) { if (WasDisposed) { mesh.Dispose(); } if (!mesh.AreBuffersReady) { throw new ArgumentException($"Cannot update chunk mesh for chunk at {Coords}: Mesh buffers aren't ready!"); } if (Mesh != null && Mesh != mesh) { Mesh.Dispose(); } Mesh = mesh; }