Browse Source

Merge pull request #6428 from TrevorDev/gizmosMultipleScenesAndCameras

use custom utility layer in gizmo manager
David Catuhe 6 năm trước cách đây
mục cha
commit
1a12bb4dec
2 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 1 0
      dist/preview release/what's new.md
  2. 2 1
      src/Gizmos/gizmoManager.ts

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

@@ -52,5 +52,6 @@
 - Do not call onError when creating a texture when falling back to another loader ([TrevorDev](https://github.com/TrevorDev))
 - Context loss should not cause PBR materials to render black ([TrevorDev](https://github.com/TrevorDev))
 - Only cast pointer ray input when pointer is locked in webVR ([TrevorDev](https://github.com/TrevorDev))
+- Avoid using default utility layer in gizmo manager to support multiple scenes ([TrevorDev](https://github.com/TrevorDev))
 
 ## Breaking changes

+ 2 - 1
src/Gizmos/gizmoManager.ts

@@ -68,7 +68,7 @@ export class GizmoManager implements IDisposable {
     constructor(private scene: Scene) {
         this._defaultKeepDepthUtilityLayer = new UtilityLayerRenderer(scene);
         this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;
-        this._defaultUtilityLayer = UtilityLayerRenderer.DefaultUtilityLayer;
+        this._defaultUtilityLayer = new UtilityLayerRenderer(scene);
 
         this.gizmos = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null };
 
@@ -221,6 +221,7 @@ export class GizmoManager implements IDisposable {
             }
         }
         this._defaultKeepDepthUtilityLayer.dispose();
+        this._defaultUtilityLayer.dispose();
         this.boundingBoxDragBehavior.detach();
         this.onAttachedToMeshObservable.clear();
     }