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