Răsfoiți Sursa

Added vec2/3/4 nodes for conversion

Clement Espeute 1 an în urmă
părinte
comite
962b98e882

+ 0 - 1
hrt/shgraph/ShaderGraph.hx

@@ -427,7 +427,6 @@ class ShaderGraph extends hrt.prefab.Prefab {
 					p.type = std.Type.createEnum(Type, typeString[0], [Std.parseInt(paramsEnum[0]), std.Type.createEnum(VecType, paramsEnum[1])]);
 				}
 			}
-			trace(p);
 			p.variable = generateParameter(p.name, p.type);
 			this.parametersAvailable.set(p.id, p);
 			parametersKeys.push(p.id);

+ 22 - 0
hrt/shgraph/nodes/Vec2.hx

@@ -0,0 +1,22 @@
+package hrt.shgraph.nodes;
+
+import hxsl.Types.Vec;
+import hxsl.*;
+
+using hxsl.Ast;
+
+@name("Vec2")
+@description("Create a vector of size 2 from 2 floats")
+@group("Channel")
+class Vec2 extends ShaderNodeHxsl {
+
+	static var SRC = {
+		@sginput(0.0) var x : Float;
+		@sginput(0.0) var y : Float;
+		@sgoutput var output : Vec2;
+
+		function fragment() {
+			output = vec2(x,y);
+		}
+	}
+}

+ 23 - 0
hrt/shgraph/nodes/Vec3.hx

@@ -0,0 +1,23 @@
+package hrt.shgraph.nodes;
+
+import hxsl.Types.Vec;
+import hxsl.*;
+
+using hxsl.Ast;
+
+@name("Vec3")
+@description("Create a vector of size 3 from 3 floats")
+@group("Channel")
+class Vec3 extends ShaderNodeHxsl {
+
+	static var SRC = {
+		@sginput(0.0) var x : Float;
+		@sginput(0.0) var y : Float;
+		@sginput(0.0) var z : Float;
+		@sgoutput var output : Vec3;
+
+		function fragment() {
+			output = vec3(x,y,z);
+		}
+	}
+}

+ 25 - 0
hrt/shgraph/nodes/Vec4.hx

@@ -0,0 +1,25 @@
+package hrt.shgraph.nodes;
+
+import hxsl.Types.Vec;
+import hxsl.*;
+
+using hxsl.Ast;
+
+@name("Vec4")
+@description("Create a vector of size 4 from 4 floats")
+@group("Channel")
+class Vec4 extends ShaderNodeHxsl {
+
+	static var SRC = {
+		@sginput(0.0) var x : Float;
+		@sginput(0.0) var y : Float;
+		@sginput(0.0) var z : Float;
+		@sginput(0.0) var w : Float;
+
+		@sgoutput var output : Vec4;
+
+		function fragment() {
+			output = vec4(x,y,z,w);
+		}
+	}
+}