示例#1
0
        public static FastColor InterpolateColor(float progress, params FastColor[] colors)
        {
            int colora = (int)((colors.Length - 1) * progress);

            if (colora < 0)
            {
                colora = 0;
            }
            if (colora >= colors.Length)
            {
                colora = colors.Length - 1;
            }
            int colorb = colora + 1;

            if (colorb >= colors.Length)
            {
                colorb = colors.Length - 1;
            }
            FastColor a = colors[colora];
            FastColor b = colors[colorb];
            float     p = (progress - (float)colora / (colors.Length - 1)) * (colors.Length - 1);
            int       A = (int)(a.A + (b.A - a.A) * p);
            int       R = (int)(a.R + (b.R - a.R) * p);
            int       G = (int)(a.G + (b.G - a.G) * p);
            int       B = (int)(a.B + (b.B - a.B) * p);

            return(new FastColor(A, R, G, B));
        }
示例#2
0
 public VertexPositionTexture(float x, float y, float z, float u, float v, FastColor c)
 {
     Position = new Vector3(x, y, z);
     this.u   = u;
     this.v   = v;
     r        = c.R;
     g        = c.G;
     b        = c.B;
     a        = c.A;
 }