소스 검색

Renove unnecessary Ray.Transform

David Catuhe 7 년 전
부모
커밋
baa64d2c97
3개의 변경된 파일2692개의 추가작업 그리고 2676개의 파일을 삭제
  1. 1338 1337
      dist/preview release/babylon.d.ts
  2. 1338 1337
      dist/preview release/babylon.module.d.ts
  3. 16 2
      src/babylon.scene.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1338 - 1337
dist/preview release/babylon.d.ts


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1338 - 1337
dist/preview release/babylon.module.d.ts


+ 16 - 2
src/babylon.scene.ts

@@ -4094,6 +4094,8 @@
             return this._internalPickSprites(ray, predicate, fastCheck, camera);
         }
 
+        private _cachedRayForTransform: Ray;
+
         /** Use the given ray to pick a mesh in the scene
          * @param ray The ray to use to pick meshes
          * @param predicate Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true
@@ -4105,7 +4107,13 @@
                     this._pickWithRayInverseMatrix = Matrix.Identity();
                 }
                 world.invertToRef(this._pickWithRayInverseMatrix);
-                return Ray.Transform(ray, this._pickWithRayInverseMatrix);
+
+                if (!this._cachedRayForTransform) {
+                    this._cachedRayForTransform = new Ray(Vector3.Zero(), Vector3.Zero());
+                }
+                
+                Ray.TransformToRef(ray, this._pickWithRayInverseMatrix, this._cachedRayForTransform);
+                return this._cachedRayForTransform;
             }, predicate, fastCheck);
         }
 
@@ -4131,7 +4139,13 @@
                     this._pickWithRayInverseMatrix = Matrix.Identity();
                 }
                 world.invertToRef(this._pickWithRayInverseMatrix);
-                return Ray.Transform(ray, this._pickWithRayInverseMatrix);
+
+                if (!this._cachedRayForTransform) {
+                    this._cachedRayForTransform = new Ray(Vector3.Zero(), Vector3.Zero());
+                }
+                
+                Ray.TransformToRef(ray, this._pickWithRayInverseMatrix, this._cachedRayForTransform);
+                return this._cachedRayForTransform;
             }, predicate);
         }