@combeenation/3d-viewer 4.0.0-alpha7 → 4.0.0-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 +1 -0
- package/dist/lib-cjs/api/classes/element.d.ts +12 -16
- package/dist/lib-cjs/api/classes/element.js +125 -180
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/event.d.ts +1 -15
- package/dist/lib-cjs/api/classes/event.js +1 -15
- package/dist/lib-cjs/api/classes/event.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameter.d.ts +7 -101
- package/dist/lib-cjs/api/classes/parameter.js +21 -141
- package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameterObservable.js +36 -11
- package/dist/lib-cjs/api/classes/parameterObservable.js.map +1 -1
- package/dist/lib-cjs/api/classes/variant.d.ts +14 -48
- package/dist/lib-cjs/api/classes/variant.js +56 -315
- package/dist/lib-cjs/api/classes/variant.js.map +1 -1
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +1 -5
- package/dist/lib-cjs/api/classes/variantInstance.js +0 -10
- package/dist/lib-cjs/api/classes/variantInstance.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewer.d.ts +1 -0
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerLight.js +27 -19
- package/dist/lib-cjs/api/classes/viewerLight.js.map +1 -1
- package/dist/lib-cjs/api/internal/sceneSetup.d.ts +1 -5
- package/dist/lib-cjs/api/internal/sceneSetup.js +71 -75
- package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +4 -51
- package/dist/lib-cjs/api/util/babylonHelper.js +8 -141
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +11 -53
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +8 -4
- package/dist/lib-cjs/api/util/resourceHelper.js +25 -59
- package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
- package/dist/lib-cjs/index.d.ts +22 -24
- package/dist/lib-cjs/index.js +38 -42
- package/dist/lib-cjs/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/classes/element.ts +112 -133
- package/src/api/classes/{parameterizable.ts → elementParameterizable.ts} +1 -12
- package/src/api/classes/event.ts +1 -16
- package/src/api/classes/parameter.ts +22 -153
- package/src/api/classes/parameterObservable.ts +31 -9
- package/src/api/classes/variant.ts +51 -184
- package/src/api/classes/variantInstance.ts +1 -8
- package/src/api/classes/viewer.ts +1 -0
- package/src/api/internal/sceneSetup.ts +109 -99
- package/src/api/util/babylonHelper.ts +9 -153
- package/src/api/util/globalTypes.ts +13 -64
- package/src/api/util/resourceHelper.ts +24 -26
- package/src/dev.ts +7 -5
- package/src/index.ts +23 -27
- package/src/pagesconfig.json +13 -8
- package/dist/lib-cjs/api/emitter.d.ts +0 -35
- package/dist/lib-cjs/api/emitter.js +0 -61
- package/dist/lib-cjs/api/emitter.js.map +0 -1
- package/src/api/classes/variantParameterizable.ts +0 -73
- package/src/api/classes/viewerLight.ts +0 -326
- package/src/api/util/stringHelper.ts +0 -26
|
@@ -308,26 +308,12 @@ var Event = /** @class */ (function () {
|
|
|
308
308
|
* * {@link Element}
|
|
309
309
|
*
|
|
310
310
|
* Payload:
|
|
311
|
-
* *
|
|
311
|
+
* * variant: {@link Element}
|
|
312
312
|
* * parameter: string
|
|
313
313
|
* * oldValue: string
|
|
314
314
|
* * newValue: string
|
|
315
315
|
*/
|
|
316
316
|
Event.ELEMENT_PARAMETER_COMMITTED = 'elementParameterCommitted';
|
|
317
|
-
/**
|
|
318
|
-
* Fired after a parameter on an {@link ViewerLight} has been committed.
|
|
319
|
-
*
|
|
320
|
-
* Scopes:
|
|
321
|
-
* * Global
|
|
322
|
-
* * {@link ViewerLight}
|
|
323
|
-
*
|
|
324
|
-
* Payload:
|
|
325
|
-
* * light: {@link ViewerLight}
|
|
326
|
-
* * parameter: string
|
|
327
|
-
* * oldValue: string
|
|
328
|
-
* * newValue: string
|
|
329
|
-
*/
|
|
330
|
-
Event.VIEWER_LIGHT_PARAMETER_COMMITTED = 'viewerLightParameterCommitted';
|
|
331
317
|
/**
|
|
332
318
|
* Fired after a parameter on an {@link SceneManager} has been committed.
|
|
333
319
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../src/api/classes/event.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,uCAAqC;AAErC,iBAAiB;AACJ,QAAA,OAAO,GAAG,IAAI,4BAAY,EAAE,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAEC;;OAEG;IACH;IAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../src/api/classes/event.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,uCAAqC;AAErC,iBAAiB;AACJ,QAAA,OAAO,GAAG,IAAI,4BAAY,EAAE,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAEC;;OAEG;IACH;IAAuB,CAAC;IAkRxB,sBAAkB,YAAG;QAHrB;;WAEG;aACH;YACC,IAAM,GAAG,GAAa,EAAE,CAAC;YACzB,KAAK,IAAM,OAAK,IAAI,KAAK,EAAG;gBAC3B,IAAM,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAK,CAAC,CAAC;gBAC/D,IAAI,OAAK,CAAC,WAAW,EAAE,KAAK,OAAK,IAAI,QAAQ,IAAI,oBAAQ,CAAE,QAAQ,CAAC,KAAK,CAAE,EAAG;oBAC7E,GAAG,CAAC,IAAI,CAAE,QAAQ,CAAC,KAAK,CAAE,CAAC;iBAC3B;aACD;YACD,OAAO,GAAG,CAAC;QACZ,CAAC;;;OAAA;IAKD,sB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qBAAe,GAAG,gBAAgB,CAAC;IAC1D;;;;;;;;;OASG;IACoB,uBAAiB,GAAG,kBAAkB,CAAC;IAE9D;;;;;;;;;OASG;IACoB,oBAAc,GAAG,eAAe,CAAC;IAExD;;;;;;;;;OASG;IACoB,oBAAc,GAAG,eAAe,CAAC;IAExD;;;;;;;;;;;;OAYG;IACoB,iCAA2B,GAAG,2BAA2B,CAAC;IAEjF;;;;;;;;;;;;OAYG;IACoB,qCAA+B,GAAG,8BAA8B,CAAC;IAExF;;;;;;;;;OASG;IACoB,8BAAwB,GAAG,wBAAwB,CAAC;IAC3E;;;;;;;;;;OAUG;IACoB,iCAA2B,GAAG,2BAA2B,CAAC;IACjF;;;;;;;;;OASG;IACoB,6BAAuB,GAAG,uBAAuB,CAAC;IACzE;;;;;;;;;OASG;IACoB,gCAA0B,GAAG,0BAA0B,CAAC;IAE/E;;;;;;;;;;;;OAYG;IACoB,iCAA2B,GAAG,2BAA2B,CAAC;IAEjF;;;;;;;;;;;;OAYG;IACoB,+BAAyB,GAAG,yBAAyB,CAAC;IAE7E;;;;;;;;;OASG;IACoB,qBAAe,GAAG,gBAAgB,CAAC;IAE1D;;;;;;;;;;;OAWG;IACoB,iBAAW,GAAG,YAAY,CAAC;IA4CnD,YAAC;CAAA,AA9TD,IA8TC;AA9TY,sBAAK"}
|
|
@@ -11,19 +11,18 @@ export declare class Parameter {
|
|
|
11
11
|
*/
|
|
12
12
|
private constructor();
|
|
13
13
|
/**
|
|
14
|
-
* Mutates the visibility. Helper methods are {@link
|
|
15
|
-
* {@link
|
|
14
|
+
* Mutates the visibility. Helper methods are {@link ElementParameterizable.show} and
|
|
15
|
+
* {@link ElementParameterizable.hide}. Getter and setter is {@link ElementParameterizable.visible}.
|
|
16
16
|
*
|
|
17
17
|
* Scopes:
|
|
18
18
|
* * {@link Element}
|
|
19
19
|
* * {@link Variant}
|
|
20
|
-
* * {@link ViewerLight} Available for all light types
|
|
21
20
|
*
|
|
22
21
|
* @parser {@link parseBoolean}
|
|
23
22
|
*/
|
|
24
23
|
static readonly VISIBLE = "visible";
|
|
25
24
|
/**
|
|
26
|
-
* Stretches or compresses some meshes. Getter and setter is {@link
|
|
25
|
+
* Stretches or compresses some meshes. Getter and setter is {@link ElementParameterizable.scaling}.
|
|
27
26
|
*
|
|
28
27
|
* Scopes:
|
|
29
28
|
* * {@link Element}
|
|
@@ -33,7 +32,7 @@ export declare class Parameter {
|
|
|
33
32
|
*/
|
|
34
33
|
static readonly SCALING = "scaling";
|
|
35
34
|
/**
|
|
36
|
-
* Mutates the material. Getter and setter is {@link
|
|
35
|
+
* Mutates the material. Getter and setter is {@link ElementParameterizable.material}. The value of this parameter
|
|
37
36
|
* represents the ID of a baked-in glTF or custom created material in the {@link Variant} tree.
|
|
38
37
|
*
|
|
39
38
|
* Scopes:
|
|
@@ -94,7 +93,7 @@ export declare class Parameter {
|
|
|
94
93
|
*/
|
|
95
94
|
static readonly HIGHLIGHT_COLOR = "highlight.color";
|
|
96
95
|
/**
|
|
97
|
-
* Mutates the highlighted state. Getter and setter is {@link
|
|
96
|
+
* Mutates the highlighted state. Getter and setter is {@link ElementParameterizable.highlighted}.
|
|
98
97
|
*
|
|
99
98
|
* Scopes:
|
|
100
99
|
* * {@link Element}
|
|
@@ -104,18 +103,17 @@ export declare class Parameter {
|
|
|
104
103
|
*/
|
|
105
104
|
static readonly HIGHLIGHTED = "highlighted";
|
|
106
105
|
/**
|
|
107
|
-
* Mutates the position relative to its origin position. Getter and setter is {@link
|
|
106
|
+
* Mutates the position relative to its origin position. Getter and setter is {@link ElementParameterizable.position}.
|
|
108
107
|
*
|
|
109
108
|
* Scopes:
|
|
110
109
|
* * {@link Element}
|
|
111
110
|
* * {@link Variant}
|
|
112
|
-
* * {@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)
|
|
113
111
|
*
|
|
114
112
|
* @parser {@link parseVector}
|
|
115
113
|
*/
|
|
116
114
|
static readonly POSITION = "position";
|
|
117
115
|
/**
|
|
118
|
-
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link
|
|
116
|
+
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link ElementParameterizable.rotation}.
|
|
119
117
|
*
|
|
120
118
|
* Scopes:
|
|
121
119
|
* * {@link Element}
|
|
@@ -124,90 +122,6 @@ export declare class Parameter {
|
|
|
124
122
|
* @parser {@link parseRotation}
|
|
125
123
|
*/
|
|
126
124
|
static readonly ROTATION = "rotation";
|
|
127
|
-
/**
|
|
128
|
-
* Mutates whether a shadow should be casted or not.
|
|
129
|
-
*
|
|
130
|
-
* Scopes:
|
|
131
|
-
* * {@link Element}
|
|
132
|
-
* * {@link Variant}
|
|
133
|
-
*
|
|
134
|
-
* @parser {@link parseBoolean}
|
|
135
|
-
*/
|
|
136
|
-
static readonly CAST_SHADOW = "castShadow";
|
|
137
|
-
/**
|
|
138
|
-
* Mutates from which lights a shadow should be casted.
|
|
139
|
-
*
|
|
140
|
-
* Scopes:
|
|
141
|
-
* * {@link Element}
|
|
142
|
-
* * {@link Variant}
|
|
143
|
-
*
|
|
144
|
-
* @parser {@link parseCommaSeparatedList}
|
|
145
|
-
*/
|
|
146
|
-
static readonly CAST_SHADOW_FROM_LIGHTS = "castShadow.fromLights";
|
|
147
|
-
/**
|
|
148
|
-
* Mutates whether to receive shadows or not.
|
|
149
|
-
*
|
|
150
|
-
* Scopes:
|
|
151
|
-
* * {@link Element}
|
|
152
|
-
* * {@link Variant}
|
|
153
|
-
*
|
|
154
|
-
* @parser {@link parseBoolean}
|
|
155
|
-
*/
|
|
156
|
-
static readonly RECEIVE_SHADOWS = "receiveShadows";
|
|
157
|
-
/**
|
|
158
|
-
* Mutates the intensity of Lights.
|
|
159
|
-
*
|
|
160
|
-
* Scopes:
|
|
161
|
-
* * {@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)
|
|
162
|
-
*
|
|
163
|
-
* @parser {@link parseNumber}
|
|
164
|
-
*/
|
|
165
|
-
static readonly INTENSITY = "intensity";
|
|
166
|
-
/**
|
|
167
|
-
* Mutates the direction of Lights.
|
|
168
|
-
*
|
|
169
|
-
* Scopes:
|
|
170
|
-
* * {@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)
|
|
171
|
-
*
|
|
172
|
-
* @parser {@link parseNumber}
|
|
173
|
-
*/
|
|
174
|
-
static readonly DIRECTION = "direction";
|
|
175
|
-
/**
|
|
176
|
-
* Mutates the angle of Lights.
|
|
177
|
-
*
|
|
178
|
-
* Scopes:
|
|
179
|
-
* * {@link ViewerLight} Available for [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#angle)
|
|
180
|
-
*
|
|
181
|
-
* @parser {@link parseNumber}
|
|
182
|
-
*/
|
|
183
|
-
static readonly ANGLE = "angle";
|
|
184
|
-
/**
|
|
185
|
-
* Mutates the exponent of Lights.
|
|
186
|
-
*
|
|
187
|
-
* Scopes:
|
|
188
|
-
* * {@link ViewerLight} Available for [SpotLight](https://doc.babylonjs.com/typedoc/classes/babylon.spotlight#exponent)
|
|
189
|
-
*
|
|
190
|
-
* @parser {@link parseNumber}
|
|
191
|
-
*/
|
|
192
|
-
static readonly EXPONENT = "exponent";
|
|
193
|
-
/**
|
|
194
|
-
* Mutates the diffuse color of Lights.
|
|
195
|
-
*
|
|
196
|
-
* Scopes:
|
|
197
|
-
* * {@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)
|
|
198
|
-
*
|
|
199
|
-
* @parser {@link parseNumber}
|
|
200
|
-
*/
|
|
201
|
-
static readonly DIFFUSE = "diffuse";
|
|
202
|
-
/**
|
|
203
|
-
* Mutates the specular color of Lights.
|
|
204
|
-
*
|
|
205
|
-
* Scopes:
|
|
206
|
-
* * {@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)
|
|
207
|
-
*
|
|
208
|
-
* @parser {@link parseNumber}
|
|
209
|
-
*/
|
|
210
|
-
static readonly SPECULAR = "specular";
|
|
211
125
|
/**
|
|
212
126
|
* The {@link ParameterDeclarations} for all parameters in this class.
|
|
213
127
|
*/
|
|
@@ -220,10 +134,6 @@ export declare class Parameter {
|
|
|
220
134
|
* All parameters defined in this class.
|
|
221
135
|
*/
|
|
222
136
|
static get all(): string[];
|
|
223
|
-
/**
|
|
224
|
-
* Parses given {@link ParameterBag} with given {@link ParameterDeclarations}.
|
|
225
|
-
*/
|
|
226
|
-
static parseFromDeclarations(declarations: ParameterDeclarations, parameterBag: ParameterBag): ParsedParameterBag;
|
|
227
137
|
/**
|
|
228
138
|
* Parses a string of format `'(x,y,z)'` to a `Vector3`.
|
|
229
139
|
*/
|
|
@@ -252,8 +162,4 @@ export declare class Parameter {
|
|
|
252
162
|
* Parses a number `string` to a `number`.
|
|
253
163
|
*/
|
|
254
164
|
static parseNumber(value: ParameterValue): number;
|
|
255
|
-
/**
|
|
256
|
-
* Parses a string with comma separated values to a list of strings.
|
|
257
|
-
*/
|
|
258
|
-
static parseCommaSeparatedList(value: ParameterValue): string[];
|
|
259
165
|
}
|
|
@@ -20,29 +20,20 @@ var Parameter = /** @class */ (function () {
|
|
|
20
20
|
* The {@link ParameterDeclarations} for all parameters in this class.
|
|
21
21
|
*/
|
|
22
22
|
get: function () {
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
return declarations;
|
|
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;
|
|
46
37
|
},
|
|
47
38
|
enumerable: false,
|
|
48
39
|
configurable: true
|
|
@@ -70,23 +61,6 @@ var Parameter = /** @class */ (function () {
|
|
|
70
61
|
enumerable: false,
|
|
71
62
|
configurable: true
|
|
72
63
|
});
|
|
73
|
-
/**
|
|
74
|
-
* Parses given {@link ParameterBag} with given {@link ParameterDeclarations}.
|
|
75
|
-
*/
|
|
76
|
-
Parameter.parseFromDeclarations = function (declarations, parameterBag) {
|
|
77
|
-
var parameters = {};
|
|
78
|
-
for (var parameter in parameterBag) {
|
|
79
|
-
var value = lodash_es_1.get(parameterBag, parameter);
|
|
80
|
-
parameters[parameter] = value;
|
|
81
|
-
var declaration = declarations[parameter];
|
|
82
|
-
if (declaration) {
|
|
83
|
-
if (!lodash_es_1.isEmpty(value) && declaration.parser) {
|
|
84
|
-
parameters[parameter] = declaration.parser(value);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return parameters;
|
|
89
|
-
};
|
|
90
64
|
/**
|
|
91
65
|
* Parses a string of format `'(x,y,z)'` to a `Vector3`.
|
|
92
66
|
*/
|
|
@@ -177,27 +151,18 @@ var Parameter = /** @class */ (function () {
|
|
|
177
151
|
return parseFloat(value.toString());
|
|
178
152
|
};
|
|
179
153
|
/**
|
|
180
|
-
*
|
|
181
|
-
|
|
182
|
-
Parameter.parseCommaSeparatedList = function (value) {
|
|
183
|
-
return value.toString()
|
|
184
|
-
.split(',')
|
|
185
|
-
.map(function (s) { return s.trim(); });
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Mutates the visibility. Helper methods are {@link VariantParameterizable.show} and
|
|
189
|
-
* {@link VariantParameterizable.hide}. Getter and setter is {@link VariantParameterizable.visible}.
|
|
154
|
+
* Mutates the visibility. Helper methods are {@link ElementParameterizable.show} and
|
|
155
|
+
* {@link ElementParameterizable.hide}. Getter and setter is {@link ElementParameterizable.visible}.
|
|
190
156
|
*
|
|
191
157
|
* Scopes:
|
|
192
158
|
* * {@link Element}
|
|
193
159
|
* * {@link Variant}
|
|
194
|
-
* * {@link ViewerLight} Available for all light types
|
|
195
160
|
*
|
|
196
161
|
* @parser {@link parseBoolean}
|
|
197
162
|
*/
|
|
198
163
|
Parameter.VISIBLE = 'visible';
|
|
199
164
|
/**
|
|
200
|
-
* Stretches or compresses some meshes. Getter and setter is {@link
|
|
165
|
+
* Stretches or compresses some meshes. Getter and setter is {@link ElementParameterizable.scaling}.
|
|
201
166
|
*
|
|
202
167
|
* Scopes:
|
|
203
168
|
* * {@link Element}
|
|
@@ -207,7 +172,7 @@ var Parameter = /** @class */ (function () {
|
|
|
207
172
|
*/
|
|
208
173
|
Parameter.SCALING = 'scaling';
|
|
209
174
|
/**
|
|
210
|
-
* Mutates the material. Getter and setter is {@link
|
|
175
|
+
* Mutates the material. Getter and setter is {@link ElementParameterizable.material}. The value of this parameter
|
|
211
176
|
* represents the ID of a baked-in glTF or custom created material in the {@link Variant} tree.
|
|
212
177
|
*
|
|
213
178
|
* Scopes:
|
|
@@ -268,7 +233,7 @@ var Parameter = /** @class */ (function () {
|
|
|
268
233
|
*/
|
|
269
234
|
Parameter.HIGHLIGHT_COLOR = 'highlight.color';
|
|
270
235
|
/**
|
|
271
|
-
* Mutates the highlighted state. Getter and setter is {@link
|
|
236
|
+
* Mutates the highlighted state. Getter and setter is {@link ElementParameterizable.highlighted}.
|
|
272
237
|
*
|
|
273
238
|
* Scopes:
|
|
274
239
|
* * {@link Element}
|
|
@@ -278,18 +243,17 @@ var Parameter = /** @class */ (function () {
|
|
|
278
243
|
*/
|
|
279
244
|
Parameter.HIGHLIGHTED = 'highlighted';
|
|
280
245
|
/**
|
|
281
|
-
* Mutates the position relative to its origin position. Getter and setter is {@link
|
|
246
|
+
* Mutates the position relative to its origin position. Getter and setter is {@link ElementParameterizable.position}.
|
|
282
247
|
*
|
|
283
248
|
* Scopes:
|
|
284
249
|
* * {@link Element}
|
|
285
250
|
* * {@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
251
|
*
|
|
288
252
|
* @parser {@link parseVector}
|
|
289
253
|
*/
|
|
290
254
|
Parameter.POSITION = 'position';
|
|
291
255
|
/**
|
|
292
|
-
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link
|
|
256
|
+
* Mutates the rotation relative to its origin rotation. Getter and setter is {@link ElementParameterizable.rotation}.
|
|
293
257
|
*
|
|
294
258
|
* Scopes:
|
|
295
259
|
* * {@link Element}
|
|
@@ -298,90 +262,6 @@ var Parameter = /** @class */ (function () {
|
|
|
298
262
|
* @parser {@link parseRotation}
|
|
299
263
|
*/
|
|
300
264
|
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
265
|
return Parameter;
|
|
386
266
|
}());
|
|
387
267
|
exports.Parameter = Parameter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../../../src/api/classes/parameter.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,iEAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../../../src/api/classes/parameter.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAC1D,iEAA4D;AAC5D,uCAA+C;AAG/C;;;;GAIG;AACH;IAEC;;OAEG;IACH;IAAuB,CAAC;IAgIxB,sBAAkB,yBAAY;QAH9B;;WAEG;aACH;YACC,IAAM,WAAW,GAA0B,EAAE,CAAC;YAC9C,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;YACrD,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YACpD,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;YACzD,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YACrD,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;YAC1D,WAAW,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAChE,WAAW,CAAC,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC/D,WAAW,CA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GAAG,mBAAmB,CAAC;IAE/D;;;;;;;;OAQG;IACoB,yBAAe,GAAG,iBAAiB,CAAC;IAE3D;;;;;;;;OAQG;IACoB,qBAAW,GAAG,aAAa,CAAC;IAEnD;;;;;;;;OAQG;IACoB,kBAAQ,GAAG,UAAU,CAAC;IAE7C;;;;;;;;OAQG;IACoB,kBAAQ,GAAG,UAAU,CAAC;IA0I9C,gBAAC;CAAA,AA1QD,IA0QC;AA1QY,8BAAS"}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ParameterObservable = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var lodash_es_1 = require("lodash-es");
|
|
6
|
-
var
|
|
6
|
+
var parameter_1 = require("../classes/parameter");
|
|
7
|
+
var resourceHelper_1 = require("../util/resourceHelper");
|
|
7
8
|
var eventBroadcaster_1 = require("./eventBroadcaster");
|
|
8
9
|
var ParameterObservable = /** @class */ (function (_super) {
|
|
9
10
|
tslib_1.__extends(ParameterObservable, _super);
|
|
@@ -14,7 +15,7 @@ var ParameterObservable = /** @class */ (function (_super) {
|
|
|
14
15
|
_this.parameters = {};
|
|
15
16
|
_this.parameterDeclaration = {};
|
|
16
17
|
_this.parameterObservers = new Map();
|
|
17
|
-
_this.uuid =
|
|
18
|
+
_this.uuid = resourceHelper_1.uuidv4();
|
|
18
19
|
_this.parameterDeclaration = lodash_es_1.merge(_this.parameterDeclaration, parameterDeclaration);
|
|
19
20
|
_this.parameters = lodash_es_1.merge(_this.parameters, parameters);
|
|
20
21
|
return _this;
|
|
@@ -74,17 +75,41 @@ var ParameterObservable = /** @class */ (function (_super) {
|
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
var declaration = parameterDeclaration[parameter];
|
|
77
|
-
var genericError = "\"" + value + "\" is not a valid value for parameter \"" + parameter + "\" of type
|
|
78
|
+
var genericError = "\"" + value + "\" is not a valid value for parameter \"" + parameter + "\" of type " +
|
|
78
79
|
("\"" + declaration.type + "\" for " + this.constructor.name + " \"" + this.id + "\".");
|
|
79
|
-
if (declaration.parser) {
|
|
80
|
-
try {
|
|
81
|
-
declaration.parser(value);
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
throw Error(genericError + e.message);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
80
|
switch (declaration.type) {
|
|
81
|
+
case 'boolean':
|
|
82
|
+
try {
|
|
83
|
+
parameter_1.Parameter.parseBoolean(value);
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
throw Error(genericError);
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case 'number':
|
|
90
|
+
try {
|
|
91
|
+
parameter_1.Parameter.parseNumber(value);
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
throw Error(genericError);
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
case 'color':
|
|
98
|
+
try {
|
|
99
|
+
parameter_1.Parameter.parseColor(value);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
throw Error(genericError + " It must be hex with leading \"#\" or of format \"(r,g,b)\".");
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case 'vector':
|
|
106
|
+
try {
|
|
107
|
+
parameter_1.Parameter.parseVector(value);
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
throw Error(genericError + " It must be of format \"(x,y,z)\".");
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
88
113
|
case 'select':
|
|
89
114
|
if (!declaration.options) {
|
|
90
115
|
throw Error("No options defined for parameter declaration \"" + parameter + "\"" +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterObservable.js","sourceRoot":"","sources":["../../../../src/api/classes/parameterObservable.ts"],"names":[],"mappings":";;;;AAAA,uCAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"parameterObservable.js","sourceRoot":"","sources":["../../../../src/api/classes/parameterOb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