示例#1
0
 public SerializableColorF(float r, float g, float b, float a)
 {
     this.R = FlaiMath.Clamp((byte)(r * 255), byte.MinValue, byte.MaxValue);
     this.G = FlaiMath.Clamp((byte)(g * 255), byte.MinValue, byte.MaxValue);
     this.B = FlaiMath.Clamp((byte)(b * 255), byte.MinValue, byte.MaxValue);
     this.A = FlaiMath.Clamp((byte)(a * 255), byte.MinValue, byte.MaxValue);
 }
示例#2
0
 public ColorF(float r, float g, float b)
 {
     this.R = FlaiMath.Clamp((byte)(r * 255), byte.MinValue, byte.MaxValue);
     this.G = FlaiMath.Clamp((byte)(g * 255), byte.MinValue, byte.MaxValue);
     this.B = FlaiMath.Clamp((byte)(b * 255), byte.MinValue, byte.MaxValue);
     this.A = 255;
 }
示例#3
0
 public static Vector2f ClampY(Vector2f vec, float min, float max)
 {
     Ensure.True(min <= max);
     vec.Y = FlaiMath.Clamp(vec.Y, min, max);
     return(vec);
 }
示例#4
0
 public static Vector2f Clamp(Vector2f value, Vector2f min, Vector2f max)
 {
     return(new Vector2f(FlaiMath.Clamp(value.X, min.X, max.X), FlaiMath.Clamp(value.Y, min.Y, max.Y)));
 }
示例#5
0
        public static double SmoothStep(double value1, double value2, double amount)
        {
            double num = FlaiMath.Clamp(amount, 0f, 1f);

            return(FlaiMath.Lerp(value1, value2, num * num * (3f - 2f * num)));
        }
示例#6
0
        public static float SmoothStep(float value1, float value2, float amount)
        {
            float num = FlaiMath.Clamp(amount, 0f, 1f);

            return(FlaiMath.Lerp(value1, value2, num * num * (3f - 2f * num)));
        }
示例#7
0
 public static ColorF operator *(ColorF color, float multiplier)
 {
     return(new ColorF(color.R, color.G, color.B, (byte)FlaiMath.Clamp(color.A * multiplier, 0, 255)));
 }
示例#8
0
 // smoothstep
 public static ColorF Slerp(Color from, Color to, float amount)
 {
     amount = FlaiMath.Clamp(amount, 0, 1);
     return(ColorF.Lerp(from, to, amount * amount * (3f - 2f * amount)));
 }
示例#9
0
 public static ColorF Lerp(ColorF from, ColorF to, float amount)
 {
     // from UnityEngine.Color32
     amount = FlaiMath.Clamp(amount, 0, 1);
     return(new Color32((byte)(from.R + (to.R - from.R) * amount), (byte)(from.G + (to.G - from.G) * amount), (byte)(from.B + (to.B - from.B) * amount), (byte)(from.A + (to.A - from.A) * amount)));
 }
示例#10
0
 public static Vector2d ClampY(Vector2d vec, double min, double max)
 {
     Ensure.True(min <= max);
     vec.Y = FlaiMath.Clamp(vec.Y, min, max);
     return(vec);
 }