|
@@ -1206,6 +1206,51 @@ export class NodeMaterial extends PushMaterial {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Clear the current material and set it to a default state for post process
|
|
|
+ */
|
|
|
+ public setToDefaultPostProcess() {
|
|
|
+ this.clear();
|
|
|
+
|
|
|
+ this.editorData = null;
|
|
|
+
|
|
|
+ const position = new InputBlock("Position");
|
|
|
+ position.setAsAttribute("position2d");
|
|
|
+
|
|
|
+ const const1 = new InputBlock("Constant1");
|
|
|
+ const1.isConstant = true;
|
|
|
+ const1.value = 1;
|
|
|
+
|
|
|
+ const vmerger = new VectorMergerBlock("Position3D");
|
|
|
+
|
|
|
+ position.connectTo(vmerger);
|
|
|
+ const1.connectTo(vmerger, { input: "w" });
|
|
|
+
|
|
|
+ const vertexOutput = new VertexOutputBlock("VertexOutput");
|
|
|
+ vmerger.connectTo(vertexOutput);
|
|
|
+
|
|
|
+ // Pixel
|
|
|
+ const scale = new InputBlock("scale");
|
|
|
+ scale.visibleInInspector = true;
|
|
|
+ scale.value = new Vector2(1, 1);
|
|
|
+
|
|
|
+ const uv0 = new RemapBlock("uv0");
|
|
|
+ position.connectTo(uv0);
|
|
|
+
|
|
|
+ const uv = new MultiplyBlock("uv");
|
|
|
+ uv0.connectTo(uv);
|
|
|
+ scale.connectTo(uv);
|
|
|
+
|
|
|
+ const currentScreen = new CurrentScreenBlock("CurrentScreen");
|
|
|
+ uv.connectTo(currentScreen);
|
|
|
+
|
|
|
+ var fragmentOutput = new FragmentOutputBlock("FragmentOutput");
|
|
|
+ currentScreen.connectTo(fragmentOutput, { output: "rgba" });
|
|
|
+
|
|
|
+ // Add to nodes
|
|
|
+ this.addOutputNode(vertexOutput);
|
|
|
+ this.addOutputNode(fragmentOutput);
|
|
|
+
|
|
|
+ this._mode = NodeMaterialModes.PostProcess;
|
|
|
}
|
|
|
|
|
|
/**
|