瀏覽代碼

Merge pull request #4585 from TrevorDev/addRemoveCameraDefaultPipeline

add/remove camera methods in the default pipeline
Trevor Baron 7 年之前
父節點
當前提交
6080080377

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

@@ -54,6 +54,7 @@
 - `Sound` now accepts `MediaStream` as source to enable easier WebAudio and WebRTC integrations ([menduz](https://github.com/menduz))
 - Vector x, y and z constructor parameters are now optional and default to 0 ([TrevorDev](https://github.com/TrevorDev))
 - New vertical mode for sliders in 2D GUI. [Demo](https://www.babylonjs-playground.com/#U9AC0N#53) ([Saket Saurabh](https://github.com/ssaket))
+- Add and remove camera methods in the default pipeline ([TrevorDev](https://github.com/TrevorDev))
 - Add internal texture `format` support for RenderTargetCubeTexture ([PeapBoy](https://github.com/NicolasBuecher))
 
 ### glTF Loader

+ 19 - 0
src/PostProcess/RenderPipeline/Pipelines/babylon.defaultRenderingPipeline.ts

@@ -599,6 +599,25 @@
         }
 
         /**
+         * Adds a camera to the pipeline
+         * @param camera the camera to be added
+         */
+        public addCamera(camera:Camera):void{
+            this._originalCameras.push(camera);
+            this._buildPipeline();
+        }
+
+        /**
+         * Removes a camera from the pipeline
+         * @param camera the camera to remove
+         */
+        public removeCamera(camera:Camera):void{
+            var index = this._originalCameras.indexOf(camera);
+            this._originalCameras.splice(index, 1);
+            this._buildPipeline();
+        }
+
+        /**
          * Dispose of the pipeline and stop all post processes
          */
         public dispose(): void {