@babylonjs/viewer 7.21.3-alpha → 7.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/configuration/configuration.d.ts +107 -0
  2. package/configuration/configuration.js +16 -0
  3. package/configuration/configuration.js.map +1 -0
  4. package/configuration/configurationCompatibility.d.ts +8 -0
  5. package/configuration/configurationCompatibility.js +66 -0
  6. package/configuration/configurationCompatibility.js.map +1 -0
  7. package/configuration/configurationContainer.d.ts +10 -0
  8. package/configuration/configurationContainer.js +10 -0
  9. package/configuration/configurationContainer.js.map +1 -0
  10. package/configuration/globals.d.ts +6 -0
  11. package/configuration/globals.js +18 -0
  12. package/configuration/globals.js.map +1 -0
  13. package/configuration/index.d.ts +2 -0
  14. package/configuration/index.js +4 -0
  15. package/configuration/index.js.map +1 -0
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
  17. package/configuration/interfaces/cameraConfiguration.js +2 -0
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -0
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
  20. package/configuration/interfaces/colorGradingConfiguration.js +2 -0
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
  26. package/configuration/interfaces/environmentMapConfiguration.js +2 -0
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -0
  29. package/configuration/interfaces/groundConfiguration.js +2 -0
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -0
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
  32. package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
  34. package/configuration/interfaces/index.d.ts +15 -0
  35. package/configuration/interfaces/index.js +16 -0
  36. package/configuration/interfaces/index.js.map +1 -0
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -0
  38. package/configuration/interfaces/lightConfiguration.js +2 -0
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -0
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
  41. package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -0
  44. package/configuration/interfaces/modelConfiguration.js +2 -0
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -0
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -0
  47. package/configuration/interfaces/observersConfiguration.js +2 -0
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -0
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
  50. package/configuration/interfaces/sceneConfiguration.js +2 -0
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -0
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
  56. package/configuration/interfaces/skyboxConfiguration.js +2 -0
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -0
  59. package/configuration/interfaces/templateConfiguration.js +2 -0
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -0
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -0
  62. package/configuration/interfaces/vrConfiguration.js +2 -0
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -0
  64. package/configuration/loader.d.ts +4 -0
  65. package/configuration/loader.js +17 -0
  66. package/configuration/loader.js.map +1 -0
  67. package/configuration/mappers.d.ts +43 -0
  68. package/configuration/mappers.js +192 -0
  69. package/configuration/mappers.js.map +1 -0
  70. package/configuration/renderOnlyLoader.d.ts +33 -0
  71. package/configuration/renderOnlyLoader.js +162 -0
  72. package/configuration/renderOnlyLoader.js.map +1 -0
  73. package/configuration/types/default.d.ts +6 -0
  74. package/configuration/types/default.js +121 -0
  75. package/configuration/types/default.js.map +1 -0
  76. package/configuration/types/environmentMap.d.ts +5 -0
  77. package/configuration/types/environmentMap.js +14 -0
  78. package/configuration/types/environmentMap.js.map +1 -0
  79. package/configuration/types/extended.d.ts +6 -0
  80. package/configuration/types/extended.js +317 -0
  81. package/configuration/types/extended.js.map +1 -0
  82. package/configuration/types/index.d.ts +14 -0
  83. package/configuration/types/index.js +51 -0
  84. package/configuration/types/index.js.map +1 -0
  85. package/configuration/types/minimal.d.ts +6 -0
  86. package/configuration/types/minimal.js +43 -0
  87. package/configuration/types/minimal.js.map +1 -0
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -0
  89. package/configuration/types/renderOnlyDefault.js +31 -0
  90. package/configuration/types/renderOnlyDefault.js.map +1 -0
  91. package/configuration/types/shadowLight.d.ts +9 -0
  92. package/configuration/types/shadowLight.js +64 -0
  93. package/configuration/types/shadowLight.js.map +1 -0
  94. package/helper/index.d.ts +29 -0
  95. package/helper/index.js +66 -0
  96. package/helper/index.js.map +1 -0
  97. package/index.d.ts +30 -0
  98. package/index.js +46 -0
  99. package/index.js.map +1 -0
  100. package/initializer.d.ts +11 -0
  101. package/initializer.js +35 -0
  102. package/initializer.js.map +1 -0
  103. package/interfaces.d.ts +5 -0
  104. package/interfaces.js +7 -0
  105. package/interfaces.js.map +1 -0
  106. package/labs/environmentSerializer.d.ts +126 -0
  107. package/labs/environmentSerializer.js +191 -0
  108. package/labs/environmentSerializer.js.map +1 -0
  109. package/labs/texture.d.ts +183 -0
  110. package/labs/texture.js +351 -0
  111. package/labs/texture.js.map +1 -0
  112. package/labs/viewerLabs.d.ts +51 -0
  113. package/labs/viewerLabs.js +134 -0
  114. package/labs/viewerLabs.js.map +1 -0
  115. package/loader/modelLoader.d.ts +56 -0
  116. package/loader/modelLoader.js +199 -0
  117. package/loader/modelLoader.js.map +1 -0
  118. package/loader/plugins/applyMaterialConfig.d.ts +12 -0
  119. package/loader/plugins/applyMaterialConfig.js +16 -0
  120. package/loader/plugins/applyMaterialConfig.js.map +1 -0
  121. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
  122. package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
  124. package/loader/plugins/index.d.ts +19 -0
  125. package/loader/plugins/index.js +44 -0
  126. package/loader/plugins/index.js.map +1 -0
  127. package/loader/plugins/loaderPlugin.d.ts +24 -0
  128. package/loader/plugins/loaderPlugin.js +2 -0
  129. package/loader/plugins/loaderPlugin.js.map +1 -0
  130. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
  131. package/loader/plugins/msftLodLoaderPlugin.js +21 -0
  132. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
  133. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
  134. package/loader/plugins/telemetryLoaderPlugin.js +36 -0
  135. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
  136. package/managers/observablesManager.d.ts +66 -0
  137. package/managers/observablesManager.js +35 -0
  138. package/managers/observablesManager.js.map +1 -0
  139. package/managers/sceneManager.d.ts +245 -0
  140. package/managers/sceneManager.js +1375 -0
  141. package/managers/sceneManager.js.map +1 -0
  142. package/managers/telemetryManager.d.ts +78 -0
  143. package/managers/telemetryManager.js +117 -0
  144. package/managers/telemetryManager.js.map +1 -0
  145. package/model/modelAnimation.d.ts +215 -0
  146. package/model/modelAnimation.js +237 -0
  147. package/model/modelAnimation.js.map +1 -0
  148. package/model/viewerModel.d.ts +233 -0
  149. package/model/viewerModel.js +673 -0
  150. package/model/viewerModel.js.map +1 -0
  151. package/optimizer/custom/extended.d.ts +13 -0
  152. package/optimizer/custom/extended.js +101 -0
  153. package/optimizer/custom/extended.js.map +1 -0
  154. package/optimizer/custom/index.d.ts +9 -0
  155. package/optimizer/custom/index.js +26 -0
  156. package/optimizer/custom/index.js.map +1 -0
  157. package/package.json +29 -16
  158. package/readme.md +21 -35
  159. package/renderOnlyIndex.d.ts +11 -0
  160. package/renderOnlyIndex.js +18 -0
  161. package/renderOnlyIndex.js.map +1 -0
  162. package/templating/eventManager.d.ts +35 -0
  163. package/templating/eventManager.js +66 -0
  164. package/templating/eventManager.js.map +1 -0
  165. package/templating/plugins/hdButtonPlugin.d.ts +9 -0
  166. package/templating/plugins/hdButtonPlugin.js +21 -0
  167. package/templating/plugins/hdButtonPlugin.js.map +1 -0
  168. package/templating/plugins/printButton.d.ts +9 -0
  169. package/templating/plugins/printButton.js +40 -0
  170. package/templating/plugins/printButton.js.map +1 -0
  171. package/templating/templateManager.d.ts +197 -0
  172. package/templating/templateManager.js +561 -0
  173. package/templating/templateManager.js.map +1 -0
  174. package/templating/viewerTemplatePlugin.d.ts +21 -0
  175. package/templating/viewerTemplatePlugin.js +69 -0
  176. package/templating/viewerTemplatePlugin.js.map +1 -0
  177. package/viewer/defaultViewer.d.ts +130 -0
  178. package/viewer/defaultViewer.js +675 -0
  179. package/viewer/defaultViewer.js.map +1 -0
  180. package/viewer/renderOnlyViewer.d.ts +9 -0
  181. package/viewer/renderOnlyViewer.js +46 -0
  182. package/viewer/renderOnlyViewer.js.map +1 -0
  183. package/viewer/viewer.d.ts +258 -0
  184. package/viewer/viewer.js +783 -0
  185. package/viewer/viewer.js.map +1 -0
  186. package/viewer/viewerManager.d.ts +58 -0
  187. package/viewer/viewerManager.js +91 -0
  188. package/viewer/viewerManager.js.map +1 -0
  189. package/viewer/viewerWithTemplate.d.ts +9 -0
  190. package/viewer/viewerWithTemplate.js +20 -0
  191. package/viewer/viewerWithTemplate.js.map +1 -0
  192. package/dist/babylon-viewer.esm.js +0 -112505
  193. package/dist/babylon-viewer.esm.js.map +0 -1
  194. package/dist/babylon-viewer.esm.min.js +0 -2
  195. package/dist/babylon-viewer.esm.min.js.map +0 -1
  196. package/lib/index.d.ts +0 -132
  197. package/lib/index.js +0 -348
  198. package/lib/index.js.map +0 -1
package/lib/index.d.ts DELETED
@@ -1,132 +0,0 @@
1
- import { Nullable, AssetContainer, IDisposable, AbstractEngine, LoadAssetContainerOptions } from '@babylonjs/core/index.js';
2
- import { Color4 } from '@babylonjs/core/Maths/math.color.js';
3
- import { Scene } from '@babylonjs/core/scene.js';
4
- import { Nullable as Nullable$1 } from '@babylonjs/core/types.js';
5
- import { EngineOptions } from '@babylonjs/core/Engines.js';
6
-
7
- declare const defaultViewerOptions: {
8
- readonly backgroundColor: Color4;
9
- };
10
- type ViewerDetails = {
11
- /**
12
- * Provides access to the Scene managed by the Viewer.
13
- */
14
- scene: Scene;
15
- /**
16
- * Provides access to the currently loaded model.
17
- */
18
- model: Nullable<AssetContainer>;
19
- };
20
- type ViewerOptions = Partial<typeof defaultViewerOptions & Readonly<{
21
- /**
22
- * Called once when the viewer is initialized and provides viewer details that can be used for advanced customization.
23
- */
24
- onInitialized: (details: Readonly<ViewerDetails>) => void;
25
- }>>;
26
- /**
27
- * Provides an experience for viewing a single 3D model.
28
- * @remarks
29
- * The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
30
- * Includes (or will include) support for common model viewing requirements such as:
31
- * - Loading different model formats.
32
- * - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.
33
- * - Framing the loaded model in the camera's view.
34
- * - Setting up the environment, lighting, and tone mapping.
35
- * - Enumerating and playing (or auto playing) animations.
36
- * - Enumerating and switching between material variants.
37
- * - Full screen and XR modes.
38
- */
39
- declare class Viewer implements IDisposable {
40
- private readonly _engine;
41
- private readonly _details;
42
- private readonly _camera;
43
- private _skybox;
44
- private _isDisposed;
45
- private readonly _loadModelLock;
46
- private _loadModelAbortController;
47
- private readonly _loadEnvironmentLock;
48
- private _environment;
49
- private _loadEnvironmentAbortController;
50
- constructor(_engine: AbstractEngine, options?: ViewerOptions);
51
- /**
52
- * Loads a 3D model from the specified URL.
53
- * @remarks
54
- * If a model is already loaded, it will be unloaded before loading the new model.
55
- * @param source A url or File or ArrayBufferView that points to the model to load.
56
- * @param options The options to use when loading the model.
57
- * @param abortSignal An optional signal that can be used to abort the loading process.
58
- */
59
- loadModelAsync(source: string | File | ArrayBufferView, options?: LoadAssetContainerOptions, abortSignal?: AbortSignal): Promise<void>;
60
- /**
61
- * Loads an environment texture from the specified url and sets up a corresponding skybox.
62
- * @remarks
63
- * If no url is provided, a default hemispheric light will be created.
64
- * If an environment is already loaded, it will be unloaded before loading the new environment.
65
- * @param url The url of the environment texture to load.
66
- * @param abortSignal An optional signal that can be used to abort the loading process.
67
- */
68
- loadEnvironmentAsync(url: Nullable<string | undefined>, abortSignal?: AbortSignal): Promise<void>;
69
- /**
70
- * Disposes of the resources held by the Viewer.
71
- */
72
- dispose(): void;
73
- private _updateCamera;
74
- /**
75
- * Check for disposed or aborted state (basically everything that can interrupt an async operation).
76
- * @param abortSignals A set of optional AbortSignals to also check.
77
- */
78
- private _throwIfDisposedOrAborted;
79
- }
80
-
81
- /**
82
- * Represents a custom element that displays a 3D model using the Babylon.js Viewer.
83
- */
84
- declare class HTML3DElement extends HTMLElement {
85
- static readonly observedAttributes: readonly ["src", "env"];
86
- /**
87
- * Gets the underlying Viewer object.
88
- */
89
- readonly viewer: Viewer;
90
- /**
91
- * Creates an instance of HTML3DElement.
92
- */
93
- constructor();
94
- /**
95
- * Gets the model URL.
96
- */
97
- get src(): Nullable$1<string>;
98
- /**
99
- * Sets the model URL.
100
- */
101
- set src(value: Nullable$1<string>);
102
- /**
103
- * Called each time the element is added to the document.
104
- * @remarks
105
- * See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks
106
- */
107
- connectedCallback(): void;
108
- /**
109
- * Called when attributes are changed, added, removed, or replaced.
110
- * @remarks
111
- * See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks
112
- * @param name The name of the attribute that changed.
113
- * @param oldValue The old value of the attribute.
114
- * @param newValue The new value of the attribute.
115
- */
116
- attributeChangedCallback(name: (typeof HTML3DElement.observedAttributes)[number], oldValue: string, newValue: string): void;
117
- }
118
-
119
- type CanvasViewerOptions = ViewerOptions & ({
120
- engine: "WebGL";
121
- } & EngineOptions);
122
- /**
123
- * Creates a Viewer instance that is bound to an HTML canvas.
124
- * @remarks
125
- * This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
126
- * @param canvas The canvas element to bind the Viewer to.
127
- * @param options The options to use when creating the Viewer and binding it to the specified canvas.
128
- * @returns A Viewer instance that is bound to the specified canvas.
129
- */
130
- declare function createViewerForCanvas(canvas: HTMLCanvasElement, options?: CanvasViewerOptions): Viewer;
131
-
132
- export { HTML3DElement, Viewer, type ViewerDetails, type ViewerOptions, createViewerForCanvas };
package/lib/index.js DELETED
@@ -1,348 +0,0 @@
1
- import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera.js';
2
- import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight.js';
3
- import { loadAssetContainerAsync } from '@babylonjs/core/Loading/sceneLoader.js';
4
- import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial.js';
5
- import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';
6
- import { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
7
- import { Color4 } from '@babylonjs/core/Maths/math.color.js';
8
- import { Vector3 } from '@babylonjs/core/Maths/math.vector.js';
9
- import { CreateBox } from '@babylonjs/core/Meshes/Builders/boxBuilder.js';
10
- import { AsyncLock } from '@babylonjs/core/Misc/asyncLock.js';
11
- import { Scene } from '@babylonjs/core/scene.js';
12
- import '@babylonjs/core/Animations/animatable.js';
13
- import '@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js';
14
- import '@babylonjs/loaders/glTF/2.0/index.js';
15
- import { Logger } from '@babylonjs/core/Misc/logger.js';
16
- import { Engine } from '@babylonjs/core/Engines/engine.js';
17
-
18
- function createSkybox(scene, camera, environmentTexture, blur) {
19
- const hdrSkybox = CreateBox("hdrSkyBox", undefined, scene);
20
- const hdrSkyboxMaterial = new PBRMaterial("skyBox", scene);
21
- hdrSkyboxMaterial.backFaceCulling = false;
22
- hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();
23
- if (hdrSkyboxMaterial.reflectionTexture) {
24
- hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
25
- }
26
- hdrSkyboxMaterial.microSurface = 1.0 - blur;
27
- hdrSkyboxMaterial.disableLighting = true;
28
- hdrSkyboxMaterial.twoSidedLighting = true;
29
- hdrSkybox.material = hdrSkyboxMaterial;
30
- hdrSkybox.isPickable = false;
31
- hdrSkybox.infiniteDistance = true;
32
- hdrSkybox.ignoreCameraMaxZ = true;
33
- updateSkybox(hdrSkybox, camera);
34
- return hdrSkybox;
35
- }
36
- function updateSkybox(skybox, camera) {
37
- skybox?.scaling.setAll((camera.maxZ - camera.minZ) / 2);
38
- }
39
- const defaultViewerOptions = {
40
- backgroundColor: new Color4(0.1, 0.1, 0.2, 1.0),
41
- };
42
- /**
43
- * Provides an experience for viewing a single 3D model.
44
- * @remarks
45
- * The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
46
- * Includes (or will include) support for common model viewing requirements such as:
47
- * - Loading different model formats.
48
- * - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.
49
- * - Framing the loaded model in the camera's view.
50
- * - Setting up the environment, lighting, and tone mapping.
51
- * - Enumerating and playing (or auto playing) animations.
52
- * - Enumerating and switching between material variants.
53
- * - Full screen and XR modes.
54
- */
55
- class Viewer {
56
- constructor(_engine, options) {
57
- this._engine = _engine;
58
- this._skybox = null;
59
- this._isDisposed = false;
60
- this._loadModelLock = new AsyncLock();
61
- this._loadModelAbortController = null;
62
- this._loadEnvironmentLock = new AsyncLock();
63
- this._environment = null;
64
- this._loadEnvironmentAbortController = null;
65
- const finalOptions = { ...defaultViewerOptions, ...options };
66
- this._details = {
67
- scene: new Scene(this._engine),
68
- model: null,
69
- };
70
- this._details.scene.clearColor = finalOptions.backgroundColor;
71
- this._camera = new ArcRotateCamera("camera1", 0, 0, 1, Vector3.Zero(), this._details.scene);
72
- this._camera.attachControl();
73
- this._updateCamera(); // set default camera values
74
- // Load a default light, but ignore errors as the user might be immediately loading their own environment.
75
- this.loadEnvironmentAsync(undefined).catch(() => { });
76
- // TODO: render at least back ground. Maybe we can only run renderloop when a mesh is loaded. What to render until then?
77
- this._engine.runRenderLoop(() => {
78
- this._details.scene.render();
79
- });
80
- options?.onInitialized?.(this._details);
81
- }
82
- /**
83
- * Loads a 3D model from the specified URL.
84
- * @remarks
85
- * If a model is already loaded, it will be unloaded before loading the new model.
86
- * @param source A url or File or ArrayBufferView that points to the model to load.
87
- * @param options The options to use when loading the model.
88
- * @param abortSignal An optional signal that can be used to abort the loading process.
89
- */
90
- async loadModelAsync(source, options, abortSignal) {
91
- this._throwIfDisposedOrAborted(abortSignal);
92
- this._loadModelAbortController?.abort("New model is being loaded before previous model finished loading.");
93
- const abortController = (this._loadModelAbortController = new AbortController());
94
- await this._loadModelLock.lockAsync(async () => {
95
- this._throwIfDisposedOrAborted(abortSignal, abortController.signal);
96
- this._details.model?.dispose();
97
- this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);
98
- this._details.model.addAllToScene();
99
- this._updateCamera();
100
- });
101
- }
102
- /**
103
- * Loads an environment texture from the specified url and sets up a corresponding skybox.
104
- * @remarks
105
- * If no url is provided, a default hemispheric light will be created.
106
- * If an environment is already loaded, it will be unloaded before loading the new environment.
107
- * @param url The url of the environment texture to load.
108
- * @param abortSignal An optional signal that can be used to abort the loading process.
109
- */
110
- async loadEnvironmentAsync(url, abortSignal) {
111
- this._throwIfDisposedOrAborted(abortSignal);
112
- this._loadEnvironmentAbortController?.abort("New environment is being loaded before previous environment finished loading.");
113
- const abortController = (this._loadEnvironmentAbortController = new AbortController());
114
- await this._loadEnvironmentLock.lockAsync(async () => {
115
- this._throwIfDisposedOrAborted(abortSignal, abortController.signal);
116
- this._environment?.dispose();
117
- this._environment = await new Promise((resolve, reject) => {
118
- if (!url) {
119
- const light = new HemisphericLight("hemilight", Vector3.Up(), this._details.scene);
120
- this._details.scene.autoClear = true;
121
- resolve(light);
122
- }
123
- else {
124
- const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);
125
- this._details.scene.environmentTexture = cubeTexture;
126
- const skybox = createSkybox(this._details.scene, this._camera, cubeTexture, 0.3);
127
- this._skybox = skybox;
128
- this._details.scene.autoClear = false;
129
- const dispose = () => {
130
- cubeTexture.dispose();
131
- skybox.dispose();
132
- this._skybox = null;
133
- };
134
- const successObserver = cubeTexture.onLoadObservable.addOnce(() => {
135
- successObserver.remove();
136
- errorObserver.remove();
137
- resolve({
138
- dispose,
139
- });
140
- });
141
- const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {
142
- if (texture === cubeTexture) {
143
- successObserver.remove();
144
- errorObserver.remove();
145
- dispose();
146
- reject(new Error("Failed to load environment texture."));
147
- }
148
- });
149
- }
150
- });
151
- });
152
- }
153
- /**
154
- * Disposes of the resources held by the Viewer.
155
- */
156
- dispose() {
157
- this._details.scene.dispose();
158
- this._isDisposed = true;
159
- }
160
- // copy/paste from sandbox and scene helpers
161
- _updateCamera() {
162
- // Enable camera's behaviors
163
- this._camera.useFramingBehavior = true;
164
- const framingBehavior = this._camera.getBehaviorByName("Framing");
165
- framingBehavior.framingTime = 0;
166
- framingBehavior.elevationReturnTime = -1;
167
- let radius = 1;
168
- if (this._details.scene.meshes.length) {
169
- // get bounds and prepare framing/camera radius from its values
170
- this._camera.lowerRadiusLimit = null;
171
- const worldExtends = this._details.scene.getWorldExtends((mesh) => {
172
- return mesh.isVisible && mesh.isEnabled();
173
- });
174
- framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);
175
- const worldSize = worldExtends.max.subtract(worldExtends.min);
176
- const worldCenter = worldExtends.min.add(worldSize.scale(0.5));
177
- radius = worldSize.length() * 1.2;
178
- if (!isFinite(radius)) {
179
- radius = 1;
180
- worldCenter.copyFromFloats(0, 0, 0);
181
- }
182
- this._camera.setTarget(worldCenter);
183
- }
184
- this._camera.lowerRadiusLimit = radius * 0.01;
185
- this._camera.wheelPrecision = 100 / radius;
186
- this._camera.alpha = Math.PI / 2;
187
- this._camera.beta = Math.PI / 2;
188
- this._camera.radius = radius;
189
- this._camera.minZ = radius * 0.01;
190
- this._camera.maxZ = radius * 1000;
191
- this._camera.speed = radius * 0.2;
192
- this._camera.useAutoRotationBehavior = true;
193
- this._camera.pinchPrecision = 200 / this._camera.radius;
194
- this._camera.upperRadiusLimit = 5 * this._camera.radius;
195
- this._camera.wheelDeltaPercentage = 0.01;
196
- this._camera.pinchDeltaPercentage = 0.01;
197
- this._camera.restoreStateInterpolationFactor = 0.1;
198
- updateSkybox(this._skybox, this._camera);
199
- }
200
- /**
201
- * Check for disposed or aborted state (basically everything that can interrupt an async operation).
202
- * @param abortSignals A set of optional AbortSignals to also check.
203
- */
204
- _throwIfDisposedOrAborted(...abortSignals) {
205
- if (this._isDisposed) {
206
- throw new Error("Viewer is disposed.");
207
- }
208
- for (const signal of abortSignals) {
209
- signal?.throwIfAborted();
210
- }
211
- }
212
- }
213
-
214
- const defaultCanvasViewerOptions = {
215
- engine: "WebGL",
216
- };
217
- /**
218
- * Creates a Viewer instance that is bound to an HTML canvas.
219
- * @remarks
220
- * This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
221
- * @param canvas The canvas element to bind the Viewer to.
222
- * @param options The options to use when creating the Viewer and binding it to the specified canvas.
223
- * @returns A Viewer instance that is bound to the specified canvas.
224
- */
225
- function createViewerForCanvas(canvas, options) {
226
- const finalOptions = { ...defaultCanvasViewerOptions, ...options };
227
- const disposeActions = [];
228
- // If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.
229
- let needsResize = false;
230
- const resizeObserver = new ResizeObserver(() => (needsResize = true));
231
- resizeObserver.observe(canvas);
232
- disposeActions.push(() => resizeObserver.disconnect());
233
- // Create an engine instance.
234
- // TODO: Create a WebGL or WebGPUEngine based on the engine option.
235
- const engine = new Engine(canvas, undefined, options);
236
- // Override the onInitialized callback to add in some specific behavior.
237
- const onInitialized = finalOptions.onInitialized;
238
- finalOptions.onInitialized = (details) => {
239
- // Resize if needed right before rendering the Viewer scene to avoid any flickering.
240
- const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {
241
- if (needsResize) {
242
- engine.resize();
243
- needsResize = false;
244
- }
245
- });
246
- disposeActions.push(() => beforeRenderObserver.remove());
247
- // Call the original onInitialized callback, if one was provided.
248
- onInitialized?.(details);
249
- };
250
- // Instantiate the Viewer with the engine and options.
251
- const viewer = new Viewer(engine, finalOptions);
252
- disposeActions.push(viewer.dispose.bind(viewer));
253
- disposeActions.push(() => engine.dispose());
254
- // Override the Viewer's dispose method to add in additional cleanup.
255
- viewer.dispose = () => disposeActions.forEach((dispose) => dispose());
256
- // TODO: Creating an engine instance will be async if we use a dynamic import for choosing either Engine or WebGPUEngine,
257
- // or even when just creating a WebGPUEngine since we have to call initAsync. To keep the UI integration layer
258
- // simple (e.g. not have to deal with asynchronous creation of the Viewer), should we also be able to pass Promise<AbstractEngine> to the Viewer constructor?
259
- return viewer;
260
- }
261
-
262
- // TODO: Use https://lit.dev/ to simplify this code and ease maintenance.
263
- /**
264
- * Represents a custom element that displays a 3D model using the Babylon.js Viewer.
265
- */
266
- class HTML3DElement extends HTMLElement {
267
- /**
268
- * Creates an instance of HTML3DElement.
269
- */
270
- constructor() {
271
- super();
272
- const shadowRoot = this.attachShadow({ mode: "open" });
273
- shadowRoot.innerHTML = `
274
- <style>
275
- :host {
276
- display: block;
277
- width: 100%;
278
- height: 100%;
279
- }
280
-
281
- #container {
282
- display: block;
283
- width: 100%;
284
- height: 100%;
285
- }
286
-
287
- #renderCanvas {
288
- width: 100%;
289
- height: 100%;
290
- display: block;
291
- font-size: 0;
292
- }
293
- </style>
294
- <div id="container">
295
- <canvas id="renderCanvas" touch-action="none"></canvas>
296
- </div>
297
- `;
298
- const canvas = shadowRoot.querySelector("#renderCanvas");
299
- this.viewer = createViewerForCanvas(canvas);
300
- }
301
- /**
302
- * Gets the model URL.
303
- */
304
- get src() {
305
- return this.getAttribute("src");
306
- }
307
- /**
308
- * Sets the model URL.
309
- */
310
- set src(value) {
311
- if (value === null) {
312
- this.removeAttribute("src");
313
- }
314
- else {
315
- this.setAttribute("src", value);
316
- }
317
- }
318
- /**
319
- * Called each time the element is added to the document.
320
- * @remarks
321
- * See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks
322
- */
323
- connectedCallback() { }
324
- /**
325
- * Called when attributes are changed, added, removed, or replaced.
326
- * @remarks
327
- * See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks
328
- * @param name The name of the attribute that changed.
329
- * @param oldValue The old value of the attribute.
330
- * @param newValue The new value of the attribute.
331
- */
332
- attributeChangedCallback(name, oldValue, newValue) {
333
- switch (name) {
334
- case "src":
335
- this.viewer.loadModelAsync(newValue).catch(Logger.Log);
336
- break;
337
- case "env":
338
- this.viewer.loadEnvironmentAsync(newValue).catch(Logger.Log);
339
- break;
340
- }
341
- }
342
- }
343
- // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/naming-convention
344
- HTML3DElement.observedAttributes = Object.freeze(["src", "env"]);
345
- globalThis.customElements.define("babylon-viewer", HTML3DElement);
346
-
347
- export { HTML3DElement, Viewer, createViewerForCanvas };
348
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../../tools/viewer-alpha/src/viewer.ts","../../../../../../../../tools/viewer-alpha/src/viewerFactory.ts","../../../../../../../../tools/viewer-alpha/src/viewerElement.ts"],"sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { AbstractEngine, AssetContainer, Camera, FramingBehavior, IDisposable, LoadAssetContainerOptions, Mesh, Nullable } from \"core/index\";\r\n\r\nimport { ArcRotateCamera } from \"core/Cameras/arcRotateCamera\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { loadAssetContainerAsync } from \"core/Loading/sceneLoader\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport { CubeTexture } from \"core/Materials/Textures/cubeTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { AsyncLock } from \"core/Misc/asyncLock\";\r\nimport { Scene } from \"core/scene\";\r\n\r\n// TODO: Dynamic imports?\r\nimport \"core/Animations/animatable\";\r\nimport \"core/Materials/Textures/Loaders/envTextureLoader\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nimport \"loaders/glTF/2.0/index\";\r\n\r\nfunction createSkybox(scene: Scene, camera: Camera, environmentTexture: CubeTexture, blur: number): Mesh {\r\n const hdrSkybox = CreateBox(\"hdrSkyBox\", undefined, scene);\r\n const hdrSkyboxMaterial = new PBRMaterial(\"skyBox\", scene);\r\n hdrSkyboxMaterial.backFaceCulling = false;\r\n hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();\r\n if (hdrSkyboxMaterial.reflectionTexture) {\r\n hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;\r\n }\r\n hdrSkyboxMaterial.microSurface = 1.0 - blur;\r\n hdrSkyboxMaterial.disableLighting = true;\r\n hdrSkyboxMaterial.twoSidedLighting = true;\r\n hdrSkybox.material = hdrSkyboxMaterial;\r\n hdrSkybox.isPickable = false;\r\n hdrSkybox.infiniteDistance = true;\r\n hdrSkybox.ignoreCameraMaxZ = true;\r\n\r\n updateSkybox(hdrSkybox, camera);\r\n\r\n return hdrSkybox;\r\n}\r\n\r\nfunction updateSkybox(skybox: Nullable<Mesh>, camera: Camera): void {\r\n skybox?.scaling.setAll((camera.maxZ - camera.minZ) / 2);\r\n}\r\n\r\nconst defaultViewerOptions = {\r\n backgroundColor: new Color4(0.1, 0.1, 0.2, 1.0),\r\n} as const;\r\n\r\nexport type ViewerDetails = {\r\n /**\r\n * Provides access to the Scene managed by the Viewer.\r\n */\r\n scene: Scene;\r\n\r\n /**\r\n * Provides access to the currently loaded model.\r\n */\r\n model: Nullable<AssetContainer>;\r\n};\r\n\r\nexport type ViewerOptions = Partial<\r\n typeof defaultViewerOptions &\r\n Readonly<{\r\n /**\r\n * Called once when the viewer is initialized and provides viewer details that can be used for advanced customization.\r\n */\r\n onInitialized: (details: Readonly<ViewerDetails>) => void;\r\n }>\r\n>;\r\n\r\n/**\r\n * Provides an experience for viewing a single 3D model.\r\n * @remarks\r\n * The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.\r\n * Includes (or will include) support for common model viewing requirements such as:\r\n * - Loading different model formats.\r\n * - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.\r\n * - Framing the loaded model in the camera's view.\r\n * - Setting up the environment, lighting, and tone mapping.\r\n * - Enumerating and playing (or auto playing) animations.\r\n * - Enumerating and switching between material variants.\r\n * - Full screen and XR modes.\r\n */\r\nexport class Viewer implements IDisposable {\r\n private readonly _details: ViewerDetails;\r\n private readonly _camera: ArcRotateCamera;\r\n private _skybox: Nullable<Mesh> = null;\r\n\r\n private _isDisposed = false;\r\n\r\n private readonly _loadModelLock = new AsyncLock();\r\n private _loadModelAbortController: Nullable<AbortController> = null;\r\n\r\n private readonly _loadEnvironmentLock = new AsyncLock();\r\n private _environment: Nullable<IDisposable> = null;\r\n private _loadEnvironmentAbortController: Nullable<AbortController> = null;\r\n\r\n public constructor(\r\n private readonly _engine: AbstractEngine,\r\n options?: ViewerOptions\r\n ) {\r\n const finalOptions = { ...defaultViewerOptions, ...options };\r\n this._details = {\r\n scene: new Scene(this._engine),\r\n model: null,\r\n };\r\n this._details.scene.clearColor = finalOptions.backgroundColor;\r\n this._camera = new ArcRotateCamera(\"camera1\", 0, 0, 1, Vector3.Zero(), this._details.scene);\r\n this._camera.attachControl();\r\n this._updateCamera(); // set default camera values\r\n\r\n // Load a default light, but ignore errors as the user might be immediately loading their own environment.\r\n this.loadEnvironmentAsync(undefined).catch(() => {});\r\n\r\n // TODO: render at least back ground. Maybe we can only run renderloop when a mesh is loaded. What to render until then?\r\n this._engine.runRenderLoop(() => {\r\n this._details.scene.render();\r\n });\r\n\r\n options?.onInitialized?.(this._details);\r\n }\r\n\r\n /**\r\n * Loads a 3D model from the specified URL.\r\n * @remarks\r\n * If a model is already loaded, it will be unloaded before loading the new model.\r\n * @param source A url or File or ArrayBufferView that points to the model to load.\r\n * @param options The options to use when loading the model.\r\n * @param abortSignal An optional signal that can be used to abort the loading process.\r\n */\r\n public async loadModelAsync(source: string | File | ArrayBufferView, options?: LoadAssetContainerOptions, abortSignal?: AbortSignal): Promise<void> {\r\n this._throwIfDisposedOrAborted(abortSignal);\r\n\r\n this._loadModelAbortController?.abort(\"New model is being loaded before previous model finished loading.\");\r\n const abortController = (this._loadModelAbortController = new AbortController());\r\n\r\n await this._loadModelLock.lockAsync(async () => {\r\n this._throwIfDisposedOrAborted(abortSignal, abortController.signal);\r\n this._details.model?.dispose();\r\n this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);\r\n this._details.model.addAllToScene();\r\n this._updateCamera();\r\n });\r\n }\r\n\r\n /**\r\n * Loads an environment texture from the specified url and sets up a corresponding skybox.\r\n * @remarks\r\n * If no url is provided, a default hemispheric light will be created.\r\n * If an environment is already loaded, it will be unloaded before loading the new environment.\r\n * @param url The url of the environment texture to load.\r\n * @param abortSignal An optional signal that can be used to abort the loading process.\r\n */\r\n public async loadEnvironmentAsync(url: Nullable<string | undefined>, abortSignal?: AbortSignal): Promise<void> {\r\n this._throwIfDisposedOrAborted(abortSignal);\r\n\r\n this._loadEnvironmentAbortController?.abort(\"New environment is being loaded before previous environment finished loading.\");\r\n const abortController = (this._loadEnvironmentAbortController = new AbortController());\r\n\r\n await this._loadEnvironmentLock.lockAsync(async () => {\r\n this._throwIfDisposedOrAborted(abortSignal, abortController.signal);\r\n this._environment?.dispose();\r\n this._environment = await new Promise<IDisposable>((resolve, reject) => {\r\n if (!url) {\r\n const light = new HemisphericLight(\"hemilight\", Vector3.Up(), this._details.scene);\r\n this._details.scene.autoClear = true;\r\n resolve(light);\r\n } else {\r\n const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);\r\n this._details.scene.environmentTexture = cubeTexture;\r\n\r\n const skybox = createSkybox(this._details.scene, this._camera, cubeTexture, 0.3);\r\n this._skybox = skybox;\r\n\r\n this._details.scene.autoClear = false;\r\n\r\n const dispose = () => {\r\n cubeTexture.dispose();\r\n skybox.dispose();\r\n this._skybox = null;\r\n };\r\n\r\n const successObserver = cubeTexture.onLoadObservable.addOnce(() => {\r\n successObserver.remove();\r\n errorObserver.remove();\r\n resolve({\r\n dispose,\r\n });\r\n });\r\n\r\n const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {\r\n if (texture === cubeTexture) {\r\n successObserver.remove();\r\n errorObserver.remove();\r\n dispose();\r\n reject(new Error(\"Failed to load environment texture.\"));\r\n }\r\n });\r\n }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the resources held by the Viewer.\r\n */\r\n public dispose(): void {\r\n this._details.scene.dispose();\r\n this._isDisposed = true;\r\n }\r\n\r\n // copy/paste from sandbox and scene helpers\r\n private _updateCamera(): void {\r\n // Enable camera's behaviors\r\n this._camera.useFramingBehavior = true;\r\n const framingBehavior = this._camera.getBehaviorByName(\"Framing\") as FramingBehavior;\r\n framingBehavior.framingTime = 0;\r\n framingBehavior.elevationReturnTime = -1;\r\n\r\n let radius = 1;\r\n if (this._details.scene.meshes.length) {\r\n // get bounds and prepare framing/camera radius from its values\r\n this._camera.lowerRadiusLimit = null;\r\n\r\n const worldExtends = this._details.scene.getWorldExtends((mesh) => {\r\n return mesh.isVisible && mesh.isEnabled();\r\n });\r\n framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);\r\n\r\n const worldSize = worldExtends.max.subtract(worldExtends.min);\r\n const worldCenter = worldExtends.min.add(worldSize.scale(0.5));\r\n\r\n radius = worldSize.length() * 1.2;\r\n\r\n if (!isFinite(radius)) {\r\n radius = 1;\r\n worldCenter.copyFromFloats(0, 0, 0);\r\n }\r\n\r\n this._camera.setTarget(worldCenter);\r\n }\r\n this._camera.lowerRadiusLimit = radius * 0.01;\r\n this._camera.wheelPrecision = 100 / radius;\r\n this._camera.alpha = Math.PI / 2;\r\n this._camera.beta = Math.PI / 2;\r\n this._camera.radius = radius;\r\n this._camera.minZ = radius * 0.01;\r\n this._camera.maxZ = radius * 1000;\r\n this._camera.speed = radius * 0.2;\r\n this._camera.useAutoRotationBehavior = true;\r\n this._camera.pinchPrecision = 200 / this._camera.radius;\r\n this._camera.upperRadiusLimit = 5 * this._camera.radius;\r\n this._camera.wheelDeltaPercentage = 0.01;\r\n this._camera.pinchDeltaPercentage = 0.01;\r\n this._camera.restoreStateInterpolationFactor = 0.1;\r\n\r\n updateSkybox(this._skybox, this._camera);\r\n }\r\n\r\n /**\r\n * Check for disposed or aborted state (basically everything that can interrupt an async operation).\r\n * @param abortSignals A set of optional AbortSignals to also check.\r\n */\r\n private _throwIfDisposedOrAborted(...abortSignals: (Nullable<AbortSignal> | undefined)[]): void {\r\n if (this._isDisposed) {\r\n throw new Error(\"Viewer is disposed.\");\r\n }\r\n\r\n for (const signal of abortSignals) {\r\n signal?.throwIfAborted();\r\n }\r\n }\r\n}\r\n","import { Engine } from \"core/Engines/engine\";\r\nimport type { EngineOptions } from \"core/Engines\";\r\n\r\nimport type { ViewerOptions } from \"./viewer\";\r\nimport { Viewer } from \"./viewer\";\r\n\r\ntype CanvasViewerOptions = ViewerOptions & ({ engine: \"WebGL\" } & EngineOptions);\r\nconst defaultCanvasViewerOptions: CanvasViewerOptions = {\r\n engine: \"WebGL\",\r\n};\r\n\r\n/**\r\n * Creates a Viewer instance that is bound to an HTML canvas.\r\n * @remarks\r\n * This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).\r\n * @param canvas The canvas element to bind the Viewer to.\r\n * @param options The options to use when creating the Viewer and binding it to the specified canvas.\r\n * @returns A Viewer instance that is bound to the specified canvas.\r\n */\r\nexport function createViewerForCanvas(canvas: HTMLCanvasElement, options?: CanvasViewerOptions): Viewer {\r\n const finalOptions = { ...defaultCanvasViewerOptions, ...options };\r\n const disposeActions: (() => void)[] = [];\r\n\r\n // If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.\r\n let needsResize = false;\r\n const resizeObserver = new ResizeObserver(() => (needsResize = true));\r\n resizeObserver.observe(canvas);\r\n disposeActions.push(() => resizeObserver.disconnect());\r\n\r\n // Create an engine instance.\r\n // TODO: Create a WebGL or WebGPUEngine based on the engine option.\r\n const engine = new Engine(canvas, undefined, options);\r\n\r\n // Override the onInitialized callback to add in some specific behavior.\r\n const onInitialized = finalOptions.onInitialized;\r\n finalOptions.onInitialized = (details) => {\r\n // Resize if needed right before rendering the Viewer scene to avoid any flickering.\r\n const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {\r\n if (needsResize) {\r\n engine.resize();\r\n needsResize = false;\r\n }\r\n });\r\n disposeActions.push(() => beforeRenderObserver.remove());\r\n\r\n // Call the original onInitialized callback, if one was provided.\r\n onInitialized?.(details);\r\n };\r\n\r\n // Instantiate the Viewer with the engine and options.\r\n const viewer = new Viewer(engine, finalOptions);\r\n disposeActions.push(viewer.dispose.bind(viewer));\r\n\r\n disposeActions.push(() => engine.dispose());\r\n\r\n // Override the Viewer's dispose method to add in additional cleanup.\r\n viewer.dispose = () => disposeActions.forEach((dispose) => dispose());\r\n\r\n // TODO: Creating an engine instance will be async if we use a dynamic import for choosing either Engine or WebGPUEngine,\r\n // or even when just creating a WebGPUEngine since we have to call initAsync. To keep the UI integration layer\r\n // simple (e.g. not have to deal with asynchronous creation of the Viewer), should we also be able to pass Promise<AbstractEngine> to the Viewer constructor?\r\n\r\n return viewer;\r\n}\r\n","import { Logger } from \"core/Misc/logger\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Viewer } from \"./viewer\";\r\nimport { createViewerForCanvas } from \"./viewerFactory\";\r\n\r\n// TODO: Use https://lit.dev/ to simplify this code and ease maintenance.\r\n\r\n/**\r\n * Represents a custom element that displays a 3D model using the Babylon.js Viewer.\r\n */\r\nexport class HTML3DElement extends HTMLElement {\r\n // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/naming-convention\r\n public static readonly observedAttributes = Object.freeze([\"src\", \"env\"] as const);\r\n\r\n /**\r\n * Gets the underlying Viewer object.\r\n */\r\n public readonly viewer: Viewer;\r\n\r\n /**\r\n * Creates an instance of HTML3DElement.\r\n */\r\n public constructor() {\r\n super();\r\n\r\n const shadowRoot = this.attachShadow({ mode: \"open\" });\r\n shadowRoot.innerHTML = `\r\n <style>\r\n :host {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n #container {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n #renderCanvas {\r\n width: 100%;\r\n height: 100%;\r\n display: block;\r\n font-size: 0;\r\n }\r\n </style>\r\n <div id=\"container\">\r\n <canvas id=\"renderCanvas\" touch-action=\"none\"></canvas>\r\n </div>\r\n `;\r\n\r\n const canvas = shadowRoot.querySelector(\"#renderCanvas\") as HTMLCanvasElement;\r\n this.viewer = createViewerForCanvas(canvas);\r\n }\r\n\r\n /**\r\n * Gets the model URL.\r\n */\r\n public get src() {\r\n return this.getAttribute(\"src\");\r\n }\r\n\r\n /**\r\n * Sets the model URL.\r\n */\r\n public set src(value: Nullable<string>) {\r\n if (value === null) {\r\n this.removeAttribute(\"src\");\r\n } else {\r\n this.setAttribute(\"src\", value);\r\n }\r\n }\r\n\r\n /**\r\n * Called each time the element is added to the document.\r\n * @remarks\r\n * See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks\r\n */\r\n public connectedCallback() {}\r\n\r\n /**\r\n * Called when attributes are changed, added, removed, or replaced.\r\n * @remarks\r\n * See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks\r\n * @param name The name of the attribute that changed.\r\n * @param oldValue The old value of the attribute.\r\n * @param newValue The new value of the attribute.\r\n */\r\n public attributeChangedCallback(name: (typeof HTML3DElement.observedAttributes)[number], oldValue: string, newValue: string) {\r\n switch (name) {\r\n case \"src\":\r\n this.viewer.loadModelAsync(newValue).catch(Logger.Log);\r\n break;\r\n case \"env\":\r\n this.viewer.loadEnvironmentAsync(newValue).catch(Logger.Log);\r\n break;\r\n }\r\n }\r\n}\r\n\r\nglobalThis.customElements.define(\"babylon-viewer\", HTML3DElement);\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAqBA,SAAS,YAAY,CAAC,KAAY,EAAE,MAAc,EAAE,kBAA+B,EAAE,IAAY,EAAA;IAC7F,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC3D,IAAA,iBAAiB,CAAC,eAAe,GAAG,KAAK,CAAC;AAC1C,IAAA,iBAAiB,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,KAAK,EAAE,CAAC;IACjE,IAAI,iBAAiB,CAAC,iBAAiB,EAAE;QACrC,iBAAiB,CAAC,iBAAiB,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;AA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