@xviewer.js/core 1.0.0-alpha.55 → 1.0.0-alpha.56
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/main.js +39 -11
- package/dist/main.js.map +1 -1
- package/dist/module.js +39 -12
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Task.d.ts +2 -0
- package/types/Viewer.d.ts +10 -2
- package/types/asset/ResourceManager.d.ts +4 -2
- package/types/asset/aLoader.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/loaders/aFBXLoader.d.ts +1 -1
- package/types/loaders/aGLTFLoader.d.ts +1 -1
package/dist/module.js
CHANGED
|
@@ -1119,14 +1119,18 @@ class aEXRLoader extends aLoader {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
1121
|
class aFBXLoader extends aLoader {
|
|
1122
|
-
load({ url, onLoad, onProgress, onError }) {
|
|
1122
|
+
load({ url, buffer, onLoad, onProgress, onError }) {
|
|
1123
1123
|
const loadCallback = (node)=>{
|
|
1124
1124
|
onLoad(aLoader._setUserData(node));
|
|
1125
1125
|
};
|
|
1126
1126
|
const loader = new FBXLoader(this.manager.loadingManager);
|
|
1127
1127
|
loader.setPath(this.manager.path);
|
|
1128
1128
|
loader.setResourcePath(this.manager.resourcePath);
|
|
1129
|
-
|
|
1129
|
+
if (buffer) {
|
|
1130
|
+
loadCallback(loader.parse(buffer, this.manager.path));
|
|
1131
|
+
} else {
|
|
1132
|
+
loader.load(url, loadCallback, onProgress, onError);
|
|
1133
|
+
}
|
|
1130
1134
|
}
|
|
1131
1135
|
constructor(...args){
|
|
1132
1136
|
super(...args);
|
|
@@ -1137,7 +1141,7 @@ class aFBXLoader extends aLoader {
|
|
|
1137
1141
|
}
|
|
1138
1142
|
|
|
1139
1143
|
class aGLTFLoader extends aLoader {
|
|
1140
|
-
load({ url, onLoad, onProgress, onError }) {
|
|
1144
|
+
load({ url, buffer, onLoad, onProgress, onError }) {
|
|
1141
1145
|
const loadCallback = (gltf)=>{
|
|
1142
1146
|
const node = gltf.scene;
|
|
1143
1147
|
if (gltf.animations) node.animations = gltf.animations;
|
|
@@ -1150,7 +1154,11 @@ class aGLTFLoader extends aLoader {
|
|
|
1150
1154
|
dracoLoader.setDecoderPath(this.manager.dracoPath);
|
|
1151
1155
|
gltfLoader.setDRACOLoader(dracoLoader);
|
|
1152
1156
|
gltfLoader.setMeshoptDecoder(MeshoptDecoder);
|
|
1153
|
-
|
|
1157
|
+
if (buffer) {
|
|
1158
|
+
gltfLoader.parse(buffer, this.manager.path, loadCallback, onError);
|
|
1159
|
+
} else {
|
|
1160
|
+
gltfLoader.load(url, loadCallback, onProgress, onError);
|
|
1161
|
+
}
|
|
1154
1162
|
}
|
|
1155
1163
|
constructor(...args){
|
|
1156
1164
|
super(...args);
|
|
@@ -1163,13 +1171,13 @@ class aGLTFLoader extends aLoader {
|
|
|
1163
1171
|
|
|
1164
1172
|
class aHDRLoader extends aLoader {
|
|
1165
1173
|
load({ url, onLoad, onProgress, onError, texSettings }) {
|
|
1166
|
-
|
|
1174
|
+
const settings = Object.assign({
|
|
1167
1175
|
mapping: EquirectangularReflectionMapping
|
|
1168
1176
|
}, texSettings);
|
|
1169
1177
|
const loader = new RGBELoader(this.manager.loadingManager);
|
|
1170
1178
|
loader.setPath(this.manager.path);
|
|
1171
1179
|
loader.setResourcePath(this.manager.resourcePath);
|
|
1172
|
-
loader.load(url, (tex)=>onLoad(Object.assign(tex,
|
|
1180
|
+
loader.load(url, (tex)=>onLoad(Object.assign(tex, settings)), onProgress, onError);
|
|
1173
1181
|
}
|
|
1174
1182
|
constructor(...args){
|
|
1175
1183
|
super(...args);
|
|
@@ -4241,7 +4249,7 @@ class ResourceManager {
|
|
|
4241
4249
|
static extension(path) {
|
|
4242
4250
|
let str = path.split(".");
|
|
4243
4251
|
if (str.length > 1) {
|
|
4244
|
-
return str.pop();
|
|
4252
|
+
return str.pop().toLowerCase();
|
|
4245
4253
|
}
|
|
4246
4254
|
return "";
|
|
4247
4255
|
}
|
|
@@ -4279,13 +4287,16 @@ class ResourceManager {
|
|
|
4279
4287
|
this._caches.clear();
|
|
4280
4288
|
this._loaders.clear();
|
|
4281
4289
|
}
|
|
4290
|
+
getLoader(ext) {
|
|
4291
|
+
return this._loaders.get(ext);
|
|
4292
|
+
}
|
|
4282
4293
|
addLoader(Loader) {
|
|
4283
4294
|
let loader = new Loader(this);
|
|
4284
4295
|
for (let ext of loader.extension){
|
|
4285
4296
|
this._loaders.set(ext, loader);
|
|
4286
4297
|
}
|
|
4287
4298
|
}
|
|
4288
|
-
loadAsset({ url, ext, onProgress, ...props }) {
|
|
4299
|
+
loadAsset({ url, buffer, ext, onProgress, ...props }) {
|
|
4289
4300
|
return new Promise((resolve, reject)=>{
|
|
4290
4301
|
const ext_ = ResourceManager.extension(url);
|
|
4291
4302
|
const texSettings = ResourceManager._splitTextureSettings(props);
|
|
@@ -4298,10 +4309,11 @@ class ResourceManager {
|
|
|
4298
4309
|
this._caches.set(key, file);
|
|
4299
4310
|
resolve(file);
|
|
4300
4311
|
};
|
|
4301
|
-
|
|
4312
|
+
const sel = ext || ext_;
|
|
4302
4313
|
if (this._loaders.has(sel)) {
|
|
4303
4314
|
this._loaders.get(sel).load({
|
|
4304
4315
|
url,
|
|
4316
|
+
buffer,
|
|
4305
4317
|
texSettings,
|
|
4306
4318
|
onProgress,
|
|
4307
4319
|
onLoad,
|
|
@@ -4310,7 +4322,7 @@ class ResourceManager {
|
|
|
4310
4322
|
}
|
|
4311
4323
|
});
|
|
4312
4324
|
} else {
|
|
4313
|
-
reject("ResourceManager.loadAsset: missing loader for " +
|
|
4325
|
+
reject("ResourceManager.loadAsset: missing loader for " + url);
|
|
4314
4326
|
}
|
|
4315
4327
|
}
|
|
4316
4328
|
});
|
|
@@ -4587,6 +4599,15 @@ class Viewer extends EventEmitter {
|
|
|
4587
4599
|
set targetFrameRate(v) {
|
|
4588
4600
|
this._targetFrameRate = Math.max(0.001, v);
|
|
4589
4601
|
}
|
|
4602
|
+
get loadingManager() {
|
|
4603
|
+
return this._loadingManager;
|
|
4604
|
+
}
|
|
4605
|
+
get resourceManager() {
|
|
4606
|
+
return this._resourceManager;
|
|
4607
|
+
}
|
|
4608
|
+
get taskManager() {
|
|
4609
|
+
return this._taskManager;
|
|
4610
|
+
}
|
|
4590
4611
|
destroy() {
|
|
4591
4612
|
this.stop();
|
|
4592
4613
|
this._renderer.dispose();
|
|
@@ -4713,6 +4734,9 @@ class Viewer extends EventEmitter {
|
|
|
4713
4734
|
loadAsset(props) {
|
|
4714
4735
|
return this._resourceManager.loadAsset(props);
|
|
4715
4736
|
}
|
|
4737
|
+
getLoader(ext) {
|
|
4738
|
+
return this._resourceManager.getLoader(ext);
|
|
4739
|
+
}
|
|
4716
4740
|
addLoader(Loader) {
|
|
4717
4741
|
this._resourceManager.addLoader(Loader);
|
|
4718
4742
|
}
|
|
@@ -4756,6 +4780,9 @@ class Viewer extends EventEmitter {
|
|
|
4756
4780
|
removeComponent(node, component) {
|
|
4757
4781
|
return this._componentManager.removeComponent(node, component);
|
|
4758
4782
|
}
|
|
4783
|
+
addTask(task) {
|
|
4784
|
+
this._taskManager.add(task);
|
|
4785
|
+
}
|
|
4759
4786
|
addNode(object, { args, debug, scale, position, rotation, layer, shadowArgs, makeDefault, component, parent = this._scene, ...props } = {}) {
|
|
4760
4787
|
let node = null;
|
|
4761
4788
|
let ins = getClassInstance(object, args);
|
|
@@ -4934,7 +4961,7 @@ class Viewer extends EventEmitter {
|
|
|
4934
4961
|
this._renderer.shadowMap.enabled = !!shadows;
|
|
4935
4962
|
this._renderer.shadowMap.type = typeof shadows === "boolean" ? PCFSoftShadowMap : shadows;
|
|
4936
4963
|
this._renderer.info.autoReset = false;
|
|
4937
|
-
const loadingManager = new LoadingManager(loader.onLoad, loader.onProgress, loader.onError);
|
|
4964
|
+
const loadingManager = this._loadingManager = new LoadingManager(loader.onLoad, loader.onProgress, loader.onError);
|
|
4938
4965
|
this._resourceManager = new ResourceManager({
|
|
4939
4966
|
path,
|
|
4940
4967
|
resourcePath,
|
|
@@ -5538,5 +5565,5 @@ class PerformanceMonitorPlugin extends Plugin {
|
|
|
5538
5565
|
}
|
|
5539
5566
|
}
|
|
5540
5567
|
|
|
5541
|
-
export { AnimationCurve, Box, BoxProjectionPlugin, CinestationBlendDefinition, CinestationBrain, Component, DebugPlugin, DeviceInput, Easing, EnvironmentPlugin, EventEmitter, FInterpConstantTo, FInterpTo, FreelookVirtualCamera, Logger, ObjectInstance, Orientation, PerformanceMonitorPlugin, Perlin, Plane, Plugin, PropertyManager, QInterpConstantTo, QInterpTo, Quat_AngularDistance, Quat_Equals, Quat_exponentialDamp, Quat_quarticDamp, Quat_smoothDamp, Reflector, ReflectorMaterial, Sphere, SystemInfo, Tween, TweenChain, TweenManager, VInterpConstantTo, VInterpTo, Vec3_smoothDamp, Vector3_NEG_ONE, Vector3_ONE, Vector3_RIGHT, Vector3_UNIT_X, Vector3_UNIT_Y, Vector3_UNIT_Z, Vector3_UP, Vector3_ZERO, Viewer, VirtualCamera, aEXRLoader, aFBXLoader, aGLTFLoader, aHDRLoader, aJSONLoader, aLoader, aTextureLoader, exponentialDamp, frag_BoxfilterBlur, frag_cubeMapToPanorama, frag_panoramaToCubeMap, getClassInstance, getShaderMaterial, mixin, property, quarticDamp, smoothDamp, vert_fullscreen };
|
|
5568
|
+
export { AnimationCurve, Box, BoxProjectionPlugin, CinestationBlendDefinition, CinestationBrain, Component, DebugPlugin, DeviceInput, Easing, EnvironmentPlugin, EventEmitter, FInterpConstantTo, FInterpTo, FreelookVirtualCamera, Logger, ObjectInstance, Orientation, PerformanceMonitorPlugin, Perlin, Plane, Plugin, PropertyManager, QInterpConstantTo, QInterpTo, Quat_AngularDistance, Quat_Equals, Quat_exponentialDamp, Quat_quarticDamp, Quat_smoothDamp, Reflector, ReflectorMaterial, ResourceManager, Sphere, SystemInfo, Tween, TweenChain, TweenManager, VInterpConstantTo, VInterpTo, Vec3_smoothDamp, Vector3_NEG_ONE, Vector3_ONE, Vector3_RIGHT, Vector3_UNIT_X, Vector3_UNIT_Y, Vector3_UNIT_Z, Vector3_UP, Vector3_ZERO, Viewer, VirtualCamera, aEXRLoader, aFBXLoader, aGLTFLoader, aHDRLoader, aJSONLoader, aLoader, aTextureLoader, exponentialDamp, frag_BoxfilterBlur, frag_cubeMapToPanorama, frag_panoramaToCubeMap, getClassInstance, getShaderMaterial, mixin, property, quarticDamp, smoothDamp, vert_fullscreen };
|
|
5542
5569
|
//# sourceMappingURL=module.js.map
|