@combeenation/3d-viewer 4.0.0-beta4 → 4.0.0-beta5

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