sebavan 6 years ago
parent
commit
becc84d23a

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


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


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


+ 1 - 5
dist/preview release/babylon.max.js

@@ -52719,10 +52719,6 @@ var BABYLON;
             var camLeft = this._rigCameras[0];
             var camRight = this._rigCameras[1];
             camLeft.beta = camRight.beta = this.beta;
-            // This looks like being an issue in rig mode. Should be looked if
-            // further issues are found. but was modifying the view matrix twice
-            // Line below commented in order to fix http://www.html5gamedevs.com/topic/41454-confusion-about-camera-positions/
-            // camLeft.radius = camRight.radius = this.radius;
             switch (this.cameraRigMode) {
                 case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
                 case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
@@ -69762,7 +69758,7 @@ var BABYLON;
                     // place and scale the particle bouding sphere in the SPS local system, then update it
                     var minBbox = modelBoundingInfo.minimum.multiplyToRef(particleScaling, tempVectors[1]);
                     var maxBbox = modelBoundingInfo.maximum.multiplyToRef(particleScaling, tempVectors[2]);
-                    var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5);
+                    var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5).addInPlace(particleGlobalPosition);
                     var halfDiag = maxBbox.subtractToRef(minBbox, tempVectors[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor);
                     var bSphereMinBbox = bSphereCenter.subtractToRef(halfDiag, tempVectors[1]);
                     var bSphereMaxBbox = bSphereCenter.addToRef(halfDiag, tempVectors[2]);

+ 1 - 5
dist/preview release/babylon.no-module.max.js

@@ -52686,10 +52686,6 @@ var BABYLON;
             var camLeft = this._rigCameras[0];
             var camRight = this._rigCameras[1];
             camLeft.beta = camRight.beta = this.beta;
-            // This looks like being an issue in rig mode. Should be looked if
-            // further issues are found. but was modifying the view matrix twice
-            // Line below commented in order to fix http://www.html5gamedevs.com/topic/41454-confusion-about-camera-positions/
-            // camLeft.radius = camRight.radius = this.radius;
             switch (this.cameraRigMode) {
                 case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
                 case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
@@ -69729,7 +69725,7 @@ var BABYLON;
                     // place and scale the particle bouding sphere in the SPS local system, then update it
                     var minBbox = modelBoundingInfo.minimum.multiplyToRef(particleScaling, tempVectors[1]);
                     var maxBbox = modelBoundingInfo.maximum.multiplyToRef(particleScaling, tempVectors[2]);
-                    var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5);
+                    var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5).addInPlace(particleGlobalPosition);
                     var halfDiag = maxBbox.subtractToRef(minBbox, tempVectors[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor);
                     var bSphereMinBbox = bSphereCenter.subtractToRef(halfDiag, tempVectors[1]);
                     var bSphereMaxBbox = bSphereCenter.addToRef(halfDiag, tempVectors[2]);

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


+ 1 - 5
dist/preview release/es6.js

@@ -52686,10 +52686,6 @@ var BABYLON;
             var camLeft = this._rigCameras[0];
             var camRight = this._rigCameras[1];
             camLeft.beta = camRight.beta = this.beta;
-            // This looks like being an issue in rig mode. Should be looked if
-            // further issues are found. but was modifying the view matrix twice
-            // Line below commented in order to fix http://www.html5gamedevs.com/topic/41454-confusion-about-camera-positions/
-            // camLeft.radius = camRight.radius = this.radius;
             switch (this.cameraRigMode) {
                 case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
                 case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
@@ -69729,7 +69725,7 @@ var BABYLON;
                     // place and scale the particle bouding sphere in the SPS local system, then update it
                     var minBbox = modelBoundingInfo.minimum.multiplyToRef(particleScaling, tempVectors[1]);
                     var maxBbox = modelBoundingInfo.maximum.multiplyToRef(particleScaling, tempVectors[2]);
-                    var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5);
+                    var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5).addInPlace(particleGlobalPosition);
                     var halfDiag = maxBbox.subtractToRef(minBbox, tempVectors[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor);
                     var bSphereMinBbox = bSphereCenter.subtractToRef(halfDiag, tempVectors[1]);
                     var bSphereMaxBbox = bSphereCenter.addToRef(halfDiag, tempVectors[2]);

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

@@ -2013,6 +2013,11 @@ declare module BABYLON.GUI {
             constructor(
             /** name of ScrollViewer */
             name?: string | undefined);
+            /**
+                * Gets or sets the mouse wheel precision
+                * from 0 to 1 with a default value of 0.05
+                * */
+            wheelPrecision: number;
             /** Gets or sets the bar color */
             barColor: string;
             /** Gets or sets the bar color */

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


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


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


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

@@ -2165,6 +2165,11 @@ declare module 'babylonjs-gui/2D/controls/scrollViewer' {
             constructor(
             /** name of ScrollViewer */
             name?: string | undefined);
+            /**
+                * Gets or sets the mouse wheel precision
+                * from 0 to 1 with a default value of 0.05
+                * */
+            wheelPrecision: number;
             /** Gets or sets the bar color */
             barColor: string;
             /** Gets or sets the bar color */
@@ -5140,6 +5145,11 @@ declare module BABYLON.GUI {
             constructor(
             /** name of ScrollViewer */
             name?: string | undefined);
+            /**
+                * Gets or sets the mouse wheel precision
+                * from 0 to 1 with a default value of 0.05
+                * */
+            wheelPrecision: number;
             /** Gets or sets the bar color */
             barColor: string;
             /** Gets or sets the bar color */

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


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


+ 2 - 1
dist/preview release/what's new.md

@@ -18,7 +18,7 @@
 - GUI:
   - Added new [ImageBasedSlider](http://doc.babylonjs.com/how_to/gui#imagebasedslider) to let users customize sliders using images ([Deltakosh](https://github.com/deltakosh))
   - Added support for clipboard events to let users perform `cut`, `copy` and `paste` events ([Saket Saurabh](https://github.com/ssaket))
-  - Added new ScrollViewer for larger containers to be viewed using Sliders ([JohnK](https://github.com/BabylonJSGuide/))
+  - Added new [ScrollViewer](https://doc.babylonjs.com/how_to/scrollviewer) with mouse wheel scrolling for larger containers to be viewed using Sliders ([JohnK](https://github.com/BabylonJSGuide/))
 
 ## Updates
 
@@ -120,6 +120,7 @@
 - Fixed position and rotation of plane mesh created by MeshBuilder.CreatePlane when specifying a source plane ([sable](https://github.com/thscott), [bghgary](https://github.com/bghgary))
 - Fixed inspector dynamic loading ([Sebavan](https://github.com/Sebavan))
 - Fixed infiniteDistance not working anymore ([Sebavan](https://github.com/Sebavan))
+- Fixed bug in SolidParticle BoundingSphere update within the SolidParticleSystem ([barroij](https://github.com/barroij))
 
 ### Viewer
 

+ 60 - 0
gui/src/2D/controls/scrollViewer.ts

@@ -28,6 +28,8 @@ export class ScrollViewer extends Rectangle {
     private _endTop: number;
     private _window: Container;
     private _windowContents: Control;
+    private _pointerIsOver: Boolean = false;
+    private _wheelPrecision: number = 0.05;
 
     /**
      * Adds windowContents to the grid view window
@@ -145,6 +147,14 @@ export class ScrollViewer extends Rectangle {
             }
         });
 
+        this.onPointerEnterObservable.add(() => {
+            this._pointerIsOver = true;
+        });
+
+        this.onPointerOutObservable.add(() => {
+            this._pointerIsOver = false;
+        });
+
         this._grid = new Grid();
         this._horizontalBar = new Slider();
         this._verticalBar = new Slider();
@@ -227,6 +237,30 @@ export class ScrollViewer extends Rectangle {
         this._grid.addControl(this._dragSpace, 1, 1);
     }
 
+    /**
+     * Gets or sets the mouse wheel precision
+     * from 0 to 1 with a default value of 0.05
+     * */
+    public get wheelPrecision(): number {
+        return this._wheelPrecision;
+    }
+
+    public set wheelPrecision(value: number) {
+        if (this._wheelPrecision === value) {
+            return;
+        }
+
+        if (value < 0) {
+            value = 0;
+        }
+
+        if (value > 1) {
+            value = 1;
+        }
+
+        this._wheelPrecision = value;
+    }
+
     /** Gets or sets the bar color */
     public get barColor(): string {
         return this._barColor;
@@ -287,6 +321,8 @@ export class ScrollViewer extends Rectangle {
 
         this._grid.setColumnDefinition(0, innerWidth, true);
         this._grid.setRowDefinition(0, innerHeight, true);
+
+        this._attachWheel();
     }
 
     /** @hidden */
@@ -361,4 +397,28 @@ export class ScrollViewer extends Rectangle {
             this._updateScroller(windowContents);
         });
     }
+
+    /** @hidden */
+    private _attachWheel() {
+        let scene = this._host.getScene();
+        scene!.onPointerObservable.add((pi, state) => {
+            if (!this._pointerIsOver || pi.type !== BABYLON.PointerEventTypes.POINTERWHEEL) {
+                return;
+            }
+            if (this._verticalBar.isVisible == true) {
+                if ((<MouseWheelEvent>pi.event).deltaY < 0 && this._verticalBar.value > 0) {
+                    this._verticalBar.value -= this._wheelPrecision * 100;
+                } else if ((<MouseWheelEvent>pi.event).deltaY > 0 && this._verticalBar.value < this._verticalBar.maximum) {
+                    this._verticalBar.value += this._wheelPrecision * 100;
+                }
+            }
+            if (this._horizontalBar.isVisible == true) {
+                if ((<MouseWheelEvent>pi.event).deltaX < 0 && this._horizontalBar.value < this._horizontalBar.maximum) {
+                    this._horizontalBar.value += this._wheelPrecision * 100;
+                } else if ((<MouseWheelEvent>pi.event).deltaX > 0 && this._horizontalBar.value > 0) {
+                    this._horizontalBar.value -= this._wheelPrecision * 100;
+                }
+            }
+        });
+    }
 }

+ 1 - 1
src/Particles/solidParticleSystem.ts

@@ -908,7 +908,7 @@ import { BoundingInfo } from "Culling/boundingInfo";
                     const minBbox = modelBoundingInfo.minimum.multiplyToRef(particleScaling, tempVectors[1]);
                     const maxBbox = modelBoundingInfo.maximum.multiplyToRef(particleScaling, tempVectors[2]);
 
-                    const bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5);
+                    const bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5).addInPlace(particleGlobalPosition);
                     const halfDiag = maxBbox.subtractToRef(minBbox, tempVectors[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor);
                     const bSphereMinBbox = bSphereCenter.subtractToRef(halfDiag, tempVectors[1]);
                     const bSphereMaxBbox = bSphereCenter.addToRef(halfDiag, tempVectors[2]);