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