瀏覽代碼

Added `Scene.constantlyUpdateMeshUnderPointer` to improve performance when moving mouse

David catuhe 10 年之前
父節點
當前提交
1277987c76

文件差異過大導致無法顯示
+ 650 - 649
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 16 - 15
dist/preview release/babylon.js


+ 2 - 2
dist/preview release/babylon.max.js

@@ -12560,6 +12560,7 @@ var BABYLON;
             this.forcePointsCloud = false;
             this.forceShowBoundingBoxes = false;
             this.animationsEnabled = true;
+            this.constantlyUpdateMeshUnderPointer = false;
             this.cameraToUseForPointers = null; // Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position
             // Fog
             /**
@@ -12857,7 +12858,7 @@ var BABYLON;
                 var canvas = _this._engine.getRenderingCanvas();
                 _this._updatePointerPosition(evt);
                 // Meshes
-                var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) { return mesh.isPickable && mesh.isVisible && mesh.isReady(); }, false, _this.cameraToUseForPointers);
+                var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) { return mesh.isPickable && mesh.isVisible && mesh.isReady() && (_this.constantlyUpdateMeshUnderPointer || mesh.actionManager !== null && mesh.actionManager !== undefined); }, false, _this.cameraToUseForPointers);
                 if (pickResult.hit && pickResult.pickedMesh) {
                     _this._meshUnderPointer = pickResult.pickedMesh;
                     _this.setPointerOverMesh(pickResult.pickedMesh);
@@ -19530,7 +19531,6 @@ var BABYLON;
                     }
                     else {
                         needNormals = true;
-                        needUVs = true;
                         this._defines.REFLECTION = true;
                         if (this.roughness > 0) {
                             this._defines.ROUGHNESS = true;

文件差異過大導致無法顯示
+ 16 - 15
dist/preview release/babylon.noworker.js


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

@@ -6,6 +6,7 @@
       - New .obj serializer ([BitOfGold](https://github.com/BitOfGold))
     - Sprites now can be [picked](http://www.babylonjs-playground.com/#1XMVZW#3) and can use [actions](http://www.babylonjs-playground.com/#9RUHH#3) ([deltakosh](https://github.com/deltakosh))
   - **Updates**
+    - Added `Scene.constantlyUpdateMeshUnderPointer` to improve performance when moving mouse ([deltakosh](https://github.com/deltakosh))
     - Added `StandardMaterial.disableLighting` ([deltakosh](https://github.com/deltakosh))
     - Improved reflection shader performance ([deltakosh](https://github.com/deltakosh))
     - New `Material.sideOrientation` property to define clockwise or counter-clockwise faces selection. [Demo here](http://www.babylonjs-playground.com/#1TZJQY) ([deltakosh](https://github.com/deltakosh))

+ 0 - 1
src/Materials/babylon.standardMaterial.js

@@ -239,7 +239,6 @@ var BABYLON;
                     }
                     else {
                         needNormals = true;
-                        needUVs = true;
                         this._defines.REFLECTION = true;
                         if (this.roughness > 0) {
                             this._defines.ROUGHNESS = true;

+ 0 - 1
src/Materials/babylon.standardMaterial.ts

@@ -282,7 +282,6 @@
                         return false;
                     } else {
                         needNormals = true;
-                        needUVs = true;
                         this._defines.REFLECTION = true;
 
                         if (this.roughness > 0) {

+ 2 - 1
src/babylon.scene.js

@@ -18,6 +18,7 @@ var BABYLON;
             this.forcePointsCloud = false;
             this.forceShowBoundingBoxes = false;
             this.animationsEnabled = true;
+            this.constantlyUpdateMeshUnderPointer = false;
             this.cameraToUseForPointers = null; // Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position
             // Fog
             /**
@@ -315,7 +316,7 @@ var BABYLON;
                 var canvas = _this._engine.getRenderingCanvas();
                 _this._updatePointerPosition(evt);
                 // Meshes
-                var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) { return mesh.isPickable && mesh.isVisible && mesh.isReady(); }, false, _this.cameraToUseForPointers);
+                var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) { return mesh.isPickable && mesh.isVisible && mesh.isReady() && (_this.constantlyUpdateMeshUnderPointer || mesh.actionManager !== null && mesh.actionManager !== undefined); }, false, _this.cameraToUseForPointers);
                 if (pickResult.hit && pickResult.pickedMesh) {
                     _this._meshUnderPointer = pickResult.pickedMesh;
                     _this.setPointerOverMesh(pickResult.pickedMesh);

+ 2 - 1
src/babylon.scene.ts

@@ -59,6 +59,7 @@
         public forceShowBoundingBoxes = false;
         public clipPlane: Plane;
         public animationsEnabled = true;
+        public constantlyUpdateMeshUnderPointer = false;
 
         // Pointers
         private _onPointerMove: (evt: PointerEvent) => void;
@@ -454,7 +455,7 @@
 
                 // Meshes
                 var pickResult = this.pick(this._pointerX, this._pointerY,
-                    (mesh: AbstractMesh): boolean => mesh.isPickable && mesh.isVisible && mesh.isReady(),
+                    (mesh: AbstractMesh): boolean => mesh.isPickable && mesh.isVisible && mesh.isReady() && (this.constantlyUpdateMeshUnderPointer || mesh.actionManager !== null && mesh.actionManager !== undefined),
                     false,
                     this.cameraToUseForPointers);