@combeenation/3d-viewer 5.1.2 → 5.2.0-alpha4
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.
- package/README.md +111 -111
- package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-cjs/api/classes/animationInterface.js +2 -1
- package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-cjs/api/classes/dottedPath.js +166 -187
- package/dist/lib-cjs/api/classes/dottedPath.js.map +1 -1
- package/dist/lib-cjs/api/classes/element.d.ts +149 -149
- package/dist/lib-cjs/api/classes/element.js +668 -823
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/event.d.ts +326 -326
- package/dist/lib-cjs/api/classes/event.js +349 -371
- package/dist/lib-cjs/api/classes/event.js.map +1 -1
- package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-cjs/api/classes/eventBroadcaster.js +49 -53
- package/dist/lib-cjs/api/classes/eventBroadcaster.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameter.d.ts +336 -336
- package/dist/lib-cjs/api/classes/parameter.js +461 -471
- package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
- package/dist/lib-cjs/api/classes/parameterObservable.js +97 -101
- package/dist/lib-cjs/api/classes/parameterObservable.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-cjs/api/classes/parameterizable.js +102 -149
- package/dist/lib-cjs/api/classes/parameterizable.js.map +1 -1
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +45 -44
- package/dist/lib-cjs/api/classes/placementAnimation.js +175 -163
- package/dist/lib-cjs/api/classes/placementAnimation.js.map +1 -1
- package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
- package/dist/lib-cjs/api/classes/variant.js +836 -1203
- package/dist/lib-cjs/api/classes/variant.js.map +1 -1
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -45
- package/dist/lib-cjs/api/classes/variantInstance.js +101 -108
- package/dist/lib-cjs/api/classes/variantInstance.js.map +1 -1
- package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-cjs/api/classes/variantParameterizable.js +88 -99
- package/dist/lib-cjs/api/classes/variantParameterizable.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewer.d.ts +187 -184
- package/dist/lib-cjs/api/classes/viewer.js +593 -731
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
- package/dist/lib-cjs/api/classes/viewerLight.js +343 -392
- package/dist/lib-cjs/api/classes/viewerLight.js.map +1 -1
- package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
- package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
- package/dist/lib-cjs/api/internal/lensRendering.js.map +1 -1
- package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -13
- package/dist/lib-cjs/api/internal/sceneSetup.js +225 -238
- package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
- package/dist/lib-cjs/api/manager/animationManager.d.ts +30 -29
- package/dist/lib-cjs/api/manager/animationManager.js +126 -130
- package/dist/lib-cjs/api/manager/animationManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +65 -65
- package/dist/lib-cjs/api/manager/gltfExportManager.js +196 -223
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/sceneManager.d.ts +31 -31
- package/dist/lib-cjs/api/manager/sceneManager.js +127 -152
- package/dist/lib-cjs/api/manager/sceneManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +92 -92
- package/dist/lib-cjs/api/manager/variantInstanceManager.js +260 -335
- package/dist/lib-cjs/api/manager/variantInstanceManager.js.map +1 -1
- package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
- package/dist/lib-cjs/api/store/specStorage.js +50 -51
- package/dist/lib-cjs/api/store/specStorage.js.map +1 -1
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +174 -174
- package/dist/lib-cjs/api/util/babylonHelper.js +591 -611
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +366 -366
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -58
- package/dist/lib-cjs/api/util/resourceHelper.js +201 -257
- package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +35 -35
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js +141 -140
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/stringHelper.js +23 -25
- package/dist/lib-cjs/api/util/stringHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/structureHelper.js +48 -48
- package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +3 -3
- package/dist/lib-cjs/index.d.ts +51 -49
- package/dist/lib-cjs/index.js +110 -89
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-es6/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-es6/api/classes/animationInterface.js +1 -1
- package/dist/lib-es6/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-es6/api/classes/dottedPath.js +162 -184
- package/dist/lib-es6/api/classes/dottedPath.js.map +1 -1
- package/dist/lib-es6/api/classes/element.d.ts +149 -149
- package/dist/lib-es6/api/classes/element.js +664 -820
- package/dist/lib-es6/api/classes/element.js.map +1 -1
- package/dist/lib-es6/api/classes/event.d.ts +326 -326
- package/dist/lib-es6/api/classes/event.js +345 -368
- package/dist/lib-es6/api/classes/event.js.map +1 -1
- package/dist/lib-es6/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-es6/api/classes/eventBroadcaster.js +42 -50
- package/dist/lib-es6/api/classes/eventBroadcaster.js.map +1 -1
- package/dist/lib-es6/api/classes/parameter.d.ts +336 -336
- package/dist/lib-es6/api/classes/parameter.js +457 -468
- package/dist/lib-es6/api/classes/parameter.js.map +1 -1
- package/dist/lib-es6/api/classes/parameterObservable.d.ts +36 -36
- package/dist/lib-es6/api/classes/parameterObservable.js +93 -98
- package/dist/lib-es6/api/classes/parameterObservable.js.map +1 -1
- package/dist/lib-es6/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-es6/api/classes/parameterizable.js +98 -146
- package/dist/lib-es6/api/classes/parameterizable.js.map +1 -1
- package/dist/lib-es6/api/classes/placementAnimation.d.ts +45 -44
- package/dist/lib-es6/api/classes/placementAnimation.js +171 -160
- package/dist/lib-es6/api/classes/placementAnimation.js.map +1 -1
- package/dist/lib-es6/api/classes/variant.d.ts +234 -234
- package/dist/lib-es6/api/classes/variant.js +832 -1198
- package/dist/lib-es6/api/classes/variant.js.map +1 -1
- package/dist/lib-es6/api/classes/variantInstance.d.ts +45 -45
- package/dist/lib-es6/api/classes/variantInstance.js +97 -105
- package/dist/lib-es6/api/classes/variantInstance.js.map +1 -1
- package/dist/lib-es6/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-es6/api/classes/variantParameterizable.js +84 -96
- package/dist/lib-es6/api/classes/variantParameterizable.js.map +1 -1
- package/dist/lib-es6/api/classes/viewer.d.ts +187 -184
- package/dist/lib-es6/api/classes/viewer.js +586 -728
- package/dist/lib-es6/api/classes/viewer.js.map +1 -1
- package/dist/lib-es6/api/classes/viewerLight.d.ts +66 -66
- package/dist/lib-es6/api/classes/viewerLight.js +316 -389
- package/dist/lib-es6/api/classes/viewerLight.js.map +1 -1
- package/dist/lib-es6/api/internal/lensRendering.d.ts +8 -8
- package/dist/lib-es6/api/internal/lensRendering.js +8 -8
- package/dist/lib-es6/api/internal/lensRendering.js.map +1 -1
- package/dist/lib-es6/api/internal/sceneSetup.d.ts +13 -13
- package/dist/lib-es6/api/internal/sceneSetup.js +197 -233
- package/dist/lib-es6/api/internal/sceneSetup.js.map +1 -1
- package/dist/lib-es6/api/manager/animationManager.d.ts +30 -29
- package/dist/lib-es6/api/manager/animationManager.js +122 -127
- package/dist/lib-es6/api/manager/animationManager.js.map +1 -1
- package/dist/lib-es6/api/manager/gltfExportManager.d.ts +65 -65
- package/dist/lib-es6/api/manager/gltfExportManager.js +192 -220
- package/dist/lib-es6/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-es6/api/manager/sceneManager.d.ts +31 -31
- package/dist/lib-es6/api/manager/sceneManager.js +123 -149
- package/dist/lib-es6/api/manager/sceneManager.js.map +1 -1
- package/dist/lib-es6/api/manager/variantInstanceManager.d.ts +92 -92
- package/dist/lib-es6/api/manager/variantInstanceManager.js +256 -332
- package/dist/lib-es6/api/manager/variantInstanceManager.js.map +1 -1
- package/dist/lib-es6/api/store/specStorage.d.ts +24 -24
- package/dist/lib-es6/api/store/specStorage.js +46 -48
- package/dist/lib-es6/api/store/specStorage.js.map +1 -1
- package/dist/lib-es6/api/util/babylonHelper.d.ts +174 -174
- package/dist/lib-es6/api/util/babylonHelper.js +561 -581
- package/dist/lib-es6/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-es6/api/util/globalTypes.d.ts +366 -366
- package/dist/lib-es6/api/util/globalTypes.js +1 -1
- package/dist/lib-es6/api/util/resourceHelper.d.ts +58 -58
- package/dist/lib-es6/api/util/resourceHelper.js +191 -247
- package/dist/lib-es6/api/util/resourceHelper.js.map +1 -1
- package/dist/lib-es6/api/util/sceneLoaderHelper.d.ts +35 -35
- package/dist/lib-es6/api/util/sceneLoaderHelper.js +131 -133
- package/dist/lib-es6/api/util/sceneLoaderHelper.js.map +1 -1
- package/dist/lib-es6/api/util/stringHelper.d.ts +9 -9
- package/dist/lib-es6/api/util/stringHelper.js +19 -21
- package/dist/lib-es6/api/util/stringHelper.js.map +1 -1
- package/dist/lib-es6/api/util/structureHelper.d.ts +9 -9
- package/dist/lib-es6/api/util/structureHelper.js +45 -45
- package/dist/lib-es6/api/util/structureHelper.js.map +1 -1
- package/dist/lib-es6/buildinfo.json +3 -3
- package/dist/lib-es6/index.d.ts +51 -49
- package/dist/lib-es6/index.js +48 -50
- package/dist/lib-es6/index.js.map +1 -1
- package/dist/lib-full/lens-rendering.js +2 -0
- package/dist/lib-full/lens-rendering.js.map +1 -0
- package/dist/lib-full/main.js +3 -0
- package/dist/lib-full/main.js.LICENSE.txt +9 -0
- package/dist/lib-full/main.js.map +1 -0
- package/package.json +76 -88
- package/src/api/classes/animationInterface.ts +10 -10
- package/src/api/classes/dottedPath.ts +181 -181
- package/src/api/classes/element.ts +716 -716
- package/src/api/classes/event.ts +367 -367
- package/src/api/classes/eventBroadcaster.ts +52 -52
- package/src/api/classes/parameter.ts +494 -494
- package/src/api/classes/parameterObservable.ts +100 -100
- package/src/api/classes/parameterizable.ts +87 -87
- package/src/api/classes/placementAnimation.ts +161 -160
- package/src/api/classes/variant.ts +904 -905
- package/src/api/classes/variantInstance.ts +97 -97
- package/src/api/classes/variantParameterizable.ts +85 -85
- package/src/api/classes/viewer.ts +669 -668
- package/src/api/classes/viewerLight.ts +334 -334
- package/src/api/internal/debugViewer.ts +90 -90
- package/src/api/internal/lensRendering.ts +9 -10
- package/src/api/internal/sceneSetup.ts +204 -204
- package/src/api/manager/animationManager.ts +143 -142
- package/src/api/manager/gltfExportManager.ts +191 -191
- package/src/api/manager/sceneManager.ts +127 -127
- package/src/api/manager/variantInstanceManager.ts +265 -265
- package/src/api/store/specStorage.ts +51 -51
- package/src/api/util/babylonHelper.ts +663 -663
- package/src/api/util/globalTypes.ts +413 -413
- package/src/api/util/resourceHelper.ts +189 -189
- package/src/api/util/sceneLoaderHelper.ts +148 -147
- package/src/api/util/stringHelper.ts +23 -23
- package/src/api/util/structureHelper.ts +49 -49
- package/src/buildinfo.json +3 -3
- package/src/dev.ts +61 -64
- package/src/index.ts +96 -94
- package/src/types.d.ts +28 -28
- package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +0 -14
- package/dist/lib-cjs/api/classes/elementParameterizable.js +0 -135
- package/dist/lib-cjs/api/classes/elementParameterizable.js.map +0 -1
- package/dist/lib-cjs/api/internal/debugViewer.d.ts +0 -13
- package/dist/lib-cjs/api/internal/debugViewer.js +0 -87
- package/dist/lib-cjs/api/internal/debugViewer.js.map +0 -1
- package/dist/lib-es6/api/internal/debugViewer.d.ts +0 -13
- package/dist/lib-es6/api/internal/debugViewer.js +0 -84
- package/dist/lib-es6/api/internal/debugViewer.js.map +0 -1
- package/dist/webpack-stats.json +0 -0
- package/src/commonjs.tsconfig.json +0 -10
- package/src/declaration.tsconfig.json +0 -8
- package/src/es6.tsconfig.json +0 -10
- package/src/pagesconfig.json +0 -81
- package/src/tsconfig.json +0 -33
- package/src/tsconfig.types.json +0 -9
|
@@ -1,390 +1,317 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
})
|
|
188
|
-
]);
|
|
189
|
-
this._parameterObservers.set(Parameter.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return [3 /*break*/, 11];
|
|
318
|
-
case 8:
|
|
319
|
-
if (!parameters['direction']) {
|
|
320
|
-
throw new Error("The ViewerLight \"" + lightId + "\" of type \"" + definition.type + "\" needs a \"direction\".");
|
|
321
|
-
}
|
|
322
|
-
if (!parameters['angle']) {
|
|
323
|
-
throw new Error("A ViewerLight of type \"" + definition.type + "\" needs an \"angle\".");
|
|
324
|
-
}
|
|
325
|
-
if (!parameters['exponent']) {
|
|
326
|
-
throw new Error("The ViewerLight \"" + lightId + "\" of type \"" + definition.type + "\" needs an \"exponent\".");
|
|
327
|
-
}
|
|
328
|
-
return [4 /*yield*/, import(/* webpackChunkName: "spot-light" */ '@babylonjs/core/Lights/spotLight')];
|
|
329
|
-
case 9:
|
|
330
|
-
spotLightModule = _b.sent();
|
|
331
|
-
babylonLight = new spotLightModule.SpotLight(lightId, Vector3.Zero(), // position is set via parent TransformNode
|
|
332
|
-
parameters['direction'], parameters['angle'], parameters['exponent'], scene);
|
|
333
|
-
return [3 /*break*/, 11];
|
|
334
|
-
case 10: throw new Error("The type \"" + definition.type + "\" for ViewerLight \"" + lightId + "\" is not implemented (yet).");
|
|
335
|
-
case 11:
|
|
336
|
-
if (!babylonLight) {
|
|
337
|
-
throw new Error("The Light for ViewerLight \"" + lightId + "\" of type \"" + definition.type + "\" could no be created " + "or found.");
|
|
338
|
-
}
|
|
339
|
-
if (!babylonLight.parent) {
|
|
340
|
-
// Create pseudo parent since lights do not implement mutations like "rotation" by itself.
|
|
341
|
-
babylonLight.parent = new TransformNode('__light__', this.variant.viewer.scene, true);
|
|
342
|
-
}
|
|
343
|
-
injectNodeMetadata(babylonLight.parent, {
|
|
344
|
-
variant: this.variant,
|
|
345
|
-
variantParameterizable: this,
|
|
346
|
-
});
|
|
347
|
-
// disable/hide by default
|
|
348
|
-
disableNodeWithParents(babylonLight);
|
|
349
|
-
shadowGeneratorDefinition = get(definition, 'shadowGenerator');
|
|
350
|
-
if (!!isEmpty(shadowGeneratorDefinition)) return [3 /*break*/, 13];
|
|
351
|
-
if (!(babylonLight instanceof ShadowLight)) {
|
|
352
|
-
throw new Error("Using a ShadowGenerator with light type \"" + definition.type + "\" is not supported for " +
|
|
353
|
-
("\"" + lightId + "\". Use lights deriving from ShadowLight."));
|
|
354
|
-
}
|
|
355
|
-
return [4 /*yield*/, this.processShadowGenerator(babylonLight, shadowGeneratorDefinition)];
|
|
356
|
-
case 12:
|
|
357
|
-
_b.sent();
|
|
358
|
-
_b.label = 13;
|
|
359
|
-
case 13: return [2 /*return*/, babylonLight];
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
};
|
|
364
|
-
/**
|
|
365
|
-
* @param babylonLight
|
|
366
|
-
* @param definition
|
|
367
|
-
* @protected
|
|
368
|
-
*/
|
|
369
|
-
ViewerLight.prototype.processShadowGenerator = function (babylonLight, definition) {
|
|
370
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
371
|
-
var parameterDeclarations, parameterBag, parameters, shadowGenerator, parameter;
|
|
372
|
-
return __generator(this, function (_a) {
|
|
373
|
-
parameterDeclarations = {};
|
|
374
|
-
parameterBag = definition;
|
|
375
|
-
parameters = Parameter.parseFromDeclarations(parameterDeclarations, parameterBag);
|
|
376
|
-
shadowGenerator = new ShadowGenerator(parameters['mapSize'], babylonLight);
|
|
377
|
-
for (parameter in parameters) {
|
|
378
|
-
if (parameter === 'mapSize') {
|
|
379
|
-
continue;
|
|
380
|
-
}
|
|
381
|
-
set(shadowGenerator, parameter, get(parameters, parameter));
|
|
382
|
-
}
|
|
383
|
-
return [2 /*return*/, shadowGenerator];
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
};
|
|
387
|
-
return ViewerLight;
|
|
388
|
-
}(VariantParameterizable));
|
|
389
|
-
export { ViewerLight };
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { cloneNodeWithParents, disableNodeWithParents, enableNodeWithParents, getRootNode, injectNodeMetadata, transformTransformNode, } from './../util/babylonHelper';
|
|
11
|
+
import { DottedPath } from './dottedPath';
|
|
12
|
+
import { Parameter } from './parameter';
|
|
13
|
+
import { VariantParameterizable } from './variantParameterizable';
|
|
14
|
+
import { ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator';
|
|
15
|
+
import '@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent';
|
|
16
|
+
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight';
|
|
17
|
+
import { PointLight } from '@babylonjs/core/Lights/pointLight';
|
|
18
|
+
import { ShadowLight } from '@babylonjs/core/Lights/shadowLight';
|
|
19
|
+
import { Vector3 } from '@babylonjs/core/Maths/math.vector';
|
|
20
|
+
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
21
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_lights_punctual';
|
|
22
|
+
import { get, isEmpty, isString, set } from 'lodash-es';
|
|
23
|
+
/**
|
|
24
|
+
* A {@link ViewerLight} of a {@link Variant}. Acts as a container for BabylonJS lights. Lives only in the context of a
|
|
25
|
+
* {@link Variant}.
|
|
26
|
+
*/
|
|
27
|
+
export class ViewerLight extends VariantParameterizable {
|
|
28
|
+
/**
|
|
29
|
+
* Constructor.
|
|
30
|
+
*/
|
|
31
|
+
constructor(variant, name) {
|
|
32
|
+
super(variant, name);
|
|
33
|
+
this.variant = variant;
|
|
34
|
+
this.name = name;
|
|
35
|
+
this.addParameterObservers();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a {@link ViewerLight} with given name.
|
|
39
|
+
*/
|
|
40
|
+
static create(variant, name) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const viewerLight = new ViewerLight(variant, name);
|
|
43
|
+
viewerLight._light = yield viewerLight.createBabylonLightFromDefinition(viewerLight.definition);
|
|
44
|
+
return viewerLight;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The wrapped Light.
|
|
49
|
+
*/
|
|
50
|
+
get light() {
|
|
51
|
+
if (!this._light) {
|
|
52
|
+
throw new Error(`Light for ViewerLight "${this.name}" has not been properly initialized.`);
|
|
53
|
+
}
|
|
54
|
+
return this._light;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The {@link DottedPath} in the built tree of {@link ViewerLight}s.
|
|
58
|
+
* E.g. "_.top-1.sub-2.sub-sub-3.el-1"
|
|
59
|
+
*/
|
|
60
|
+
get dottedPath() {
|
|
61
|
+
return DottedPath.create(this.variant.dottedPath).addPart(this.name);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The id representing a {@link DottedPath}.
|
|
65
|
+
*/
|
|
66
|
+
get id() {
|
|
67
|
+
const dottedPath = DottedPath.create(this.dottedPath);
|
|
68
|
+
dottedPath.shiftPart(); // remove root
|
|
69
|
+
return dottedPath.path;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The {@link LightDefinition} of the {@link ViewerLight}.
|
|
73
|
+
*/
|
|
74
|
+
get definition() {
|
|
75
|
+
const definition = this.variant.structureJson.lights[this.name];
|
|
76
|
+
if (isString(definition)) {
|
|
77
|
+
return {
|
|
78
|
+
type: 'baked',
|
|
79
|
+
path: definition,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return definition;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The type of the {@link ViewerLight}'s light.
|
|
86
|
+
*/
|
|
87
|
+
get type() {
|
|
88
|
+
return this.light.constructor.name.replace(/light/i, '').toLowerCase();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @see {@link VariantParameterizable.commitParameters}
|
|
92
|
+
* @emit {@link Event.VIEWER_LIGHT_PARAMETER_COMMITTED}
|
|
93
|
+
*/
|
|
94
|
+
commitParameters(parameters) {
|
|
95
|
+
const _super = Object.create(null, {
|
|
96
|
+
commitParameters: { get: () => super.commitParameters }
|
|
97
|
+
});
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
return _super.commitParameters.call(this, parameters);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
|
|
104
|
+
*/
|
|
105
|
+
addParameterObservers() {
|
|
106
|
+
this._parameterObservers.set(Parameter.VISIBLE, [
|
|
107
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
let visible;
|
|
109
|
+
try {
|
|
110
|
+
visible = Parameter.parseBoolean(newValue);
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (visible === true) {
|
|
116
|
+
enableNodeWithParents(light.light);
|
|
117
|
+
}
|
|
118
|
+
else if (visible === false) {
|
|
119
|
+
disableNodeWithParents(light.light);
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
]);
|
|
123
|
+
this._parameterObservers.set(Parameter.INTENSITY, [
|
|
124
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
set(light.light, 'intensity', Parameter.parseNumber(newValue));
|
|
126
|
+
}),
|
|
127
|
+
]);
|
|
128
|
+
this._parameterObservers.set(Parameter.SCALING, [
|
|
129
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
// we have to deal just with root nodes here due to relative impacts in a node tree
|
|
131
|
+
const rootNode = getRootNode(light.light);
|
|
132
|
+
if (rootNode instanceof TransformNode) {
|
|
133
|
+
transformTransformNode(rootNode, {
|
|
134
|
+
scaling: Parameter.parseScaling(newValue),
|
|
135
|
+
position: Parameter.parseVector(light.inheritedParameters[Parameter.POSITION] || '(0, 0, 0)'),
|
|
136
|
+
rotation: Parameter.parseRotation(light.inheritedParameters[Parameter.ROTATION] || '(0, 0, 0)'),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
]);
|
|
141
|
+
this._parameterObservers.set(Parameter.POSITION, [
|
|
142
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
// we have to deal just with root nodes here due to relative impacts in a node tree
|
|
144
|
+
const rootNode = getRootNode(light.light);
|
|
145
|
+
if (rootNode instanceof TransformNode) {
|
|
146
|
+
transformTransformNode(rootNode, {
|
|
147
|
+
scaling: Parameter.parseVector(light.inheritedParameters[Parameter.SCALING] || '(1, 1, 1)'),
|
|
148
|
+
position: Parameter.parseVector(newValue),
|
|
149
|
+
rotation: Parameter.parseRotation(light.inheritedParameters[Parameter.ROTATION] || '(0, 0, 0)'),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}),
|
|
153
|
+
]);
|
|
154
|
+
this._parameterObservers.set(Parameter.ROTATION, [
|
|
155
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
// we have to deal just with root nodes here due to relative impacts in a node tree
|
|
157
|
+
const rootNode = getRootNode(light.light);
|
|
158
|
+
if (rootNode instanceof TransformNode) {
|
|
159
|
+
transformTransformNode(rootNode, {
|
|
160
|
+
scaling: Parameter.parseVector(light.inheritedParameters[Parameter.SCALING] || '(1, 1, 1)'),
|
|
161
|
+
position: Parameter.parseVector(light.inheritedParameters[Parameter.POSITION] || '(0, 0, 0)'),
|
|
162
|
+
rotation: Parameter.parseRotation(newValue),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
]);
|
|
167
|
+
this._parameterObservers.set(Parameter.DIRECTION, [
|
|
168
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
if ((light.light instanceof ShadowLight && !(light.light instanceof PointLight)) ||
|
|
170
|
+
light.light instanceof HemisphericLight) {
|
|
171
|
+
set(light.light, 'direction', Parameter.parseVector(newValue));
|
|
172
|
+
}
|
|
173
|
+
}),
|
|
174
|
+
]);
|
|
175
|
+
this._parameterObservers.set(Parameter.ANGLE, [
|
|
176
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
if (light.light.getClassName() === 'SpotLight') {
|
|
178
|
+
set(light.light, 'angle', Parameter.parseNumber(newValue));
|
|
179
|
+
}
|
|
180
|
+
}),
|
|
181
|
+
]);
|
|
182
|
+
this._parameterObservers.set(Parameter.EXPONENT, [
|
|
183
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
if (light.light.getClassName() === 'SpotLight') {
|
|
185
|
+
set(light.light, 'exponent', Parameter.parseNumber(newValue));
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
]);
|
|
189
|
+
this._parameterObservers.set(Parameter.DIFFUSE, [
|
|
190
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
set(light.light, 'diffuse', Parameter.parseColor(newValue));
|
|
192
|
+
}),
|
|
193
|
+
]);
|
|
194
|
+
this._parameterObservers.set(Parameter.SPECULAR, [
|
|
195
|
+
(light, oldValue, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
set(light.light, 'specular', Parameter.parseColor(newValue));
|
|
197
|
+
}),
|
|
198
|
+
]);
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @param definition
|
|
203
|
+
* @protected
|
|
204
|
+
*/
|
|
205
|
+
createBabylonLightFromDefinition(definition) {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
const parameters = Parameter.parseFromDeclarations(Parameter.declarations, this.inheritedParameters);
|
|
208
|
+
const scene = this.variant.viewer.scene;
|
|
209
|
+
let lightId = this.id;
|
|
210
|
+
let babylonLight;
|
|
211
|
+
switch (definition.type) {
|
|
212
|
+
case 'baked':
|
|
213
|
+
if (!definition['path']) {
|
|
214
|
+
throw new Error(`The light "${lightId}" of type "${definition.type}" needs a "path".`);
|
|
215
|
+
}
|
|
216
|
+
const bakedLight = this.variant.inheritedLights.find(l => l.metadata.dottedPath.path === definition['path']);
|
|
217
|
+
if (bakedLight) {
|
|
218
|
+
lightId = bakedLight.metadata.dottedPath.clone().unshiftPart(this.id).path;
|
|
219
|
+
babylonLight = cloneNodeWithParents(bakedLight);
|
|
220
|
+
babylonLight.name = lightId;
|
|
221
|
+
babylonLight.id = lightId;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
throw new Error(`No light found for path "${definition['path']}" in ViewerLight "${lightId}".`);
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
case 'hemispheric':
|
|
228
|
+
if (!parameters['direction']) {
|
|
229
|
+
throw new Error(`The ViewerLight "${lightId}" of type "${definition.type}" needs a "direction".`);
|
|
230
|
+
}
|
|
231
|
+
// @ts-ignore
|
|
232
|
+
const hemisphericLightModule = yield import(
|
|
233
|
+
/* webpackChunkName: "hemispheric-light" */ '@babylonjs/core/Lights/hemisphericLight');
|
|
234
|
+
babylonLight = new hemisphericLightModule.HemisphericLight(lightId, parameters['direction'], scene);
|
|
235
|
+
break;
|
|
236
|
+
case 'point':
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
const pointLightModule = yield import(
|
|
239
|
+
/* webpackChunkName: "point-light" */ '@babylonjs/core/Lights/pointLight');
|
|
240
|
+
babylonLight = new pointLightModule.PointLight(lightId, Vector3.Zero(), // position is set via parent TransformNode
|
|
241
|
+
scene);
|
|
242
|
+
break;
|
|
243
|
+
case 'directional':
|
|
244
|
+
if (!parameters['direction']) {
|
|
245
|
+
throw new Error(`The ViewerLight "${lightId}" of type "${definition.type}" needs a "direction".`);
|
|
246
|
+
}
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
const directionalLightModule = yield import(
|
|
249
|
+
/* webpackChunkName: "directional-light" */ '@babylonjs/core/Lights/directionalLight');
|
|
250
|
+
babylonLight = new directionalLightModule.DirectionalLight(lightId, parameters['direction'], scene);
|
|
251
|
+
break;
|
|
252
|
+
case 'spot':
|
|
253
|
+
if (!parameters['direction']) {
|
|
254
|
+
throw new Error(`The ViewerLight "${lightId}" of type "${definition.type}" needs a "direction".`);
|
|
255
|
+
}
|
|
256
|
+
if (!parameters['angle']) {
|
|
257
|
+
throw new Error(`A ViewerLight of type "${definition.type}" needs an "angle".`);
|
|
258
|
+
}
|
|
259
|
+
if (!parameters['exponent']) {
|
|
260
|
+
throw new Error(`The ViewerLight "${lightId}" of type "${definition.type}" needs an "exponent".`);
|
|
261
|
+
}
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
const spotLightModule = yield import(/* webpackChunkName: "spot-light" */ '@babylonjs/core/Lights/spotLight');
|
|
264
|
+
babylonLight = new spotLightModule.SpotLight(lightId, Vector3.Zero(), // position is set via parent TransformNode
|
|
265
|
+
parameters['direction'], parameters['angle'], parameters['exponent'], scene);
|
|
266
|
+
break;
|
|
267
|
+
default:
|
|
268
|
+
throw new Error(`The type "${definition.type}" for ViewerLight "${lightId}" is not implemented (yet).`);
|
|
269
|
+
}
|
|
270
|
+
if (!babylonLight) {
|
|
271
|
+
throw new Error(`The Light for ViewerLight "${lightId}" of type "${definition.type}" could no be created ` + `or found.`);
|
|
272
|
+
}
|
|
273
|
+
if (!babylonLight.parent) {
|
|
274
|
+
// Create pseudo parent since lights do not implement mutations like "rotation" by itself.
|
|
275
|
+
babylonLight.parent = new TransformNode('__light__', this.variant.viewer.scene, true);
|
|
276
|
+
}
|
|
277
|
+
injectNodeMetadata(babylonLight.parent, {
|
|
278
|
+
variant: this.variant,
|
|
279
|
+
variantParameterizable: this,
|
|
280
|
+
});
|
|
281
|
+
// disable/hide by default
|
|
282
|
+
disableNodeWithParents(babylonLight);
|
|
283
|
+
// process shadow generator
|
|
284
|
+
const shadowGeneratorDefinition = get(definition, 'shadowGenerator');
|
|
285
|
+
if (!isEmpty(shadowGeneratorDefinition)) {
|
|
286
|
+
if (!(babylonLight instanceof ShadowLight)) {
|
|
287
|
+
throw new Error(`Using a ShadowGenerator with light type "${definition.type}" is not supported for ` +
|
|
288
|
+
`"${lightId}". Use lights deriving from ShadowLight.`);
|
|
289
|
+
}
|
|
290
|
+
yield this.processShadowGenerator(babylonLight, shadowGeneratorDefinition);
|
|
291
|
+
}
|
|
292
|
+
return babylonLight;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @param babylonLight
|
|
297
|
+
* @param definition
|
|
298
|
+
* @protected
|
|
299
|
+
*/
|
|
300
|
+
processShadowGenerator(babylonLight, definition) {
|
|
301
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
302
|
+
const parameterDeclarations = {};
|
|
303
|
+
// define declarations here if needed in future
|
|
304
|
+
const parameterBag = definition;
|
|
305
|
+
const parameters = Parameter.parseFromDeclarations(parameterDeclarations, parameterBag);
|
|
306
|
+
const shadowGenerator = new ShadowGenerator(parameters['mapSize'], babylonLight);
|
|
307
|
+
for (const parameter in parameters) {
|
|
308
|
+
if (parameter === 'mapSize') {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
set(shadowGenerator, parameter, get(parameters, parameter));
|
|
312
|
+
}
|
|
313
|
+
return shadowGenerator;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
390
317
|
//# sourceMappingURL=viewerLight.js.map
|