示例#1
0
文件: Color.cs 项目: Qibbi/OpenSAGE
 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);
 }