/// <summary> /// パーリンノイズ用のグリッドを生成する /// </summary> /// <returns></returns> private int[] CreateGrid() { int[] p = new int[256]; for (int i = 0; i < p.Length; i++) { p[i] = (int)Mathf.Floor(_xorshift.Random() * 256); } int[] p2 = new int[512]; for (int i = 0; i < p2.Length; i++) { p2[i] = p[i & 255]; } return(p2); }
/// <summary> /// パーリンノイズ用のグリッドを生成する /// </summary> /// <returns></returns> static public int[] CreateGrid(int seed) { Xorshift xorshift = new Xorshift((uint)seed); int[] p = new int[256]; for (int i = 0; i < p.Length; i++) { p[i] = (int)Mathf.Floor(xorshift.Random() * 256); } int[] p2 = new int[512]; for (int i = 0; i < p2.Length; i++) { p2[i] = p[i & 255]; } return(p2); }
public PerlinNoise(uint seed) { _xorshift = new Xorshift(seed); int[] p = new int[256]; for (int i = 0; i < p.Length; i++) { p[i] = (int)Mathf.Floor(_xorshift.Random() * 256); } int[] p2 = new int[512]; for (int i = 0; i < p2.Length; i++) { p2[i] = p[i & 255]; } _p = p2; }
/// <summary> /// Constructor /// </summary> public PerlinNoise(uint seed) { _xorshit = new Xorshift(seed); int[] p = new int[256]; for (int i = 0; i < p.Length; i++) { // 0 - 255の間のランダムな値を生成する p[i] = (int)Mathf.Floor(_xorshit.Random() * 256); } // pの倍の数の配列を生成する int[] p2 = new int[p.Length * 2]; for (int i = 0; i < p2.Length; i++) { p2[i] = p[i & 255]; } _p = p2; }