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

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

Guide 7 лет назад
Родитель
Сommit
4f83d1fc5c
30 измененных файлов с 4081 добавлено и 3076 удалено
  1. 2176 1860
      Playground/babylon.d.txt
  2. 3 1
      Tools/Gulp/config.json
  3. 981 876
      dist/preview release/babylon.d.ts
  4. 1 1
      dist/preview release/babylon.js
  5. 213 62
      dist/preview release/babylon.max.js
  6. 213 62
      dist/preview release/babylon.no-module.max.js
  7. 1 1
      dist/preview release/babylon.worker.js
  8. 215 64
      dist/preview release/es6.js
  9. 2 78
      dist/preview release/typedocValidationBaseline.json
  10. 21 0
      dist/preview release/viewer/babylon.viewer.d.ts
  11. 1 1
      dist/preview release/viewer/babylon.viewer.js
  12. 1 1
      dist/preview release/viewer/babylon.viewer.max.js
  13. 25 1
      dist/preview release/viewer/babylon.viewer.module.d.ts
  14. 1 0
      dist/preview release/what's new.md
  15. 4 0
      src/Layer/babylon.effectLayerSceneComponent.ts
  16. 4 0
      src/LensFlare/babylon.lensFlareSystemSceneComponent.ts
  17. 6 0
      src/Lights/Shadows/babylon.shadowGenerator.ts
  18. 110 0
      src/Lights/Shadows/babylon.shadowGeneratorSceneComponent.ts
  19. 1 1
      src/Lights/babylon.hemisphericLight.ts
  20. 2 11
      src/Loading/Plugins/babylon.babylonFileLoader.ts
  21. 5 1
      src/Materials/Textures/Procedurals/babylon.proceduralTexture.ts
  22. 70 0
      src/Materials/Textures/Procedurals/babylon.proceduralTextureSceneComponent.ts
  23. 2 2
      src/Particles/babylon.particleSystem.ts
  24. 3 3
      src/PostProcess/RenderPipeline/Pipelines/babylon.standardRenderingPipeline.ts
  25. 1 1
      src/Shaders/gpuUpdateParticles.vertex.fx
  26. 0 11
      src/Tools/babylon.sceneSerializer.ts
  27. 2 3
      src/babylon.node.ts
  28. 8 31
      src/babylon.scene.ts
  29. 8 3
      src/babylon.sceneComponent.ts
  30. 1 1
      tests/validation/config.json

Разница между файлами не показана из-за своего большого размера
+ 2176 - 1860
Playground/babylon.d.txt


+ 3 - 1
Tools/Gulp/config.json

@@ -609,7 +609,8 @@
         },
         "shadows": {
             "files": [
-                "../../src/Lights/Shadows/babylon.shadowGenerator.js"
+                "../../src/Lights/Shadows/babylon.shadowGenerator.js",
+                "../../src/Lights/Shadows/babylon.shadowGeneratorSceneComponent.js"
             ],
             "dependUpon": [
                 "postProcesses"
@@ -684,6 +685,7 @@
         "procedural": {
             "files": [
                 "../../src/Materials/Textures/Procedurals/babylon.proceduralTexture.js",
+                "../../src/Materials/Textures/Procedurals/babylon.proceduralTextureSceneComponent.js",
                 "../../src/Materials/Textures/Procedurals/babylon.customProceduralTexture.js"
             ],
             "dependUpon": [

Разница между файлами не показана из-за своего большого размера
+ 981 - 876
dist/preview release/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/babylon.js


Разница между файлами не показана из-за своего большого размера
+ 213 - 62
dist/preview release/babylon.max.js


Разница между файлами не показана из-за своего большого размера
+ 213 - 62
dist/preview release/babylon.no-module.max.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/babylon.worker.js


Разница между файлами не показана из-за своего большого размера
+ 215 - 64
dist/preview release/es6.js


+ 2 - 78
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 3962,
+  "errors": 3950,
   "babylon.typedoc.json": {
-    "errors": 3962,
+    "errors": 3950,
     "AnimationGroup": {
       "Constructor": {
         "new AnimationGroup": {
@@ -4638,13 +4638,6 @@
             "MissingText": true
           }
         }
-      },
-      "Method": {
-        "render": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
       }
     },
     "ElasticEase": {
@@ -9629,75 +9622,6 @@
         }
       }
     },
-    "OutlineRenderer": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Constructor": {
-        "new OutlineRenderer": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "scene": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      },
-      "Property": {
-        "zOffset": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "isReady": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "subMesh": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "useInstances": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "render": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "subMesh": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "batch": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "useOverlay": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
     "PBRBaseSimpleMaterial": {
       "Property": {
         "lightmapTexture": {

+ 21 - 0
dist/preview release/viewer/babylon.viewer.d.ts

@@ -919,6 +919,13 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
+    /**
+      *
+      * @param name the name of the custom optimizer configuration
+      * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
+      */
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
     /**
@@ -1551,6 +1558,20 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 25 - 1
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -985,7 +985,15 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
-    
+    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
+    import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
+    /**
+      *
+      * @param name the name of the custom optimizer configuration
+      * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
+      */
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
 declare module 'babylonjs-viewer/initializer' {
@@ -1655,6 +1663,22 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
+declare module 'babylonjs-viewer/optimizer/custom/extended' {
+    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

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

@@ -116,6 +116,7 @@
 - BoundingBoxGizmo scalePivot field that can be used to always scale objects from the bottom ([TrevorDev](https://github.com/TrevorDev))
 - Improved _isSyncronized performance and reduced GC in TransformNode.computeWorldMatrix by directly reading property. ([Bolloxim](https://github.com/Bolloxim))
 - Added supports for reflectionMatrix in Skybox Mode Cube Texture allowing offsetting the world center or rotating the matrix ([sebavan](http://www.github.com/sebavan))
+- Improved performance of cached nodes but ensuring parent always updates cache. This removes failed isSynchronized test that meant computeWorldMatrix would always have to rebuild. On large scenes this could double framerate. ([Bolloxim](https://github.com/Bolloxim))
 
 ### glTF Loader
 

+ 4 - 0
src/Layer/babylon.effectLayerSceneComponent.ts

@@ -2,6 +2,10 @@
     // Adds the parser to the scene parsers.
     AbstractScene.AddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {
         if (parsedData.effectLayers) {
+            if (!container.effectLayers) {
+                container.effectLayers = new Array<EffectLayer>();
+            }
+
             for (let index = 0; index < parsedData.effectLayers.length; index++) {
                 var effectLayer = EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);
                 container.effectLayers.push(effectLayer);

+ 4 - 0
src/LensFlare/babylon.lensFlareSystemSceneComponent.ts

@@ -3,6 +3,10 @@
     AbstractScene.AddParser(SceneComponentConstants.NAME_LENSFLARESYSTEM, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {
         // Lens flares
         if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {
+            if (!container.lensFlareSystems) {
+                container.lensFlareSystems = new Array<LensFlareSystem>();
+            }
+
             for (let index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {
                 var parsedLensFlareSystem = parsedData.lensFlareSystems[index];
                 var lf = LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);

+ 6 - 0
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -686,6 +686,12 @@
             this._scene = light.getScene();
             light._shadowGenerator = this;
 
+            let component = this._scene._getComponent(SceneComponentConstants.NAME_SHADOWGENERATOR);
+            if (!component) {
+                component = new ShadowGeneratorSceneComponent(this._scene);
+                this._scene._addComponent(component);
+            }
+
             // Texture type fallback from float to int if not supported.
             var caps = this._scene.getEngine().getCaps();
 

+ 110 - 0
src/Lights/Shadows/babylon.shadowGeneratorSceneComponent.ts

@@ -0,0 +1,110 @@
+module BABYLON {
+    // Adds the parser to the scene parsers.
+    AbstractScene.AddParser(SceneComponentConstants.NAME_SHADOWGENERATOR, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {
+        // Shadows
+        if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
+            for (var index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
+                var parsedShadowGenerator = parsedData.shadowGenerators[index];
+                ShadowGenerator.Parse(parsedShadowGenerator, scene);
+                // SG would be available on their associated lights
+            }
+        }
+    });
+
+    /**
+     * Defines the shadow generator component responsible to manage any shadow generators
+     * in a given scene.
+     */
+    export class ShadowGeneratorSceneComponent implements ISceneSerializableComponent {
+        /**
+         * The component name helpfull to identify the component in the list of scene components.
+         */
+        public readonly name = SceneComponentConstants.NAME_SHADOWGENERATOR;
+
+        /**
+         * The scene the component belongs to.
+         */
+        public scene: Scene;
+
+        /**
+         * Creates a new instance of the component for the given scene
+         * @param scene Defines the scene to register the component in
+         */
+        constructor(scene: Scene) {
+            this.scene = scene;
+        }
+
+        /**
+         * Registers the component in a given scene
+         */
+        public register(): void {
+            this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);
+        }
+
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        public rebuild(): void {
+            // Nothing To Do Here.
+        }
+
+        /**
+         * Serializes the component data to the specified json object
+         * @param serializationObject The object to serialize to
+         */
+        public serialize(serializationObject: any): void {
+            // Shadows
+            serializationObject.shadowGenerators = [];
+            var lights = this.scene.lights;
+            for (let light of lights) {
+                let shadowGenerator = light.getShadowGenerator();
+                if (shadowGenerator) {
+                    serializationObject.shadowGenerators.push(shadowGenerator.serialize());
+                }
+            }
+        }
+
+        /**
+         * Adds all the element from the container to the scene
+         * @param container the container holding the elements
+         */
+        public addFromContainer(container: AbstractScene): void {
+            // Nothing To Do Here. (directly attached to a light)
+        }
+
+        /**
+         * Removes all the elements in the container from the scene
+         * @param container contains the elements to remove 
+         */
+        public removeFromContainer(container: AbstractScene): void{
+            // Nothing To Do Here. (directly attached to a light)
+        }
+
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        public dispose(): void {
+            // Nothing To Do Here.
+        }
+
+        private _gatherRenderTargets(renderTargets: SmartArrayNoDuplicate<RenderTargetTexture>): void {
+            // Shadows
+            var scene = this.scene;
+            if (this.scene.shadowsEnabled) {
+                for (var lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {
+                    var light = scene.lights[lightIndex];
+                    var shadowGenerator = light.getShadowGenerator();
+
+                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
+                        var shadowMap = <RenderTargetTexture>(shadowGenerator.getShadowMap());
+                        if (scene.textures.indexOf(shadowMap) !== -1) {
+                            renderTargets.push(shadowMap);
+                        }
+                    }
+                }
+            }
+        }
+    }
+} 

+ 1 - 1
src/Lights/babylon.hemisphericLight.ts

@@ -70,7 +70,7 @@
          * Returns the shadow generator associated to the light.
          * @returns Always null for hemispheric lights because it does not support shadows.
          */
-        public getShadowGenerator(): Nullable<ShadowGenerator> {
+        public getShadowGenerator(): Nullable<IShadowGenerator> {
             return null;
         }
 

+ 2 - 11
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -293,15 +293,6 @@
                 }
             }
 
-            // Shadows
-            if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
-                for (index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
-                    var parsedShadowGenerator = parsedData.shadowGenerators[index];
-                    ShadowGenerator.Parse(parsedShadowGenerator, scene);
-                    // SG would be available on their associated lights
-                }
-            }
-
             // Lights exclusions / inclusions
             for (index = 0, cache = scene.lights.length; index < cache; index++) {
                 let light = scene.lights[index];
@@ -343,7 +334,7 @@
                 container.removeAllFromScene();
             }
         } catch (err) {
-            let msg = logOperation("loadAssts", parsedData ? parsedData.producer : "Unknown") + log;
+            let msg = logOperation("loadAssets", parsedData ? parsedData.producer : "Unknown") + log;
             if (onError) {
                 onError(msg, err);
             } else {
@@ -352,7 +343,7 @@
             }
         } finally {
             if (log !== null && SceneLoader.loggingLevel !== SceneLoader.NO_LOGGING) {
-                Tools.Log(logOperation("loadAssts", parsedData ? parsedData.producer : "Unknown") + (SceneLoader.loggingLevel !== SceneLoader.MINIMAL_LOGGING ? log : ""));
+                Tools.Log(logOperation("loadAssets", parsedData ? parsedData.producer : "Unknown") + (SceneLoader.loggingLevel !== SceneLoader.MINIMAL_LOGGING ? log : ""));
             }
         }
 

+ 5 - 1
src/Materials/Textures/Procedurals/babylon.proceduralTexture.ts

@@ -44,7 +44,11 @@
             super(null, scene, !generateMipMaps);
 
             scene = this.getScene()!;
-
+            let component = scene._getComponent(SceneComponentConstants.NAME_PROCEDURALTEXTURE);
+            if (!component) {
+                component = new ProceduralTextureSceneComponent(scene);
+                scene._addComponent(component);
+            }
             scene.proceduralTextures.push(this);
 
             this._engine = scene.getEngine();

+ 70 - 0
src/Materials/Textures/Procedurals/babylon.proceduralTextureSceneComponent.ts

@@ -0,0 +1,70 @@
+module BABYLON {
+    export interface AbstractScene {
+        /**
+         * The list of procedural textures added to the scene
+         * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures
+         */
+        proceduralTextures: Array<ProceduralTexture>;
+    }
+
+    /**
+     * Defines the Procedural Texture scene component responsible to manage any Procedural Texture
+     * in a given scene.
+     */
+    export class ProceduralTextureSceneComponent implements ISceneComponent {
+        /**
+         * The component name helpfull to identify the component in the list of scene components.
+         */
+        public readonly name = SceneComponentConstants.NAME_PROCEDURALTEXTURE;
+
+        /**
+         * The scene the component belongs to.
+         */
+        public scene: Scene;
+
+        /**
+         * Creates a new instance of the component for the given scene
+         * @param scene Defines the scene to register the component in
+         */
+        constructor(scene: Scene) {
+            this.scene = scene;
+            this.scene.proceduralTextures = new Array<ProceduralTexture>();
+            scene.layers = new Array<Layer>();
+        }
+
+        /**
+         * Registers the component in a given scene
+         */
+        public register(): void {
+            this.scene._beforeClearStage.registerStep(SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear);
+        }
+
+        /**
+         * Rebuilds the elements related to this component in case of
+         * context lost for instance.
+         */
+        public rebuild(): void {
+            // Nothing to do here.
+        }
+
+        /**
+         * Disposes the component and the associated ressources.
+         */
+        public dispose(): void {
+            // Nothing to do here.
+        }
+
+        private _beforeClear(): void {
+            if (this.scene.proceduralTexturesEnabled) {
+                Tools.StartPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0);
+                for (var proceduralIndex = 0; proceduralIndex < this.scene.proceduralTextures.length; proceduralIndex++) {
+                    var proceduralTexture = this.scene.proceduralTextures[proceduralIndex];
+                    if (proceduralTexture._shouldRender()) {
+                        proceduralTexture.render();
+                    }
+                }
+                Tools.EndPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0);
+            }
+        }
+    }
+} 

+ 2 - 2
src/Particles/babylon.particleSystem.ts

@@ -250,7 +250,7 @@
                                 
                                 let drag = Scalar.Lerp(particle._currentDrag1, particle._currentDrag2, scale);
 
-                                this._scaledDirection.scaleInPlace(drag);
+                                this._scaledDirection.scaleInPlace(1.0 - drag);
                             });
                         }                           
 
@@ -1721,7 +1721,7 @@
                 serializationObject.limitVelocityDamping = particleSystem.limitVelocityDamping;
             }   
             
-            if (particleSystem.noiseTexture && particleSystem.noiseTexture instanceof ProceduralTexture) {
+            if (ProceduralTexture && particleSystem.noiseTexture && particleSystem.noiseTexture instanceof ProceduralTexture) {
                 const noiseTexture = particleSystem.noiseTexture as ProceduralTexture;
                 serializationObject.noiseTexture = noiseTexture.serialize();
             }

+ 3 - 3
src/PostProcess/RenderPipeline/Pipelines/babylon.standardRenderingPipeline.ts

@@ -457,7 +457,7 @@
 
             this.volumetricLightPostProcess.onApply = (effect: Effect) => {
                 if (this.sourceLight && this.sourceLight.getShadowGenerator() && this._scene.activeCamera) {
-                    var generator = <ShadowGenerator>this.sourceLight.getShadowGenerator();
+                    var generator = this.sourceLight.getShadowGenerator()!;
 
                     effect.setTexture("shadowMapSampler", generator.getShadowMap());
                     effect.setTexture("positionSampler", geometry.textures[2]);
@@ -471,8 +471,8 @@
                     effect.setFloat("scatteringCoefficient", this.volumetricLightCoefficient);
                     effect.setFloat("scatteringPower", this.volumetricLightPower);
 
-                    depthValues.x = generator.getLight().getDepthMinZ(this._scene.activeCamera);
-                    depthValues.y = generator.getLight().getDepthMaxZ(this._scene.activeCamera);
+                    depthValues.x = this.sourceLight.getDepthMinZ(this._scene.activeCamera);
+                    depthValues.y = this.sourceLight.getDepthMaxZ(this._scene.activeCamera);
                     effect.setVector2("depthValues", depthValues);
                 }
             };

+ 1 - 1
src/Shaders/gpuUpdateParticles.vertex.fx

@@ -320,7 +320,7 @@ void main() {
 #endif
 
 #ifdef DRAGGRADIENTS
-    directionScale *= texture(dragGradientSampler, vec2(ageGradient, 0)).r;
+    directionScale *= 1.0 - texture(dragGradientSampler, vec2(ageGradient, 0)).r;
 #endif
 
     outPosition = position + direction * directionScale;

+ 0 - 11
src/Tools/babylon.sceneSerializer.ts

@@ -279,17 +279,6 @@
                 serializationObject.particleSystems.push(scene.particleSystems[index].serialize());
             }
 
-            // Shadows
-            serializationObject.shadowGenerators = [];
-            for (index = 0; index < scene.lights.length; index++) {
-                light = scene.lights[index];
-
-                let shadowGenerator = light.getShadowGenerator();
-                if (shadowGenerator) {
-                    serializationObject.shadowGenerators.push(shadowGenerator.serialize());
-                }
-            }
-
             // Action Manager
             if (scene.actionManager) {
                 serializationObject.actions = scene.actionManager.serialize("scene");

+ 2 - 3
src/babylon.node.ts

@@ -364,12 +364,11 @@
         }
 
         /** @hidden */
-        public hasNewParent(update?: boolean): boolean {
+        public hasNewParent(): boolean {
             if (this._cache.parent === this.parent)
                 return false;
 
-            if (update)
-                this._cache.parent = this.parent;
+            this._cache.parent = this.parent;
 
             return true;
         }

+ 8 - 31
src/babylon.scene.ts

@@ -898,11 +898,6 @@
         * Gets or sets a boolean indicating if procedural textures are enabled on this scene
         */
         public proceduralTexturesEnabled = true;
-        /**
-         * The list of procedural textures added to the scene
-         * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures
-         */
-        public proceduralTextures = new Array<ProceduralTexture>();
 
         // Sound Tracks
         private _mainSoundTrack: SoundTrack;
@@ -1103,7 +1098,6 @@
             return null;
         }
 
-
         /**
          * @hidden
          * Defines the actions happening before camera updates.
@@ -1111,6 +1105,11 @@
         public _beforeCameraUpdateStage = Stage.Create<SimpleStageAction>();
         /**
          * @hidden
+         * Defines the actions happening before clear the canvas.
+         */
+        public _beforeClearStage = Stage.Create<SimpleStageAction>();
+        /**
+         * @hidden
          * Defines the actions happening before camera updates.
          */
         public _gatherRenderTargetsStage = Stage.Create<RenderTargetsStageAction>();
@@ -4548,16 +4547,8 @@
             this.onAfterRenderTargetsRenderObservable.notifyObservers(this);
             this.activeCamera = currentActiveCamera;
 
-            // Procedural textures
-            if (this.proceduralTexturesEnabled) {
-                Tools.StartPerformanceCounter("Procedural textures", this.proceduralTextures.length > 0);
-                for (var proceduralIndex = 0; proceduralIndex < this.proceduralTextures.length; proceduralIndex++) {
-                    var proceduralTexture = this.proceduralTextures[proceduralIndex];
-                    if (proceduralTexture._shouldRender()) {
-                        proceduralTexture.render();
-                    }
-                }
-                Tools.EndPerformanceCounter("Procedural textures", this.proceduralTextures.length > 0);
+            for (let step of this._beforeClearStage) {
+                step.action();
             }
 
             // Clear
@@ -4565,21 +4556,6 @@
                 this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);
             }
 
-            // Shadows
-            if (this.shadowsEnabled) {
-                for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
-                    var light = this.lights[lightIndex];
-                    var shadowGenerator = light.getShadowGenerator();
-
-                    if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {
-                        var shadowMap = <RenderTargetTexture>(shadowGenerator.getShadowMap());
-                        if (this.textures.indexOf(shadowMap) !== -1) {
-                            this._renderTargets.push(shadowMap);
-                        }
-                    }
-                }
-            }
-
             // Collects render targets from external components.
             for (let step of this._gatherRenderTargetsStage) {
                 step.action(this._renderTargets);
@@ -4809,6 +4785,7 @@
             this._afterRenderingGroupDrawStage.clear();
             this._afterCameraDrawStage.clear();
             this._beforeCameraUpdateStage.clear();
+            this._beforeClearStage.clear();
             this._gatherRenderTargetsStage.clear();
             this._rebuildGeometryStage.clear();
             this._pointerMoveStage.clear();

+ 8 - 3
src/babylon.sceneComponent.ts

@@ -16,6 +16,8 @@
         public static readonly NAME_POSTPROCESSRENDERPIPELINEMANAGER = "PostProcessRenderPipelineManager";
         public static readonly NAME_SPRITE = "Sprite";
         public static readonly NAME_OUTLINERENDERER = "Outline";
+        public static readonly NAME_PROCEDURALTEXTURE = "ProceduralTexture";
+        public static readonly NAME_SHADOWGENERATOR = "ShadowGenerator";
 
         public static readonly STEP_ISREADYFORMESH_EFFECTLAYER = 0;
 
@@ -39,15 +41,18 @@
         public static readonly STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;
         public static readonly STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;
 
+        public static readonly STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;
+
         public static readonly STEP_AFTERCAMERADRAW_EFFECTLAYER = 0;
         public static readonly STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1;
         public static readonly STEP_AFTERCAMERADRAW_BOUNDINGBOXRENDERER = 2;
         public static readonly STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;
         public static readonly STEP_AFTERCAMERADRAW_LAYER = 4;
 
-        public static readonly STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 0;
-        public static readonly STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 1;
-        public static readonly STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 2;
+        public static readonly STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0;
+        public static readonly STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;
+        public static readonly STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2;
+        public static readonly STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;
 
         public static readonly STEP_REBUILDGEOMETRY_POSTPROCESSRENDERPIPELINEMANAGER = 0;
 

+ 1 - 1
tests/validation/config.json

@@ -423,7 +423,7 @@
     },
     {
       "title": "Texture cache",
-      "playgroundId": "#20OAV9#133",
+      "playgroundId": "#20OAV9#237",
       "referenceImage": "texture cache.png"
     },
     {