瀏覽代碼

Fix lens flares not working in right handed systems

Popov72 4 年之前
父節點
當前提交
bbf5d7164a
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 4 1
      src/LensFlares/lensFlareSystem.ts

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

@@ -72,6 +72,7 @@
 - Fix accessibility of BaseCameraMouseWheelInput and BaseCameraPointersInput. They appear in documentation but were not available for include. ([mrdunk](https://github.com/mrdunk))
 - Fix function creation inside regularly called freeCameraMouseWheelInput method leading to excessive GC load. ([mrdunk](https://github.com/mrdunk))
 - Fix clip plane not reset to the rigth value when using mirrors ([Popov72](https://github.com/Popov72))
+- Fix lens flares not working in right handed system ([Popov72](https://github.com/Popov72))
 
 ## Breaking changes
 

+ 4 - 1
src/LensFlares/lensFlareSystem.ts

@@ -196,7 +196,10 @@ export class LensFlareSystem {
             this._positionY += this.viewportBorder;
         }
 
-        if (position.z > 0) {
+        const rhs = this._scene.useRightHandedSystem;
+        const okZ = position.z > 0 && !rhs || position.z < 0 && rhs;
+
+        if (okZ) {
             if ((this._positionX > globalViewport.x) && (this._positionX < globalViewport.x + globalViewport.width)) {
                 if ((this._positionY > globalViewport.y) && (this._positionY < globalViewport.y + globalViewport.height)) {
                     return true;