浏览代码

Unify naming input/output

Jed 4 年之前
父节点
当前提交
652f3e1939

+ 3 - 3
hrt/shgraph/nodes/Clamp.hx

@@ -8,9 +8,9 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Clamp extends ShaderFunction {
 class Clamp extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
-	@input("min", true) var min = SType.Number;
-	@input("max", true) var max = SType.Number;
+	@input("X") var x = SType.Number;
+	@input("Min", true) var min = SType.Number;
+	@input("Max", true) var max = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Saturate);
 		super(Saturate);

+ 4 - 4
hrt/shgraph/nodes/Cond.hx

@@ -7,10 +7,10 @@ using hxsl.Ast;
 @group("Condition")
 @group("Condition")
 class Cond extends ShaderNode {
 class Cond extends ShaderNode {
 
 
-	@input("left") var leftVar = SType.Number;
-	@input("right") var rightVar = SType.Number;
+	@input("Left") var leftVar = SType.Number;
+	@input("Right") var rightVar = SType.Number;
 
 
-	@output("boolean") var output = SType.Bool;
+	@output("Boolean") var output = SType.Bool;
 
 
 	@prop() var condition : Binop;
 	@prop() var condition : Binop;
 
 
@@ -60,7 +60,7 @@ class Cond extends ShaderNode {
 	var conditionStrings 	= ["==", "!=",    ">",  ">=",  "<",  "<=",  "AND", "OR"];
 	var conditionStrings 	= ["==", "!=",    ">",  ">=",  "<",  "<=",  "AND", "OR"];
 
 
 	override public function loadProperties(props : Dynamic) {
 	override public function loadProperties(props : Dynamic) {
-		this.condition = std.Type.createEnum(Binop, Reflect.field(props, "condition"));
+		this.condition = std.Type.createEnum(Binop, Reflect.field(props, "Condition"));
 	}
 	}
 
 
 	override public function saveProperties() : Dynamic {
 	override public function saveProperties() : Dynamic {

+ 2 - 2
hrt/shgraph/nodes/Cross.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Cross extends ShaderFunction {
 class Cross extends ShaderFunction {
 
 
-	@input("a") var a = SType.Number;
-	@input("b") var b = SType.Number;
+	@input("A") var a = SType.Number;
+	@input("B") var b = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Cross);
 		super(Cross);

+ 2 - 2
hrt/shgraph/nodes/Dot.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Dot extends ShaderFunction {
 class Dot extends ShaderFunction {
 
 
-	@input("a") var a = SType.Number;
-	@input("b") var b = SType.Number;
+	@input("A") var a = SType.Number;
+	@input("B") var b = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Dot);
 		super(Dot);

+ 2 - 2
hrt/shgraph/nodes/Exp.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Exp extends ShaderFunction {
 class Exp extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
-	@input("p", true) var p = SType.Number;
+	@input("X") var x = SType.Number;
+	@input("P", true) var p = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Exp);
 		super(Exp);

+ 1 - 1
hrt/shgraph/nodes/Floor.hx

@@ -8,7 +8,7 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Floor extends ShaderFunction {
 class Floor extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
+	@input("X") var x = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Floor);
 		super(Floor);

+ 1 - 1
hrt/shgraph/nodes/Fract.hx

@@ -8,7 +8,7 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Fract extends ShaderFunction {
 class Fract extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
+	@input("X") var x = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Fract);
 		super(Fract);

+ 3 - 3
hrt/shgraph/nodes/IfCondition.hx

@@ -7,9 +7,9 @@ using hxsl.Ast;
 @group("Condition")
 @group("Condition")
 class IfCondition extends ShaderNode {
 class IfCondition extends ShaderNode {
 
 
-	@input("condition") var condition = SType.Bool;
-	@input("true") var trueVar = SType.Variant;
-	@input("false") var falseVar = SType.Variant;
+	@input("Condition") var condition = SType.Bool;
+	@input("True") var trueVar = SType.Variant;
+	@input("False") var falseVar = SType.Variant;
 
 
 	@output() var output = SType.Variant;
 	@output() var output = SType.Variant;
 
 

+ 2 - 2
hrt/shgraph/nodes/Log.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Log extends ShaderFunction {
 class Log extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
-	@input("p", true) var p = SType.Number;
+	@input("X") var x = SType.Number;
+	@input("P", true) var p = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Log);
 		super(Log);

+ 3 - 3
hrt/shgraph/nodes/Mix.hx

@@ -8,9 +8,9 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Mix extends ShaderFunction {
 class Mix extends ShaderFunction {
 
 
-	@input("a") var x = SType.Number;
-	@input("b") var y = SType.Number;
-	@input("mix") var a = SType.Number;
+	@input("A") var x = SType.Number;
+	@input("B") var y = SType.Number;
+	@input("Mix") var a = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Mix);
 		super(Mix);

+ 2 - 2
hrt/shgraph/nodes/Mod.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Mod extends ShaderFunction {
 class Mod extends ShaderFunction {
 
 
-	@input("x") var x = SType.Variant;
-	@input("mod", true) var mod = SType.Float;
+	@input("X") var x = SType.Variant;
+	@input("Mod", true) var mod = SType.Float;
 
 
 	public function new() {
 	public function new() {
 		super(Mod);
 		super(Mod);

+ 1 - 1
hrt/shgraph/nodes/Normalize.hx

@@ -8,7 +8,7 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Normalize extends ShaderFunction {
 class Normalize extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
+	@input("X") var x = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Normalize);
 		super(Normalize);

+ 2 - 2
hrt/shgraph/nodes/Pow.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Pow extends ShaderFunction {
 class Pow extends ShaderFunction {
 
 
-	@input("x") var x = SType.Number;
-	@input("p", true) var p = SType.Number;
+	@input("X") var x = SType.Number;
+	@input("P", true) var p = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Pow);
 		super(Pow);

+ 1 - 1
hrt/shgraph/nodes/Preview.hx

@@ -11,7 +11,7 @@ using hxsl.Ast;
 @noheader()
 @noheader()
 class Preview extends ShaderNode {
 class Preview extends ShaderNode {
 
 
-	@input("input") var input = SType.Vec4;
+	@input("Input") var input = SType.Vec4;
 
 
 	public var variable : TVar;
 	public var variable : TVar;
 
 

+ 7 - 7
hrt/shgraph/nodes/Sampler.hx

@@ -7,14 +7,14 @@ using hxsl.Ast;
 @group("Property")
 @group("Property")
 class Sampler extends ShaderNode {
 class Sampler extends ShaderNode {
 
 
-	@input("texture") var texture = SType.Sampler;
-	@input("uv") var uv = SType.Vec2;
+	@input("Texture") var texture = SType.Sampler;
+	@input("UV") var uv = SType.Vec2;
 
 
-	@output("rgba") var rgba = SType.Vec4;
-	@output("r") var r = SType.Float;
-	@output("g") var g = SType.Float;
-	@output("b") var b = SType.Float;
-	@output("a") var a = SType.Float;
+	@output("RGBA") var rgba = SType.Vec4;
+	@output("R") var r = SType.Float;
+	@output("G") var g = SType.Float;
+	@output("B") var b = SType.Float;
+	@output("A") var a = SType.Float;
 
 
 	var components = [X, Y, Z, W];
 	var components = [X, Y, Z, W];
 	var componentsString = ["r", "g", "b", "a"];
 	var componentsString = ["r", "g", "b", "a"];

+ 3 - 3
hrt/shgraph/nodes/SmoothStep.hx

@@ -8,9 +8,9 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class SmoothStep extends ShaderFunction {
 class SmoothStep extends ShaderFunction {
 
 
-	@input("a") var x = SType.Number;
-	@input("b") var y = SType.Number;
-	@input("mix") var a = SType.Number;
+	@input("A") var x = SType.Number;
+	@input("A") var y = SType.Number;
+	@input("Mix") var a = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Smoothstep);
 		super(Smoothstep);

+ 2 - 2
hrt/shgraph/nodes/Step.hx

@@ -8,8 +8,8 @@ using hxsl.Ast;
 @group("Math")
 @group("Math")
 class Step extends ShaderFunction {
 class Step extends ShaderFunction {
 
 
-	@input("edge") var edge = SType.Number;
-	@input("a") var x = SType.Number;
+	@input("Edge") var edge = SType.Number;
+	@input("A") var x = SType.Number;
 
 
 	public function new() {
 	public function new() {
 		super(Step);
 		super(Step);

+ 31 - 10
hrt/shgraph/nodes/SubGraph.hx

@@ -50,24 +50,45 @@ class SubGraph extends ShaderNode {
 							ids = paramInfo.ids;
 							ids = paramInfo.ids;
 						ids.push(node.id);
 						ids.push(node.id);
 						if (!inputsInfo.exists(prefixSubGraph + paramId)) {
 						if (!inputsInfo.exists(prefixSubGraph + paramId)) {
-							inputInfoKeys.push(prefixSubGraph+paramId);
+							inputInfoKeys.insert(shaderParam.parameterIndex ,prefixSubGraph+paramId);
 						}
 						}
 						inputsInfo.set(prefixSubGraph+paramId, { name : paramName , type: ShaderType.getSType(shaderParam.variable.type), hasProperty: false, isRequired : false, ids : ids });
 						inputsInfo.set(prefixSubGraph+paramId, { name : paramName , type: ShaderType.getSType(shaderParam.variable.type), hasProperty: false, isRequired : false, ids : ids });
 					case "ShaderInput":
 					case "ShaderInput":
 						var shaderInput = Std.downcast(node.instance, ShaderInput);
 						var shaderInput = Std.downcast(node.instance, ShaderInput);
-
-						inputsInfo.set(prefixSubGraph+node.id, { name : "*" + shaderInput.variable.name , type: ShaderType.getSType(shaderInput.variable.type), hasProperty: false, isRequired : false, ids : [node.id] });
-						inputInfoKeys.push(prefixSubGraph+node.id);
+						var inputId = "input_" + shaderInput.variable.id;
+						var inputInfo = inputsInfo.get(prefixSubGraph+inputId);
+						var ids = [];
+						if (inputInfo != null && inputInfo.ids != null)
+							ids = inputInfo.ids;
+						ids.push(node.id);
+						if (!inputsInfo.exists(prefixSubGraph + inputId)) {
+							inputInfoKeys.push(prefixSubGraph+inputId);
+						}
+						inputsInfo.set(prefixSubGraph+inputId, { name : "*" + shaderInput.variable.name , type: ShaderType.getSType(shaderInput.variable.type), hasProperty: false, isRequired : false, ids : ids });
 					case "ShaderGlobalInput":
 					case "ShaderGlobalInput":
 						var shaderInput = Std.downcast(node.instance, ShaderGlobalInput);
 						var shaderInput = Std.downcast(node.instance, ShaderGlobalInput);
-
-						inputsInfo.set(prefixSubGraph+node.id, { name : "*" + shaderInput.variable.name , type: ShaderType.getSType(shaderInput.variable.type), hasProperty: false, isRequired : false, ids : [node.id] });
-						inputInfoKeys.push(prefixSubGraph+node.id);
+						var inputId = "globalInput_" + shaderInput.variable.id;
+						var inputInfo = inputsInfo.get(prefixSubGraph+inputId);
+						var ids = [];
+						if (inputInfo != null && inputInfo.ids != null)
+							ids = inputInfo.ids;
+						ids.push(node.id);
+						if (!inputsInfo.exists(prefixSubGraph + inputId)) {
+							inputInfoKeys.push(prefixSubGraph+inputId);
+						}
+						inputsInfo.set(prefixSubGraph+inputId, { name : "*" + shaderInput.variable.name , type: ShaderType.getSType(shaderInput.variable.type), hasProperty: false, isRequired : false, ids : ids });
 					case "ShaderCameraInput":
 					case "ShaderCameraInput":
 						var shaderInput = Std.downcast(node.instance, ShaderCameraInput);
 						var shaderInput = Std.downcast(node.instance, ShaderCameraInput);
-
-						inputsInfo.set(prefixSubGraph+node.id, { name : "*" + shaderInput.variable.name , type: ShaderType.getSType(shaderInput.variable.type), hasProperty: false, isRequired : false, ids : [node.id] });
-						inputInfoKeys.push(prefixSubGraph+node.id);
+						var inputId = "cameraInput_" + shaderInput.variable.id;
+						var inputInfo = inputsInfo.get(prefixSubGraph+inputId);
+						var ids = [];
+						if (inputInfo != null && inputInfo.ids != null)
+							ids = inputInfo.ids;
+						ids.push(node.id);
+						if (!inputsInfo.exists(prefixSubGraph + inputId)) {
+							inputInfoKeys.push(prefixSubGraph+inputId);
+						}
+						inputsInfo.set(prefixSubGraph+inputId, { name : "*" + shaderInput.variable.name , type: ShaderType.getSType(shaderInput.variable.type), hasProperty: false, isRequired : false, ids : ids });
 					case "ShaderOutput":
 					case "ShaderOutput":
 						var shaderOutput = Std.downcast(node.instance, ShaderOutput);
 						var shaderOutput = Std.downcast(node.instance, ShaderOutput);
 						var prefix = shaderOutput.variable.kind == Local ? "" : "*";
 						var prefix = shaderOutput.variable.kind == Local ? "" : "*";

+ 4 - 4
hrt/shgraph/nodes/UVScroll.hx

@@ -7,9 +7,9 @@ using hxsl.Ast;
 @group("Specials")
 @group("Specials")
 class UVScroll extends ShaderNode {
 class UVScroll extends ShaderNode {
 
 
-	@input("uv") var uv = SType.Vec2;
-	@input("uSpeed", true) var uSpeed = SType.Number;
-	@input("vSpeed", true) var vSpeed = SType.Number;
+	@input("UV") var uv = SType.Vec2;
+	@input("USpeed", true) var uSpeed = SType.Number;
+	@input("VSpeed", true) var vSpeed = SType.Number;
 
 
 	@output("") var output = SType.Vec2;
 	@output("") var output = SType.Vec2;
 
 
@@ -27,7 +27,7 @@ class UVScroll extends ShaderNode {
 	}
 	}
 
 
 	override public function build(key : String) : TExpr {
 	override public function build(key : String) : TExpr {
-		
+
 		var globalTime : TVar = @:privateAccess ShaderGlobalInput.globalInputs.filter(i -> i.name.indexOf("time") != -1)[0];
 		var globalTime : TVar = @:privateAccess ShaderGlobalInput.globalInputs.filter(i -> i.name.indexOf("time") != -1)[0];
 		var timeExpr : TExpr = { e: TVar(globalTime), p: null, t: globalTime.type };
 		var timeExpr : TExpr = { e: TVar(globalTime), p: null, t: globalTime.type };