@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/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mesh, EquirectangularReflectionMapping, FileLoader, TextureLoader, SRGBColorSpace, MathUtils, Vector3, Quaternion, Raycaster, Vector2, LinearInterpolant, Spherical, Object3D, BoxGeometry, SphereGeometry, PlaneGeometry, HalfFloatType, FloatType, UnsignedByteType, OrthographicCamera, BufferGeometry, Float32BufferAttribute, WebGLRenderTarget, ClampToEdgeWrapping, NearestFilter, LinearFilter, LinearMipMapLinearFilter, WebGLCubeRenderTarget, DataTexture, RGBAFormat, UVMapping, Scene,
|
|
1
|
+
import { Mesh, EquirectangularReflectionMapping, FileLoader, TextureLoader, SRGBColorSpace, MathUtils, Vector3, Quaternion, Raycaster, Vector2, LinearInterpolant, Spherical, Object3D, BoxGeometry, SphereGeometry, PlaneGeometry, HalfFloatType, FloatType, UnsignedByteType, OrthographicCamera, BufferGeometry, Float32BufferAttribute, WebGLRenderTarget, ClampToEdgeWrapping, NearestFilter, LinearFilter, LinearMipMapLinearFilter, WebGLCubeRenderTarget, DataTexture, RGBAFormat, UVMapping, Scene, PerspectiveCamera, WebGLRenderer, PCFSoftShadowMap, LoadingManager, LinearToneMapping } from 'three';
|
|
2
2
|
import { EXRLoader } from 'three/examples/jsm/loaders/EXRLoader.js';
|
|
3
3
|
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js';
|
|
4
4
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
@@ -1004,19 +1004,6 @@ class TweenManager {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
-
const materialMapKeys = [
|
|
1008
|
-
"alphaMap",
|
|
1009
|
-
"aoMap",
|
|
1010
|
-
"bumpMap",
|
|
1011
|
-
"displacementMap",
|
|
1012
|
-
"emissiveMap",
|
|
1013
|
-
"envMap",
|
|
1014
|
-
"lightMap",
|
|
1015
|
-
"metalnessMap",
|
|
1016
|
-
"normalMap",
|
|
1017
|
-
"roughnessMap",
|
|
1018
|
-
"specularMap"
|
|
1019
|
-
];
|
|
1020
1007
|
class aLoader {
|
|
1021
1008
|
static _setMeshData(node) {
|
|
1022
1009
|
const meshData = {
|
|
@@ -1032,7 +1019,7 @@ class aLoader {
|
|
|
1032
1019
|
meshData.meshes.push(node);
|
|
1033
1020
|
meshData.materials[mat.name] = mat;
|
|
1034
1021
|
let tex = null;
|
|
1035
|
-
for (let v of
|
|
1022
|
+
for (let v of aLoader._materialMapKeys){
|
|
1036
1023
|
tex = mat[v];
|
|
1037
1024
|
tex && (meshData.textures[tex.uuid] = tex);
|
|
1038
1025
|
}
|
|
@@ -1046,6 +1033,19 @@ class aLoader {
|
|
|
1046
1033
|
this.manager = manager;
|
|
1047
1034
|
}
|
|
1048
1035
|
}
|
|
1036
|
+
aLoader._materialMapKeys = [
|
|
1037
|
+
"alphaMap",
|
|
1038
|
+
"aoMap",
|
|
1039
|
+
"bumpMap",
|
|
1040
|
+
"displacementMap",
|
|
1041
|
+
"emissiveMap",
|
|
1042
|
+
"envMap",
|
|
1043
|
+
"lightMap",
|
|
1044
|
+
"metalnessMap",
|
|
1045
|
+
"normalMap",
|
|
1046
|
+
"roughnessMap",
|
|
1047
|
+
"specularMap"
|
|
1048
|
+
];
|
|
1049
1049
|
|
|
1050
1050
|
class aEXRLoader extends aLoader {
|
|
1051
1051
|
load({ url, onLoad, onProgress, onError, texSettings }) {
|
|
@@ -2889,53 +2889,6 @@ class Plane extends Mesh {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
}
|
|
2891
2891
|
|
|
2892
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2893
|
-
try {
|
|
2894
|
-
var info = gen[key](arg);
|
|
2895
|
-
var value = info.value;
|
|
2896
|
-
} catch (error) {
|
|
2897
|
-
reject(error);
|
|
2898
|
-
return;
|
|
2899
|
-
}
|
|
2900
|
-
if (info.done) resolve(value);
|
|
2901
|
-
else Promise.resolve(value).then(_next, _throw);
|
|
2902
|
-
}
|
|
2903
|
-
function _async_to_generator(fn) {
|
|
2904
|
-
return function() {
|
|
2905
|
-
var self = this, args = arguments;
|
|
2906
|
-
|
|
2907
|
-
return new Promise(function(resolve, reject) {
|
|
2908
|
-
var gen = fn.apply(self, args);
|
|
2909
|
-
|
|
2910
|
-
function _next(value) {
|
|
2911
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2912
|
-
}
|
|
2913
|
-
|
|
2914
|
-
function _throw(err) {
|
|
2915
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2916
|
-
}
|
|
2917
|
-
|
|
2918
|
-
_next(undefined);
|
|
2919
|
-
});
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
function _object_without_properties_loose(source, excluded) {
|
|
2924
|
-
if (source == null) return {};
|
|
2925
|
-
|
|
2926
|
-
var target = {};
|
|
2927
|
-
var sourceKeys = Object.keys(source);
|
|
2928
|
-
var key, i;
|
|
2929
|
-
|
|
2930
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
2931
|
-
key = sourceKeys[i];
|
|
2932
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2933
|
-
target[key] = source[key];
|
|
2934
|
-
}
|
|
2935
|
-
|
|
2936
|
-
return target;
|
|
2937
|
-
}
|
|
2938
|
-
|
|
2939
2892
|
class Caller {
|
|
2940
2893
|
get pause() {
|
|
2941
2894
|
return this._pause;
|
|
@@ -3440,12 +3393,7 @@ class ResourceManager {
|
|
|
3440
3393
|
this._loaders.set(ext, loader);
|
|
3441
3394
|
}
|
|
3442
3395
|
}
|
|
3443
|
-
loadAsset(
|
|
3444
|
-
var { url, ext, onProgress } = _param, props = _object_without_properties_loose(_param, [
|
|
3445
|
-
"url",
|
|
3446
|
-
"ext",
|
|
3447
|
-
"onProgress"
|
|
3448
|
-
]);
|
|
3396
|
+
loadAsset({ url, ext, onProgress, ...props }) {
|
|
3449
3397
|
return new Promise((resolve, reject)=>{
|
|
3450
3398
|
const info = ResourceManager._parseURL(url);
|
|
3451
3399
|
const texSettings = ResourceManager._splitTextureSettings(props);
|
|
@@ -3803,30 +3751,20 @@ class Viewer extends EventEmitter {
|
|
|
3803
3751
|
addLoader(Loader) {
|
|
3804
3752
|
this._resourceManager.addLoader(Loader);
|
|
3805
3753
|
}
|
|
3806
|
-
load(
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
const node = yield _this.loadAsset({
|
|
3817
|
-
url,
|
|
3818
|
-
ext,
|
|
3819
|
-
onProgress
|
|
3754
|
+
async load({ url, ext, onProgress, castShadow = false, receiveShadow = false, ...props }) {
|
|
3755
|
+
const node = await this.loadAsset({
|
|
3756
|
+
url,
|
|
3757
|
+
ext,
|
|
3758
|
+
onProgress
|
|
3759
|
+
});
|
|
3760
|
+
if (castShadow || receiveShadow) {
|
|
3761
|
+
node.userData.meshData.meshes.forEach((v)=>{
|
|
3762
|
+
v.castShadow = castShadow;
|
|
3763
|
+
v.receiveShadow = receiveShadow;
|
|
3820
3764
|
});
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
v.receiveShadow = receiveShadow;
|
|
3825
|
-
});
|
|
3826
|
-
}
|
|
3827
|
-
_this.addNode(node, props);
|
|
3828
|
-
return node;
|
|
3829
|
-
})();
|
|
3765
|
+
}
|
|
3766
|
+
this.addNode(node, props);
|
|
3767
|
+
return node;
|
|
3830
3768
|
}
|
|
3831
3769
|
tween(target) {
|
|
3832
3770
|
return this._tweenManager.tween(target);
|
|
@@ -3875,18 +3813,7 @@ class Viewer extends EventEmitter {
|
|
|
3875
3813
|
removeComponent(node, component) {
|
|
3876
3814
|
return this._componentManager.removeComponent(node, component);
|
|
3877
3815
|
}
|
|
3878
|
-
addNode(object,
|
|
3879
|
-
var { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene } = _param, props = _object_without_properties_loose(_param, [
|
|
3880
|
-
"args",
|
|
3881
|
-
"debug",
|
|
3882
|
-
"scale",
|
|
3883
|
-
"position",
|
|
3884
|
-
"rotation",
|
|
3885
|
-
"shadowArgs",
|
|
3886
|
-
"makeDefault",
|
|
3887
|
-
"component",
|
|
3888
|
-
"parent"
|
|
3889
|
-
]);
|
|
3816
|
+
addNode(object, { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene, ...props } = {}) {
|
|
3890
3817
|
let node = null;
|
|
3891
3818
|
let ins = getClassInstance(object, args);
|
|
3892
3819
|
if (ins.isObject3D) {
|
|
@@ -4011,30 +3938,12 @@ class Viewer extends EventEmitter {
|
|
|
4011
3938
|
Viewer.CompileObject3D(this._renderer, this._scene, this._camera, this._scene);
|
|
4012
3939
|
}
|
|
4013
3940
|
}
|
|
4014
|
-
constructor(
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
}, targetFrameRate = -1, colorSpace = SRGBColorSpace, toneMapping = 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, [
|
|
4021
|
-
"root",
|
|
4022
|
-
"canvas",
|
|
4023
|
-
"autoStart",
|
|
4024
|
-
"autoResize",
|
|
4025
|
-
"shadows",
|
|
4026
|
-
"camera",
|
|
4027
|
-
"targetFrameRate",
|
|
4028
|
-
"colorSpace",
|
|
4029
|
-
"toneMapping",
|
|
4030
|
-
"toneMappingExposure",
|
|
4031
|
-
"maxDPR",
|
|
4032
|
-
"path",
|
|
4033
|
-
"resourcePath",
|
|
4034
|
-
"dracoPath",
|
|
4035
|
-
"loader",
|
|
4036
|
-
"tasker"
|
|
4037
|
-
]);
|
|
3941
|
+
constructor({ root, canvas, autoStart = true, autoResize = true, shadows = false, camera = {
|
|
3942
|
+
fov: 45,
|
|
3943
|
+
near: 1,
|
|
3944
|
+
far: 1000,
|
|
3945
|
+
position: new Vector3(0, 0, 4)
|
|
3946
|
+
}, targetFrameRate = -1, colorSpace = SRGBColorSpace, toneMapping = LinearToneMapping, toneMappingExposure = 1, maxDPR = 1.5, path = "", resourcePath = "", dracoPath = "https://www.gstatic.com/draco/v1/decoders/", loader = {}, tasker = {}, ...webglOpts } = {}){
|
|
4038
3947
|
super();
|
|
4039
3948
|
this._dpr = 1;
|
|
4040
3949
|
this._width = 1;
|
|
@@ -4114,5 +4023,5 @@ class Plugin extends ObjectInstance {
|
|
|
4114
4023
|
}
|
|
4115
4024
|
}
|
|
4116
4025
|
|
|
4117
|
-
export { AnimationCurve, Box, CinestationBlendDefinition, CinestationBrain, Component, DeviceInput, Easing, EventEmitter, FInterpConstantTo, FInterpTo, FreelookVirtualCamera, Logger, ObjectInstance, Perlin, Plane, Plugin, PropertyManager, QInterpConstantTo, QInterpTo, Quat_AngularDistance, Quat_Equals, Quat_exponentialDamp, Quat_quarticDamp, Quat_smoothDamp, 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, aTextureLoader, exponentialDamp, getClassInstance, mixin, property, quarticDamp, smoothDamp };
|
|
4026
|
+
export { AnimationCurve, Box, CinestationBlendDefinition, CinestationBrain, Component, DeviceInput, Easing, EventEmitter, FInterpConstantTo, FInterpTo, FreelookVirtualCamera, Logger, ObjectInstance, Perlin, Plane, Plugin, PropertyManager, QInterpConstantTo, QInterpTo, Quat_AngularDistance, Quat_Equals, Quat_exponentialDamp, Quat_quarticDamp, Quat_smoothDamp, 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, getClassInstance, mixin, property, quarticDamp, smoothDamp };
|
|
4118
4027
|
//# sourceMappingURL=module.js.map
|