@babylonjs/viewer 7.22.3 → 7.22.4-alpha
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/babylon-viewer.esm.js +117012 -0
- package/dist/babylon-viewer.esm.js.map +1 -0
- package/dist/babylon-viewer.esm.min.js +56 -0
- package/dist/babylon-viewer.esm.min.js.map +1 -0
- package/lib/index.d.ts +237 -0
- package/lib/index.js +862 -0
- package/lib/index.js.map +1 -0
- package/package.json +17 -27
- package/readme.md +35 -21
- package/configuration/configuration.d.ts +0 -107
- package/configuration/configuration.js +0 -16
- package/configuration/configuration.js.map +0 -1
- package/configuration/configurationCompatibility.d.ts +0 -8
- package/configuration/configurationCompatibility.js +0 -66
- package/configuration/configurationCompatibility.js.map +0 -1
- package/configuration/configurationContainer.d.ts +0 -10
- package/configuration/configurationContainer.js +0 -10
- package/configuration/configurationContainer.js.map +0 -1
- package/configuration/globals.d.ts +0 -6
- package/configuration/globals.js +0 -18
- package/configuration/globals.js.map +0 -1
- package/configuration/index.d.ts +0 -2
- package/configuration/index.js +0 -4
- package/configuration/index.js.map +0 -1
- package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
- package/configuration/interfaces/cameraConfiguration.js +0 -2
- package/configuration/interfaces/cameraConfiguration.js.map +0 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
- package/configuration/interfaces/colorGradingConfiguration.js +0 -2
- package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
- package/configuration/interfaces/environmentMapConfiguration.js +0 -2
- package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
- package/configuration/interfaces/groundConfiguration.d.ts +0 -24
- package/configuration/interfaces/groundConfiguration.js +0 -2
- package/configuration/interfaces/groundConfiguration.js.map +0 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
- package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
- package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
- package/configuration/interfaces/index.d.ts +0 -15
- package/configuration/interfaces/index.js +0 -16
- package/configuration/interfaces/index.js.map +0 -1
- package/configuration/interfaces/lightConfiguration.d.ts +0 -60
- package/configuration/interfaces/lightConfiguration.js +0 -2
- package/configuration/interfaces/lightConfiguration.js.map +0 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
- package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
- package/configuration/interfaces/modelConfiguration.d.ts +0 -65
- package/configuration/interfaces/modelConfiguration.js +0 -2
- package/configuration/interfaces/modelConfiguration.js.map +0 -1
- package/configuration/interfaces/observersConfiguration.d.ts +0 -5
- package/configuration/interfaces/observersConfiguration.js +0 -2
- package/configuration/interfaces/observersConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
- package/configuration/interfaces/sceneConfiguration.js +0 -2
- package/configuration/interfaces/sceneConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
- package/configuration/interfaces/skyboxConfiguration.js +0 -2
- package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
- package/configuration/interfaces/templateConfiguration.d.ts +0 -67
- package/configuration/interfaces/templateConfiguration.js +0 -2
- package/configuration/interfaces/templateConfiguration.js.map +0 -1
- package/configuration/interfaces/vrConfiguration.d.ts +0 -16
- package/configuration/interfaces/vrConfiguration.js +0 -2
- package/configuration/interfaces/vrConfiguration.js.map +0 -1
- package/configuration/loader.d.ts +0 -4
- package/configuration/loader.js +0 -17
- package/configuration/loader.js.map +0 -1
- package/configuration/mappers.d.ts +0 -43
- package/configuration/mappers.js +0 -192
- package/configuration/mappers.js.map +0 -1
- package/configuration/renderOnlyLoader.d.ts +0 -33
- package/configuration/renderOnlyLoader.js +0 -162
- package/configuration/renderOnlyLoader.js.map +0 -1
- package/configuration/types/default.d.ts +0 -6
- package/configuration/types/default.js +0 -121
- package/configuration/types/default.js.map +0 -1
- package/configuration/types/environmentMap.d.ts +0 -5
- package/configuration/types/environmentMap.js +0 -14
- package/configuration/types/environmentMap.js.map +0 -1
- package/configuration/types/extended.d.ts +0 -6
- package/configuration/types/extended.js +0 -317
- package/configuration/types/extended.js.map +0 -1
- package/configuration/types/index.d.ts +0 -14
- package/configuration/types/index.js +0 -51
- package/configuration/types/index.js.map +0 -1
- package/configuration/types/minimal.d.ts +0 -6
- package/configuration/types/minimal.js +0 -43
- package/configuration/types/minimal.js.map +0 -1
- package/configuration/types/renderOnlyDefault.d.ts +0 -30
- package/configuration/types/renderOnlyDefault.js +0 -31
- package/configuration/types/renderOnlyDefault.js.map +0 -1
- package/configuration/types/shadowLight.d.ts +0 -9
- package/configuration/types/shadowLight.js +0 -64
- package/configuration/types/shadowLight.js.map +0 -1
- package/helper/index.d.ts +0 -29
- package/helper/index.js +0 -66
- package/helper/index.js.map +0 -1
- package/index.d.ts +0 -30
- package/index.js +0 -46
- package/index.js.map +0 -1
- package/initializer.d.ts +0 -11
- package/initializer.js +0 -35
- package/initializer.js.map +0 -1
- package/interfaces.d.ts +0 -5
- package/interfaces.js +0 -7
- package/interfaces.js.map +0 -1
- package/labs/environmentSerializer.d.ts +0 -126
- package/labs/environmentSerializer.js +0 -191
- package/labs/environmentSerializer.js.map +0 -1
- package/labs/texture.d.ts +0 -183
- package/labs/texture.js +0 -351
- package/labs/texture.js.map +0 -1
- package/labs/viewerLabs.d.ts +0 -51
- package/labs/viewerLabs.js +0 -134
- package/labs/viewerLabs.js.map +0 -1
- package/loader/modelLoader.d.ts +0 -56
- package/loader/modelLoader.js +0 -199
- package/loader/modelLoader.js.map +0 -1
- package/loader/plugins/applyMaterialConfig.d.ts +0 -12
- package/loader/plugins/applyMaterialConfig.js +0 -16
- package/loader/plugins/applyMaterialConfig.js.map +0 -1
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
- package/loader/plugins/index.d.ts +0 -19
- package/loader/plugins/index.js +0 -44
- package/loader/plugins/index.js.map +0 -1
- package/loader/plugins/loaderPlugin.d.ts +0 -24
- package/loader/plugins/loaderPlugin.js +0 -2
- package/loader/plugins/loaderPlugin.js.map +0 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
- package/loader/plugins/msftLodLoaderPlugin.js +0 -21
- package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
- package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
- package/loader/plugins/telemetryLoaderPlugin.js +0 -36
- package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
- package/managers/observablesManager.d.ts +0 -66
- package/managers/observablesManager.js +0 -35
- package/managers/observablesManager.js.map +0 -1
- package/managers/sceneManager.d.ts +0 -245
- package/managers/sceneManager.js +0 -1375
- package/managers/sceneManager.js.map +0 -1
- package/managers/telemetryManager.d.ts +0 -78
- package/managers/telemetryManager.js +0 -117
- package/managers/telemetryManager.js.map +0 -1
- package/model/modelAnimation.d.ts +0 -215
- package/model/modelAnimation.js +0 -237
- package/model/modelAnimation.js.map +0 -1
- package/model/viewerModel.d.ts +0 -233
- package/model/viewerModel.js +0 -673
- package/model/viewerModel.js.map +0 -1
- package/optimizer/custom/extended.d.ts +0 -13
- package/optimizer/custom/extended.js +0 -101
- package/optimizer/custom/extended.js.map +0 -1
- package/optimizer/custom/index.d.ts +0 -9
- package/optimizer/custom/index.js +0 -26
- package/optimizer/custom/index.js.map +0 -1
- package/renderOnlyIndex.d.ts +0 -11
- package/renderOnlyIndex.js +0 -18
- package/renderOnlyIndex.js.map +0 -1
- package/templating/eventManager.d.ts +0 -35
- package/templating/eventManager.js +0 -66
- package/templating/eventManager.js.map +0 -1
- package/templating/plugins/hdButtonPlugin.d.ts +0 -9
- package/templating/plugins/hdButtonPlugin.js +0 -21
- package/templating/plugins/hdButtonPlugin.js.map +0 -1
- package/templating/plugins/printButton.d.ts +0 -9
- package/templating/plugins/printButton.js +0 -40
- package/templating/plugins/printButton.js.map +0 -1
- package/templating/templateManager.d.ts +0 -197
- package/templating/templateManager.js +0 -561
- package/templating/templateManager.js.map +0 -1
- package/templating/viewerTemplatePlugin.d.ts +0 -21
- package/templating/viewerTemplatePlugin.js +0 -69
- package/templating/viewerTemplatePlugin.js.map +0 -1
- package/viewer/defaultViewer.d.ts +0 -130
- package/viewer/defaultViewer.js +0 -675
- package/viewer/defaultViewer.js.map +0 -1
- package/viewer/renderOnlyViewer.d.ts +0 -9
- package/viewer/renderOnlyViewer.js +0 -46
- package/viewer/renderOnlyViewer.js.map +0 -1
- package/viewer/viewer.d.ts +0 -258
- package/viewer/viewer.js +0 -783
- package/viewer/viewer.js.map +0 -1
- package/viewer/viewerManager.d.ts +0 -58
- package/viewer/viewerManager.js +0 -91
- package/viewer/viewerManager.js.map +0 -1
- package/viewer/viewerWithTemplate.d.ts +0 -9
- package/viewer/viewerWithTemplate.js +0 -20
- package/viewer/viewerWithTemplate.js.map +0 -1
package/model/viewerModel.js
DELETED
|
@@ -1,673 +0,0 @@
|
|
|
1
|
-
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
2
|
-
import "@babylonjs/core/Misc/observable.extensions.js";
|
|
3
|
-
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
|
|
4
|
-
import { Animation, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, } from "@babylonjs/core/Animations/index.js";
|
|
5
|
-
import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
6
|
-
import { Tags } from "@babylonjs/core/Misc/tags.js";
|
|
7
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
8
|
-
import { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial.js";
|
|
9
|
-
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
10
|
-
import { GroupModelAnimation, AnimationPlayMode, EasingFunction, AnimationState } from "./modelAnimation.js";
|
|
11
|
-
import { deepmerge, extendClassWithConfig } from "../helper/index.js";
|
|
12
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
13
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
14
|
-
/**
|
|
15
|
-
* The current state of the model
|
|
16
|
-
*/
|
|
17
|
-
export var ModelState;
|
|
18
|
-
(function (ModelState) {
|
|
19
|
-
ModelState[ModelState["INIT"] = 0] = "INIT";
|
|
20
|
-
ModelState[ModelState["LOADING"] = 1] = "LOADING";
|
|
21
|
-
ModelState[ModelState["LOADED"] = 2] = "LOADED";
|
|
22
|
-
ModelState[ModelState["ENTRY"] = 3] = "ENTRY";
|
|
23
|
-
ModelState[ModelState["ENTRYDONE"] = 4] = "ENTRYDONE";
|
|
24
|
-
ModelState[ModelState["COMPLETE"] = 5] = "COMPLETE";
|
|
25
|
-
ModelState[ModelState["CANCELED"] = 6] = "CANCELED";
|
|
26
|
-
ModelState[ModelState["ERROR"] = 7] = "ERROR";
|
|
27
|
-
})(ModelState || (ModelState = {}));
|
|
28
|
-
/**
|
|
29
|
-
* The viewer model is a container for all assets representing a sngle loaded model.
|
|
30
|
-
*/
|
|
31
|
-
var ViewerModel = /** @class */ (function () {
|
|
32
|
-
function ViewerModel(_observablesManager, modelConfiguration, _configurationContainer) {
|
|
33
|
-
var _this = this;
|
|
34
|
-
this._observablesManager = _observablesManager;
|
|
35
|
-
this._configurationContainer = _configurationContainer;
|
|
36
|
-
/**
|
|
37
|
-
* the list of meshes that are a part of this model
|
|
38
|
-
*/
|
|
39
|
-
this._meshes = [];
|
|
40
|
-
/**
|
|
41
|
-
* ParticleSystems connected to this model
|
|
42
|
-
*/
|
|
43
|
-
this.particleSystems = [];
|
|
44
|
-
/**
|
|
45
|
-
* Skeletons defined in this model
|
|
46
|
-
*/
|
|
47
|
-
this.skeletons = [];
|
|
48
|
-
this._loaderDone = false;
|
|
49
|
-
this._animatables = [];
|
|
50
|
-
this._frameRate = 60;
|
|
51
|
-
this._shadowsRenderedAfterLoad = false;
|
|
52
|
-
this.onLoadedObservable = new Observable();
|
|
53
|
-
this.onLoadErrorObservable = new Observable();
|
|
54
|
-
this.onLoadProgressObservable = new Observable();
|
|
55
|
-
this.onCompleteObservable = new Observable();
|
|
56
|
-
this.onAfterConfigure = new Observable();
|
|
57
|
-
this.state = ModelState.INIT;
|
|
58
|
-
var scene = this._configurationContainer && this._configurationContainer.scene;
|
|
59
|
-
this.rootMesh = new Mesh("modelRootMesh", scene);
|
|
60
|
-
this._pivotMesh = new TransformNode("pivotMesh", scene);
|
|
61
|
-
this._pivotMesh.parent = this.rootMesh;
|
|
62
|
-
// rotate 180, gltf fun
|
|
63
|
-
this._pivotMesh.rotation.y += Math.PI;
|
|
64
|
-
this._scaleTransition = new Animation("scaleAnimation", "scaling", this._frameRate, Animation.ANIMATIONTYPE_VECTOR3, Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
65
|
-
this._animations = [];
|
|
66
|
-
//create a copy of the configuration to make sure it doesn't change even after it is changed in the viewer
|
|
67
|
-
this._modelConfiguration = deepmerge((this._configurationContainer && this._configurationContainer.configuration.model) || {}, modelConfiguration);
|
|
68
|
-
if (this._observablesManager) {
|
|
69
|
-
this._observablesManager.onModelAddedObservable.notifyObservers(this);
|
|
70
|
-
}
|
|
71
|
-
if (this._modelConfiguration.entryAnimation) {
|
|
72
|
-
this.rootMesh.setEnabled(false);
|
|
73
|
-
}
|
|
74
|
-
this.onLoadedObservable.add(function () {
|
|
75
|
-
_this.updateConfiguration(_this._modelConfiguration);
|
|
76
|
-
if (_this._observablesManager) {
|
|
77
|
-
_this._observablesManager.onModelLoadedObservable.notifyObservers(_this);
|
|
78
|
-
}
|
|
79
|
-
_this._initAnimations();
|
|
80
|
-
});
|
|
81
|
-
this.onCompleteObservable.add(function () {
|
|
82
|
-
_this.state = ModelState.COMPLETE;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
Object.defineProperty(ViewerModel.prototype, "shadowsRenderedAfterLoad", {
|
|
86
|
-
get: function () {
|
|
87
|
-
return this._shadowsRenderedAfterLoad;
|
|
88
|
-
},
|
|
89
|
-
set: function (rendered) {
|
|
90
|
-
if (!rendered) {
|
|
91
|
-
throw new Error("can only be enabled");
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this._shadowsRenderedAfterLoad = rendered;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
ViewerModel.prototype.getViewerId = function () {
|
|
101
|
-
return this._configurationContainer && this._configurationContainer.viewerId;
|
|
102
|
-
};
|
|
103
|
-
Object.defineProperty(ViewerModel.prototype, "enabled", {
|
|
104
|
-
/**
|
|
105
|
-
* Is this model enabled?
|
|
106
|
-
*/
|
|
107
|
-
get: function () {
|
|
108
|
-
return this.rootMesh.isEnabled();
|
|
109
|
-
},
|
|
110
|
-
/**
|
|
111
|
-
* Set whether this model is enabled or not.
|
|
112
|
-
*/
|
|
113
|
-
set: function (enable) {
|
|
114
|
-
this.rootMesh.setEnabled(enable);
|
|
115
|
-
},
|
|
116
|
-
enumerable: false,
|
|
117
|
-
configurable: true
|
|
118
|
-
});
|
|
119
|
-
Object.defineProperty(ViewerModel.prototype, "loaderDone", {
|
|
120
|
-
set: function (done) {
|
|
121
|
-
this._loaderDone = done;
|
|
122
|
-
this._checkCompleteState();
|
|
123
|
-
},
|
|
124
|
-
enumerable: false,
|
|
125
|
-
configurable: true
|
|
126
|
-
});
|
|
127
|
-
ViewerModel.prototype._checkCompleteState = function () {
|
|
128
|
-
if (this._loaderDone && this.state === ModelState.ENTRYDONE) {
|
|
129
|
-
this._modelComplete();
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Add a mesh to this model.
|
|
134
|
-
* Any mesh that has no parent will be provided with the root mesh as its new parent.
|
|
135
|
-
*
|
|
136
|
-
* @param mesh the new mesh to add
|
|
137
|
-
* @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
|
|
138
|
-
* @returns a promise that will resolve when the model is done loading
|
|
139
|
-
*/
|
|
140
|
-
ViewerModel.prototype.addMesh = function (mesh, triggerLoaded) {
|
|
141
|
-
if (!mesh.parent) {
|
|
142
|
-
mesh.parent = this._pivotMesh;
|
|
143
|
-
}
|
|
144
|
-
if (mesh.getClassName() !== "InstancedMesh") {
|
|
145
|
-
mesh.receiveShadows = !!this.configuration.receiveShadows;
|
|
146
|
-
}
|
|
147
|
-
this._meshes.push(mesh);
|
|
148
|
-
if (triggerLoaded) {
|
|
149
|
-
return this.onLoadedObservable.notifyObserversWithPromise(this);
|
|
150
|
-
}
|
|
151
|
-
return Promise.resolve(this);
|
|
152
|
-
};
|
|
153
|
-
Object.defineProperty(ViewerModel.prototype, "meshes", {
|
|
154
|
-
/**
|
|
155
|
-
* get the list of meshes (excluding the root mesh)
|
|
156
|
-
*/
|
|
157
|
-
get: function () {
|
|
158
|
-
return this._meshes;
|
|
159
|
-
},
|
|
160
|
-
enumerable: false,
|
|
161
|
-
configurable: true
|
|
162
|
-
});
|
|
163
|
-
Object.defineProperty(ViewerModel.prototype, "configuration", {
|
|
164
|
-
/**
|
|
165
|
-
* Get the model's configuration
|
|
166
|
-
*/
|
|
167
|
-
get: function () {
|
|
168
|
-
return this._modelConfiguration;
|
|
169
|
-
},
|
|
170
|
-
/**
|
|
171
|
-
* (Re-)set the model's entire configuration
|
|
172
|
-
* @param newConfiguration the new configuration to replace the new one
|
|
173
|
-
*/
|
|
174
|
-
set: function (newConfiguration) {
|
|
175
|
-
this._modelConfiguration = newConfiguration;
|
|
176
|
-
this._configureModel();
|
|
177
|
-
},
|
|
178
|
-
enumerable: false,
|
|
179
|
-
configurable: true
|
|
180
|
-
});
|
|
181
|
-
/**
|
|
182
|
-
* Update the current configuration with new values.
|
|
183
|
-
* Configuration will not be overwritten, but merged with the new configuration.
|
|
184
|
-
* Priority is to the new configuration
|
|
185
|
-
* @param newConfiguration the configuration to be merged into the current configuration;
|
|
186
|
-
*/
|
|
187
|
-
ViewerModel.prototype.updateConfiguration = function (newConfiguration) {
|
|
188
|
-
this._modelConfiguration = deepmerge(this._modelConfiguration, newConfiguration);
|
|
189
|
-
this._configureModel();
|
|
190
|
-
};
|
|
191
|
-
ViewerModel.prototype._initAnimations = function () {
|
|
192
|
-
var _this = this;
|
|
193
|
-
// check if this is not a gltf loader and init the animations
|
|
194
|
-
if (this.skeletons.length) {
|
|
195
|
-
this.skeletons.forEach(function (skeleton, idx) {
|
|
196
|
-
var ag = new AnimationGroup("animation-" + idx, _this._configurationContainer && _this._configurationContainer.scene);
|
|
197
|
-
var add = false;
|
|
198
|
-
skeleton.getAnimatables().forEach(function (a) {
|
|
199
|
-
if (a.animations && a.animations[0]) {
|
|
200
|
-
ag.addTargetedAnimation(a.animations[0], a);
|
|
201
|
-
add = true;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
if (add) {
|
|
205
|
-
_this.addAnimationGroup(ag);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
var completeCallback = function () { };
|
|
210
|
-
if (this._modelConfiguration.animation) {
|
|
211
|
-
if (this._modelConfiguration.animation.playOnce) {
|
|
212
|
-
this._animations.forEach(function (a) {
|
|
213
|
-
a.playMode = AnimationPlayMode.ONCE;
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
if (this._modelConfiguration.animation.autoStart && this._animations.length) {
|
|
217
|
-
var animationName_1 = this._modelConfiguration.animation.autoStart === true ? this._animations[0].name : this._modelConfiguration.animation.autoStart;
|
|
218
|
-
completeCallback = function () {
|
|
219
|
-
_this.playAnimation(animationName_1);
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
this._enterScene(completeCallback);
|
|
224
|
-
};
|
|
225
|
-
/**
|
|
226
|
-
* Animates the model from the current position to the default position
|
|
227
|
-
* @param completeCallback A function to call when the animation has completed
|
|
228
|
-
*/
|
|
229
|
-
ViewerModel.prototype._enterScene = function (completeCallback) {
|
|
230
|
-
var _this = this;
|
|
231
|
-
var scene = this.rootMesh.getScene();
|
|
232
|
-
var previousValue = scene.animationPropertiesOverride.enableBlending;
|
|
233
|
-
var callback = function () {
|
|
234
|
-
_this.state = ModelState.ENTRYDONE;
|
|
235
|
-
scene.animationPropertiesOverride.enableBlending = previousValue;
|
|
236
|
-
_this._checkCompleteState();
|
|
237
|
-
if (completeCallback) {
|
|
238
|
-
completeCallback();
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
if (!this._entryAnimation) {
|
|
242
|
-
callback();
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
this.rootMesh.setEnabled(true);
|
|
246
|
-
// disable blending for the sake of the entry animation;
|
|
247
|
-
scene.animationPropertiesOverride.enableBlending = false;
|
|
248
|
-
this._applyAnimation(this._entryAnimation, true, callback);
|
|
249
|
-
};
|
|
250
|
-
// /**
|
|
251
|
-
// * Animates the model from the current position to the exit-screen position
|
|
252
|
-
// * @param completeCallback A function to call when the animation has completed
|
|
253
|
-
// */
|
|
254
|
-
// private _exitScene(completeCallback: () => void): void {
|
|
255
|
-
// if (!this._exitAnimation) {
|
|
256
|
-
// completeCallback();
|
|
257
|
-
// return;
|
|
258
|
-
// }
|
|
259
|
-
// this._applyAnimation(this._exitAnimation, false, completeCallback);
|
|
260
|
-
// }
|
|
261
|
-
ViewerModel.prototype._modelComplete = function () {
|
|
262
|
-
var _this = this;
|
|
263
|
-
//reapply material defines to be sure:
|
|
264
|
-
var meshes = this._pivotMesh.getChildMeshes(false);
|
|
265
|
-
meshes
|
|
266
|
-
.filter(function (m) { return m.material; })
|
|
267
|
-
.forEach(function (mesh) {
|
|
268
|
-
_this._applyModelMaterialConfiguration(mesh.material);
|
|
269
|
-
});
|
|
270
|
-
this.state = ModelState.COMPLETE;
|
|
271
|
-
this.onCompleteObservable.notifyObservers(this);
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Add a new animation group to this model.
|
|
275
|
-
* @param animationGroup the new animation group to be added
|
|
276
|
-
*/
|
|
277
|
-
ViewerModel.prototype.addAnimationGroup = function (animationGroup) {
|
|
278
|
-
this._animations.push(new GroupModelAnimation(animationGroup));
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* Get the ModelAnimation array
|
|
282
|
-
* @returns the array of ModelAnimations
|
|
283
|
-
*/
|
|
284
|
-
ViewerModel.prototype.getAnimations = function () {
|
|
285
|
-
return this._animations;
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* Get the animations' names. Using the names you can play a specific animation.
|
|
289
|
-
* @returns the array of ModelAnimations
|
|
290
|
-
*/
|
|
291
|
-
ViewerModel.prototype.getAnimationNames = function () {
|
|
292
|
-
return this._animations.map(function (a) { return a.name; });
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Get an animation by the provided name. Used mainly when playing n animation.
|
|
296
|
-
* @param name the name of the animation to find
|
|
297
|
-
* @returns the ModelAnimation object
|
|
298
|
-
*/
|
|
299
|
-
ViewerModel.prototype._getAnimationByName = function (name) {
|
|
300
|
-
// can't use .find, noe available on IE
|
|
301
|
-
var filtered = this._animations.filter(function (a) { return a.name === name.trim(); });
|
|
302
|
-
if (filtered.length >= 1) {
|
|
303
|
-
return filtered[0];
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
return null;
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
/**
|
|
310
|
-
* Choose an initialized animation using its name and start playing it
|
|
311
|
-
* @param name the name of the animation to play
|
|
312
|
-
* @returns The model aniamtion to be played.
|
|
313
|
-
*/
|
|
314
|
-
ViewerModel.prototype.playAnimation = function (name) {
|
|
315
|
-
var animation = this.setCurrentAnimationByName(name);
|
|
316
|
-
if (animation) {
|
|
317
|
-
animation.start();
|
|
318
|
-
}
|
|
319
|
-
return animation;
|
|
320
|
-
};
|
|
321
|
-
ViewerModel.prototype.setCurrentAnimationByName = function (name) {
|
|
322
|
-
var animation = this._getAnimationByName(name.trim());
|
|
323
|
-
if (animation) {
|
|
324
|
-
if (this.currentAnimation && this.currentAnimation.state !== AnimationState.STOPPED) {
|
|
325
|
-
this.currentAnimation.stop();
|
|
326
|
-
}
|
|
327
|
-
this.currentAnimation = animation;
|
|
328
|
-
return animation;
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
throw new Error("animation not found - " + name);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
ViewerModel.prototype._configureModel = function () {
|
|
335
|
-
var _this = this;
|
|
336
|
-
// this can be changed to the meshes that have rootMesh a parent without breaking anything.
|
|
337
|
-
var meshesWithNoParent = [this.rootMesh]; //this._meshes.filter(m => m.parent === this.rootMesh);
|
|
338
|
-
var updateMeshesWithNoParent = function (variable, value, param) {
|
|
339
|
-
meshesWithNoParent.forEach(function (mesh) {
|
|
340
|
-
if (param) {
|
|
341
|
-
mesh[variable][param] = value;
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
mesh[variable] = value;
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
};
|
|
348
|
-
var updateXYZ = function (variable, configValues) {
|
|
349
|
-
if (configValues.x !== undefined) {
|
|
350
|
-
updateMeshesWithNoParent(variable, configValues.x, "x");
|
|
351
|
-
}
|
|
352
|
-
if (configValues.y !== undefined) {
|
|
353
|
-
updateMeshesWithNoParent(variable, configValues.y, "y");
|
|
354
|
-
}
|
|
355
|
-
if (configValues.z !== undefined) {
|
|
356
|
-
updateMeshesWithNoParent(variable, configValues.z, "z");
|
|
357
|
-
}
|
|
358
|
-
if (configValues.w !== undefined) {
|
|
359
|
-
updateMeshesWithNoParent(variable, configValues.w, "w");
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
if (this._modelConfiguration.normalize) {
|
|
363
|
-
var center = false;
|
|
364
|
-
var unitSize = false;
|
|
365
|
-
var parentIndex = void 0;
|
|
366
|
-
if (this._modelConfiguration.normalize === true) {
|
|
367
|
-
center = true;
|
|
368
|
-
unitSize = true;
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
center = !!this._modelConfiguration.normalize.center;
|
|
372
|
-
unitSize = !!this._modelConfiguration.normalize.unitSize;
|
|
373
|
-
parentIndex = this._modelConfiguration.normalize.parentIndex;
|
|
374
|
-
}
|
|
375
|
-
var meshesToNormalize = [];
|
|
376
|
-
if (parentIndex !== undefined) {
|
|
377
|
-
meshesToNormalize.push(this._meshes[parentIndex]);
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
meshesToNormalize = this._pivotMesh.getChildMeshes(true).length === 1 ? [this._pivotMesh] : meshesWithNoParent;
|
|
381
|
-
}
|
|
382
|
-
if (unitSize) {
|
|
383
|
-
meshesToNormalize.forEach(function (mesh) {
|
|
384
|
-
mesh.normalizeToUnitCube(true);
|
|
385
|
-
mesh.computeWorldMatrix(true);
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
if (center) {
|
|
389
|
-
meshesToNormalize.forEach(function (mesh) {
|
|
390
|
-
var boundingInfo = mesh.getHierarchyBoundingVectors(true);
|
|
391
|
-
var sizeVec = boundingInfo.max.subtract(boundingInfo.min);
|
|
392
|
-
var halfSizeVec = sizeVec.scale(0.5);
|
|
393
|
-
var center = boundingInfo.min.add(halfSizeVec);
|
|
394
|
-
mesh.position = center.scale(-1);
|
|
395
|
-
mesh.position.y += halfSizeVec.y;
|
|
396
|
-
// Recompute Info.
|
|
397
|
-
mesh.computeWorldMatrix(true);
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
// if centered, should be done here
|
|
403
|
-
}
|
|
404
|
-
// position?
|
|
405
|
-
if (this._modelConfiguration.position) {
|
|
406
|
-
updateXYZ("position", this._modelConfiguration.position);
|
|
407
|
-
}
|
|
408
|
-
if (this._modelConfiguration.rotation) {
|
|
409
|
-
//quaternion?
|
|
410
|
-
if (this._modelConfiguration.rotation.w) {
|
|
411
|
-
meshesWithNoParent.forEach(function (mesh) {
|
|
412
|
-
if (!mesh.rotationQuaternion) {
|
|
413
|
-
mesh.rotationQuaternion = new Quaternion();
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
updateXYZ("rotationQuaternion", this._modelConfiguration.rotation);
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
updateXYZ("rotation", this._modelConfiguration.rotation);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
if (this._modelConfiguration.rotationOffsetAxis) {
|
|
423
|
-
var rotationAxis_1 = new Vector3(this._modelConfiguration.rotationOffsetAxis.x, this._modelConfiguration.rotationOffsetAxis.y, this._modelConfiguration.rotationOffsetAxis.z);
|
|
424
|
-
meshesWithNoParent.forEach(function (m) {
|
|
425
|
-
if (_this._modelConfiguration.rotationOffsetAngle) {
|
|
426
|
-
m.rotate(rotationAxis_1, _this._modelConfiguration.rotationOffsetAngle);
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
if (this._modelConfiguration.scaling) {
|
|
431
|
-
updateXYZ("scaling", this._modelConfiguration.scaling);
|
|
432
|
-
}
|
|
433
|
-
if (this._modelConfiguration.castShadow) {
|
|
434
|
-
this._meshes.forEach(function (mesh) {
|
|
435
|
-
Tags.AddTagsTo(mesh, "castShadow");
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
var meshes = this._pivotMesh.getChildMeshes(false);
|
|
439
|
-
meshes
|
|
440
|
-
.filter(function (m) { return m.material; })
|
|
441
|
-
.forEach(function (mesh) {
|
|
442
|
-
_this._applyModelMaterialConfiguration(mesh.material);
|
|
443
|
-
});
|
|
444
|
-
if (this._modelConfiguration.entryAnimation) {
|
|
445
|
-
this._entryAnimation = this._modelAnimationConfigurationToObject(this._modelConfiguration.entryAnimation);
|
|
446
|
-
}
|
|
447
|
-
// if (this._modelConfiguration.exitAnimation) {
|
|
448
|
-
// this._exitAnimation = this._modelAnimationConfigurationToObject(this._modelConfiguration.exitAnimation);
|
|
449
|
-
// }
|
|
450
|
-
this.onAfterConfigure.notifyObservers(this);
|
|
451
|
-
};
|
|
452
|
-
ViewerModel.prototype._modelAnimationConfigurationToObject = function (animConfig) {
|
|
453
|
-
var anim = {
|
|
454
|
-
time: 0.5,
|
|
455
|
-
};
|
|
456
|
-
if (animConfig.scaling) {
|
|
457
|
-
anim.scaling = Vector3.Zero();
|
|
458
|
-
}
|
|
459
|
-
if (animConfig.easingFunction !== undefined) {
|
|
460
|
-
anim.easingFunction = animConfig.easingFunction;
|
|
461
|
-
}
|
|
462
|
-
if (animConfig.easingMode !== undefined) {
|
|
463
|
-
anim.easingMode = animConfig.easingMode;
|
|
464
|
-
}
|
|
465
|
-
extendClassWithConfig(anim, animConfig);
|
|
466
|
-
return anim;
|
|
467
|
-
};
|
|
468
|
-
/**
|
|
469
|
-
* Apply a material configuration to a material
|
|
470
|
-
* @param material Material to apply configuration to
|
|
471
|
-
* @internal
|
|
472
|
-
*/
|
|
473
|
-
ViewerModel.prototype._applyModelMaterialConfiguration = function (material) {
|
|
474
|
-
if (!this._modelConfiguration.material) {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
extendClassWithConfig(material, this._modelConfiguration.material);
|
|
478
|
-
if (material instanceof PBRMaterial) {
|
|
479
|
-
if (this._modelConfiguration.material.directIntensity !== undefined) {
|
|
480
|
-
material.directIntensity = this._modelConfiguration.material.directIntensity;
|
|
481
|
-
}
|
|
482
|
-
if (this._modelConfiguration.material.emissiveIntensity !== undefined) {
|
|
483
|
-
material.emissiveIntensity = this._modelConfiguration.material.emissiveIntensity;
|
|
484
|
-
}
|
|
485
|
-
if (this._modelConfiguration.material.environmentIntensity !== undefined) {
|
|
486
|
-
material.environmentIntensity = this._modelConfiguration.material.environmentIntensity;
|
|
487
|
-
}
|
|
488
|
-
if (this._modelConfiguration.material.directEnabled !== undefined) {
|
|
489
|
-
material.disableLighting = !this._modelConfiguration.material.directEnabled;
|
|
490
|
-
}
|
|
491
|
-
if (this._configurationContainer && this._configurationContainer.reflectionColor) {
|
|
492
|
-
material.reflectionColor = this._configurationContainer.reflectionColor.clone();
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
else if (material instanceof MultiMaterial) {
|
|
496
|
-
for (var i = 0; i < material.subMaterials.length; i++) {
|
|
497
|
-
var subMaterial = material.subMaterials[i];
|
|
498
|
-
if (subMaterial) {
|
|
499
|
-
this._applyModelMaterialConfiguration(subMaterial);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
/**
|
|
505
|
-
* Start entry/exit animation given an animation configuration
|
|
506
|
-
* @param animationConfiguration Entry/Exit animation configuration
|
|
507
|
-
* @param isEntry Pass true if the animation is an entry animation
|
|
508
|
-
* @param completeCallback Callback to execute when the animation completes
|
|
509
|
-
*/
|
|
510
|
-
ViewerModel.prototype._applyAnimation = function (animationConfiguration, isEntry, completeCallback) {
|
|
511
|
-
var animations = [];
|
|
512
|
-
//scale
|
|
513
|
-
if (animationConfiguration.scaling) {
|
|
514
|
-
var scaleStart = isEntry ? animationConfiguration.scaling : new Vector3(1, 1, 1);
|
|
515
|
-
var scaleEnd = isEntry ? new Vector3(1, 1, 1) : animationConfiguration.scaling;
|
|
516
|
-
if (!scaleStart.equals(scaleEnd)) {
|
|
517
|
-
this.rootMesh.scaling = scaleStart;
|
|
518
|
-
this._setLinearKeys(this._scaleTransition, this.rootMesh.scaling, scaleEnd, animationConfiguration.time);
|
|
519
|
-
animations.push(this._scaleTransition);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
//Start the animation(s)
|
|
523
|
-
this.transitionTo(animations, animationConfiguration.time, this._createEasingFunction(animationConfiguration.easingFunction), animationConfiguration.easingMode, function () {
|
|
524
|
-
if (completeCallback) {
|
|
525
|
-
completeCallback();
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
};
|
|
529
|
-
/**
|
|
530
|
-
* Begin @animations with the specified @easingFunction
|
|
531
|
-
* @param animations The BABYLON Animations to begin
|
|
532
|
-
* @param duration of transition, in seconds
|
|
533
|
-
* @param easingFunction An easing function to apply
|
|
534
|
-
* @param easingMode A easing mode to apply to the easingFunction
|
|
535
|
-
* @param onAnimationEnd Call back trigger at the end of the animation.
|
|
536
|
-
*/
|
|
537
|
-
ViewerModel.prototype.transitionTo = function (animations, duration, easingFunction, easingMode, // BABYLON.EasingFunction.EASINGMODE_EASEINOUT,
|
|
538
|
-
onAnimationEnd) {
|
|
539
|
-
if (easingMode === void 0) { easingMode = 2; }
|
|
540
|
-
if (easingFunction) {
|
|
541
|
-
for (var _i = 0, animations_1 = animations; _i < animations_1.length; _i++) {
|
|
542
|
-
var animation = animations_1[_i];
|
|
543
|
-
easingFunction.setEasingMode(easingMode);
|
|
544
|
-
animation.setEasingFunction(easingFunction);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
//Stop any current animations before starting the new one - merging not yet supported.
|
|
548
|
-
this.stopAllAnimations();
|
|
549
|
-
this.rootMesh.animations = animations;
|
|
550
|
-
if (this.rootMesh.getScene().beginAnimation !== undefined) {
|
|
551
|
-
var animatable = this.rootMesh.getScene().beginAnimation(this.rootMesh, 0, this._frameRate * duration, false, 1, function () {
|
|
552
|
-
if (onAnimationEnd) {
|
|
553
|
-
onAnimationEnd();
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
this._animatables.push(animatable);
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
/**
|
|
560
|
-
* Sets key values on an Animation from first to last frame.
|
|
561
|
-
* @param animation The Babylon animation object to set keys on
|
|
562
|
-
* @param startValue The value of the first key
|
|
563
|
-
* @param endValue The value of the last key
|
|
564
|
-
* @param duration The duration of the animation, used to determine the end frame
|
|
565
|
-
*/
|
|
566
|
-
ViewerModel.prototype._setLinearKeys = function (animation, startValue, endValue, duration) {
|
|
567
|
-
animation.setKeys([
|
|
568
|
-
{
|
|
569
|
-
frame: 0,
|
|
570
|
-
value: startValue,
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
frame: this._frameRate * duration,
|
|
574
|
-
value: endValue,
|
|
575
|
-
},
|
|
576
|
-
]);
|
|
577
|
-
};
|
|
578
|
-
/**
|
|
579
|
-
* Creates and returns a Babylon easing funtion object based on a string representing the Easing function
|
|
580
|
-
* @param easingFunctionID The enum of the easing funtion to create
|
|
581
|
-
* @returns The newly created Babylon easing function object
|
|
582
|
-
*/
|
|
583
|
-
ViewerModel.prototype._createEasingFunction = function (easingFunctionID) {
|
|
584
|
-
var easingFunction;
|
|
585
|
-
switch (easingFunctionID) {
|
|
586
|
-
case EasingFunction.CircleEase:
|
|
587
|
-
easingFunction = new CircleEase();
|
|
588
|
-
break;
|
|
589
|
-
case EasingFunction.BackEase:
|
|
590
|
-
easingFunction = new BackEase(0.3);
|
|
591
|
-
break;
|
|
592
|
-
case EasingFunction.BounceEase:
|
|
593
|
-
easingFunction = new BounceEase();
|
|
594
|
-
break;
|
|
595
|
-
case EasingFunction.CubicEase:
|
|
596
|
-
easingFunction = new CubicEase();
|
|
597
|
-
break;
|
|
598
|
-
case EasingFunction.ElasticEase:
|
|
599
|
-
easingFunction = new ElasticEase();
|
|
600
|
-
break;
|
|
601
|
-
case EasingFunction.ExponentialEase:
|
|
602
|
-
easingFunction = new ExponentialEase();
|
|
603
|
-
break;
|
|
604
|
-
case EasingFunction.PowerEase:
|
|
605
|
-
easingFunction = new PowerEase();
|
|
606
|
-
break;
|
|
607
|
-
case EasingFunction.QuadraticEase:
|
|
608
|
-
easingFunction = new QuadraticEase();
|
|
609
|
-
break;
|
|
610
|
-
case EasingFunction.QuarticEase:
|
|
611
|
-
easingFunction = new QuarticEase();
|
|
612
|
-
break;
|
|
613
|
-
case EasingFunction.QuinticEase:
|
|
614
|
-
easingFunction = new QuinticEase();
|
|
615
|
-
break;
|
|
616
|
-
case EasingFunction.SineEase:
|
|
617
|
-
easingFunction = new SineEase();
|
|
618
|
-
break;
|
|
619
|
-
default:
|
|
620
|
-
Tools.Log("No ease function found");
|
|
621
|
-
break;
|
|
622
|
-
}
|
|
623
|
-
return easingFunction;
|
|
624
|
-
};
|
|
625
|
-
/**
|
|
626
|
-
* Stops and removes all animations that have been applied to the model
|
|
627
|
-
*/
|
|
628
|
-
ViewerModel.prototype.stopAllAnimations = function () {
|
|
629
|
-
if (this.rootMesh) {
|
|
630
|
-
this.rootMesh.animations = [];
|
|
631
|
-
}
|
|
632
|
-
if (this.currentAnimation) {
|
|
633
|
-
this.currentAnimation.stop();
|
|
634
|
-
}
|
|
635
|
-
while (this._animatables.length) {
|
|
636
|
-
this._animatables[0].onAnimationEnd = null;
|
|
637
|
-
this._animatables[0].stop();
|
|
638
|
-
this._animatables.shift();
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
/**
|
|
642
|
-
* Will remove this model from the viewer (but NOT dispose it).
|
|
643
|
-
*/
|
|
644
|
-
ViewerModel.prototype.remove = function () {
|
|
645
|
-
this.stopAllAnimations();
|
|
646
|
-
if (this._observablesManager) {
|
|
647
|
-
this._observablesManager.onModelRemovedObservable.notifyObservers(this);
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
/**
|
|
651
|
-
* Dispose this model, including all of its associated assets.
|
|
652
|
-
*/
|
|
653
|
-
ViewerModel.prototype.dispose = function () {
|
|
654
|
-
this.remove();
|
|
655
|
-
this.onAfterConfigure.clear();
|
|
656
|
-
this.onLoadedObservable.clear();
|
|
657
|
-
this.onLoadErrorObservable.clear();
|
|
658
|
-
this.onLoadProgressObservable.clear();
|
|
659
|
-
if (this.loader && this.loader.name === "gltf") {
|
|
660
|
-
this.loader.dispose();
|
|
661
|
-
}
|
|
662
|
-
this.particleSystems.forEach(function (ps) { return ps.dispose(); });
|
|
663
|
-
this.particleSystems.length = 0;
|
|
664
|
-
this.skeletons.forEach(function (s) { return s.dispose(); });
|
|
665
|
-
this.skeletons.length = 0;
|
|
666
|
-
this._animations.forEach(function (ag) { return ag.dispose(); });
|
|
667
|
-
this._animations.length = 0;
|
|
668
|
-
this.rootMesh.dispose(false, true);
|
|
669
|
-
};
|
|
670
|
-
return ViewerModel;
|
|
671
|
-
}());
|
|
672
|
-
export { ViewerModel };
|
|
673
|
-
//# sourceMappingURL=viewerModel.js.map
|