private void Initialize(TestFront front) { if (front.Initialized) { return; } front.Initialized = true; var test = front.Test; test.Test(); front.NoiseTexture = new Texture2D(256, 256) { filterMode = FilterMode.Point }; test.Reset(); for (var j = front.NoiseTexture.height - 1; j >= 0; j--) { for (var i = 0; i < front.NoiseTexture.width; i++) { var f = test.NoiseSequence[i + j * 256]; front.NoiseTexture.SetPixel(i, j, new Color(f, f, f, 1)); } } front.NoiseTexture.Apply(); front.CoordTexture = new Texture2D(256, 256) { filterMode = FilterMode.Point }; for (var j = front.CoordTexture.height - 1; j >= 0; j--) { for (var i = 0; i < front.CoordTexture.width; i++) { var f = 1.0f - test.CoordsArray[i, j]; front.CoordTexture.SetPixel(i, j, new Color(f, f, f, 1)); } } front.CoordTexture.Apply(); progress++; }
private void SaveRandomSequence(TestFront front, string path) { var dirName = System.IO.Path.GetDirectoryName(path); if (!System.IO.Directory.Exists(dirName)) { if (string.IsNullOrEmpty(dirName)) { Debug.LogError("Path is null"); } else { System.IO.Directory.CreateDirectory(dirName); } } SaveTextureAsPNG(front.CoordTexture, path + front.Test.Name + " coordinate.png"); SaveTextureAsPNG(front.NoiseTexture, path + front.Test.Name + " noise.png"); Debug.Log(Application.dataPath + front.Test.Name + " saved."); }