flabbet преди 9 месеца
родител
ревизия
61ddbd0615

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit e1cab4d5a37165457960f13d2b39041f8ce66722
+Subproject commit 2571a7503807445d75f04d7e628751725d6f15c7

+ 24 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/MathNode.cs

@@ -59,6 +59,15 @@ public class MathNode : Node
                 MathNodeMode.NaturalLogarithm => ShaderMath.LogE(x),
                 MathNodeMode.NaturalLogarithm => ShaderMath.LogE(x),
                 MathNodeMode.Root => ShaderMath.Root(x, y),
                 MathNodeMode.Root => ShaderMath.Root(x, y),
                 MathNodeMode.InverseRoot => ShaderMath.InverseRoot(x, y),
                 MathNodeMode.InverseRoot => ShaderMath.InverseRoot(x, y),
+                MathNodeMode.Fraction => ShaderMath.Fraction(x),
+                MathNodeMode.Absolute => ShaderMath.Abs(x),
+                MathNodeMode.Negate => ShaderMath.Negate(x),
+                MathNodeMode.Floor => ShaderMath.Floor(x),
+                MathNodeMode.Ceil => ShaderMath.Ceil(x),
+                MathNodeMode.Round => ShaderMath.Round(x),
+                MathNodeMode.Modulo => ShaderMath.Modulo(x, y),
+                MathNodeMode.Min => ShaderMath.Min(x, y),
+                MathNodeMode.Max => ShaderMath.Max(x, y),
             };
             };
 
 
             if (Clamp.Value)
             if (Clamp.Value)
@@ -91,8 +100,22 @@ public class MathNode : Node
             MathNodeMode.Logarithm => Math.Log(xConst, yConst),
             MathNodeMode.Logarithm => Math.Log(xConst, yConst),
             MathNodeMode.NaturalLogarithm => Math.Log(xConst),
             MathNodeMode.NaturalLogarithm => Math.Log(xConst),
             MathNodeMode.Root => Math.Pow(xConst, 1.0 / yConst),
             MathNodeMode.Root => Math.Pow(xConst, 1.0 / yConst),
-            MathNodeMode.InverseRoot => 1.0 / Math.Pow(xConst, 1.0 / yConst)
+            MathNodeMode.InverseRoot => 1.0 / Math.Pow(xConst, 1.0 / yConst),
+            MathNodeMode.Fraction => 1.0 / xConst,
+            MathNodeMode.Absolute => Math.Abs(xConst),
+            MathNodeMode.Negate => -xConst,
+            MathNodeMode.Floor => Math.Floor(xConst),
+            MathNodeMode.Ceil => Math.Ceiling(xConst),
+            MathNodeMode.Round => Math.Round(xConst),
+            MathNodeMode.Modulo => xConst % yConst,
+            MathNodeMode.Min => Math.Min(xConst, yConst),
+            MathNodeMode.Max => Math.Max(xConst, yConst),
         };
         };
+        
+        if (Clamp.Value)
+        {
+            constValue = Math.Clamp(constValue, 0, 1);
+        }
             
             
         return new Float1(string.Empty) { ConstantValue = constValue };
         return new Float1(string.Empty) { ConstantValue = constValue };
     }
     }

+ 31 - 2
src/PixiEditor.ChangeableDocument/Enums/MathNodeMode.cs

@@ -37,12 +37,41 @@ public enum MathNodeMode
     [Description("ROOT")]
     [Description("ROOT")]
     Root,
     Root,
     [Description("INVERSE_ROOT")]
     [Description("INVERSE_ROOT")]
-    InverseRoot
+    InverseRoot,
+    [Description("FRACTION")]
+    Fraction,
+    [Description("ABSOLUTE")]
+    Absolute,
+    [Description("NEGATE")]
+    Negate,
+    [Description("FLOOR")]
+    Floor,
+    [Description("CEIL")]
+    Ceil,
+    [Description("ROUND")]
+    Round,
+    [Description("MODULO")]
+    Modulo,
+    [Description("MIN")]
+    Min,
+    [Description("MAX")]
+    Max,
 }
 }
 
 
 public static class MathNodeModeExtensions
 public static class MathNodeModeExtensions
 {
 {
-    public static bool UsesYValue(this MathNodeMode mode) => !(mode is >= MathNodeMode.Sin and <= MathNodeMode.Tan);
+    public static bool UsesYValue(this MathNodeMode mode) =>
+        mode != MathNodeMode.Sin &&
+        mode != MathNodeMode.Cos &&
+        mode != MathNodeMode.Tan &&
+        mode != MathNodeMode.Fraction &&
+        mode != MathNodeMode.Absolute &&
+        mode != MathNodeMode.Negate &&
+        mode != MathNodeMode.Floor &&
+        mode != MathNodeMode.Ceil &&
+        mode != MathNodeMode.Round &&
+        mode != MathNodeMode.NaturalLogarithm;
+    
 
 
     public static bool UsesZValue(this MathNodeMode mode) => mode is MathNodeMode.Compare;
     public static bool UsesZValue(this MathNodeMode mode) => mode is MathNodeMode.Compare;
 
 

+ 19 - 1
src/PixiEditor/Data/Localization/Languages/en.json

@@ -743,6 +743,21 @@
   "SIN": "Sin",
   "SIN": "Sin",
   "COS": "Cos",
   "COS": "Cos",
   "TAN": "Tan",
   "TAN": "Tan",
+  "GREATER_THAN": "Greater than",
+  "LESS_THAN": "Less than",
+  "LESS_THAN_OR_EQUAL": "Less than or equal",
+  "COMPARE": "Compare",
+  "MATH_POWER": "Power",
+  "LOGARITHM": "Logarithm",
+  "NATURAL_LOGARITHM": "Natural logarithm",
+  "ROOT": "Root",
+  "INVERSE_ROOT": "Inverse root",
+  "FRACTION": "Fraction",
+  "NEGATE": "Negate",
+  "FLOOR": "Floor",
+  "CEIL": "Ceil",
+  "ROUND": "Round",
+  "MODULO": "Modulo",
   "PIXEL_ART_TOOLSET": "Pixel Art",
   "PIXEL_ART_TOOLSET": "Pixel Art",
   "VECTOR_TOOLSET": "Vector",
   "VECTOR_TOOLSET": "Vector",
   "VECTOR_LAYER": "Vector Layer",
   "VECTOR_LAYER": "Vector Layer",
@@ -810,5 +825,8 @@
   "PASTE_NODES_DESCRIPTIVE": "Paste copied nodes",
   "PASTE_NODES_DESCRIPTIVE": "Paste copied nodes",
   "COPY_CELS": "Copy cels",
   "COPY_CELS": "Copy cels",
   "COPY_CELS_DESCRIPTIVE": "Copy selected cels",
   "COPY_CELS_DESCRIPTIVE": "Copy selected cels",
-  "TOGGLE_ONION_SKINNING_DESCRIPTIVE": "Toggle onion skinning"
+  "TOGGLE_ONION_SKINNING_DESCRIPTIVE": "Toggle onion skinning",
+  "VALUE": "Value",
+  "TARGET": "Target",
+  "EPSILON": "Epsilon"
 }
 }

+ 1 - 1
src/PixiParser

@@ -1 +1 @@
-Subproject commit 345e15022ad031e97907bdeba8a91cc4c7fd2a8d
+Subproject commit 357930a8fcc6669df3a4fb6411bdbf7ad3f4e7e6