コード例 #1
0
        public void BuildAllChunks()
        {
            for (int x = 0; x < _worldWidth; x++)
            {
                for (int z = 0; z < _worldLength; z++)
                {
                    if (_config.CPULightingEnabled)
                    {
                        _lightManager.LightChunkColumn(x, z);
                    }
                    else
                    {
                        for (int y = 0; y < _worldHeight; y++)
                        {
                            int index = ArrayUtil.Convert3DTo1D(x, y, z, _worldLength, _worldHeight);

                            _chunks[index].MarkChunkAwaitingBuild();
                        }
                    }
                }
            }

            for (int x = 0; x < _worldWidth; x++)
            {
                for (int y = 0; y < _worldHeight; y++)
                {
                    for (int z = 0; z < _worldLength; z++)
                    {
                        int index = ArrayUtil.Convert3DTo1D(x, y, z, _worldLength, _worldHeight);

                        _chunkSystem.Builder.Build(_chunks[index]);
                    }
                }
            }

            if (_chunkSystem.Builder.RequiresPostProcess)
            {
                for (int x = 0; x < _worldWidth; x++)
                {
                    for (int y = 0; y < _worldHeight; y++)
                    {
                        for (int z = 0; z < _worldLength; z++)
                        {
                            int index = ArrayUtil.Convert3DTo1D(x, y, z, _worldLength, _worldHeight);

                            _chunkSystem.Builder.PostProcess(_chunks[index]);
                        }
                    }
                }
            }
        }