@combeenation/3d-viewer 4.0.0-alpha9 → 4.0.0-beta4
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 +112 -111
- 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 +190 -190
- package/dist/lib-cjs/api/classes/element.d.ts +125 -130
- package/dist/lib-cjs/api/classes/element.js +682 -739
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -14
- package/dist/lib-cjs/api/classes/elementParameterizable.js +134 -134
- package/dist/lib-cjs/api/classes/event.d.ts +312 -326
- package/dist/lib-cjs/api/classes/event.js +357 -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 +53 -53
- package/dist/lib-cjs/api/classes/parameter.d.ts +165 -259
- package/dist/lib-cjs/api/classes/parameter.js +267 -387
- 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 +126 -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 +149 -149
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +38 -38
- package/dist/lib-cjs/api/classes/placementAnimation.js +138 -138
- package/dist/lib-cjs/api/classes/variant.d.ts +190 -224
- package/dist/lib-cjs/api/classes/variant.js +873 -1137
- package/dist/lib-cjs/api/classes/variant.js.map +1 -1
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +41 -45
- package/dist/lib-cjs/api/classes/variantInstance.js +98 -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 +92 -92
- package/dist/lib-cjs/api/classes/viewer.d.ts +128 -131
- package/dist/lib-cjs/api/classes/viewer.js +486 -538
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerLight.d.ts +65 -66
- package/dist/lib-cjs/api/classes/viewerLight.js +322 -389
- package/dist/lib-cjs/api/classes/viewerLight.js.map +1 -1
- package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
- package/dist/lib-cjs/api/internal/debugViewer.js +87 -87
- 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 +6 -10
- package/dist/lib-cjs/api/internal/sceneSetup.js +227 -231
- 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 +121 -121
- package/dist/lib-cjs/api/manager/sceneManager.d.ts +32 -32
- package/dist/lib-cjs/api/manager/sceneManager.js +132 -132
- package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +90 -90
- package/dist/lib-cjs/api/manager/variantInstanceManager.js +321 -321
- 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 +125 -175
- package/dist/lib-cjs/api/util/babylonHelper.js +368 -520
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +279 -321
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +51 -26
- package/dist/lib-cjs/api/util/resourceHelper.js +243 -237
- 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/buildinfo.json +3 -3
- package/dist/lib-cjs/index.d.ts +46 -48
- package/dist/lib-cjs/index.js +82 -86
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/webpack-stats.json +0 -0
- package/package.json +83 -83
- package/src/api/classes/animationInterface.ts +11 -11
- package/src/api/classes/dottedPath.ts +189 -189
- package/src/api/classes/element.ts +617 -635
- package/src/api/classes/{parameterizable.ts → elementParameterizable.ts} +78 -89
- package/src/api/classes/event.ts +355 -370
- package/src/api/classes/eventBroadcaster.ts +54 -54
- package/src/api/classes/parameter.ts +277 -408
- package/src/api/classes/parameterObservable.ts +121 -99
- package/src/api/classes/placementAnimation.ts +133 -133
- package/src/api/classes/variant.ts +670 -806
- package/src/api/classes/variantInstance.ts +81 -88
- package/src/api/classes/viewer.ts +421 -473
- package/src/api/internal/debugViewer.ts +81 -81
- package/src/api/internal/lensRendering.ts +10 -10
- package/src/api/internal/sceneSetup.ts +204 -194
- package/src/api/manager/animationManager.ts +116 -116
- package/src/api/manager/sceneManager.ts +105 -105
- package/src/api/manager/variantInstanceManager.ts +236 -236
- package/src/api/store/specStorage.ts +53 -53
- package/src/api/util/babylonHelper.ts +392 -553
- package/src/api/util/globalTypes.ts +318 -369
- package/src/api/util/resourceHelper.ts +187 -157
- package/src/buildinfo.json +2 -2
- package/src/commonjs.tsconfig.json +13 -13
- package/src/declaration.tsconfig.json +10 -10
- package/src/dev.ts +46 -44
- package/src/es6.tsconfig.json +13 -13
- package/src/index.ts +87 -91
- package/src/pagesconfig.json +57 -52
- package/src/tsconfig.json +43 -43
- package/src/tsconfig.types.json +9 -9
- package/src/types.d.ts +4 -4
- package/src/api/classes/variantParameterizable.ts +0 -73
- package/src/api/classes/viewerLight.ts +0 -330
- package/src/api/util/stringHelper.ts +0 -26
|
@@ -1,388 +1,268 @@
|
|
|
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
|
|
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
|
-
if (
|
|
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
|
-
*
|
|
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
|
-
Parameter.HIGHLIGHT_COLOR = 'highlight.color';
|
|
270
|
-
/**
|
|
271
|
-
* Mutates the highlighted state. Getter and setter is {@link VariantParameterizable.highlighted}.
|
|
272
|
-
*
|
|
273
|
-
* Scopes:
|
|
274
|
-
* * {@link Element}
|
|
275
|
-
* * {@link Variant}
|
|
276
|
-
*
|
|
277
|
-
* @parser {@link parseBoolean}
|
|
278
|
-
*/
|
|
279
|
-
Parameter.HIGHLIGHTED = 'highlighted';
|
|
280
|
-
/**
|
|
281
|
-
* Mutates the position relative to its origin position. Getter and setter is {@link VariantParameterizable.position}.
|
|
282
|
-
*
|
|
283
|
-
* Scopes:
|
|
284
|
-
* * {@link Element}
|
|
285
|
-
* * {@link Variant}
|
|
286
|
-
* * {@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)
|
|
287
|
-
*
|
|
288
|
-
* @parser {@link parseVector}
|
|
289
|
-
*/
|
|
290
|
-
Parameter.POSITION = 'position';
|
|
291
|
-
/**
|
|
292
|
-
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link VariantParameterizable.rotation}.
|
|
293
|
-
*
|
|
294
|
-
* Scopes:
|
|
295
|
-
* * {@link Element}
|
|
296
|
-
* * {@link Variant}
|
|
297
|
-
*
|
|
298
|
-
* @parser {@link parseRotation}
|
|
299
|
-
*/
|
|
300
|
-
Parameter.ROTATION = 'rotation';
|
|
301
|
-
/**
|
|
302
|
-
* Mutates whether a shadow should be casted or not.
|
|
303
|
-
*
|
|
304
|
-
* Scopes:
|
|
305
|
-
* * {@link Element}
|
|
306
|
-
* * {@link Variant}
|
|
307
|
-
*
|
|
308
|
-
* @parser {@link parseBoolean}
|
|
309
|
-
*/
|
|
310
|
-
Parameter.CAST_SHADOW = 'castShadow';
|
|
311
|
-
/**
|
|
312
|
-
* Mutates from which lights a shadow should be casted.
|
|
313
|
-
*
|
|
314
|
-
* Scopes:
|
|
315
|
-
* * {@link Element}
|
|
316
|
-
* * {@link Variant}
|
|
317
|
-
*
|
|
318
|
-
* @parser {@link parseCommaSeparatedList}
|
|
319
|
-
*/
|
|
320
|
-
Parameter.CAST_SHADOW_FROM_LIGHTS = 'castShadow.fromLights';
|
|
321
|
-
/**
|
|
322
|
-
* Mutates whether to receive shadows or not.
|
|
323
|
-
*
|
|
324
|
-
* Scopes:
|
|
325
|
-
* * {@link Element}
|
|
326
|
-
* * {@link Variant}
|
|
327
|
-
*
|
|
328
|
-
* @parser {@link parseBoolean}
|
|
329
|
-
*/
|
|
330
|
-
Parameter.RECEIVE_SHADOWS = 'receiveShadows';
|
|
331
|
-
/**
|
|
332
|
-
* Mutates the intensity of Lights.
|
|
333
|
-
*
|
|
334
|
-
* Scopes:
|
|
335
|
-
* * {@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)
|
|
336
|
-
*
|
|
337
|
-
* @parser {@link parseNumber}
|
|
338
|
-
*/
|
|
339
|
-
Parameter.INTENSITY = 'intensity';
|
|
340
|
-
/**
|
|
341
|
-
* Mutates the direction of Lights.
|
|
342
|
-
*
|
|
343
|
-
* Scopes:
|
|
344
|
-
* * {@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)
|
|
345
|
-
*
|
|
346
|
-
* @parser {@link parseNumber}
|
|
347
|
-
*/
|
|
348
|
-
Parameter.DIRECTION = 'direction';
|
|
349
|
-
/**
|
|
350
|
-
* Mutates the angle of Lights.
|
|
351
|
-
*
|
|
352
|
-
* Scopes:
|
|
353
|
-
* * {@link ViewerLight} Available for [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#angle)
|
|
354
|
-
*
|
|
355
|
-
* @parser {@link parseNumber}
|
|
356
|
-
*/
|
|
357
|
-
Parameter.ANGLE = 'angle';
|
|
358
|
-
/**
|
|
359
|
-
* Mutates the exponent of Lights.
|
|
360
|
-
*
|
|
361
|
-
* Scopes:
|
|
362
|
-
* * {@link ViewerLight} Available for [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#exponent)
|
|
363
|
-
*
|
|
364
|
-
* @parser {@link parseNumber}
|
|
365
|
-
*/
|
|
366
|
-
Parameter.EXPONENT = 'exponent';
|
|
367
|
-
/**
|
|
368
|
-
* Mutates the diffuse color of Lights.
|
|
369
|
-
*
|
|
370
|
-
* Scopes:
|
|
371
|
-
* * {@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)
|
|
372
|
-
*
|
|
373
|
-
* @parser {@link parseNumber}
|
|
374
|
-
*/
|
|
375
|
-
Parameter.DIFFUSE = 'diffuse';
|
|
376
|
-
/**
|
|
377
|
-
* Mutates the specular color of Lights.
|
|
378
|
-
*
|
|
379
|
-
* Scopes:
|
|
380
|
-
* * {@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)
|
|
381
|
-
*
|
|
382
|
-
* @parser {@link parseNumber}
|
|
383
|
-
*/
|
|
384
|
-
Parameter.SPECULAR = 'specular';
|
|
385
|
-
return Parameter;
|
|
386
|
-
}());
|
|
387
|
-
exports.Parameter = Parameter;
|
|
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 declaration = {};
|
|
24
|
+
declaration[Parameter.VISIBLE] = { type: 'boolean' };
|
|
25
|
+
declaration[Parameter.SCALING] = { type: 'number' };
|
|
26
|
+
declaration[Parameter.HIGHLIGHTED] = { type: 'boolean' };
|
|
27
|
+
declaration[Parameter.MATERIAL] = { type: 'string' };
|
|
28
|
+
declaration[Parameter.MATERIAL_COLOR] = { type: 'color' };
|
|
29
|
+
declaration[Parameter.MATERIAL_METALLNESS] = { type: 'number' };
|
|
30
|
+
declaration[Parameter.MATERIAL_ROUGHNESS] = { type: 'number' };
|
|
31
|
+
declaration[Parameter.HIGHLIGHT_ENABLED] = { type: 'boolean' };
|
|
32
|
+
declaration[Parameter.HIGHLIGHT_COLOR] = { type: 'color' };
|
|
33
|
+
declaration[Parameter.HIGHLIGHTED] = { type: 'boolean' };
|
|
34
|
+
declaration[Parameter.POSITION] = { type: 'vector' };
|
|
35
|
+
declaration[Parameter.ROTATION] = { type: 'vector' };
|
|
36
|
+
return declaration;
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Gets the {@link ParameterDeclaration} for a given {@link Parameter} declared in this class.
|
|
43
|
+
*/
|
|
44
|
+
Parameter.getDeclaration = function (parameter) {
|
|
45
|
+
return Parameter.declarations[parameter];
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(Parameter, "all", {
|
|
48
|
+
/**
|
|
49
|
+
* All parameters defined in this class.
|
|
50
|
+
*/
|
|
51
|
+
get: function () {
|
|
52
|
+
var all = [];
|
|
53
|
+
for (var parameter in Parameter) {
|
|
54
|
+
var property = Object.getOwnPropertyDescriptor(Parameter, parameter);
|
|
55
|
+
if (parameter.toUpperCase() === parameter && property && lodash_es_1.isString(property.value)) {
|
|
56
|
+
all.push(property.value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return all;
|
|
60
|
+
},
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Parses a string of format `'(x,y,z)'` to a `Vector3`.
|
|
66
|
+
*/
|
|
67
|
+
Parameter.parseVector = function (value) {
|
|
68
|
+
if (!lodash_es_1.isString(value)) {
|
|
69
|
+
throw new Error("Unable to convert \"" + value + "\" into a Vector: not a string.");
|
|
70
|
+
}
|
|
71
|
+
var cleanedValue = value.split(' ').join('');
|
|
72
|
+
if (cleanedValue.startsWith('(') && cleanedValue.endsWith(')')) {
|
|
73
|
+
cleanedValue = cleanedValue.substring(1, cleanedValue.length - 1);
|
|
74
|
+
var _a = cleanedValue.split(',').map(function (value) { return parseFloat(value); }), x = _a[0], y = _a[1], z = _a[2];
|
|
75
|
+
return new math_vector_1.Vector3(x, y, z);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
throw new Error("Unable to parse \"" + value + "\" to a Vector: expected \"(x,y,z)\".");
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Stringifies a Vector3 to format `(x,y,z)`.
|
|
83
|
+
*/
|
|
84
|
+
Parameter.stringifyVector = function (value) {
|
|
85
|
+
return "(" + value.x + "," + value.y + "," + value.z + ")";
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Parses a string of format `'(x,y,z)'` with angular degrees to a `Vector3` with rotation information in radians.
|
|
89
|
+
*/
|
|
90
|
+
Parameter.parseRotation = function (value) {
|
|
91
|
+
var rotation = Parameter.parseVector(value);
|
|
92
|
+
var deg2rad = function (deg) {
|
|
93
|
+
return deg * Math.PI / 180;
|
|
94
|
+
};
|
|
95
|
+
return rotation.set(deg2rad(rotation.x), deg2rad(rotation.y), deg2rad(rotation.z));
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Parses a string of format `'(x,y,z)'` or a simple `number` to a `Vector3` for scaling.
|
|
99
|
+
*/
|
|
100
|
+
Parameter.parseScaling = function (value) {
|
|
101
|
+
var scaling = new math_vector_1.Vector3();
|
|
102
|
+
if (lodash_es_1.isString(value)) {
|
|
103
|
+
var cleanedFactor = value.split(' ').join('');
|
|
104
|
+
if (cleanedFactor.startsWith('(') && cleanedFactor.endsWith(')')) {
|
|
105
|
+
scaling = Parameter.parseVector(cleanedFactor);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
var _factor = parseFloat(value);
|
|
109
|
+
scaling = new math_vector_1.Vector3(_factor, _factor, _factor);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (lodash_es_1.isNumber(value)) {
|
|
113
|
+
scaling = new math_vector_1.Vector3(value, value, value);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
throw new Error("Unable to convert \"" + value + "\" to a Vector: expected \"(x,y,z)\".");
|
|
117
|
+
}
|
|
118
|
+
return scaling;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Parses a string of format `'#rrggbb'` or `'(r,g,b)'` to a `Color3`.
|
|
122
|
+
*/
|
|
123
|
+
Parameter.parseColor = function (value) {
|
|
124
|
+
var cleanedValue = value.toString().split(' ').join('');
|
|
125
|
+
if (cleanedValue.startsWith('#')) {
|
|
126
|
+
return math_color_1.Color3.FromHexString(value.toString());
|
|
127
|
+
}
|
|
128
|
+
if (cleanedValue.startsWith('(') && cleanedValue.endsWith(')')) {
|
|
129
|
+
cleanedValue = cleanedValue.substring(1, cleanedValue.length - 1);
|
|
130
|
+
var _a = cleanedValue.split(',').map(function (value) { return parseFloat(value); }), r = _a[0], g = _a[1], b = _a[2];
|
|
131
|
+
return math_color_1.Color3.FromInts(r, g, b);
|
|
132
|
+
}
|
|
133
|
+
throw new Error("Unable to parse \"" + value + "\" to a Color: expected \"#rrggbb\" or \"(r,g,b)\".");
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Parses a `boolean` string (`'true'`/`'1'` or `'false'`/`'0'`) or `number` (`1` or `0`) to a `boolean` or `undefined`.
|
|
137
|
+
*/
|
|
138
|
+
Parameter.parseBoolean = function (value) {
|
|
139
|
+
if (value.toString() === 'true' || value.toString() === '1') {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
else if (value.toString() === 'false' || value.toString() === '0') {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
throw new Error("Unable to parse \"" + value + "\" to a boolean.");
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Parses a number `string` to a `number`.
|
|
149
|
+
*/
|
|
150
|
+
Parameter.parseNumber = function (value) {
|
|
151
|
+
return parseFloat(value.toString());
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Mutates the visibility. Helper methods are {@link ElementParameterizable.show} and
|
|
155
|
+
* {@link ElementParameterizable.hide}. Getter and setter is {@link ElementParameterizable.visible}.
|
|
156
|
+
*
|
|
157
|
+
* Scopes:
|
|
158
|
+
* * {@link Element}
|
|
159
|
+
* * {@link Variant}
|
|
160
|
+
*
|
|
161
|
+
* @parser {@link parseBoolean}
|
|
162
|
+
*/
|
|
163
|
+
Parameter.VISIBLE = 'visible';
|
|
164
|
+
/**
|
|
165
|
+
* Stretches or compresses some meshes. Getter and setter is {@link ElementParameterizable.scaling}.
|
|
166
|
+
*
|
|
167
|
+
* Scopes:
|
|
168
|
+
* * {@link Element}
|
|
169
|
+
* * {@link Variant}
|
|
170
|
+
*
|
|
171
|
+
* @parser {@link parseScaling}
|
|
172
|
+
*/
|
|
173
|
+
Parameter.SCALING = 'scaling';
|
|
174
|
+
/**
|
|
175
|
+
* Mutates the material. Getter and setter is {@link ElementParameterizable.material}. The value of this parameter
|
|
176
|
+
* represents the ID of a baked-in glTF or custom created material in the {@link Variant} tree.
|
|
177
|
+
*
|
|
178
|
+
* Scopes:
|
|
179
|
+
* * {@link Element}
|
|
180
|
+
* * {@link Variant}
|
|
181
|
+
*
|
|
182
|
+
* @parser string
|
|
183
|
+
*/
|
|
184
|
+
Parameter.MATERIAL = 'material';
|
|
185
|
+
/**
|
|
186
|
+
* Mutates the material color.
|
|
187
|
+
*
|
|
188
|
+
* Scopes:
|
|
189
|
+
* * {@link Element}
|
|
190
|
+
* * {@link Variant}
|
|
191
|
+
*
|
|
192
|
+
* @parser {@link parseColor}
|
|
193
|
+
*/
|
|
194
|
+
Parameter.MATERIAL_COLOR = 'material.color';
|
|
195
|
+
/**
|
|
196
|
+
* Mutates the material metallness.
|
|
197
|
+
*
|
|
198
|
+
* Scopes:
|
|
199
|
+
* * {@link Element}
|
|
200
|
+
* * {@link Variant}
|
|
201
|
+
*
|
|
202
|
+
* @parser {@link parseNumber}
|
|
203
|
+
*/
|
|
204
|
+
Parameter.MATERIAL_METALLNESS = 'material.metallness';
|
|
205
|
+
/**
|
|
206
|
+
* Mutates the material roughness.
|
|
207
|
+
*
|
|
208
|
+
* Scopes:
|
|
209
|
+
* * {@link Element}
|
|
210
|
+
* * {@link Variant}
|
|
211
|
+
*
|
|
212
|
+
* @parser {@link parseNumber}
|
|
213
|
+
*/
|
|
214
|
+
Parameter.MATERIAL_ROUGHNESS = 'material.roughness';
|
|
215
|
+
/**
|
|
216
|
+
* Mutates whether a highlight layer should be enabled.
|
|
217
|
+
*
|
|
218
|
+
* Scopes:
|
|
219
|
+
* * {@link Element}
|
|
220
|
+
* * {@link Variant}
|
|
221
|
+
*
|
|
222
|
+
* @parser {@link parseBoolean}
|
|
223
|
+
*/
|
|
224
|
+
Parameter.HIGHLIGHT_ENABLED = 'highlight.enabled';
|
|
225
|
+
/**
|
|
226
|
+
* Changes the highlight color.
|
|
227
|
+
*
|
|
228
|
+
* Scopes:
|
|
229
|
+
* * {@link Element}
|
|
230
|
+
* * {@link Variant}
|
|
231
|
+
*
|
|
232
|
+
* @parser {@link parseColor}
|
|
233
|
+
*/
|
|
234
|
+
Parameter.HIGHLIGHT_COLOR = 'highlight.color';
|
|
235
|
+
/**
|
|
236
|
+
* Mutates the highlighted state. Getter and setter is {@link ElementParameterizable.highlighted}.
|
|
237
|
+
*
|
|
238
|
+
* Scopes:
|
|
239
|
+
* * {@link Element}
|
|
240
|
+
* * {@link Variant}
|
|
241
|
+
*
|
|
242
|
+
* @parser {@link parseBoolean}
|
|
243
|
+
*/
|
|
244
|
+
Parameter.HIGHLIGHTED = 'highlighted';
|
|
245
|
+
/**
|
|
246
|
+
* Mutates the position relative to its origin position. Getter and setter is {@link ElementParameterizable.position}.
|
|
247
|
+
*
|
|
248
|
+
* Scopes:
|
|
249
|
+
* * {@link Element}
|
|
250
|
+
* * {@link Variant}
|
|
251
|
+
*
|
|
252
|
+
* @parser {@link parseVector}
|
|
253
|
+
*/
|
|
254
|
+
Parameter.POSITION = 'position';
|
|
255
|
+
/**
|
|
256
|
+
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link ElementParameterizable.rotation}.
|
|
257
|
+
*
|
|
258
|
+
* Scopes:
|
|
259
|
+
* * {@link Element}
|
|
260
|
+
* * {@link Variant}
|
|
261
|
+
*
|
|
262
|
+
* @parser {@link parseRotation}
|
|
263
|
+
*/
|
|
264
|
+
Parameter.ROTATION = 'rotation';
|
|
265
|
+
return Parameter;
|
|
266
|
+
}());
|
|
267
|
+
exports.Parameter = Parameter;
|
|
388
268
|
//# sourceMappingURL=parameter.js.map
|