Просмотр исходного кода

make node material props public

Trevor Baron 6 лет назад
Родитель
Сommit
cce8c8a1b4

+ 4 - 2
src/Materials/Node/nodeMaterial.ts

@@ -101,12 +101,12 @@ export class NodeMaterial extends PushMaterial {
     /**
      * Gets or sets the root nodes of the material vertex shader
      */
-    private _vertexOutputNodes = new Array<NodeMaterialBlock>();
+    public _vertexOutputNodes = new Array<NodeMaterialBlock>();
 
     /**
      * Gets or sets the root nodes of the material fragment (pixel) shader
      */
-    private _fragmentOutputNodes = new Array<NodeMaterialBlock>();
+    public _fragmentOutputNodes = new Array<NodeMaterialBlock>();
 
     /** Gets or sets options to control the node material overall behavior */
     public get options() {
@@ -447,6 +447,8 @@ export class NodeMaterial extends PushMaterial {
 
         this._buildWasSuccessful = true;
         this.onBuildObservable.notifyObservers(this);
+
+        this._markAllSubMeshesAsAllDirty();
     }
 
     /**

+ 2 - 2
src/Materials/Node/nodeMaterialBlock.ts

@@ -17,9 +17,9 @@ export class NodeMaterialBlock {
     private _isFinalMerger = false;
 
     /** @hidden */
-    protected _inputs = new Array<NodeMaterialConnectionPoint>();
+    public _inputs = new Array<NodeMaterialConnectionPoint>();
     /** @hidden */
-    protected _outputs = new Array<NodeMaterialConnectionPoint>();
+    public _outputs = new Array<NodeMaterialConnectionPoint>();
 
     /**
      * Gets or sets the name of the block

+ 2 - 2
src/Materials/Node/nodeMaterialBlockConnectionPoint.ts

@@ -12,8 +12,8 @@ declare type NodeMaterialBlock = import("./nodeMaterialBlock").NodeMaterialBlock
  * Defines a connection point for a block
  */
 export class NodeMaterialConnectionPoint {
-    private _ownerBlock: NodeMaterialBlock;
-    private _connectedPoint: Nullable<NodeMaterialConnectionPoint>;
+    public _ownerBlock: NodeMaterialBlock;
+    public _connectedPoint: Nullable<NodeMaterialConnectionPoint>;
     private _associatedVariableName: string;
     private _endpoints = new Array<NodeMaterialConnectionPoint>();
     private _storedValue: any;

+ 8 - 0
src/Materials/material.ts

@@ -917,6 +917,7 @@ export class Material implements IAnimatable {
         });
     }
 
+    private static readonly _AllDirtyCallBack = (defines: MaterialDefines) => defines.markAllAsDirty();
     private static readonly _ImageProcessingDirtyCallBack = (defines: MaterialDefines) => defines.markAsImageProcessingDirty();
     private static readonly _TextureDirtyCallBack = (defines: MaterialDefines) => defines.markAsTexturesDirty();
     private static readonly _FresnelDirtyCallBack = (defines: MaterialDefines) => defines.markAsFresnelDirty();
@@ -1007,6 +1008,13 @@ export class Material implements IAnimatable {
         }
     }
 
+        /**
+     * Indicates that we need to re-calculated for all submeshes
+     */
+    protected _markAllSubMeshesAsAllDirty() {
+        this._markAllSubMeshesAsDirty(Material._AllDirtyCallBack);
+    }
+
     /**
      * Indicates that image processing needs to be re-calculated for all submeshes
      */