예제 #1
0
 /// <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);
 }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <inheritdoc cref="IRemeshTask"/>
        public ProcMesh Finish()
        {
            m_Task.Wait();

            m_GreedyMesher?.ReturnToPool();
            m_GreedyMesher = null;

            return(m_Mesh);
        }