Browse Source

Merging from master

DESKTOP-QJU4N0L\mityh 8 years ago
parent
commit
888387b0d9

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


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


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


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


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


File diff suppressed because it is too large
+ 1225 - 1263
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


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


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


File diff suppressed because it is too large
+ 1225 - 1263
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 2 - 0
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -701,10 +701,12 @@
                                 return false;
                             }
 
+                            defines.METALLICWORKFLOW = false;
                             MaterialHelper.PrepareDefinesForMergedUV(this._reflectivityTexture, defines, "REFLECTIVITY");
                             defines.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha;
                             defines.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap;
                         } else {
+                            defines.METALLICWORKFLOW = false;
                             defines.REFLECTIVITY = false;
                         }
 

+ 6 - 4
src/Mesh/babylon.mesh.ts

@@ -918,7 +918,7 @@
                     if (this._unIndexed) {
                         engine.drawUnIndexed(false, subMesh.verticesStart, subMesh.verticesCount, instancesCount);
                     } else {
-                        engine.draw(false, 0, instancesCount > 0 ? subMesh.linesIndexCount / 2 : subMesh.linesIndexCount, instancesCount);
+                        engine.draw(false, 0, subMesh.linesIndexCount, instancesCount);
                     }
                     break;
 
@@ -1058,8 +1058,7 @@
                 instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
             }
 
-            this.geometry._bind(effect);
-
+            this._bind(subMesh, effect, fillMode);
             this._draw(subMesh, fillMode, instancesCount);
 
             engine.unbindInstanceAttributes();
@@ -1172,7 +1171,10 @@
 
             // Bind
             var fillMode = scene.forcePointsCloud ? Material.PointFillMode : (scene.forceWireframe ? Material.WireFrameFillMode : effectiveMaterial.fillMode);
-            this._bind(subMesh, effect, fillMode);
+
+            if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB
+                this._bind(subMesh, effect, fillMode);
+            }
 
             var world = this.getWorldMatrix();
 

+ 8 - 0
src/Tools/babylon.tools.ts

@@ -378,6 +378,10 @@
             return url;
         }
 
+        public static PreprocessUrl = (url: string) => {
+            return url;
+        }
+
         public static LoadImage(url: any, onload, onerror, database): HTMLImageElement {
             if (url instanceof ArrayBuffer) {
                 url = Tools.EncodeArrayBufferTobase64(url);
@@ -385,6 +389,8 @@
 
             url = Tools.CleanUrl(url);
 
+            url = Tools.PreprocessUrl(url);
+
             var img = new Image();
 
             if (url.substr(0, 5) !== "data:") {
@@ -455,6 +461,8 @@
         public static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: (data: any) => void, database?, useArrayBuffer?: boolean, onError?: (request: XMLHttpRequest) => void): void {
             url = Tools.CleanUrl(url);
 
+            url = Tools.PreprocessUrl(url);
+
             var noIndexedDB = () => {
                 var request = new XMLHttpRequest();
                 var loadUrl = Tools.BaseUrl + url;

+ 8 - 0
src/babylon.engine.ts

@@ -3681,6 +3681,10 @@
 
         private _prepareWebGLTextureContinuation(texture: WebGLTexture, scene: Scene, noMipmap: boolean, isCompressed: boolean, samplingMode: number): void {
             var gl = this._gl;
+            if (!gl) {
+                return;
+            }
+
             var filters = getSamplingParameters(samplingMode, !noMipmap, gl);
 
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);
@@ -3707,6 +3711,10 @@
             var potHeight = this.needPOTTextures ? Tools.GetExponentOfTwo(height, this.getCaps().maxTextureSize) : height;
 
             var gl = this._gl;
+            if (!gl) {
+                return;
+            }
+
             this._bindTextureDirectly(gl.TEXTURE_2D, texture);
             gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));