David Catuhe 7 anni fa
parent
commit
a9016b24fa

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


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


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


+ 28 - 3
dist/preview release/babylon.max.js

@@ -89029,12 +89029,16 @@ var BABYLON;
             var _this = _super.call(this, gizmoLayer) || this;
             _this._boundingDimensions = new BABYLON.Vector3(1, 1, 1);
             _this._renderObserver = null;
+            _this._pointerObserver = null;
             // Do not update the gizmo's scale so it has a fixed size to the object its attached to
             _this._updateScale = false;
-            // Create Material
+            // Create Materials
             var coloredMaterial = new BABYLON.StandardMaterial("", gizmoLayer.utilityLayerScene);
             coloredMaterial.disableLighting = true;
             coloredMaterial.emissiveColor = color;
+            var hoverColoredMaterial = new BABYLON.StandardMaterial("", gizmoLayer.utilityLayerScene);
+            hoverColoredMaterial.disableLighting = true;
+            hoverColoredMaterial.emissiveColor = color.clone().add(new BABYLON.Color3(0.2, 0.2, 0.2));
             // Build bounding box out of lines
             _this._lineBoundingBox = new BABYLON.AbstractMesh("", gizmoLayer.utilityLayerScene);
             _this._lineBoundingBox.rotationQuaternion = new BABYLON.Quaternion();
@@ -89147,6 +89151,24 @@ var BABYLON;
                 }
             }
             _this._rootMesh.addChild(_this._scaleBoxesParent);
+            // Hover color change
+            var pointerIds = new Array();
+            _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo, eventState) {
+                if (!pointerIds[pointerInfo.event.pointerId]) {
+                    _this._rotateSpheresParent.getChildMeshes().concat(_this._scaleBoxesParent.getChildMeshes()).forEach(function (mesh) {
+                        if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {
+                            pointerIds[pointerInfo.event.pointerId] = mesh;
+                            mesh.material = hoverColoredMaterial;
+                        }
+                    });
+                }
+                else {
+                    if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[pointerInfo.event.pointerId]) {
+                        pointerIds[pointerInfo.event.pointerId].material = coloredMaterial;
+                        delete pointerIds[pointerInfo.event.pointerId];
+                    }
+                }
+            });
             // Update bounding box positions
             _this._renderObserver = _this.gizmoLayer.originalScene.onBeforeRenderObservable.add(function () {
                 _this._updateBoundingBox();
@@ -89216,6 +89238,7 @@ var BABYLON;
          * Disposes of the gizmo
          */
         BoundingBoxGizmo.prototype.dispose = function () {
+            this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);
             this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);
             this._lineBoundingBox.dispose();
             this._rotateSpheresParent.dispose();
@@ -91273,6 +91296,7 @@ var BABYLON;
             _this._laserPointer.rotation.x = Math.PI / 2;
             _this._laserPointer.position.z = -0.5;
             _this._laserPointer.isVisible = false;
+            _this._laserPointer.isPickable = false;
             if (!webVRController.mesh) {
                 // Create an empty mesh that is used prior to loading the high quality model
                 var preloadMesh = new BABYLON.Mesh("preloadControllerMesh", scene);
@@ -91304,6 +91328,7 @@ var BABYLON;
         VRExperienceHelperControllerGazer.prototype._setLaserPointerParent = function (mesh) {
             var makeNotPick = function (root) {
                 root.name += " laserPointer";
+                root.isPickable = false;
                 root.getChildMeshes().forEach(function (c) {
                     makeNotPick(c);
                 });
@@ -101371,7 +101396,7 @@ var BABYLON;
          */
         EnvironmentHelper.prototype._setupGround = function (sceneSize) {
             var _this = this;
-            if (!this._ground) {
+            if (!this._ground || this._ground.isDisposed()) {
                 this._ground = BABYLON.Mesh.CreatePlane("BackgroundPlane", sceneSize.groundSize, this._scene);
                 this._ground.rotation.x = Math.PI / 2; // Face up by default.
                 this._ground.parent = this._rootMesh;
@@ -101458,7 +101483,7 @@ var BABYLON;
          */
         EnvironmentHelper.prototype._setupSkybox = function (sceneSize) {
             var _this = this;
-            if (!this._skybox) {
+            if (!this._skybox || this._skybox.isDisposed()) {
                 this._skybox = BABYLON.Mesh.CreateBox("BackgroundSkybox", sceneSize.skyboxSize, this._scene, undefined, BABYLON.Mesh.BACKSIDE);
                 this._skybox.onDisposeObservable.add(function () { _this._skybox = null; });
             }

+ 28 - 3
dist/preview release/babylon.no-module.max.js

@@ -88996,12 +88996,16 @@ var BABYLON;
             var _this = _super.call(this, gizmoLayer) || this;
             _this._boundingDimensions = new BABYLON.Vector3(1, 1, 1);
             _this._renderObserver = null;
+            _this._pointerObserver = null;
             // Do not update the gizmo's scale so it has a fixed size to the object its attached to
             _this._updateScale = false;
-            // Create Material
+            // Create Materials
             var coloredMaterial = new BABYLON.StandardMaterial("", gizmoLayer.utilityLayerScene);
             coloredMaterial.disableLighting = true;
             coloredMaterial.emissiveColor = color;
+            var hoverColoredMaterial = new BABYLON.StandardMaterial("", gizmoLayer.utilityLayerScene);
+            hoverColoredMaterial.disableLighting = true;
+            hoverColoredMaterial.emissiveColor = color.clone().add(new BABYLON.Color3(0.2, 0.2, 0.2));
             // Build bounding box out of lines
             _this._lineBoundingBox = new BABYLON.AbstractMesh("", gizmoLayer.utilityLayerScene);
             _this._lineBoundingBox.rotationQuaternion = new BABYLON.Quaternion();
@@ -89114,6 +89118,24 @@ var BABYLON;
                 }
             }
             _this._rootMesh.addChild(_this._scaleBoxesParent);
+            // Hover color change
+            var pointerIds = new Array();
+            _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo, eventState) {
+                if (!pointerIds[pointerInfo.event.pointerId]) {
+                    _this._rotateSpheresParent.getChildMeshes().concat(_this._scaleBoxesParent.getChildMeshes()).forEach(function (mesh) {
+                        if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {
+                            pointerIds[pointerInfo.event.pointerId] = mesh;
+                            mesh.material = hoverColoredMaterial;
+                        }
+                    });
+                }
+                else {
+                    if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[pointerInfo.event.pointerId]) {
+                        pointerIds[pointerInfo.event.pointerId].material = coloredMaterial;
+                        delete pointerIds[pointerInfo.event.pointerId];
+                    }
+                }
+            });
             // Update bounding box positions
             _this._renderObserver = _this.gizmoLayer.originalScene.onBeforeRenderObservable.add(function () {
                 _this._updateBoundingBox();
@@ -89183,6 +89205,7 @@ var BABYLON;
          * Disposes of the gizmo
          */
         BoundingBoxGizmo.prototype.dispose = function () {
+            this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);
             this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);
             this._lineBoundingBox.dispose();
             this._rotateSpheresParent.dispose();
@@ -91240,6 +91263,7 @@ var BABYLON;
             _this._laserPointer.rotation.x = Math.PI / 2;
             _this._laserPointer.position.z = -0.5;
             _this._laserPointer.isVisible = false;
+            _this._laserPointer.isPickable = false;
             if (!webVRController.mesh) {
                 // Create an empty mesh that is used prior to loading the high quality model
                 var preloadMesh = new BABYLON.Mesh("preloadControllerMesh", scene);
@@ -91271,6 +91295,7 @@ var BABYLON;
         VRExperienceHelperControllerGazer.prototype._setLaserPointerParent = function (mesh) {
             var makeNotPick = function (root) {
                 root.name += " laserPointer";
+                root.isPickable = false;
                 root.getChildMeshes().forEach(function (c) {
                     makeNotPick(c);
                 });
@@ -101338,7 +101363,7 @@ var BABYLON;
          */
         EnvironmentHelper.prototype._setupGround = function (sceneSize) {
             var _this = this;
-            if (!this._ground) {
+            if (!this._ground || this._ground.isDisposed()) {
                 this._ground = BABYLON.Mesh.CreatePlane("BackgroundPlane", sceneSize.groundSize, this._scene);
                 this._ground.rotation.x = Math.PI / 2; // Face up by default.
                 this._ground.parent = this._rootMesh;
@@ -101425,7 +101450,7 @@ var BABYLON;
          */
         EnvironmentHelper.prototype._setupSkybox = function (sceneSize) {
             var _this = this;
-            if (!this._skybox) {
+            if (!this._skybox || this._skybox.isDisposed()) {
                 this._skybox = BABYLON.Mesh.CreateBox("BackgroundSkybox", sceneSize.skyboxSize, this._scene, undefined, BABYLON.Mesh.BACKSIDE);
                 this._skybox.onDisposeObservable.add(function () { _this._skybox = null; });
             }

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


+ 28 - 3
dist/preview release/es6.js

@@ -88996,12 +88996,16 @@ var BABYLON;
             var _this = _super.call(this, gizmoLayer) || this;
             _this._boundingDimensions = new BABYLON.Vector3(1, 1, 1);
             _this._renderObserver = null;
+            _this._pointerObserver = null;
             // Do not update the gizmo's scale so it has a fixed size to the object its attached to
             _this._updateScale = false;
-            // Create Material
+            // Create Materials
             var coloredMaterial = new BABYLON.StandardMaterial("", gizmoLayer.utilityLayerScene);
             coloredMaterial.disableLighting = true;
             coloredMaterial.emissiveColor = color;
+            var hoverColoredMaterial = new BABYLON.StandardMaterial("", gizmoLayer.utilityLayerScene);
+            hoverColoredMaterial.disableLighting = true;
+            hoverColoredMaterial.emissiveColor = color.clone().add(new BABYLON.Color3(0.2, 0.2, 0.2));
             // Build bounding box out of lines
             _this._lineBoundingBox = new BABYLON.AbstractMesh("", gizmoLayer.utilityLayerScene);
             _this._lineBoundingBox.rotationQuaternion = new BABYLON.Quaternion();
@@ -89114,6 +89118,24 @@ var BABYLON;
                 }
             }
             _this._rootMesh.addChild(_this._scaleBoxesParent);
+            // Hover color change
+            var pointerIds = new Array();
+            _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo, eventState) {
+                if (!pointerIds[pointerInfo.event.pointerId]) {
+                    _this._rotateSpheresParent.getChildMeshes().concat(_this._scaleBoxesParent.getChildMeshes()).forEach(function (mesh) {
+                        if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {
+                            pointerIds[pointerInfo.event.pointerId] = mesh;
+                            mesh.material = hoverColoredMaterial;
+                        }
+                    });
+                }
+                else {
+                    if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[pointerInfo.event.pointerId]) {
+                        pointerIds[pointerInfo.event.pointerId].material = coloredMaterial;
+                        delete pointerIds[pointerInfo.event.pointerId];
+                    }
+                }
+            });
             // Update bounding box positions
             _this._renderObserver = _this.gizmoLayer.originalScene.onBeforeRenderObservable.add(function () {
                 _this._updateBoundingBox();
@@ -89183,6 +89205,7 @@ var BABYLON;
          * Disposes of the gizmo
          */
         BoundingBoxGizmo.prototype.dispose = function () {
+            this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);
             this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);
             this._lineBoundingBox.dispose();
             this._rotateSpheresParent.dispose();
@@ -91240,6 +91263,7 @@ var BABYLON;
             _this._laserPointer.rotation.x = Math.PI / 2;
             _this._laserPointer.position.z = -0.5;
             _this._laserPointer.isVisible = false;
+            _this._laserPointer.isPickable = false;
             if (!webVRController.mesh) {
                 // Create an empty mesh that is used prior to loading the high quality model
                 var preloadMesh = new BABYLON.Mesh("preloadControllerMesh", scene);
@@ -91271,6 +91295,7 @@ var BABYLON;
         VRExperienceHelperControllerGazer.prototype._setLaserPointerParent = function (mesh) {
             var makeNotPick = function (root) {
                 root.name += " laserPointer";
+                root.isPickable = false;
                 root.getChildMeshes().forEach(function (c) {
                     makeNotPick(c);
                 });
@@ -101338,7 +101363,7 @@ var BABYLON;
          */
         EnvironmentHelper.prototype._setupGround = function (sceneSize) {
             var _this = this;
-            if (!this._ground) {
+            if (!this._ground || this._ground.isDisposed()) {
                 this._ground = BABYLON.Mesh.CreatePlane("BackgroundPlane", sceneSize.groundSize, this._scene);
                 this._ground.rotation.x = Math.PI / 2; // Face up by default.
                 this._ground.parent = this._rootMesh;
@@ -101425,7 +101450,7 @@ var BABYLON;
          */
         EnvironmentHelper.prototype._setupSkybox = function (sceneSize) {
             var _this = this;
-            if (!this._skybox) {
+            if (!this._skybox || this._skybox.isDisposed()) {
                 this._skybox = BABYLON.Mesh.CreateBox("BackgroundSkybox", sceneSize.skyboxSize, this._scene, undefined, BABYLON.Mesh.BACKSIDE);
                 this._skybox.onDisposeObservable.add(function () { _this._skybox = null; });
             }

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


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