mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
23 lines
858 B
C#
23 lines
858 B
C#
using UnityEngine;
|
|
|
|
namespace Raindrop.Tests.MeshingTests
|
|
{
|
|
public class TerrainTestFunctions
|
|
{
|
|
public static void GenerateNoiseZMap(uint width, uint height, ref float[,] zMap, float noiseAmplitude,
|
|
float noisePeriodicity)
|
|
{
|
|
for (int row = 0; row < height; row++) // in each row...
|
|
{
|
|
for (int col = 0; col < width; col++) // in each col...
|
|
{
|
|
float perlinXInput = (float)col * noisePeriodicity;
|
|
float perlinYInput = (float)row * noisePeriodicity;
|
|
// ... generate the noise at current position and apply....
|
|
float noiseVal = Mathf.PerlinNoise(perlinXInput, perlinYInput) * noiseAmplitude;
|
|
zMap[row, col] = noiseVal;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |