Browse Source

Add default fragment program for "particle" mode

Popov72 5 years ago
parent
commit
6ddbcd50c3
1 changed files with 21 additions and 0 deletions
  1. 21 0
      src/Materials/Node/nodeMaterial.ts

+ 21 - 0
src/Materials/Node/nodeMaterial.ts

@@ -1270,6 +1270,27 @@ export class NodeMaterial extends PushMaterial {
     }
 
     /**
+     * Clear the current material and set it to a default state for particle
+     */
+    public setToDefaultParticle() {
+        this.clear();
+
+        this.editorData = null;
+
+        // Pixel
+        var pixelColor = new InputBlock("color");
+        pixelColor.value = new Color4(0.8, 0.8, 0.8, 1);
+
+        var fragmentOutput = new FragmentOutputBlock("FragmentOutput");
+        pixelColor.connectTo(fragmentOutput);
+
+        // Add to nodes
+        this.addOutputNode(fragmentOutput);
+
+        this._mode = NodeMaterialModes.Particle;
+    }
+
+    /**
      * Loads the current Node Material from a url pointing to a file save by the Node Material Editor
      * @param url defines the url to load from
      * @returns a promise that will fullfil when the material is fully loaded