@xviewer.js/core 1.0.0-alpha.21 → 1.0.0-alpha.22
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 +36 -126
- package/dist/main.js.map +1 -1
- package/dist/module.js +37 -128
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/asset/aLoader.d.ts +1 -0
- package/types/index.d.ts +1 -0
package/dist/main.js
CHANGED
|
@@ -1006,19 +1006,6 @@ class TweenManager {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
1008
|
|
|
1009
|
-
const materialMapKeys = [
|
|
1010
|
-
"alphaMap",
|
|
1011
|
-
"aoMap",
|
|
1012
|
-
"bumpMap",
|
|
1013
|
-
"displacementMap",
|
|
1014
|
-
"emissiveMap",
|
|
1015
|
-
"envMap",
|
|
1016
|
-
"lightMap",
|
|
1017
|
-
"metalnessMap",
|
|
1018
|
-
"normalMap",
|
|
1019
|
-
"roughnessMap",
|
|
1020
|
-
"specularMap"
|
|
1021
|
-
];
|
|
1022
1009
|
class aLoader {
|
|
1023
1010
|
static _setMeshData(node) {
|
|
1024
1011
|
const meshData = {
|
|
@@ -1034,7 +1021,7 @@ class aLoader {
|
|
|
1034
1021
|
meshData.meshes.push(node);
|
|
1035
1022
|
meshData.materials[mat.name] = mat;
|
|
1036
1023
|
let tex = null;
|
|
1037
|
-
for (let v of
|
|
1024
|
+
for (let v of aLoader._materialMapKeys){
|
|
1038
1025
|
tex = mat[v];
|
|
1039
1026
|
tex && (meshData.textures[tex.uuid] = tex);
|
|
1040
1027
|
}
|
|
@@ -1048,6 +1035,19 @@ class aLoader {
|
|
|
1048
1035
|
this.manager = manager;
|
|
1049
1036
|
}
|
|
1050
1037
|
}
|
|
1038
|
+
aLoader._materialMapKeys = [
|
|
1039
|
+
"alphaMap",
|
|
1040
|
+
"aoMap",
|
|
1041
|
+
"bumpMap",
|
|
1042
|
+
"displacementMap",
|
|
1043
|
+
"emissiveMap",
|
|
1044
|
+
"envMap",
|
|
1045
|
+
"lightMap",
|
|
1046
|
+
"metalnessMap",
|
|
1047
|
+
"normalMap",
|
|
1048
|
+
"roughnessMap",
|
|
1049
|
+
"specularMap"
|
|
1050
|
+
];
|
|
1051
1051
|
|
|
1052
1052
|
class aEXRLoader extends aLoader {
|
|
1053
1053
|
load({ url, onLoad, onProgress, onError, texSettings }) {
|
|
@@ -2891,53 +2891,6 @@ class Plane extends three.Mesh {
|
|
|
2891
2891
|
}
|
|
2892
2892
|
}
|
|
2893
2893
|
|
|
2894
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2895
|
-
try {
|
|
2896
|
-
var info = gen[key](arg);
|
|
2897
|
-
var value = info.value;
|
|
2898
|
-
} catch (error) {
|
|
2899
|
-
reject(error);
|
|
2900
|
-
return;
|
|
2901
|
-
}
|
|
2902
|
-
if (info.done) resolve(value);
|
|
2903
|
-
else Promise.resolve(value).then(_next, _throw);
|
|
2904
|
-
}
|
|
2905
|
-
function _async_to_generator(fn) {
|
|
2906
|
-
return function() {
|
|
2907
|
-
var self = this, args = arguments;
|
|
2908
|
-
|
|
2909
|
-
return new Promise(function(resolve, reject) {
|
|
2910
|
-
var gen = fn.apply(self, args);
|
|
2911
|
-
|
|
2912
|
-
function _next(value) {
|
|
2913
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
|
-
function _throw(err) {
|
|
2917
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
_next(undefined);
|
|
2921
|
-
});
|
|
2922
|
-
};
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2925
|
-
function _object_without_properties_loose(source, excluded) {
|
|
2926
|
-
if (source == null) return {};
|
|
2927
|
-
|
|
2928
|
-
var target = {};
|
|
2929
|
-
var sourceKeys = Object.keys(source);
|
|
2930
|
-
var key, i;
|
|
2931
|
-
|
|
2932
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
2933
|
-
key = sourceKeys[i];
|
|
2934
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2935
|
-
target[key] = source[key];
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
return target;
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
2894
|
class Caller {
|
|
2942
2895
|
get pause() {
|
|
2943
2896
|
return this._pause;
|
|
@@ -3442,12 +3395,7 @@ class ResourceManager {
|
|
|
3442
3395
|
this._loaders.set(ext, loader);
|
|
3443
3396
|
}
|
|
3444
3397
|
}
|
|
3445
|
-
loadAsset(
|
|
3446
|
-
var { url, ext, onProgress } = _param, props = _object_without_properties_loose(_param, [
|
|
3447
|
-
"url",
|
|
3448
|
-
"ext",
|
|
3449
|
-
"onProgress"
|
|
3450
|
-
]);
|
|
3398
|
+
loadAsset({ url, ext, onProgress, ...props }) {
|
|
3451
3399
|
return new Promise((resolve, reject)=>{
|
|
3452
3400
|
const info = ResourceManager._parseURL(url);
|
|
3453
3401
|
const texSettings = ResourceManager._splitTextureSettings(props);
|
|
@@ -3805,30 +3753,20 @@ class Viewer extends EventEmitter {
|
|
|
3805
3753
|
addLoader(Loader) {
|
|
3806
3754
|
this._resourceManager.addLoader(Loader);
|
|
3807
3755
|
}
|
|
3808
|
-
load(
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
const node = yield _this.loadAsset({
|
|
3819
|
-
url,
|
|
3820
|
-
ext,
|
|
3821
|
-
onProgress
|
|
3756
|
+
async load({ url, ext, onProgress, castShadow = false, receiveShadow = false, ...props }) {
|
|
3757
|
+
const node = await this.loadAsset({
|
|
3758
|
+
url,
|
|
3759
|
+
ext,
|
|
3760
|
+
onProgress
|
|
3761
|
+
});
|
|
3762
|
+
if (castShadow || receiveShadow) {
|
|
3763
|
+
node.userData.meshData.meshes.forEach((v)=>{
|
|
3764
|
+
v.castShadow = castShadow;
|
|
3765
|
+
v.receiveShadow = receiveShadow;
|
|
3822
3766
|
});
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
v.receiveShadow = receiveShadow;
|
|
3827
|
-
});
|
|
3828
|
-
}
|
|
3829
|
-
_this.addNode(node, props);
|
|
3830
|
-
return node;
|
|
3831
|
-
})();
|
|
3767
|
+
}
|
|
3768
|
+
this.addNode(node, props);
|
|
3769
|
+
return node;
|
|
3832
3770
|
}
|
|
3833
3771
|
tween(target) {
|
|
3834
3772
|
return this._tweenManager.tween(target);
|
|
@@ -3877,18 +3815,7 @@ class Viewer extends EventEmitter {
|
|
|
3877
3815
|
removeComponent(node, component) {
|
|
3878
3816
|
return this._componentManager.removeComponent(node, component);
|
|
3879
3817
|
}
|
|
3880
|
-
addNode(object,
|
|
3881
|
-
var { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene } = _param, props = _object_without_properties_loose(_param, [
|
|
3882
|
-
"args",
|
|
3883
|
-
"debug",
|
|
3884
|
-
"scale",
|
|
3885
|
-
"position",
|
|
3886
|
-
"rotation",
|
|
3887
|
-
"shadowArgs",
|
|
3888
|
-
"makeDefault",
|
|
3889
|
-
"component",
|
|
3890
|
-
"parent"
|
|
3891
|
-
]);
|
|
3818
|
+
addNode(object, { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene, ...props } = {}) {
|
|
3892
3819
|
let node = null;
|
|
3893
3820
|
let ins = getClassInstance(object, args);
|
|
3894
3821
|
if (ins.isObject3D) {
|
|
@@ -4013,30 +3940,12 @@ class Viewer extends EventEmitter {
|
|
|
4013
3940
|
Viewer.CompileObject3D(this._renderer, this._scene, this._camera, this._scene);
|
|
4014
3941
|
}
|
|
4015
3942
|
}
|
|
4016
|
-
constructor(
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
}, targetFrameRate = -1, colorSpace = three.SRGBColorSpace, toneMapping = three.LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", loader = {}, tasker = {} } = _param, webglOpts = _object_without_properties_loose(_param, [
|
|
4023
|
-
"root",
|
|
4024
|
-
"canvas",
|
|
4025
|
-
"autoStart",
|
|
4026
|
-
"autoResize",
|
|
4027
|
-
"shadows",
|
|
4028
|
-
"camera",
|
|
4029
|
-
"targetFrameRate",
|
|
4030
|
-
"colorSpace",
|
|
4031
|
-
"toneMapping",
|
|
4032
|
-
"toneMappingExposure",
|
|
4033
|
-
"maxDPR",
|
|
4034
|
-
"path",
|
|
4035
|
-
"resourcePath",
|
|
4036
|
-
"dracoPath",
|
|
4037
|
-
"loader",
|
|
4038
|
-
"tasker"
|
|
4039
|
-
]);
|
|
3943
|
+
constructor({ root, canvas, autoStart = true, autoResize = true, shadows = false, camera = {
|
|
3944
|
+
fov: 45,
|
|
3945
|
+
near: 1,
|
|
3946
|
+
far: 1000,
|
|
3947
|
+
position: new three.Vector3(0, 0, 4)
|
|
3948
|
+
}, targetFrameRate = -1, colorSpace = three.SRGBColorSpace, toneMapping = three.LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", loader = {}, tasker = {}, ...webglOpts } = {}){
|
|
4040
3949
|
super();
|
|
4041
3950
|
this._dpr = 1;
|
|
4042
3951
|
this._width = 1;
|
|
@@ -4163,6 +4072,7 @@ exports.aFBXLoader = aFBXLoader;
|
|
|
4163
4072
|
exports.aGLTFLoader = aGLTFLoader;
|
|
4164
4073
|
exports.aHDRLoader = aHDRLoader;
|
|
4165
4074
|
exports.aJSONLoader = aJSONLoader;
|
|
4075
|
+
exports.aLoader = aLoader;
|
|
4166
4076
|
exports.aTextureLoader = aTextureLoader;
|
|
4167
4077
|
exports.exponentialDamp = exponentialDamp;
|
|
4168
4078
|
exports.getClassInstance = getClassInstance;
|