Browse Source

Merge pull request #7190 from Popov72/Freeze-support-ShaderMaterial

Added support for the freeze / unfreeze functions in ShaderMaterial
David Catuhe 5 years ago
parent
commit
9d865cc235
2 changed files with 8 additions and 0 deletions
  1. 1 0
      dist/preview release/what's new.md
  2. 7 0
      src/Materials/shaderMaterial.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -126,6 +126,7 @@
 - Added `scene.environmentIntensity` to control the IBL strength overall in a scene ([Sebavan](https://github.com/sebavan/))
 - Added support of image processing for `WaterMaterial` ([julien-moreau](https://github.com/julien-moreau))
 - Added `pbrBRDFConfiguration.useSpecularGlossinessInputEnergyConservation` to allow Specular-Workflow energy conservation to be turned off ([ColorDigital-PS](https://github.com/ColorDigital-PS)).
+- Added support for the `freeze` / `unfreeze` functions in `ShaderMaterial` ([Popov72](https://github.com/Popov72))
 - Added `depthFunction` new property to `Material` base class ([Popov72](https://github.com/Popov72))
 
 ### ScreenshotTools

+ 7 - 0
src/Materials/shaderMaterial.ts

@@ -470,6 +470,12 @@ export class ShaderMaterial extends Material {
      * @returns true if ready, otherwise false
      */
     public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {
+        if (this._effect && this.isFrozen) {
+            if (this._wasPreviouslyReady) {
+                return true;
+            }
+        }
+
         var scene = this.getScene();
         var engine = scene.getEngine();
 
@@ -588,6 +594,7 @@ export class ShaderMaterial extends Material {
         }
 
         this._renderId = scene.getRenderId();
+        this._wasPreviouslyReady = true;
 
         return true;
     }