//Generate 2D positions
        IEnumerable <Vector3> GenerateChunkPositions()
        {
            //snap position to the nearest chunk:
            if (chunkSize > 0)
            {
                position = PWUtils.Round(position / chunkSize) * chunkSize;
            }
            else
            {
                position = Vector3.zero;
            }

            switch (loadPatternMode)
            {
            case PWChunkLoadPatternMode.CUBIC:
                Vector3 pos = position;
                for (int x = -renderDistance; x <= renderDistance; x++)
                {
                    for (int z = -renderDistance; z <= renderDistance; z++)
                    {
                        Vector3 chunkPos = pos + new Vector3(x * chunkSize, 0, z * chunkSize);
                        yield return(chunkPos);
                    }
                }
                yield break;
            }
            yield return(position);
        }
        public static void ApplyBiomeTerrainModifiers(BlendedBiomeTerrain b)
        {
            if (b.terrain == null)
            {
                return;
            }

            if (b.terrain.type == SamplerType.Sampler2D)
            {
                PWUtils.ResizeSamplerIfNeeded(b.terrain, ref b.biomeTerrain);
                Sampler2D terrain      = b.terrain as Sampler2D;
                Sampler2D biomeTerrain = b.biomeTerrain as Sampler2D;
                //Fill biomeTerrain instead of terrain to keep an original version of the terrain
                biomeTerrain.Foreach((x, y) => {
                    float val   = terrain[x, y];
                    int biomeId = b.biomeMap.GetBiomeBlendInfo(x, y).firstBiomeId;
                    if (biomeId == -1)
                    {
                        return(val);
                    }
                    //TODO: biome blending
                    return(b.biomeTree.GetBiome(biomeId).biomeTerrain.ComputeValue(x, y, val));
                });
            }
            //else: TODO
            //TODO: apply biome terrain modifiers to terrain

            //TODO: apply biome terrain detail (caves / oth)
        }