Browse Source

Fix multi Engine issues

Sebastien Vandenberghe 8 năm trước cách đây
mục cha
commit
31d656dbd9

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1025 - 1025
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 48 - 48
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1966 - 1955
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1025 - 1025
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 14 - 1
src/PostProcess/babylon.imageProcessingPostProcess.ts

@@ -43,8 +43,21 @@
 
             // Pick the scene configuration if needed.
             if (!configuration) {
+                var scene = null;
+                var engine = this.getEngine();
                 var camera = this.getCamera();
-                var scene = camera ? camera.getScene() : BABYLON.Engine.LastCreatedScene;
+
+                if (camera) {
+                    scene = camera.getScene();
+                }
+                else if (engine && engine.scenes) {
+                    var scenes = engine.scenes;
+                    scene = scenes[scenes.length - 1];
+                }
+                else {
+                    scene = BABYLON.Engine.LastCreatedScene;
+                }
+
                 this._imageProcessingConfiguration = scene.imageProcessingConfiguration;
             }
             else {

+ 4 - 3
src/Tools/babylon.textureTools.ts

@@ -8,6 +8,10 @@
 		 * @return Generated texture
 		 */
 		public static CreateResizedCopy(texture: BABYLON.Texture, width: number, height: number, useBilinearMode: boolean = true): BABYLON.Texture {
+			
+			var scene = texture.getScene();
+			var engine = scene.getEngine();
+			
 			let rtt = new BABYLON.RenderTargetTexture(
 				'resized' + texture.name,
 				{ width: width, height: height },
@@ -20,9 +24,6 @@
 				false
 			);
 
-            var scene = texture.getScene();
-			var engine = scene.getEngine();
-
 			rtt.wrapU = texture.wrapU;
 			rtt.wrapV = texture.wrapV;
             rtt.uOffset = texture.uOffset;