Browse Source

Merge pull request #9093 from Drigax/fix-skeleton-viewer-lighting

Fix black skeleton viewer meshes in sandbox
David Catuhe 4 năm trước cách đây
mục cha
commit
0ed09ea1dc
2 tập tin đã thay đổi với 11 bổ sung5 xóa
  1. 1 0
      dist/preview release/what's new.md
  2. 10 5
      src/Debug/skeletonViewer.ts

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

@@ -336,6 +336,7 @@
 - Fix exporting vertex color of mesh with `StandardMaterial` when exporting to glTF ([Drigax](https://github.com/drigax))
 - Changed use of mousemove to pointermove in freeCameraMouseInput and flyCameraMouseInput to fix issue with Firefox ([PolygonalSun](https://github.com/PolygonalSun))
 - Fixed `TriPlanarMaterial` to compute the right world normals ([julien-moreau](https://github.com/julien-moreau))
+- Fix `SkeletonViewer` to use utillity layer with custom lighting to improve debug mesh visibility ([Drigax](https://github.com/drigax))
 
 ## Breaking changes
 

+ 10 - 5
src/Debug/skeletonViewer.ts

@@ -558,6 +558,7 @@ export class SkeletonViewer {
     private _revert(animationState: boolean): void {
         if (this.options.pauseAnimations) {
             this.scene.animationsEnabled = animationState;
+            this.utilityLayer!.utilityLayerScene!.animationsEnabled = animationState;
         }
     }
 
@@ -583,16 +584,17 @@ export class SkeletonViewer {
         }
 
         this._ready = false;
-        let scene = this.scene;
+        let utilityLayerScene = this.utilityLayer?.utilityLayerScene!;
         let bones: Bone[] = this.skeleton.bones;
         let spheres: Array<[Mesh, Bone]> = [];
         let spurs: Mesh[] = [];
 
-        const animationState = scene.animationsEnabled;
+        const animationState = this.scene.animationsEnabled;
 
         try {
             if (this.options.pauseAnimations) {
-                scene.animationsEnabled = false;
+                this.scene.animationsEnabled = false;
+                utilityLayerScene.animationsEnabled = false;
             }
 
             if (this.options.returnToRest) {
@@ -665,7 +667,7 @@ export class SkeletonViewer {
                                 },
                         sideOrientation: Mesh.DEFAULTSIDE,
                         updatable: false
-                    },  scene);
+                    },  utilityLayerScene);
 
                     let numVertices = spur.getTotalVertices();
                     let mwk: number[] = [], mik: number[] = [];
@@ -698,7 +700,7 @@ export class SkeletonViewer {
                     segments: 6,
                     diameter: sphereBaseSize,
                     updatable: true
-                }, scene);
+                }, utilityLayerScene);
 
                 const numVertices = sphere.getTotalVertices();
 
@@ -744,6 +746,9 @@ export class SkeletonViewer {
                 this.debugMesh.alwaysSelectAsActiveMesh = true;
             }
 
+            const light = this.utilityLayer!._getSharedGizmoLight();
+            light.intensity = 0.7;
+
             this._revert(animationState);
             this.ready = true;
         } catch (err) {