@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.
- package/README.md +111 -114
- package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-cjs/api/classes/animationInterface.js +1 -1
- package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-cjs/api/classes/dottedPath.js +187 -187
- package/dist/lib-cjs/api/classes/element.d.ts +139 -139
- package/dist/lib-cjs/api/classes/element.js +794 -794
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -0
- package/dist/lib-cjs/api/classes/elementParameterizable.js +135 -0
- package/dist/lib-cjs/api/classes/elementParameterizable.js.map +1 -0
- package/dist/lib-cjs/api/classes/event.d.ts +326 -326
- package/dist/lib-cjs/api/classes/event.js +371 -371
- package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
- package/dist/lib-cjs/api/classes/parameter.d.ts +316 -259
- package/dist/lib-cjs/api/classes/parameter.js +451 -388
- 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 +101 -101
- package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +44 -44
- package/dist/lib-cjs/api/classes/placementAnimation.js +163 -163
- package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
- package/dist/lib-cjs/api/classes/variant.js +1154 -1154
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -45
- package/dist/lib-cjs/api/classes/variantInstance.js +108 -108
- package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-cjs/api/classes/variantParameterizable.js +99 -99
- package/dist/lib-cjs/api/classes/viewer.d.ts +177 -175
- package/dist/lib-cjs/api/classes/viewer.js +717 -701
- 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 +392 -392
- package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
- package/dist/lib-cjs/api/internal/debugViewer.js +86 -86
- 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/sceneSetup.d.ts +13 -10
- package/dist/lib-cjs/api/internal/sceneSetup.js +238 -234
- package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
- package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
- package/dist/lib-cjs/api/manager/animationManager.js +130 -130
- package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +65 -65
- package/dist/lib-cjs/api/manager/gltfExportManager.js +223 -222
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/sceneManager.d.ts +31 -32
- package/dist/lib-cjs/api/manager/sceneManager.js +153 -132
- 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 +335 -335
- package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
- package/dist/lib-cjs/api/store/specStorage.js +51 -51
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +174 -166
- package/dist/lib-cjs/api/util/babylonHelper.js +575 -497
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +366 -356
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -53
- package/dist/lib-cjs/api/util/resourceHelper.js +257 -242
- package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/stringHelper.js +25 -25
- package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/structureHelper.js +48 -44
- 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 +49 -49
- package/dist/lib-cjs/index.js +89 -89
- package/dist/webpack-stats.json +0 -0
- package/package.json +87 -87
- package/src/api/classes/animationInterface.ts +10 -10
- package/src/api/classes/dottedPath.ts +181 -181
- package/src/api/classes/element.ts +690 -692
- package/src/api/classes/event.ts +367 -367
- package/src/api/classes/eventBroadcaster.ts +52 -52
- package/src/api/classes/parameter.ts +474 -405
- package/src/api/classes/parameterObservable.ts +100 -100
- package/src/api/classes/parameterizable.ts +87 -87
- package/src/api/classes/placementAnimation.ts +160 -160
- package/src/api/classes/variant.ts +845 -845
- package/src/api/classes/variantInstance.ts +97 -97
- package/src/api/classes/variantParameterizable.ts +85 -85
- package/src/api/classes/viewer.ts +650 -624
- package/src/api/classes/viewerLight.ts +334 -334
- package/src/api/internal/debugViewer.ts +90 -90
- package/src/api/internal/lensRendering.ts +10 -10
- package/src/api/internal/sceneSetup.ts +204 -201
- package/src/api/manager/animationManager.ts +142 -142
- package/src/api/manager/gltfExportManager.ts +191 -191
- package/src/api/manager/sceneManager.ts +128 -102
- package/src/api/manager/variantInstanceManager.ts +265 -265
- package/src/api/store/specStorage.ts +51 -51
- package/src/api/util/babylonHelper.ts +628 -538
- package/src/api/util/globalTypes.ts +413 -402
- package/src/api/util/resourceHelper.ts +189 -173
- package/src/api/util/stringHelper.ts +23 -23
- package/src/api/util/structureHelper.ts +49 -43
- package/src/buildinfo.json +3 -3
- package/src/commonjs.tsconfig.json +10 -10
- package/src/declaration.tsconfig.json +8 -8
- package/src/dev.ts +42 -42
- package/src/es6.tsconfig.json +10 -10
- package/src/index.ts +94 -94
- package/src/pagesconfig.json +77 -73
- package/src/tsconfig.json +32 -32
- package/src/tsconfig.types.json +9 -9
- package/src/types.d.ts +3 -3
|
@@ -1,389 +1,452 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Parameter = void 0;
|
|
4
|
-
var math_color_1 = require("@babylonjs/core/Maths/math.color");
|
|
5
|
-
var math_vector_1 = require("@babylonjs/core/Maths/math.vector");
|
|
6
|
-
var lodash_es_1 = require("lodash-es");
|
|
7
|
-
/**
|
|
8
|
-
* This `Parameter` class defines all parameters that can be consumed and committed by a {@link ParameterObservable}.
|
|
9
|
-
* Use {@link ParameterObservable.addParameterObserver} or {@link ParameterObservable.commitParameters} to either add or
|
|
10
|
-
* commit parameters on your observable objects.
|
|
11
|
-
*/
|
|
12
|
-
var Parameter = /** @class */ (function () {
|
|
13
|
-
/**
|
|
14
|
-
* Constructor.
|
|
15
|
-
*/
|
|
16
|
-
function Parameter() {
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(Parameter, "declarations", {
|
|
19
|
-
/**
|
|
20
|
-
* The {@link ParameterDeclarations} for all parameters in this class.
|
|
21
|
-
*/
|
|
22
|
-
get: function () {
|
|
23
|
-
var declarations = {};
|
|
24
|
-
declarations[Parameter.VISIBLE] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
25
|
-
declarations[Parameter.SCALING] = { type: 'number', parser: Parameter.parseNumber };
|
|
26
|
-
declarations[Parameter.POSITION] = { type: 'vector', parser: Parameter.parseVector };
|
|
27
|
-
declarations[Parameter.ROTATION] = { type: 'vector', parser: Parameter.parseVector };
|
|
28
|
-
declarations[Parameter.HIGHLIGHTED] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
29
|
-
declarations[Parameter.MATERIAL] = { type: 'string' };
|
|
30
|
-
declarations[Parameter.MATERIAL_COLOR] = { type: 'color', parser: Parameter.parseColor };
|
|
31
|
-
declarations[Parameter.MATERIAL_METALLNESS] = { type: 'number', parser: Parameter.parseNumber };
|
|
32
|
-
declarations[Parameter.MATERIAL_ROUGHNESS] = { type: 'number', parser: Parameter.parseNumber };
|
|
33
|
-
declarations[Parameter.HIGHLIGHT_ENABLED] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
34
|
-
declarations[Parameter.HIGHLIGHT_COLOR] = { type: 'color', parser: Parameter.parseColor };
|
|
35
|
-
declarations[Parameter.HIGHLIGHTED] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
36
|
-
declarations[Parameter.CAST_SHADOW] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
37
|
-
declarations[Parameter.CAST_SHADOW_FROM_LIGHTS] = { type: 'csl', parser: Parameter.parseCommaSeparatedList };
|
|
38
|
-
declarations[Parameter.RECEIVE_SHADOWS] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
39
|
-
declarations[Parameter.INTENSITY] = { type: 'number', parser: Parameter.parseNumber };
|
|
40
|
-
declarations[Parameter.DIRECTION] = { type: 'vector', parser: Parameter.parseVector };
|
|
41
|
-
declarations[Parameter.ANGLE] = { type: 'number', parser: Parameter.parseNumber };
|
|
42
|
-
declarations[Parameter.EXPONENT] = { type: 'number', parser: Parameter.parseNumber };
|
|
43
|
-
declarations[Parameter.DIFFUSE] = { type: 'color', parser: Parameter.parseColor };
|
|
44
|
-
declarations[Parameter.SPECULAR] = { type: 'color', parser: Parameter.parseColor };
|
|
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
|
-
Parameter.
|
|
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
|
-
* Parses a string
|
|
181
|
-
*/
|
|
182
|
-
Parameter.
|
|
183
|
-
return value
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
318
|
-
|
|
319
|
-
*
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
*
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}())
|
|
388
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Parameter = void 0;
|
|
4
|
+
var math_color_1 = require("@babylonjs/core/Maths/math.color");
|
|
5
|
+
var math_vector_1 = require("@babylonjs/core/Maths/math.vector");
|
|
6
|
+
var lodash_es_1 = require("lodash-es");
|
|
7
|
+
/**
|
|
8
|
+
* This `Parameter` class defines all parameters that can be consumed and committed by a {@link ParameterObservable}.
|
|
9
|
+
* Use {@link ParameterObservable.addParameterObserver} or {@link ParameterObservable.commitParameters} to either add or
|
|
10
|
+
* commit parameters on your observable objects.
|
|
11
|
+
*/
|
|
12
|
+
var Parameter = /** @class */ (function () {
|
|
13
|
+
/**
|
|
14
|
+
* Constructor.
|
|
15
|
+
*/
|
|
16
|
+
function Parameter() {
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(Parameter, "declarations", {
|
|
19
|
+
/**
|
|
20
|
+
* The {@link ParameterDeclarations} for all parameters in this class.
|
|
21
|
+
*/
|
|
22
|
+
get: function () {
|
|
23
|
+
var declarations = {};
|
|
24
|
+
declarations[Parameter.VISIBLE] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
25
|
+
declarations[Parameter.SCALING] = { type: 'number', parser: Parameter.parseNumber };
|
|
26
|
+
declarations[Parameter.POSITION] = { type: 'vector', parser: Parameter.parseVector };
|
|
27
|
+
declarations[Parameter.ROTATION] = { type: 'vector', parser: Parameter.parseVector };
|
|
28
|
+
declarations[Parameter.HIGHLIGHTED] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
29
|
+
declarations[Parameter.MATERIAL] = { type: 'string' };
|
|
30
|
+
declarations[Parameter.MATERIAL_COLOR] = { type: 'color', parser: Parameter.parseColor };
|
|
31
|
+
declarations[Parameter.MATERIAL_METALLNESS] = { type: 'number', parser: Parameter.parseNumber };
|
|
32
|
+
declarations[Parameter.MATERIAL_ROUGHNESS] = { type: 'number', parser: Parameter.parseNumber };
|
|
33
|
+
declarations[Parameter.HIGHLIGHT_ENABLED] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
34
|
+
declarations[Parameter.HIGHLIGHT_COLOR] = { type: 'color', parser: Parameter.parseColor };
|
|
35
|
+
declarations[Parameter.HIGHLIGHTED] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
36
|
+
declarations[Parameter.CAST_SHADOW] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
37
|
+
declarations[Parameter.CAST_SHADOW_FROM_LIGHTS] = { type: 'csl', parser: Parameter.parseCommaSeparatedList };
|
|
38
|
+
declarations[Parameter.RECEIVE_SHADOWS] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
39
|
+
declarations[Parameter.INTENSITY] = { type: 'number', parser: Parameter.parseNumber };
|
|
40
|
+
declarations[Parameter.DIRECTION] = { type: 'vector', parser: Parameter.parseVector };
|
|
41
|
+
declarations[Parameter.ANGLE] = { type: 'number', parser: Parameter.parseNumber };
|
|
42
|
+
declarations[Parameter.EXPONENT] = { type: 'number', parser: Parameter.parseNumber };
|
|
43
|
+
declarations[Parameter.DIFFUSE] = { type: 'color', parser: Parameter.parseColor };
|
|
44
|
+
declarations[Parameter.SPECULAR] = { type: 'color', parser: Parameter.parseColor };
|
|
45
|
+
declarations[Parameter.ENVIRONMENT] = { type: 'string' };
|
|
46
|
+
declarations[Parameter.ENVIRONMENT_COLOR] = { type: 'color', parser: Parameter.parseColor };
|
|
47
|
+
declarations[Parameter.ENVIRONMENT_ROTATION] = { type: 'number', parser: Parameter.parseNumber };
|
|
48
|
+
declarations[Parameter.ENVIRONMENT_INTENSITY] = { type: 'number', parser: Parameter.parseNumber };
|
|
49
|
+
declarations[Parameter.ENVIRONMENT_BACKGROUND] = { type: 'string' };
|
|
50
|
+
declarations[Parameter.ENVIRONMENT_USEDEFAULT] = { type: 'boolean', parser: Parameter.parseBoolean };
|
|
51
|
+
return declarations;
|
|
52
|
+
},
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Gets the {@link ParameterDeclaration} for a given {@link Parameter} declared in this class.
|
|
58
|
+
*/
|
|
59
|
+
Parameter.getDeclaration = function (parameter) {
|
|
60
|
+
return Parameter.declarations[parameter];
|
|
61
|
+
};
|
|
62
|
+
Object.defineProperty(Parameter, "all", {
|
|
63
|
+
/**
|
|
64
|
+
* All parameters defined in this class.
|
|
65
|
+
*/
|
|
66
|
+
get: function () {
|
|
67
|
+
var all = [];
|
|
68
|
+
for (var parameter in Parameter) {
|
|
69
|
+
var property = Object.getOwnPropertyDescriptor(Parameter, parameter);
|
|
70
|
+
if (parameter.toUpperCase() === parameter && property && lodash_es_1.isString(property.value)) {
|
|
71
|
+
all.push(property.value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return all;
|
|
75
|
+
},
|
|
76
|
+
enumerable: false,
|
|
77
|
+
configurable: true
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Parses given {@link ParameterBag} with given {@link ParameterDeclarations}.
|
|
81
|
+
*/
|
|
82
|
+
Parameter.parseFromDeclarations = function (declarations, parameterBag) {
|
|
83
|
+
var parameters = {};
|
|
84
|
+
for (var parameter in parameterBag) {
|
|
85
|
+
var value = lodash_es_1.get(parameterBag, parameter);
|
|
86
|
+
parameters[parameter] = value;
|
|
87
|
+
var declaration = declarations[parameter];
|
|
88
|
+
if (declaration) {
|
|
89
|
+
if (!lodash_es_1.isEmpty(value) && declaration.parser) {
|
|
90
|
+
parameters[parameter] = declaration.parser(value);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return parameters;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Parses a string of format `'(x,y,z)'` to a `Vector3`.
|
|
98
|
+
*/
|
|
99
|
+
Parameter.parseVector = function (value) {
|
|
100
|
+
if (!lodash_es_1.isString(value)) {
|
|
101
|
+
throw new Error("Unable to convert \"" + value + "\" into a Vector: not a string.");
|
|
102
|
+
}
|
|
103
|
+
var cleanedValue = value.split(' ').join('');
|
|
104
|
+
if (cleanedValue.startsWith('(') && cleanedValue.endsWith(')')) {
|
|
105
|
+
cleanedValue = cleanedValue.substring(1, cleanedValue.length - 1);
|
|
106
|
+
var _a = cleanedValue.split(',').map(function (value) { return parseFloat(value); }), x = _a[0], y = _a[1], z = _a[2];
|
|
107
|
+
return new math_vector_1.Vector3(x, y, z);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
throw new Error("Unable to parse \"" + value + "\" to a Vector: expected \"(x,y,z)\".");
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Stringifies a Vector3 to format `(x,y,z)`.
|
|
115
|
+
*/
|
|
116
|
+
Parameter.stringifyVector = function (value) {
|
|
117
|
+
return "(" + value.x + "," + value.y + "," + value.z + ")";
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Parses a string of format `'(x,y,z)'` with angular degrees to a `Vector3` with rotation information in radians.
|
|
121
|
+
*/
|
|
122
|
+
Parameter.parseRotation = function (value) {
|
|
123
|
+
var rotation = Parameter.parseVector(value);
|
|
124
|
+
var deg2rad = function (deg) {
|
|
125
|
+
return (deg * Math.PI) / 180;
|
|
126
|
+
};
|
|
127
|
+
return rotation.set(deg2rad(rotation.x), deg2rad(rotation.y), deg2rad(rotation.z));
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Parses a string of format `'(x,y,z)'` or a simple `number` to a `Vector3` for scaling.
|
|
131
|
+
*/
|
|
132
|
+
Parameter.parseScaling = function (value) {
|
|
133
|
+
var scaling = new math_vector_1.Vector3();
|
|
134
|
+
if (lodash_es_1.isString(value)) {
|
|
135
|
+
var cleanedFactor = value.split(' ').join('');
|
|
136
|
+
if (cleanedFactor.startsWith('(') && cleanedFactor.endsWith(')')) {
|
|
137
|
+
scaling = Parameter.parseVector(cleanedFactor);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
var _factor = parseFloat(value);
|
|
141
|
+
scaling = new math_vector_1.Vector3(_factor, _factor, _factor);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (lodash_es_1.isNumber(value)) {
|
|
145
|
+
scaling = new math_vector_1.Vector3(value, value, value);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new Error("Unable to convert \"" + value + "\" to a Vector: expected \"(x,y,z)\".");
|
|
149
|
+
}
|
|
150
|
+
return scaling;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Parses a string of format `'#rrggbb'` or `'(r,g,b)'` to a `Color3`.
|
|
154
|
+
*/
|
|
155
|
+
Parameter.parseColor = function (value) {
|
|
156
|
+
var cleanedValue = value.toString().split(' ').join('');
|
|
157
|
+
if (cleanedValue.startsWith('#')) {
|
|
158
|
+
return math_color_1.Color3.FromHexString(value.toString());
|
|
159
|
+
}
|
|
160
|
+
if (cleanedValue.startsWith('(') && cleanedValue.endsWith(')')) {
|
|
161
|
+
cleanedValue = cleanedValue.substring(1, cleanedValue.length - 1);
|
|
162
|
+
var _a = cleanedValue.split(',').map(function (value) { return parseFloat(value); }), r = _a[0], g = _a[1], b = _a[2];
|
|
163
|
+
return math_color_1.Color3.FromInts(r, g, b);
|
|
164
|
+
}
|
|
165
|
+
throw new Error("Unable to parse \"" + value + "\" to a Color: expected \"#rrggbb\" or \"(r,g,b)\".");
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Parses a `boolean` string (`'true'`/`'1'` or `'false'`/`'0'`) or `number` (`1` or `0`) to a `boolean` or `undefined`.
|
|
169
|
+
*/
|
|
170
|
+
Parameter.parseBoolean = function (value) {
|
|
171
|
+
if (value.toString() === 'true' || value.toString() === '1') {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
else if (value.toString() === 'false' || value.toString() === '0') {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
throw new Error("Unable to parse \"" + value + "\" to a boolean.");
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Parses a number `string` to a `number`.
|
|
181
|
+
*/
|
|
182
|
+
Parameter.parseNumber = function (value) {
|
|
183
|
+
return parseFloat(value.toString());
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Parses a string with comma separated values to a list of strings.
|
|
187
|
+
*/
|
|
188
|
+
Parameter.parseCommaSeparatedList = function (value) {
|
|
189
|
+
return value
|
|
190
|
+
.toString()
|
|
191
|
+
.split(',')
|
|
192
|
+
.map(function (s) { return s.trim(); });
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Mutates the visibility. Helper methods are {@link VariantParameterizable.show} and
|
|
196
|
+
* {@link VariantParameterizable.hide}. Getter and setter is {@link VariantParameterizable.visible}.
|
|
197
|
+
*
|
|
198
|
+
* Scopes:
|
|
199
|
+
* * {@link Element}
|
|
200
|
+
* * {@link Variant}
|
|
201
|
+
* * {@link ViewerLight} Available for all light types
|
|
202
|
+
*
|
|
203
|
+
* @parser {@link parseBoolean}
|
|
204
|
+
*/
|
|
205
|
+
Parameter.VISIBLE = 'visible';
|
|
206
|
+
/**
|
|
207
|
+
* Stretches or compresses some meshes. Getter and setter is {@link VariantParameterizable.scaling}.
|
|
208
|
+
*
|
|
209
|
+
* Scopes:
|
|
210
|
+
* * {@link Element}
|
|
211
|
+
* * {@link Variant}
|
|
212
|
+
*
|
|
213
|
+
* @parser {@link parseScaling}
|
|
214
|
+
*/
|
|
215
|
+
Parameter.SCALING = 'scaling';
|
|
216
|
+
/**
|
|
217
|
+
* Mutates the material. Getter and setter is {@link VariantParameterizable.material}. The value of this parameter
|
|
218
|
+
* represents the ID of a baked-in glTF or custom created material in the {@link Variant} tree.
|
|
219
|
+
*
|
|
220
|
+
* Scopes:
|
|
221
|
+
* * {@link Element}
|
|
222
|
+
* * {@link Variant}
|
|
223
|
+
*
|
|
224
|
+
* @parser string
|
|
225
|
+
*/
|
|
226
|
+
Parameter.MATERIAL = 'material';
|
|
227
|
+
/**
|
|
228
|
+
* Mutates the material color.
|
|
229
|
+
*
|
|
230
|
+
* Scopes:
|
|
231
|
+
* * {@link Element}
|
|
232
|
+
* * {@link Variant}
|
|
233
|
+
*
|
|
234
|
+
* @parser {@link parseColor}
|
|
235
|
+
*/
|
|
236
|
+
Parameter.MATERIAL_COLOR = 'material.color';
|
|
237
|
+
/**
|
|
238
|
+
* Mutates the material metallness.
|
|
239
|
+
*
|
|
240
|
+
* Scopes:
|
|
241
|
+
* * {@link Element}
|
|
242
|
+
* * {@link Variant}
|
|
243
|
+
*
|
|
244
|
+
* @parser {@link parseNumber}
|
|
245
|
+
*/
|
|
246
|
+
Parameter.MATERIAL_METALLNESS = 'material.metallness';
|
|
247
|
+
/**
|
|
248
|
+
* Mutates the material roughness.
|
|
249
|
+
*
|
|
250
|
+
* Scopes:
|
|
251
|
+
* * {@link Element}
|
|
252
|
+
* * {@link Variant}
|
|
253
|
+
*
|
|
254
|
+
* @parser {@link parseNumber}
|
|
255
|
+
*/
|
|
256
|
+
Parameter.MATERIAL_ROUGHNESS = 'material.roughness';
|
|
257
|
+
/**
|
|
258
|
+
* Mutates whether a highlight layer should be enabled.
|
|
259
|
+
*
|
|
260
|
+
* Scopes:
|
|
261
|
+
* * {@link Element}
|
|
262
|
+
* * {@link Variant}
|
|
263
|
+
*
|
|
264
|
+
* @parser {@link parseBoolean}
|
|
265
|
+
*/
|
|
266
|
+
Parameter.HIGHLIGHT_ENABLED = 'highlight.enabled';
|
|
267
|
+
/**
|
|
268
|
+
* Changes the highlight color.
|
|
269
|
+
*
|
|
270
|
+
* Scopes:
|
|
271
|
+
* * {@link Element}
|
|
272
|
+
* * {@link Variant}
|
|
273
|
+
*
|
|
274
|
+
* @parser {@link parseColor}
|
|
275
|
+
*/
|
|
276
|
+
Parameter.HIGHLIGHT_COLOR = 'highlight.color';
|
|
277
|
+
/**
|
|
278
|
+
* Mutates the highlighted state. Getter and setter is {@link VariantParameterizable.highlighted}.
|
|
279
|
+
*
|
|
280
|
+
* Scopes:
|
|
281
|
+
* * {@link Element}
|
|
282
|
+
* * {@link Variant}
|
|
283
|
+
*
|
|
284
|
+
* @parser {@link parseBoolean}
|
|
285
|
+
*/
|
|
286
|
+
Parameter.HIGHLIGHTED = 'highlighted';
|
|
287
|
+
/**
|
|
288
|
+
* Mutates the position relative to its origin position. Getter and setter is {@link VariantParameterizable.position}.
|
|
289
|
+
*
|
|
290
|
+
* Scopes:
|
|
291
|
+
* * {@link Element}
|
|
292
|
+
* * {@link Variant}
|
|
293
|
+
* * {@link ViewerLight} Available for [PointLight](https://doc.babylonjs.com/typedoc/classes/babylon.pointlight#position), [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#position), [DirectionalLight](https://doc.babylonjs.com/typedoc/classes/babylon.directionallight#position)
|
|
294
|
+
*
|
|
295
|
+
* @parser {@link parseVector}
|
|
296
|
+
*/
|
|
297
|
+
Parameter.POSITION = 'position';
|
|
298
|
+
/**
|
|
299
|
+
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link VariantParameterizable.rotation}.
|
|
300
|
+
*
|
|
301
|
+
* Scopes:
|
|
302
|
+
* * {@link Element}
|
|
303
|
+
* * {@link Variant}
|
|
304
|
+
*
|
|
305
|
+
* @parser {@link parseRotation}
|
|
306
|
+
*/
|
|
307
|
+
Parameter.ROTATION = 'rotation';
|
|
308
|
+
/**
|
|
309
|
+
* Mutates whether a shadow should be casted or not.
|
|
310
|
+
*
|
|
311
|
+
* Scopes:
|
|
312
|
+
* * {@link Element}
|
|
313
|
+
* * {@link Variant}
|
|
314
|
+
*
|
|
315
|
+
* @parser {@link parseBoolean}
|
|
316
|
+
*/
|
|
317
|
+
Parameter.CAST_SHADOW = 'castShadow';
|
|
318
|
+
/**
|
|
319
|
+
* Mutates from which lights a shadow should be casted.
|
|
320
|
+
*
|
|
321
|
+
* Scopes:
|
|
322
|
+
* * {@link Element}
|
|
323
|
+
* * {@link Variant}
|
|
324
|
+
*
|
|
325
|
+
* @parser {@link parseCommaSeparatedList}
|
|
326
|
+
*/
|
|
327
|
+
Parameter.CAST_SHADOW_FROM_LIGHTS = 'castShadow.fromLights';
|
|
328
|
+
/**
|
|
329
|
+
* Mutates whether to receive shadows or not.
|
|
330
|
+
*
|
|
331
|
+
* Scopes:
|
|
332
|
+
* * {@link Element}
|
|
333
|
+
* * {@link Variant}
|
|
334
|
+
*
|
|
335
|
+
* @parser {@link parseBoolean}
|
|
336
|
+
*/
|
|
337
|
+
Parameter.RECEIVE_SHADOWS = 'receiveShadows';
|
|
338
|
+
/**
|
|
339
|
+
* Mutates the intensity of Lights.
|
|
340
|
+
*
|
|
341
|
+
* Scopes:
|
|
342
|
+
* * {@link ViewerLight} Available for [PointLight](https://doc.babylonjs.com/typedoc/classes/babylon.pointlight#intensity), [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#intensity), [DirectionalLight](https://doc.babylonjs.com/typedoc/classes/babylon.directionallight#intensity), [HemisphericLight](https://doc.babylonjs.com/typedoc/classes/babylon.hemisphericlight#intensity)
|
|
343
|
+
*
|
|
344
|
+
* @parser {@link parseNumber}
|
|
345
|
+
*/
|
|
346
|
+
Parameter.INTENSITY = 'intensity';
|
|
347
|
+
/**
|
|
348
|
+
* Mutates the direction of Lights.
|
|
349
|
+
*
|
|
350
|
+
* Scopes:
|
|
351
|
+
* * {@link ViewerLight} Available for [PointLight](https://doc.babylonjs.com/typedoc/classes/babylon.pointlight#direction), [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#direction), [DirectionalLight](https://doc.babylonjs.com/typedoc/classes/babylon.directionallight#direction), [HemisphericLight](https://doc.babylonjs.com/typedoc/classes/babylon.hemisphericlight#direction)
|
|
352
|
+
*
|
|
353
|
+
* @parser {@link parseNumber}
|
|
354
|
+
*/
|
|
355
|
+
Parameter.DIRECTION = 'direction';
|
|
356
|
+
/**
|
|
357
|
+
* Mutates the angle of Lights.
|
|
358
|
+
*
|
|
359
|
+
* Scopes:
|
|
360
|
+
* * {@link ViewerLight} Available for [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#angle)
|
|
361
|
+
*
|
|
362
|
+
* @parser {@link parseNumber}
|
|
363
|
+
*/
|
|
364
|
+
Parameter.ANGLE = 'angle';
|
|
365
|
+
/**
|
|
366
|
+
* Mutates the exponent of Lights.
|
|
367
|
+
*
|
|
368
|
+
* Scopes:
|
|
369
|
+
* * {@link ViewerLight} Available for [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#exponent)
|
|
370
|
+
*
|
|
371
|
+
* @parser {@link parseNumber}
|
|
372
|
+
*/
|
|
373
|
+
Parameter.EXPONENT = 'exponent';
|
|
374
|
+
/**
|
|
375
|
+
* Mutates the diffuse color of Lights.
|
|
376
|
+
*
|
|
377
|
+
* Scopes:
|
|
378
|
+
* * {@link ViewerLight} Available for [PointLight](https://doc.babylonjs.com/typedoc/classes/babylon.pointlight#diffuse), [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#diffuse), [DirectionalLight](https://doc.babylonjs.com/typedoc/classes/babylon.directionallight#diffuse), [HemisphericLight](https://doc.babylonjs.com/typedoc/classes/babylon.hemisphericlight#diffuse)
|
|
379
|
+
*
|
|
380
|
+
* @parser {@link parseNumber}
|
|
381
|
+
*/
|
|
382
|
+
Parameter.DIFFUSE = 'diffuse';
|
|
383
|
+
/**
|
|
384
|
+
* Mutates the specular color of Lights.
|
|
385
|
+
*
|
|
386
|
+
* Scopes:
|
|
387
|
+
* * {@link ViewerLight} Available for [PointLight](https://doc.babylonjs.com/typedoc/classes/babylon.pointlight#specular), [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#specular), [DirectionalLight](https://doc.babylonjs.com/typedoc/classes/babylon.directionallight#specular), [HemisphericLight](https://doc.babylonjs.com/typedoc/classes/babylon.hemisphericlight#specular)
|
|
388
|
+
*
|
|
389
|
+
* @parser {@link parseNumber}
|
|
390
|
+
*/
|
|
391
|
+
Parameter.SPECULAR = 'specular';
|
|
392
|
+
/**
|
|
393
|
+
* Sets the environment. See [BABYLON.Scene.environmentTexture](https://doc.babylonjs.com/typedoc/classes/BABYLON.Scene#environmentTexture)
|
|
394
|
+
*
|
|
395
|
+
* Scopes:
|
|
396
|
+
* *{@link SceneManager}
|
|
397
|
+
*
|
|
398
|
+
* @parser string
|
|
399
|
+
*/
|
|
400
|
+
Parameter.ENVIRONMENT = 'environment';
|
|
401
|
+
/**
|
|
402
|
+
* Sets [BABYLON.Scene.clearColor](https://doc.babylonjs.com/typedoc/classes/BABYLON.Scene#clearColor)
|
|
403
|
+
*
|
|
404
|
+
* Scopes:
|
|
405
|
+
* *{@link SceneManager}
|
|
406
|
+
*
|
|
407
|
+
* @parser {@link parseColor}
|
|
408
|
+
*/
|
|
409
|
+
Parameter.ENVIRONMENT_COLOR = 'environment.color';
|
|
410
|
+
/**
|
|
411
|
+
* Rotates connected textures, i.e. IBL, reflection, background, ..
|
|
412
|
+
*
|
|
413
|
+
* Scopes:
|
|
414
|
+
* *{@link SceneManager}
|
|
415
|
+
*
|
|
416
|
+
* @parser {@link parseNumber}
|
|
417
|
+
*/
|
|
418
|
+
Parameter.ENVIRONMENT_ROTATION = 'environment.rotation';
|
|
419
|
+
/**
|
|
420
|
+
* Intensity of IBL
|
|
421
|
+
*
|
|
422
|
+
* Scopes:
|
|
423
|
+
* *{@link SceneManager}
|
|
424
|
+
*
|
|
425
|
+
* @parser {@link parseNumber}
|
|
426
|
+
*/
|
|
427
|
+
Parameter.ENVIRONMENT_INTENSITY = 'environment.intensity';
|
|
428
|
+
/**
|
|
429
|
+
* Background texture on a PhotoDome. Just background, no IBL or reflection.
|
|
430
|
+
*
|
|
431
|
+
* Scopes:
|
|
432
|
+
* *{@link SceneManager}
|
|
433
|
+
*
|
|
434
|
+
* @parser string
|
|
435
|
+
*/
|
|
436
|
+
Parameter.ENVIRONMENT_BACKGROUND = 'environment.background';
|
|
437
|
+
/**
|
|
438
|
+
* If TRUE, sets a `scene.environmentTexture` and creates
|
|
439
|
+
* a *BackgroundHelper* Node (via `scene.createDefaultEnvironment()) with two subnodes/meshes:
|
|
440
|
+
* - BackgroundPlane
|
|
441
|
+
* - BackgroundSkybox
|
|
442
|
+
*
|
|
443
|
+
* Scopes:
|
|
444
|
+
* *{@link SceneManager}
|
|
445
|
+
*
|
|
446
|
+
* @parser {@link parseBoolean}
|
|
447
|
+
*/
|
|
448
|
+
Parameter.ENVIRONMENT_USEDEFAULT = 'environment.usedefault';
|
|
449
|
+
return Parameter;
|
|
450
|
+
}());
|
|
451
|
+
exports.Parameter = Parameter;
|
|
389
452
|
//# sourceMappingURL=parameter.js.map
|