@xviewer.js/core 1.0.5-alhpa.1 → 1.0.5-alhpa.2
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.cjs +68 -43
- package/dist/main.cjs.map +1 -1
- package/dist/module.js +68 -43
- package/dist/module.js.map +1 -1
- package/package.json +2 -2
- package/types/DeviceInput.d.ts +6 -1
- package/types/Viewer.d.ts +5 -8
- package/types/components/Environment.d.ts +1 -1
- package/types/components/RenderTexture.d.ts +1 -1
- package/types/materials/ReflectorMaterial.d.ts +3 -0
- package/types/passes/cubeuv/MergeBlurPass.d.ts +2 -2
- package/types/passes/cubeuv/MergeReflectPass.d.ts +1 -1
package/dist/main.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var GLTFLoader_js = require('three/examples/jsm/loaders/GLTFLoader.js');
|
|
|
6
6
|
var DRACOLoader_js = require('three/examples/jsm/loaders/DRACOLoader.js');
|
|
7
7
|
var meshopt_decoder_module_js = require('three/examples/jsm/libs/meshopt_decoder.module.js');
|
|
8
8
|
var THREE = require('three');
|
|
9
|
-
var
|
|
9
|
+
var HDRLoader_js = require('three/examples/jsm/loaders/HDRLoader.js');
|
|
10
10
|
var SVGLoader_js = require('three/examples/jsm/loaders/SVGLoader.js');
|
|
11
11
|
var KTX2Loader_js = require('three/examples/jsm/loaders/KTX2Loader.js');
|
|
12
12
|
var Addons_js = require('three/examples/jsm/Addons.js');
|
|
@@ -291,7 +291,7 @@ class HDRLoader extends Loader {
|
|
|
291
291
|
load({ url, path, resourcePath, manager, texSettings, onLoad, onProgress, onError }) {
|
|
292
292
|
let loader = this._loader;
|
|
293
293
|
if (loader === undefined) {
|
|
294
|
-
loader = this._loader = new
|
|
294
|
+
loader = this._loader = new HDRLoader_js.HDRLoader();
|
|
295
295
|
}
|
|
296
296
|
loader.manager = manager;
|
|
297
297
|
loader.setPath(path);
|
|
@@ -2647,9 +2647,15 @@ class DeviceInput extends Component {
|
|
|
2647
2647
|
get pointerPixel() {
|
|
2648
2648
|
return this._pointerPixel;
|
|
2649
2649
|
}
|
|
2650
|
+
get pointerDown() {
|
|
2651
|
+
return this._pointerDown;
|
|
2652
|
+
}
|
|
2650
2653
|
get pointerButton() {
|
|
2651
2654
|
return this._pointerButton;
|
|
2652
2655
|
}
|
|
2656
|
+
get pointerMoving() {
|
|
2657
|
+
return this._pointerMoving;
|
|
2658
|
+
}
|
|
2653
2659
|
get prePointer() {
|
|
2654
2660
|
return this._prePointer;
|
|
2655
2661
|
}
|
|
@@ -2677,6 +2683,9 @@ class DeviceInput extends Component {
|
|
|
2677
2683
|
get keys() {
|
|
2678
2684
|
return this._keys;
|
|
2679
2685
|
}
|
|
2686
|
+
get pressability() {
|
|
2687
|
+
return this._pressability;
|
|
2688
|
+
}
|
|
2680
2689
|
onEnable() {
|
|
2681
2690
|
const dom = this._target;
|
|
2682
2691
|
this._addEventListener(dom, 'contextmenu', (e)=>e.preventDefault());
|
|
@@ -2729,6 +2738,8 @@ class DeviceInput extends Component {
|
|
|
2729
2738
|
this._listeners = [];
|
|
2730
2739
|
}
|
|
2731
2740
|
lastUpdate(dt) {
|
|
2741
|
+
this._pointerDown = false;
|
|
2742
|
+
this._pointerMoving = false;
|
|
2732
2743
|
this._prePointer.copy(this._pointer);
|
|
2733
2744
|
this._prePointerPixel.copy(this._pointerPixel);
|
|
2734
2745
|
for(let i = this._touchCount; i--;){
|
|
@@ -2813,6 +2824,7 @@ class DeviceInput extends Component {
|
|
|
2813
2824
|
}
|
|
2814
2825
|
_onPointerDown(e) {
|
|
2815
2826
|
e = this._remapPointer(e);
|
|
2827
|
+
this._pointerDown = true;
|
|
2816
2828
|
this._pointerButton = e.button;
|
|
2817
2829
|
this._computePointer(e);
|
|
2818
2830
|
this._prePointer.copy(this._pointer);
|
|
@@ -2830,6 +2842,7 @@ class DeviceInput extends Component {
|
|
|
2830
2842
|
_onPointerMove(e) {
|
|
2831
2843
|
e = this._remapPointer(e);
|
|
2832
2844
|
this._computePointer(e);
|
|
2845
|
+
this._pointerMoving = true;
|
|
2833
2846
|
this._pressability.pointerMove(this._pointer, this.viewer.camera);
|
|
2834
2847
|
this.viewer.emit(DeviceInput.POINTER_MOVE, e);
|
|
2835
2848
|
}
|
|
@@ -2897,7 +2910,7 @@ class DeviceInput extends Component {
|
|
|
2897
2910
|
this.viewer.emit(DeviceInput.KEYUP, e);
|
|
2898
2911
|
}
|
|
2899
2912
|
constructor(option){
|
|
2900
|
-
super(), this._listeners = [], this._touches = [], this._touchCount = 0, this._touchStart = false, this._touchMoving = false, this._pointer = new THREE.Vector2(), this._pointerPixel = new THREE.Vector2(), this._pointerButton = -1, this._prePointer = new THREE.Vector2(), this._prePointerPixel = new THREE.Vector2(), this._preTouches = [], this._mouseWheel = 0, this._keys = {}, this._pressability = new Pressability();
|
|
2913
|
+
super(), this._listeners = [], this._touches = [], this._touchCount = 0, this._touchStart = false, this._touchMoving = false, this._pointer = new THREE.Vector2(), this._pointerPixel = new THREE.Vector2(), this._pointerButton = -1, this._pointerDown = false, this._pointerMoving = false, this._prePointer = new THREE.Vector2(), this._prePointerPixel = new THREE.Vector2(), this._preTouches = [], this._mouseWheel = 0, this._keys = {}, this._pressability = new Pressability();
|
|
2901
2914
|
this._target = option.source;
|
|
2902
2915
|
this._normalizeWheel = option.normalizeWheel || normalizeWheel;
|
|
2903
2916
|
}
|
|
@@ -3934,6 +3947,12 @@ class ReflectorMaterial extends THREE.ShaderMaterial {
|
|
|
3934
3947
|
set aoMap(v) {
|
|
3935
3948
|
this.uniforms.aoMap.value = v;
|
|
3936
3949
|
}
|
|
3950
|
+
get aoMapIntensity() {
|
|
3951
|
+
return this.uniforms.aoMapIntensity.value;
|
|
3952
|
+
}
|
|
3953
|
+
set aoMapIntensity(v) {
|
|
3954
|
+
this.uniforms.aoMapIntensity.value = v;
|
|
3955
|
+
}
|
|
3937
3956
|
get lightMap() {
|
|
3938
3957
|
return this.uniforms.lightMap.value;
|
|
3939
3958
|
}
|
|
@@ -4012,6 +4031,9 @@ class ReflectorMaterial extends THREE.ShaderMaterial {
|
|
|
4012
4031
|
},
|
|
4013
4032
|
lightMapIntensity: {
|
|
4014
4033
|
value: 1
|
|
4034
|
+
},
|
|
4035
|
+
dfgLUT: {
|
|
4036
|
+
value: null
|
|
4015
4037
|
}
|
|
4016
4038
|
};
|
|
4017
4039
|
Object.defineProperty(this, "opacity", {
|
|
@@ -4058,6 +4080,12 @@ __decorate([
|
|
|
4058
4080
|
__decorate([
|
|
4059
4081
|
property
|
|
4060
4082
|
], ReflectorMaterial.prototype, "aoMap", null);
|
|
4083
|
+
__decorate([
|
|
4084
|
+
property({
|
|
4085
|
+
min: 0,
|
|
4086
|
+
max: 1
|
|
4087
|
+
})
|
|
4088
|
+
], ReflectorMaterial.prototype, "aoMapIntensity", null);
|
|
4061
4089
|
__decorate([
|
|
4062
4090
|
property
|
|
4063
4091
|
], ReflectorMaterial.prototype, "lightMap", null);
|
|
@@ -4751,44 +4779,43 @@ class Viewer extends EventEmitter {
|
|
|
4751
4779
|
};
|
|
4752
4780
|
}
|
|
4753
4781
|
}
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
if (delta >= interval) {
|
|
4760
|
-
this.loop(this._fixedFrameTime ? interval : this._time - this._lastTime);
|
|
4761
|
-
this._lastTime = this._time;
|
|
4762
|
-
this._lastFrameTime = this._time - delta % interval;
|
|
4782
|
+
animate() {
|
|
4783
|
+
const loop = (dt)=>{
|
|
4784
|
+
if (!this._active) return;
|
|
4785
|
+
if (this._resourceManager.isComplete) {
|
|
4786
|
+
this._taskManager.isComplete ? this._running = true : this._taskManager.update();
|
|
4763
4787
|
}
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
loop(dt) {
|
|
4770
|
-
if (this._resourceManager.isComplete) {
|
|
4771
|
-
this._taskManager.update();
|
|
4772
|
-
if (this._taskManager.isComplete) {
|
|
4773
|
-
this._running = true;
|
|
4788
|
+
if (this._running) {
|
|
4789
|
+
dt = Math.min(dt, 0.067);
|
|
4790
|
+
this._renderer.info.reset();
|
|
4791
|
+
this._componentManager.update(dt);
|
|
4792
|
+
this._componentManager.render(dt);
|
|
4774
4793
|
}
|
|
4775
|
-
}
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
this.
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4794
|
+
};
|
|
4795
|
+
const frame = (time)=>{
|
|
4796
|
+
this._time = time * 0.001;
|
|
4797
|
+
if (this._targetFrameRate > -1) {
|
|
4798
|
+
const interval = 1 / this._targetFrameRate;
|
|
4799
|
+
const delta = this._time - this._lastFrameTime;
|
|
4800
|
+
if (delta >= interval) {
|
|
4801
|
+
loop(this._fixedFrameTime ? interval : this._time - this._lastTime);
|
|
4802
|
+
this._lastTime = this._time;
|
|
4803
|
+
this._lastFrameTime = this._time - delta % interval;
|
|
4804
|
+
}
|
|
4805
|
+
} else {
|
|
4806
|
+
loop(this._time - this._lastTime);
|
|
4807
|
+
this._lastTime = this._time;
|
|
4808
|
+
}
|
|
4809
|
+
};
|
|
4810
|
+
this._renderer.setAnimationLoop(frame);
|
|
4782
4811
|
}
|
|
4783
4812
|
start() {
|
|
4784
|
-
if (this._active
|
|
4813
|
+
if (this._active === false) {
|
|
4785
4814
|
this._active = true;
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
};
|
|
4791
|
-
this._renderer.setAnimationLoop(frameCallback);
|
|
4815
|
+
requestAnimationFrame(()=>{
|
|
4816
|
+
this.rotate();
|
|
4817
|
+
this.resize();
|
|
4818
|
+
});
|
|
4792
4819
|
}
|
|
4793
4820
|
return this;
|
|
4794
4821
|
}
|
|
@@ -4928,7 +4955,7 @@ class Viewer extends EventEmitter {
|
|
|
4928
4955
|
if (parent === undefined) {
|
|
4929
4956
|
parent = mount ? this._mount : this._scene;
|
|
4930
4957
|
}
|
|
4931
|
-
if (parent && !node.parent) {
|
|
4958
|
+
if (parent !== node && !node.parent) {
|
|
4932
4959
|
parent.add(node);
|
|
4933
4960
|
}
|
|
4934
4961
|
if (component) {
|
|
@@ -5148,7 +5175,7 @@ class Viewer extends EventEmitter {
|
|
|
5148
5175
|
width: 1,
|
|
5149
5176
|
height: 1,
|
|
5150
5177
|
factor: 1
|
|
5151
|
-
}, this._active = false, this.
|
|
5178
|
+
}, this._active = false, this._running = false, this._rootRotated = false, this._time = 0, this._lastTime = 0, this._lastFrameTime = 0, this._targetFrameRate = -1, this._fixedFrameTime = false, this._windowSize = ()=>[
|
|
5152
5179
|
window.innerWidth,
|
|
5153
5180
|
window.innerHeight
|
|
5154
5181
|
], this._orientation = Orientation.AUTO;
|
|
@@ -5206,11 +5233,9 @@ class Viewer extends EventEmitter {
|
|
|
5206
5233
|
this.addLoader(BINLoader);
|
|
5207
5234
|
this.addLoader(SVGLoader);
|
|
5208
5235
|
this.addLoader(KTX2Loader);
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
this.start();
|
|
5213
|
-
});
|
|
5236
|
+
this.rotate();
|
|
5237
|
+
this.resize();
|
|
5238
|
+
this.animate();
|
|
5214
5239
|
}
|
|
5215
5240
|
}
|
|
5216
5241
|
Viewer.instanceCount = 0;
|