@combeenation/3d-viewer 6.1.0 → 6.2.0

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 (97) hide show
  1. package/README.md +111 -111
  2. package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
  3. package/dist/lib-cjs/api/classes/animationInterface.js +2 -2
  4. package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
  5. package/dist/lib-cjs/api/classes/dottedPath.js +166 -166
  6. package/dist/lib-cjs/api/classes/element.d.ts +149 -149
  7. package/dist/lib-cjs/api/classes/element.js +669 -669
  8. package/dist/lib-cjs/api/classes/event.d.ts +342 -342
  9. package/dist/lib-cjs/api/classes/event.js +365 -365
  10. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  11. package/dist/lib-cjs/api/classes/eventBroadcaster.js +49 -49
  12. package/dist/lib-cjs/api/classes/parameter.d.ts +339 -339
  13. package/dist/lib-cjs/api/classes/parameter.js +464 -464
  14. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  15. package/dist/lib-cjs/api/classes/parameterObservable.js +97 -97
  16. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
  17. package/dist/lib-cjs/api/classes/parameterizable.js +102 -102
  18. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +45 -45
  19. package/dist/lib-cjs/api/classes/placementAnimation.js +176 -176
  20. package/dist/lib-cjs/api/classes/variant.d.ts +238 -234
  21. package/dist/lib-cjs/api/classes/variant.js +841 -828
  22. package/dist/lib-cjs/api/classes/variant.js.map +1 -1
  23. package/dist/lib-cjs/api/classes/variantInstance.d.ts +44 -44
  24. package/dist/lib-cjs/api/classes/variantInstance.js +105 -105
  25. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
  26. package/dist/lib-cjs/api/classes/variantParameterizable.js +88 -88
  27. package/dist/lib-cjs/api/classes/viewer.d.ts +192 -187
  28. package/dist/lib-cjs/api/classes/viewer.js +639 -594
  29. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  30. package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
  31. package/dist/lib-cjs/api/classes/viewerLight.js +348 -348
  32. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  33. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  34. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -13
  35. package/dist/lib-cjs/api/internal/sceneSetup.js +226 -226
  36. package/dist/lib-cjs/api/manager/animationManager.d.ts +30 -30
  37. package/dist/lib-cjs/api/manager/animationManager.js +126 -126
  38. package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +78 -78
  39. package/dist/lib-cjs/api/manager/gltfExportManager.js +241 -241
  40. package/dist/lib-cjs/api/manager/sceneManager.d.ts +33 -33
  41. package/dist/lib-cjs/api/manager/sceneManager.js +130 -130
  42. package/dist/lib-cjs/api/manager/textureLoadManager.d.ts +22 -22
  43. package/dist/lib-cjs/api/manager/textureLoadManager.js +97 -97
  44. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +92 -92
  45. package/dist/lib-cjs/api/manager/variantInstanceManager.js +260 -260
  46. package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
  47. package/dist/lib-cjs/api/store/specStorage.js +50 -50
  48. package/dist/lib-cjs/api/util/babylonHelper.d.ts +187 -187
  49. package/dist/lib-cjs/api/util/babylonHelper.js +596 -596
  50. package/dist/lib-cjs/api/util/globalTypes.d.ts +387 -383
  51. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  52. package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -58
  53. package/dist/lib-cjs/api/util/resourceHelper.js +203 -203
  54. package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +42 -42
  55. package/dist/lib-cjs/api/util/sceneLoaderHelper.js +139 -139
  56. package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
  57. package/dist/lib-cjs/api/util/stringHelper.js +25 -25
  58. package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
  59. package/dist/lib-cjs/api/util/structureHelper.js +48 -48
  60. package/dist/lib-cjs/buildinfo.json +3 -3
  61. package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
  62. package/dist/lib-cjs/index.d.ts +51 -51
  63. package/dist/lib-cjs/index.js +110 -110
  64. package/package.json +81 -81
  65. package/src/api/classes/animationInterface.ts +10 -10
  66. package/src/api/classes/dottedPath.ts +181 -181
  67. package/src/api/classes/element.ts +717 -717
  68. package/src/api/classes/event.ts +385 -385
  69. package/src/api/classes/eventBroadcaster.ts +52 -52
  70. package/src/api/classes/parameter.ts +497 -497
  71. package/src/api/classes/parameterObservable.ts +100 -100
  72. package/src/api/classes/parameterizable.ts +87 -87
  73. package/src/api/classes/placementAnimation.ts +162 -162
  74. package/src/api/classes/variant.ts +910 -896
  75. package/src/api/classes/variantInstance.ts +97 -97
  76. package/src/api/classes/variantParameterizable.ts +85 -85
  77. package/src/api/classes/viewer.ts +720 -672
  78. package/src/api/classes/viewerLight.ts +339 -339
  79. package/src/api/internal/debugViewer.ts +90 -90
  80. package/src/api/internal/lensRendering.ts +9 -9
  81. package/src/api/internal/sceneSetup.ts +205 -205
  82. package/src/api/manager/animationManager.ts +143 -143
  83. package/src/api/manager/gltfExportManager.ts +236 -236
  84. package/src/api/manager/sceneManager.ts +132 -132
  85. package/src/api/manager/textureLoadManager.ts +95 -95
  86. package/src/api/manager/variantInstanceManager.ts +265 -265
  87. package/src/api/store/specStorage.ts +51 -51
  88. package/src/api/util/babylonHelper.ts +663 -663
  89. package/src/api/util/globalTypes.ts +437 -432
  90. package/src/api/util/resourceHelper.ts +191 -191
  91. package/src/api/util/sceneLoaderHelper.ts +137 -137
  92. package/src/api/util/stringHelper.ts +23 -23
  93. package/src/api/util/structureHelper.ts +49 -49
  94. package/src/buildinfo.json +3 -3
  95. package/src/dev.ts +61 -61
  96. package/src/index.ts +96 -96
  97. package/src/types.d.ts +28 -28
@@ -1,383 +1,387 @@
1
- /// <reference types="gsap" />
2
- declare type Viewer = import('../classes/viewer').Viewer;
3
- declare type Variant = import('../classes/variant').Variant;
4
- declare type VariantInstance = import('../classes/variantInstance').VariantInstance;
5
- /**
6
- * Alias for {@link Element} which can be used to prevent name clashes with the web APIs
7
- * [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) class
8
- */
9
- declare type VariantElement = import('../classes/element').Element;
10
- declare type DottedPath = import('../classes/dottedPath').DottedPath;
11
- declare type ViewerLight = import('../classes/viewerLight').ViewerLight;
12
- declare type SceneManager = import('../manager/sceneManager').SceneManager;
13
- declare type Scene = import('@babylonjs/core/scene').Scene;
14
- declare type Vector3 = import('@babylonjs/core/Maths/math.vector').Vector3;
15
- declare type Color3 = import('@babylonjs/core/Maths/math.color').Color3;
16
- declare type Color4 = import('@babylonjs/core/Maths/math.color').Color4;
17
- declare type Material = import('@babylonjs/core/Materials/material').Material;
18
- declare type PBRMaterial = import('@babylonjs/core/Materials/PBR/pbrMaterial').PBRMaterial;
19
- declare type StandardMaterial = import('@babylonjs/core/Materials/standardMaterial').StandardMaterial;
20
- declare type DynamicTexture = import('@babylonjs/core/Materials/Textures/dynamicTexture').DynamicTexture;
21
- declare type Mesh = import('@babylonjs/core/Meshes/mesh').Mesh;
22
- declare type AbstractMesh = import('@babylonjs/core/Meshes/abstractMesh').AbstractMesh;
23
- declare type InstancedMesh = import('@babylonjs/core/Meshes/instancedMesh').InstancedMesh;
24
- declare type TransformNode = import('@babylonjs/core/Meshes/transformNode').TransformNode;
25
- declare type Engine = import('@babylonjs/core/Engines/engine').Engine;
26
- declare type EngineOptions = import('@babylonjs/core/Engines/thinEngine').EngineOptions;
27
- declare type ArcRotateCamera = import('@babylonjs/core/Cameras/arcRotateCamera').ArcRotateCamera;
28
- declare type IScreenshotSize = import('@babylonjs/core/Misc/interfaces/screenshotSize').IScreenshotSize;
29
- declare type BabylonAnimation = import('@babylonjs/core/Animations/animation').Animation;
30
- declare type CubeTexture = import('@babylonjs/core/Materials/Textures/cubeTexture').CubeTexture;
31
- declare type MeshBuilder = typeof import('@babylonjs/core/Meshes/meshBuilder').MeshBuilder;
32
- declare type Texture = import('@babylonjs/core/Materials/Textures/texture').Texture;
33
- declare type HemisphericLight = import('@babylonjs/core/Lights/hemisphericLight').HemisphericLight;
34
- declare type DirectionalLight = import('@babylonjs/core/Lights/directionalLight').DirectionalLight;
35
- declare type IInspectorOptions = import('@babylonjs/core/Debug').IInspectorOptions;
36
- declare type IExportOptions = import('@babylonjs/serializers/glTF/2.0').IExportOptions;
37
- declare type EventEmitter = import('eventemitter3');
38
- declare type PathDefinitions = {
39
- include: string[];
40
- exclude?: string[];
41
- };
42
- declare type TraceableDefinition = {
43
- path: string;
44
- };
45
- declare type TraceableDefinitions = {
46
- [name: string]: TraceableDefinition;
47
- };
48
- declare type PaintableDefinition = {
49
- path: string;
50
- textureOptions: {
51
- width: number;
52
- height: number;
53
- } | number;
54
- };
55
- declare type PaintableDefinitions = {
56
- [name: string]: PaintableDefinition;
57
- };
58
- declare type Asset = {
59
- rootUrl: string;
60
- fileName: string | undefined;
61
- };
62
- declare type ElementDefinitions = {
63
- [name: string]: ElementDefinition | string[];
64
- };
65
- declare type ElementDefinition = {
66
- paths: PathDefinitions;
67
- traceables?: TraceableDefinitions;
68
- paintables?: PaintableDefinitions;
69
- };
70
- declare type TransformationDefinition = {
71
- scaling: Vector3;
72
- position: Vector3;
73
- rotation: Vector3;
74
- };
75
- declare type EnvironmentDefinition = {
76
- environmentColor?: Color3;
77
- environmentIntensity?: number;
78
- environment?: string;
79
- environmentBackground?: string;
80
- environmentRotation?: number;
81
- environmentUseDefault?: boolean;
82
- };
83
- declare type StructureJson = {
84
- /**
85
- * `scene` describes the visualisation of the Babylon `scene` such as the incidence of light and camera position. If a
86
- * string is given, the {@link Viewer} will resolve the URL or path and pass the parsed JSON to this property.
87
- */
88
- scene?: string | SceneJson;
89
- /**
90
- * `setup` is a kind of construction plan for the {@link Viewer}. You can pass a {@link SetupJson} or a string, which
91
- * must represent a valid URL or path. If a string is given, the {@link Viewer} will resolve the URL or path and pass
92
- * the parsed JSON to this property. The {@link SetupJson} is responsible for managing a list of
93
- * {@link VariantInstanceDefinition}s. These definitions define the instances that should be instantiated during the
94
- * bootstrapping process. Each instance has a name and a reference to it's {@link Variant}.
95
- */
96
- setup?: string | SetupJson;
97
- file?: string;
98
- glTF?: Asset | string;
99
- parameterDeclaration?: ParameterDeclarations;
100
- parameters?: ParameterBag;
101
- elements?: ElementDefinitions;
102
- lights?: LightDefinitions;
103
- grounds?: GroundDefinitions;
104
- /**
105
- * `variants` is a declarative description of 3D-model variations in the configurator. Each variant itself is a
106
- * {@link StructureJson} which must at least define a `name` in the key of the list and the properties `glTF` and
107
- * `elements` in the value. FYI: BabylonJS's sandbox can show you the path of the 3D-model to properly define the
108
- * `paths`.
109
- *
110
- * Example Code
111
- * ```js
112
- * variants: {
113
- * 'My Pretty Variant' {
114
- * glTF: {
115
- * rootUrl: 'https:/my.awesome.domain/path/to/my/project/',
116
- * fileName: 'my_3d_model_file.glb',
117
- * },
118
- * elements: {
119
- * 'My Little Element': {
120
- * paths: {
121
- * includes: ['__root__.MeshName']
122
- * }
123
- * }
124
- * }
125
- * }
126
- * }
127
- * ```
128
- * `MeshName` has to be identical to the path in the glb-file of the 3D-model.
129
- */
130
- variants?: {
131
- [id: string]: StructureJson;
132
- };
133
- };
134
- declare type SceneJson = {
135
- parameterDeclaration?: ParameterDeclarations;
136
- parameters?: ParameterBag;
137
- meshPicking?: boolean;
138
- /**
139
- * Information about [EngineOptions](https://doc.babylonjs.com/typedoc/interfaces/babylon.engineoptions).
140
- */
141
- engine?: {
142
- antialiasing?: boolean;
143
- options?: EngineOptions;
144
- };
145
- scene: SceneDefinition;
146
- animations?: AnimationDefinitions;
147
- placements?: PlacementDefinitions;
148
- /**
149
- * Information about [material cloning](pages/Release%20Notes/releases/4-3-0.html#material-cloning-on-mutation)
150
- */
151
- cloneMaterialsOnMutation?: boolean;
152
- };
153
- declare type SceneDefinition = {
154
- globals: SceneGlobals;
155
- cameras?: CameraDefinitions;
156
- };
157
- declare type SceneGlobals = {
158
- 'shadows'?: {
159
- enabled: boolean;
160
- type: 'contact';
161
- settings: [];
162
- generator: [];
163
- receiver: [];
164
- };
165
- /**
166
- * `aa` or anti aliasing is not needed if hard edges are desired.\
167
- * FYI: aa smooths edges and avoids stairs-effects.
168
- */
169
- 'aa'?: 'fxaa';
170
- 'tone-mapping'?: boolean;
171
- /**
172
- * @bloom is widely known as glow. There you can define it’s size (Specifies the size of the bloom blur kernel,
173
- * relative to the final output size) and threshold (The luminance threshold to find bright areas of the image to
174
- * bloom).
175
- * Further Information under [BloomEffect](https://doc.babylonjs.com/typedoc/classes/babylon.bloomeffect).
176
- *
177
- * @dof short for "depth-of-field" defines the focus in the view. Parameters in settings are listed in [Depth of Field and Other Lens Effects link](https://doc.babylonjs.com/divingDeeper/postProcesses/dofLenseEffects).
178
- * @exposure specifies the intensity of the lightning of the view (not 3D-Model).
179
- * @sharpen´s parameter `settings` are listed in [Default Rendering Pipeline Sharpening link](https://doc.babylonjs.com/divingDeeper/postProcesses/defaultRenderingPipeline#sharpening).
180
- */
181
- 'camera-settings'?: {
182
- contrast: number;
183
- exposure: number;
184
- bloom?: {
185
- enabled: boolean;
186
- size?: number;
187
- threshold?: number;
188
- };
189
- dof?: {
190
- enabled: boolean;
191
- settings: {};
192
- };
193
- sharpen?: {
194
- enabled: boolean;
195
- settings: {};
196
- };
197
- };
198
- };
199
- /**
200
- * {@link Viewer.screenshot} internally uses Babylons [ScreenshotTools.CreateScreenshotUsingRenderTarget](https://doc.babylonjs.com/typedoc/classes/babylon.screenshottools#createscreenshotusingrendertarget). \
201
- * See this link for additional info about the properties.
202
- */
203
- declare type ScreenshotSettings = {
204
- /** Defaults to canvas width & height */
205
- size?: IScreenshotSize;
206
- /**
207
- * Default `image/png`
208
- *
209
- * **Info regarding JPEG:** \
210
- * Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
211
- * Also ensure that {@link Scene.clearColor | viewer.scene.clearColor} has an alpha value of `1` as jpeg's don't
212
- * support transparency. Otherwise background will always be black for jpeg's.
213
- */
214
- mimeType?: string;
215
- /** Default `1` */
216
- samples?: number;
217
- /** Default `false` */
218
- antialiasing?: boolean;
219
- /** Default `screenshot.png` */
220
- fileName?: string;
221
- /** Default `false` */
222
- renderSprites?: boolean;
223
- };
224
- /**
225
- * Use this to define geometry to be excluded from autofocus, GLB export, etc.
226
- */
227
- declare type ExcludedGeometry = Mesh | AbstractMesh | VariantInstance | Variant | VariantElement | Node;
228
- declare type ExcludedGeometryList = ExcludedGeometry[];
229
- declare type AutofocusSettings = {
230
- /**
231
- * Can be used to customize the margins shown around the 3d model when calling {@link Viewer.autofocusActiveCamera}.\
232
- * Defaults to 1.5 when not set explicitly.
233
- */
234
- radiusFactor?: number;
235
- adjustWheelPrecision?: boolean;
236
- adjustPanningSensibility?: boolean;
237
- adjustPinchPrecision?: boolean;
238
- /** Desired horizontal camera angle, this won't be overwritten by the autofocus function */
239
- alpha?: number;
240
- /** Desired vertical camera angle, this won't be overwritten by the autofocus function */
241
- beta?: number;
242
- /** Optional animation for the focusing camera movement */
243
- animation?: string | AnimationDefinition;
244
- /** Optional list of geometry to be excluded from consideration */
245
- exclude?: ExcludedGeometryList;
246
- };
247
- declare type LightDefinitions = {
248
- [name: string]: LightDefinition | string;
249
- };
250
- declare type LightDefinition = {
251
- type: 'baked' | 'hemispheric' | 'point' | 'directional' | 'spot';
252
- path?: string;
253
- shadowGenerator?: ShadowGeneratorDefinition;
254
- };
255
- declare type ShadowGeneratorDefinition = {
256
- mapSize: number;
257
- [others: string]: any;
258
- };
259
- declare type GroundDefinitions = {
260
- [ground: string]: GroundDefinition;
261
- };
262
- declare type GroundDefinition = {
263
- type: 'baked' | 'ground' | 'heightmap';
264
- meshId?: string;
265
- url?: string;
266
- width?: number;
267
- height?: number;
268
- subdivisions?: number;
269
- receiveShadows?: boolean;
270
- minHeight?: number;
271
- maxHeight?: number;
272
- alphaFilter?: number;
273
- onReady?: any;
274
- };
275
- declare type CameraDefinitions = {
276
- [camera: string]: CameraDefinition;
277
- };
278
- declare type CameraDefinition = {
279
- /**
280
- * `fov` or "Field Of View" defines as it says the view of the scene. Further information about its [theory](https://en.wikipedia.org/wiki/Field_of_view) and [implementation](https://doc.babylonjs.com/typedoc/classes/babylon.camera#fov).
281
- */
282
- fov?: number;
283
- active?: boolean;
284
- /**
285
- * `arc` is a default camera position where the 3D-model is the center and the camera rotates around the 3D-model.
286
- * More Information about `arc` in [ArcRotateCamera](https://doc.babylonjs.com/typedoc/classes/babylon.arcrotatecamera).
287
- *
288
- * NOTE: While "baked" camera definitions from a GLB or babylon file can currently not be instatiated within the
289
- * `Specification`, it's still possible to use them in the viewer.\
290
- * For the moment all camera definitions inside these files are automatically added to the scene and can be actived
291
- * using the {@link Viewer.switchCamera} function.\
292
- * The `newCamera` input has to match the name of the camera node inside the GLB/babylon file.
293
- */
294
- type: 'arc';
295
- /**
296
- * `target` overrides `arc`´s position and repositions the camera. The string has the syntax (x?: number, y?: number, z?: number) like [Vector3](https://doc.babylonjs.com/typedoc/classes/babylon.vector3).
297
- */
298
- target?: string;
299
- };
300
- declare type VariantInstanceDefinition = {
301
- name?: string;
302
- variant: DottedPathArgument;
303
- parameters?: ParameterBag;
304
- lazy?: boolean;
305
- };
306
- declare type SetupJson = {
307
- instances: VariantInstanceDefinition[];
308
- };
309
- declare type ParameterDeclarations = {
310
- [name: string]: ParameterDeclaration;
311
- };
312
- declare type ParameterDeclaration = {
313
- type: 'string' | 'boolean' | 'number' | 'color' | 'select' | 'vector' | 'csl';
314
- parser?: any;
315
- options?: ParameterValue[];
316
- };
317
- declare type ParameterValue = string | number | boolean;
318
- declare type ParameterBag = {
319
- [name: string]: ParameterValue;
320
- };
321
- declare type ParsedParameterBag = {
322
- [name: string]: any;
323
- };
324
- declare type DottedPathArgument = string | string[] | DottedPath;
325
- declare type ParameterObserver = (object: any, oldValue: ParameterValue, newValue: ParameterValue) => void;
326
- declare type PlacementDefinitions = {
327
- [name: string]: PlacementDefinition;
328
- };
329
- declare type PlacementDefinition = {
330
- position?: string | Vector3;
331
- alpha?: number;
332
- beta?: number;
333
- radius?: number;
334
- target?: string | Vector3;
335
- };
336
- declare type AnimationDefinitions = {
337
- [name: string]: AnimationDefinition;
338
- };
339
- /**
340
- * See [GSAP API Docs](https://greensock.com/docs/v3/GSAP/Tween/vars) for description of `GSAPTWeenVars`.
341
- *
342
- * You can use the [GreenSock Ease Visualizer](https://greensock.com/ease-visualizer/) to create an animation of your
343
- * liking and simply copy the `ease` function shown at the bottom of the visualizer into the `ease` property of your
344
- * {@link AnimationDefinition}.
345
- *
346
- * The `GSAPTWeenVars` are extended by the `shortestWay` property.\
347
- * This property defines if the camera should move to the target position within the shortest possible distance.\
348
- * If `shortestWay` is `false`, the camera moves the whole difference between the current camera position and the target
349
- * position and that could be > 360, which can appear very unconvenient to the operator.\
350
- * The default value of this flag is `true`.
351
- *
352
- * Example usage in {@link SceneJson | SceneJson.animations}:
353
- *
354
- * ```js
355
- * // ...
356
- * scene: {
357
- * // ...
358
- * animations: {
359
- * DefaultCameraAnimation: {
360
- * ease: 'Power3.easeInOut',
361
- * duration: 0.8,
362
- * },
363
- * },
364
- * // ...
365
- * }
366
- * // ...
367
- * ```
368
- */
369
- declare type AnimationDefinition = GSAPTweenVars & {
370
- shortestWay?: boolean;
371
- };
372
- /**
373
- * Extends Babylon JSs {@link IExportOptions} by some viewer specific settings
374
- */
375
- interface IExportOptionsExtended extends IExportOptions {
376
- /**
377
- * In certain situations multiple meshes in the viewer scene have the same name (e.g. when cloning instances).\
378
- * If this option is set, the exporter adjusts all mesh names before export to have a unique name.\
379
- * This is required e.g. if the exported file is used to show an AR scene with the model viewer which requires all
380
- * meshes to have unique names.
381
- */
382
- createUniqueMeshNames?: boolean;
383
- }
1
+ /// <reference types="gsap" />
2
+ declare type Viewer = import('../classes/viewer').Viewer;
3
+ declare type Variant = import('../classes/variant').Variant;
4
+ declare type VariantInstance = import('../classes/variantInstance').VariantInstance;
5
+ /**
6
+ * Alias for {@link Element} which can be used to prevent name clashes with the web APIs
7
+ * [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) class
8
+ */
9
+ declare type VariantElement = import('../classes/element').Element;
10
+ declare type DottedPath = import('../classes/dottedPath').DottedPath;
11
+ declare type ViewerLight = import('../classes/viewerLight').ViewerLight;
12
+ declare type SceneManager = import('../manager/sceneManager').SceneManager;
13
+ declare type Scene = import('@babylonjs/core/scene').Scene;
14
+ declare type Vector3 = import('@babylonjs/core/Maths/math.vector').Vector3;
15
+ declare type Color3 = import('@babylonjs/core/Maths/math.color').Color3;
16
+ declare type Color4 = import('@babylonjs/core/Maths/math.color').Color4;
17
+ declare type Material = import('@babylonjs/core/Materials/material').Material;
18
+ declare type PBRMaterial = import('@babylonjs/core/Materials/PBR/pbrMaterial').PBRMaterial;
19
+ declare type StandardMaterial = import('@babylonjs/core/Materials/standardMaterial').StandardMaterial;
20
+ declare type DynamicTexture = import('@babylonjs/core/Materials/Textures/dynamicTexture').DynamicTexture;
21
+ declare type Mesh = import('@babylonjs/core/Meshes/mesh').Mesh;
22
+ declare type AbstractMesh = import('@babylonjs/core/Meshes/abstractMesh').AbstractMesh;
23
+ declare type InstancedMesh = import('@babylonjs/core/Meshes/instancedMesh').InstancedMesh;
24
+ declare type TransformNode = import('@babylonjs/core/Meshes/transformNode').TransformNode;
25
+ declare type Engine = import('@babylonjs/core/Engines/engine').Engine;
26
+ declare type EngineOptions = import('@babylonjs/core/Engines/thinEngine').EngineOptions;
27
+ declare type ArcRotateCamera = import('@babylonjs/core/Cameras/arcRotateCamera').ArcRotateCamera;
28
+ declare type IScreenshotSize = import('@babylonjs/core/Misc/interfaces/screenshotSize').IScreenshotSize;
29
+ declare type BabylonAnimation = import('@babylonjs/core/Animations/animation').Animation;
30
+ declare type CubeTexture = import('@babylonjs/core/Materials/Textures/cubeTexture').CubeTexture;
31
+ declare type MeshBuilder = typeof import('@babylonjs/core/Meshes/meshBuilder').MeshBuilder;
32
+ declare type Texture = import('@babylonjs/core/Materials/Textures/texture').Texture;
33
+ declare type HemisphericLight = import('@babylonjs/core/Lights/hemisphericLight').HemisphericLight;
34
+ declare type DirectionalLight = import('@babylonjs/core/Lights/directionalLight').DirectionalLight;
35
+ declare type IInspectorOptions = import('@babylonjs/core/Debug').IInspectorOptions;
36
+ declare type IExportOptions = import('@babylonjs/serializers/glTF/2.0').IExportOptions;
37
+ declare type EventEmitter = import('eventemitter3');
38
+ declare type PathDefinitions = {
39
+ include: string[];
40
+ exclude?: string[];
41
+ };
42
+ declare type TraceableDefinition = {
43
+ path: string;
44
+ };
45
+ declare type TraceableDefinitions = {
46
+ [name: string]: TraceableDefinition;
47
+ };
48
+ declare type PaintableDefinition = {
49
+ path: string;
50
+ textureOptions: {
51
+ width: number;
52
+ height: number;
53
+ } | number;
54
+ };
55
+ declare type PaintableDefinitions = {
56
+ [name: string]: PaintableDefinition;
57
+ };
58
+ declare type Asset = {
59
+ rootUrl: string;
60
+ fileName: string | undefined;
61
+ };
62
+ declare type ElementDefinitions = {
63
+ [name: string]: ElementDefinition | string[];
64
+ };
65
+ declare type ElementDefinition = {
66
+ paths: PathDefinitions;
67
+ traceables?: TraceableDefinitions;
68
+ paintables?: PaintableDefinitions;
69
+ };
70
+ declare type TransformationDefinition = {
71
+ scaling: Vector3;
72
+ position: Vector3;
73
+ rotation: Vector3;
74
+ };
75
+ declare type EnvironmentDefinition = {
76
+ environmentColor?: Color3;
77
+ environmentIntensity?: number;
78
+ environment?: string;
79
+ environmentBackground?: string;
80
+ environmentRotation?: number;
81
+ environmentUseDefault?: boolean;
82
+ };
83
+ declare type StructureJson = {
84
+ /**
85
+ * `scene` describes the visualisation of the Babylon `scene` such as the incidence of light and camera position. If a
86
+ * string is given, the {@link Viewer} will resolve the URL or path and pass the parsed JSON to this property.
87
+ */
88
+ scene?: string | SceneJson;
89
+ /**
90
+ * `setup` is a kind of construction plan for the {@link Viewer}. You can pass a {@link SetupJson} or a string, which
91
+ * must represent a valid URL or path. If a string is given, the {@link Viewer} will resolve the URL or path and pass
92
+ * the parsed JSON to this property. The {@link SetupJson} is responsible for managing a list of
93
+ * {@link VariantInstanceDefinition}s. These definitions define the instances that should be instantiated during the
94
+ * bootstrapping process. Each instance has a name and a reference to it's {@link Variant}.
95
+ */
96
+ setup?: string | SetupJson;
97
+ file?: string;
98
+ glTF?: Asset | string;
99
+ parameterDeclaration?: ParameterDeclarations;
100
+ parameters?: ParameterBag;
101
+ elements?: ElementDefinitions;
102
+ lights?: LightDefinitions;
103
+ grounds?: GroundDefinitions;
104
+ /**
105
+ * `variants` is a declarative description of 3D-model variations in the configurator. Each variant itself is a
106
+ * {@link StructureJson} which must at least define a `name` in the key of the list and the properties `glTF` and
107
+ * `elements` in the value. FYI: BabylonJS's sandbox can show you the path of the 3D-model to properly define the
108
+ * `paths`.
109
+ *
110
+ * Example Code
111
+ * ```js
112
+ * variants: {
113
+ * 'My Pretty Variant' {
114
+ * glTF: {
115
+ * rootUrl: 'https:/my.awesome.domain/path/to/my/project/',
116
+ * fileName: 'my_3d_model_file.glb',
117
+ * },
118
+ * elements: {
119
+ * 'My Little Element': {
120
+ * paths: {
121
+ * includes: ['__root__.MeshName']
122
+ * }
123
+ * }
124
+ * }
125
+ * }
126
+ * }
127
+ * ```
128
+ * `MeshName` has to be identical to the path in the glb-file of the 3D-model.
129
+ */
130
+ variants?: {
131
+ [id: string]: StructureJson;
132
+ };
133
+ };
134
+ declare type SceneJson = {
135
+ parameterDeclaration?: ParameterDeclarations;
136
+ parameters?: ParameterBag;
137
+ meshPicking?: boolean;
138
+ /**
139
+ * Information about [EngineOptions](https://doc.babylonjs.com/typedoc/interfaces/babylon.engineoptions).
140
+ */
141
+ engine?: {
142
+ antialiasing?: boolean;
143
+ options?: EngineOptions;
144
+ };
145
+ scene: SceneDefinition;
146
+ animations?: AnimationDefinitions;
147
+ placements?: PlacementDefinitions;
148
+ /**
149
+ * Information about [material cloning](pages/Release%20Notes/releases/4-3-0.html#material-cloning-on-mutation)
150
+ */
151
+ cloneMaterialsOnMutation?: boolean;
152
+ };
153
+ declare type SceneDefinition = {
154
+ globals: SceneGlobals;
155
+ cameras?: CameraDefinitions;
156
+ };
157
+ declare type SceneGlobals = {
158
+ 'shadows'?: {
159
+ enabled: boolean;
160
+ type: 'contact';
161
+ settings: [];
162
+ generator: [];
163
+ receiver: [];
164
+ };
165
+ /**
166
+ * `aa` or anti aliasing is not needed if hard edges are desired.\
167
+ * FYI: aa smooths edges and avoids stairs-effects.
168
+ */
169
+ 'aa'?: 'fxaa';
170
+ 'tone-mapping'?: boolean;
171
+ /**
172
+ * @bloom is widely known as glow. There you can define it’s size (Specifies the size of the bloom blur kernel,
173
+ * relative to the final output size) and threshold (The luminance threshold to find bright areas of the image to
174
+ * bloom).
175
+ * Further Information under [BloomEffect](https://doc.babylonjs.com/typedoc/classes/babylon.bloomeffect).
176
+ *
177
+ * @dof short for "depth-of-field" defines the focus in the view. Parameters in settings are listed in [Depth of Field and Other Lens Effects link](https://doc.babylonjs.com/divingDeeper/postProcesses/dofLenseEffects).
178
+ * @exposure specifies the intensity of the lightning of the view (not 3D-Model).
179
+ * @sharpen´s parameter `settings` are listed in [Default Rendering Pipeline Sharpening link](https://doc.babylonjs.com/divingDeeper/postProcesses/defaultRenderingPipeline#sharpening).
180
+ */
181
+ 'camera-settings'?: {
182
+ contrast: number;
183
+ exposure: number;
184
+ bloom?: {
185
+ enabled: boolean;
186
+ size?: number;
187
+ threshold?: number;
188
+ };
189
+ dof?: {
190
+ enabled: boolean;
191
+ settings: {};
192
+ };
193
+ sharpen?: {
194
+ enabled: boolean;
195
+ settings: {};
196
+ };
197
+ };
198
+ };
199
+ /**
200
+ * {@link Viewer.screenshot} internally uses Babylons [ScreenshotTools.CreateScreenshotUsingRenderTarget](https://doc.babylonjs.com/typedoc/classes/babylon.screenshottools#createscreenshotusingrendertarget). \
201
+ * See this link for additional info about the properties.
202
+ */
203
+ declare type ScreenshotSettings = {
204
+ /** Defaults to canvas width & height */
205
+ size?: IScreenshotSize;
206
+ /**
207
+ * Default `image/png`
208
+ *
209
+ * **Info regarding JPEG:** \
210
+ * Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
211
+ * Also ensure that {@link Scene.clearColor | viewer.scene.clearColor} has an alpha value of `1` as jpeg's don't
212
+ * support transparency. Otherwise background will always be black for jpeg's.
213
+ */
214
+ mimeType?: string;
215
+ /** Default `1` */
216
+ samples?: number;
217
+ /** Default `false` */
218
+ antialiasing?: boolean;
219
+ /** Default `screenshot.png` */
220
+ fileName?: string;
221
+ /** Default `false` */
222
+ renderSprites?: boolean;
223
+ };
224
+ /**
225
+ * Use this to define geometry to be excluded from autofocus, GLB export, etc.
226
+ */
227
+ declare type ExcludedGeometry = Mesh | AbstractMesh | VariantInstance | Variant | VariantElement | Node;
228
+ declare type ExcludedGeometryList = ExcludedGeometry[];
229
+ declare type AutofocusSettings = {
230
+ /**
231
+ * Can be used to customize the margins shown around the 3d model when calling {@link Viewer.autofocusActiveCamera}.\
232
+ * Defaults to 1.5 when not set explicitly.
233
+ */
234
+ radiusFactor?: number;
235
+ adjustWheelPrecision?: boolean;
236
+ adjustPanningSensibility?: boolean;
237
+ adjustPinchPrecision?: boolean;
238
+ /** Desired horizontal camera angle, this won't be overwritten by the autofocus function */
239
+ alpha?: number;
240
+ /** Desired vertical camera angle, this won't be overwritten by the autofocus function */
241
+ beta?: number;
242
+ /** Optional animation for the focusing camera movement */
243
+ animation?: string | AnimationDefinition;
244
+ /** Optional list of geometry to be excluded from consideration */
245
+ exclude?: ExcludedGeometryList;
246
+ };
247
+ declare type LightDefinitions = {
248
+ [name: string]: LightDefinition | string;
249
+ };
250
+ declare type LightDefinition = {
251
+ type: 'baked' | 'hemispheric' | 'point' | 'directional' | 'spot';
252
+ path?: string;
253
+ shadowGenerator?: ShadowGeneratorDefinition;
254
+ };
255
+ declare type ShadowGeneratorDefinition = {
256
+ mapSize: number;
257
+ [others: string]: any;
258
+ };
259
+ declare type GroundDefinitions = {
260
+ [ground: string]: GroundDefinition;
261
+ };
262
+ declare type GroundDefinition = {
263
+ type: 'baked' | 'ground' | 'heightmap';
264
+ meshId?: string;
265
+ url?: string;
266
+ width?: number;
267
+ height?: number;
268
+ subdivisions?: number;
269
+ receiveShadows?: boolean;
270
+ minHeight?: number;
271
+ maxHeight?: number;
272
+ alphaFilter?: number;
273
+ onReady?: any;
274
+ };
275
+ declare type CameraDefinitions = {
276
+ [camera: string]: CameraDefinition;
277
+ };
278
+ declare type CameraDefinition = {
279
+ /**
280
+ * `fov` or "Field Of View" defines as it says the view of the scene. Further information about its [theory](https://en.wikipedia.org/wiki/Field_of_view) and [implementation](https://doc.babylonjs.com/typedoc/classes/babylon.camera#fov).
281
+ */
282
+ fov?: number;
283
+ active?: boolean;
284
+ /**
285
+ * `arc` is a default camera position where the 3D-model is the center and the camera rotates around the 3D-model.
286
+ * More Information about `arc` in [ArcRotateCamera](https://doc.babylonjs.com/typedoc/classes/babylon.arcrotatecamera).
287
+ *
288
+ * NOTE: While "baked" camera definitions from a GLB or babylon file can currently not be instatiated within the
289
+ * `Specification`, it's still possible to use them in the viewer.\
290
+ * For the moment all camera definitions inside these files are automatically added to the scene and can be actived
291
+ * using the {@link Viewer.switchCamera} function.\
292
+ * The `newCamera` input has to match the name of the camera node inside the GLB/babylon file.
293
+ */
294
+ type: 'arc';
295
+ /**
296
+ * `target` overrides `arc`´s position and repositions the camera. The string has the syntax (x?: number, y?: number, z?: number) like [Vector3](https://doc.babylonjs.com/typedoc/classes/babylon.vector3).
297
+ */
298
+ target?: string;
299
+ };
300
+ declare type VariantInstanceDefinition = {
301
+ name?: string;
302
+ variant: DottedPathArgument;
303
+ parameters?: ParameterBag;
304
+ lazy?: boolean;
305
+ };
306
+ declare type SetupJson = {
307
+ instances: VariantInstanceDefinition[];
308
+ };
309
+ declare type ParameterDeclarations = {
310
+ [name: string]: ParameterDeclaration;
311
+ };
312
+ declare type ParameterDeclaration = {
313
+ type: 'string' | 'boolean' | 'number' | 'color' | 'select' | 'vector' | 'csl';
314
+ parser?: any;
315
+ options?: ParameterValue[];
316
+ };
317
+ declare type ParameterValue = string | number | boolean;
318
+ declare type ParameterBag = {
319
+ [name: string]: ParameterValue;
320
+ };
321
+ declare type ParsedParameterBag = {
322
+ [name: string]: any;
323
+ };
324
+ declare type DottedPathArgument = string | string[] | DottedPath;
325
+ declare type ParameterObserver = (object: any, oldValue: ParameterValue, newValue: ParameterValue) => void;
326
+ declare type PlacementDefinitions = {
327
+ [name: string]: PlacementDefinition;
328
+ };
329
+ declare type PlacementDefinition = {
330
+ position?: string | Vector3;
331
+ alpha?: number;
332
+ beta?: number;
333
+ radius?: number;
334
+ target?: string | Vector3;
335
+ };
336
+ declare type AnimationDefinitions = {
337
+ [name: string]: AnimationDefinition;
338
+ };
339
+ /**
340
+ * See [GSAP API Docs](https://greensock.com/docs/v3/GSAP/Tween/vars) for description of `GSAPTWeenVars`.
341
+ *
342
+ * You can use the [GreenSock Ease Visualizer](https://greensock.com/ease-visualizer/) to create an animation of your
343
+ * liking and simply copy the `ease` function shown at the bottom of the visualizer into the `ease` property of your
344
+ * {@link AnimationDefinition}.
345
+ *
346
+ * The `GSAPTWeenVars` are extended by the `shortestWay` property.\
347
+ * This property defines if the camera should move to the target position within the shortest possible distance.\
348
+ * If `shortestWay` is `false`, the camera moves the whole difference between the current camera position and the target
349
+ * position and that could be > 360, which can appear very unconvenient to the operator.\
350
+ * The default value of this flag is `true`.
351
+ *
352
+ * Example usage in {@link SceneJson | SceneJson.animations}:
353
+ *
354
+ * ```js
355
+ * // ...
356
+ * scene: {
357
+ * // ...
358
+ * animations: {
359
+ * DefaultCameraAnimation: {
360
+ * ease: 'Power3.easeInOut',
361
+ * duration: 0.8,
362
+ * },
363
+ * },
364
+ * // ...
365
+ * }
366
+ * // ...
367
+ * ```
368
+ */
369
+ declare type AnimationDefinition = GSAPTweenVars & {
370
+ shortestWay?: boolean;
371
+ };
372
+ /**
373
+ * Extends Babylon JSs {@link IExportOptions} by some viewer specific settings
374
+ */
375
+ interface IExportOptionsExtended extends IExportOptions {
376
+ /**
377
+ * In certain situations multiple meshes in the viewer scene have the same name (e.g. when cloning instances).\
378
+ * If this option is set, the exporter adjusts all mesh names before export to have a unique name.\
379
+ * This is required e.g. if the exported file is used to show an AR scene with the model viewer which requires all
380
+ * meshes to have unique names.
381
+ */
382
+ createUniqueMeshNames?: boolean;
383
+ }
384
+ declare type SpecGenerationData = {
385
+ name: string;
386
+ url: string;
387
+ };