瀏覽代碼

[shgraph] cleaned up old shgraph commented code

Clément Espeute 1 年之前
父節點
當前提交
7e8661218f

+ 0 - 4
hrt/shgraph/ShaderConst.hx

@@ -6,10 +6,6 @@ class ShaderConst extends ShaderNode {
 
 	@prop() public var name : String = "";
 
-	// override public function getOutputType(key : String) : Type {
-	// 	return getOutputTExpr(key).t;
-	// }
-
 	override function generate(ctx:NodeGenContext) {
 
 	}

+ 0 - 56
hrt/shgraph/ShaderFunction.hx

@@ -1,56 +0,0 @@
-package hrt.shgraph;
-
-using hxsl.Ast;
-
-class ShaderFunction extends ShaderNode {
-
-
-	var func : TGlobal;
-
-	public function new(func : TGlobal) {
-		this.func = func;
-	}
-
-	// override public function build(key : String) : TExpr {
-	// 	var args = [];
-	// 	var varArgs = [];
-
-	// 	for (k in getInputInfoKeys()) {
-	// 		if (getInputInfo(k).hasProperty && getInput(k) == null) {
-	// 			var value : Dynamic = Reflect.field(this, "prop_"+k);
-	// 			if (value == null)
-	// 				value = 0;
-	// 			args.push({ name: k, type: TFloat });
-	// 			varArgs.push(new NodeVar(new hrt.shgraph.nodes.FloatConst(value), "output").getVar());
-	// 		} else {
-	// 			args.push({ name: k, type: getInput(k).getType() });
-	// 			var wantedType = ShaderType.getType(getInputInfo(k).type);
-	// 			varArgs.push(getInput(k).getVar((wantedType != null) ? wantedType : null));
-	// 		}
-	// 	}
-
-	// 	return {
-	// 				p : null,
-	// 				t : output.type,
-	// 				e : TBinop(OpAssign, {
-	// 					e: TVar(output),
-	// 					p: null,
-	// 					t: output.type
-	// 				}, {
-	// 					e: TCall({
-	// 						e: TGlobal(func),
-	// 						p: null,
-	// 						t: TFun([
-	// 							{
-	// 								ret: output.type,
-	// 								args: args
-	// 							}
-	// 						])
-	// 					}, varArgs),
-	// 					p: null,
-	// 					t: output.type
-	// 				})
-	// 			};
-	// }
-
-}

+ 0 - 50
hrt/shgraph/ShaderOutput.hx

@@ -74,23 +74,6 @@ class ShaderOutput extends ShaderNode {
 		}
 	}
 
-	/*override public function saveProperties() : Dynamic {
-		if (this.variable == null) {
-			this.variable = ShaderNode.availableVariables[0];
-		}
-		var parameters : Dynamic = {
-			name: variable.name,
-			type: variable.type.getName(),
-		};
-		switch variable.type {
-			case TVec(size, t):
-				parameters.vecSize = size;
-				parameters.vecType = t.getName();
-			default:
-		}
-		return parameters;
-	}*/
-
 
 	#if editor
 	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
@@ -108,42 +91,9 @@ class ShaderOutput extends ShaderNode {
 		}
 		input.val(variable);
 
-		/*var maxIndex = indexOption;
-		input.append(new hide.Element('<option value="${maxIndex}">Other...</option>'));
-		var initialName : String = null;
-		var initialType : Type = null;
-		if( !selectingDefault ) {
-			input.val(maxIndex);
-			initialName = this.variable.name;
-			initialType = this.variable.type;
-		}*/
-
-		/*var customVarChooser = new CustomVarChooser(element, initialName, initialType, function(val) {
-			this.variable = val;
-		});
-
-		if( !selectingDefault )
-			customVarChooser.show();
-		else
-			customVarChooser.hide();*/
-
 		input.on("change", function(e) {
 			variable = input.val();
 			inputs = null;
-			/*var value = input.val();
-			if (value < ShaderNode.availableVariables.length) {
-				this.variable = ShaderNode.availableVariables[value];
-			} else if (value < maxIndex) {
-				this.variable = ShaderOutput.availableOutputs[value-ShaderNode.availableVariables.length];
-			}
-			if (value == maxIndex) {
-				customVarChooser.show();
-				if (customVarChooser.variable != null) {
-					this.variable = customVarChooser.variable;
-				}
-			} else {
-				customVarChooser.hide();
-			}*/
 		});
 
 		elements.push(element);

+ 0 - 8
hrt/shgraph/ShaderParticleInput.hx

@@ -9,14 +9,6 @@ using hxsl.Ast;
 class ShaderParticleInputs extends ShaderNode {
 	@prop("Variable") public var variable : String = "life";
 
-	// override public function getOutput(key : String) : TVar {
-	// 	return variable;
-	// }
-
-	// override public function build(key : String) : TExpr {
-	// 	return null;
-	// }
-
 	public function new(variable = "life") {
 		this.variable = variable;
 	}

+ 0 - 45
hrt/shgraph/nodes/Cond.hx

@@ -32,54 +32,9 @@ class Cond extends ShaderNode {
 		ctx.addPreview(expr);
 	}
 
-	// @input("Left") var leftVar = SType.Number;
-	// @input("Right") var rightVar = SType.Number;
-
 
 	@prop() var condition : Binop = OpEq;
 
-	// override public function checkValidityInput(key : String, type : ShaderType.SType) : Bool {
-
-	// 	if (key == "leftVar" && rightVar != null && !rightVar.isEmpty())
-	// 		return ShaderType.checkCompatibilities(type, ShaderType.getSType(rightVar.getType()));
-
-	// 	if (key == "rightVar" && leftVar != null && !leftVar.isEmpty())
-	// 		return ShaderType.checkCompatibilities(type, ShaderType.getSType(leftVar.getType()));
-
-	// 	return true;
-	// }
-
-	// override public function computeOutputs() {
-	// 	if (leftVar != null && !leftVar.isEmpty() && rightVar != null && !rightVar.isEmpty()) {
-	// 		var type = leftVar.getVar(rightVar.getType()).t;
-	// 		switch(type) {
-	// 			case TVec(s, t):
-	// 				removeOutput("output");
-	// 				throw ShaderException.t("Vector of bools is not supported", this.id); //addOutput("output", TVec(s, VBool));
-	// 			case TFloat:
-	// 				addOutput("output", TBool);
-	// 			default:
-	// 				removeOutput("output");
-	// 		}
-	// 	} else
-	// 		removeOutput("output");
-	// }
-
-	// override public function build(key : String) : TExpr {
-	// 	return {
-	// 			p : null,
-	// 			t : output.type,
-	// 			e : TBinop(OpAssign, {
-	// 					e: TVar(output),
-	// 					p: null,
-	// 					t: output.type
-	// 				}, {e: TBinop(this.condition,
-	// 						leftVar.getVar(rightVar.getType()),
-	// 						rightVar.getVar(leftVar.getType())),
-	// 					p: null, t: output.type })
-	// 		};
-	// }
-
 	static var availableConditions = [OpEq, OpNotEq, OpGt, OpGte, OpLt, OpLte, OpAnd, OpOr];
 	static var conditionStrings 	= ["==", "!=",    ">",  ">=",  "<",  "<=",  "AND", "OR"];
 

+ 0 - 85
hrt/shgraph/nodes/Sampler.hx

@@ -131,89 +131,4 @@ class Sampler extends ShaderNodeHxsl {
 		return elements;
 	}
 	#end
-
-	// @input("Texture") var texture = SType.Sampler;
-	// @input("UV") var uv = SType.Vec2;
-
-
-
-	// var components = [X, Y, Z, W];
-	// var componentsString = ["r", "g", "b", "a"];
-
-	// override public function computeOutputs() {
-	// 	addOutput("rgba", TVec(4, VFloat));
-	// 	addOutput("r", TFloat);
-	// 	addOutput("g", TFloat);
-	// 	addOutput("b", TFloat);
-	// 	addOutput("a", TFloat);
-	// }
-
-	// override public function build(key : String) : TExpr {
-	// 	if (key == "rgba") {
-	// 		var args = [];
-	// 		var varArgs = [];
-
-	// 		for (k in getInputInfoKeys()) {
-	// 			args.push({ name: k, type: getInput(k).getType() });
-	// 			var wantedType = ShaderType.getType(getInputInfo(k).type);
-	// 			varArgs.push(getInput(k).getVar((wantedType != null) ? wantedType : null));
-	// 		}
-
-	// 		return {
-	// 					p : null,
-	// 					t : rgba.type,
-	// 					e : TBinop(OpAssign, {
-	// 						e: TVar(rgba),
-	// 						p: null,
-	// 						t: rgba.type
-	// 					}, {
-	// 						e: TCall({
-	// 							e: TGlobal(Texture),
-	// 							p: null,
-	// 							t: TFun([
-	// 								{
-	// 									ret: rgba.type,
-	// 									args: args
-	// 								}
-	// 							])
-	// 						}, varArgs),
-	// 						p: null,
-	// 						t: rgba.type
-	// 					})
-	// 				};
-	// 	} else {
-	// 		var arrayExpr = [];
-	// 		if (!outputCompiled.get("rgba")) {
-	// 			arrayExpr.push({ e : TVarDecl(rgba), t : rgba.type, p : null });
-	// 			arrayExpr.push(build("rgba"));
-	// 			outputCompiled.set("rgba", true);
-	// 		}
-	// 		var compIdx = componentsString.indexOf(key);
-	// 		arrayExpr.push({ e: TBinop(OpAssign, {
-	// 					e: TVar(getOutput(key)),
-	// 					p: null,
-	// 					t: getOutput(key).type
-	// 				}, {e: TSwiz({
-	// 						e: TVar(rgba),
-	// 						p: null,
-	// 						t: rgba.type
-	// 					},
-	// 					[components[compIdx]]),
-	// 					p: null,
-	// 					t: getOutput(key).type }),
-	// 				p: null,
-	// 				t: getOutput(key).type
-	// 			});
-	// 		if (arrayExpr.length > 1) {
-	// 			return {
-	// 				p : null,
-	// 				t : TVoid,
-	// 				e : TBlock(arrayExpr)
-	// 			};
-	// 		} else {
-	// 			return arrayExpr[0];
-	// 		}
-	// 	}
-	// }
-
 }

+ 0 - 98
hrt/shgraph/nodes/UVScroll.hx

@@ -21,101 +21,3 @@ class UVScroll extends  ShaderNodeHxsl {
 	};
 
 }
-
-	// @input("UV") var uv = SType.Vec2;
-	// @input("USpeed", true) var uSpeed = SType.Number;
-	// @input("VSpeed", true) var vSpeed = SType.Number;
-
-
-	// var operation : Binop;
-
-	// public function new(operation : Binop) {
-	// 	this.operation = operation;
-	// }
-
-	// override public function computeOutputs() {
-	// 	if (uv != null && !uv.isEmpty())
-	// 		addOutput("output", uv.getType());
-	// 	else
-	// 		removeOutput("output");
-	// }
-
-	// override public function build(key : String) : TExpr {
-
-	// 	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 };
-
-	// 	return { e: TBinop(OpAssign, {
-	// 					e: TVar(output),
-	// 					p: null,
-	// 					t: output.type
-	// 				}, {
-	// 					// uv % 1 (wrap)
-	// 					e: TCall({
-	// 						e: TGlobal(Mod),
-	// 						p: null,
-	// 						t: TFun([
-	// 							{
-	// 								ret: output.type,
-	// 								args: [
-	// 									{ name: "uv", type : output.type },
-	// 									{ name: "mod", type : TFloat }
-	// 								]
-	// 							}
-	// 						])
-	// 					}, [
-	// 						{
-	// 							// uv + speed * time
-	// 							e: TBinop(OpAdd,
-	// 								uv.getVar(),
-	// 								{
-	// 									e: TCall({
-	// 										e: TGlobal(Vec2),
-	// 										p: null,
-	// 										t: TFun([
-	// 											{
-	// 												ret: output.type,
-	// 												args: [
-	// 													{ name: "u", type : TFloat },
-	// 													{ name: "v", type : TFloat }
-	// 												]
-	// 											}
-	// 										])
-	// 									}, [
-	// 										// uSpeed * time
-	// 										{
-	// 											e: TBinop(OpMult,
-	// 												uSpeed.getVar(),
-	// 												timeExpr),
-	// 											p: null,
-	// 											t: uSpeed.getType()
-	// 										},
-	// 										// vSpeed * time
-	// 										{
-	// 											e: TBinop(OpMult,
-	// 												vSpeed.getVar(),
-	// 												timeExpr),
-	// 											p: null,
-	// 											t: vSpeed.getType()
-	// 										}
-	// 									]
-	// 									),
-	// 									p: null,
-	// 									t: output.type
-	// 								}),
-	// 							p: null,
-	// 							t: uSpeed.getType()
-	// 						},
-	// 						{
-	// 							e: TConst(CFloat(1)),
-	// 							p: null,
-	// 							t: TFloat
-	// 						}
-	// 					]),
-	// 					p: null,
-	// 					t: output.type
-	// 				}),
-	// 				p: null,
-	// 				t: output.type
-	// 			};
-	// }