@combeenation/3d-viewer 5.1.0-rc2 → 5.1.0-rc4
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/dist/lib-cjs/api/classes/element.js +4 -18
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/variant.js +37 -26
- package/dist/lib-cjs/api/classes/variant.js.map +1 -1
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +2 -2
- package/dist/lib-cjs/api/util/babylonHelper.js +20 -5
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +8 -1
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js +39 -2
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-es6/api/classes/animationInterface.d.ts +8 -0
- package/dist/lib-es6/api/classes/animationInterface.js +2 -0
- package/dist/lib-es6/api/classes/animationInterface.js.map +1 -0
- package/dist/lib-es6/api/classes/dottedPath.d.ts +79 -0
- package/dist/lib-es6/api/classes/dottedPath.js +185 -0
- package/dist/lib-es6/api/classes/dottedPath.js.map +1 -0
- package/dist/lib-es6/api/classes/element.d.ts +149 -0
- package/dist/lib-es6/api/classes/element.js +821 -0
- package/dist/lib-es6/api/classes/element.js.map +1 -0
- package/dist/lib-es6/api/classes/event.d.ts +326 -0
- package/dist/lib-es6/api/classes/event.js +369 -0
- package/dist/lib-es6/api/classes/event.js.map +1 -0
- package/dist/lib-es6/api/classes/eventBroadcaster.d.ts +26 -0
- package/dist/lib-es6/api/classes/eventBroadcaster.js +51 -0
- package/dist/lib-es6/api/classes/eventBroadcaster.js.map +1 -0
- package/dist/lib-es6/api/classes/parameter.d.ts +336 -0
- package/dist/lib-es6/api/classes/parameter.js +469 -0
- package/dist/lib-es6/api/classes/parameter.js.map +1 -0
- package/dist/lib-es6/api/classes/parameterObservable.d.ts +36 -0
- package/dist/lib-es6/api/classes/parameterObservable.js +99 -0
- package/dist/lib-es6/api/classes/parameterObservable.js.map +1 -0
- package/dist/lib-es6/api/classes/parameterizable.d.ts +15 -0
- package/dist/lib-es6/api/classes/parameterizable.js +147 -0
- package/dist/lib-es6/api/classes/parameterizable.js.map +1 -0
- package/dist/lib-es6/api/classes/placementAnimation.d.ts +44 -0
- package/dist/lib-es6/api/classes/placementAnimation.js +161 -0
- package/dist/lib-es6/api/classes/placementAnimation.js.map +1 -0
- package/dist/lib-es6/api/classes/variant.d.ts +234 -0
- package/dist/lib-es6/api/classes/variant.js +1199 -0
- package/dist/lib-es6/api/classes/variant.js.map +1 -0
- package/dist/lib-es6/api/classes/variantInstance.d.ts +45 -0
- package/dist/lib-es6/api/classes/variantInstance.js +106 -0
- package/dist/lib-es6/api/classes/variantInstance.js.map +1 -0
- package/dist/lib-es6/api/classes/variantParameterizable.d.ts +17 -0
- package/dist/lib-es6/api/classes/variantParameterizable.js +97 -0
- package/dist/lib-es6/api/classes/variantParameterizable.js.map +1 -0
- package/dist/lib-es6/api/classes/viewer.d.ts +184 -0
- package/dist/lib-es6/api/classes/viewer.js +729 -0
- package/dist/lib-es6/api/classes/viewer.js.map +1 -0
- package/dist/lib-es6/api/classes/viewerLight.d.ts +66 -0
- package/dist/lib-es6/api/classes/viewerLight.js +390 -0
- package/dist/lib-es6/api/classes/viewerLight.js.map +1 -0
- package/dist/lib-es6/api/internal/debugViewer.d.ts +13 -0
- package/dist/lib-es6/api/internal/debugViewer.js +84 -0
- package/dist/lib-es6/api/internal/debugViewer.js.map +1 -0
- package/dist/lib-es6/api/internal/lensRendering.d.ts +8 -0
- package/dist/lib-es6/api/internal/lensRendering.js +9 -0
- package/dist/lib-es6/api/internal/lensRendering.js.map +1 -0
- package/dist/lib-es6/api/internal/sceneSetup.d.ts +13 -0
- package/dist/lib-es6/api/internal/sceneSetup.js +234 -0
- package/dist/lib-es6/api/internal/sceneSetup.js.map +1 -0
- package/dist/lib-es6/api/manager/animationManager.d.ts +29 -0
- package/dist/lib-es6/api/manager/animationManager.js +128 -0
- package/dist/lib-es6/api/manager/animationManager.js.map +1 -0
- package/dist/lib-es6/api/manager/gltfExportManager.d.ts +65 -0
- package/dist/lib-es6/api/manager/gltfExportManager.js +221 -0
- package/dist/lib-es6/api/manager/gltfExportManager.js.map +1 -0
- package/dist/lib-es6/api/manager/sceneManager.d.ts +31 -0
- package/dist/lib-es6/api/manager/sceneManager.js +150 -0
- package/dist/lib-es6/api/manager/sceneManager.js.map +1 -0
- package/dist/lib-es6/api/manager/variantInstanceManager.d.ts +92 -0
- package/dist/lib-es6/api/manager/variantInstanceManager.js +333 -0
- package/dist/lib-es6/api/manager/variantInstanceManager.js.map +1 -0
- package/dist/lib-es6/api/store/specStorage.d.ts +24 -0
- package/dist/lib-es6/api/store/specStorage.js +49 -0
- package/dist/lib-es6/api/store/specStorage.js.map +1 -0
- package/dist/lib-es6/api/util/babylonHelper.d.ts +174 -0
- package/dist/lib-es6/api/util/babylonHelper.js +582 -0
- package/dist/lib-es6/api/util/babylonHelper.js.map +1 -0
- package/dist/lib-es6/api/util/globalTypes.d.ts +366 -0
- package/dist/lib-es6/api/util/globalTypes.js +2 -0
- package/dist/lib-es6/api/util/globalTypes.js.map +1 -0
- package/dist/lib-es6/api/util/resourceHelper.d.ts +58 -0
- package/dist/lib-es6/api/util/resourceHelper.js +248 -0
- package/dist/lib-es6/api/util/resourceHelper.js.map +1 -0
- package/dist/lib-es6/api/util/sceneLoaderHelper.d.ts +35 -0
- package/dist/lib-es6/api/util/sceneLoaderHelper.js +134 -0
- package/dist/lib-es6/api/util/sceneLoaderHelper.js.map +1 -0
- package/dist/lib-es6/api/util/stringHelper.d.ts +9 -0
- package/dist/lib-es6/api/util/stringHelper.js +22 -0
- package/dist/lib-es6/api/util/stringHelper.js.map +1 -0
- package/dist/lib-es6/api/util/structureHelper.d.ts +9 -0
- package/dist/lib-es6/api/util/structureHelper.js +46 -0
- package/dist/lib-es6/api/util/structureHelper.js.map +1 -0
- package/dist/lib-es6/buildinfo.json +3 -0
- package/dist/lib-es6/index.d.ts +49 -0
- package/dist/lib-es6/index.js +51 -0
- package/dist/lib-es6/index.js.map +1 -0
- package/package.json +6 -6
- package/src/api/classes/element.ts +4 -23
- package/src/api/classes/variant.ts +22 -3
- package/src/api/util/babylonHelper.ts +20 -6
- package/src/api/util/sceneLoaderHelper.ts +48 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { Parameter } from './parameter';
|
|
3
|
+
import { ParameterObservable } from './parameterObservable';
|
|
4
|
+
var Parameterizable = /** @class */ (function (_super) {
|
|
5
|
+
__extends(Parameterizable, _super);
|
|
6
|
+
function Parameterizable() {
|
|
7
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
8
|
+
_this.parameterDeclaration = Parameter.declarations;
|
|
9
|
+
return _this;
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(Parameterizable.prototype, "visible", {
|
|
12
|
+
get: function () {
|
|
13
|
+
if (!(Parameter.VISIBLE in this.parameters)) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
return Parameter.parseBoolean(this.parameters[Parameter.VISIBLE]);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
enumerable: false,
|
|
24
|
+
configurable: true
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(Parameterizable.prototype, "highlighted", {
|
|
27
|
+
get: function () {
|
|
28
|
+
if (!(Parameter.HIGHLIGHTED in this.parameters)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
return Parameter.parseBoolean(this.parameters[Parameter.HIGHLIGHTED]);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(Parameterizable.prototype, "material", {
|
|
42
|
+
get: function () {
|
|
43
|
+
if (!(Parameter.MATERIAL in this.parameters)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return this.parameters[Parameter.MATERIAL].toString();
|
|
47
|
+
},
|
|
48
|
+
enumerable: false,
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(Parameterizable.prototype, "scaling", {
|
|
52
|
+
get: function () {
|
|
53
|
+
if (!(Parameter.SCALING in this.parameters)) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return this.parameters[Parameter.SCALING].toString();
|
|
57
|
+
},
|
|
58
|
+
enumerable: false,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(Parameterizable.prototype, "position", {
|
|
62
|
+
get: function () {
|
|
63
|
+
if (!(Parameter.POSITION in this.parameters)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return this.parameters[Parameter.POSITION].toString();
|
|
67
|
+
},
|
|
68
|
+
enumerable: false,
|
|
69
|
+
configurable: true
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(Parameterizable.prototype, "rotation", {
|
|
72
|
+
get: function () {
|
|
73
|
+
if (!(Parameter.ROTATION in this.parameters)) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return this.parameters[Parameter.ROTATION].toString();
|
|
77
|
+
},
|
|
78
|
+
enumerable: false,
|
|
79
|
+
configurable: true
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(Parameterizable.prototype, "castShadow", {
|
|
82
|
+
get: function () {
|
|
83
|
+
if (!(Parameter.CAST_SHADOW in this.parameters)) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
return Parameter.parseBoolean(this.parameters[Parameter.CAST_SHADOW]);
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
enumerable: false,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
Parameterizable.prototype.show = function () {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0: return [4 /*yield*/, this.commitParameter(Parameter.VISIBLE, true)];
|
|
101
|
+
case 1:
|
|
102
|
+
_a.sent();
|
|
103
|
+
return [2 /*return*/, this];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
Parameterizable.prototype.hide = function () {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
switch (_a.label) {
|
|
112
|
+
case 0: return [4 /*yield*/, this.commitParameter(Parameter.VISIBLE, false)];
|
|
113
|
+
case 1:
|
|
114
|
+
_a.sent();
|
|
115
|
+
return [2 /*return*/, this];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
Parameterizable.prototype.toggle = function () {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
switch (_a.label) {
|
|
124
|
+
case 0: return [4 /*yield*/, this.commitParameter(Parameter.VISIBLE, !this.visible)];
|
|
125
|
+
case 1:
|
|
126
|
+
_a.sent();
|
|
127
|
+
return [2 /*return*/, this];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
Parameterizable.prototype.toggleHighlight = function () {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0: return [4 /*yield*/, this.commitParameter(Parameter.HIGHLIGHTED, !this.highlighted)];
|
|
137
|
+
case 1:
|
|
138
|
+
_a.sent();
|
|
139
|
+
return [2 /*return*/, this];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
return Parameterizable;
|
|
145
|
+
}(ParameterObservable));
|
|
146
|
+
export { Parameterizable };
|
|
147
|
+
//# sourceMappingURL=parameterizable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameterizable.js","sourceRoot":"","sources":["../../../../src/api/classes/parameterizable.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;IAA8C,mCAAmB;IAAjE;QAAA,qEAmFC;QAlFW,0BAAoB,GAA0B,SAAS,CAAC,YAAY,CAAC;;IAkFjF,CAAC;IAhFC,sBAAI,oCAAO;aAAX;YACE,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;gBAC3C,OAAO,SAAS,CAAC;aAClB;YACD,IAAI;gBACF,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;aACnE;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,SAAS,CAAC;aAClB;QACH,CAAC;;;OAAA;IAED,sBAAI,wCAAW;aAAf;YACE,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;gBAC/C,OAAO,SAAS,CAAC;aAClB;YACD,IAAI;gBACF,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;aACvE;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO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W,CAAC,CAAC,CAAC;aACvE;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,SAAS,CAAC;aAClB;QACH,CAAC;;;OAAA;IAEY,8BAAI,GAAjB;;;;4BACE,qBAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,EAAA;;wBAAnD,SAAmD,CAAC;wBACpD,sBAAO,IAAI,EAAC;;;;KACb;IAEY,8BAAI,GAAjB;;;;4BACE,qBAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAA;;wBAApD,SAAoD,CAAC;wBACrD,sBAAO,IAAI,EAAC;;;;KACb;IAEY,gCAAM,GAAnB;;;;4BACE,qBAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAA5D,SAA4D,CAAC;wBAC7D,sBAAO,IAAI,EAAC;;;;KACb;IAEY,yCAAe,GAA5B;;;;4BACE,qBAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAA;;wBAApE,SAAoE,CAAC;wBACrE,sBAAO,IAAI,EAAC;;;;KACb;IACH,sBAAC;AAAD,CAAC,AAnFD,CAA8C,mBAAmB,GAmFhE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="gsap" />
|
|
2
|
+
/**
|
|
3
|
+
* An {@link PlacementAnimation} handling `Tweens` of the `GSAP` API using configured {@link PlacementDefinition}s
|
|
4
|
+
* and {@link AnimationDefinition}s. It mutates the attributes in the given {@link PlacementDefinition} with the given
|
|
5
|
+
* {@link AnimationDefinition}. The latter can be anything the `GSAP` allows in its API. Please consider using the
|
|
6
|
+
* API of the {@link AnimationManager} to handle instances of this class in your consuming project.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PlacementAnimation implements AnimationInterface {
|
|
9
|
+
readonly mutable: object;
|
|
10
|
+
protected _placement: PlacementDefinition | string;
|
|
11
|
+
protected _animation?: string | AnimationDefinition | undefined;
|
|
12
|
+
protected _placementDefinition: PlacementDefinition;
|
|
13
|
+
protected _animationDefinition: AnimationDefinition;
|
|
14
|
+
protected _timeline: GSAPTimeline;
|
|
15
|
+
/**
|
|
16
|
+
* Constructor.
|
|
17
|
+
*/
|
|
18
|
+
constructor(mutable: object, _placement: PlacementDefinition | string, _animation?: string | AnimationDefinition | undefined);
|
|
19
|
+
/**
|
|
20
|
+
* Plays all `Tweens` of this {@link PlacementAnimation}.
|
|
21
|
+
*/
|
|
22
|
+
play(): Promise<AnimationInterface>;
|
|
23
|
+
/**
|
|
24
|
+
* Pause all `Tweens` of this {@link PlacementAnimation}.
|
|
25
|
+
*/
|
|
26
|
+
pause(): AnimationInterface;
|
|
27
|
+
/**
|
|
28
|
+
* Kills all `Tweens` of this {@link PlacementAnimation}.
|
|
29
|
+
*/
|
|
30
|
+
kill(): AnimationInterface;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
33
|
+
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
34
|
+
*/
|
|
35
|
+
protected prepareAnimationDefinition(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
38
|
+
*/
|
|
39
|
+
protected preparePlacementDefinition(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Creates `Tweens` for the {@link PlacementDefinition} configured for this {@link PlacementAnimation}.
|
|
42
|
+
*/
|
|
43
|
+
protected createTweens(): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { __awaiter, __generator, __rest } from "tslib";
|
|
2
|
+
import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera';
|
|
3
|
+
import { Vector3 } from '@babylonjs/core/Maths/math.vector';
|
|
4
|
+
import { gsap } from 'gsap';
|
|
5
|
+
import { cloneDeep, get, isString, merge, set } from 'lodash-es';
|
|
6
|
+
import { Parameter } from '../classes/parameter';
|
|
7
|
+
import { SpecStorage } from '../store/specStorage';
|
|
8
|
+
/**
|
|
9
|
+
* An {@link PlacementAnimation} handling `Tweens` of the `GSAP` API using configured {@link PlacementDefinition}s
|
|
10
|
+
* and {@link AnimationDefinition}s. It mutates the attributes in the given {@link PlacementDefinition} with the given
|
|
11
|
+
* {@link AnimationDefinition}. The latter can be anything the `GSAP` allows in its API. Please consider using the
|
|
12
|
+
* API of the {@link AnimationManager} to handle instances of this class in your consuming project.
|
|
13
|
+
*/
|
|
14
|
+
var PlacementAnimation = /** @class */ (function () {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor.
|
|
17
|
+
*/
|
|
18
|
+
function PlacementAnimation(mutable, _placement, _animation) {
|
|
19
|
+
var _a;
|
|
20
|
+
this.mutable = mutable;
|
|
21
|
+
this._placement = _placement;
|
|
22
|
+
this._animation = _animation;
|
|
23
|
+
if (isString(_placement)) {
|
|
24
|
+
var placementDefinitions = SpecStorage.get('scene.placements');
|
|
25
|
+
if (!placementDefinitions) {
|
|
26
|
+
throw new Error("No PlacementDefinitions defined in JSON structure.");
|
|
27
|
+
}
|
|
28
|
+
var placementDefinition = placementDefinitions[_placement];
|
|
29
|
+
if (!placementDefinition) {
|
|
30
|
+
throw new Error("PlacementDefinition \"" + _placement + "\" not defined in JSON structure.");
|
|
31
|
+
}
|
|
32
|
+
this._placementDefinition = cloneDeep(placementDefinition);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this._placementDefinition = cloneDeep(_placement);
|
|
36
|
+
}
|
|
37
|
+
if (isString(_animation)) {
|
|
38
|
+
var animationDefinition = (_a = SpecStorage.get('scene.animations')) === null || _a === void 0 ? void 0 : _a[_animation];
|
|
39
|
+
if (!animationDefinition) {
|
|
40
|
+
throw new Error("AnimationDefinition \"" + _animation + "\" not defined in JSON structure.");
|
|
41
|
+
}
|
|
42
|
+
this._animationDefinition = cloneDeep(animationDefinition);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this._animationDefinition = cloneDeep(_animation);
|
|
46
|
+
}
|
|
47
|
+
this.prepareAnimationDefinition();
|
|
48
|
+
// create (shallow) copy for GSAP which doesn't contain `shortestWay`,
|
|
49
|
+
// because that's not part of the original `TweenVars` input typing and therefore leads to warnings
|
|
50
|
+
var _b = this._animationDefinition, shortestWay = _b.shortestWay, gsapTweenVars = __rest(_b, ["shortestWay"]);
|
|
51
|
+
this._timeline = gsap.timeline({
|
|
52
|
+
defaults: gsapTweenVars,
|
|
53
|
+
paused: true,
|
|
54
|
+
});
|
|
55
|
+
this.preparePlacementDefinition();
|
|
56
|
+
this.createTweens();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Plays all `Tweens` of this {@link PlacementAnimation}.
|
|
60
|
+
*/
|
|
61
|
+
PlacementAnimation.prototype.play = function () {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0: return [4 /*yield*/, this._timeline.play().then()];
|
|
66
|
+
case 1:
|
|
67
|
+
_a.sent();
|
|
68
|
+
return [2 /*return*/, this];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Pause all `Tweens` of this {@link PlacementAnimation}.
|
|
75
|
+
*/
|
|
76
|
+
PlacementAnimation.prototype.pause = function () {
|
|
77
|
+
this._timeline.pause();
|
|
78
|
+
return this;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Kills all `Tweens` of this {@link PlacementAnimation}.
|
|
82
|
+
*/
|
|
83
|
+
PlacementAnimation.prototype.kill = function () {
|
|
84
|
+
this._timeline.kill();
|
|
85
|
+
return this;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
89
|
+
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
90
|
+
*/
|
|
91
|
+
PlacementAnimation.prototype.prepareAnimationDefinition = function () {
|
|
92
|
+
// create an animation definition if not available yet
|
|
93
|
+
this._animationDefinition = this._animationDefinition || {};
|
|
94
|
+
// parse shortest way flag or set to `true` if not configured
|
|
95
|
+
if (this._animationDefinition.shortestWay !== undefined) {
|
|
96
|
+
this._animationDefinition.shortestWay = Parameter.parseBoolean(this._animationDefinition.shortestWay);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this._animationDefinition.shortestWay = true;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
104
|
+
*/
|
|
105
|
+
PlacementAnimation.prototype.preparePlacementDefinition = function () {
|
|
106
|
+
var position = this._placementDefinition.position;
|
|
107
|
+
if (isString(position)) {
|
|
108
|
+
position = Parameter.parseVector(position);
|
|
109
|
+
this._placementDefinition.position = position;
|
|
110
|
+
}
|
|
111
|
+
if (this.mutable instanceof ArcRotateCamera) {
|
|
112
|
+
// parse the target
|
|
113
|
+
if (isString(this._placementDefinition.target)) {
|
|
114
|
+
this._placementDefinition.target = Parameter.parseVector(this._placementDefinition.target);
|
|
115
|
+
}
|
|
116
|
+
if (position) {
|
|
117
|
+
// parse the position and calculate alpha, beta and radius with a "ghost camera"
|
|
118
|
+
// @see https://www.babylonjs-playground.com/#4IVMG#0
|
|
119
|
+
var ghostCam = this.mutable.clone('ghost');
|
|
120
|
+
ghostCam.setPosition(position);
|
|
121
|
+
merge(this._placementDefinition, {
|
|
122
|
+
alpha: ghostCam.alpha,
|
|
123
|
+
beta: ghostCam.beta,
|
|
124
|
+
radius: ghostCam.radius,
|
|
125
|
+
});
|
|
126
|
+
delete this._placementDefinition.position;
|
|
127
|
+
ghostCam.dispose();
|
|
128
|
+
}
|
|
129
|
+
else if (this._animationDefinition.shortestWay && this._placementDefinition.alpha !== undefined) {
|
|
130
|
+
// transform the target's alpha value into the same turn as the current camera position to avoid movements > 360 degrees
|
|
131
|
+
var alphaGap = this.mutable.alpha - this._placementDefinition.alpha;
|
|
132
|
+
var cntTurns = Math.round(alphaGap / (2 * Math.PI));
|
|
133
|
+
this._placementDefinition.alpha += 2 * Math.PI * cntTurns;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Creates `Tweens` for the {@link PlacementDefinition} configured for this {@link PlacementAnimation}.
|
|
139
|
+
*/
|
|
140
|
+
PlacementAnimation.prototype.createTweens = function () {
|
|
141
|
+
for (var property in this._placementDefinition) {
|
|
142
|
+
var propertyValue = get(this._placementDefinition, property);
|
|
143
|
+
var tweenVars = {};
|
|
144
|
+
var _mutable = this.mutable;
|
|
145
|
+
if (propertyValue instanceof Vector3) {
|
|
146
|
+
// GSAP does not support mutation of complex objects, so we are forced
|
|
147
|
+
// to use the properties on the object as mutable directly and mutate
|
|
148
|
+
// the coordinates separately.
|
|
149
|
+
_mutable = get(this.mutable, property);
|
|
150
|
+
merge(tweenVars, { x: propertyValue.x, y: propertyValue.y, z: propertyValue.z });
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
set(tweenVars, property, propertyValue);
|
|
154
|
+
}
|
|
155
|
+
this._timeline.to(_mutable, tweenVars, 0); // Note: position 0 does the "parallel" stuff here
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return PlacementAnimation;
|
|
159
|
+
}());
|
|
160
|
+
export { PlacementAnimation };
|
|
161
|
+
//# sourceMappingURL=placementAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placementAnimation.js","sourceRoot":"","sources":["../../../../src/api/classes/placementAnimation.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC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
import '@babylonjs/core/Loading/Plugins/babylonFileLoader';
|
|
4
|
+
import { Material } from '@babylonjs/core/Materials/material';
|
|
5
|
+
import { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
6
|
+
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
7
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression';
|
|
8
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform';
|
|
9
|
+
import '@babylonjs/loaders/glTF/2.0/glTFLoader';
|
|
10
|
+
import { DottedPath } from './dottedPath';
|
|
11
|
+
import { Element } from './element';
|
|
12
|
+
import { Parameterizable } from './parameterizable';
|
|
13
|
+
import { ParameterObservable } from './parameterObservable';
|
|
14
|
+
import { VariantParameterizable } from './variantParameterizable';
|
|
15
|
+
import { Viewer } from './viewer';
|
|
16
|
+
import { ViewerLight } from './viewerLight';
|
|
17
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_basisu';
|
|
18
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_clearcoat';
|
|
19
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen';
|
|
20
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_ior';
|
|
21
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness';
|
|
22
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_specular';
|
|
23
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_translucency';
|
|
24
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_transmission';
|
|
25
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_unlit';
|
|
26
|
+
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants';
|
|
27
|
+
/**
|
|
28
|
+
* A concrete "Variant". Most of these are handled by either the {@link Viewer} or {@link VariantInstance}.
|
|
29
|
+
*/
|
|
30
|
+
export declare class Variant extends Parameterizable {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
protected readonly _structureJson: StructureJson;
|
|
33
|
+
readonly viewer: Viewer;
|
|
34
|
+
readonly parent?: Variant | undefined;
|
|
35
|
+
assetContainer: AssetContainer;
|
|
36
|
+
readonly elements: Element[];
|
|
37
|
+
readonly viewerLights: ViewerLight[];
|
|
38
|
+
structureJson: StructureJson;
|
|
39
|
+
protected _dottedNodes: Map<DottedPath, TransformNode> | undefined;
|
|
40
|
+
protected readonly _children: Map<string, Variant>;
|
|
41
|
+
protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
private parametersInitialized;
|
|
46
|
+
/**
|
|
47
|
+
* Constructor.
|
|
48
|
+
*/
|
|
49
|
+
protected constructor(name: string, _structureJson: StructureJson, viewer: Viewer, parent?: Variant | undefined);
|
|
50
|
+
/**
|
|
51
|
+
* Creates a {@link Variant} based on given parameters.
|
|
52
|
+
*
|
|
53
|
+
* @throws Error if "gltf" property is provided without a filename
|
|
54
|
+
*/
|
|
55
|
+
static create(name: string, structureJson: StructureJson, viewer: Viewer, parent?: Variant): Promise<Variant>;
|
|
56
|
+
/**
|
|
57
|
+
* The ancestor {@link Variant}s ordered from top to bottom in the built tree.
|
|
58
|
+
*/
|
|
59
|
+
get ancestors(): Variant[];
|
|
60
|
+
/**
|
|
61
|
+
* The root {@link Variant}.
|
|
62
|
+
*/
|
|
63
|
+
get root(): Variant;
|
|
64
|
+
/**
|
|
65
|
+
* The {@link DottedPath} in the built tree of {@link Variant}s.
|
|
66
|
+
* E.g. "_.top-1.sub-2.sub-sub-3"
|
|
67
|
+
*/
|
|
68
|
+
get dottedPath(): DottedPath;
|
|
69
|
+
/**
|
|
70
|
+
* The id representing a {@link DottedPath}.
|
|
71
|
+
*/
|
|
72
|
+
get id(): string;
|
|
73
|
+
/**
|
|
74
|
+
* The defined glTF Asset.
|
|
75
|
+
*/
|
|
76
|
+
get glTF(): Asset | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* The defined glTF URI.
|
|
79
|
+
*/
|
|
80
|
+
get glTFUri(): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The inherited defined glTF URI.
|
|
83
|
+
*/
|
|
84
|
+
get inheritedGlTFUri(): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* The TransformNodes of the {@link Variant}.
|
|
87
|
+
*/
|
|
88
|
+
get nodes(): TransformNode[];
|
|
89
|
+
/**
|
|
90
|
+
* The {@link ViewerLight}s of the {@link Variant}.
|
|
91
|
+
*/
|
|
92
|
+
get lights(): Light[];
|
|
93
|
+
/**
|
|
94
|
+
* All TransformNodes of the {@link Variant} mapped flat with a {@link DottedPath}.
|
|
95
|
+
*/
|
|
96
|
+
get dottedNodes(): Map<DottedPath, TransformNode>;
|
|
97
|
+
/**
|
|
98
|
+
* The Materials of the {@link Variant}.
|
|
99
|
+
*/
|
|
100
|
+
get materials(): Material[];
|
|
101
|
+
/**
|
|
102
|
+
* All {@link Element}s from this {@link Variant}'s parents.
|
|
103
|
+
*/
|
|
104
|
+
get inheritedElements(): Element[];
|
|
105
|
+
/**
|
|
106
|
+
* All {@link ViewerLight}s inherited from this {@link Variant}'s parents.
|
|
107
|
+
*/
|
|
108
|
+
get inheritedViewerLights(): ViewerLight[];
|
|
109
|
+
/**
|
|
110
|
+
* All TransformNodes inherited from this {@link Variant}'s parents.
|
|
111
|
+
*/
|
|
112
|
+
get inheritedNodes(): TransformNode[];
|
|
113
|
+
/**
|
|
114
|
+
* All TransformNodes inherited from this {@link Variant}'s parents mapped flat with a {@link DottedPath}.
|
|
115
|
+
*/
|
|
116
|
+
get inheritedDottedNodes(): Map<DottedPath, TransformNode>;
|
|
117
|
+
/**
|
|
118
|
+
* All Lights inherited from this {@link Variant}'s parents.
|
|
119
|
+
*/
|
|
120
|
+
get inheritedLights(): Light[];
|
|
121
|
+
/**
|
|
122
|
+
* The {@link ParameterDeclarations} inherited from this {@link Variant}'s parents.
|
|
123
|
+
*/
|
|
124
|
+
get inheritedParameterDeclaration(): ParameterDeclarations;
|
|
125
|
+
/**
|
|
126
|
+
* The {@link ParameterBag} inherited from this {@link Variant}'s parents.
|
|
127
|
+
*/
|
|
128
|
+
get inheritedParameters(): ParameterBag;
|
|
129
|
+
/**
|
|
130
|
+
* All Materials from this {@link Variant}'s parents.
|
|
131
|
+
*/
|
|
132
|
+
get inheritedMaterials(): Material[];
|
|
133
|
+
/**
|
|
134
|
+
* Gets the direct children of the current {@link Variant}.
|
|
135
|
+
*/
|
|
136
|
+
getChildren(): Promise<Variant[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Gets a descendant {@link Variant} of the current {@link Variant} relative to its {@link DottedPath}.
|
|
139
|
+
* If you have the dotted path `_.product_x.variant_blue.with_yellow_highlight` in a tree and you operate on the
|
|
140
|
+
* `product_x`, you can call `this.getDescendant('variant_blue.with_yellow_highlight')` to get the lowermost
|
|
141
|
+
* {@link Variant}.
|
|
142
|
+
*/
|
|
143
|
+
getDescendant(dottedPath: DottedPathArgument): Promise<Variant>;
|
|
144
|
+
/**
|
|
145
|
+
* Gets the desired {@link Element} of the current {@link Variant} relative to its {@link DottedPath}.
|
|
146
|
+
* Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
|
|
147
|
+
*/
|
|
148
|
+
getElement(dottedPath: DottedPathArgument): Promise<Element>;
|
|
149
|
+
/**
|
|
150
|
+
* Gets the desired {@link ViewerLight} of the current {@link Variant} relative to its {@link DottedPath}.
|
|
151
|
+
* Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
|
|
152
|
+
*/
|
|
153
|
+
getViewerLight(dottedPath: DottedPathArgument): Promise<ViewerLight>;
|
|
154
|
+
/**
|
|
155
|
+
* A proxy for directly getting a Node from an {@link Element} by its {@link DottedPath}s.
|
|
156
|
+
*/
|
|
157
|
+
getNode(elementDottedPath: DottedPathArgument, nodeDottedPath: DottedPathArgument): Promise<TransformNode>;
|
|
158
|
+
/**
|
|
159
|
+
* A proxy for directly getting a Mesh from an {@link Element} by its {@link DottedPath}s.
|
|
160
|
+
*/
|
|
161
|
+
getMesh(elementDottedPath: DottedPathArgument, meshDottedPath: DottedPathArgument): Promise<Mesh | null>;
|
|
162
|
+
/**
|
|
163
|
+
* Gets the Material defined in one of the variants glTFs by its id.
|
|
164
|
+
*/
|
|
165
|
+
getMaterial(id: string): Material;
|
|
166
|
+
/**
|
|
167
|
+
* Creates a living clone of this {@link Variant}. Will clone all parent {@link Variant}s in tree.
|
|
168
|
+
*
|
|
169
|
+
* @emit {@link Event.VARIANT_CREATED}
|
|
170
|
+
* @ignore
|
|
171
|
+
*/
|
|
172
|
+
createLiving(parameters?: ParameterBag): Promise<Variant>;
|
|
173
|
+
/**
|
|
174
|
+
* Destroys this {@link Variant}, all parents and destroy the {@link Element}s.
|
|
175
|
+
*/
|
|
176
|
+
destroy(): Variant;
|
|
177
|
+
/**
|
|
178
|
+
* Places the given {@link ParameterBag} in the {@link Variant}'s parameters, replaces all patterns in the
|
|
179
|
+
* {@link StructureJson}, broadcasts all {@link ParameterObserver}s and delegates them to its {@link Element}s.
|
|
180
|
+
*
|
|
181
|
+
* @emit {@link Event.VARIANT_PARAMETER_COMMITTED}
|
|
182
|
+
*/
|
|
183
|
+
commitParameters(parameters?: ParameterBag): Promise<Variant>;
|
|
184
|
+
/**
|
|
185
|
+
* Adds an observer function for camera matrix changes for given `dottedPath` representing the {@link Element}
|
|
186
|
+
* and the `traceable`. The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
|
|
187
|
+
*/
|
|
188
|
+
addTraceableObserver(dottedPath: DottedPathArgument, observer: CallableFunction, payload?: any): Promise<Element>;
|
|
189
|
+
/**
|
|
190
|
+
* Loads {@link glTFUri} with assets, adds them to the {@link Variant}'s `assetContainer` and deactivates the meshes.
|
|
191
|
+
* (for further processing).
|
|
192
|
+
* @emits {@link Event.ASSET_LOADING_START}
|
|
193
|
+
* @emits {@link Event.ASSET_LOADING_END}
|
|
194
|
+
*/
|
|
195
|
+
protected loadAssets(): Promise<Variant>;
|
|
196
|
+
/**
|
|
197
|
+
* Commits given parameters to all {@link Element}s.
|
|
198
|
+
*/
|
|
199
|
+
protected commitParametersToElements(parameters: ParameterBag): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Commits given parameters to all {@link ViewerLight}s.
|
|
202
|
+
*/
|
|
203
|
+
protected commitParametersToViewerLights(parameters: ParameterBag): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Commits given parameters to a {@link VariantParameterizable} and updates the according definition with given
|
|
206
|
+
* key in the {@link StructureJson}. The `definitionKey` "elements" for example will update the definition in
|
|
207
|
+
* `this.structureJson.elements`.
|
|
208
|
+
*/
|
|
209
|
+
protected commitParametersToVariantParameterizable(parameters: ParameterBag, parameterizable: VariantParameterizable, definitionKey: string): Promise<ParameterObservable>;
|
|
210
|
+
/**
|
|
211
|
+
* Commits given {@link Parameter} to the {@link Variant}'s {@link Element}s.
|
|
212
|
+
*/
|
|
213
|
+
protected commitParameterToElements(parameter: string, value: ParameterValue): Promise<Variant>;
|
|
214
|
+
/**
|
|
215
|
+
* Commits given {@link Parameter} to the {@link Variant}'s {@link Element}s.
|
|
216
|
+
*/
|
|
217
|
+
protected commitParameterToViewerLights(parameter: string, value: ParameterValue): Promise<Variant>;
|
|
218
|
+
/**
|
|
219
|
+
* Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
|
|
220
|
+
*/
|
|
221
|
+
protected addParameterObservers(): Variant;
|
|
222
|
+
/**
|
|
223
|
+
* Creates {@link Element}s and clones nodes into them.
|
|
224
|
+
*/
|
|
225
|
+
protected createElements(): Promise<Variant>;
|
|
226
|
+
/**
|
|
227
|
+
* Creates {@link ViewerLight}s.
|
|
228
|
+
*/
|
|
229
|
+
protected createViewerLights(): Promise<Variant>;
|
|
230
|
+
/**
|
|
231
|
+
* Bootstrapping for parameters. It sets the `parametersInitialized` to true for all ancestors.
|
|
232
|
+
*/
|
|
233
|
+
protected bootstrapParameters(parameters?: ParameterBag): Promise<Variant>;
|
|
234
|
+
}
|