Ejemplo n.º 1
0
        public override void Process()
        {
            timer.Start();

            if (chunk.Dirty)
            {
                // TODO: look into ways of iterating only known visible blocks (i.e not AIR)
                foreach (var position in Configuration.ChunkRegion)
                {
                    Block block = chunkView.GetBlock(position);

                    if (block.IsVisible)
                    {
                        renderer.GenerateMesh(mesh, chunkView, block, position);
                    }
                }

                Statistics.ChunkMeshes++;
            }

            chunk.ChunkMesh  = mesh;
            chunk.ChunkState = ChunkState.TESSELATED;
            chunk.Working    = false;

            timer.Stop();
            Statistics.ChunkTotal += timer.ElapsedMilliseconds;
        }