コード例 #1
0
 public void PerlinNoise()
 {
     float[,] heightMap = GetHeightMap();
     for (int y = 0; y < terrainData.heightmapResolution; y++)
     {
         for (int x = 0; x < terrainData.heightmapResolution; x++)
         {
             heightMap[x, y] += TerrainOptions.fBm((x + perlinXoffset) * perlinX, (y + perlinYoffset) * perlinY, perlinOctaves, perlinPersistance) * perlinHeightScale;
         }
     }
     terrainData.SetHeights(0, 0, heightMap);
 }
コード例 #2
0
 public void MultiplePerlinNoise()
 {
     float[,] heightMap = GetHeightMap();
     for (int y = 0; y < terrainData.heightmapResolution; y++)
     {
         for (int x = 0; x < terrainData.heightmapResolution; x++)
         {
             //adding all the PerlinNoise Curves
             foreach (PerlinParameters t in perlinParameters)
             {
                 heightMap[x, y] += TerrainOptions.fBm((x + t.mPerlinXoffset) * t.mPerlinX, (y + t.mPerlinYoffset) * t.mPerlinY, t.mPerlinOctaves, t.mPerlinPersistance) * t.mPerlinHeightScale;
             }
         }
     }
     terrainData.SetHeights(0, 0, heightMap);
 }