Color[] GenerateTexture(int width, int height) { var random = ConcurrentRandomProvider.GetRandom(); Color[] usecs = Enumerable.Range(0, random.Next(2, 5)).Select(i => new Color((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble())).ToArray(); return(Algs.GenerateColorArray(usecs, width, height, 2, random)); }
Texture2D GenerateTexture(Color[] colors, int size) { Texture2D tex = new Texture2D(size, size); var random = ConcurrentRandomProvider.GetRandom(); tex.SetPixels(Algs.GenerateColorArray(colors, size, size, 1, random)); tex.Apply(); return(tex); }
Color[][] GenerateAnimation(Color color, int size) { Color[] usecs = new Color[] { color * .8f, color, color *(2f * .8f) }; Color[][] animation = new Color[animation_frames][]; var random = ConcurrentRandomProvider.GetRandom(); Color[] origin = Algs.GenerateColorArray(usecs, size, size, 1, random); Color[] final = Algs.GenerateColorArray(usecs, size, size, 1, random); for (int i = 1; i < animation_frames - 1; i++) { animation[i] = LerpColorArray(origin, final, ((float)i) / animation_frames); } animation[0] = origin; animation[animation_frames - 1] = final; return(animation); }
Color[] GenerateColorArray(System.Random random) { Color[] usecs = Enumerable.Range(0, random.Next(2, 5)).Select(i => RandomTColor(random)).ToArray(); return(Algs.GenerateColorArray(usecs, size, size, 1, random)); }