Browse Source

Fix issue with cubemap incorrectly loaded when in binary mode

David Catuhe 7 years ago
parent
commit
a3ca7c1251

File diff suppressed because it is too large
+ 3878 - 3878
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 2978 - 2978
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 6 - 6
dist/preview release/babylon.js


+ 12 - 3
dist/preview release/babylon.max.js

@@ -24369,13 +24369,13 @@ var BABYLON;
             }
             else if (this.delayLoadState === BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
                 this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADING;
-                this._queueLoad(this, scene);
+                this._queueLoad(scene);
             }
             return this;
         };
-        Mesh.prototype._queueLoad = function (mesh, scene) {
+        Mesh.prototype._queueLoad = function (scene) {
             var _this = this;
-            scene._addPendingData(mesh);
+            scene._addPendingData(this);
             var getBinaryData = (this.delayLoadingFile.indexOf(".babylonbinarymeshdata") !== -1);
             BABYLON.Tools.LoadFile(this.delayLoadingFile, function (data) {
                 if (data instanceof ArrayBuffer) {
@@ -50505,6 +50505,7 @@ var BABYLON;
                     }
                 }
             }
+            _this._files = files;
             if (!_this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
@@ -72344,6 +72345,14 @@ var BABYLON;
                         this._leftLaserPointer.isVisible = false;
                     }
                 }
+                else {
+                    if (this._rightLaserPointer) {
+                        this._rightLaserPointer.isVisible = true;
+                    }
+                    else if (this._leftLaserPointer) {
+                        this._leftLaserPointer.isVisible = true;
+                    }
+                }
             },
             enumerable: true,
             configurable: true

File diff suppressed because it is too large
+ 6 - 6
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 6 - 6
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 12 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -24369,13 +24369,13 @@ var BABYLON;
             }
             else if (this.delayLoadState === BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
                 this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADING;
-                this._queueLoad(this, scene);
+                this._queueLoad(scene);
             }
             return this;
         };
-        Mesh.prototype._queueLoad = function (mesh, scene) {
+        Mesh.prototype._queueLoad = function (scene) {
             var _this = this;
-            scene._addPendingData(mesh);
+            scene._addPendingData(this);
             var getBinaryData = (this.delayLoadingFile.indexOf(".babylonbinarymeshdata") !== -1);
             BABYLON.Tools.LoadFile(this.delayLoadingFile, function (data) {
                 if (data instanceof ArrayBuffer) {
@@ -50351,6 +50351,7 @@ var BABYLON;
                     }
                 }
             }
+            _this._files = files;
             if (!_this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
@@ -72190,6 +72191,14 @@ var BABYLON;
                         this._leftLaserPointer.isVisible = false;
                     }
                 }
+                else {
+                    if (this._rightLaserPointer) {
+                        this._rightLaserPointer.isVisible = true;
+                    }
+                    else if (this._leftLaserPointer) {
+                        this._leftLaserPointer.isVisible = true;
+                    }
+                }
             },
             enumerable: true,
             configurable: true

File diff suppressed because it is too large
+ 8 - 8
dist/preview release/viewer/babylon.viewer.js


+ 4 - 2
src/Materials/Textures/babylon.cubeTexture.ts

@@ -52,13 +52,15 @@
                 files = [];
 
                 if (extensions) {
-                    
+
                     for (var index = 0; index < extensions.length; index++) {
                         files.push(rootUrl + extensions[index]);
                     }
                 }
             }
 
+            this._files = files;
+
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
@@ -131,7 +133,7 @@
         public clone(): CubeTexture {
             return SerializationHelper.Clone(() => {
                 let scene = this.getScene();
-                
+
                 if (!scene) {
                     return this;
                 }

+ 13 - 15
src/Mesh/babylon.geometry.ts

@@ -48,7 +48,7 @@
 
         public static CreateGeometryForMesh(mesh: Mesh): Geometry {
             let geometry = new Geometry(Geometry.RandomId(), mesh.getScene());
-            
+
             geometry.applyToMesh(mesh);
 
             return geometry;
@@ -80,7 +80,7 @@
             // applyToMesh
             if (mesh) {
                 if (mesh.getClassName() === "LinesMesh") {
-                    this.boundingBias = new Vector2(0, (<LinesMesh> mesh).intersectionThreshold);
+                    this.boundingBias = new Vector2(0, (<LinesMesh>mesh).intersectionThreshold);
                     this.updateExtend();
                 }
 
@@ -307,7 +307,7 @@
          * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
          * - BABYLON.VertexBuffer.MatricesWeightsKind
          * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
-         */        
+         */
         public isVertexBufferUpdatable(kind: string): boolean {
             let vb = this._vertexBuffers[kind];
 
@@ -482,7 +482,7 @@
             }
         }
 
-        private updateExtend(data: Nullable<FloatArray> = null, stride? : number) {
+        private updateExtend(data: Nullable<FloatArray> = null, stride?: number) {
             if (!data) {
                 data = <FloatArray>this._vertexBuffers[VertexBuffer.PositionKind].getData();
             }
@@ -617,13 +617,11 @@
         }
 
         // Cache
-        public _resetPointsArrayCache(): void
-        {
+        public _resetPointsArrayCache(): void {
             this._positions = null;
         }
 
-        public _generatePointsArray(): boolean
-        {
+        public _generatePointsArray(): boolean {
             if (this._positions)
                 return true;
 
@@ -753,7 +751,7 @@
             return serializationObject;
         }
 
-        private toNumberArray(origin: Nullable<Float32Array | IndicesArray>) : number[] {
+        private toNumberArray(origin: Nullable<Float32Array | IndicesArray>): number[] {
             if (Array.isArray(origin)) {
                 return origin;
             } else {
@@ -933,7 +931,7 @@
                 }
 
                 if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {
-                    var matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);                    
+                    var matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);
                     mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);
                 }
 
@@ -1034,7 +1032,7 @@
                     mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);
                 }
 
-                if (parsedGeometry.matricesWeightsExtra) {       
+                if (parsedGeometry.matricesWeightsExtra) {
                     mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);
                 }
 
@@ -1066,7 +1064,7 @@
             }
         }
 
-        private static _CleanMatricesWeights(parsedGeometry:any, mesh:Mesh): void {
+        private static _CleanMatricesWeights(parsedGeometry: any, mesh: Mesh): void {
             const epsilon: number = 1e-3;
             if (!SceneLoader.CleanBoneMatrixWeights) {
                 return;
@@ -1108,7 +1106,7 @@
                         }
                     }
                 }
-                if (firstZeroWeight < 0  || firstZeroWeight > (influencers - 1)) {
+                if (firstZeroWeight < 0 || firstZeroWeight > (influencers - 1)) {
                     firstZeroWeight = influencers - 1;
                 }
                 if (weight > epsilon) {
@@ -1119,7 +1117,7 @@
                     if (matricesWeightsExtra) {
                         for (var j = 0; j < 4; j++) {
                             matricesWeightsExtra[i + j] *= mweight;
-                        }    
+                        }
                     }
                 } else {
                     if (firstZeroWeight >= 4) {
@@ -1133,7 +1131,7 @@
             }
 
             mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);
-            if (parsedGeometry.matricesWeightsExtra) {       
+            if (parsedGeometry.matricesWeightsExtra) {
                 mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);
             }
         }

+ 3 - 3
src/Mesh/babylon.mesh.ts

@@ -1439,13 +1439,13 @@
             else if (this.delayLoadState === Engine.DELAYLOADSTATE_NOTLOADED) {
                 this.delayLoadState = Engine.DELAYLOADSTATE_LOADING;
 
-                this._queueLoad(this, scene);
+                this._queueLoad(scene);
             }
             return this;
         }
 
-        private _queueLoad(mesh: Mesh, scene: Scene): Mesh {
-            scene._addPendingData(mesh);
+        private _queueLoad(scene: Scene): Mesh {
+            scene._addPendingData(this);
 
             var getBinaryData = (this.delayLoadingFile.indexOf(".babylonbinarymeshdata") !== -1);
 

+ 6 - 2
src/tsconfig.json

@@ -6,10 +6,14 @@
     "target": "es5",
     "sourceMap": true,
     "noImplicitAny": true,
-    "lib": ["dom", "es2015.promise", "es5"],
+    "lib": [
+      "dom",
+      "es2015.promise",
+      "es5"
+    ],
     "noImplicitReturns": true,
     "noImplicitThis": true,
-    "noUnusedLocals": true,    
+    "noUnusedLocals": true,
     "strictNullChecks": true,
     "strictFunctionTypes": true
   }