Skip to content

Commit

Permalink
refactor: optimized scene.constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoBinyong committed Nov 1, 2023
1 parent c2de504 commit 7ea81db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/dev/core/src/scene.ts
Expand Up @@ -1654,12 +1654,12 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
...options,
};

this._engine = engine || EngineStore.LastCreatedEngine;
if (!fullOptions.virtual) {
EngineStore._LastCreatedScene = this;
this._engine.scenes.push(this);
engine = this._engine = engine || EngineStore.LastCreatedEngine;
if (fullOptions.virtual) {
engine._virtualScenes.push(this);
} else {
this._engine._virtualScenes.push(this);
EngineStore._LastCreatedScene = this;
engine.scenes.push(this);
}

this._uid = null;
Expand Down Expand Up @@ -1692,7 +1692,7 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
this.useClonedMeshMap = fullOptions.useClonedMeshMap;

if (!options || !options.virtual) {
this._engine.onNewSceneAddedObservable.notifyObservers(this);
engine.onNewSceneAddedObservable.notifyObservers(this);
}
}

Expand Down

0 comments on commit 7ea81db

Please sign in to comment.