|
@@ -2,6 +2,7 @@
|
|
|
using PixiEditor.ChangeableDocument.Rendering;
|
|
|
using PixiEditor.DrawingApi.Core;
|
|
|
using PixiEditor.DrawingApi.Core.ColorsImpl;
|
|
|
+using PixiEditor.DrawingApi.Core.Shaders.Generation.Expressions;
|
|
|
using PixiEditor.Numerics;
|
|
|
|
|
|
namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
|
|
@@ -9,29 +10,29 @@ namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
|
|
|
[NodeInfo("Lerp")]
|
|
|
public class LerpColorNode : Node // TODO: ILerpable as inputs?
|
|
|
{
|
|
|
- public FuncOutputProperty<Color> Result { get; }
|
|
|
- public FuncInputProperty<Color> From { get; }
|
|
|
- public FuncInputProperty<Color> To { get; }
|
|
|
- public FuncInputProperty<double> Time { get; }
|
|
|
+ public FuncOutputProperty<Half4> Result { get; }
|
|
|
+ public FuncInputProperty<Half4> From { get; }
|
|
|
+ public FuncInputProperty<Half4> To { get; }
|
|
|
+ public FuncInputProperty<Float1> Time { get; }
|
|
|
|
|
|
public override string DisplayName { get; set; } = "LERP_NODE";
|
|
|
|
|
|
|
|
|
public LerpColorNode()
|
|
|
{
|
|
|
- Result = CreateFuncOutput("Result", "RESULT", Lerp);
|
|
|
- From = CreateFuncInput("From", "FROM", Colors.Black);
|
|
|
- To = CreateFuncInput("To", "TO", Colors.White);
|
|
|
- Time = CreateFuncInput("Time", "TIME", 0.5);
|
|
|
+ Result = CreateFuncOutput<Half4>("Result", "RESULT", Lerp);
|
|
|
+ From = CreateFuncInput<Half4>("From", "FROM", Colors.Black);
|
|
|
+ To = CreateFuncInput<Half4>("To", "TO", Colors.White);
|
|
|
+ Time = CreateFuncInput<Float1>("Time", "TIME", 0.5);
|
|
|
}
|
|
|
|
|
|
- private Color Lerp(FuncContext arg)
|
|
|
+ private Half4 Lerp(FuncContext arg)
|
|
|
{
|
|
|
var from = From.Value(arg);
|
|
|
var to = To.Value(arg);
|
|
|
var time = Time.Value(arg);
|
|
|
|
|
|
- return Color.Lerp(from, to, time);
|
|
|
+ return arg.NewHalf4(ShaderMath.Lerp(from, to, time));
|
|
|
}
|
|
|
|
|
|
protected override Texture? OnExecute(RenderingContext context)
|