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