Пример #1
0
 override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
 {
     for (int i = 0; i < b.Length; i++)
     {
         b[i] = (byte)(b[i] * factor);
     }
 }
Пример #2
0
 override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
 {
     for (int i = 0; i < b.Length / 2; i++)
     {
         b[b.Length - i - 1] = b[i];
     }
 }
Пример #3
0
 override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
 {
     for (int i = 0; i < b.Length; i++)
     {
         b[i] = (byte)(minimum.i + (maximum.i - minimum.i) * (b[i] / 255f));
     }
 }
Пример #4
0
        override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
        {
            float dvdx = (maxValue.i - minValue.i) / (float)(b.Length - 1);

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = (byte)(minValue.i + dvdx * i);
            }
        }
Пример #5
0
        override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
        {
            var copy = s.BufferForName(target);

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = copy[i];
            }
        }
Пример #6
0
 override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
 {
     for (int i = 0; i < b.Length; i++)
     {
         if (r.NextDouble() < probability)
         {
             b[i] = (byte)value;
         }
     }
 }
Пример #7
0
        override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
        {
            float midpoint = (maximum + minimum) / 2f;
            float halfdiff = (maximum - minimum) / 2f;

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = (byte)(halfdiff * Math.Sin((6.28 / period) * i + speed * v["SPECTRA_TIME"].f + phase) + midpoint);
            }
        }
Пример #8
0
        override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
        {
            scroll = v["SPECTRA_TIME"].f * scrollRate;

            for (int i = 0; i < b.Length; i++)
            {
                t[i] = b[Utils.nfmod((int)(i + scroll), b.Length)];
            }

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = t[i];
            }
        }
Пример #9
0
 override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
 {
     for (int i = 0; i < b.Length; i++)
     {
         if (wrap.b)
         {
             b[i] = (byte)(b[i] + constant.i);
         }
         else
         {
             b[i] = Utils.limit(b[i] + constant.i);
         }
     }
 }
Пример #10
0
        override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
        {
            for (int p = 0; p < passes; p++)
            {
                t[0]            = (byte)((b[0] + b[1] * factor) / (1 + factor));
                t[b.Length - 1] = (byte)((b[b.Length - 1] + b[b.Length - 2] * factor) / (1 + factor));

                for (int i = 1; i < b.Length - 1; i++)
                {
                    t[i] = (byte)((b[i] + b[i - 1] * factor + b[i + 1] * factor) / (1 + 2 * factor));
                }

                Array.Copy(t, b, b.Length);
            }
        }
Пример #11
0
        override public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t)
        {
            if (gradients == null)
            {
                heights   = new float[b.Length];
                gradients = new float[b.Length];
            }

            for (int i = 1; i < b.Length - 1; i++)
            {
                if (b[i] == 255)
                {
                    heights[i] = 255;
                }
            }

            gradients[0]            = gradients[0] * momentum + (b[1] - b[0]) * (1 - momentum);
            gradients[b.Length - 1] = gradients[b.Length - 1] * momentum + (b[b.Length - 2] - b[b.Length - 1]) * (1 - momentum);
            for (int i = 1; i < b.Length - 1; i++)
            {
                gradients[i] = gradients[i] * momentum + ((b[i - 1] - b[i]) * (1 - momentum) + (b[i + 1] - b[i]) * (1 - momentum)) * 0.5f;
            }

            float dt = v["SPECTRA_DELTA_TIME"].f;

            for (int i = 0; i < b.Length; i++)
            {
                heights[i]    = (heights[i] + gradients[i] * speed * dt);
                b[i]          = (byte)heights[i];
                heights[i]   *= decay;
                gradients[i] *= decay;
            }

            //Array.ForEach(gradients, f => Console.Write("{0} ", (byte)f));
            //Console.WriteLine();
        }
Пример #12
0
 abstract public void Process(Spectra s, Dictionary <String, Variant> v, byte[] b, byte[] bb, byte[] t);