globalState.ts 1.0 KB

123456789101112131415161718192021222324252627282930
  1. import { Observable } from 'babylonjs/Misc/observable';
  2. import { Scene } from 'babylonjs/scene';
  3. import { FilesInput } from 'babylonjs/Misc/filesInput';
  4. export class GlobalState {
  5. currentScene: Scene;
  6. onSceneLoaded = new Observable<{scene: Scene, filename: string}>();
  7. onError = new Observable<{scene?: Scene, message?: string}>();
  8. onEnvironmentChanged = new Observable<string>();
  9. onRequestClickInterceptor = new Observable<void>();
  10. onClickInterceptorClicked = new Observable<void>();
  11. glTFLoaderExtensions: { [key: string]: import("babylonjs-loaders/glTF/index").IGLTFLoaderExtension } = {};
  12. filesInput: FilesInput;
  13. isDebugLayerEnabled = false;
  14. public showDebugLayer() {
  15. this.isDebugLayerEnabled = true;
  16. if (this.currentScene) {
  17. this.currentScene.debugLayer.show();
  18. }
  19. }
  20. public hideDebugLayer() {
  21. this.isDebugLayerEnabled = false;
  22. if (this.currentScene) {
  23. this.currentScene.debugLayer.hide();
  24. }
  25. }
  26. }