Prechádzať zdrojové kódy

Length and UvToScreen node

Jed 4 rokov pred
rodič
commit
ecbac393f2

+ 24 - 0
hrt/shgraph/nodes/Length.hx

@@ -0,0 +1,24 @@
+package hrt.shgraph.nodes;
+
+using hxsl.Ast;
+
+@name("Length")
+@description("")
+@width(80)
+@group("Math")
+class Length extends ShaderFunction {
+
+	@input("A") var a = SType.Vec2;
+
+	public function new() {
+		super(Length);
+	}
+
+	override public function computeOutputs() {
+		if (a != null && !a.isEmpty())
+			addOutput("output", TFloat);
+		else
+			removeOutput("output");
+	}
+
+}

+ 24 - 0
hrt/shgraph/nodes/UvToScreen.hx

@@ -0,0 +1,24 @@
+package hrt.shgraph.nodes;
+
+using hxsl.Ast;
+
+@name("uvToScreen")
+@description("")
+@width(80)
+@group("Math")
+class UvToScreen extends ShaderFunction {
+
+	@input("uv") var uv = SType.Vec2;
+
+	public function new() {
+		super(UvToScreen);
+	}
+
+	override public function computeOutputs() {
+		if (uv != null && !uv.isEmpty())
+			addOutput("output", uv.getType());
+		else
+			removeOutput("output");
+	}
+
+}