فهرست منبع

Fixed StandardRenderingPipeline to keep cameras to attach when rebuilding pipleine.

Julien MOREAU-MATHIS 6 سال پیش
والد
کامیت
ab8b99ed2f
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      src/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts

+ 10 - 1
src/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts

@@ -335,6 +335,8 @@ export class StandardRenderingPipeline extends PostProcessRenderPipeline impleme
 
     private _floatTextureType: number;
 
+    private _camerasToBeAttached: Array<Camera> = [];
+
     @serialize()
     private _ratio: number;
 
@@ -550,7 +552,9 @@ export class StandardRenderingPipeline extends PostProcessRenderPipeline impleme
      */
     constructor(name: string, scene: Scene, ratio: number, originalPostProcess: Nullable<PostProcess> = null, cameras?: Camera[]) {
         super(scene.getEngine(), name);
-        this._cameras = cameras || [];
+        this._cameras = cameras || scene.cameras;
+        this._cameras = this._cameras.slice();
+        this._camerasToBeAttached = this._cameras.slice();
 
         // Initialize
         this._scene = scene;
@@ -570,6 +574,11 @@ export class StandardRenderingPipeline extends PostProcessRenderPipeline impleme
         var scene = this._scene;
 
         this._disposePostProcesses();
+        if (this._cameras !== null) {
+            this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);
+            // get back cameras to be used to reattach pipeline
+            this._cameras = this._camerasToBeAttached.slice();
+        }
         this._reset();
 
         // Create pass post-process