Browse Source

Fixing post process issue
Moving to RC state

David Catuhe 11 năm trước cách đây
mục cha
commit
3e55ace201

+ 1 - 0
Babylon/Actions/babylon.action.js

@@ -48,6 +48,7 @@
                 if (!this._nextActiveAction._child._actionManager) {
                 if (!this._nextActiveAction._child._actionManager) {
                     this._nextActiveAction._child._actionManager = this._actionManager;
                     this._nextActiveAction._child._actionManager = this._actionManager;
                 }
                 }
+
                 this._nextActiveAction = this._nextActiveAction._child;
                 this._nextActiveAction = this._nextActiveAction._child;
             } else {
             } else {
                 this._nextActiveAction = this;
                 this._nextActiveAction = this;

+ 2 - 1
Babylon/Actions/babylon.action.ts

@@ -55,8 +55,9 @@
             if (this._nextActiveAction._child) {
             if (this._nextActiveAction._child) {
 
 
                 if (!this._nextActiveAction._child._actionManager) {
                 if (!this._nextActiveAction._child._actionManager) {
-                    this._nextActiveAction._child._actionManager = this._actionManager
+                    this._nextActiveAction._child._actionManager = this._actionManager;
                 }
                 }
+
                 this._nextActiveAction = this._nextActiveAction._child;
                 this._nextActiveAction = this._nextActiveAction._child;
             } else {
             } else {
                 this._nextActiveAction = this;
                 this._nextActiveAction = this;

+ 1 - 2
Babylon/Cameras/babylon.webVRCamera.js

@@ -26,8 +26,7 @@ var BABYLON;
             this._sensorDevice = null;
             this._sensorDevice = null;
             this._hmdDevice = null;
             this._hmdDevice = null;
 
 
-            // Search for a HmdDevice.
-            while (i < size && this._hmdDevice === null) { 
+            while (i < size && this._hmdDevice === null) {
                 if (devices[i] instanceof HMDVRDevice) {
                 if (devices[i] instanceof HMDVRDevice) {
                     this._hmdDevice = devices[i];
                     this._hmdDevice = devices[i];
                 }
                 }

+ 1 - 1
Babylon/Cameras/babylon.webVRCamera.ts

@@ -24,7 +24,7 @@ module BABYLON {
             this._hmdDevice = null;
             this._hmdDevice = null;
 
 
             // Search for a HmdDevice.
             // Search for a HmdDevice.
-            while (i < size && this._hmdDevice === null) { 
+            while (i < size && this._hmdDevice === null) {
                 if (devices[i] instanceof HMDVRDevice) {
                 if (devices[i] instanceof HMDVRDevice) {
                     this._hmdDevice = devices[i];
                     this._hmdDevice = devices[i];
                 }
                 }

+ 7 - 2
Babylon/PostProcess/babylon.postProcess.js

@@ -34,8 +34,13 @@
             camera = camera || this._camera;
             camera = camera || this._camera;
 
 
             var scene = camera.getScene();
             var scene = camera.getScene();
-            var desiredWidth = (sourceTexture ? sourceTexture._width : this._engine.getRenderingCanvas().width) * this._renderRatio;
-            var desiredHeight = (sourceTexture ? sourceTexture._height : this._engine.getRenderingCanvas().height) * this._renderRatio;
+            var maxSize = camera.getEngine().getCaps().maxTextureSize;
+            var desiredWidth = ((sourceTexture ? sourceTexture._width : this._engine.getRenderingCanvas().width) * this._renderRatio) | 0;
+            var desiredHeight = ((sourceTexture ? sourceTexture._height : this._engine.getRenderingCanvas().height) * this._renderRatio) | 0;
+
+            desiredWidth = BABYLON.Tools.GetExponantOfTwo(desiredWidth, maxSize);
+            desiredHeight = BABYLON.Tools.GetExponantOfTwo(desiredHeight, maxSize);
+
             if (this.width !== desiredWidth || this.height !== desiredHeight) {
             if (this.width !== desiredWidth || this.height !== desiredHeight) {
                 if (this._textures.length > 0) {
                 if (this._textures.length > 0) {
                     for (var i = 0; i < this._textures.length; i++) {
                     for (var i = 0; i < this._textures.length; i++) {

+ 7 - 2
Babylon/PostProcess/babylon.postProcess.ts

@@ -48,8 +48,13 @@
             camera = camera || this._camera;
             camera = camera || this._camera;
 
 
             var scene = camera.getScene();
             var scene = camera.getScene();
-            var desiredWidth =  (sourceTexture ? sourceTexture._width : this._engine.getRenderingCanvas().width) * this._renderRatio;
-            var desiredHeight = (sourceTexture ? sourceTexture._height : this._engine.getRenderingCanvas().height) * this._renderRatio;
+            var maxSize = camera.getEngine().getCaps().maxTextureSize;
+            var desiredWidth = ((sourceTexture ? sourceTexture._width : this._engine.getRenderingCanvas().width) * this._renderRatio) | 0;
+            var desiredHeight = ((sourceTexture ? sourceTexture._height : this._engine.getRenderingCanvas().height) * this._renderRatio) | 0;
+
+            desiredWidth = Tools.GetExponantOfTwo(desiredWidth, maxSize);
+            desiredHeight = Tools.GetExponantOfTwo(desiredHeight, maxSize);
+
             if (this.width !== desiredWidth || this.height !== desiredHeight) {
             if (this.width !== desiredWidth || this.height !== desiredHeight) {
                 if (this._textures.length > 0) {
                 if (this._textures.length > 0) {
                     for (var i = 0; i < this._textures.length; i++) {
                     for (var i = 0; i < this._textures.length; i++) {

+ 13 - 0
Babylon/Tools/babylon.tools.js

@@ -641,6 +641,19 @@
         });
         });
         Tools.BaseUrl = "";
         Tools.BaseUrl = "";
 
 
+        Tools.GetExponantOfTwo = function (value, max) {
+            var count = 1;
+
+            do {
+                count *= 2;
+            } while(count < value);
+
+            if (count > max)
+                count = max;
+
+            return count;
+        };
+
         Tools._NoneLogLevel = 0;
         Tools._NoneLogLevel = 0;
         Tools._MessageLogLevel = 1;
         Tools._MessageLogLevel = 1;
         Tools._WarningLogLevel = 2;
         Tools._WarningLogLevel = 2;

+ 14 - 1
Babylon/Tools/babylon.tools.ts

@@ -36,6 +36,19 @@
     export class Tools {
     export class Tools {
         public static BaseUrl = "";
         public static BaseUrl = "";
 
 
+        public static GetExponantOfTwo = (value: number, max: number): number => {
+            var count = 1;
+
+            do {
+                count *= 2;
+            } while (count < value);
+
+            if (count > max)
+                count = max;
+
+            return count;
+        };
+
         public static GetFilename(path: string): string {
         public static GetFilename(path: string): string {
             var index = path.lastIndexOf("/");
             var index = path.lastIndexOf("/");
             if (index < 0)
             if (index < 0)
@@ -265,7 +278,7 @@
             else {
             else {
                 // Caching all files
                 // Caching all files
                 if (database && database.enableSceneOffline) {
                 if (database && database.enableSceneOffline) {
-                    database.openAsync(loadFromIndexedDB, noIndexedDB);                    
+                    database.openAsync(loadFromIndexedDB, noIndexedDB);
                 }
                 }
                 else {
                 else {
                     noIndexedDB();
                     noIndexedDB();

+ 5 - 18
Babylon/babylon.engine.js

@@ -289,24 +289,11 @@
         };
         };
     };
     };
 
 
-    var getExponantOfTwo = function (value, max) {
-        var count = 1;
-
-        do {
-            count *= 2;
-        } while(count < value);
-
-        if (count > max)
-            count = max;
-
-        return count;
-    };
-
     var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {
     var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {
         if (typeof samplingMode === "undefined") { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
         if (typeof samplingMode === "undefined") { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
         var engine = scene.getEngine();
         var engine = scene.getEngine();
-        var potWidth = getExponantOfTwo(width, engine.getCaps().maxTextureSize);
-        var potHeight = getExponantOfTwo(height, engine.getCaps().maxTextureSize);
+        var potWidth = BABYLON.Tools.GetExponantOfTwo(width, engine.getCaps().maxTextureSize);
+        var potHeight = BABYLON.Tools.GetExponantOfTwo(height, engine.getCaps().maxTextureSize);
 
 
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
@@ -1266,8 +1253,8 @@
         Engine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {
         Engine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {
             var texture = this._gl.createTexture();
             var texture = this._gl.createTexture();
 
 
-            width = getExponantOfTwo(width, this._caps.maxTextureSize);
-            height = getExponantOfTwo(height, this._caps.maxTextureSize);
+            width = BABYLON.Tools.GetExponantOfTwo(width, this._caps.maxTextureSize);
+            height = BABYLON.Tools.GetExponantOfTwo(height, this._caps.maxTextureSize);
 
 
             this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
             this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
 
 
@@ -1443,7 +1430,7 @@
                 }, null, null, true);
                 }, null, null, true);
             } else {
             } else {
                 cascadeLoad(rootUrl, 0, [], scene, function (imgs) {
                 cascadeLoad(rootUrl, 0, [], scene, function (imgs) {
-                    var width = getExponantOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize);
+                    var width = BABYLON.Tools.GetExponantOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize);
                     var height = width;
                     var height = width;
 
 
                     _this._workingCanvas.width = width;
                     _this._workingCanvas.width = width;

+ 5 - 18
Babylon/babylon.engine.ts

@@ -264,24 +264,11 @@
         }
         }
     }
     }
 
 
-    var getExponantOfTwo = (value: number, max: number): number => {
-        var count = 1;
-
-        do {
-            count *= 2;
-        } while (count < value);
-
-        if (count > max)
-            count = max;
-
-        return count;
-    };
-
     var prepareWebGLTexture = (texture: WebGLTexture, gl: WebGLRenderingContext, scene: Scene, width: number, height: number, invertY: boolean, noMipmap: boolean, isCompressed: boolean,
     var prepareWebGLTexture = (texture: WebGLTexture, gl: WebGLRenderingContext, scene: Scene, width: number, height: number, invertY: boolean, noMipmap: boolean, isCompressed: boolean,
         processFunction: (width: number, height: number) => void, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) => {
         processFunction: (width: number, height: number) => void, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) => {
         var engine = scene.getEngine();
         var engine = scene.getEngine();
-        var potWidth = getExponantOfTwo(width, engine.getCaps().maxTextureSize);
-        var potHeight = getExponantOfTwo(height, engine.getCaps().maxTextureSize);
+        var potWidth = Tools.GetExponantOfTwo(width, engine.getCaps().maxTextureSize);
+        var potHeight = Tools.GetExponantOfTwo(height, engine.getCaps().maxTextureSize);
 
 
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
@@ -1276,8 +1263,8 @@
         public createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture {
         public createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture {
             var texture = this._gl.createTexture();
             var texture = this._gl.createTexture();
 
 
-            width = getExponantOfTwo(width, this._caps.maxTextureSize);
-            height = getExponantOfTwo(height, this._caps.maxTextureSize);
+            width = Tools.GetExponantOfTwo(width, this._caps.maxTextureSize);
+            height = Tools.GetExponantOfTwo(height, this._caps.maxTextureSize);
 
 
             this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
             this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
 
 
@@ -1450,7 +1437,7 @@
                 }, null, null, true);
                 }, null, null, true);
             } else {
             } else {
                 cascadeLoad(rootUrl, 0, [], scene, imgs => {
                 cascadeLoad(rootUrl, 0, [], scene, imgs => {
-                    var width = getExponantOfTwo(imgs[0].width, this._caps.maxCubemapTextureSize);
+                    var width = Tools.GetExponantOfTwo(imgs[0].width, this._caps.maxCubemapTextureSize);
                     var height = width;
                     var height = width;
 
 
                     this._workingCanvas.width = width;
                     this._workingCanvas.width = width;

+ 28 - 22
babylon.1.14-beta-debug.js

@@ -2797,6 +2797,19 @@ var BABYLON;
         });
         });
         Tools.BaseUrl = "";
         Tools.BaseUrl = "";
 
 
+        Tools.GetExponantOfTwo = function (value, max) {
+            var count = 1;
+
+            do {
+                count *= 2;
+            } while(count < value);
+
+            if (count > max)
+                count = max;
+
+            return count;
+        };
+
         Tools._NoneLogLevel = 0;
         Tools._NoneLogLevel = 0;
         Tools._MessageLogLevel = 1;
         Tools._MessageLogLevel = 1;
         Tools._WarningLogLevel = 2;
         Tools._WarningLogLevel = 2;
@@ -3102,24 +3115,11 @@ var BABYLON;
         };
         };
     };
     };
 
 
-    var getExponantOfTwo = function (value, max) {
-        var count = 1;
-
-        do {
-            count *= 2;
-        } while(count < value);
-
-        if (count > max)
-            count = max;
-
-        return count;
-    };
-
     var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {
     var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {
         if (typeof samplingMode === "undefined") { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
         if (typeof samplingMode === "undefined") { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
         var engine = scene.getEngine();
         var engine = scene.getEngine();
-        var potWidth = getExponantOfTwo(width, engine.getCaps().maxTextureSize);
-        var potHeight = getExponantOfTwo(height, engine.getCaps().maxTextureSize);
+        var potWidth = BABYLON.Tools.GetExponantOfTwo(width, engine.getCaps().maxTextureSize);
+        var potHeight = BABYLON.Tools.GetExponantOfTwo(height, engine.getCaps().maxTextureSize);
 
 
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
@@ -4079,8 +4079,8 @@ var BABYLON;
         Engine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {
         Engine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {
             var texture = this._gl.createTexture();
             var texture = this._gl.createTexture();
 
 
-            width = getExponantOfTwo(width, this._caps.maxTextureSize);
-            height = getExponantOfTwo(height, this._caps.maxTextureSize);
+            width = BABYLON.Tools.GetExponantOfTwo(width, this._caps.maxTextureSize);
+            height = BABYLON.Tools.GetExponantOfTwo(height, this._caps.maxTextureSize);
 
 
             this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
             this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
 
 
@@ -4256,7 +4256,7 @@ var BABYLON;
                 }, null, null, true);
                 }, null, null, true);
             } else {
             } else {
                 cascadeLoad(rootUrl, 0, [], scene, function (imgs) {
                 cascadeLoad(rootUrl, 0, [], scene, function (imgs) {
-                    var width = getExponantOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize);
+                    var width = BABYLON.Tools.GetExponantOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize);
                     var height = width;
                     var height = width;
 
 
                     _this._workingCanvas.width = width;
                     _this._workingCanvas.width = width;
@@ -15733,8 +15733,13 @@ var BABYLON;
             camera = camera || this._camera;
             camera = camera || this._camera;
 
 
             var scene = camera.getScene();
             var scene = camera.getScene();
-            var desiredWidth = (sourceTexture ? sourceTexture._width : this._engine.getRenderingCanvas().width) * this._renderRatio;
-            var desiredHeight = (sourceTexture ? sourceTexture._height : this._engine.getRenderingCanvas().height) * this._renderRatio;
+            var maxSize = camera.getEngine().getCaps().maxTextureSize;
+            var desiredWidth = ((sourceTexture ? sourceTexture._width : this._engine.getRenderingCanvas().width) * this._renderRatio) | 0;
+            var desiredHeight = ((sourceTexture ? sourceTexture._height : this._engine.getRenderingCanvas().height) * this._renderRatio) | 0;
+
+            desiredWidth = BABYLON.Tools.GetExponantOfTwo(desiredWidth, maxSize);
+            desiredHeight = BABYLON.Tools.GetExponantOfTwo(desiredHeight, maxSize);
+
             if (this.width !== desiredWidth || this.height !== desiredHeight) {
             if (this.width !== desiredWidth || this.height !== desiredHeight) {
                 if (this._textures.length > 0) {
                 if (this._textures.length > 0) {
                     for (var i = 0; i < this._textures.length; i++) {
                     for (var i = 0; i < this._textures.length; i++) {
@@ -23408,6 +23413,7 @@ var BABYLON;
                 if (!this._nextActiveAction._child._actionManager) {
                 if (!this._nextActiveAction._child._actionManager) {
                     this._nextActiveAction._child._actionManager = this._actionManager;
                     this._nextActiveAction._child._actionManager = this._actionManager;
                 }
                 }
+
                 this._nextActiveAction = this._nextActiveAction._child;
                 this._nextActiveAction = this._nextActiveAction._child;
             } else {
             } else {
                 this._nextActiveAction = this;
                 this._nextActiveAction = this;
@@ -25751,7 +25757,7 @@ var BABYLON;
             this._sensorDevice = null;
             this._sensorDevice = null;
             this._hmdDevice = null;
             this._hmdDevice = null;
 
 
-            while (i > 0 && this._hmdDevice === null) {
+            while (i < size && this._hmdDevice === null) {
                 if (devices[i] instanceof HMDVRDevice) {
                 if (devices[i] instanceof HMDVRDevice) {
                     this._hmdDevice = devices[i];
                     this._hmdDevice = devices[i];
                 }
                 }
@@ -25760,7 +25766,7 @@ var BABYLON;
 
 
             i = 0;
             i = 0;
 
 
-            while (i > 0 && this._sensorDevice === null) {
+            while (i < size && this._sensorDevice === null) {
                 if (devices[i] instanceof PositionSensorVRDevice && (!this._hmdDevice || devices[i].hardwareUnitId === this._hmdDevice.hardwareUnitId)) {
                 if (devices[i] instanceof PositionSensorVRDevice && (!this._hmdDevice || devices[i].hardwareUnitId === this._hmdDevice.hardwareUnitId)) {
                     this._sensorDevice = devices[i];
                     this._sensorDevice = devices[i];
                 }
                 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 17 - 0
babylon.1.14-RC.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 17
babylon.1.14-beta.js


+ 1 - 0
babylon.d.ts

@@ -3473,6 +3473,7 @@ declare module BABYLON {
     }
     }
     class Tools {
     class Tools {
         static BaseUrl: string;
         static BaseUrl: string;
+        static GetExponantOfTwo: (value: number, max: number) => number;
         static GetFilename(path: string): string;
         static GetFilename(path: string): string;
         static GetDOMTextContent(element: HTMLElement): string;
         static GetDOMTextContent(element: HTMLElement): string;
         static ToDegrees(angle: number): number;
         static ToDegrees(angle: number): number;