@combeenation/3d-viewer 4.0.0-rc1 → 4.1.0
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 +114 -114
- package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-cjs/api/classes/animationInterface.js +1 -1
- package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-cjs/api/classes/dottedPath.js +190 -190
- package/dist/lib-cjs/api/classes/element.d.ts +130 -130
- package/dist/lib-cjs/api/classes/element.js +746 -743
- 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 +326 -326
- package/dist/lib-cjs/api/classes/event.js +371 -371
- package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
- package/dist/lib-cjs/api/classes/parameter.d.ts +259 -259
- package/dist/lib-cjs/api/classes/parameter.js +387 -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 +101 -101
- package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +43 -38
- package/dist/lib-cjs/api/classes/placementAnimation.js +160 -149
- package/dist/lib-cjs/api/classes/placementAnimation.js.map +1 -1
- package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
- package/dist/lib-cjs/api/classes/variant.js +1147 -1147
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -45
- package/dist/lib-cjs/api/classes/variantInstance.js +108 -108
- package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-cjs/api/classes/variantParameterizable.js +99 -92
- package/dist/lib-cjs/api/classes/variantParameterizable.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewer.d.ts +131 -131
- package/dist/lib-cjs/api/classes/viewer.js +567 -567
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
- package/dist/lib-cjs/api/classes/viewerLight.js +392 -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 +10 -10
- package/dist/lib-cjs/api/internal/sceneSetup.js +231 -231
- 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/gltfExportManager.d.ts +35 -0
- package/dist/lib-cjs/api/manager/gltfExportManager.js +108 -0
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -0
- 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 +166 -175
- package/dist/lib-cjs/api/util/babylonHelper.js +500 -520
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +338 -333
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +53 -53
- package/dist/lib-cjs/api/util/resourceHelper.js +240 -240
- 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 +48 -48
- package/dist/lib-cjs/index.js +86 -86
- 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 +648 -644
- package/src/api/classes/event.ts +370 -370
- package/src/api/classes/eventBroadcaster.ts +54 -54
- package/src/api/classes/parameter.ts +408 -408
- package/src/api/classes/parameterObservable.ts +99 -99
- package/src/api/classes/parameterizable.ts +89 -89
- package/src/api/classes/placementAnimation.ts +157 -143
- package/src/api/classes/variant.ts +817 -817
- package/src/api/classes/variantInstance.ts +88 -88
- package/src/api/classes/variantParameterizable.ts +80 -73
- package/src/api/classes/viewer.ts +487 -487
- package/src/api/classes/viewerLight.ts +334 -330
- package/src/api/internal/debugViewer.ts +81 -81
- package/src/api/internal/lensRendering.ts +10 -10
- package/src/api/internal/sceneSetup.ts +193 -193
- 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 +534 -555
- package/src/api/util/globalTypes.ts +385 -379
- package/src/api/util/resourceHelper.ts +184 -184
- package/src/api/util/stringHelper.ts +25 -25
- package/src/buildinfo.json +2 -2
- package/src/commonjs.tsconfig.json +13 -13
- package/src/declaration.tsconfig.json +10 -10
- package/src/dev.ts +42 -42
- package/src/es6.tsconfig.json +13 -13
- package/src/index.ts +91 -91
- package/src/pagesconfig.json +65 -61
- package/src/tsconfig.json +43 -43
- package/src/tsconfig.types.json +9 -9
- package/src/types.d.ts +4 -4
- package/dist/webpack-stats.json +0 -0
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnimationManager = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var animation_1 = require("@babylonjs/core/Animations/animation");
|
|
6
|
-
//import { CustomEase } from 'gsap/CustomEase';
|
|
7
|
-
//import { ExpoScaleEase, RoughEase, SlowMo } from 'gsap/EasePack';
|
|
8
|
-
var lodash_es_1 = require("lodash-es");
|
|
9
|
-
var placementAnimation_1 = require("../classes/placementAnimation");
|
|
10
|
-
//gsap.registerPlugin( CustomEase, ExpoScaleEase, RoughEase, SlowMo );
|
|
11
|
-
var AnimationManager = /** @class */ (function () {
|
|
12
|
-
/**
|
|
13
|
-
* Constructor.
|
|
14
|
-
*/
|
|
15
|
-
function AnimationManager(scene) {
|
|
16
|
-
this.scene = scene;
|
|
17
|
-
this.animations = [];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates an {@link AnimationManager} based on given BabylonJS scene.
|
|
21
|
-
*/
|
|
22
|
-
AnimationManager.create = function (scene) {
|
|
23
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
24
|
-
return tslib_1.__generator(this, function (_b) {
|
|
25
|
-
return [2 /*return*/, new AnimationManager(scene)];
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated Use viewer.moveCameraTo().
|
|
31
|
-
*/
|
|
32
|
-
AnimationManager.prototype.resetCamera = function (animate) {
|
|
33
|
-
if (animate === void 0) { animate = false; }
|
|
34
|
-
//TODO currently only works for arcrotate. are there any other cameras?
|
|
35
|
-
var activeCamera = this.scene.activeCamera;
|
|
36
|
-
if (!activeCamera) {
|
|
37
|
-
throw new Error('There is no active camera');
|
|
38
|
-
}
|
|
39
|
-
var initAlpha = activeCamera.metadata.alpha;
|
|
40
|
-
var initBeta = activeCamera.metadata.beta;
|
|
41
|
-
var initRadius = activeCamera.metadata.radius;
|
|
42
|
-
if (animate) {
|
|
43
|
-
this.animateArcRotateCamera(initAlpha, initBeta, initRadius);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
activeCamera.alpha = initAlpha;
|
|
47
|
-
activeCamera.beta = initBeta;
|
|
48
|
-
activeCamera.radius = initRadius;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated Use viewer.moveCameraTo().
|
|
53
|
-
*/
|
|
54
|
-
AnimationManager.prototype.animateArcRotateCamera = function (targetAlpha, targetBeta, targetRadius) {
|
|
55
|
-
var activeCamera = this.scene.activeCamera;
|
|
56
|
-
if (!activeCamera) {
|
|
57
|
-
throw new Error('There is no active camera');
|
|
58
|
-
}
|
|
59
|
-
var alphaAnimation = new animation_1.Animation('alphaAnimation', 'alpha', 30, animation_1.Animation.ANIMATIONTYPE_FLOAT, animation_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
60
|
-
var betaAnimation = new animation_1.Animation('betaAnimation', 'beta', 30, animation_1.Animation.ANIMATIONTYPE_FLOAT, animation_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
61
|
-
var radiusAnimation = new animation_1.Animation('radiusAnimation', 'radius', 30, animation_1.Animation.ANIMATIONTYPE_FLOAT, animation_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
62
|
-
alphaAnimation.setKeys([{
|
|
63
|
-
frame: 0,
|
|
64
|
-
value: activeCamera.alpha
|
|
65
|
-
}, {
|
|
66
|
-
frame: 100,
|
|
67
|
-
value: targetAlpha
|
|
68
|
-
}]);
|
|
69
|
-
betaAnimation.setKeys([{
|
|
70
|
-
frame: 0,
|
|
71
|
-
value: activeCamera.beta
|
|
72
|
-
}, {
|
|
73
|
-
frame: 100,
|
|
74
|
-
value: targetBeta
|
|
75
|
-
}]);
|
|
76
|
-
radiusAnimation.setKeys([{
|
|
77
|
-
frame: 0,
|
|
78
|
-
value: activeCamera.radius
|
|
79
|
-
}, {
|
|
80
|
-
frame: 100,
|
|
81
|
-
value: targetRadius
|
|
82
|
-
}]);
|
|
83
|
-
activeCamera.animations.push(alphaAnimation);
|
|
84
|
-
activeCamera.animations.push(betaAnimation);
|
|
85
|
-
activeCamera.animations.push(radiusAnimation);
|
|
86
|
-
var animation = this.scene.beginAnimation(activeCamera, 0, 100, false, 10);
|
|
87
|
-
animation.disposeOnEnd = true;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Stops and kills all running animations.
|
|
91
|
-
*/
|
|
92
|
-
AnimationManager.prototype.killAllAnimations = function () {
|
|
93
|
-
this.animations.forEach(function (animation) { return animation.kill(); });
|
|
94
|
-
this.animations = [];
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* @see {@link PlacementAnimation.play}
|
|
98
|
-
*/
|
|
99
|
-
AnimationManager.prototype.animateToPlacement = function (mutable, placement, animation) {
|
|
100
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
101
|
-
var _animation, animationPromise;
|
|
102
|
-
var _this = this;
|
|
103
|
-
return tslib_1.__generator(this, function (_b) {
|
|
104
|
-
switch (_b.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
_animation = new placementAnimation_1.PlacementAnimation(mutable, placement, animation);
|
|
107
|
-
this.animations.push(_animation);
|
|
108
|
-
animationPromise = _animation.play();
|
|
109
|
-
animationPromise.then(function (a) {
|
|
110
|
-
lodash_es_1.remove(_this.animations, function (_a) { return _a === a; });
|
|
111
|
-
a.kill();
|
|
112
|
-
});
|
|
113
|
-
return [4 /*yield*/, animationPromise];
|
|
114
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
return AnimationManager;
|
|
120
|
-
}());
|
|
121
|
-
exports.AnimationManager = AnimationManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnimationManager = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var animation_1 = require("@babylonjs/core/Animations/animation");
|
|
6
|
+
//import { CustomEase } from 'gsap/CustomEase';
|
|
7
|
+
//import { ExpoScaleEase, RoughEase, SlowMo } from 'gsap/EasePack';
|
|
8
|
+
var lodash_es_1 = require("lodash-es");
|
|
9
|
+
var placementAnimation_1 = require("../classes/placementAnimation");
|
|
10
|
+
//gsap.registerPlugin( CustomEase, ExpoScaleEase, RoughEase, SlowMo );
|
|
11
|
+
var AnimationManager = /** @class */ (function () {
|
|
12
|
+
/**
|
|
13
|
+
* Constructor.
|
|
14
|
+
*/
|
|
15
|
+
function AnimationManager(scene) {
|
|
16
|
+
this.scene = scene;
|
|
17
|
+
this.animations = [];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates an {@link AnimationManager} based on given BabylonJS scene.
|
|
21
|
+
*/
|
|
22
|
+
AnimationManager.create = function (scene) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
24
|
+
return tslib_1.__generator(this, function (_b) {
|
|
25
|
+
return [2 /*return*/, new AnimationManager(scene)];
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use viewer.moveCameraTo().
|
|
31
|
+
*/
|
|
32
|
+
AnimationManager.prototype.resetCamera = function (animate) {
|
|
33
|
+
if (animate === void 0) { animate = false; }
|
|
34
|
+
//TODO currently only works for arcrotate. are there any other cameras?
|
|
35
|
+
var activeCamera = this.scene.activeCamera;
|
|
36
|
+
if (!activeCamera) {
|
|
37
|
+
throw new Error('There is no active camera');
|
|
38
|
+
}
|
|
39
|
+
var initAlpha = activeCamera.metadata.alpha;
|
|
40
|
+
var initBeta = activeCamera.metadata.beta;
|
|
41
|
+
var initRadius = activeCamera.metadata.radius;
|
|
42
|
+
if (animate) {
|
|
43
|
+
this.animateArcRotateCamera(initAlpha, initBeta, initRadius);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
activeCamera.alpha = initAlpha;
|
|
47
|
+
activeCamera.beta = initBeta;
|
|
48
|
+
activeCamera.radius = initRadius;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use viewer.moveCameraTo().
|
|
53
|
+
*/
|
|
54
|
+
AnimationManager.prototype.animateArcRotateCamera = function (targetAlpha, targetBeta, targetRadius) {
|
|
55
|
+
var activeCamera = this.scene.activeCamera;
|
|
56
|
+
if (!activeCamera) {
|
|
57
|
+
throw new Error('There is no active camera');
|
|
58
|
+
}
|
|
59
|
+
var alphaAnimation = new animation_1.Animation('alphaAnimation', 'alpha', 30, animation_1.Animation.ANIMATIONTYPE_FLOAT, animation_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
60
|
+
var betaAnimation = new animation_1.Animation('betaAnimation', 'beta', 30, animation_1.Animation.ANIMATIONTYPE_FLOAT, animation_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
61
|
+
var radiusAnimation = new animation_1.Animation('radiusAnimation', 'radius', 30, animation_1.Animation.ANIMATIONTYPE_FLOAT, animation_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
62
|
+
alphaAnimation.setKeys([{
|
|
63
|
+
frame: 0,
|
|
64
|
+
value: activeCamera.alpha
|
|
65
|
+
}, {
|
|
66
|
+
frame: 100,
|
|
67
|
+
value: targetAlpha
|
|
68
|
+
}]);
|
|
69
|
+
betaAnimation.setKeys([{
|
|
70
|
+
frame: 0,
|
|
71
|
+
value: activeCamera.beta
|
|
72
|
+
}, {
|
|
73
|
+
frame: 100,
|
|
74
|
+
value: targetBeta
|
|
75
|
+
}]);
|
|
76
|
+
radiusAnimation.setKeys([{
|
|
77
|
+
frame: 0,
|
|
78
|
+
value: activeCamera.radius
|
|
79
|
+
}, {
|
|
80
|
+
frame: 100,
|
|
81
|
+
value: targetRadius
|
|
82
|
+
}]);
|
|
83
|
+
activeCamera.animations.push(alphaAnimation);
|
|
84
|
+
activeCamera.animations.push(betaAnimation);
|
|
85
|
+
activeCamera.animations.push(radiusAnimation);
|
|
86
|
+
var animation = this.scene.beginAnimation(activeCamera, 0, 100, false, 10);
|
|
87
|
+
animation.disposeOnEnd = true;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Stops and kills all running animations.
|
|
91
|
+
*/
|
|
92
|
+
AnimationManager.prototype.killAllAnimations = function () {
|
|
93
|
+
this.animations.forEach(function (animation) { return animation.kill(); });
|
|
94
|
+
this.animations = [];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @see {@link PlacementAnimation.play}
|
|
98
|
+
*/
|
|
99
|
+
AnimationManager.prototype.animateToPlacement = function (mutable, placement, animation) {
|
|
100
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var _animation, animationPromise;
|
|
102
|
+
var _this = this;
|
|
103
|
+
return tslib_1.__generator(this, function (_b) {
|
|
104
|
+
switch (_b.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
_animation = new placementAnimation_1.PlacementAnimation(mutable, placement, animation);
|
|
107
|
+
this.animations.push(_animation);
|
|
108
|
+
animationPromise = _animation.play();
|
|
109
|
+
animationPromise.then(function (a) {
|
|
110
|
+
lodash_es_1.remove(_this.animations, function (_a) { return _a === a; });
|
|
111
|
+
a.kill();
|
|
112
|
+
});
|
|
113
|
+
return [4 /*yield*/, animationPromise];
|
|
114
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return AnimationManager;
|
|
120
|
+
}());
|
|
121
|
+
exports.AnimationManager = AnimationManager;
|
|
122
122
|
//# sourceMappingURL=animationManager.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Scene } from '@babylonjs/core/scene';
|
|
2
|
+
import { IExportOptions } from '@babylonjs/serializers';
|
|
3
|
+
export declare class GltfExportManager {
|
|
4
|
+
protected scene: Scene;
|
|
5
|
+
/**
|
|
6
|
+
* Constructor.
|
|
7
|
+
*/
|
|
8
|
+
protected constructor(scene: Scene);
|
|
9
|
+
/**
|
|
10
|
+
* Creates an {@link GltfExportManager}.
|
|
11
|
+
*/
|
|
12
|
+
static create(scene: Scene): Promise<GltfExportManager>;
|
|
13
|
+
/**
|
|
14
|
+
* Exports selected nodes to a {@link GlbExportResult} blob.
|
|
15
|
+
* @param exportOptions export options to be merged with default options. See {@link gltfExportOptions}.
|
|
16
|
+
*/
|
|
17
|
+
exportGlb(exportOptions?: IExportOptions): Promise<GlbExportResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Exports selected nodes to GLTF. This may result in more than one file, since textures are exported separately.
|
|
20
|
+
* @param filename name of the main (text-based) .GLTF file referring to separate texture files.
|
|
21
|
+
* @param exportOptions export options to be merged with default options. See {@link gltfExportOptions}.
|
|
22
|
+
*/
|
|
23
|
+
exportGltfToFile(filename: string, exportOptions?: IExportOptions): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Exports selected nodes to GLB. This results in one binary file.
|
|
26
|
+
* @param filename name of the .GLB file.
|
|
27
|
+
* @param exportOptions export options to be merged with default options. See {@link gltfExportOptions}.
|
|
28
|
+
*/
|
|
29
|
+
exportGlbToFile(filename: string, exportOptions?: IExportOptions): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets predefined {@link IExportOptions } merged with given ones.
|
|
32
|
+
* @protected
|
|
33
|
+
*/
|
|
34
|
+
protected gltfExportOptions(mergeWithOptions?: IExportOptions): IExportOptions;
|
|
35
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GltfExportManager = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var serializers_1 = require("@babylonjs/serializers");
|
|
6
|
+
var lodash_es_1 = require("lodash-es");
|
|
7
|
+
var GltfExportManager = /** @class */ (function () {
|
|
8
|
+
/**
|
|
9
|
+
* Constructor.
|
|
10
|
+
*/
|
|
11
|
+
function GltfExportManager(scene) {
|
|
12
|
+
this.scene = scene;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates an {@link GltfExportManager}.
|
|
16
|
+
*/
|
|
17
|
+
GltfExportManager.create = function (scene) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
19
|
+
return tslib_1.__generator(this, function (_a) {
|
|
20
|
+
return [2 /*return*/, new GltfExportManager(scene)];
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Exports selected nodes to a {@link GlbExportResult} blob.
|
|
26
|
+
* @param exportOptions export options to be merged with default options. See {@link gltfExportOptions}.
|
|
27
|
+
*/
|
|
28
|
+
GltfExportManager.prototype.exportGlb = function (exportOptions) {
|
|
29
|
+
if (exportOptions === void 0) { exportOptions = {}; }
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
31
|
+
var glbData;
|
|
32
|
+
return tslib_1.__generator(this, function (_a) {
|
|
33
|
+
switch (_a.label) {
|
|
34
|
+
case 0: return [4 /*yield*/, serializers_1.GLTF2Export.GLBAsync(this.scene, 'dummy', this.gltfExportOptions(exportOptions))];
|
|
35
|
+
case 1:
|
|
36
|
+
glbData = _a.sent();
|
|
37
|
+
return [2 /*return*/, glbData.glTFFiles['dummy.glb']]; // should be only one file for glb
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Exports selected nodes to GLTF. This may result in more than one file, since textures are exported separately.
|
|
44
|
+
* @param filename name of the main (text-based) .GLTF file referring to separate texture files.
|
|
45
|
+
* @param exportOptions export options to be merged with default options. See {@link gltfExportOptions}.
|
|
46
|
+
*/
|
|
47
|
+
GltfExportManager.prototype.exportGltfToFile = function (filename, exportOptions) {
|
|
48
|
+
if (exportOptions === void 0) { exportOptions = {}; }
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return tslib_1.__generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0: return [4 /*yield*/, serializers_1.GLTF2Export.GLTFAsync(this.scene, filename, this.gltfExportOptions(exportOptions)).then(function (glb) {
|
|
53
|
+
glb.downloadFiles();
|
|
54
|
+
})];
|
|
55
|
+
case 1:
|
|
56
|
+
_a.sent();
|
|
57
|
+
return [2 /*return*/];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Exports selected nodes to GLB. This results in one binary file.
|
|
64
|
+
* @param filename name of the .GLB file.
|
|
65
|
+
* @param exportOptions export options to be merged with default options. See {@link gltfExportOptions}.
|
|
66
|
+
*/
|
|
67
|
+
GltfExportManager.prototype.exportGlbToFile = function (filename, exportOptions) {
|
|
68
|
+
if (exportOptions === void 0) { exportOptions = {}; }
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
70
|
+
return tslib_1.__generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0: return [4 /*yield*/, serializers_1.GLTF2Export.GLBAsync(this.scene, filename, this.gltfExportOptions(exportOptions)).then(function (glb) {
|
|
73
|
+
glb.downloadFiles();
|
|
74
|
+
})];
|
|
75
|
+
case 1:
|
|
76
|
+
_a.sent();
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Gets predefined {@link IExportOptions } merged with given ones.
|
|
84
|
+
* @protected
|
|
85
|
+
*/
|
|
86
|
+
GltfExportManager.prototype.gltfExportOptions = function (mergeWithOptions) {
|
|
87
|
+
if (mergeWithOptions === void 0) { mergeWithOptions = {}; }
|
|
88
|
+
var defaultOptions = {
|
|
89
|
+
// includeCoordinateSystemConversionNodes: true,
|
|
90
|
+
shouldExportNode: function (node) {
|
|
91
|
+
if (!node.isEnabled()) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (node.isVisible === false) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (node.name === '__bounding_box__') {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return lodash_es_1.merge({}, defaultOptions, mergeWithOptions);
|
|
104
|
+
};
|
|
105
|
+
return GltfExportManager;
|
|
106
|
+
}());
|
|
107
|
+
exports.GltfExportManager = GltfExportManager;
|
|
108
|
+
//# sourceMappingURL=gltfExportManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltfExportManager.js","sourceRoot":"","sources":["../../../../src/api/manager/gltfExportManager.ts"],"names":[],"mappings":";;;;AACA,sDAAqE;AACrE,uCAAkC;AAElC;IAEC;;OAEG;IACH,2BAAiC,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAC7C,CAAC;IAED;;OAEG;IACiB,wBAAM,GAA1B,UAA4B,KAAY;;;gBACvC,sBAAO,IAAI,iBAAiB,CAAE,KAAK,CAAE,EAAC;;;KACtC;IAED;;;OAGG;IACU,qCAAS,GAAtB,UAAwB,aAAkC;QAAlC,8BAAA,EAAA,kBAAkC;;;;;4BACzC,qBAAM,yBAAW,CAAC,QAAQ,CAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAE,aAAa,CAAE,CAAE,EAAA;;wBAApG,OAAO,GAAG,SAA0F;wBAC1G,sBAAO,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,EAAC,CAAE,kCAAkC;;;;KAC1E;IAED;;;;OAIG;IACU,4CAAgB,GAA7B,UAA+B,QAAgB,EAAE,aAAkC;QAAlC,8BAAA,EAAA,kBAAkC;;;;4BAClF,qBAAM,yBAAW,CAAC,SAAS,CAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAE,aAAa,CAAE,CAAE,CAAC,IAAI,CAAE,UAAE,GAAG;4BACvG,GAAG,CAAC,aAAa,EAAE,CAAC;wBACrB,CAAC,CAAE,EAAA;;wBAFH,SAEG,CAAC;;;;;KACJ;IAED;;;;OAIG;IACU,2CAAe,GAA5B,UAA8B,QAAgB,EAAE,aAAkC;QAAlC,8BAAA,EAAA,kBAAkC;;;;4BACjF,qBAAM,yBAAW,CAAC,QAAQ,CAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAE,aAAa,CAAE,CAAE,CAAC,IAAI,CAAE,UAAE,GAAG;4BACtG,GAAG,CAAC,aAAa,EAAE,CAAC;wBACrB,CAAC,CAAE,EAAA;;wBAFH,SAEG,CAAC;;;;;KACJ;IAED;;;OAGG;IACO,6CAAiB,GAA3B,UAA6B,gBAAqC;QAArC,iCAAA,EAAA,qBAAqC;QACjE,IAAM,cAAc,GAAG;YACtB,gDAAgD;YAChD,gBAAgB,EAAE,UAAU,IAAS;gBACpC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAG;oBACvB,OAAO,KAAK,CAAC;iBACb;gBACD,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAG;oBAC9B,OAAO,KAAK,CAAC;iBACb;gBACD,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,EAAG;oBACtC,OAAO,KAAK,CAAC;iBACb;gBACD,OAAO,IAAI,CAAC;YACb,CAAC;SACD,CAAC;QACF,OAAO,iBAAK,CAAE,EAAE,EAAE,cAAc,EAAE,gBAAgB,CAAE,CAAC;IACtD,CAAC;IAEF,wBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,8CAAiB"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { Camera } from '@babylonjs/core/Cameras/camera';
|
|
2
|
-
import { Scene as BabylonScene } from '@babylonjs/core/scene';
|
|
3
|
-
import { ParameterObservable } from '../classes/parameterObservable';
|
|
4
|
-
export declare class SceneManager extends ParameterObservable {
|
|
5
|
-
scene: BabylonScene;
|
|
6
|
-
protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
|
|
7
|
-
protected readonly parameterDeclaration: ParameterDeclarations;
|
|
8
|
-
/**
|
|
9
|
-
* Constructor.
|
|
10
|
-
*/
|
|
11
|
-
protected constructor(scene: BabylonScene);
|
|
12
|
-
/**
|
|
13
|
-
* Creates a {@link SceneManager} based on given BabylonJS scene.
|
|
14
|
-
*/
|
|
15
|
-
static create(scene: BabylonScene): Promise<SceneManager>;
|
|
16
|
-
/**
|
|
17
|
-
* The active `Camera`.
|
|
18
|
-
*/
|
|
19
|
-
get activeCamera(): Camera;
|
|
20
|
-
/**
|
|
21
|
-
* Places the given {@link ParameterBag} in the {@link SceneManager}'s parameters, replaces all patterns in the
|
|
22
|
-
* {@link StructureJson} and broadcasts all {@link ParameterObserver}s.
|
|
23
|
-
*
|
|
24
|
-
* @emit {@link Event.SCENE_PARAMETER_COMMITTED}
|
|
25
|
-
*/
|
|
26
|
-
commitParameters(parameters?: ParameterBag): Promise<SceneManager>;
|
|
27
|
-
protected addParameterObservers(): SceneManager;
|
|
28
|
-
/**
|
|
29
|
-
* Bootstrapping for parameters. It sets the `parametersInitialized` to true for all ancestors.
|
|
30
|
-
*/
|
|
31
|
-
protected bootstrapParameters(parameters?: ParameterBag): Promise<SceneManager>;
|
|
32
|
-
}
|
|
1
|
+
import { Camera } from '@babylonjs/core/Cameras/camera';
|
|
2
|
+
import { Scene as BabylonScene } from '@babylonjs/core/scene';
|
|
3
|
+
import { ParameterObservable } from '../classes/parameterObservable';
|
|
4
|
+
export declare class SceneManager extends ParameterObservable {
|
|
5
|
+
scene: BabylonScene;
|
|
6
|
+
protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
|
|
7
|
+
protected readonly parameterDeclaration: ParameterDeclarations;
|
|
8
|
+
/**
|
|
9
|
+
* Constructor.
|
|
10
|
+
*/
|
|
11
|
+
protected constructor(scene: BabylonScene);
|
|
12
|
+
/**
|
|
13
|
+
* Creates a {@link SceneManager} based on given BabylonJS scene.
|
|
14
|
+
*/
|
|
15
|
+
static create(scene: BabylonScene): Promise<SceneManager>;
|
|
16
|
+
/**
|
|
17
|
+
* The active `Camera`.
|
|
18
|
+
*/
|
|
19
|
+
get activeCamera(): Camera;
|
|
20
|
+
/**
|
|
21
|
+
* Places the given {@link ParameterBag} in the {@link SceneManager}'s parameters, replaces all patterns in the
|
|
22
|
+
* {@link StructureJson} and broadcasts all {@link ParameterObserver}s.
|
|
23
|
+
*
|
|
24
|
+
* @emit {@link Event.SCENE_PARAMETER_COMMITTED}
|
|
25
|
+
*/
|
|
26
|
+
commitParameters(parameters?: ParameterBag): Promise<SceneManager>;
|
|
27
|
+
protected addParameterObservers(): SceneManager;
|
|
28
|
+
/**
|
|
29
|
+
* Bootstrapping for parameters. It sets the `parametersInitialized` to true for all ancestors.
|
|
30
|
+
*/
|
|
31
|
+
protected bootstrapParameters(parameters?: ParameterBag): Promise<SceneManager>;
|
|
32
|
+
}
|