@@ -9,5 +9,6 @@ common.hxml
--macro include("hxd.clipper")
--macro include("hxd.earcut")
--macro include("hrt.prefab")
+--macro include("hrt.shgraph.nodes")
-dce no
-debug
@@ -547,7 +547,7 @@ class ShaderGraph {
parameters: [
for (p in parametersAvailable) { id : p.id, name : p.name, type : [p.type.getName(), p.type.getParameters().toString()], defaultValue : p.defaultValue }
]
- });
+ }, "\t");
return json;
}
@@ -2,11 +2,11 @@ package hrt.shgraph.nodes;
using hxsl.Ast;
-@name("Lerp")
+@name("Mix")
@description("Linear interpolation between a and b using mix")
@width(80)
@group("Math")
-class Lerp extends ShaderFunction {
+class Mix extends ShaderFunction {
@input("a") var x = SType.Number;
@input("b") var y = SType.Number;
@@ -0,0 +1,25 @@
+package hrt.shgraph.nodes;
+
+using hxsl.Ast;
+@name("Sqrt")
+@description("The output is the squre root A")
+@width(80)
+@group("Math")
+@:keep
+class Sqrt extends ShaderFunction {
+ @input("A") var a = SType.Number;
+ public function new() {
+ super(Sqrt);
+ }
+ override public function computeOutputs() {
+ if (a != null && !a.isEmpty())
+ addOutput("output", a.getType());
+ else
+ removeOutput("output");
+}