示例#1
0
 public override void DrawSpecificGUI()
 {
     Strength       = Mathf.Max(0, EditorGUILayout.FloatField("Strength", Strength));
     Radius         = Mathf.Clamp(EditorGUILayout.IntField("Radius", Radius), 0, 32);
     Falloff        = EditorGUILayout.CurveField("Falloff", Falloff, Color.white, new Rect(0, 0, 1, 1));
     BrushBlendMode = (MadMaps.Common.Painter.EBrushBlendMode)EditorGUILayout.EnumPopup("Blend Mode", BrushBlendMode);
     BrushShape     = (MadMaps.Common.Painter.EBrushShape)EditorGUILayout.EnumPopup("Shape", BrushShape);
     if (BrushBlendMode == EBrushBlendMode.Add || BrushBlendMode == EBrushBlendMode.Subtract)
     {
         Flow = Mathf.Max(0, EditorGUILayout.FloatField("Flow", Flow));
     }
 }
示例#2
0
        public static float BlendValues(float val, float existingVal, EBrushBlendMode brushBlendMode, float dt, float flow)
        {
            switch (brushBlendMode)
            {
            case EBrushBlendMode.Set:
                return(val);

            case EBrushBlendMode.Max:
                return(Mathf.Max(val, existingVal));

            case EBrushBlendMode.Min:
                return(Mathf.Min(val, existingVal));

            case EBrushBlendMode.Average:
                return((val + existingVal) / 2);

            case EBrushBlendMode.Add:
                return(existingVal + (val * dt * flow));

            case EBrushBlendMode.Subtract:
                return(existingVal - (val * dt * flow));
            }
            throw new NotImplementedException("Unsupported Blend Mode!");
        }