globalState.ts 955 B

1234567891011121314151617181920212223242526272829
  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. filesInput: FilesInput;
  12. isDebugLayerEnabled = false;
  13. public showDebugLayer() {
  14. this.isDebugLayerEnabled = true;
  15. if (this.currentScene) {
  16. this.currentScene.debugLayer.show();
  17. }
  18. }
  19. public hideDebugLayer() {
  20. this.isDebugLayerEnabled = false;
  21. if (this.currentScene) {
  22. this.currentScene.debugLayer.hide();
  23. }
  24. }
  25. }