@combeenation/3d-viewer 5.0.1 → 5.0.3-beta2

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