Browse Source

Merge pull request #7953 from BabylonJS/master

Nightly
mergify[bot] 5 years ago
parent
commit
7591a60dd8
56 changed files with 3644 additions and 1005 deletions
  1. 78 65
      Tools/Gulp/tasks/gulpTasks-viewerLibraries.js
  2. 12 0
      dist/preview release/babylon.d.ts
  3. 1 1
      dist/preview release/babylon.js
  4. 24 0
      dist/preview release/babylon.module.d.ts
  5. 15 2
      dist/preview release/documentation.d.ts
  6. 2 2
      dist/preview release/gui/babylon.gui.min.js
  7. 8 7
      dist/preview release/inspector/babylon.inspector.bundle.js
  8. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  9. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  10. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  11. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  12. 1 1
      dist/preview release/loaders/babylon.stlFileLoader.min.js
  13. 2 2
      dist/preview release/loaders/babylonjs.loaders.min.js
  14. 1 1
      dist/preview release/materialsLibrary/babylon.cellMaterial.min.js
  15. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  16. 1 1
      dist/preview release/materialsLibrary/babylon.fireMaterial.min.js
  17. 1 1
      dist/preview release/materialsLibrary/babylon.furMaterial.min.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.gridMaterial.min.js
  20. 1 1
      dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.mixMaterial.min.js
  22. 1 1
      dist/preview release/materialsLibrary/babylon.normalMaterial.min.js
  23. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  24. 1 1
      dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js
  25. 1 1
      dist/preview release/materialsLibrary/babylon.skyMaterial.min.js
  26. 1 1
      dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js
  27. 1 1
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js
  28. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  29. 1 1
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  30. 7 7
      dist/preview release/nodeEditor/babylon.nodeEditor.js
  31. 1 1
      dist/preview release/packagesSizeBaseLine.json
  32. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  33. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  34. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  35. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.brickProceduralTexture.min.js
  36. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.cloudProceduralTexture.min.js
  37. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.fireProceduralTexture.min.js
  38. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.grassProceduralTexture.min.js
  39. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.marbleProceduralTexture.min.js
  40. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.normalMapProceduralTexture.min.js
  41. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.perlinNoiseProceduralTexture.min.js
  42. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.roadProceduralTexture.min.js
  43. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.min.js
  44. 1 1
      dist/preview release/proceduralTexturesLibrary/babylon.woodProceduralTexture.min.js
  45. 1 1
      dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js
  46. 1 15
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  47. 1 1
      dist/preview release/serializers/babylon.objSerializer.min.js
  48. 1 15
      dist/preview release/serializers/babylonjs.serializers.min.js
  49. 24 0
      dist/preview release/viewer/babylon.module.d.ts
  50. 2 2
      dist/preview release/viewer/babylon.viewer.js
  51. 3341 838
      dist/preview release/viewer/babylon.viewer.max.js
  52. 8 0
      dist/preview release/what's new.md
  53. 2 1
      inspector/src/components/actionTabs/tabs/propertyGrids/animations/animationPropertyGridComponent.tsx
  54. 3 3
      package.json
  55. 11 0
      src/Sprites/sprite.ts
  56. 63 6
      src/Sprites/spriteManager.ts

+ 78 - 65
Tools/Gulp/tasks/gulpTasks-viewerLibraries.js

@@ -13,93 +13,106 @@ var addModuleExports = require("../helpers/gulp-addModuleExports");
 // Import Build Config
 // Import Build Config
 var config = require("../../Config/config.json");
 var config = require("../../Config/config.json");
 
 
+const webpack = require("webpack");
+
 /**
 /**
  * Build the viewer
  * Build the viewer
  */
  */
-var buildViewerLibrary = function(library, settings) {
+var buildViewerLibrary = function (library, settings, out) {
     const sequence = [];
     const sequence = [];
     var outputDirectory = config.build.outputDirectory + settings.build.distOutputDirectory;
     var outputDirectory = config.build.outputDirectory + settings.build.distOutputDirectory;
 
 
-    settings.build.outputs.forEach(out => {
-        let wpConfig = require(settings.build.webpack);
-        if (!out.minified) {
-            wpConfig.mode = "development";
-        }
+    let wpConfig = require(settings.build.webpack);
+    if (!out.minified) {
+        wpConfig.mode = "development";
+    }
 
 
-        let wpBuild = webpackStream(wpConfig, require("webpack"));
+    let wpBuild = webpackStream(wpConfig, webpack);
 
 
-        //shoud dtsBundle create the declaration?
-        if (settings.build.dtsBundle) {
-            let event = wpBuild
-                .pipe(through.obj(function(file, enc, cb) {
-                    // only declaration files
-                    const isdts = /\.d\.ts$/.test(file.path);
-                    if (isdts) this.push(file);
-                    cb();
-                }))
-                .pipe(gulp.dest(outputDirectory));
-            // dts-bundle does NOT support (gulp) streams, so files have to be saved and reloaded, 
-            // until I fix it
-            event.on("end", function() {
-                // create the file
-                dtsBundle.bundle(settings.build.dtsBundle);
-                // process the declaration
-                let fileLocation = path.join(path.dirname(settings.build.dtsBundle.main), settings.build.dtsBundle.out);
-                processDeclaration(fileLocation, settings.build.umd.packageName, settings.build.umd.processDeclaration);
-            });
-        }
-
-        let build = wpBuild
-            .pipe(through.obj(function(file, enc, cb) {
-                // only pipe js files
-                const isJs = /\.js$/.test(file.path);
-                if (isJs) this.push(file);
+    //shoud dtsBundle create the declaration?
+    if (settings.build.dtsBundle) {
+        let event = wpBuild
+            .pipe(through.obj(function (file, enc, cb) {
+                // only declaration files
+                const isdts = /\.d\.ts$/.test(file.path);
+                if (isdts) this.push(file);
                 cb();
                 cb();
             }))
             }))
-            .pipe(addModuleExports(library.moduleDeclaration, { subModule: false, extendsRoot: false, externalUsingBabylon: true, noBabylonInit: true }));
-
-        function processDestination(dest) {
-            var outputDirectory = config.build.outputDirectory + dest.outputDirectory;
-            build = build
-                .pipe(rename(dest.filename))
-                .pipe(gulp.dest(outputDirectory));
-
-            if (dest.addBabylonDeclaration) {
-                // include the babylon declaration
-                if (dest.addBabylonDeclaration === true) {
-                    dest.addBabylonDeclaration = ["babylon.module.d.ts"];
-                }
-                var decsToAdd = dest.addBabylonDeclaration.map(function(dec) {
-                    return config.build.outputDirectory + '/' + dec;
-                });
-                sequence.unshift(gulp.src(decsToAdd)
-                    .pipe(rename(function(path) {
-                        path.dirname = '';
-                    }))
-                    .pipe(gulp.dest(outputDirectory)))
+            .pipe(gulp.dest(outputDirectory));
+        // dts-bundle does NOT support (gulp) streams, so files have to be saved and reloaded, 
+        // until I fix it
+        event.on("end", function () {
+            // create the file
+            dtsBundle.bundle(settings.build.dtsBundle);
+            // process the declaration
+            let fileLocation = path.join(path.dirname(settings.build.dtsBundle.main), settings.build.dtsBundle.out);
+            processDeclaration(fileLocation, settings.build.umd.packageName, settings.build.umd.processDeclaration);
+        });
+    }
+
+    let build = wpBuild
+        .pipe(through.obj(function (file, enc, cb) {
+            // only pipe js files
+            const isJs = /\.js$/.test(file.path);
+            if (isJs) this.push(file);
+            cb();
+        }))
+        .pipe(addModuleExports(library.moduleDeclaration, {
+            subModule: false,
+            extendsRoot: false,
+            externalUsingBabylon: true,
+            noBabylonInit: true
+        }));
+
+    function processDestination(dest) {
+        var outputDirectory = config.build.outputDirectory + dest.outputDirectory;
+        build = build
+            .pipe(rename(dest.filename))
+            .pipe(gulp.dest(outputDirectory));
+
+        if (dest.addBabylonDeclaration) {
+            // include the babylon declaration
+            if (dest.addBabylonDeclaration === true) {
+                dest.addBabylonDeclaration = ["babylon.module.d.ts"];
             }
             }
+            var decsToAdd = dest.addBabylonDeclaration.map(function (dec) {
+                return config.build.outputDirectory + '/' + dec;
+            });
+            sequence.unshift(gulp.src(decsToAdd)
+                .pipe(rename(function (path) {
+                    path.dirname = '';
+                }))
+                .pipe(gulp.dest(outputDirectory)))
         }
         }
+    }
 
 
-        out.destinations.forEach(dest => {
-            processDestination(dest);
-        });
+    out.destinations.forEach(dest => {
+        processDestination(dest);
+    });
 
 
-        sequence.push(build);
+    sequence.push(build);
 
 
-    });
+    // });
 
 
     return merge2(sequence);
     return merge2(sequence);
 }
 }
 
 
+function buildViewerOutputs(settings, library) {
+    var outputBuilds = settings.build.outputs.map(out => {
+        var buildOutput = function () {
+            return buildViewerLibrary(library, settings, out);
+        }
+        return buildOutput;
+    });
+    return (outputBuilds);
+}
+
 /**
 /**
  * Dynamic viewer module creation In Serie for WebPack leaks.
  * Dynamic viewer module creation In Serie for WebPack leaks.
  */
  */
 function buildViewerLibraries(settings) {
 function buildViewerLibraries(settings) {
-    var tasks = settings.libraries.map(function(library) {
-        var build = function(cb) {
-            return buildViewerLibrary(library, settings);
-        }
-        return build;
+    var tasks = settings.libraries.map(function (library) {
+        return buildViewerOutputs(settings, library);
     });
     });
 
 
     return gulp.series.apply(this, tasks);
     return gulp.series.apply(this, tasks);
@@ -109,7 +122,7 @@ function buildViewerLibraries(settings) {
 /**
 /**
  * Dynamic viewer module creation.
  * Dynamic viewer module creation.
  */
  */
-config.viewerModules.map(function(module) {
+config.viewerModules.map(function (module) {
     var settings = config[module];
     var settings = config[module];
 
 
     // Build the libraries.
     // Build the libraries.

+ 12 - 0
dist/preview release/babylon.d.ts

@@ -10024,6 +10024,7 @@ declare module BABYLON {
         private _spriteMap;
         private _spriteMap;
         /** True when packed cell data from JSON file is ready*/
         /** True when packed cell data from JSON file is ready*/
         private _packedAndReady;
         private _packedAndReady;
+        private _textureContent;
         /**
         /**
         * An event triggered when the manager is disposed.
         * An event triggered when the manager is disposed.
         */
         */
@@ -10079,6 +10080,7 @@ declare module BABYLON {
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         private _makePacked;
         private _makePacked;
         private _appendSpriteVertex;
         private _appendSpriteVertex;
+        private _checkTextureAlpha;
         /**
         /**
          * Intersects the sprites with a ray
          * Intersects the sprites with a ray
          * @param ray defines the ray to intersect with
          * @param ray defines the ray to intersect with
@@ -18073,6 +18075,16 @@ declare module BABYLON {
         animations: Animation[];
         animations: Animation[];
         /** Gets or sets a boolean indicating if the sprite can be picked */
         /** Gets or sets a boolean indicating if the sprite can be picked */
         isPickable: boolean;
         isPickable: boolean;
+        /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+        useAlphaForPicking: boolean;
+        /** @hidden */
+        _xOffset: number;
+        /** @hidden */
+        _yOffset: number;
+        /** @hidden */
+        _xSize: number;
+        /** @hidden */
+        _ySize: number;
         /**
         /**
          * Gets or sets the associated action manager
          * Gets or sets the associated action manager
          */
          */

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


+ 24 - 0
dist/preview release/babylon.module.d.ts

@@ -10214,6 +10214,7 @@ declare module "babylonjs/Sprites/spriteManager" {
         private _spriteMap;
         private _spriteMap;
         /** True when packed cell data from JSON file is ready*/
         /** True when packed cell data from JSON file is ready*/
         private _packedAndReady;
         private _packedAndReady;
+        private _textureContent;
         /**
         /**
         * An event triggered when the manager is disposed.
         * An event triggered when the manager is disposed.
         */
         */
@@ -10269,6 +10270,7 @@ declare module "babylonjs/Sprites/spriteManager" {
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         private _makePacked;
         private _makePacked;
         private _appendSpriteVertex;
         private _appendSpriteVertex;
+        private _checkTextureAlpha;
         /**
         /**
          * Intersects the sprites with a ray
          * Intersects the sprites with a ray
          * @param ray defines the ray to intersect with
          * @param ray defines the ray to intersect with
@@ -18564,6 +18566,16 @@ declare module "babylonjs/Sprites/sprite" {
         animations: Animation[];
         animations: Animation[];
         /** Gets or sets a boolean indicating if the sprite can be picked */
         /** Gets or sets a boolean indicating if the sprite can be picked */
         isPickable: boolean;
         isPickable: boolean;
+        /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+        useAlphaForPicking: boolean;
+        /** @hidden */
+        _xOffset: number;
+        /** @hidden */
+        _yOffset: number;
+        /** @hidden */
+        _xSize: number;
+        /** @hidden */
+        _ySize: number;
         /**
         /**
          * Gets or sets the associated action manager
          * Gets or sets the associated action manager
          */
          */
@@ -84318,6 +84330,7 @@ declare module BABYLON {
         private _spriteMap;
         private _spriteMap;
         /** True when packed cell data from JSON file is ready*/
         /** True when packed cell data from JSON file is ready*/
         private _packedAndReady;
         private _packedAndReady;
+        private _textureContent;
         /**
         /**
         * An event triggered when the manager is disposed.
         * An event triggered when the manager is disposed.
         */
         */
@@ -84373,6 +84386,7 @@ declare module BABYLON {
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         private _makePacked;
         private _makePacked;
         private _appendSpriteVertex;
         private _appendSpriteVertex;
+        private _checkTextureAlpha;
         /**
         /**
          * Intersects the sprites with a ray
          * Intersects the sprites with a ray
          * @param ray defines the ray to intersect with
          * @param ray defines the ray to intersect with
@@ -92367,6 +92381,16 @@ declare module BABYLON {
         animations: Animation[];
         animations: Animation[];
         /** Gets or sets a boolean indicating if the sprite can be picked */
         /** Gets or sets a boolean indicating if the sprite can be picked */
         isPickable: boolean;
         isPickable: boolean;
+        /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+        useAlphaForPicking: boolean;
+        /** @hidden */
+        _xOffset: number;
+        /** @hidden */
+        _yOffset: number;
+        /** @hidden */
+        _xSize: number;
+        /** @hidden */
+        _ySize: number;
         /**
         /**
          * Gets or sets the associated action manager
          * Gets or sets the associated action manager
          */
          */

+ 15 - 2
dist/preview release/documentation.d.ts

@@ -10024,6 +10024,7 @@ declare module BABYLON {
         private _spriteMap;
         private _spriteMap;
         /** True when packed cell data from JSON file is ready*/
         /** True when packed cell data from JSON file is ready*/
         private _packedAndReady;
         private _packedAndReady;
+        private _textureContent;
         /**
         /**
         * An event triggered when the manager is disposed.
         * An event triggered when the manager is disposed.
         */
         */
@@ -10079,6 +10080,7 @@ declare module BABYLON {
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         private _makePacked;
         private _makePacked;
         private _appendSpriteVertex;
         private _appendSpriteVertex;
+        private _checkTextureAlpha;
         /**
         /**
          * Intersects the sprites with a ray
          * Intersects the sprites with a ray
          * @param ray defines the ray to intersect with
          * @param ray defines the ray to intersect with
@@ -18073,6 +18075,16 @@ declare module BABYLON {
         animations: Animation[];
         animations: Animation[];
         /** Gets or sets a boolean indicating if the sprite can be picked */
         /** Gets or sets a boolean indicating if the sprite can be picked */
         isPickable: boolean;
         isPickable: boolean;
+        /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+        useAlphaForPicking: boolean;
+        /** @hidden */
+        _xOffset: number;
+        /** @hidden */
+        _yOffset: number;
+        /** @hidden */
+        _xSize: number;
+        /** @hidden */
+        _ySize: number;
         /**
         /**
          * Gets or sets the associated action manager
          * Gets or sets the associated action manager
          */
          */
@@ -48010,6 +48022,7 @@ declare module BABYLON {
         private readonly INVALID_HANDLE;
         private readonly INVALID_HANDLE;
         getHardwareScalingLevel(): number;
         getHardwareScalingLevel(): number;
         constructor();
         constructor();
+        dispose(): void;
         /**
         /**
          * Can be used to override the current requestAnimationFrame requester.
          * Can be used to override the current requestAnimationFrame requester.
          * @hidden
          * @hidden
@@ -48156,7 +48169,7 @@ declare module BABYLON {
         /**
         /**
          * Usually called from Texture.ts.
          * Usually called from Texture.ts.
          * Passed information to create a WebGLTexture
          * Passed information to create a WebGLTexture
-         * @param urlArg defines a value which contains one of the following:
+         * @param url defines a value which contains one of the following:
          * * A conventional http URL, e.g. 'http://...' or 'file://...'
          * * A conventional http URL, e.g. 'http://...' or 'file://...'
          * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
          * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
          * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
          * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
@@ -48173,7 +48186,7 @@ declare module BABYLON {
          * @param mimeType defines an optional mime type
          * @param mimeType defines an optional mime type
          * @returns a InternalTexture for assignment back into BABYLON.Texture
          * @returns a InternalTexture for assignment back into BABYLON.Texture
          */
          */
-        createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<ISceneLike>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>, fallback?: Nullable<InternalTexture>, format?: Nullable<number>, forcedExtension?: Nullable<string>, mimeType?: string): InternalTexture;
+        createTexture(url: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<ISceneLike>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>, fallback?: Nullable<InternalTexture>, format?: Nullable<number>, forcedExtension?: Nullable<string>, mimeType?: string): InternalTexture;
         /**
         /**
          * Creates a cube texture
          * Creates a cube texture
          * @param rootUrl defines the url where the files to load is located
          * @param rootUrl defines the url where the files to load is located

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


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


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.stlFileLoader.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylonjs.loaders.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.cellMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.fireMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.furMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.gridMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.mixMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.normalMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.skyMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylonjs.materials.min.js


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


+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"thinEngineOnly":114747,"engineOnly":151405,"sceneOnly":509096,"minGridMaterial":641404,"minStandardMaterial":782585}
+{"thinEngineOnly":114719,"engineOnly":151377,"sceneOnly":508946,"minGridMaterial":641242,"minStandardMaterial":782423}

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.brickProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.cloudProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.fireProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.grassProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.marbleProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.normalMapProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.perlinNoiseProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.roadProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylon.woodProceduralTexture.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js


File diff suppressed because it is too large
+ 1 - 15
dist/preview release/serializers/babylon.glTF2Serializer.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylon.objSerializer.min.js


File diff suppressed because it is too large
+ 1 - 15
dist/preview release/serializers/babylonjs.serializers.min.js


+ 24 - 0
dist/preview release/viewer/babylon.module.d.ts

@@ -10214,6 +10214,7 @@ declare module "babylonjs/Sprites/spriteManager" {
         private _spriteMap;
         private _spriteMap;
         /** True when packed cell data from JSON file is ready*/
         /** True when packed cell data from JSON file is ready*/
         private _packedAndReady;
         private _packedAndReady;
+        private _textureContent;
         /**
         /**
         * An event triggered when the manager is disposed.
         * An event triggered when the manager is disposed.
         */
         */
@@ -10269,6 +10270,7 @@ declare module "babylonjs/Sprites/spriteManager" {
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         private _makePacked;
         private _makePacked;
         private _appendSpriteVertex;
         private _appendSpriteVertex;
+        private _checkTextureAlpha;
         /**
         /**
          * Intersects the sprites with a ray
          * Intersects the sprites with a ray
          * @param ray defines the ray to intersect with
          * @param ray defines the ray to intersect with
@@ -18564,6 +18566,16 @@ declare module "babylonjs/Sprites/sprite" {
         animations: Animation[];
         animations: Animation[];
         /** Gets or sets a boolean indicating if the sprite can be picked */
         /** Gets or sets a boolean indicating if the sprite can be picked */
         isPickable: boolean;
         isPickable: boolean;
+        /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+        useAlphaForPicking: boolean;
+        /** @hidden */
+        _xOffset: number;
+        /** @hidden */
+        _yOffset: number;
+        /** @hidden */
+        _xSize: number;
+        /** @hidden */
+        _ySize: number;
         /**
         /**
          * Gets or sets the associated action manager
          * Gets or sets the associated action manager
          */
          */
@@ -84318,6 +84330,7 @@ declare module BABYLON {
         private _spriteMap;
         private _spriteMap;
         /** True when packed cell data from JSON file is ready*/
         /** True when packed cell data from JSON file is ready*/
         private _packedAndReady;
         private _packedAndReady;
+        private _textureContent;
         /**
         /**
         * An event triggered when the manager is disposed.
         * An event triggered when the manager is disposed.
         */
         */
@@ -84373,6 +84386,7 @@ declare module BABYLON {
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null);
         private _makePacked;
         private _makePacked;
         private _appendSpriteVertex;
         private _appendSpriteVertex;
+        private _checkTextureAlpha;
         /**
         /**
          * Intersects the sprites with a ray
          * Intersects the sprites with a ray
          * @param ray defines the ray to intersect with
          * @param ray defines the ray to intersect with
@@ -92367,6 +92381,16 @@ declare module BABYLON {
         animations: Animation[];
         animations: Animation[];
         /** Gets or sets a boolean indicating if the sprite can be picked */
         /** Gets or sets a boolean indicating if the sprite can be picked */
         isPickable: boolean;
         isPickable: boolean;
+        /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+        useAlphaForPicking: boolean;
+        /** @hidden */
+        _xOffset: number;
+        /** @hidden */
+        _yOffset: number;
+        /** @hidden */
+        _xSize: number;
+        /** @hidden */
+        _ySize: number;
         /**
         /**
          * Gets or sets the associated action manager
          * Gets or sets the associated action manager
          */
          */

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


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


+ 8 - 0
dist/preview release/what's new.md

@@ -36,6 +36,10 @@
 - Added flag to TargetCamera to invert rotation direction and multiplier to adjust speed ([Exolun](https://github.com/Exolun))
 - Added flag to TargetCamera to invert rotation direction and multiplier to adjust speed ([Exolun](https://github.com/Exolun))
 - Added upwards and downwards keyboard input to `FreeCamera` ([Pheater](https://github.com/pheater))
 - Added upwards and downwards keyboard input to `FreeCamera` ([Pheater](https://github.com/pheater))
 
 
+### Sprites
+
+- Added support for 'sprite.useAlphaForPicking` to enable precise picking using sprite alpha ([Deltakosh](https://github.com/deltakosh) 
+
 ### Physics
 ### Physics
 
 
 - Ammo.js IDL exposed property update and raycast vehicle stablization support ([MackeyK24](https://github.com/MackeyK24))
 - Ammo.js IDL exposed property update and raycast vehicle stablization support ([MackeyK24](https://github.com/MackeyK24))
@@ -76,6 +80,10 @@
 
 
 - Added support for Additive Animation Blending. Existing animations can be converted to additive using the new MakeAnimationAdditive method for Skeletons, AnimationGroups and Animations. Animations can be played additively using the new isAdditive input parameter to the begin animation methods. ([c-morten](https://github.com/c-morten))
 - Added support for Additive Animation Blending. Existing animations can be converted to additive using the new MakeAnimationAdditive method for Skeletons, AnimationGroups and Animations. Animations can be played additively using the new isAdditive input parameter to the begin animation methods. ([c-morten](https://github.com/c-morten))
 
 
+### Build
+
+- Fixed an issue with gulp webpack, webpack stream and the viewer ([RaananW](https://github.com/RaananW))
+
 ## Bugs
 ## Bugs
 
 
 - Fix infinite loop in `GlowLayer.unReferenceMeshFromUsingItsOwnMaterial` ([Popov72](https://github.com/Popov72)
 - Fix infinite loop in `GlowLayer.unReferenceMeshFromUsingItsOwnMaterial` ([Popov72](https://github.com/Popov72)

+ 2 - 1
inspector/src/components/actionTabs/tabs/propertyGrids/animations/animationPropertyGridComponent.tsx

@@ -170,11 +170,12 @@ export class AnimationGridComponent extends React.Component<IAnimationGridCompon
                     <>
                     <>
                         <LineContainerComponent globalState={this.props.globalState} title="ANIMATIONS">
                         <LineContainerComponent globalState={this.props.globalState} title="ANIMATIONS">
                             <TextLineComponent label="Count" value={animations.length.toString()} />
                             <TextLineComponent label="Count" value={animations.length.toString()} />
+                            <ButtonLineComponent label="Edit" onClick={() => {}} />
                             {
                             {
                                 animations.map((anim, i) => {
                                 animations.map((anim, i) => {
                                     return (
                                     return (
                                         <>
                                         <>
-                                            <TextLineComponent label={"#" + i + " >"} value={anim.targetProperty} />
+                                            <TextLineComponent key={i} label={"#" + i + " >"} value={anim.targetProperty} />
                                         </>           
                                         </>           
                                     )
                                     )
                                 })
                                 })

+ 3 - 3
package.json

@@ -99,14 +99,14 @@
         "tslint": "^5.11.0",
         "tslint": "^5.11.0",
         "typedoc": "^0.15.4",
         "typedoc": "^0.15.4",
         "typescript": "~3.8.3",
         "typescript": "~3.8.3",
-        "webpack": "4.41.0",
+        "webpack": "~4.42.0",
         "webpack-bundle-analyzer": "^3.1.0",
         "webpack-bundle-analyzer": "^3.1.0",
         "webpack-cli": "^3.3.9",
         "webpack-cli": "^3.3.9",
         "webpack-dev-server": "^3.1.14",
         "webpack-dev-server": "^3.1.14",
-        "webpack-stream": "5.0.0",
+        "webpack-stream": "~5.2.0",
         "xhr2": "^0.1.4",
         "xhr2": "^0.1.4",
         "xmlbuilder": "8.2.2",
         "xmlbuilder": "8.2.2",
         "react-color": "^2.18.0",
         "react-color": "^2.18.0",
         "@types/react-color": "^3.0.1"
         "@types/react-color": "^3.0.1"
     }
     }
-}
+}

+ 11 - 0
src/Sprites/sprite.ts

@@ -33,6 +33,17 @@ export class Sprite {
     public animations = new Array<Animation>();
     public animations = new Array<Animation>();
     /** Gets or sets a boolean indicating if the sprite can be picked */
     /** Gets or sets a boolean indicating if the sprite can be picked */
     public isPickable = false;
     public isPickable = false;
+    /** Gets or sets a boolean indicating that sprite texture alpha will be used for precise picking (false by default) */
+    public useAlphaForPicking = false;
+
+    /** @hidden */
+    public _xOffset: number;
+    /** @hidden */
+    public _yOffset: number;
+    /** @hidden */
+    public _xSize: number;
+    /** @hidden */
+    public _ySize: number;
 
 
     /**
     /**
      * Gets or sets the associated action manager
      * Gets or sets the associated action manager

+ 63 - 6
src/Sprites/spriteManager.ts

@@ -98,6 +98,8 @@ export class SpriteManager implements ISpriteManager {
     /** True when packed cell data from JSON file is ready*/
     /** True when packed cell data from JSON file is ready*/
     private _packedAndReady: boolean = false;
     private _packedAndReady: boolean = false;
 
 
+    private _textureContent: Nullable<Uint8Array>;
+
     /**
     /**
     * An event triggered when the manager is disposed.
     * An event triggered when the manager is disposed.
     */
     */
@@ -138,6 +140,7 @@ export class SpriteManager implements ISpriteManager {
 
 
     public set texture(value: Texture) {
     public set texture(value: Texture) {
         this._spriteTexture = value;
         this._spriteTexture = value;
+        this._textureContent = null;
     }
     }
 
 
     private _blendMode = Constants.ALPHA_COMBINE;
     private _blendMode = Constants.ALPHA_COMBINE;
@@ -352,10 +355,14 @@ export class SpriteManager implements ISpriteManager {
             if (typeof (num) === "number" && isFinite(num) && Math.floor(num) === num) {
             if (typeof (num) === "number" && isFinite(num) && Math.floor(num) === num) {
                 sprite.cellRef = this._spriteMap[sprite.cellIndex];
                 sprite.cellRef = this._spriteMap[sprite.cellIndex];
             }
             }
-            this._vertexData[arrayOffset + 10] = this._cellData[sprite.cellRef].frame.x / baseSize.width;
-            this._vertexData[arrayOffset + 11] = this._cellData[sprite.cellRef].frame.y / baseSize.height;
-            this._vertexData[arrayOffset + 12] = this._cellData[sprite.cellRef].frame.w / baseSize.width;
-            this._vertexData[arrayOffset + 13] = this._cellData[sprite.cellRef].frame.h / baseSize.height;
+            sprite._xOffset = this._cellData[sprite.cellRef].frame.x / baseSize.width;
+            sprite._yOffset = this._cellData[sprite.cellRef].frame.y / baseSize.height;
+            sprite._xSize = this._cellData[sprite.cellRef].frame.w;
+            sprite._ySize = this._cellData[sprite.cellRef].frame.h;
+            this._vertexData[arrayOffset + 10] = sprite._xOffset;
+            this._vertexData[arrayOffset + 11] = sprite._yOffset;
+            this._vertexData[arrayOffset + 12] = sprite._xSize / baseSize.width;
+            this._vertexData[arrayOffset + 13] = sprite._ySize / baseSize.height;
         }
         }
         else {
         else {
             if (!sprite.cellIndex) {
             if (!sprite.cellIndex) {
@@ -363,8 +370,12 @@ export class SpriteManager implements ISpriteManager {
             }
             }
             var rowSize = baseSize.width / this.cellWidth;
             var rowSize = baseSize.width / this.cellWidth;
             var offset = (sprite.cellIndex / rowSize) >> 0;
             var offset = (sprite.cellIndex / rowSize) >> 0;
-            this._vertexData[arrayOffset + 10] = (sprite.cellIndex - offset * rowSize) * this.cellWidth / baseSize.width;
-            this._vertexData[arrayOffset + 11] = offset * this.cellHeight / baseSize.height;
+            sprite._xOffset = (sprite.cellIndex - offset * rowSize) * this.cellWidth / baseSize.width;
+            sprite._yOffset = offset * this.cellHeight / baseSize.height;
+            sprite._xSize = this.cellWidth;
+            sprite._ySize = this.cellHeight;
+            this._vertexData[arrayOffset + 10] = sprite._xOffset;
+            this._vertexData[arrayOffset + 11] = sprite._yOffset;
             this._vertexData[arrayOffset + 12] = this.cellWidth / baseSize.width;
             this._vertexData[arrayOffset + 12] = this.cellWidth / baseSize.width;
             this._vertexData[arrayOffset + 13] = this.cellHeight / baseSize.height;
             this._vertexData[arrayOffset + 13] = this.cellHeight / baseSize.height;
         }
         }
@@ -375,6 +386,41 @@ export class SpriteManager implements ISpriteManager {
         this._vertexData[arrayOffset + 17] = sprite.color.a;
         this._vertexData[arrayOffset + 17] = sprite.color.a;
     }
     }
 
 
+    private _checkTextureAlpha(sprite: Sprite, ray: Ray, distance: number, min: Vector3, max: Vector3) {
+        if (!sprite.useAlphaForPicking || !this._spriteTexture) {
+            return true;
+        }
+
+        let textureSize = this._spriteTexture.getSize();
+        if (!this._textureContent) {
+            this._textureContent = new Uint8Array(textureSize.width * textureSize.height * 4);
+            this._spriteTexture.readPixels(0, 0, this._textureContent);
+        }
+
+        let contactPoint = TmpVectors.Vector3[0];
+
+        contactPoint.copyFrom(ray.direction);
+
+        contactPoint.normalize();
+        contactPoint.scaleInPlace(distance);
+        contactPoint.addInPlace(ray.origin);
+
+        let contactPointU = ((contactPoint.x - min.x) / (max.x - min.x)) - 0.5;
+        let contactPointV = (1.0 - (contactPoint.y - min.y) / (max.y - min.y)) - 0.5;
+
+        // Rotate
+        let angle = sprite.angle;
+        let rotatedU = 0.5 + (contactPointU * Math.cos(angle) - contactPointV * Math.sin(angle));
+        let rotatedV = 0.5 + (contactPointU * Math.sin(angle) + contactPointV * Math.cos(angle));
+
+        let u = (sprite._xOffset * textureSize.width + rotatedU * sprite._xSize) | 0;
+        let v = (sprite._yOffset * textureSize.height +  rotatedV * sprite._ySize) | 0;
+
+        let alpha = this._textureContent![(u + v * textureSize.width) * 4 + 3];
+
+        return (alpha > 0.5);
+    }
+
     /**
     /**
      * Intersects the sprites with a ray
      * Intersects the sprites with a ray
      * @param ray defines the ray to intersect with
      * @param ray defines the ray to intersect with
@@ -416,6 +462,11 @@ export class SpriteManager implements ISpriteManager {
                 var currentDistance = Vector3.Distance(cameraSpacePosition, ray.origin);
                 var currentDistance = Vector3.Distance(cameraSpacePosition, ray.origin);
 
 
                 if (distance > currentDistance) {
                 if (distance > currentDistance) {
+
+                    if (!this._checkTextureAlpha(sprite, ray, distance, min, max)) {
+                        continue;
+                    }
+
                     distance = currentDistance;
                     distance = currentDistance;
                     currentSprite = sprite;
                     currentSprite = sprite;
 
 
@@ -488,6 +539,10 @@ export class SpriteManager implements ISpriteManager {
             if (ray.intersectsBoxMinMax(min, max)) {
             if (ray.intersectsBoxMinMax(min, max)) {
                 distance = Vector3.Distance(cameraSpacePosition, ray.origin);
                 distance = Vector3.Distance(cameraSpacePosition, ray.origin);
 
 
+                if (!this._checkTextureAlpha(sprite, ray, distance, min, max)) {
+                    continue;
+                }
+
                 var result = new PickingInfo();
                 var result = new PickingInfo();
                 results.push(result);
                 results.push(result);
 
 
@@ -612,6 +667,8 @@ export class SpriteManager implements ISpriteManager {
             (<any>this._spriteTexture) = null;
             (<any>this._spriteTexture) = null;
         }
         }
 
 
+        this._textureContent = null;
+
         // Remove from scene
         // Remove from scene
         var index = this._scene.spriteManagers.indexOf(this);
         var index = this._scene.spriteManagers.indexOf(this);
         this._scene.spriteManagers.splice(index, 1);
         this._scene.spriteManagers.splice(index, 1);