Пример #1
0
    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));
    }
Пример #2
0
    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);
    }
Пример #3
0
    IEnumerator InitializeAsync(Vector3 sunPosition, Color sunColor, float sunRadius, float planetRadius)
    {
        Color[] texArray = null;
        var     random   = ConcurrentRandomProvider.GetRandom();

        yield return(new AsyncProcess(() =>
        {
            texArray = GenerateColorArray(random);
        }).Process());

        InitializeAtmosphere(texArray, sunPosition, sunColor, sunRadius, planetRadius);
    }
Пример #4
0
    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);
    }