Просмотр исходного кода

Adding IE support for validation

David Catuhe 5 лет назад
Родитель
Сommit
632663418d

+ 13 - 4
Tools/DevLoader/BabylonLoader.js

@@ -3,6 +3,9 @@
 var BABYLONDEVTOOLS;
 (function(BABYLONDEVTOOLS) {
 
+    var ua = window.navigator.userAgent;
+    var isIE = ua.indexOf("Trident") > 0;
+
     var getJson = function(url, callback, errorCallback) {
         var xhr = new XMLHttpRequest();
         xhr.open('GET', url);
@@ -145,9 +148,15 @@ var BABYLONDEVTOOLS;
             }
 
             var self = this;
-            script.onload = function() {
-                self.dequeue();
-            };
+            if (isIE) { // I love you IE
+                setTimeout(function() {
+                    self.dequeue();
+                }, 500);
+            } else {
+                script.onload = function() {
+                    self.dequeue();
+                };
+            }
             head.appendChild(script);
         }
 
@@ -209,7 +218,7 @@ var BABYLONDEVTOOLS;
         }
 
         Loader.prototype.loadCoreDev = function() {
-            if (typeof document === "undefined") {                
+            if (typeof document === "undefined" || isIE) {                
                 this.loadScript(babylonJSPath + "/dist/preview release/babylon.max.js");
                 return;
             }

+ 4 - 2
src/Materials/Node/Blocks/Dual/reflectionTextureBlock.ts

@@ -67,6 +67,8 @@ export class ReflectionTextureBlock extends NodeMaterialBlock {
         this.registerOutput("r", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
         this.registerOutput("g", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
         this.registerOutput("b", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
+        
+        this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector4);
     }
 
     /**
@@ -244,13 +246,13 @@ export class ReflectionTextureBlock extends NodeMaterialBlock {
 
         if (state._emitVaryingFromString(this._positionUVWName, "vec3", this._defineSkyboxName)) {
             state.compilationString += `#ifdef ${this._defineSkyboxName}\r\n`;
-            state.compilationString += `${this._positionUVWName} = ${this.position.associatedVariableName};\r\n`;
+            state.compilationString += `${this._positionUVWName} = ${this.position.associatedVariableName}.xyz;\r\n`;
             state.compilationString += `#endif\r\n`;
         }
 
         if (state._emitVaryingFromString(this._directionWName, "vec3", `defined(${this._defineEquirectangularFixedName}) || defined(${this._defineMirroredEquirectangularFixedName})`)) {
             state.compilationString += `#if defined(${this._defineEquirectangularFixedName}) || defined(${this._defineMirroredEquirectangularFixedName})\r\n`;
-            state.compilationString += `${this._directionWName} = normalize(vec3(${this.world.associatedVariableName} * vec4(${this.position.associatedVariableName}, 0.0)));\r\n`;
+            state.compilationString += `${this._directionWName} = normalize(vec3(${this.world.associatedVariableName} * vec4(${this.position.associatedVariableName}.xyz, 0.0)));\r\n`;
             state.compilationString += `#endif\r\n`;
         }
     }

+ 3 - 3
tests/validation/config.json

@@ -8,7 +8,7 @@
         },           
         {
             "title": "Sprite maps",
-            "playgroundId": "#ARLADE#22",
+            "playgroundId": "#ARLADE#23",
             "referenceImage": "sprite-maps.png",            
             "excludeFromAutomaticTesting": true
         },              
@@ -19,14 +19,14 @@
         },             
         {
             "title": "Node material #0",
-            "playgroundId": "#M5VQE9#16",
+            "playgroundId": "#M5VQE9#20",
             "referenceImage": "node-material0.png",
             "renderCount": 5,
             "excludeFromAutomaticTesting": true
         },    
         {
             "title": "Node material #1",
-            "playgroundId": "#QJ71C6#0",
+            "playgroundId": "#QJ71C6#1",
             "referenceImage": "node-material1.png",
             "renderCount": 20
         },     

+ 0 - 4
tests/validation/validation.js

@@ -37,10 +37,6 @@ function compare(renderData, referenceCanvas, threshold, errorRatio) {
             continue;
         }
 
-        if (differencesCount === 0) {
-            console.log(`First pixel off at ${index}: Value: (${renderData[index]}, ${renderData[index + 1]}, ${renderData[index] + 2}) - Expected: (${referenceData.data[index]}, ${referenceData.data[index + 1]}, ${referenceData.data[index + 2]}) `);
-        }
-
         referenceData.data[index] = 255;
         referenceData.data[index + 1] *= 0.5;
         referenceData.data[index + 2] *= 0.5;