Пример #1
0
 public Color(LinearColor color)
 {
     R = WMath.Clamp((byte)SMath.Truncate(SMath.Pow(color.R, Constants.ONE_OVER_TWO_TWO) * 255.0f), (byte)0, (byte)255);
     G = WMath.Clamp((byte)SMath.Truncate(SMath.Pow(color.G, Constants.ONE_OVER_TWO_TWO) * 255.0f), (byte)0, (byte)255);
     B = WMath.Clamp((byte)SMath.Truncate(SMath.Pow(color.B, Constants.ONE_OVER_TWO_TWO) * 255.0f), (byte)0, (byte)255);
     A = WMath.Clamp((byte)SMath.Truncate(color.A * 255.0f), (byte)0, (byte)255);
 }
Пример #2
0
 public LinearColor(LinearColor color)
 {
     _a = color._a;
     _r = color._r;
     _g = color._g;
     _b = color._b;
 }
Пример #3
0
        public bool Equals(LinearColor other, float tolerance = Constants.NUMBER_PRETTY_SMALL)
        {
            if ((object)other == null)
            {
                return false;
            }

            return (SMath.Abs(A - other.A) < tolerance)
                && (SMath.Abs(R - other.R) < tolerance)
                && (SMath.Abs(G - other.G) < tolerance)
                && (SMath.Abs(B - other.B) < tolerance);
        }
Пример #4
0
 public static LinearColor Lerp(LinearColor x, LinearColor y, float alpha)
 {
     return x + alpha * (y - x);
 }
Пример #5
0
 public static float EvaluateBezier(LinearColor[] controlPoints, out List<LinearColor> points)
 {
     throw new NotImplementedException();
 }
Пример #6
0
 public static float Distance(LinearColor x, LinearColor y)
 {
     return (float)SMath.Sqrt(WMath.Square(y.R - x.R) + WMath.Square(y.G - x.G) + WMath.Square(y.B - x.B) + WMath.Square(y.A - x.A));
 }
Пример #7
0
 public static unsafe void WriteLinearColorRGBA(byte[] buffer, ref int offset, LinearColor value)
 {
     WriteFloat(buffer, ref offset, value.R);
     WriteFloat(buffer, ref offset, value.G);
     WriteFloat(buffer, ref offset, value.B);
     WriteFloat(buffer, ref offset, value.A);
 }