/// <summary> /// Creates a new voxel chunk mesher. /// </summary> /// <param name="chunkProperties">The chunk properties to handle.</param> /// <param name="greedyMesher">The greedy mesher to use.</param> internal VoxelChunkMesher(ChunkProperties chunkProperties, GreedyMesher greedyMesher) { m_ChunkProperties = chunkProperties; m_GreedyMesher = greedyMesher; m_Mesh = new ProcMesh(); m_Task = Task.Run(Remesh); }
/// <summary> /// Returns a greedy mesher back to the object pool. /// </summary> /// <param name="mesher">The mesher to return.</param> internal void ReturnMesher(GreedyMesher mesher) { if (m_GreedyMesherPool.Count >= MAX_MESHER_POOL_SIZE) { return; } m_GreedyMesherPool.Add(mesher); }
/// <inheritdoc cref="IRemeshTask"/> public ProcMesh Finish() { m_Task.Wait(); m_GreedyMesher?.ReturnToPool(); m_GreedyMesher = null; return(m_Mesh); }