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