@xviewer.js/core 1.0.0 → 1.0.1
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 +403 -159
- package/dist/main.js.map +1 -1
- package/dist/module.js +402 -160
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/DeviceInput.d.ts +1 -0
- package/types/Utils.d.ts +1 -1
- package/types/Viewer.d.ts +5 -1
- package/types/cinestation/FreelookVirtualCamera.d.ts +9 -1
- package/types/components/ContactShadows.d.ts +28 -0
- package/types/components/index.d.ts +1 -0
- package/types/materials/ShadowMaterial.d.ts +17 -0
- package/types/materials/index.d.ts +1 -0
- package/types/math/Interpolation.d.ts +6 -5
package/dist/main.js
CHANGED
|
@@ -7,6 +7,7 @@ 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
9
|
var RGBELoader_js = require('three/examples/jsm/loaders/RGBELoader.js');
|
|
10
|
+
var Addons_js = require('three/examples/jsm/Addons.js');
|
|
10
11
|
|
|
11
12
|
class EventEmitter {
|
|
12
13
|
_removeEvent(list, index, name) {
|
|
@@ -918,10 +919,11 @@ class Tween {
|
|
|
918
919
|
} else if (typeof end === 'object' && end) {
|
|
919
920
|
// eslint-disable-next-line
|
|
920
921
|
// @ts-ignore FIXME?
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
922
|
+
let des = getPropertyDescriptor(_object, property);
|
|
923
|
+
if ((des == null ? void 0 : des.set) || (des == null ? void 0 : des.writable)) {
|
|
924
|
+
_object[property] = this._updateProperties(_object[property], start, end, value);
|
|
925
|
+
} else {
|
|
926
|
+
this._updateProperties(_object[property], start, end, value);
|
|
925
927
|
}
|
|
926
928
|
} else {
|
|
927
929
|
// Parses relative end values with start as base (e.g.: +10, -3)
|
|
@@ -934,6 +936,7 @@ class Tween {
|
|
|
934
936
|
}
|
|
935
937
|
}
|
|
936
938
|
}
|
|
939
|
+
return _object;
|
|
937
940
|
}
|
|
938
941
|
_handleRelativeValue(start, end) {
|
|
939
942
|
if (typeof end !== 'string') {
|
|
@@ -985,6 +988,14 @@ class Tween {
|
|
|
985
988
|
this._goToEnd = false;
|
|
986
989
|
}
|
|
987
990
|
}
|
|
991
|
+
function getPropertyDescriptor(obj, prop) {
|
|
992
|
+
while(obj){
|
|
993
|
+
let desc = Object.getOwnPropertyDescriptor(obj, prop);
|
|
994
|
+
if (desc) return desc;
|
|
995
|
+
obj = Object.getPrototypeOf(obj);
|
|
996
|
+
}
|
|
997
|
+
return undefined;
|
|
998
|
+
}
|
|
988
999
|
|
|
989
1000
|
class TweenChain {
|
|
990
1001
|
start() {
|
|
@@ -1686,34 +1697,34 @@ class DeviceInput {
|
|
|
1686
1697
|
return this._keys;
|
|
1687
1698
|
}
|
|
1688
1699
|
addEventListeners() {
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1691
|
-
this._addEventListener(
|
|
1692
|
-
this._addEventListener(
|
|
1700
|
+
const { canvas } = this.viewer;
|
|
1701
|
+
canvas.style.touchAction = 'none';
|
|
1702
|
+
this._addEventListener(canvas, 'contextmenu', (e)=>e.preventDefault());
|
|
1703
|
+
this._addEventListener(canvas, "pointerdown", (e)=>this._onPointerDown(e), {
|
|
1693
1704
|
passive: false
|
|
1694
1705
|
});
|
|
1695
|
-
this._addEventListener(
|
|
1706
|
+
this._addEventListener(canvas, "pointerup", (e)=>this._onPointerUp(e), {
|
|
1696
1707
|
passive: false
|
|
1697
1708
|
});
|
|
1698
|
-
this._addEventListener(
|
|
1709
|
+
this._addEventListener(canvas, "pointercancel", (e)=>this._onPointerUp(e), {
|
|
1699
1710
|
passive: false
|
|
1700
1711
|
});
|
|
1701
|
-
this._addEventListener(
|
|
1712
|
+
this._addEventListener(canvas, "pointerout", (e)=>this._onPointerUp(e), {
|
|
1702
1713
|
passive: false
|
|
1703
1714
|
});
|
|
1704
|
-
this._addEventListener(
|
|
1715
|
+
this._addEventListener(canvas, "pointermove", (e)=>this._onPointerMove(e), {
|
|
1705
1716
|
passive: true
|
|
1706
1717
|
});
|
|
1707
|
-
this._addEventListener(
|
|
1718
|
+
this._addEventListener(canvas, "wheel", (e)=>this._onMouseWheel(e), {
|
|
1708
1719
|
passive: false
|
|
1709
1720
|
});
|
|
1710
|
-
this._addEventListener(
|
|
1721
|
+
this._addEventListener(canvas, "touchstart", (e)=>this._onTouchStart(e), {
|
|
1711
1722
|
passive: true
|
|
1712
1723
|
});
|
|
1713
|
-
this._addEventListener(
|
|
1724
|
+
this._addEventListener(canvas, "touchend", (e)=>this._onTouchEnd(e), {
|
|
1714
1725
|
passive: true
|
|
1715
1726
|
});
|
|
1716
|
-
this._addEventListener(
|
|
1727
|
+
this._addEventListener(canvas, "touchmove", (e)=>this._onTouchMove(e), {
|
|
1717
1728
|
passive: true
|
|
1718
1729
|
});
|
|
1719
1730
|
//监听了pointer事件之后,key事件失效,改成window解决
|
|
@@ -1726,6 +1737,9 @@ class DeviceInput {
|
|
|
1726
1737
|
this._addEventListener(window, "keyup", (e)=>this._onKeyUp(e), {
|
|
1727
1738
|
passive: false
|
|
1728
1739
|
});
|
|
1740
|
+
this._addEventListener(window, "resize", (e)=>this._onResize(e), {
|
|
1741
|
+
passive: false
|
|
1742
|
+
});
|
|
1729
1743
|
}
|
|
1730
1744
|
removeAllListeners() {
|
|
1731
1745
|
for (let { target, type, callback } of this._listeners){
|
|
@@ -1757,6 +1771,10 @@ class DeviceInput {
|
|
|
1757
1771
|
callback
|
|
1758
1772
|
});
|
|
1759
1773
|
}
|
|
1774
|
+
_onResize(e) {
|
|
1775
|
+
this.viewer.rotate();
|
|
1776
|
+
this.viewer.resize();
|
|
1777
|
+
}
|
|
1760
1778
|
_remapPointer(e) {
|
|
1761
1779
|
const width = this.viewer.width;
|
|
1762
1780
|
return this.viewer.rootRotated ? {
|
|
@@ -2158,19 +2176,21 @@ const Vector3_NEG_ONE = Object.freeze(new three.Vector3(-1, -1, -1));
|
|
|
2158
2176
|
const { clamp: clamp$2 } = three.MathUtils;
|
|
2159
2177
|
const { max, abs: abs$1, acos } = Math;
|
|
2160
2178
|
const EPSILON = 1.e-6;
|
|
2161
|
-
const
|
|
2162
|
-
|
|
2179
|
+
const __deltaMap = new Map();
|
|
2180
|
+
__deltaMap.set(three.Vector3, new three.Vector3());
|
|
2181
|
+
__deltaMap.set(three.Vector2, new three.Vector2());
|
|
2182
|
+
function VInterpTo(current, target, deltaTime, speed, out = current, epsilon = EPSILON) {
|
|
2163
2183
|
if (speed <= 0) {
|
|
2164
2184
|
return out.copy(target);
|
|
2165
2185
|
}
|
|
2166
|
-
let dist =
|
|
2167
|
-
if (dist.lengthSq() <
|
|
2186
|
+
let dist = __deltaMap.get(current.constructor).copy(target).sub(current);
|
|
2187
|
+
if (dist.lengthSq() < epsilon) {
|
|
2168
2188
|
return out.copy(target);
|
|
2169
2189
|
}
|
|
2170
2190
|
return out.copy(current).add(dist.multiplyScalar(clamp$2(deltaTime * speed, 0, 1)));
|
|
2171
2191
|
}
|
|
2172
2192
|
function VInterpConstantTo(current, target, deltaTime, speed, out = current) {
|
|
2173
|
-
let delta =
|
|
2193
|
+
let delta = __deltaMap.get(current.constructor).copy(target).sub(current);
|
|
2174
2194
|
let deltaM = delta.length();
|
|
2175
2195
|
let maxStep = speed * deltaTime;
|
|
2176
2196
|
if (deltaM > maxStep) {
|
|
@@ -2190,11 +2210,11 @@ function Quat_AngularDistance(a, b) {
|
|
|
2190
2210
|
let innerProd = a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
|
2191
2211
|
return acos(2 * innerProd * innerProd - 1);
|
|
2192
2212
|
}
|
|
2193
|
-
function QInterpTo(current, target, deltaTime, speed) {
|
|
2213
|
+
function QInterpTo(current, target, deltaTime, speed, epsilon = EPSILON) {
|
|
2194
2214
|
if (speed <= 0) {
|
|
2195
2215
|
return target;
|
|
2196
2216
|
}
|
|
2197
|
-
if (Quat_Equals(current, target)) {
|
|
2217
|
+
if (Quat_Equals(current, target, epsilon)) {
|
|
2198
2218
|
return target;
|
|
2199
2219
|
}
|
|
2200
2220
|
return current.slerp(target, clamp$2(speed * deltaTime, 0, 1));
|
|
@@ -2211,20 +2231,20 @@ function QInterpConstantTo(current, target, deltaTime, speed, out = current) {
|
|
|
2211
2231
|
return out.copy(current).slerp(target, clamp$2(deltaSpeed / angularDist, 0, 1));
|
|
2212
2232
|
}
|
|
2213
2233
|
//非线性
|
|
2214
|
-
function FInterpTo(current, target, deltaTime, speed) {
|
|
2234
|
+
function FInterpTo(current, target, deltaTime, speed, epsilon = EPSILON) {
|
|
2215
2235
|
if (speed <= 0) {
|
|
2216
2236
|
return target;
|
|
2217
2237
|
}
|
|
2218
2238
|
let dist = target - current;
|
|
2219
|
-
if (abs$1(dist) <
|
|
2239
|
+
if (abs$1(dist) < epsilon) {
|
|
2220
2240
|
return target;
|
|
2221
2241
|
}
|
|
2222
2242
|
return current + dist * clamp$2(speed * deltaTime, 0, 1);
|
|
2223
2243
|
}
|
|
2224
2244
|
//线性插值
|
|
2225
|
-
function FInterpConstantTo(current, target, deltaTime, speed) {
|
|
2245
|
+
function FInterpConstantTo(current, target, deltaTime, speed, epsilon = EPSILON) {
|
|
2226
2246
|
let dist = target - current;
|
|
2227
|
-
if (abs$1(dist) <
|
|
2247
|
+
if (abs$1(dist) < epsilon) {
|
|
2228
2248
|
return target;
|
|
2229
2249
|
}
|
|
2230
2250
|
let step = speed * deltaTime;
|
|
@@ -2672,6 +2692,7 @@ Perlin._Permutation = [
|
|
|
2672
2692
|
|
|
2673
2693
|
const { clamp, degToRad } = three.MathUtils;
|
|
2674
2694
|
const { abs, tan, PI } = Math;
|
|
2695
|
+
const PI2 = PI * 2;
|
|
2675
2696
|
const ESP = 0.001;
|
|
2676
2697
|
class FreelookVirtualCamera extends VirtualCamera {
|
|
2677
2698
|
get lookAt() {
|
|
@@ -2681,6 +2702,13 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2681
2702
|
this._lookAt.copy(v);
|
|
2682
2703
|
this._targetLookAt.copy(v);
|
|
2683
2704
|
}
|
|
2705
|
+
get offset() {
|
|
2706
|
+
return this._offset;
|
|
2707
|
+
}
|
|
2708
|
+
set offset(v) {
|
|
2709
|
+
this._offset.copy(v);
|
|
2710
|
+
this._targetOffset.copy(v);
|
|
2711
|
+
}
|
|
2684
2712
|
get springLength() {
|
|
2685
2713
|
return this._spherical.radius;
|
|
2686
2714
|
}
|
|
@@ -2802,8 +2830,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2802
2830
|
}
|
|
2803
2831
|
_calculateRotatelDelta(out, loc0, loc1) {
|
|
2804
2832
|
this._tempRotateSmoothing = this.rotateSmoothing;
|
|
2805
|
-
|
|
2806
|
-
out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / domElement.clientHeight);
|
|
2833
|
+
out.copy(loc1).sub(loc0).multiplyScalar(this.rotateSpeed * 2 * Math.PI / this.viewer.height);
|
|
2807
2834
|
out.y = -out.y;
|
|
2808
2835
|
if (this.forbidX) {
|
|
2809
2836
|
out.x = 0;
|
|
@@ -2815,8 +2842,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2815
2842
|
}
|
|
2816
2843
|
_calculatePanDelta(out, loc0, loc1) {
|
|
2817
2844
|
this._tempRotateSmoothing = this.rotateSmoothing;
|
|
2818
|
-
|
|
2819
|
-
out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / domElement.clientHeight);
|
|
2845
|
+
out.copy(loc1).sub(loc0).multiplyScalar(this.panSpeed / this.viewer.height);
|
|
2820
2846
|
if (this.forbidPanX) {
|
|
2821
2847
|
out.x = 0;
|
|
2822
2848
|
}
|
|
@@ -2825,7 +2851,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2825
2851
|
}
|
|
2826
2852
|
return out;
|
|
2827
2853
|
}
|
|
2828
|
-
|
|
2854
|
+
_calculateLookAtOffset(panDelta, out = new three.Vector3()) {
|
|
2829
2855
|
const { __xAxis, __yAxis, __posDelta } = FreelookVirtualCamera;
|
|
2830
2856
|
__xAxis.setFromMatrixColumn(this.node.matrix, 0);
|
|
2831
2857
|
__yAxis.setFromMatrixColumn(this.node.matrix, 1);
|
|
@@ -2835,7 +2861,11 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2835
2861
|
}
|
|
2836
2862
|
__posDelta.copy(this.node.position).sub(this.lookAt);
|
|
2837
2863
|
const length = __posDelta.length() * 2 * tan(degToRad(this.fov * 0.5));
|
|
2838
|
-
|
|
2864
|
+
return out.set(0, 0, 0).sub(__xAxis.multiplyScalar(panDelta.x * length)).add(__yAxis.multiplyScalar(panDelta.y * length));
|
|
2865
|
+
}
|
|
2866
|
+
_setTargetLookAt(panDelta) {
|
|
2867
|
+
const { __lookAtOffset } = FreelookVirtualCamera;
|
|
2868
|
+
this._targetLookAt.add(this._calculateLookAtOffset(panDelta, __lookAtOffset));
|
|
2839
2869
|
}
|
|
2840
2870
|
_setTargetRotation(rotateDelta) {
|
|
2841
2871
|
this._targetTheta -= rotateDelta.x;
|
|
@@ -2846,11 +2876,15 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2846
2876
|
_setTargetSpringLength(radius) {
|
|
2847
2877
|
this._targetSpringLength = clamp(radius, this.distanceMin, this.distanceMax);
|
|
2848
2878
|
}
|
|
2849
|
-
goto({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, fov = this.lens.fov, smoothing = this.smoothing, rotateSmoothing = this.smoothing }) {
|
|
2850
|
-
this.
|
|
2851
|
-
|
|
2879
|
+
goto({ springLength = this._targetSpringLength, theta = this._targetTheta, phi = this._targetPhi, lookAt = this._lookAt, offset = this._targetOffset, fov = this.lens.fov, smoothing = this.smoothing, rotateSmoothing = this.smoothing }) {
|
|
2880
|
+
const t0 = this._spherical.theta = this._spherical.theta % PI2;
|
|
2881
|
+
const t1 = theta % PI2;
|
|
2882
|
+
const delta = three.MathUtils.euclideanModulo(t1 - t0 + Math.PI, PI2) - Math.PI;
|
|
2883
|
+
this._targetTheta = clamp(t0 + delta, this.thetaMin, this.thetaMax);
|
|
2852
2884
|
this._targetPhi = clamp(phi, this.phiMin, this.phiMax);
|
|
2885
|
+
this._targetSpringLength = clamp(springLength, this.distanceMin, this.distanceMax);
|
|
2853
2886
|
this._targetLookAt.copy(lookAt);
|
|
2887
|
+
this._targetOffset.copy(offset);
|
|
2854
2888
|
this._targetFov = fov;
|
|
2855
2889
|
this._tempSmoothing = smoothing;
|
|
2856
2890
|
this._tempRotateSmoothing = rotateSmoothing;
|
|
@@ -2863,8 +2897,10 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2863
2897
|
this._spherical.radius = FInterpTo(this._spherical.radius, this._targetSpringLength, dt, smoothing);
|
|
2864
2898
|
this.lens.fov = FInterpTo(this.lens.fov, this._targetFov, dt, smoothing);
|
|
2865
2899
|
VInterpTo(this._lookAt, this._targetLookAt, dt, smoothing);
|
|
2866
|
-
|
|
2867
|
-
this.
|
|
2900
|
+
VInterpTo(this._offset, this._targetOffset, dt, smoothing);
|
|
2901
|
+
this._calculateLookAtOffset(this._offset, this._finalLookAt).add(this._lookAt);
|
|
2902
|
+
this.node.position.setFromSpherical(this._spherical).add(this._finalLookAt);
|
|
2903
|
+
this.node.lookAt(this._finalLookAt);
|
|
2868
2904
|
}
|
|
2869
2905
|
constructor(...args){
|
|
2870
2906
|
super(...args);
|
|
@@ -2874,6 +2910,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2874
2910
|
this._preLoc1 = new three.Vector2();
|
|
2875
2911
|
this._spherical = new three.Spherical(4, Math.PI / 2);
|
|
2876
2912
|
this._lookAt = new three.Vector3();
|
|
2913
|
+
this._offset = new three.Vector2();
|
|
2877
2914
|
this._tempSmoothing = 6;
|
|
2878
2915
|
this._tempRotateSmoothing = 8;
|
|
2879
2916
|
this._targetTheta = 0;
|
|
@@ -2881,6 +2918,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2881
2918
|
this._targetSpringLength = 4;
|
|
2882
2919
|
this._targetFov = this.fov;
|
|
2883
2920
|
this._targetLookAt = new three.Vector3();
|
|
2921
|
+
this._targetOffset = new three.Vector2();
|
|
2884
2922
|
this.forbidX = false;
|
|
2885
2923
|
this.forbidY = false;
|
|
2886
2924
|
this.forbidZ = false;
|
|
@@ -2897,6 +2935,7 @@ class FreelookVirtualCamera extends VirtualCamera {
|
|
|
2897
2935
|
this.thetaMax = Infinity;
|
|
2898
2936
|
this.distanceMin = ESP;
|
|
2899
2937
|
this.distanceMax = Infinity;
|
|
2938
|
+
this._finalLookAt = new three.Vector3();
|
|
2900
2939
|
}
|
|
2901
2940
|
}
|
|
2902
2941
|
FreelookVirtualCamera.__loc0 = new three.Vector2();
|
|
@@ -2907,6 +2946,7 @@ FreelookVirtualCamera.__panDelta = new three.Vector2();
|
|
|
2907
2946
|
FreelookVirtualCamera.__panTarget = new three.Vector2();
|
|
2908
2947
|
FreelookVirtualCamera.__rotateDelta = new three.Vector2();
|
|
2909
2948
|
FreelookVirtualCamera.__posDelta = new three.Vector3();
|
|
2949
|
+
FreelookVirtualCamera.__lookAtOffset = new three.Vector3();
|
|
2910
2950
|
FreelookVirtualCamera.__xAxis = new three.Vector3();
|
|
2911
2951
|
FreelookVirtualCamera.__yAxis = new three.Vector3();
|
|
2912
2952
|
FreelookVirtualCamera.__quat = new three.Quaternion();
|
|
@@ -3001,10 +3041,11 @@ __decorate([
|
|
|
3001
3041
|
})
|
|
3002
3042
|
], FreelookVirtualCamera.prototype, "distanceMax", void 0);
|
|
3003
3043
|
__decorate([
|
|
3004
|
-
property
|
|
3005
|
-
step: 0.01
|
|
3006
|
-
})
|
|
3044
|
+
property
|
|
3007
3045
|
], FreelookVirtualCamera.prototype, "lookAt", null);
|
|
3046
|
+
__decorate([
|
|
3047
|
+
property
|
|
3048
|
+
], FreelookVirtualCamera.prototype, "offset", null);
|
|
3008
3049
|
__decorate([
|
|
3009
3050
|
property({
|
|
3010
3051
|
step: 0.01
|
|
@@ -3216,6 +3257,186 @@ class Animation extends Component {
|
|
|
3216
3257
|
}
|
|
3217
3258
|
}
|
|
3218
3259
|
|
|
3260
|
+
function applyProps(target, props) {
|
|
3261
|
+
for(let k in props){
|
|
3262
|
+
let prop = props[k];
|
|
3263
|
+
if (prop === undefined) {
|
|
3264
|
+
continue;
|
|
3265
|
+
}
|
|
3266
|
+
if (target[k] !== undefined) {
|
|
3267
|
+
let des = Object.getOwnPropertyDescriptor(target, k);
|
|
3268
|
+
if (!des || des.writable || des.set) {
|
|
3269
|
+
target[k] = prop;
|
|
3270
|
+
} else {
|
|
3271
|
+
let value = target[k];
|
|
3272
|
+
if (value && value.copy) {
|
|
3273
|
+
value.copy(prop);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
return target;
|
|
3279
|
+
}
|
|
3280
|
+
function find(node, path) {
|
|
3281
|
+
let child = null;
|
|
3282
|
+
let parts = path.split("/");
|
|
3283
|
+
let children = node.children;
|
|
3284
|
+
for (let part of parts){
|
|
3285
|
+
child = children.find((v)=>v.name === part);
|
|
3286
|
+
if (child) {
|
|
3287
|
+
children = child.children;
|
|
3288
|
+
} else {
|
|
3289
|
+
return null;
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
return child;
|
|
3293
|
+
}
|
|
3294
|
+
function getChildren(node, filter, group = false) {
|
|
3295
|
+
const queue = [
|
|
3296
|
+
node
|
|
3297
|
+
];
|
|
3298
|
+
const objects = [];
|
|
3299
|
+
while(queue.length !== 0){
|
|
3300
|
+
let object = queue.shift();
|
|
3301
|
+
let target = filter(object);
|
|
3302
|
+
if (target) {
|
|
3303
|
+
objects.push(object);
|
|
3304
|
+
if (!group) {
|
|
3305
|
+
break;
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
object.children.forEach((v)=>queue.push(v));
|
|
3309
|
+
}
|
|
3310
|
+
if (group) {
|
|
3311
|
+
return objects;
|
|
3312
|
+
}
|
|
3313
|
+
return objects[0];
|
|
3314
|
+
}
|
|
3315
|
+
function getChildByName(node, name) {
|
|
3316
|
+
return getChildren(node, (v)=>v && v.name === name);
|
|
3317
|
+
}
|
|
3318
|
+
const __emtpyObject = {};
|
|
3319
|
+
function queryValues(object, name, group = false) {
|
|
3320
|
+
if (name) {
|
|
3321
|
+
if (group) {
|
|
3322
|
+
return Object.values(object || __emtpyObject).filter((v)=>v.name === name);
|
|
3323
|
+
}
|
|
3324
|
+
return Object.values(object || __emtpyObject).find((v)=>v.name === name);
|
|
3325
|
+
}
|
|
3326
|
+
return Object.values(object);
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
class ContactShadows extends Component {
|
|
3330
|
+
get visible() {
|
|
3331
|
+
return this.node.visible;
|
|
3332
|
+
}
|
|
3333
|
+
set visible(v) {
|
|
3334
|
+
this.node.visible = v;
|
|
3335
|
+
}
|
|
3336
|
+
constructor({ scale = 10, frames = Infinity, width = 1, height = 1, intensity = 1, blur = 1, near = 0, far = 10, resolution = 512, smooth = true, color = new three.Color(0x0), renderOrder = 0, layerMask = 1 << 0, ...props } = {}){
|
|
3337
|
+
super();
|
|
3338
|
+
this.layerMask = 1 << 0;
|
|
3339
|
+
this.color = new three.Color();
|
|
3340
|
+
this.blur = 1;
|
|
3341
|
+
this.blur = blur;
|
|
3342
|
+
this.layerMask = layerMask;
|
|
3343
|
+
this.color.copy(color);
|
|
3344
|
+
width = width * scale;
|
|
3345
|
+
height = height * scale;
|
|
3346
|
+
const planeGeometry = new three.PlaneGeometry(width, height);
|
|
3347
|
+
const shadowCamera = new three.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, near, far);
|
|
3348
|
+
const renderTarget = new three.WebGLRenderTarget(resolution, resolution);
|
|
3349
|
+
const renderTargetBlur = new three.WebGLRenderTarget(resolution, resolution);
|
|
3350
|
+
renderTargetBlur.texture.generateMipmaps = renderTarget.texture.generateMipmaps = false;
|
|
3351
|
+
const depthMaterial = new three.MeshDepthMaterial();
|
|
3352
|
+
depthMaterial.depthTest = depthMaterial.depthWrite = false;
|
|
3353
|
+
depthMaterial.onBeforeCompile = (shader)=>{
|
|
3354
|
+
shader.uniforms = {
|
|
3355
|
+
...shader.uniforms,
|
|
3356
|
+
color: {
|
|
3357
|
+
value: this.color
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3360
|
+
shader.fragmentShader = shader.fragmentShader.replace(`void main() {`, `uniform vec3 color;
|
|
3361
|
+
uniform float intensity;
|
|
3362
|
+
void main() {
|
|
3363
|
+
`);
|
|
3364
|
+
shader.fragmentShader = shader.fragmentShader.replace('vec4( vec3( 1.0 - fragCoordZ ), opacity );', // Colorize the shadow, multiply by the falloff so that the center can remain darker
|
|
3365
|
+
'vec4( color * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );');
|
|
3366
|
+
};
|
|
3367
|
+
const horizontalBlurMaterial = new three.ShaderMaterial(Addons_js.HorizontalBlurShader);
|
|
3368
|
+
const verticalBlurMaterial = new three.ShaderMaterial(Addons_js.VerticalBlurShader);
|
|
3369
|
+
verticalBlurMaterial.depthTest = horizontalBlurMaterial.depthTest = false;
|
|
3370
|
+
const blurPlane = new three.Mesh(planeGeometry);
|
|
3371
|
+
this.node = applyProps(new three.Group(), {
|
|
3372
|
+
rotation: new three.Euler(Math.PI / 2, 0, 0),
|
|
3373
|
+
...props
|
|
3374
|
+
});
|
|
3375
|
+
this.node.add(shadowCamera);
|
|
3376
|
+
this.node.add(blurPlane);
|
|
3377
|
+
const textureMatrix = new three.Matrix4();
|
|
3378
|
+
const blurShadows = (gl, blur)=>{
|
|
3379
|
+
blurPlane.visible = true;
|
|
3380
|
+
blurPlane.material = horizontalBlurMaterial;
|
|
3381
|
+
horizontalBlurMaterial.uniforms.tDiffuse.value = renderTarget.texture;
|
|
3382
|
+
horizontalBlurMaterial.uniforms.h.value = blur * 1 / 256;
|
|
3383
|
+
gl.setRenderTarget(renderTargetBlur);
|
|
3384
|
+
gl.render(blurPlane, shadowCamera);
|
|
3385
|
+
blurPlane.material = verticalBlurMaterial;
|
|
3386
|
+
verticalBlurMaterial.uniforms.tDiffuse.value = renderTargetBlur.texture;
|
|
3387
|
+
verticalBlurMaterial.uniforms.v.value = blur * 1 / 256;
|
|
3388
|
+
gl.setRenderTarget(renderTarget);
|
|
3389
|
+
gl.render(blurPlane, shadowCamera);
|
|
3390
|
+
blurPlane.visible = false;
|
|
3391
|
+
};
|
|
3392
|
+
let count = 0;
|
|
3393
|
+
let initialBackground;
|
|
3394
|
+
let initialOverrideMaterial;
|
|
3395
|
+
let initialClearAlpha;
|
|
3396
|
+
this.update = ()=>{
|
|
3397
|
+
shadowCamera.layers.mask = blurPlane.layers.mask = this.layerMask;
|
|
3398
|
+
if (frames === Infinity || count < frames) {
|
|
3399
|
+
count++;
|
|
3400
|
+
const { scene, renderer: gl } = this.viewer;
|
|
3401
|
+
initialBackground = scene.background;
|
|
3402
|
+
initialOverrideMaterial = scene.overrideMaterial;
|
|
3403
|
+
this.node.visible = false;
|
|
3404
|
+
scene.background = null;
|
|
3405
|
+
scene.overrideMaterial = depthMaterial;
|
|
3406
|
+
textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
|
|
3407
|
+
textureMatrix.multiply(shadowCamera.projectionMatrix);
|
|
3408
|
+
textureMatrix.multiply(shadowCamera.matrixWorldInverse);
|
|
3409
|
+
initialClearAlpha = gl.getClearAlpha();
|
|
3410
|
+
gl.setClearAlpha(0);
|
|
3411
|
+
gl.setRenderTarget(renderTarget);
|
|
3412
|
+
gl.render(scene, shadowCamera);
|
|
3413
|
+
blurShadows(gl, this.blur);
|
|
3414
|
+
if (smooth) blurShadows(gl, this.blur * 0.4);
|
|
3415
|
+
gl.setRenderTarget(null);
|
|
3416
|
+
gl.setClearAlpha(initialClearAlpha);
|
|
3417
|
+
this.node.visible = true;
|
|
3418
|
+
scene.overrideMaterial = initialOverrideMaterial;
|
|
3419
|
+
scene.background = initialBackground;
|
|
3420
|
+
}
|
|
3421
|
+
};
|
|
3422
|
+
this.onDestroy = ()=>renderTarget.dispose();
|
|
3423
|
+
this.getRenderTarget = ()=>renderTarget;
|
|
3424
|
+
this.getTextureMatrix = ()=>textureMatrix;
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
__decorate([
|
|
3428
|
+
property
|
|
3429
|
+
], ContactShadows.prototype, "visible", null);
|
|
3430
|
+
__decorate([
|
|
3431
|
+
property
|
|
3432
|
+
], ContactShadows.prototype, "color", void 0);
|
|
3433
|
+
__decorate([
|
|
3434
|
+
property({
|
|
3435
|
+
min: 0,
|
|
3436
|
+
max: 15
|
|
3437
|
+
})
|
|
3438
|
+
], ContactShadows.prototype, "blur", void 0);
|
|
3439
|
+
|
|
3219
3440
|
const vert_fullscreen = /*glsl*/ `
|
|
3220
3441
|
varying vec2 vUv;
|
|
3221
3442
|
void main() {
|
|
@@ -3572,7 +3793,6 @@ class ReflectorMaterial extends three.ShaderMaterial {
|
|
|
3572
3793
|
set lightMapIntensity(v) {
|
|
3573
3794
|
this.uniforms.lightMapIntensity.value = v;
|
|
3574
3795
|
}
|
|
3575
|
-
// @property
|
|
3576
3796
|
get reflectMap() {
|
|
3577
3797
|
return this.uniforms.reflectMap.value;
|
|
3578
3798
|
}
|
|
@@ -3688,6 +3908,9 @@ __decorate([
|
|
|
3688
3908
|
parent: "lightMap"
|
|
3689
3909
|
})
|
|
3690
3910
|
], ReflectorMaterial.prototype, "lightMapIntensity", null);
|
|
3911
|
+
__decorate([
|
|
3912
|
+
property()
|
|
3913
|
+
], ReflectorMaterial.prototype, "reflectMap", null);
|
|
3691
3914
|
__decorate([
|
|
3692
3915
|
property({
|
|
3693
3916
|
min: 0,
|
|
@@ -3697,6 +3920,72 @@ __decorate([
|
|
|
3697
3920
|
})
|
|
3698
3921
|
], ReflectorMaterial.prototype, "reflectIntensity", null);
|
|
3699
3922
|
|
|
3923
|
+
const vert_Shadow = `
|
|
3924
|
+
varying vec4 v_shadows;
|
|
3925
|
+
uniform mat4 shadowsMatrix;
|
|
3926
|
+
|
|
3927
|
+
void main() {
|
|
3928
|
+
vec4 worldPos = modelMatrix * vec4(position, 1.);
|
|
3929
|
+
vec4 mvPosition = viewMatrix * worldPos;
|
|
3930
|
+
|
|
3931
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
3932
|
+
|
|
3933
|
+
v_shadows = shadowsMatrix * worldPos;
|
|
3934
|
+
}
|
|
3935
|
+
`;
|
|
3936
|
+
const frag_Shadow = `
|
|
3937
|
+
uniform vec3 color;
|
|
3938
|
+
uniform float opacity;
|
|
3939
|
+
|
|
3940
|
+
varying vec4 v_shadows;
|
|
3941
|
+
uniform sampler2D shadowsMap;
|
|
3942
|
+
uniform float shadowsIntensity;
|
|
3943
|
+
|
|
3944
|
+
void main() {
|
|
3945
|
+
vec4 shadows = texture2DProj(shadowsMap, v_shadows);
|
|
3946
|
+
gl_FragColor = vec4(color * shadows.rgb, shadows.a * opacity);
|
|
3947
|
+
|
|
3948
|
+
#include <tonemapping_fragment>
|
|
3949
|
+
#include <colorspace_fragment>
|
|
3950
|
+
}
|
|
3951
|
+
`;
|
|
3952
|
+
class ShadowMaterial extends three.ShaderMaterial {
|
|
3953
|
+
get color() {
|
|
3954
|
+
return this.uniforms.color.value;
|
|
3955
|
+
}
|
|
3956
|
+
set color(v) {
|
|
3957
|
+
this.uniforms.color.value.copy(v);
|
|
3958
|
+
}
|
|
3959
|
+
constructor({ shadows, ...props }){
|
|
3960
|
+
super();
|
|
3961
|
+
this.vertexShader = vert_Shadow;
|
|
3962
|
+
this.fragmentShader = frag_Shadow;
|
|
3963
|
+
this.uniforms = {
|
|
3964
|
+
color: {
|
|
3965
|
+
value: new three.Color()
|
|
3966
|
+
},
|
|
3967
|
+
opacity: {
|
|
3968
|
+
value: 1
|
|
3969
|
+
},
|
|
3970
|
+
shadowsMap: {
|
|
3971
|
+
value: null
|
|
3972
|
+
},
|
|
3973
|
+
shadowsMatrix: {
|
|
3974
|
+
value: new three.Matrix4()
|
|
3975
|
+
}
|
|
3976
|
+
};
|
|
3977
|
+
Object.defineProperty(this, "opacity", {
|
|
3978
|
+
get: ()=>this.uniforms.opacity.value,
|
|
3979
|
+
set: (v)=>this.uniforms.opacity.value = v
|
|
3980
|
+
});
|
|
3981
|
+
this.uniforms.shadowsMap.value = shadows.getRenderTarget().texture;
|
|
3982
|
+
this.uniforms.shadowsMatrix.value = shadows.getTextureMatrix();
|
|
3983
|
+
this.transparent = true;
|
|
3984
|
+
this.depthWrite = false;
|
|
3985
|
+
this.setValues(props);
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
|
|
3700
3989
|
const LOD_MIN = 4;
|
|
3701
3990
|
const _flatCamera = /*@__PURE__*/ new three.OrthographicCamera();
|
|
3702
3991
|
// Golden Ratio
|
|
@@ -4479,75 +4768,6 @@ ResourceManager._texSettingKeys = [
|
|
|
4479
4768
|
"channel"
|
|
4480
4769
|
];
|
|
4481
4770
|
|
|
4482
|
-
function applyProps(target, props) {
|
|
4483
|
-
for(let k in props){
|
|
4484
|
-
let prop = props[k];
|
|
4485
|
-
if (prop === undefined) {
|
|
4486
|
-
continue;
|
|
4487
|
-
}
|
|
4488
|
-
if (target[k] !== undefined) {
|
|
4489
|
-
let des = Object.getOwnPropertyDescriptor(target, k);
|
|
4490
|
-
if (!des || des.writable || des.set) {
|
|
4491
|
-
target[k] = prop;
|
|
4492
|
-
} else {
|
|
4493
|
-
let value = target[k];
|
|
4494
|
-
if (value && value.copy) {
|
|
4495
|
-
value.copy(prop);
|
|
4496
|
-
}
|
|
4497
|
-
}
|
|
4498
|
-
}
|
|
4499
|
-
}
|
|
4500
|
-
return target;
|
|
4501
|
-
}
|
|
4502
|
-
function find(node, path) {
|
|
4503
|
-
let child = null;
|
|
4504
|
-
let parts = path.split("/");
|
|
4505
|
-
let children = node.children;
|
|
4506
|
-
for (let part of parts){
|
|
4507
|
-
child = children.find((v)=>v.name === part);
|
|
4508
|
-
if (child) {
|
|
4509
|
-
children = child.children;
|
|
4510
|
-
} else {
|
|
4511
|
-
return null;
|
|
4512
|
-
}
|
|
4513
|
-
}
|
|
4514
|
-
return child;
|
|
4515
|
-
}
|
|
4516
|
-
function getChidren(node, filter, group = false) {
|
|
4517
|
-
const queue = [
|
|
4518
|
-
node
|
|
4519
|
-
];
|
|
4520
|
-
const objects = [];
|
|
4521
|
-
while(queue.length !== 0){
|
|
4522
|
-
let object = queue.shift();
|
|
4523
|
-
let target = filter(object);
|
|
4524
|
-
if (target) {
|
|
4525
|
-
objects.push(object);
|
|
4526
|
-
if (!group) {
|
|
4527
|
-
break;
|
|
4528
|
-
}
|
|
4529
|
-
}
|
|
4530
|
-
object.children.forEach((v)=>queue.push(v));
|
|
4531
|
-
}
|
|
4532
|
-
if (group) {
|
|
4533
|
-
return objects;
|
|
4534
|
-
}
|
|
4535
|
-
return objects[0];
|
|
4536
|
-
}
|
|
4537
|
-
function getChildByName(node, name) {
|
|
4538
|
-
return getChidren(node, (v)=>v && v.name === name);
|
|
4539
|
-
}
|
|
4540
|
-
const __emtpyObject = {};
|
|
4541
|
-
function queryValues(object, name, group = false) {
|
|
4542
|
-
if (name) {
|
|
4543
|
-
if (group) {
|
|
4544
|
-
return Object.values(object || __emtpyObject).filter((v)=>v.name === name);
|
|
4545
|
-
}
|
|
4546
|
-
return Object.values(object || __emtpyObject).find((v)=>v.name === name);
|
|
4547
|
-
}
|
|
4548
|
-
return Object.values(object);
|
|
4549
|
-
}
|
|
4550
|
-
|
|
4551
4771
|
class Viewer extends EventEmitter {
|
|
4552
4772
|
static _setDirectLightShadow(shadow, props) {
|
|
4553
4773
|
const shadowCamera = shadow.camera;
|
|
@@ -4611,6 +4831,9 @@ class Viewer extends EventEmitter {
|
|
|
4611
4831
|
get root() {
|
|
4612
4832
|
return this._root;
|
|
4613
4833
|
}
|
|
4834
|
+
get container() {
|
|
4835
|
+
return this._container;
|
|
4836
|
+
}
|
|
4614
4837
|
get time() {
|
|
4615
4838
|
return this._time;
|
|
4616
4839
|
}
|
|
@@ -4703,7 +4926,6 @@ class Viewer extends EventEmitter {
|
|
|
4703
4926
|
}
|
|
4704
4927
|
}
|
|
4705
4928
|
loop(dt) {
|
|
4706
|
-
if (this._autoResize) this.resize();
|
|
4707
4929
|
dt = Math.min(dt, 0.067);
|
|
4708
4930
|
this.update(dt);
|
|
4709
4931
|
this.render(dt);
|
|
@@ -4741,59 +4963,75 @@ class Viewer extends EventEmitter {
|
|
|
4741
4963
|
this._time = this._lastTime = 0;
|
|
4742
4964
|
return this;
|
|
4743
4965
|
}
|
|
4744
|
-
|
|
4745
|
-
|
|
4966
|
+
rotate() {
|
|
4967
|
+
let width = window.innerWidth;
|
|
4968
|
+
let height = window.innerHeight;
|
|
4969
|
+
if (this._orientation === exports.Orientation.LANDSCAPE) {
|
|
4970
|
+
this._rootRotated = width < height;
|
|
4971
|
+
} else if (this._orientation === exports.Orientation.PORTRAIT) {
|
|
4972
|
+
this._rootRotated = width > height;
|
|
4973
|
+
} else {
|
|
4974
|
+
return;
|
|
4975
|
+
}
|
|
4746
4976
|
if (this._rootRotated) {
|
|
4747
4977
|
let tmp = width;
|
|
4748
4978
|
width = height;
|
|
4749
4979
|
height = tmp;
|
|
4750
4980
|
}
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4981
|
+
const root = this._root;
|
|
4982
|
+
if (this._rootRotated) {
|
|
4983
|
+
root.style['-webkit-transform'] = 'rotate(90deg)';
|
|
4984
|
+
root.style.transform = 'rotate(90deg)';
|
|
4985
|
+
root.style['-webkit-transform-origin'] = '0px 0px 0px';
|
|
4986
|
+
root.style.transformOrigin = '0px 0px 0px';
|
|
4987
|
+
root.style.margin = `0 0 0 ${height}px`;
|
|
4988
|
+
root.style.width = `${width}px`;
|
|
4989
|
+
root.style.height = `${height}px`;
|
|
4990
|
+
} else {
|
|
4991
|
+
root.style['-webkit-transform'] = 'rotate(0deg)';
|
|
4992
|
+
root.style.transform = 'rotate(0deg)';
|
|
4993
|
+
root.style.margin = '0px auto';
|
|
4994
|
+
root.style.width = `${width}px`;
|
|
4995
|
+
root.style.height = `${height}px`;
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
resize(width = this._container.offsetWidth, height = this._container.offsetHeight) {
|
|
4999
|
+
if (!this._autoResize) {
|
|
5000
|
+
return;
|
|
5001
|
+
}
|
|
5002
|
+
if (this._rootRotated) {
|
|
5003
|
+
let tmp = width;
|
|
5004
|
+
width = height;
|
|
5005
|
+
height = tmp;
|
|
5006
|
+
}
|
|
5007
|
+
this._width = width;
|
|
5008
|
+
this._height = height;
|
|
5009
|
+
let camera = this._camera;
|
|
5010
|
+
if (camera.isOrthographicCamera) {
|
|
5011
|
+
this._viewport = {
|
|
5012
|
+
width: width / camera.zoom,
|
|
5013
|
+
height: height / camera.zoom,
|
|
5014
|
+
factor: 1
|
|
5015
|
+
};
|
|
5016
|
+
} else if (camera.isPerspectiveCamera) {
|
|
5017
|
+
if (!camera.manual) {
|
|
5018
|
+
camera.aspect = width / height;
|
|
5019
|
+
camera.updateProjectionMatrix();
|
|
4790
5020
|
}
|
|
4791
|
-
|
|
4792
|
-
|
|
5021
|
+
let distance = camera.getWorldPosition(Viewer.__worldPos).distanceTo(Viewer.__target);
|
|
5022
|
+
let h = 2 * Math.tan(three.MathUtils.degToRad(camera.fov * 0.5)) * distance;
|
|
5023
|
+
let w = h * width / height;
|
|
5024
|
+
this._viewport = {
|
|
5025
|
+
width: w,
|
|
5026
|
+
height: h,
|
|
5027
|
+
factor: width / w
|
|
5028
|
+
};
|
|
4793
5029
|
}
|
|
5030
|
+
this._resizing(width, height);
|
|
5031
|
+
this._componentManager.resize(width, height);
|
|
4794
5032
|
}
|
|
4795
5033
|
loadAsset(props) {
|
|
4796
|
-
return this._resourceManager.loadAsset(Object.assign(
|
|
5034
|
+
return this._resourceManager.loadAsset(Object.assign({}, this._defaultProps, props));
|
|
4797
5035
|
}
|
|
4798
5036
|
getLoader(ext) {
|
|
4799
5037
|
return this._resourceManager.getLoader(ext);
|
|
@@ -4956,7 +5194,7 @@ class Viewer extends EventEmitter {
|
|
|
4956
5194
|
Viewer.CompileObject3D(this._renderer, this._scene, this._camera, this._scene);
|
|
4957
5195
|
}
|
|
4958
5196
|
}
|
|
4959
|
-
constructor({ root, canvas, autoStart = true, autoResize = true, shadows = false, camera = {
|
|
5197
|
+
constructor({ root, canvas, container, autoStart = true, autoResize = true, shadows = false, camera = {
|
|
4960
5198
|
fov: 45,
|
|
4961
5199
|
near: 0.1,
|
|
4962
5200
|
far: 1000,
|
|
@@ -4990,6 +5228,7 @@ class Viewer extends EventEmitter {
|
|
|
4990
5228
|
}
|
|
4991
5229
|
this._root = root || el;
|
|
4992
5230
|
this._canvas = el;
|
|
5231
|
+
this._container = container || el.parentElement;
|
|
4993
5232
|
this._gl = webgl.gl;
|
|
4994
5233
|
this._RENDER_TARGET_FLOAT_TYPE = webgl.RENDER_TARGET_FLOAT_TYPE;
|
|
4995
5234
|
this._DATA_FLOAT_TYPE = webgl.DATA_FLOAT_TYPE;
|
|
@@ -5024,7 +5263,10 @@ class Viewer extends EventEmitter {
|
|
|
5024
5263
|
this._input = new DeviceInput(this);
|
|
5025
5264
|
this._input.addEventListeners();
|
|
5026
5265
|
this._addDefaultLoaders();
|
|
5027
|
-
if (autoStart)
|
|
5266
|
+
if (autoStart) {
|
|
5267
|
+
this.start();
|
|
5268
|
+
}
|
|
5269
|
+
this.rotate();
|
|
5028
5270
|
this.resize();
|
|
5029
5271
|
}
|
|
5030
5272
|
}
|
|
@@ -5708,6 +5950,7 @@ exports.BoxProjection = BoxProjection;
|
|
|
5708
5950
|
exports.CinestationBlendDefinition = CinestationBlendDefinition;
|
|
5709
5951
|
exports.CinestationBrain = CinestationBrain;
|
|
5710
5952
|
exports.Component = Component;
|
|
5953
|
+
exports.ContactShadows = ContactShadows;
|
|
5711
5954
|
exports.DeviceInput = DeviceInput;
|
|
5712
5955
|
exports.DropFile = DropFile;
|
|
5713
5956
|
exports.Easing = Easing;
|
|
@@ -5733,6 +5976,7 @@ exports.Quat_smoothDamp = Quat_smoothDamp;
|
|
|
5733
5976
|
exports.Reflector = Reflector;
|
|
5734
5977
|
exports.ReflectorMaterial = ReflectorMaterial;
|
|
5735
5978
|
exports.ResourceManager = ResourceManager;
|
|
5979
|
+
exports.ShadowMaterial = ShadowMaterial;
|
|
5736
5980
|
exports.Sphere = Sphere;
|
|
5737
5981
|
exports.SystemInfo = SystemInfo;
|
|
5738
5982
|
exports.Tween = Tween;
|
|
@@ -5766,8 +6010,8 @@ exports.find = find;
|
|
|
5766
6010
|
exports.frag_BoxfilterBlur = frag_BoxfilterBlur;
|
|
5767
6011
|
exports.frag_cubeMapToPanorama = frag_cubeMapToPanorama;
|
|
5768
6012
|
exports.frag_panoramaToCubeMap = frag_panoramaToCubeMap;
|
|
5769
|
-
exports.getChidren = getChidren;
|
|
5770
6013
|
exports.getChildByName = getChildByName;
|
|
6014
|
+
exports.getChildren = getChildren;
|
|
5771
6015
|
exports.getClassInstance = getClassInstance;
|
|
5772
6016
|
exports.getShaderMaterial = getShaderMaterial;
|
|
5773
6017
|
exports.mixin = mixin;
|