示例#1
0
 private void generateRainMap()
 {
     Rainmap = new PerlinNoiseMap (m_terrainData.heightmapResolution, 0.2f);
     Rainmap.generate ();
 }
示例#2
0
    private void generateHeightmap()
    {
        DiamondSquareNoiseMap map = new DiamondSquareNoiseMap (m_terrainData.heightmapResolution);

        //Set some seed values for the map:
        int quarterSize = (map.size - 1) / 4;
        // - Set some random heights in the middle of the map
        for (int x = 1; x <= 3; ++x) {
            for (int y = 1; y <= 3; ++y) {
                map.SetSeedValue (x * quarterSize, y * quarterSize, UnityEngine.Random.value);
            }
        }

        // - Force sea around the outside.
        for (int coordinate = 0; coordinate < map.size; ++coordinate) {
            map.SetSeedValue (coordinate, 0, 0.0f);
            map.SetSeedValue (coordinate, map.size - 1, 0.0f);
            map.SetSeedValue (0, coordinate, 0.0f);
            map.SetSeedValue (map.size - 1, coordinate, 0.0f);
        }
        map.generate ();

        Heightmap = map;
    }