David Catuhe 8 gadi atpakaļ
vecāks
revīzija
084fa4efa5
24 mainītis faili ar 9321 papildinājumiem un 9115 dzēšanām
  1. 4 5
      Playground/index2_5.html
  2. 3 13
      Playground/scripts/pbr.js
  3. 1179 1179
      dist/preview release/babylon.d.ts
  4. 34 34
      dist/preview release/babylon.js
  5. 110 17
      dist/preview release/babylon.max.js
  6. 1179 1179
      dist/preview release/babylon.module.d.ts
  7. 35 35
      dist/preview release/babylon.worker.js
  8. 3162 3156
      dist/preview release/customConfigurations/minimalViewer/babylon.d.ts
  9. 27 27
      dist/preview release/customConfigurations/minimalViewer/babylon.js
  10. 112 16
      dist/preview release/customConfigurations/minimalViewer/babylon.max.js
  11. 3162 3156
      dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts
  12. 2 0
      dist/preview release/gui/babylon.gui.d.ts
  13. 33 19
      dist/preview release/gui/babylon.gui.js
  14. 3 3
      dist/preview release/gui/babylon.gui.min.js
  15. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  16. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  17. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  18. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  19. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  20. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  22. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  23. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  24. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js

+ 4 - 5
Playground/index2_5.html

@@ -36,11 +36,10 @@
     <!--Monaco-->
     <!--Monaco-->
     <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
     <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
     <!-- Babylon.js -->
     <!-- Babylon.js -->
-    <script src="https://www.babylonjs.com/cannon.js"></script>
-    <script src="https://www.babylonjs.com/Oimo.js"></script>
-    <script src="js/v2.5/babylon.2.5.js"></script>
-    <script src="js/v2.5/babylon.2.5.canvas2d.js"></script>
-    <script src="https://www.babylonjs.com/babylon.inspector.bundle.js"></script>
+    <script src="https://cdn.babylonjs.com/cannon.js"></script>
+    <script src="https://cdn.babylonjs.com/Oimo.js"></script>
+    <script src="https://cdn.babylonjs.com/babylon.2.5.js"></script>
+    <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
 
 
     <script src="https://www.babylonjs.com/lib/babylon.glTFFileLoader.js"></script>
     <script src="https://www.babylonjs.com/lib/babylon.glTFFileLoader.js"></script>
     <script src="https://www.babylonjs.com/lib/babylon.objFileLoader.js"></script>
     <script src="https://www.babylonjs.com/lib/babylon.objFileLoader.js"></script>

+ 3 - 13
Playground/scripts/pbr.js

@@ -7,8 +7,8 @@
     // Environment Texture
     // Environment Texture
     var hdrTexture = new BABYLON.HDRCubeTexture("textures/room.hdr", scene, 512);
     var hdrTexture = new BABYLON.HDRCubeTexture("textures/room.hdr", scene, 512);
 
 
-    var exposure = 0.6;
-    var contrast = 1.6;
+    scene.imageProcessingConfiguration.exposure = 0.6;
+    scene.imageProcessingConfiguration.contrast = 1.6;
 
 
     // Skybox
     // Skybox
     var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", 1000.0, scene);
     var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", 1000.0, scene);
@@ -17,8 +17,6 @@
     hdrSkyboxMaterial.reflectionTexture = hdrTexture.clone();
     hdrSkyboxMaterial.reflectionTexture = hdrTexture.clone();
     hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
     hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
 	hdrSkyboxMaterial.microSurface = 1.0;
 	hdrSkyboxMaterial.microSurface = 1.0;
-	hdrSkyboxMaterial.cameraExposure = exposure;
-	hdrSkyboxMaterial.cameraContrast = contrast;
     hdrSkyboxMaterial.disableLighting = true;
     hdrSkyboxMaterial.disableLighting = true;
     hdrSkybox.material = hdrSkyboxMaterial;
     hdrSkybox.material = hdrSkyboxMaterial;
     hdrSkybox.infiniteDistance = true;
     hdrSkybox.infiniteDistance = true;
@@ -42,8 +40,6 @@
     glass.linkRefractionWithTransparency = true;
     glass.linkRefractionWithTransparency = true;
     glass.indexOfRefraction = 0.52;
     glass.indexOfRefraction = 0.52;
     glass.alpha = 0;
     glass.alpha = 0;
-    glass.cameraExposure = exposure;
-    glass.cameraContrast = contrast;
     glass.microSurface = 1;
     glass.microSurface = 1;
     glass.reflectivityColor = new BABYLON.Color3(0.2, 0.2, 0.2);
     glass.reflectivityColor = new BABYLON.Color3(0.2, 0.2, 0.2);
     glass.albedoColor = new BABYLON.Color3(0.85, 0.85, 0.85);
     glass.albedoColor = new BABYLON.Color3(0.85, 0.85, 0.85);
@@ -51,8 +47,6 @@
 
 
     var metal = new BABYLON.PBRMaterial("metal", scene);
     var metal = new BABYLON.PBRMaterial("metal", scene);
     metal.reflectionTexture = hdrTexture;
     metal.reflectionTexture = hdrTexture;
-    metal.cameraExposure = exposure;
-    metal.cameraContrast = 1.6;
     metal.microSurface = 0.96;
     metal.microSurface = 0.96;
     metal.reflectivityColor = new BABYLON.Color3(0.85, 0.85, 0.85);
     metal.reflectivityColor = new BABYLON.Color3(0.85, 0.85, 0.85);
     metal.albedoColor = new BABYLON.Color3(0.01, 0.01, 0.01);
     metal.albedoColor = new BABYLON.Color3(0.01, 0.01, 0.01);
@@ -60,19 +54,15 @@
 	
 	
 	var plastic = new BABYLON.PBRMaterial("plastic", scene);
 	var plastic = new BABYLON.PBRMaterial("plastic", scene);
     plastic.reflectionTexture = hdrTexture;
     plastic.reflectionTexture = hdrTexture;
-    plastic.cameraExposure = exposure;
-    plastic.cameraContrast = contrast;
     plastic.microSurface = 0.96;
     plastic.microSurface = 0.96;
 	plastic.albedoColor = new BABYLON.Color3(0.206, 0.94, 1);
 	plastic.albedoColor = new BABYLON.Color3(0.206, 0.94, 1);
-	plastic.reflectivityColor = new BABYLON.Color3(0.07, 0.07, 0.07);
+	plastic.reflectivityColor = new BABYLON.Color3(0.003, 0.003, 0.003);
     spherePlastic.material = plastic;
     spherePlastic.material = plastic;
 
 
     var wood = new BABYLON.PBRMaterial("wood", scene);
     var wood = new BABYLON.PBRMaterial("wood", scene);
     wood.reflectionTexture = hdrTexture;
     wood.reflectionTexture = hdrTexture;
     wood.environmentIntensity = 1;
     wood.environmentIntensity = 1;
     wood.specularIntensity = 0.3;
     wood.specularIntensity = 0.3;
-    wood.cameraExposure = exposure;
-    wood.cameraContrast = contrast;
 
 
     wood.reflectivityTexture = new BABYLON.Texture("textures/reflectivity.png", scene);
     wood.reflectivityTexture = new BABYLON.Texture("textures/reflectivity.png", scene);
     wood.useMicroSurfaceFromReflectivityMapAlpha = true;
     wood.useMicroSurfaceFromReflectivityMapAlpha = true;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1179 - 1179
dist/preview release/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 34 - 34
dist/preview release/babylon.js


+ 110 - 17
dist/preview release/babylon.max.js

@@ -9647,6 +9647,12 @@ var BABYLON;
             this.bindUnboundFramebuffer(null);
             this.bindUnboundFramebuffer(null);
             return samples;
             return samples;
         };
         };
+        Engine.prototype._uploadDataToTexture = function (target, lod, internalFormat, width, height, format, type, data) {
+            this._gl.texImage2D(target, lod, internalFormat, width, height, 0, format, type, data);
+        };
+        Engine.prototype._uploadCompressedDataToTexture = function (target, lod, internalFormat, width, height, data) {
+            this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);
+        };
         Engine.prototype.createRenderTargetCubeTexture = function (size, options) {
         Engine.prototype.createRenderTargetCubeTexture = function (size, options) {
             var gl = this._gl;
             var gl = this._gl;
             var texture = gl.createTexture();
             var texture = gl.createTexture();
@@ -20227,6 +20233,25 @@ var BABYLON;
             if (!totalVertices || !this.getIndices()) {
             if (!totalVertices || !this.getIndices()) {
                 return null;
                 return null;
             }
             }
+            // Check if we need to recreate the submeshes
+            if (this.subMeshes && this.subMeshes.length > 0) {
+                var totalIndices = this.getIndices().length;
+                var needToRecreate = false;
+                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                    var submesh = _a[_i];
+                    if (submesh.indexStart + submesh.indexCount >= totalIndices) {
+                        needToRecreate = true;
+                        break;
+                    }
+                    if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
+                        needToRecreate = true;
+                        break;
+                    }
+                }
+                if (!needToRecreate) {
+                    return;
+                }
+            }
             this.releaseSubMeshes();
             this.releaseSubMeshes();
             return new BABYLON.SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);
             return new BABYLON.SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);
         };
         };
@@ -56034,7 +56059,7 @@ var BABYLON;
             selects one of the cube map face's 2D mipmap sets based on the largest magnitude coordinate direction
             selects one of the cube map face's 2D mipmap sets based on the largest magnitude coordinate direction
             the major axis direction). The target column in the table below explains how the major axis direction
             the major axis direction). The target column in the table below explains how the major axis direction
             maps to the 2D image of a particular cube map target.
             maps to the 2D image of a particular cube map target.
-    
+    
             major axis
             major axis
             direction     target                              sc     tc    ma
             direction     target                              sc     tc    ma
             ----------    ---------------------------------   ---    ---   ---
             ----------    ---------------------------------   ---    ---   ---
@@ -56044,7 +56069,7 @@ var BABYLON;
             -ry          GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT   +rx    -rz   ry
             -ry          GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT   +rx    -rz   ry
             +rz          GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT   +rx    -ry   rz
             +rz          GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT   +rx    -ry   rz
             -rz          GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT   -rx    -ry   rz
             -rz          GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT   -rx    -ry   rz
-    
+    
             Using the sc, tc, and ma determined by the major axis direction as specified in the table above,
             Using the sc, tc, and ma determined by the major axis direction as specified in the table above,
             an updated (s,t) is calculated as follows
             an updated (s,t) is calculated as follows
             s   =   ( sc/|ma| + 1 ) / 2
             s   =   ( sc/|ma| + 1 ) / 2
@@ -60840,19 +60865,86 @@ var BABYLON;
                     textureType: textureType
                     textureType: textureType
                 };
                 };
             };
             };
-            DDSTools.GetHalfFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
+            DDSTools._ToHalfFloat = function (value) {
+                if (!DDSTools._FloatView) {
+                    DDSTools._FloatView = new Float32Array(1);
+                    DDSTools._Int32View = new Int32Array(DDSTools._FloatView.buffer);
+                }
+                DDSTools._FloatView[0] = value;
+                var x = DDSTools._Int32View[0];
+                var bits = (x >> 16) & 0x8000; /* Get the sign */
+                var m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */
+                var e = (x >> 23) & 0xff; /* Using int is faster here */
+                /* If zero, or denormal, or exponent underflows too much for a denormal
+                * half, return signed zero. */
+                if (e < 103) {
+                    return bits;
+                }
+                /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */
+                if (e > 142) {
+                    bits |= 0x7c00;
+                    /* If exponent was 0xff and one mantissa bit was set, it means NaN,
+                    * not Inf, so make sure we set one mantissa bit too. */
+                    bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff);
+                    return bits;
+                }
+                /* If exponent underflows but not too much, return a denormal */
+                if (e < 113) {
+                    m |= 0x0800;
+                    /* Extra rounding may overflow and set mantissa to 0 and exponent
+                    * to 1, which is OK. */
+                    bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1);
+                    return bits;
+                }
+                bits |= ((e - 112) << 10) | (m >> 1);
+                bits += m & 1;
+                return bits;
+            };
+            DDSTools.GetHalfFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {
+                if (DDSTools.StoreLODInAlphaChannel) {
+                    var destArray = new Uint16Array(dataLength);
+                    var srcData = new Uint16Array(arrayBuffer, dataOffset);
+                    var index = 0;
+                    for (var y = 0; y < height; y++) {
+                        for (var x = 0; x < width; x++) {
+                            var srcPos = (x + y * width) * 4;
+                            destArray[index] = srcData[srcPos];
+                            destArray[index + 1] = srcData[srcPos + 1];
+                            destArray[index + 2] = srcData[srcPos + 2];
+                            destArray[index + 3] = DDSTools._ToHalfFloat(lod);
+                            index += 4;
+                        }
+                    }
+                    return destArray;
+                }
                 return new Uint16Array(arrayBuffer, dataOffset, dataLength);
                 return new Uint16Array(arrayBuffer, dataOffset, dataLength);
             };
             };
-            DDSTools.GetFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
+            DDSTools.GetFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {
+                if (DDSTools.StoreLODInAlphaChannel) {
+                    var destArray = new Float32Array(dataLength);
+                    var srcData = new Float32Array(arrayBuffer, dataOffset);
+                    var index = 0;
+                    for (var y = 0; y < height; y++) {
+                        for (var x = 0; x < width; x++) {
+                            var srcPos = (x + y * width) * 4;
+                            destArray[index] = srcData[srcPos];
+                            destArray[index + 1] = srcData[srcPos + 1];
+                            destArray[index + 2] = srcData[srcPos + 2];
+                            destArray[index + 3] = lod;
+                            index += 4;
+                        }
+                    }
+                    return destArray;
+                }
                 return new Float32Array(arrayBuffer, dataOffset, dataLength);
                 return new Float32Array(arrayBuffer, dataOffset, dataLength);
             };
             };
             DDSTools.GetRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
             DDSTools.GetRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
                 var byteArray = new Uint8Array(dataLength);
                 var byteArray = new Uint8Array(dataLength);
-                var srcData = new Uint8Array(arrayBuffer);
+                var srcData = new Uint8Array(arrayBuffer, dataOffset);
                 var index = 0;
                 var index = 0;
                 for (var y = 0; y < height; y++) {
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                     for (var x = 0; x < width; x++) {
-                        var srcPos = dataOffset + (x + y * width) * 4;
+                        var srcPos = (x + y * width) * 4;
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 2] = srcData[srcPos];
                         byteArray[index + 2] = srcData[srcPos];
@@ -60864,11 +60956,11 @@ var BABYLON;
             };
             };
             DDSTools.GetRGBArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
             DDSTools.GetRGBArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
                 var byteArray = new Uint8Array(dataLength);
                 var byteArray = new Uint8Array(dataLength);
-                var srcData = new Uint8Array(arrayBuffer);
+                var srcData = new Uint8Array(arrayBuffer, dataOffset);
                 var index = 0;
                 var index = 0;
                 for (var y = 0; y < height; y++) {
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                     for (var x = 0; x < width; x++) {
-                        var srcPos = dataOffset + (x + y * width) * 3;
+                        var srcPos = (x + y * width) * 3;
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 2] = srcData[srcPos];
                         byteArray[index + 2] = srcData[srcPos];
@@ -60879,11 +60971,11 @@ var BABYLON;
             };
             };
             DDSTools.GetLuminanceArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
             DDSTools.GetLuminanceArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
                 var byteArray = new Uint8Array(dataLength);
                 var byteArray = new Uint8Array(dataLength);
-                var srcData = new Uint8Array(arrayBuffer);
+                var srcData = new Uint8Array(arrayBuffer, dataOffset);
                 var index = 0;
                 var index = 0;
                 for (var y = 0; y < height; y++) {
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                     for (var x = 0; x < width; x++) {
-                        var srcPos = dataOffset + (x + y * width);
+                        var srcPos = (x + y * width);
                         byteArray[index] = srcData[srcPos];
                         byteArray[index] = srcData[srcPos];
                         index++;
                         index++;
                     }
                     }
@@ -60959,23 +61051,23 @@ var BABYLON;
                             dataLength = width * height * 4;
                             dataLength = width * height * 4;
                             var floatArray;
                             var floatArray;
                             if (bpp === 128) {
                             if (bpp === 128) {
-                                floatArray = DDSTools.GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
+                                floatArray = DDSTools.GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                             }
                             }
                             else {
                             else {
-                                floatArray = DDSTools.GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
+                                floatArray = DDSTools.GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                             }
                             }
-                            gl.texImage2D(sampler, i, internalFormat, width, height, 0, gl.RGBA, format, floatArray);
+                            engine._uploadDataToTexture(sampler, i, internalFormat, width, height, gl.RGBA, format, floatArray);
                         }
                         }
                         else if (info.isRGB) {
                         else if (info.isRGB) {
                             if (bpp === 24) {
                             if (bpp === 24) {
                                 dataLength = width * height * 3;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools.GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                                 byteArray = DDSTools.GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                                gl.texImage2D(sampler, i, gl.RGB, width, height, 0, gl.RGB, gl.UNSIGNED_BYTE, byteArray);
+                                engine._uploadDataToTexture(sampler, i, gl.RGB, width, height, gl.RGB, gl.UNSIGNED_BYTE, byteArray);
                             }
                             }
                             else {
                             else {
                                 dataLength = width * height * 4;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools.GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                                 byteArray = DDSTools.GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                                gl.texImage2D(sampler, i, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, byteArray);
+                                engine._uploadDataToTexture(sampler, i, gl.RGBA, width, height, gl.RGBA, gl.UNSIGNED_BYTE, byteArray);
                             }
                             }
                         }
                         }
                         else if (info.isLuminance) {
                         else if (info.isLuminance) {
@@ -60984,12 +61076,12 @@ var BABYLON;
                             var paddedRowSize = Math.floor((width + unpackAlignment - 1) / unpackAlignment) * unpackAlignment;
                             var paddedRowSize = Math.floor((width + unpackAlignment - 1) / unpackAlignment) * unpackAlignment;
                             dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;
                             dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;
                             byteArray = DDSTools.GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                             byteArray = DDSTools.GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                            gl.texImage2D(sampler, i, gl.LUMINANCE, width, height, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, byteArray);
+                            engine._uploadDataToTexture(sampler, i, gl.LUMINANCE, width, height, gl.LUMINANCE, gl.UNSIGNED_BYTE, byteArray);
                         }
                         }
                         else {
                         else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
                             byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);
                             byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);
-                            gl.compressedTexImage2D(sampler, i, internalFormat, width, height, 0, byteArray);
+                            engine._uploadCompressedDataToTexture(sampler, i, internalFormat, width, height, byteArray);
                         }
                         }
                         dataOffset += width * height * (bpp / 8);
                         dataOffset += width * height * (bpp / 8);
                         width *= 0.5;
                         width *= 0.5;
@@ -61001,6 +61093,7 @@ var BABYLON;
             };
             };
             return DDSTools;
             return DDSTools;
         }());
         }());
+        DDSTools.StoreLODInAlphaChannel = false;
         Internals.DDSTools = DDSTools;
         Internals.DDSTools = DDSTools;
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1179 - 1179
dist/preview release/babylon.module.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 35 - 35
dist/preview release/babylon.worker.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3162 - 3156
dist/preview release/customConfigurations/minimalViewer/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 27 - 27
dist/preview release/customConfigurations/minimalViewer/babylon.js


+ 112 - 16
dist/preview release/customConfigurations/minimalViewer/babylon.max.js

@@ -9647,6 +9647,12 @@ var BABYLON;
             this.bindUnboundFramebuffer(null);
             this.bindUnboundFramebuffer(null);
             return samples;
             return samples;
         };
         };
+        Engine.prototype._uploadDataToTexture = function (target, lod, internalFormat, width, height, format, type, data) {
+            this._gl.texImage2D(target, lod, internalFormat, width, height, 0, format, type, data);
+        };
+        Engine.prototype._uploadCompressedDataToTexture = function (target, lod, internalFormat, width, height, data) {
+            this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);
+        };
         Engine.prototype.createRenderTargetCubeTexture = function (size, options) {
         Engine.prototype.createRenderTargetCubeTexture = function (size, options) {
             var gl = this._gl;
             var gl = this._gl;
             var texture = gl.createTexture();
             var texture = gl.createTexture();
@@ -20227,6 +20233,25 @@ var BABYLON;
             if (!totalVertices || !this.getIndices()) {
             if (!totalVertices || !this.getIndices()) {
                 return null;
                 return null;
             }
             }
+            // Check if we need to recreate the submeshes
+            if (this.subMeshes && this.subMeshes.length > 0) {
+                var totalIndices = this.getIndices().length;
+                var needToRecreate = false;
+                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                    var submesh = _a[_i];
+                    if (submesh.indexStart + submesh.indexCount >= totalIndices) {
+                        needToRecreate = true;
+                        break;
+                    }
+                    if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
+                        needToRecreate = true;
+                        break;
+                    }
+                }
+                if (!needToRecreate) {
+                    return;
+                }
+            }
             this.releaseSubMeshes();
             this.releaseSubMeshes();
             return new BABYLON.SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);
             return new BABYLON.SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);
         };
         };
@@ -29102,7 +29127,10 @@ var BABYLON;
             this.setValue(currentValue);
             this.setValue(currentValue);
             // Check events
             // Check events
             for (var index = 0; index < this._events.length; index++) {
             for (var index = 0; index < this._events.length; index++) {
-                if (currentFrame >= this._events[index].frame) {
+                // Make sure current frame has passed event frame and that event frame is within the current range
+                // Also, handle both forward and reverse animations
+                if ((range > 0 && currentFrame >= this._events[index].frame && this._events[index].frame >= from) ||
+                    (range < 0 && currentFrame <= this._events[index].frame && this._events[index].frame <= from)) {
                     var event = this._events[index];
                     var event = this._events[index];
                     if (!event.isDone) {
                     if (!event.isDone) {
                         // If event should be done only once, remove it.
                         // If event should be done only once, remove it.
@@ -32716,19 +32744,86 @@ var BABYLON;
                     textureType: textureType
                     textureType: textureType
                 };
                 };
             };
             };
-            DDSTools.GetHalfFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
+            DDSTools._ToHalfFloat = function (value) {
+                if (!DDSTools._FloatView) {
+                    DDSTools._FloatView = new Float32Array(1);
+                    DDSTools._Int32View = new Int32Array(DDSTools._FloatView.buffer);
+                }
+                DDSTools._FloatView[0] = value;
+                var x = DDSTools._Int32View[0];
+                var bits = (x >> 16) & 0x8000; /* Get the sign */
+                var m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */
+                var e = (x >> 23) & 0xff; /* Using int is faster here */
+                /* If zero, or denormal, or exponent underflows too much for a denormal
+                * half, return signed zero. */
+                if (e < 103) {
+                    return bits;
+                }
+                /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */
+                if (e > 142) {
+                    bits |= 0x7c00;
+                    /* If exponent was 0xff and one mantissa bit was set, it means NaN,
+                    * not Inf, so make sure we set one mantissa bit too. */
+                    bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff);
+                    return bits;
+                }
+                /* If exponent underflows but not too much, return a denormal */
+                if (e < 113) {
+                    m |= 0x0800;
+                    /* Extra rounding may overflow and set mantissa to 0 and exponent
+                    * to 1, which is OK. */
+                    bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1);
+                    return bits;
+                }
+                bits |= ((e - 112) << 10) | (m >> 1);
+                bits += m & 1;
+                return bits;
+            };
+            DDSTools.GetHalfFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {
+                if (DDSTools.StoreLODInAlphaChannel) {
+                    var destArray = new Uint16Array(dataLength);
+                    var srcData = new Uint16Array(arrayBuffer, dataOffset);
+                    var index = 0;
+                    for (var y = 0; y < height; y++) {
+                        for (var x = 0; x < width; x++) {
+                            var srcPos = (x + y * width) * 4;
+                            destArray[index] = srcData[srcPos];
+                            destArray[index + 1] = srcData[srcPos + 1];
+                            destArray[index + 2] = srcData[srcPos + 2];
+                            destArray[index + 3] = DDSTools._ToHalfFloat(lod);
+                            index += 4;
+                        }
+                    }
+                    return destArray;
+                }
                 return new Uint16Array(arrayBuffer, dataOffset, dataLength);
                 return new Uint16Array(arrayBuffer, dataOffset, dataLength);
             };
             };
-            DDSTools.GetFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
+            DDSTools.GetFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {
+                if (DDSTools.StoreLODInAlphaChannel) {
+                    var destArray = new Float32Array(dataLength);
+                    var srcData = new Float32Array(arrayBuffer, dataOffset);
+                    var index = 0;
+                    for (var y = 0; y < height; y++) {
+                        for (var x = 0; x < width; x++) {
+                            var srcPos = (x + y * width) * 4;
+                            destArray[index] = srcData[srcPos];
+                            destArray[index + 1] = srcData[srcPos + 1];
+                            destArray[index + 2] = srcData[srcPos + 2];
+                            destArray[index + 3] = lod;
+                            index += 4;
+                        }
+                    }
+                    return destArray;
+                }
                 return new Float32Array(arrayBuffer, dataOffset, dataLength);
                 return new Float32Array(arrayBuffer, dataOffset, dataLength);
             };
             };
             DDSTools.GetRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
             DDSTools.GetRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
                 var byteArray = new Uint8Array(dataLength);
                 var byteArray = new Uint8Array(dataLength);
-                var srcData = new Uint8Array(arrayBuffer);
+                var srcData = new Uint8Array(arrayBuffer, dataOffset);
                 var index = 0;
                 var index = 0;
                 for (var y = 0; y < height; y++) {
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                     for (var x = 0; x < width; x++) {
-                        var srcPos = dataOffset + (x + y * width) * 4;
+                        var srcPos = (x + y * width) * 4;
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 2] = srcData[srcPos];
                         byteArray[index + 2] = srcData[srcPos];
@@ -32740,11 +32835,11 @@ var BABYLON;
             };
             };
             DDSTools.GetRGBArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
             DDSTools.GetRGBArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
                 var byteArray = new Uint8Array(dataLength);
                 var byteArray = new Uint8Array(dataLength);
-                var srcData = new Uint8Array(arrayBuffer);
+                var srcData = new Uint8Array(arrayBuffer, dataOffset);
                 var index = 0;
                 var index = 0;
                 for (var y = 0; y < height; y++) {
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                     for (var x = 0; x < width; x++) {
-                        var srcPos = dataOffset + (x + y * width) * 3;
+                        var srcPos = (x + y * width) * 3;
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index] = srcData[srcPos + 2];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 1] = srcData[srcPos + 1];
                         byteArray[index + 2] = srcData[srcPos];
                         byteArray[index + 2] = srcData[srcPos];
@@ -32755,11 +32850,11 @@ var BABYLON;
             };
             };
             DDSTools.GetLuminanceArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
             DDSTools.GetLuminanceArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {
                 var byteArray = new Uint8Array(dataLength);
                 var byteArray = new Uint8Array(dataLength);
-                var srcData = new Uint8Array(arrayBuffer);
+                var srcData = new Uint8Array(arrayBuffer, dataOffset);
                 var index = 0;
                 var index = 0;
                 for (var y = 0; y < height; y++) {
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                     for (var x = 0; x < width; x++) {
-                        var srcPos = dataOffset + (x + y * width);
+                        var srcPos = (x + y * width);
                         byteArray[index] = srcData[srcPos];
                         byteArray[index] = srcData[srcPos];
                         index++;
                         index++;
                     }
                     }
@@ -32835,23 +32930,23 @@ var BABYLON;
                             dataLength = width * height * 4;
                             dataLength = width * height * 4;
                             var floatArray;
                             var floatArray;
                             if (bpp === 128) {
                             if (bpp === 128) {
-                                floatArray = DDSTools.GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
+                                floatArray = DDSTools.GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                             }
                             }
                             else {
                             else {
-                                floatArray = DDSTools.GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
+                                floatArray = DDSTools.GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                             }
                             }
-                            gl.texImage2D(sampler, i, internalFormat, width, height, 0, gl.RGBA, format, floatArray);
+                            engine._uploadDataToTexture(sampler, i, internalFormat, width, height, gl.RGBA, format, floatArray);
                         }
                         }
                         else if (info.isRGB) {
                         else if (info.isRGB) {
                             if (bpp === 24) {
                             if (bpp === 24) {
                                 dataLength = width * height * 3;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools.GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                                 byteArray = DDSTools.GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                                gl.texImage2D(sampler, i, gl.RGB, width, height, 0, gl.RGB, gl.UNSIGNED_BYTE, byteArray);
+                                engine._uploadDataToTexture(sampler, i, gl.RGB, width, height, gl.RGB, gl.UNSIGNED_BYTE, byteArray);
                             }
                             }
                             else {
                             else {
                                 dataLength = width * height * 4;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools.GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                                 byteArray = DDSTools.GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                                gl.texImage2D(sampler, i, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, byteArray);
+                                engine._uploadDataToTexture(sampler, i, gl.RGBA, width, height, gl.RGBA, gl.UNSIGNED_BYTE, byteArray);
                             }
                             }
                         }
                         }
                         else if (info.isLuminance) {
                         else if (info.isLuminance) {
@@ -32860,12 +32955,12 @@ var BABYLON;
                             var paddedRowSize = Math.floor((width + unpackAlignment - 1) / unpackAlignment) * unpackAlignment;
                             var paddedRowSize = Math.floor((width + unpackAlignment - 1) / unpackAlignment) * unpackAlignment;
                             dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;
                             dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;
                             byteArray = DDSTools.GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                             byteArray = DDSTools.GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                            gl.texImage2D(sampler, i, gl.LUMINANCE, width, height, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, byteArray);
+                            engine._uploadDataToTexture(sampler, i, gl.LUMINANCE, width, height, gl.LUMINANCE, gl.UNSIGNED_BYTE, byteArray);
                         }
                         }
                         else {
                         else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
                             byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);
                             byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);
-                            gl.compressedTexImage2D(sampler, i, internalFormat, width, height, 0, byteArray);
+                            engine._uploadCompressedDataToTexture(sampler, i, internalFormat, width, height, byteArray);
                         }
                         }
                         dataOffset += width * height * (bpp / 8);
                         dataOffset += width * height * (bpp / 8);
                         width *= 0.5;
                         width *= 0.5;
@@ -32877,6 +32972,7 @@ var BABYLON;
             };
             };
             return DDSTools;
             return DDSTools;
         }());
         }());
+        DDSTools.StoreLODInAlphaChannel = false;
         Internals.DDSTools = DDSTools;
         Internals.DDSTools = DDSTools;
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
     })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3162 - 3156
dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts


+ 2 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -471,6 +471,8 @@ declare module BABYLON.GUI {
         private _drawText(text, textWidth, y, context);
         private _drawText(text, textWidth, y, context);
         _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
         _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
         protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
         protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+        protected _parseLine(line: string, context: CanvasRenderingContext2D): object;
+        protected _parseLineWithTextWrapping(line: string, context: CanvasRenderingContext2D): object;
         protected _renderLines(context: CanvasRenderingContext2D): void;
         protected _renderLines(context: CanvasRenderingContext2D): void;
     }
     }
 }
 }

+ 33 - 19
dist/preview release/gui/babylon.gui.js

@@ -2779,30 +2779,44 @@ var BABYLON;
             };
             };
             TextBlock.prototype._additionalProcessing = function (parentMeasure, context) {
             TextBlock.prototype._additionalProcessing = function (parentMeasure, context) {
                 this._lines = [];
                 this._lines = [];
+                var _lines = this.text.split("\n");
                 if (this._textWrapping) {
                 if (this._textWrapping) {
-                    var words = this.text.split(' ');
-                    var line = '';
-                    var width = this._currentMeasure.width;
-                    var lineWidth = 0;
-                    for (var n = 0; n < words.length; n++) {
-                        var testLine = n > 0 ? line + " " + words[n] : words[0];
-                        var metrics = context.measureText(testLine);
-                        var testWidth = metrics.width;
-                        if (testWidth > width && n > 0) {
-                            this._lines.push({ text: line, width: lineWidth });
-                            line = words[n];
-                            lineWidth = context.measureText(line).width;
-                        }
-                        else {
-                            lineWidth = testWidth;
-                            line = testLine;
-                        }
+                    for (var _i = 0, _lines_1 = _lines; _i < _lines_1.length; _i++) {
+                        var _line = _lines_1[_i];
+                        this._lines.push(this._parseLineWithTextWrapping(_line, context));
                     }
                     }
-                    this._lines.push({ text: line, width: lineWidth });
                 }
                 }
                 else {
                 else {
-                    this._lines.push({ text: this.text, width: context.measureText(this.text).width });
+                    for (var _a = 0, _lines_2 = _lines; _a < _lines_2.length; _a++) {
+                        var _line = _lines_2[_a];
+                        this._lines.push(this._parseLine(_line, context));
+                    }
+                }
+            };
+            TextBlock.prototype._parseLine = function (line, context) {
+                if (line === void 0) { line = ''; }
+                return { text: line, width: context.measureText(line).width };
+            };
+            TextBlock.prototype._parseLineWithTextWrapping = function (line, context) {
+                if (line === void 0) { line = ''; }
+                var words = line.split(' ');
+                var width = this._currentMeasure.width;
+                var lineWidth = 0;
+                for (var n = 0; n < words.length; n++) {
+                    var testLine = n > 0 ? line + " " + words[n] : words[0];
+                    var metrics = context.measureText(testLine);
+                    var testWidth = metrics.width;
+                    if (testWidth > width && n > 0) {
+                        this._lines.push({ text: line, width: lineWidth });
+                        line = words[n];
+                        lineWidth = context.measureText(line).width;
+                    }
+                    else {
+                        lineWidth = testWidth;
+                        line = testLine;
+                    }
                 }
                 }
+                return { text: line, width: lineWidth };
             };
             };
             TextBlock.prototype._renderLines = function (context) {
             TextBlock.prototype._renderLines = function (context) {
                 var width = this._currentMeasure.width;
                 var width = this._currentMeasure.width;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 263 - 263
dist/preview release/inspector/babylon.inspector.bundle.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js