Browse Source

Merge pull request #9149 from aWeirdo/patch-36

Update boundingBoxRenderer.ts
David Catuhe 4 năm trước cách đây
mục cha
commit
5031880f15

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

@@ -54,6 +54,7 @@
 - Allow cross-eye mode in photo and video dome ([#8897](https://github.com/BabylonJS/Babylon.js/issues/8897)) ([RaananW](https://github.com/RaananW))
 - Added noMipMap option to the photo dome construction process ([#8972](https://github.com/BabylonJS/Babylon.js/issues/8972)) ([RaananW](https://github.com/RaananW))
 - Add a `disableBoundingBoxesFromEffectLayer` property to the `EffectLayer` class to render the bounding boxes unaffected by the effect ([Popov72](https://github.com/Popov72))
+- Added `boundingBoxRenderer.onRessourcesReadyObservable` ([aWeirdo](https://github.com/aWeirdo))
 
 ### Engine
 

+ 7 - 0
src/Rendering/boundingBoxRenderer.ts

@@ -131,6 +131,11 @@ export class BoundingBoxRenderer implements ISceneComponent {
     public onAfterBoxRenderingObservable = new Observable<BoundingBox>();
 
     /**
+     * Observable raised after ressources are created
+     */
+    public onRessourcesReadyObservable = new Observable<BoundingBoxRenderer>();
+
+    /**
      * When false, no bounding boxes will be rendered
      */
     public enabled = true;
@@ -205,6 +210,7 @@ export class BoundingBoxRenderer implements ISceneComponent {
         this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(engine, <FloatArray>boxdata.positions, VertexBuffer.PositionKind, false);
         this._createIndexBuffer();
         this._fillIndexData = boxdata.indices;
+        this.onRessourcesReadyObservable.notifyObservers(this);
     }
 
     private _createIndexBuffer(): void {
@@ -352,6 +358,7 @@ export class BoundingBoxRenderer implements ISceneComponent {
 
         this.onBeforeBoxRenderingObservable.clear();
         this.onAfterBoxRenderingObservable.clear();
+        this.onRessourcesReadyObservable.clear();
 
         this.renderList.dispose();