@xviewer.js/core 1.0.0-alpha.20 → 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 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 materialMapKeys){
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 }) {
@@ -1347,7 +1347,7 @@ class Component extends ObjectInstance {
1347
1347
  }
1348
1348
  }
1349
1349
 
1350
- const { clamp: clamp$1, lerp } = three.MathUtils;
1350
+ const { clamp: clamp$4, lerp: lerp$1 } = three.MathUtils;
1351
1351
  class CinestationBrain extends Component {
1352
1352
  get vcam() {
1353
1353
  return this._vcam;
@@ -1361,7 +1361,7 @@ class CinestationBrain extends Component {
1361
1361
  this._vcams.forEach((v)=>v.enabled = v === vcam);
1362
1362
  if (this._lerpTime < this.brainBlend.time) {
1363
1363
  this._lerpTime += dt;
1364
- let t = clamp$1(this._lerpTime / this.brainBlend.time, 0, 1);
1364
+ let t = clamp$4(this._lerpTime / this.brainBlend.time, 0, 1);
1365
1365
  this._lerpToMainCamera(vcam, this.brainBlend.style(t));
1366
1366
  } else {
1367
1367
  this._lerpToMainCamera(vcam, 1);
@@ -1397,9 +1397,9 @@ class CinestationBrain extends Component {
1397
1397
  const isChanged = isLensChanged || isTransformChanged;
1398
1398
  from.position.lerp(finalPosition, t);
1399
1399
  from.quaternion.slerp(finalRotation, t);
1400
- from.fov = lerp(from.fov, fov, t);
1401
- from.near = lerp(from.near, near, t);
1402
- from.far = lerp(from.far, far, t);
1400
+ from.fov = lerp$1(from.fov, fov, t);
1401
+ from.near = lerp$1(from.near, near, t);
1402
+ from.far = lerp$1(from.far, far, t);
1403
1403
  if (isLensChanged) {
1404
1404
  from.updateProjectionMatrix();
1405
1405
  }
@@ -2000,15 +2000,579 @@ SystemInfo.cpuCoreCount = navigator.hardwareConcurrency || 1;
2000
2000
  SystemInfo.baseUrl = document.location.origin;
2001
2001
  SystemInfo.isIFrame = window.self !== window.top;
2002
2002
 
2003
- const { min, max, exp } = Math;
2003
+ const { clamp: clamp$3 } = three.MathUtils;
2004
+ const { min, max: max$1, exp } = Math;
2005
+ const kNegligibleResidual = 0.01;
2006
+ const kLogNegligibleResidual = Math.log(kNegligibleResidual) // -4.605170186;
2007
+ ;
2008
+ function exponentialDamp(current, target, dampTime, deltaTime) {
2009
+ let k = -kLogNegligibleResidual / dampTime;
2010
+ return current + (target - current) * (1 - exp(-k * deltaTime));
2011
+ }
2004
2012
  // cuve like exponentialDecay but cost less
2005
2013
  function quarticDamp(current, target, dampTime, deltaTime) {
2006
2014
  let t = 1 - min(deltaTime, dampTime) / dampTime;
2007
2015
  let tt = t * t;
2008
2016
  return current + (target - current) * (1 - tt * tt);
2009
2017
  }
2018
+ function smoothDamp(state, current, target, smoothTime, maxSpeed, deltaTime) {
2019
+ if (state._velocity === undefined) {
2020
+ state._velocity = 0;
2021
+ }
2022
+ smoothTime = max$1(0.0001, smoothTime);
2023
+ let num = 2 / smoothTime;
2024
+ let num2 = num * deltaTime;
2025
+ let num3 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2);
2026
+ let num4 = current - target;
2027
+ let num5 = target;
2028
+ let num6 = maxSpeed * smoothTime;
2029
+ num4 = clamp$3(num4, -num6, num6);
2030
+ target = current - num4;
2031
+ let num7 = (state._velocity + num * num4) * deltaTime;
2032
+ state._velocity = (state._velocity - num * num7) * num3;
2033
+ let num8 = target + (num4 + num7) * num3;
2034
+ if (num5 - current > 0 == num8 > num5) {
2035
+ num8 = num5;
2036
+ state._velocity = (num8 - num5) / deltaTime;
2037
+ }
2038
+ return num8;
2039
+ }
2040
+ function Quat_exponentialDamp(current, target, dampTime, deltaTime, out = current) {
2041
+ return out.copy(current).slerp(target, exponentialDamp(0, 1, dampTime, deltaTime));
2042
+ }
2043
+ function Quat_quarticDamp(current, target, dampTime, deltaTime, out = current) {
2044
+ return out.copy(current).slerp(target, quarticDamp(0, 1, dampTime, deltaTime));
2045
+ }
2046
+ function Quat_smoothDamp(current, target, dampTime, deltaTime, out = current) {
2047
+ return out.copy(current).slerp(target, smoothDamp(out, 0, 1, dampTime, Infinity, deltaTime));
2048
+ }
2049
+ function Vec3_smoothDamp(current, target, dampTime, deltaTime, out = current) {
2050
+ return out.copy(current).lerp(target, smoothDamp(out, 0, 1, dampTime, Infinity, deltaTime));
2051
+ }
2052
+
2053
+ const Vector3_UNIT_X = Object.freeze(new three.Vector3(1, 0, 0));
2054
+ const Vector3_UNIT_Y = Object.freeze(new three.Vector3(0, 1, 0));
2055
+ const Vector3_UNIT_Z = Object.freeze(new three.Vector3(0, 0, 1));
2056
+ const Vector3_RIGHT = Object.freeze(new three.Vector3(1, 0, 0));
2057
+ const Vector3_UP = Object.freeze(new three.Vector3(0, 1, 0));
2058
+ const Vector3_ZERO = Object.freeze(new three.Vector3(0, 0, 0));
2059
+ const Vector3_ONE = Object.freeze(new three.Vector3(1, 1, 1));
2060
+ const Vector3_NEG_ONE = Object.freeze(new three.Vector3(-1, -1, -1));
2061
+
2062
+ const { clamp: clamp$2 } = three.MathUtils;
2063
+ const { max, abs: abs$1, acos } = Math;
2064
+ const EPSILON = 1.e-6;
2065
+ const __delta = new three.Vector3();
2066
+ function VInterpTo(current, target, deltaTime, speed, out = current) {
2067
+ if (speed <= 0) {
2068
+ return out.copy(target);
2069
+ }
2070
+ let dist = __delta.copy(target).sub(current);
2071
+ if (dist.lengthSq() < EPSILON) {
2072
+ return out.copy(target);
2073
+ }
2074
+ return out.copy(current).add(dist.multiplyScalar(clamp$2(deltaTime * speed, 0, 1)));
2075
+ }
2076
+ function VInterpConstantTo(current, target, deltaTime, speed, out = current) {
2077
+ let delta = __delta.copy(target).sub(current);
2078
+ let deltaM = delta.length();
2079
+ let maxStep = speed * deltaTime;
2080
+ if (deltaM > maxStep) {
2081
+ if (maxStep > 0) {
2082
+ let deltaN = delta.multiplyScalar(1 / deltaM);
2083
+ return out.copy(current).add(deltaN);
2084
+ } else {
2085
+ return out.copy(current);
2086
+ }
2087
+ }
2088
+ return out.copy(target);
2089
+ }
2090
+ function Quat_Equals(a, b, epsilon = EPSILON) {
2091
+ return abs$1(a.x - b.x) <= epsilon * max(1., abs$1(a.x), abs$1(b.x)) && abs$1(a.y - b.y) <= epsilon * max(1., abs$1(a.y), abs$1(b.y)) && abs$1(a.z - b.z) <= epsilon * max(1., abs$1(a.z), abs$1(b.z)) && abs$1(a.w - b.w) <= epsilon * max(1., abs$1(a.w), abs$1(b.w));
2092
+ }
2093
+ function Quat_AngularDistance(a, b) {
2094
+ let innerProd = a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
2095
+ return acos(2 * innerProd * innerProd - 1);
2096
+ }
2097
+ function QInterpTo(current, target, deltaTime, speed) {
2098
+ if (speed <= 0) {
2099
+ return target;
2100
+ }
2101
+ if (Quat_Equals(current, target)) {
2102
+ return target;
2103
+ }
2104
+ return current.slerp(target, clamp$2(speed * deltaTime, 0, 1));
2105
+ }
2106
+ function QInterpConstantTo(current, target, deltaTime, speed, out = current) {
2107
+ if (speed <= 0) {
2108
+ return out.copy(target);
2109
+ }
2110
+ if (Quat_Equals(current, target)) {
2111
+ return out.copy(target);
2112
+ }
2113
+ let deltaSpeed = clamp$2(speed * deltaTime, 0, 1);
2114
+ let angularDist = max(Quat_AngularDistance(current, target), EPSILON);
2115
+ return out.copy(current).slerp(target, clamp$2(deltaSpeed / angularDist, 0, 1));
2116
+ }
2117
+ //非线性
2118
+ function FInterpTo(current, target, deltaTime, speed) {
2119
+ if (speed <= 0) {
2120
+ return target;
2121
+ }
2122
+ let dist = target - current;
2123
+ if (abs$1(dist) < EPSILON) {
2124
+ return target;
2125
+ }
2126
+ return current + dist * clamp$2(speed * deltaTime, 0, 1);
2127
+ }
2128
+ //线性插值
2129
+ function FInterpConstantTo(current, target, deltaTime, speed) {
2130
+ let dist = target - current;
2131
+ if (abs$1(dist) < EPSILON) {
2132
+ return target;
2133
+ }
2134
+ let step = speed * deltaTime;
2135
+ return current + clamp$2(dist, -step, step);
2136
+ }
2010
2137
 
2011
- const Vector3_ZERO = new three.Vector3();
2138
+ const { lerp, clamp: clamp$1 } = three.MathUtils;
2139
+ function catmullRom(t, p0, p1, p2, p3) {
2140
+ const v0 = (p2 - p0) * 0.5;
2141
+ const v1 = (p3 - p1) * 0.5;
2142
+ const t2 = t * t;
2143
+ const t3 = t * t2;
2144
+ return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
2145
+ }
2146
+ class CurvePoint {
2147
+ set(x, y) {
2148
+ this.x = x;
2149
+ this.y = y;
2150
+ return this;
2151
+ }
2152
+ lerp(p, t, out = this) {
2153
+ out.x = lerp(this.x, p.x, t);
2154
+ out.y = lerp(this.y, p.y, t);
2155
+ return out;
2156
+ }
2157
+ constructor(x = 0, y = 0, mode = 0){
2158
+ this.x = x;
2159
+ this.y = y;
2160
+ this.mode = mode;
2161
+ }
2162
+ }
2163
+ class AnimationCurve {
2164
+ _getInterpolant(samples) {
2165
+ if (this._samples !== samples) {
2166
+ this._samples = samples;
2167
+ this._interpolant = new three.LinearInterpolant(new Float32Array(samples), new Float32Array(samples), 1, new Float32Array(samples));
2168
+ }
2169
+ return this._interpolant;
2170
+ }
2171
+ createCurvePoint(x, y, mode) {
2172
+ return new CurvePoint(x, y, mode);
2173
+ }
2174
+ resample(samples = 100) {
2175
+ const step = 1 / (samples - 1);
2176
+ const interpolant = this._getInterpolant(samples);
2177
+ const times = interpolant.parameterPositions;
2178
+ const values = interpolant.sampleValues;
2179
+ const point = this.createCurvePoint();
2180
+ for(let i = 0; i < samples; i++){
2181
+ this.getPoint(i * step, point);
2182
+ times[i] = point.x;
2183
+ values[i] = point.y;
2184
+ }
2185
+ }
2186
+ evaluate(t) {
2187
+ if (this.needsUpdate) {
2188
+ this.needsUpdate = false;
2189
+ this.resample();
2190
+ }
2191
+ return this._interpolant.evaluate(t)[0];
2192
+ }
2193
+ getPoint(t, out) {
2194
+ const points = this.points;
2195
+ if (t <= 0) {
2196
+ return out.set(t, points[0].y);
2197
+ }
2198
+ if (t >= 1) {
2199
+ return out.set(t, points[points.length - 1].y);
2200
+ }
2201
+ const p = (points.length - 1) * t;
2202
+ const intPoint = Math.floor(p);
2203
+ const weight = p - intPoint;
2204
+ const p0 = points[intPoint === 0 ? intPoint : intPoint - 1];
2205
+ const p1 = points[intPoint];
2206
+ const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];
2207
+ const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];
2208
+ if (p1.mode === 1 || p0 === p1 && p2.mode === 1) {
2209
+ return p1.lerp(p2, weight, out);
2210
+ }
2211
+ return out.set(clamp$1(catmullRom(weight, p0.x, p1.x, p2.x, p3.x), 0, 1), clamp$1(catmullRom(weight, p0.y, p1.y, p2.y, p3.y), 0, 1));
2212
+ }
2213
+ constructor(name = "", points = [
2214
+ new CurvePoint(0, 0),
2215
+ new CurvePoint(1, 1)
2216
+ ]){
2217
+ this.name = name;
2218
+ this.points = points;
2219
+ this.needsUpdate = true;
2220
+ this.isAnimationCurve = true;
2221
+ this._samples = 100;
2222
+ this._interpolant = new three.LinearInterpolant(new Float32Array(100), new Float32Array(100), 1, new Float32Array(100));
2223
+ }
2224
+ }
2225
+
2226
+ const { floor } = Math;
2227
+ // Copyright (C) 2016 Keijiro Takahashi
2228
+ // https://mrl.cs.nyu.edu/~perlin/noise/
2229
+ class Perlin {
2230
+ static Noise(x, y, z) {
2231
+ let fade = Perlin._Fade;
2232
+ let grad = Perlin._Grad;
2233
+ let lerp = Perlin._Lerp;
2234
+ let p = Perlin._Permutation;
2235
+ if (y !== undefined && z !== undefined) {
2236
+ let xi = floor(x);
2237
+ let yi = floor(y);
2238
+ let zi = floor(z);
2239
+ let X = xi & 0xff; // FIND UNIT CUBE THAT
2240
+ let Y = yi & 0xff; // CONTAINS POINT.
2241
+ let Z = zi & 0xff;
2242
+ x -= xi; // FIND RELATIVE X,Y,Z
2243
+ y -= yi; // OF POINT IN CUBE.
2244
+ z -= zi;
2245
+ let u = fade(x); // COMPUTE FADE CURVES
2246
+ let v = fade(y); // FOR EACH OF X,Y,Z.
2247
+ let w = fade(z);
2248
+ let A = p[X] + Y, AA = p[A] + Z, AB = p[A + 1] + Z; // HASH COORDINATES OF
2249
+ let B = p[X + 1] + Y, BA = p[B] + Z, BB = p[B + 1] + Z; // THE 8 CUBE CORNERS,
2250
+ return lerp(w, lerp(v, lerp(u, grad(p[AA], x, y, z), grad(p[BA], x - 1, y, z)), lerp(u, grad(p[AB], x, y - 1, z), grad(p[BB], x - 1, y - 1, z))), lerp(v, lerp(u, grad(p[AA + 1], x, y, z - 1), grad(p[BA + 1], x - 1, y, z - 1)), lerp(u, grad(p[AB + 1], x, y - 1, z - 1), grad(p[BB + 1], x - 1, y - 1, z - 1))));
2251
+ } else if (y !== undefined) {
2252
+ let xi = floor(x);
2253
+ let yi = floor(y);
2254
+ let X = xi & 0xff;
2255
+ let Y = yi & 0xff;
2256
+ x -= xi;
2257
+ y -= yi;
2258
+ let u = fade(x);
2259
+ let v = fade(y);
2260
+ let A = p[X] + Y & 0xff;
2261
+ let B = p[X + 1] + Y & 0xff;
2262
+ return lerp(v, lerp(u, grad(p[A], x, y), grad(p[B], x - 1, y)), lerp(u, grad(p[A + 1], x, y - 1), grad(p[B + 1], x - 1, y - 1)));
2263
+ } else {
2264
+ let xi = floor(x);
2265
+ let X = xi & 0xff;
2266
+ x -= xi;
2267
+ let u = fade(x);
2268
+ return lerp(u, grad(p[X], x), grad(p[X + 1], x - 1));
2269
+ }
2270
+ }
2271
+ static Fbm(octave, x, y, z) {
2272
+ let f = 0;
2273
+ let w = 0.5;
2274
+ let noise = Perlin.Noise;
2275
+ if (y !== undefined && z !== undefined) {
2276
+ for(let i = 0; i < octave; i++){
2277
+ f += w * noise(x, y, z);
2278
+ x *= 2.0;
2279
+ y *= 2.0;
2280
+ z *= 2.0;
2281
+ w *= 0.5;
2282
+ }
2283
+ } else if (y !== undefined) {
2284
+ for(let i = 0; i < octave; i++){
2285
+ f += w * noise(x, y);
2286
+ x *= 2.0;
2287
+ y *= 2.0;
2288
+ w *= 0.5;
2289
+ }
2290
+ } else {
2291
+ for(let i = 0; i < octave; i++){
2292
+ f += w * noise(x);
2293
+ x *= 2.0;
2294
+ w *= 0.5;
2295
+ }
2296
+ }
2297
+ return f;
2298
+ }
2299
+ static _Fade(t) {
2300
+ return t * t * t * (t * (t * 6 - 15) + 10);
2301
+ }
2302
+ static _Lerp(t, a, b) {
2303
+ return a + t * (b - a);
2304
+ }
2305
+ static _Grad(hash, x, y, z) {
2306
+ if (y !== undefined && z !== undefined) {
2307
+ let h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
2308
+ let u = h < 8 ? x : y, v = h < 4 ? y : h == 12 || h == 14 ? x : z;
2309
+ return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
2310
+ } else if (y !== undefined) {
2311
+ return ((hash & 1) == 0 ? x : -x) + ((hash & 2) == 0 ? y : -y);
2312
+ } else {
2313
+ return (hash & 1) == 0 ? x : -x;
2314
+ }
2315
+ }
2316
+ }
2317
+ Perlin._Permutation = [
2318
+ 151,
2319
+ 160,
2320
+ 137,
2321
+ 91,
2322
+ 90,
2323
+ 15,
2324
+ 131,
2325
+ 13,
2326
+ 201,
2327
+ 95,
2328
+ 96,
2329
+ 53,
2330
+ 194,
2331
+ 233,
2332
+ 7,
2333
+ 225,
2334
+ 140,
2335
+ 36,
2336
+ 103,
2337
+ 30,
2338
+ 69,
2339
+ 142,
2340
+ 8,
2341
+ 99,
2342
+ 37,
2343
+ 240,
2344
+ 21,
2345
+ 10,
2346
+ 23,
2347
+ 190,
2348
+ 6,
2349
+ 148,
2350
+ 247,
2351
+ 120,
2352
+ 234,
2353
+ 75,
2354
+ 0,
2355
+ 26,
2356
+ 197,
2357
+ 62,
2358
+ 94,
2359
+ 252,
2360
+ 219,
2361
+ 203,
2362
+ 117,
2363
+ 35,
2364
+ 11,
2365
+ 32,
2366
+ 57,
2367
+ 177,
2368
+ 33,
2369
+ 88,
2370
+ 237,
2371
+ 149,
2372
+ 56,
2373
+ 87,
2374
+ 174,
2375
+ 20,
2376
+ 125,
2377
+ 136,
2378
+ 171,
2379
+ 168,
2380
+ 68,
2381
+ 175,
2382
+ 74,
2383
+ 165,
2384
+ 71,
2385
+ 134,
2386
+ 139,
2387
+ 48,
2388
+ 27,
2389
+ 166,
2390
+ 77,
2391
+ 146,
2392
+ 158,
2393
+ 231,
2394
+ 83,
2395
+ 111,
2396
+ 229,
2397
+ 122,
2398
+ 60,
2399
+ 211,
2400
+ 133,
2401
+ 230,
2402
+ 220,
2403
+ 105,
2404
+ 92,
2405
+ 41,
2406
+ 55,
2407
+ 46,
2408
+ 245,
2409
+ 40,
2410
+ 244,
2411
+ 102,
2412
+ 143,
2413
+ 54,
2414
+ 65,
2415
+ 25,
2416
+ 63,
2417
+ 161,
2418
+ 1,
2419
+ 216,
2420
+ 80,
2421
+ 73,
2422
+ 209,
2423
+ 76,
2424
+ 132,
2425
+ 187,
2426
+ 208,
2427
+ 89,
2428
+ 18,
2429
+ 169,
2430
+ 200,
2431
+ 196,
2432
+ 135,
2433
+ 130,
2434
+ 116,
2435
+ 188,
2436
+ 159,
2437
+ 86,
2438
+ 164,
2439
+ 100,
2440
+ 109,
2441
+ 198,
2442
+ 173,
2443
+ 186,
2444
+ 3,
2445
+ 64,
2446
+ 52,
2447
+ 217,
2448
+ 226,
2449
+ 250,
2450
+ 124,
2451
+ 123,
2452
+ 5,
2453
+ 202,
2454
+ 38,
2455
+ 147,
2456
+ 118,
2457
+ 126,
2458
+ 255,
2459
+ 82,
2460
+ 85,
2461
+ 212,
2462
+ 207,
2463
+ 206,
2464
+ 59,
2465
+ 227,
2466
+ 47,
2467
+ 16,
2468
+ 58,
2469
+ 17,
2470
+ 182,
2471
+ 189,
2472
+ 28,
2473
+ 42,
2474
+ 223,
2475
+ 183,
2476
+ 170,
2477
+ 213,
2478
+ 119,
2479
+ 248,
2480
+ 152,
2481
+ 2,
2482
+ 44,
2483
+ 154,
2484
+ 163,
2485
+ 70,
2486
+ 221,
2487
+ 153,
2488
+ 101,
2489
+ 155,
2490
+ 167,
2491
+ 43,
2492
+ 172,
2493
+ 9,
2494
+ 129,
2495
+ 22,
2496
+ 39,
2497
+ 253,
2498
+ 19,
2499
+ 98,
2500
+ 108,
2501
+ 110,
2502
+ 79,
2503
+ 113,
2504
+ 224,
2505
+ 232,
2506
+ 178,
2507
+ 185,
2508
+ 112,
2509
+ 104,
2510
+ 218,
2511
+ 246,
2512
+ 97,
2513
+ 228,
2514
+ 251,
2515
+ 34,
2516
+ 242,
2517
+ 193,
2518
+ 238,
2519
+ 210,
2520
+ 144,
2521
+ 12,
2522
+ 191,
2523
+ 179,
2524
+ 162,
2525
+ 241,
2526
+ 81,
2527
+ 51,
2528
+ 145,
2529
+ 235,
2530
+ 249,
2531
+ 14,
2532
+ 239,
2533
+ 107,
2534
+ 49,
2535
+ 192,
2536
+ 214,
2537
+ 31,
2538
+ 181,
2539
+ 199,
2540
+ 106,
2541
+ 157,
2542
+ 184,
2543
+ 84,
2544
+ 204,
2545
+ 176,
2546
+ 115,
2547
+ 121,
2548
+ 50,
2549
+ 45,
2550
+ 127,
2551
+ 4,
2552
+ 150,
2553
+ 254,
2554
+ 138,
2555
+ 236,
2556
+ 205,
2557
+ 93,
2558
+ 222,
2559
+ 114,
2560
+ 67,
2561
+ 29,
2562
+ 24,
2563
+ 72,
2564
+ 243,
2565
+ 141,
2566
+ 128,
2567
+ 195,
2568
+ 78,
2569
+ 66,
2570
+ 215,
2571
+ 61,
2572
+ 156,
2573
+ 180,
2574
+ 151
2575
+ ];
2012
2576
 
2013
2577
  const { clamp, degToRad } = three.MathUtils;
2014
2578
  const { abs, tan } = Math;
@@ -2327,53 +2891,6 @@ class Plane extends three.Mesh {
2327
2891
  }
2328
2892
  }
2329
2893
 
2330
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2331
- try {
2332
- var info = gen[key](arg);
2333
- var value = info.value;
2334
- } catch (error) {
2335
- reject(error);
2336
- return;
2337
- }
2338
- if (info.done) resolve(value);
2339
- else Promise.resolve(value).then(_next, _throw);
2340
- }
2341
- function _async_to_generator(fn) {
2342
- return function() {
2343
- var self = this, args = arguments;
2344
-
2345
- return new Promise(function(resolve, reject) {
2346
- var gen = fn.apply(self, args);
2347
-
2348
- function _next(value) {
2349
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2350
- }
2351
-
2352
- function _throw(err) {
2353
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2354
- }
2355
-
2356
- _next(undefined);
2357
- });
2358
- };
2359
- }
2360
-
2361
- function _object_without_properties_loose(source, excluded) {
2362
- if (source == null) return {};
2363
-
2364
- var target = {};
2365
- var sourceKeys = Object.keys(source);
2366
- var key, i;
2367
-
2368
- for (i = 0; i < sourceKeys.length; i++) {
2369
- key = sourceKeys[i];
2370
- if (excluded.indexOf(key) >= 0) continue;
2371
- target[key] = source[key];
2372
- }
2373
-
2374
- return target;
2375
- }
2376
-
2377
2894
  class Caller {
2378
2895
  get pause() {
2379
2896
  return this._pause;
@@ -2878,12 +3395,7 @@ class ResourceManager {
2878
3395
  this._loaders.set(ext, loader);
2879
3396
  }
2880
3397
  }
2881
- loadAsset(_param) {
2882
- var { url, ext, onProgress } = _param, props = _object_without_properties_loose(_param, [
2883
- "url",
2884
- "ext",
2885
- "onProgress"
2886
- ]);
3398
+ loadAsset({ url, ext, onProgress, ...props }) {
2887
3399
  return new Promise((resolve, reject)=>{
2888
3400
  const info = ResourceManager._parseURL(url);
2889
3401
  const texSettings = ResourceManager._splitTextureSettings(props);
@@ -3241,30 +3753,20 @@ class Viewer extends EventEmitter {
3241
3753
  addLoader(Loader) {
3242
3754
  this._resourceManager.addLoader(Loader);
3243
3755
  }
3244
- load(_param) {
3245
- var _this = this;
3246
- return _async_to_generator(function*() {
3247
- var { url, ext, onProgress, castShadow = false, receiveShadow = false } = _param, props = _object_without_properties_loose(_param, [
3248
- "url",
3249
- "ext",
3250
- "onProgress",
3251
- "castShadow",
3252
- "receiveShadow"
3253
- ]);
3254
- const node = yield _this.loadAsset({
3255
- url,
3256
- ext,
3257
- 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;
3258
3766
  });
3259
- if (castShadow || receiveShadow) {
3260
- node.userData.meshData.meshes.forEach((v)=>{
3261
- v.castShadow = castShadow;
3262
- v.receiveShadow = receiveShadow;
3263
- });
3264
- }
3265
- _this.addNode(node, props);
3266
- return node;
3267
- })();
3767
+ }
3768
+ this.addNode(node, props);
3769
+ return node;
3268
3770
  }
3269
3771
  tween(target) {
3270
3772
  return this._tweenManager.tween(target);
@@ -3313,18 +3815,7 @@ class Viewer extends EventEmitter {
3313
3815
  removeComponent(node, component) {
3314
3816
  return this._componentManager.removeComponent(node, component);
3315
3817
  }
3316
- addNode(object, _param = {}) {
3317
- var { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene } = _param, props = _object_without_properties_loose(_param, [
3318
- "args",
3319
- "debug",
3320
- "scale",
3321
- "position",
3322
- "rotation",
3323
- "shadowArgs",
3324
- "makeDefault",
3325
- "component",
3326
- "parent"
3327
- ]);
3818
+ addNode(object, { args, debug, scale, position, rotation, shadowArgs, makeDefault, component, parent = this._scene, ...props } = {}) {
3328
3819
  let node = null;
3329
3820
  let ins = getClassInstance(object, args);
3330
3821
  if (ins.isObject3D) {
@@ -3419,6 +3910,9 @@ class Viewer extends EventEmitter {
3419
3910
  this._camera = camera;
3420
3911
  return result;
3421
3912
  }
3913
+ blit(renderTarget, material, lod, face) {
3914
+ Viewer.Blit(this._renderer, renderTarget, material, lod, face);
3915
+ }
3422
3916
  compile(target) {
3423
3917
  if (Array.isArray(target)) {
3424
3918
  if (target.every((v)=>v.isMaterial)) {
@@ -3446,30 +3940,12 @@ class Viewer extends EventEmitter {
3446
3940
  Viewer.CompileObject3D(this._renderer, this._scene, this._camera, this._scene);
3447
3941
  }
3448
3942
  }
3449
- constructor(_param = {}){
3450
- var { root, canvas, autoStart = true, autoResize = true, shadows = false, camera = {
3451
- fov: 45,
3452
- near: 1,
3453
- far: 1000,
3454
- position: new three.Vector3(0, 0, 4)
3455
- }, 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, [
3456
- "root",
3457
- "canvas",
3458
- "autoStart",
3459
- "autoResize",
3460
- "shadows",
3461
- "camera",
3462
- "targetFrameRate",
3463
- "colorSpace",
3464
- "toneMapping",
3465
- "toneMappingExposure",
3466
- "maxDPR",
3467
- "path",
3468
- "resourcePath",
3469
- "dracoPath",
3470
- "loader",
3471
- "tasker"
3472
- ]);
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 } = {}){
3473
3949
  super();
3474
3950
  this._dpr = 1;
3475
3951
  this._width = 1;
@@ -3549,23 +4025,46 @@ class Plugin extends ObjectInstance {
3549
4025
  }
3550
4026
  }
3551
4027
 
4028
+ exports.AnimationCurve = AnimationCurve;
3552
4029
  exports.Box = Box;
3553
4030
  exports.CinestationBlendDefinition = CinestationBlendDefinition;
3554
4031
  exports.CinestationBrain = CinestationBrain;
3555
4032
  exports.Component = Component;
4033
+ exports.DeviceInput = DeviceInput;
3556
4034
  exports.Easing = Easing;
3557
4035
  exports.EventEmitter = EventEmitter;
4036
+ exports.FInterpConstantTo = FInterpConstantTo;
4037
+ exports.FInterpTo = FInterpTo;
3558
4038
  exports.FreelookVirtualCamera = FreelookVirtualCamera;
3559
4039
  exports.Logger = Logger;
3560
4040
  exports.ObjectInstance = ObjectInstance;
4041
+ exports.Perlin = Perlin;
3561
4042
  exports.Plane = Plane;
3562
4043
  exports.Plugin = Plugin;
3563
4044
  exports.PropertyManager = PropertyManager;
4045
+ exports.QInterpConstantTo = QInterpConstantTo;
4046
+ exports.QInterpTo = QInterpTo;
4047
+ exports.Quat_AngularDistance = Quat_AngularDistance;
4048
+ exports.Quat_Equals = Quat_Equals;
4049
+ exports.Quat_exponentialDamp = Quat_exponentialDamp;
4050
+ exports.Quat_quarticDamp = Quat_quarticDamp;
4051
+ exports.Quat_smoothDamp = Quat_smoothDamp;
3564
4052
  exports.Sphere = Sphere;
3565
4053
  exports.SystemInfo = SystemInfo;
3566
4054
  exports.Tween = Tween;
3567
4055
  exports.TweenChain = TweenChain;
3568
4056
  exports.TweenManager = TweenManager;
4057
+ exports.VInterpConstantTo = VInterpConstantTo;
4058
+ exports.VInterpTo = VInterpTo;
4059
+ exports.Vec3_smoothDamp = Vec3_smoothDamp;
4060
+ exports.Vector3_NEG_ONE = Vector3_NEG_ONE;
4061
+ exports.Vector3_ONE = Vector3_ONE;
4062
+ exports.Vector3_RIGHT = Vector3_RIGHT;
4063
+ exports.Vector3_UNIT_X = Vector3_UNIT_X;
4064
+ exports.Vector3_UNIT_Y = Vector3_UNIT_Y;
4065
+ exports.Vector3_UNIT_Z = Vector3_UNIT_Z;
4066
+ exports.Vector3_UP = Vector3_UP;
4067
+ exports.Vector3_ZERO = Vector3_ZERO;
3569
4068
  exports.Viewer = Viewer;
3570
4069
  exports.VirtualCamera = VirtualCamera;
3571
4070
  exports.aEXRLoader = aEXRLoader;
@@ -3573,8 +4072,12 @@ exports.aFBXLoader = aFBXLoader;
3573
4072
  exports.aGLTFLoader = aGLTFLoader;
3574
4073
  exports.aHDRLoader = aHDRLoader;
3575
4074
  exports.aJSONLoader = aJSONLoader;
4075
+ exports.aLoader = aLoader;
3576
4076
  exports.aTextureLoader = aTextureLoader;
4077
+ exports.exponentialDamp = exponentialDamp;
3577
4078
  exports.getClassInstance = getClassInstance;
3578
4079
  exports.mixin = mixin;
3579
4080
  exports.property = property;
4081
+ exports.quarticDamp = quarticDamp;
4082
+ exports.smoothDamp = smoothDamp;
3580
4083
  //# sourceMappingURL=main.js.map