tempest.games 0.3.1 → 0.3.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.
@@ -15175,7 +15175,7 @@ var require_src2 = __commonJS((exports, module2) => {
15175
15175
  }
15176
15176
  });
15177
15177
 
15178
- // ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.2.1/node_modules/@t3-oss/env-core/dist/standard.js
15178
+ // ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.4/node_modules/@t3-oss/env-core/dist/standard.js
15179
15179
  function ensureSynchronous(value3, message) {
15180
15180
  if (value3 instanceof Promise)
15181
15181
  throw new Error(message);
@@ -15202,7 +15202,7 @@ function parseWithDictionary(dictionary, value3) {
15202
15202
  }
15203
15203
  var init_standard = () => {};
15204
15204
 
15205
- // ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.2.1/node_modules/@t3-oss/env-core/dist/index.js
15205
+ // ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.4/node_modules/@t3-oss/env-core/dist/index.js
15206
15206
  function createEnv(opts) {
15207
15207
  const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
15208
15208
  if (opts.emptyStringAsUndefined ?? false) {
@@ -15269,7 +15269,7 @@ var init_dist = __esm(() => {
15269
15269
  });
15270
15270
 
15271
15271
  // src/library/env.ts
15272
- var BUILDING_WITH_VITE, HAS_WINDOW, IS_SERVER, IS_TEST, str, maybeBool, env2;
15272
+ var BUILDING_WITH_VITE, HAS_WINDOW, IS_SERVER, IS_TEST, str, requiredBool, optionalBool, env2;
15273
15273
  var init_env = __esm(() => {
15274
15274
  init_dist();
15275
15275
  init_out4();
@@ -15278,7 +15278,8 @@ var init_env = __esm(() => {
15278
15278
  IS_SERVER = !BUILDING_WITH_VITE && !HAS_WINDOW;
15279
15279
  IS_TEST = `vitest` in globalThis;
15280
15280
  str = type(`string`);
15281
- maybeBool = type(`"true" | "false" | undefined`);
15281
+ requiredBool = type(`"true" | "false"`).pipe((s) => s === `true`);
15282
+ optionalBool = type(`"true" | "false" | undefined`).pipe((s) => s === `true`);
15282
15283
  env2 = createEnv({
15283
15284
  isServer: IS_SERVER,
15284
15285
  server: {
@@ -15289,7 +15290,7 @@ var init_env = __esm(() => {
15289
15290
  POSTGRES_HOST: str,
15290
15291
  POSTGRES_PORT: str.pipe((s) => Number.parseInt(s, 10)),
15291
15292
  BACKEND_PORT: str.pipe((s) => Number.parseInt(s, 10)),
15292
- RUN_WORKERS_FROM_SOURCE: maybeBool.pipe((s) => s === `true`),
15293
+ RUN_WORKERS_FROM_SOURCE: optionalBool,
15293
15294
  FRONTEND_PORT: str.pipe((s) => Number.parseInt(s, 10)),
15294
15295
  FRONTEND_ORIGINS: str.pipe.try((s) => JSON.parse(s), type(`string[]`)),
15295
15296
  API_KEY_OPENAI: type(`string | undefined`),
@@ -15297,10 +15298,10 @@ var init_env = __esm(() => {
15297
15298
  },
15298
15299
  clientPrefix: `VITE_`,
15299
15300
  client: {
15300
- VITE_HIDE_DEVTOOLS: type(`string | undefined`).pipe((s) => s === `true`),
15301
+ VITE_HIDE_DEVTOOLS: requiredBool,
15301
15302
  VITE_BACKEND_ORIGIN: str,
15302
15303
  VITE_DEV_FRONTEND_HOST: type(`string | undefined`),
15303
- VITE_DEV_HTTPS: maybeBool.pipe((s) => s === `true`)
15304
+ VITE_DEV_HTTPS: optionalBool
15304
15305
  },
15305
15306
  runtimeEnv: import.meta.env,
15306
15307
  emptyStringAsUndefined: true
@@ -18920,8 +18921,10 @@ class UList3 extends Set {
18920
18921
  }
18921
18922
  }
18922
18923
 
18923
- // ../../node_modules/.pnpm/three@0.180.0/node_modules/three/build/three.core.js
18924
- var REVISION = "180";
18924
+ // ../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.js
18925
+ var REVISION = "182";
18926
+ var PCFShadowMap = 1;
18927
+ var VSMShadowMap = 3;
18925
18928
  var NeverDepth = 0;
18926
18929
  var AlwaysDepth = 1;
18927
18930
  var LessDepth = 2;
@@ -18930,7 +18933,20 @@ var EqualDepth = 4;
18930
18933
  var GreaterEqualDepth = 5;
18931
18934
  var GreaterDepth = 6;
18932
18935
  var NotEqualDepth = 7;
18936
+ var MultiplyOperation = 0;
18937
+ var MixOperation = 1;
18938
+ var AddOperation = 2;
18939
+ var LinearToneMapping = 1;
18940
+ var ReinhardToneMapping = 2;
18941
+ var CineonToneMapping = 3;
18942
+ var ACESFilmicToneMapping = 4;
18943
+ var CustomToneMapping = 5;
18944
+ var AgXToneMapping = 6;
18945
+ var NeutralToneMapping = 7;
18933
18946
  var UVMapping = 300;
18947
+ var CubeReflectionMapping = 301;
18948
+ var CubeRefractionMapping = 302;
18949
+ var CubeUVReflectionMapping = 306;
18934
18950
  var RepeatWrapping = 1000;
18935
18951
  var ClampToEdgeWrapping = 1001;
18936
18952
  var MirroredRepeatWrapping = 1002;
@@ -18951,6 +18967,37 @@ var LinearTransfer = "linear";
18951
18967
  var SRGBTransfer = "srgb";
18952
18968
  var WebGLCoordinateSystem = 2000;
18953
18969
  var WebGPUCoordinateSystem = 2001;
18970
+ function isTypedArray(array) {
18971
+ return ArrayBuffer.isView(array) && !(array instanceof DataView);
18972
+ }
18973
+ function createElementNS(name) {
18974
+ return document.createElementNS("http://www.w3.org/1999/xhtml", name);
18975
+ }
18976
+ var _cache = {};
18977
+ var _setConsoleFunction = null;
18978
+ function warn(...params) {
18979
+ const message = "THREE." + params.shift();
18980
+ if (_setConsoleFunction) {
18981
+ _setConsoleFunction("warn", message, ...params);
18982
+ } else {
18983
+ console.warn(message, ...params);
18984
+ }
18985
+ }
18986
+ function error(...params) {
18987
+ const message = "THREE." + params.shift();
18988
+ if (_setConsoleFunction) {
18989
+ _setConsoleFunction("error", message, ...params);
18990
+ } else {
18991
+ console.error(message, ...params);
18992
+ }
18993
+ }
18994
+ function warnOnce(...params) {
18995
+ const message = params.join(" ");
18996
+ if (message in _cache)
18997
+ return;
18998
+ _cache[message] = true;
18999
+ warn(...params);
19000
+ }
18954
19001
  class EventDispatcher {
18955
19002
  addEventListener(type2, listener) {
18956
19003
  if (this._listeners === undefined)
@@ -19291,15 +19338,15 @@ class Quaternion {
19291
19338
  }
19292
19339
  static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
19293
19340
  let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3];
19294
- const x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3];
19295
- if (t === 0) {
19341
+ let x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3];
19342
+ if (t <= 0) {
19296
19343
  dst[dstOffset + 0] = x0;
19297
19344
  dst[dstOffset + 1] = y0;
19298
19345
  dst[dstOffset + 2] = z0;
19299
19346
  dst[dstOffset + 3] = w0;
19300
19347
  return;
19301
19348
  }
19302
- if (t === 1) {
19349
+ if (t >= 1) {
19303
19350
  dst[dstOffset + 0] = x1;
19304
19351
  dst[dstOffset + 1] = y1;
19305
19352
  dst[dstOffset + 2] = z1;
@@ -19307,19 +19354,29 @@ class Quaternion {
19307
19354
  return;
19308
19355
  }
19309
19356
  if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {
19357
+ let dot = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1;
19358
+ if (dot < 0) {
19359
+ x1 = -x1;
19360
+ y1 = -y1;
19361
+ z1 = -z1;
19362
+ w1 = -w1;
19363
+ dot = -dot;
19364
+ }
19310
19365
  let s = 1 - t;
19311
- const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, dir = cos >= 0 ? 1 : -1, sqrSin = 1 - cos * cos;
19312
- if (sqrSin > Number.EPSILON) {
19313
- const sin = Math.sqrt(sqrSin), len = Math.atan2(sin, cos * dir);
19314
- s = Math.sin(s * len) / sin;
19315
- t = Math.sin(t * len) / sin;
19316
- }
19317
- const tDir = t * dir;
19318
- x0 = x0 * s + x1 * tDir;
19319
- y0 = y0 * s + y1 * tDir;
19320
- z0 = z0 * s + z1 * tDir;
19321
- w0 = w0 * s + w1 * tDir;
19322
- if (s === 1 - t) {
19366
+ if (dot < 0.9995) {
19367
+ const theta = Math.acos(dot);
19368
+ const sin = Math.sin(theta);
19369
+ s = Math.sin(s * theta) / sin;
19370
+ t = Math.sin(t * theta) / sin;
19371
+ x0 = x0 * s + x1 * t;
19372
+ y0 = y0 * s + y1 * t;
19373
+ z0 = z0 * s + z1 * t;
19374
+ w0 = w0 * s + w1 * t;
19375
+ } else {
19376
+ x0 = x0 * s + x1 * t;
19377
+ y0 = y0 * s + y1 * t;
19378
+ z0 = z0 * s + z1 * t;
19379
+ w0 = w0 * s + w1 * t;
19323
19380
  const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);
19324
19381
  x0 *= f;
19325
19382
  y0 *= f;
@@ -19442,7 +19499,7 @@ class Quaternion {
19442
19499
  this._w = c1 * c2 * c3 + s1 * s2 * s3;
19443
19500
  break;
19444
19501
  default:
19445
- console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + order);
19502
+ warn("Quaternion: .setFromEuler() encountered an unknown order: " + order);
19446
19503
  }
19447
19504
  if (update === true)
19448
19505
  this._onChangeCallback();
@@ -19577,46 +19634,37 @@ class Quaternion {
19577
19634
  return this;
19578
19635
  }
19579
19636
  slerp(qb, t) {
19580
- if (t === 0)
19637
+ if (t <= 0)
19581
19638
  return this;
19582
- if (t === 1)
19639
+ if (t >= 1)
19583
19640
  return this.copy(qb);
19584
- const x = this._x, y = this._y, z = this._z, w = this._w;
19585
- let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
19586
- if (cosHalfTheta < 0) {
19587
- this._w = -qb._w;
19588
- this._x = -qb._x;
19589
- this._y = -qb._y;
19590
- this._z = -qb._z;
19591
- cosHalfTheta = -cosHalfTheta;
19641
+ let { _x: x, _y: y, _z: z, _w: w } = qb;
19642
+ let dot = this.dot(qb);
19643
+ if (dot < 0) {
19644
+ x = -x;
19645
+ y = -y;
19646
+ z = -z;
19647
+ w = -w;
19648
+ dot = -dot;
19649
+ }
19650
+ let s = 1 - t;
19651
+ if (dot < 0.9995) {
19652
+ const theta = Math.acos(dot);
19653
+ const sin = Math.sin(theta);
19654
+ s = Math.sin(s * theta) / sin;
19655
+ t = Math.sin(t * theta) / sin;
19656
+ this._x = this._x * s + x * t;
19657
+ this._y = this._y * s + y * t;
19658
+ this._z = this._z * s + z * t;
19659
+ this._w = this._w * s + w * t;
19660
+ this._onChangeCallback();
19592
19661
  } else {
19593
- this.copy(qb);
19594
- }
19595
- if (cosHalfTheta >= 1) {
19596
- this._w = w;
19597
- this._x = x;
19598
- this._y = y;
19599
- this._z = z;
19600
- return this;
19601
- }
19602
- const sqrSinHalfTheta = 1 - cosHalfTheta * cosHalfTheta;
19603
- if (sqrSinHalfTheta <= Number.EPSILON) {
19604
- const s = 1 - t;
19605
- this._w = s * w + t * this._w;
19606
- this._x = s * x + t * this._x;
19607
- this._y = s * y + t * this._y;
19608
- this._z = s * z + t * this._z;
19662
+ this._x = this._x * s + x * t;
19663
+ this._y = this._y * s + y * t;
19664
+ this._z = this._z * s + z * t;
19665
+ this._w = this._w * s + w * t;
19609
19666
  this.normalize();
19610
- return this;
19611
19667
  }
19612
- const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);
19613
- const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);
19614
- const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, ratioB = Math.sin(t * halfTheta) / sinHalfTheta;
19615
- this._w = w * ratioA + this._w * ratioB;
19616
- this._x = x * ratioA + this._x * ratioB;
19617
- this._y = y * ratioA + this._y * ratioB;
19618
- this._z = z * ratioA + this._z * ratioB;
19619
- this._onChangeCallback();
19620
19668
  return this;
19621
19669
  }
19622
19670
  slerpQuaternions(qa, qb, t) {
@@ -20310,16 +20358,6 @@ class Matrix3 {
20310
20358
  }
20311
20359
  }
20312
20360
  var _m3 = /* @__PURE__ */ new Matrix3;
20313
- function createElementNS(name) {
20314
- return document.createElementNS("http://www.w3.org/1999/xhtml", name);
20315
- }
20316
- var _cache = {};
20317
- function warnOnce(message) {
20318
- if (message in _cache)
20319
- return;
20320
- _cache[message] = true;
20321
- console.warn(message);
20322
- }
20323
20361
  var LINEAR_REC709_TO_XYZ = /* @__PURE__ */ new Matrix3().set(0.4123908, 0.3575843, 0.1804808, 0.212639, 0.7151687, 0.0721923, 0.0193308, 0.1191948, 0.9505322);
20324
20362
  var XYZ_TO_LINEAR_REC709 = /* @__PURE__ */ new Matrix3().set(3.2409699, -1.5373832, -0.4986108, -0.9692436, 1.8759675, 0.0415551, 0.0556301, -0.203977, 1.0569715);
20325
20363
  function createColorManagement() {
@@ -20380,11 +20418,11 @@ function createColorManagement() {
20380
20418
  return this.spaces[colorSpace].workingColorSpaceConfig.unpackColorSpace;
20381
20419
  },
20382
20420
  fromWorkingColorSpace: function(color, targetColorSpace) {
20383
- warnOnce("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().");
20421
+ warnOnce("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().");
20384
20422
  return ColorManagement.workingToColorSpace(color, targetColorSpace);
20385
20423
  },
20386
20424
  toWorkingColorSpace: function(color, sourceColorSpace) {
20387
- warnOnce("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().");
20425
+ warnOnce("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().");
20388
20426
  return ColorManagement.colorSpaceToWorking(color, sourceColorSpace);
20389
20427
  }
20390
20428
  };
@@ -20478,7 +20516,7 @@ class ImageUtils {
20478
20516
  height: image.height
20479
20517
  };
20480
20518
  } else {
20481
- console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.");
20519
+ warn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.");
20482
20520
  return image;
20483
20521
  }
20484
20522
  }
@@ -20498,7 +20536,7 @@ class Source {
20498
20536
  const data = this.data;
20499
20537
  if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
20500
20538
  target.set(data.videoWidth, data.videoHeight, 0);
20501
- } else if (data instanceof VideoFrame) {
20539
+ } else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
20502
20540
  target.set(data.displayHeight, data.displayWidth, 0);
20503
20541
  } else if (data !== null) {
20504
20542
  target.set(data.width, data.height, data.depth || 0);
@@ -20555,7 +20593,7 @@ function serializeImage(image) {
20555
20593
  type: image.data.constructor.name
20556
20594
  };
20557
20595
  } else {
20558
- console.warn("THREE.Texture: Unable to serialize Texture.");
20596
+ warn("Texture: Unable to serialize Texture.");
20559
20597
  return {};
20560
20598
  }
20561
20599
  }
@@ -20665,12 +20703,12 @@ class Texture extends EventDispatcher {
20665
20703
  for (const key in values) {
20666
20704
  const newValue = values[key];
20667
20705
  if (newValue === undefined) {
20668
- console.warn(`THREE.Texture.setValues(): parameter '${key}' has value of undefined.`);
20706
+ warn(`Texture.setValues(): parameter '${key}' has value of undefined.`);
20669
20707
  continue;
20670
20708
  }
20671
20709
  const currentValue = this[key];
20672
20710
  if (currentValue === undefined) {
20673
- console.warn(`THREE.Texture.setValues(): property '${key}' does not exist.`);
20711
+ warn(`Texture.setValues(): property '${key}' does not exist.`);
20674
20712
  continue;
20675
20713
  }
20676
20714
  if (currentValue && newValue && (currentValue.isVector2 && newValue.isVector2)) {
@@ -20871,6 +20909,12 @@ class Matrix4 {
20871
20909
  return this;
20872
20910
  }
20873
20911
  extractBasis(xAxis, yAxis, zAxis) {
20912
+ if (this.determinant() === 0) {
20913
+ xAxis.set(1, 0, 0);
20914
+ yAxis.set(0, 1, 0);
20915
+ zAxis.set(0, 0, 1);
20916
+ return this;
20917
+ }
20874
20918
  xAxis.setFromMatrixColumn(this, 0);
20875
20919
  yAxis.setFromMatrixColumn(this, 1);
20876
20920
  zAxis.setFromMatrixColumn(this, 2);
@@ -20881,6 +20925,9 @@ class Matrix4 {
20881
20925
  return this;
20882
20926
  }
20883
20927
  extractRotation(m) {
20928
+ if (m.determinant() === 0) {
20929
+ return this.identity();
20930
+ }
20884
20931
  const te = this.elements;
20885
20932
  const me = m.elements;
20886
20933
  const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length();
@@ -21081,7 +21128,13 @@ class Matrix4 {
21081
21128
  const n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13];
21082
21129
  const n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14];
21083
21130
  const n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15];
21084
- return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);
21131
+ const t11 = n23 * n34 - n24 * n33;
21132
+ const t12 = n22 * n34 - n24 * n32;
21133
+ const t13 = n22 * n33 - n23 * n32;
21134
+ const t21 = n21 * n34 - n24 * n31;
21135
+ const t22 = n21 * n33 - n23 * n31;
21136
+ const t23 = n21 * n32 - n22 * n31;
21137
+ return n11 * (n42 * t11 - n43 * t12 + n44 * t13) - n12 * (n41 * t11 - n43 * t21 + n44 * t22) + n13 * (n41 * t12 - n42 * t21 + n44 * t23) - n14 * (n41 * t13 - n42 * t22 + n43 * t23);
21085
21138
  }
21086
21139
  transpose() {
21087
21140
  const te = this.elements;
@@ -21235,15 +21288,20 @@ class Matrix4 {
21235
21288
  }
21236
21289
  decompose(position, quaternion, scale) {
21237
21290
  const te = this.elements;
21291
+ position.x = te[12];
21292
+ position.y = te[13];
21293
+ position.z = te[14];
21294
+ if (this.determinant() === 0) {
21295
+ scale.set(1, 1, 1);
21296
+ quaternion.identity();
21297
+ return this;
21298
+ }
21238
21299
  let sx = _v1$5.set(te[0], te[1], te[2]).length();
21239
21300
  const sy = _v1$5.set(te[4], te[5], te[6]).length();
21240
21301
  const sz = _v1$5.set(te[8], te[9], te[10]).length();
21241
21302
  const det = this.determinant();
21242
21303
  if (det < 0)
21243
21304
  sx = -sx;
21244
- position.x = te[12];
21245
- position.y = te[13];
21246
- position.z = te[14];
21247
21305
  _m1$2.copy(this);
21248
21306
  const invSX = 1 / sx;
21249
21307
  const invSY = 1 / sy;
@@ -21509,7 +21567,7 @@ class Euler {
21509
21567
  }
21510
21568
  break;
21511
21569
  default:
21512
- console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + order);
21570
+ warn("Euler: .setFromRotationMatrix() encountered an unknown order: " + order);
21513
21571
  }
21514
21572
  this._order = order;
21515
21573
  if (update === true)
@@ -21768,7 +21826,7 @@ class Object3D extends EventDispatcher {
21768
21826
  return this;
21769
21827
  }
21770
21828
  if (object2 === this) {
21771
- console.error("THREE.Object3D.add: object can't be added as a child of itself.", object2);
21829
+ error("Object3D.add: object can't be added as a child of itself.", object2);
21772
21830
  return this;
21773
21831
  }
21774
21832
  if (object2 && object2.isObject3D) {
@@ -21780,7 +21838,7 @@ class Object3D extends EventDispatcher {
21780
21838
  this.dispatchEvent(_childaddedEvent);
21781
21839
  _childaddedEvent.child = null;
21782
21840
  } else {
21783
- console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", object2);
21841
+ error("Object3D.add: object not an instance of THREE.Object3D.", object2);
21784
21842
  }
21785
21843
  return this;
21786
21844
  }
@@ -22396,7 +22454,7 @@ class Color {
22396
22454
  if (string2 === undefined)
22397
22455
  return;
22398
22456
  if (parseFloat(string2) < 1) {
22399
- console.warn("THREE.Color: Alpha component of " + style + " will be ignored.");
22457
+ warn("Color: Alpha component of " + style + " will be ignored.");
22400
22458
  }
22401
22459
  }
22402
22460
  let m;
@@ -22424,7 +22482,7 @@ class Color {
22424
22482
  }
22425
22483
  break;
22426
22484
  default:
22427
- console.warn("THREE.Color: Unknown color model " + style);
22485
+ warn("Color: Unknown color model " + style);
22428
22486
  }
22429
22487
  } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) {
22430
22488
  const hex2 = m[1];
@@ -22434,7 +22492,7 @@ class Color {
22434
22492
  } else if (size === 6) {
22435
22493
  return this.setHex(parseInt(hex2, 16), colorSpace);
22436
22494
  } else {
22437
- console.warn("THREE.Color: Invalid hex color " + style);
22495
+ warn("Color: Invalid hex color " + style);
22438
22496
  }
22439
22497
  } else if (style && style.length > 0) {
22440
22498
  return this.setColorName(style, colorSpace);
@@ -22446,7 +22504,7 @@ class Color {
22446
22504
  if (hex2 !== undefined) {
22447
22505
  this.setHex(hex2, colorSpace);
22448
22506
  } else {
22449
- console.warn("THREE.Color: Unknown color " + style);
22507
+ warn("Color: Unknown color " + style);
22450
22508
  }
22451
22509
  return this;
22452
22510
  }
@@ -22647,7 +22705,7 @@ function cloneUniforms(src) {
22647
22705
  const property = src[u][p];
22648
22706
  if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
22649
22707
  if (property.isRenderTargetTexture) {
22650
- console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
22708
+ warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
22651
22709
  dst[u][p] = null;
22652
22710
  } else {
22653
22711
  dst[u][p] = property.clone();
@@ -22679,9 +22737,6 @@ function convertArray(array, type2) {
22679
22737
  }
22680
22738
  return Array.prototype.slice.call(array);
22681
22739
  }
22682
- function isTypedArray(object2) {
22683
- return ArrayBuffer.isView(object2) && !(object2 instanceof DataView);
22684
- }
22685
22740
  class Interpolant {
22686
22741
  constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
22687
22742
  this.parameterPositions = parameterPositions;
@@ -22933,7 +22988,7 @@ class KeyframeTrack {
22933
22988
  throw new Error(message);
22934
22989
  }
22935
22990
  }
22936
- console.warn("THREE.KeyframeTrack:", message);
22991
+ warn("KeyframeTrack:", message);
22937
22992
  return this;
22938
22993
  }
22939
22994
  this.createInterpolant = factoryMethod;
@@ -22995,24 +23050,24 @@ class KeyframeTrack {
22995
23050
  let valid = true;
22996
23051
  const valueSize = this.getValueSize();
22997
23052
  if (valueSize - Math.floor(valueSize) !== 0) {
22998
- console.error("THREE.KeyframeTrack: Invalid value size in track.", this);
23053
+ error("KeyframeTrack: Invalid value size in track.", this);
22999
23054
  valid = false;
23000
23055
  }
23001
23056
  const times = this.times, values = this.values, nKeys = times.length;
23002
23057
  if (nKeys === 0) {
23003
- console.error("THREE.KeyframeTrack: Track is empty.", this);
23058
+ error("KeyframeTrack: Track is empty.", this);
23004
23059
  valid = false;
23005
23060
  }
23006
23061
  let prevTime = null;
23007
23062
  for (let i = 0;i !== nKeys; i++) {
23008
23063
  const currTime = times[i];
23009
23064
  if (typeof currTime === "number" && isNaN(currTime)) {
23010
- console.error("THREE.KeyframeTrack: Time is not a valid number.", this, i, currTime);
23065
+ error("KeyframeTrack: Time is not a valid number.", this, i, currTime);
23011
23066
  valid = false;
23012
23067
  break;
23013
23068
  }
23014
23069
  if (prevTime !== null && prevTime > currTime) {
23015
- console.error("THREE.KeyframeTrack: Out of order keys.", this, i, currTime, prevTime);
23070
+ error("KeyframeTrack: Out of order keys.", this, i, currTime, prevTime);
23016
23071
  valid = false;
23017
23072
  break;
23018
23073
  }
@@ -23023,7 +23078,7 @@ class KeyframeTrack {
23023
23078
  for (let i = 0, n = values.length;i !== n; ++i) {
23024
23079
  const value3 = values[i];
23025
23080
  if (isNaN(value3)) {
23026
- console.error("THREE.KeyframeTrack: Value is not a valid number.", this, i, value3);
23081
+ error("KeyframeTrack: Value is not a valid number.", this, i, value3);
23027
23082
  valid = false;
23028
23083
  break;
23029
23084
  }
@@ -23173,7 +23228,7 @@ class LoadingManager {
23173
23228
  this.onLoad = onLoad3;
23174
23229
  this.onProgress = onProgress;
23175
23230
  this.onError = onError;
23176
- this.abortController = new AbortController;
23231
+ this._abortController = null;
23177
23232
  this.itemStart = function(url3) {
23178
23233
  itemsTotal++;
23179
23234
  if (isLoading === false) {
@@ -23235,10 +23290,16 @@ class LoadingManager {
23235
23290
  };
23236
23291
  this.abort = function() {
23237
23292
  this.abortController.abort();
23238
- this.abortController = new AbortController;
23293
+ this._abortController = null;
23239
23294
  return this;
23240
23295
  };
23241
23296
  }
23297
+ get abortController() {
23298
+ if (!this._abortController) {
23299
+ this._abortController = new AbortController;
23300
+ }
23301
+ return this._abortController;
23302
+ }
23242
23303
  }
23243
23304
  var DefaultLoadingManager = /* @__PURE__ */ new LoadingManager;
23244
23305
 
@@ -23494,7 +23555,7 @@ class PropertyBinding {
23494
23555
  this.getValue = this._getValue_unavailable;
23495
23556
  this.setValue = this._setValue_unavailable;
23496
23557
  if (!targetObject) {
23497
- console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + ".");
23558
+ warn("PropertyBinding: No target node found for track: " + this.path + ".");
23498
23559
  return;
23499
23560
  }
23500
23561
  if (objectName) {
@@ -23502,18 +23563,18 @@ class PropertyBinding {
23502
23563
  switch (objectName) {
23503
23564
  case "materials":
23504
23565
  if (!targetObject.material) {
23505
- console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
23566
+ error("PropertyBinding: Can not bind to material as node does not have a material.", this);
23506
23567
  return;
23507
23568
  }
23508
23569
  if (!targetObject.material.materials) {
23509
- console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
23570
+ error("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
23510
23571
  return;
23511
23572
  }
23512
23573
  targetObject = targetObject.material.materials;
23513
23574
  break;
23514
23575
  case "bones":
23515
23576
  if (!targetObject.skeleton) {
23516
- console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
23577
+ error("PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
23517
23578
  return;
23518
23579
  }
23519
23580
  targetObject = targetObject.skeleton.bones;
@@ -23530,25 +23591,25 @@ class PropertyBinding {
23530
23591
  break;
23531
23592
  }
23532
23593
  if (!targetObject.material) {
23533
- console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
23594
+ error("PropertyBinding: Can not bind to material as node does not have a material.", this);
23534
23595
  return;
23535
23596
  }
23536
23597
  if (!targetObject.material.map) {
23537
- console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.", this);
23598
+ error("PropertyBinding: Can not bind to material.map as node.material does not have a map.", this);
23538
23599
  return;
23539
23600
  }
23540
23601
  targetObject = targetObject.material.map;
23541
23602
  break;
23542
23603
  default:
23543
23604
  if (targetObject[objectName] === undefined) {
23544
- console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this);
23605
+ error("PropertyBinding: Can not bind to objectName of node undefined.", this);
23545
23606
  return;
23546
23607
  }
23547
23608
  targetObject = targetObject[objectName];
23548
23609
  }
23549
23610
  if (objectIndex !== undefined) {
23550
23611
  if (targetObject[objectIndex] === undefined) {
23551
- console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, targetObject);
23612
+ error("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, targetObject);
23552
23613
  return;
23553
23614
  }
23554
23615
  targetObject = targetObject[objectIndex];
@@ -23557,7 +23618,7 @@ class PropertyBinding {
23557
23618
  const nodeProperty = targetObject[propertyName];
23558
23619
  if (nodeProperty === undefined) {
23559
23620
  const nodeName = parsedPath.nodeName;
23560
- console.error("THREE.PropertyBinding: Trying to update property for track: " + nodeName + "." + propertyName + " but it wasn't found.", targetObject);
23621
+ error("PropertyBinding: Trying to update property for track: " + nodeName + "." + propertyName + " but it wasn't found.", targetObject);
23561
23622
  return;
23562
23623
  }
23563
23624
  let versioning = this.Versioning.None;
@@ -23571,11 +23632,11 @@ class PropertyBinding {
23571
23632
  if (propertyIndex !== undefined) {
23572
23633
  if (propertyName === "morphTargetInfluences") {
23573
23634
  if (!targetObject.geometry) {
23574
- console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
23635
+ error("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
23575
23636
  return;
23576
23637
  }
23577
23638
  if (!targetObject.geometry.morphAttributes) {
23578
- console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
23639
+ error("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
23579
23640
  return;
23580
23641
  }
23581
23642
  if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) {
@@ -23651,13 +23712,13 @@ if (typeof __THREE_DEVTOOLS__ !== "undefined") {
23651
23712
  }
23652
23713
  if (typeof window !== "undefined") {
23653
23714
  if (window.__THREE__) {
23654
- console.warn("WARNING: Multiple instances of Three.js being imported.");
23715
+ warn("WARNING: Multiple instances of Three.js being imported.");
23655
23716
  } else {
23656
23717
  window.__THREE__ = REVISION;
23657
23718
  }
23658
23719
  }
23659
23720
 
23660
- // ../../node_modules/.pnpm/three@0.180.0/node_modules/three/build/three.module.js
23721
+ // ../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.js
23661
23722
  var alphahash_fragment = `#ifdef USE_ALPHAHASH
23662
23723
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
23663
23724
  #endif`;
@@ -24015,13 +24076,6 @@ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
24015
24076
  vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
24016
24077
  return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
24017
24078
  }
24018
- mat3 transposeMat3( const in mat3 m ) {
24019
- mat3 tmp;
24020
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
24021
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
24022
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
24023
- return tmp;
24024
- }
24025
24079
  bool isPerspectiveMatrix( mat4 m ) {
24026
24080
  return m[ 2 ][ 3 ] == - 1.0;
24027
24081
  }
@@ -24232,7 +24286,6 @@ var envmap_common_pars_fragment = `#ifdef USE_ENVMAP
24232
24286
  #else
24233
24287
  uniform sampler2D envMap;
24234
24288
  #endif
24235
-
24236
24289
  #endif`;
24237
24290
  var envmap_pars_fragment = `#ifdef USE_ENVMAP
24238
24291
  uniform float reflectivity;
@@ -24465,7 +24518,7 @@ var envmap_physical_pars_fragment = `#ifdef USE_ENVMAP
24465
24518
  vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
24466
24519
  #ifdef ENVMAP_TYPE_CUBE_UV
24467
24520
  vec3 reflectVec = reflect( - viewDir, normal );
24468
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
24521
+ reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
24469
24522
  reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
24470
24523
  vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
24471
24524
  return envMapColor.rgb * envMapIntensity;
@@ -24525,7 +24578,9 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
24525
24578
  #define RE_Direct RE_Direct_BlinnPhong
24526
24579
  #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`;
24527
24580
  var lights_physical_fragment = `PhysicalMaterial material;
24528
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
24581
+ material.diffuseColor = diffuseColor.rgb;
24582
+ material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
24583
+ material.metalness = metalnessFactor;
24529
24584
  vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
24530
24585
  float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
24531
24586
  material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
@@ -24547,9 +24602,11 @@ material.roughness = min( material.roughness, 1.0 );
24547
24602
  vec3 specularColorFactor = vec3( 1.0 );
24548
24603
  material.specularF90 = 1.0;
24549
24604
  #endif
24550
- material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
24605
+ material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
24606
+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
24551
24607
  #else
24552
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
24608
+ material.specularColor = vec3( 0.04 );
24609
+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
24553
24610
  material.specularF90 = 1.0;
24554
24611
  #endif
24555
24612
  #ifdef USE_CLEARCOAT
@@ -24587,7 +24644,7 @@ material.roughness = min( material.roughness, 1.0 );
24587
24644
  #ifdef USE_SHEEN_COLORMAP
24588
24645
  material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
24589
24646
  #endif
24590
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
24647
+ material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
24591
24648
  #ifdef USE_SHEEN_ROUGHNESSMAP
24592
24649
  material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
24593
24650
  #endif
@@ -24611,10 +24668,14 @@ material.roughness = min( material.roughness, 1.0 );
24611
24668
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
24612
24669
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
24613
24670
  #endif`;
24614
- var lights_physical_pars_fragment = `struct PhysicalMaterial {
24671
+ var lights_physical_pars_fragment = `uniform sampler2D dfgLUT;
24672
+ struct PhysicalMaterial {
24615
24673
  vec3 diffuseColor;
24616
- float roughness;
24674
+ vec3 diffuseContribution;
24617
24675
  vec3 specularColor;
24676
+ vec3 specularColorBlended;
24677
+ float roughness;
24678
+ float metalness;
24618
24679
  float specularF90;
24619
24680
  float dispersion;
24620
24681
  #ifdef USE_CLEARCOAT
@@ -24629,6 +24690,8 @@ var lights_physical_pars_fragment = `struct PhysicalMaterial {
24629
24690
  float iridescenceThickness;
24630
24691
  vec3 iridescenceFresnel;
24631
24692
  vec3 iridescenceF0;
24693
+ vec3 iridescenceFresnelDielectric;
24694
+ vec3 iridescenceFresnelMetallic;
24632
24695
  #endif
24633
24696
  #ifdef USE_SHEEN
24634
24697
  vec3 sheenColor;
@@ -24677,7 +24740,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
24677
24740
  float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
24678
24741
  float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
24679
24742
  float v = 0.5 / ( gv + gl );
24680
- return saturate(v);
24743
+ return v;
24681
24744
  }
24682
24745
  float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
24683
24746
  float a2 = alphaT * alphaB;
@@ -24705,7 +24768,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
24705
24768
  }
24706
24769
  #endif
24707
24770
  vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
24708
- vec3 f0 = material.specularColor;
24771
+ vec3 f0 = material.specularColorBlended;
24709
24772
  float f90 = material.specularF90;
24710
24773
  float roughness = material.roughness;
24711
24774
  float alpha = pow2( roughness );
@@ -24763,7 +24826,7 @@ vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m
24763
24826
  vec3 T1, T2;
24764
24827
  T1 = normalize( V - N * dot( V, N ) );
24765
24828
  T2 = - cross( N, T1 );
24766
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
24829
+ mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
24767
24830
  vec3 coords[ 4 ];
24768
24831
  coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
24769
24832
  coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
@@ -24805,22 +24868,15 @@ vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no
24805
24868
  float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
24806
24869
  float dotNV = saturate( dot( normal, viewDir ) );
24807
24870
  float r2 = roughness * roughness;
24808
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
24809
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
24810
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
24811
- return saturate( DG * RECIPROCAL_PI );
24812
- }
24813
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
24814
- float dotNV = saturate( dot( normal, viewDir ) );
24815
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
24816
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
24817
- vec4 r = roughness * c0 + c1;
24818
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
24819
- vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
24820
- return fab;
24871
+ float rInv = 1.0 / ( roughness + 0.1 );
24872
+ float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
24873
+ float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
24874
+ float DG = exp( a * dotNV + b );
24875
+ return saturate( DG );
24821
24876
  }
24822
24877
  vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
24823
- vec2 fab = DFGApprox( normal, viewDir, roughness );
24878
+ float dotNV = saturate( dot( normal, viewDir ) );
24879
+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
24824
24880
  return specularColor * fab.x + specularF90 * fab.y;
24825
24881
  }
24826
24882
  #ifdef USE_IRIDESCENCE
@@ -24828,7 +24884,8 @@ void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 view
24828
24884
  #else
24829
24885
  void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
24830
24886
  #endif
24831
- vec2 fab = DFGApprox( normal, viewDir, roughness );
24887
+ float dotNV = saturate( dot( normal, viewDir ) );
24888
+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
24832
24889
  #ifdef USE_IRIDESCENCE
24833
24890
  vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
24834
24891
  #else
@@ -24841,6 +24898,24 @@ void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const
24841
24898
  singleScatter += FssEss;
24842
24899
  multiScatter += Fms * Ems;
24843
24900
  }
24901
+ vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
24902
+ vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
24903
+ float dotNL = saturate( dot( normal, lightDir ) );
24904
+ float dotNV = saturate( dot( normal, viewDir ) );
24905
+ vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
24906
+ vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
24907
+ vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
24908
+ vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
24909
+ float Ess_V = dfgV.x + dfgV.y;
24910
+ float Ess_L = dfgL.x + dfgL.y;
24911
+ float Ems_V = 1.0 - Ess_V;
24912
+ float Ems_L = 1.0 - Ess_L;
24913
+ vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
24914
+ vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
24915
+ float compensationFactor = Ems_V * Ems_L;
24916
+ vec3 multiScatter = Fms * compensationFactor;
24917
+ return singleScatter + multiScatter;
24918
+ }
24844
24919
  #if NUM_RECT_AREA_LIGHTS > 0
24845
24920
  void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
24846
24921
  vec3 normal = geometryNormal;
@@ -24863,9 +24938,9 @@ void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const
24863
24938
  vec3( 0, 1, 0 ),
24864
24939
  vec3( t1.z, 0, t1.w )
24865
24940
  );
24866
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
24941
+ vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );
24867
24942
  reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
24868
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
24943
+ reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
24869
24944
  }
24870
24945
  #endif
24871
24946
  void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
@@ -24877,34 +24952,63 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geome
24877
24952
  clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
24878
24953
  #endif
24879
24954
  #ifdef USE_SHEEN
24880
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
24881
- #endif
24882
- reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
24883
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
24955
+
24956
+ sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
24957
+
24958
+ float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
24959
+ float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
24960
+
24961
+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
24962
+
24963
+ irradiance *= sheenEnergyComp;
24964
+
24965
+ #endif
24966
+ reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
24967
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
24884
24968
  }
24885
24969
  void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
24886
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
24970
+ vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
24971
+ #ifdef USE_SHEEN
24972
+ float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
24973
+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
24974
+ diffuse *= sheenEnergyComp;
24975
+ #endif
24976
+ reflectedLight.indirectDiffuse += diffuse;
24887
24977
  }
24888
24978
  void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
24889
24979
  #ifdef USE_CLEARCOAT
24890
24980
  clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
24891
24981
  #endif
24892
24982
  #ifdef USE_SHEEN
24893
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
24894
- #endif
24895
- vec3 singleScattering = vec3( 0.0 );
24896
- vec3 multiScattering = vec3( 0.0 );
24897
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
24983
+ sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
24984
+ #endif
24985
+ vec3 singleScatteringDielectric = vec3( 0.0 );
24986
+ vec3 multiScatteringDielectric = vec3( 0.0 );
24987
+ vec3 singleScatteringMetallic = vec3( 0.0 );
24988
+ vec3 multiScatteringMetallic = vec3( 0.0 );
24898
24989
  #ifdef USE_IRIDESCENCE
24899
- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
24990
+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
24991
+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
24900
24992
  #else
24901
- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
24993
+ computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
24994
+ computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
24995
+ #endif
24996
+ vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
24997
+ vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
24998
+ vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
24999
+ vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
25000
+ vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
25001
+ vec3 indirectSpecular = radiance * singleScattering;
25002
+ indirectSpecular += multiScattering * cosineWeightedIrradiance;
25003
+ vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
25004
+ #ifdef USE_SHEEN
25005
+ float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
25006
+ float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
25007
+ indirectSpecular *= sheenEnergyComp;
25008
+ indirectDiffuse *= sheenEnergyComp;
24902
25009
  #endif
24903
- vec3 totalScattering = singleScattering + multiScattering;
24904
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
24905
- reflectedLight.indirectSpecular += radiance * singleScattering;
24906
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
24907
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
25010
+ reflectedLight.indirectSpecular += indirectSpecular;
25011
+ reflectedLight.indirectDiffuse += indirectDiffuse;
24908
25012
  }
24909
25013
  #define RE_Direct RE_Direct_Physical
24910
25014
  #define RE_Direct_RectArea RE_Direct_RectArea_Physical
@@ -24929,7 +25033,9 @@ vec3 geometryClearcoatNormal = vec3( 0.0 );
24929
25033
  material.iridescence = saturate( material.iridescence );
24930
25034
  }
24931
25035
  if ( material.iridescence > 0.0 ) {
24932
- material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
25036
+ material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
25037
+ material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
25038
+ material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
24933
25039
  material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
24934
25040
  }
24935
25041
  #endif
@@ -24943,7 +25049,7 @@ IncidentLight directLight;
24943
25049
  for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
24944
25050
  pointLight = pointLights[ i ];
24945
25051
  getPointLightInfo( pointLight, geometryPosition, directLight );
24946
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
25052
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
24947
25053
  pointLightShadow = pointLightShadows[ i ];
24948
25054
  directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
24949
25055
  #endif
@@ -25401,7 +25507,11 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25401
25507
  #endif
25402
25508
  #ifdef USE_SHADOWMAP
25403
25509
  #if NUM_DIR_LIGHT_SHADOWS > 0
25404
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
25510
+ #if defined( SHADOWMAP_TYPE_PCF )
25511
+ uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
25512
+ #else
25513
+ uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
25514
+ #endif
25405
25515
  varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
25406
25516
  struct DirectionalLightShadow {
25407
25517
  float shadowIntensity;
@@ -25413,7 +25523,11 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25413
25523
  uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
25414
25524
  #endif
25415
25525
  #if NUM_SPOT_LIGHT_SHADOWS > 0
25416
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
25526
+ #if defined( SHADOWMAP_TYPE_PCF )
25527
+ uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
25528
+ #else
25529
+ uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
25530
+ #endif
25417
25531
  struct SpotLightShadow {
25418
25532
  float shadowIntensity;
25419
25533
  float shadowBias;
@@ -25424,7 +25538,11 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25424
25538
  uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
25425
25539
  #endif
25426
25540
  #if NUM_POINT_LIGHT_SHADOWS > 0
25427
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
25541
+ #if defined( SHADOWMAP_TYPE_PCF )
25542
+ uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
25543
+ #elif defined( SHADOWMAP_TYPE_BASIC )
25544
+ uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
25545
+ #endif
25428
25546
  varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
25429
25547
  struct PointLightShadow {
25430
25548
  float shadowIntensity;
@@ -25437,157 +25555,132 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25437
25555
  };
25438
25556
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
25439
25557
  #endif
25440
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
25441
- float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
25442
- #ifdef USE_REVERSED_DEPTH_BUFFER
25443
- return step( depth, compare );
25444
- #else
25445
- return step( compare, depth );
25446
- #endif
25447
- }
25448
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
25449
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
25450
- }
25451
- float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
25452
- float occlusion = 1.0;
25453
- vec2 distribution = texture2DDistribution( shadow, uv );
25454
- #ifdef USE_REVERSED_DEPTH_BUFFER
25455
- float hard_shadow = step( distribution.x, compare );
25456
- #else
25457
- float hard_shadow = step( compare, distribution.x );
25458
- #endif
25459
- if ( hard_shadow != 1.0 ) {
25460
- float distance = compare - distribution.x;
25461
- float variance = max( 0.00000, distribution.y * distribution.y );
25462
- float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
25558
+ #if defined( SHADOWMAP_TYPE_PCF )
25559
+ float interleavedGradientNoise( vec2 position ) {
25560
+ return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
25463
25561
  }
25464
- return occlusion;
25465
- }
25466
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
25562
+ vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
25563
+ const float goldenAngle = 2.399963229728653;
25564
+ float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
25565
+ float theta = float( sampleIndex ) * goldenAngle + phi;
25566
+ return vec2( cos( theta ), sin( theta ) ) * r;
25567
+ }
25568
+ #endif
25569
+ #if defined( SHADOWMAP_TYPE_PCF )
25570
+ float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
25571
+ float shadow = 1.0;
25572
+ shadowCoord.xyz /= shadowCoord.w;
25573
+ shadowCoord.z += shadowBias;
25574
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
25575
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
25576
+ if ( frustumTest ) {
25577
+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
25578
+ float radius = shadowRadius * texelSize.x;
25579
+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
25580
+ shadow = (
25581
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
25582
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
25583
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
25584
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
25585
+ texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
25586
+ ) * 0.2;
25587
+ }
25588
+ return mix( 1.0, shadow, shadowIntensity );
25589
+ }
25590
+ #elif defined( SHADOWMAP_TYPE_VSM )
25591
+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
25592
+ float shadow = 1.0;
25593
+ shadowCoord.xyz /= shadowCoord.w;
25594
+ shadowCoord.z += shadowBias;
25595
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
25596
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
25597
+ if ( frustumTest ) {
25598
+ vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
25599
+ float mean = distribution.x;
25600
+ float variance = distribution.y * distribution.y;
25601
+ #ifdef USE_REVERSED_DEPTH_BUFFER
25602
+ float hard_shadow = step( mean, shadowCoord.z );
25603
+ #else
25604
+ float hard_shadow = step( shadowCoord.z, mean );
25605
+ #endif
25606
+ if ( hard_shadow == 1.0 ) {
25607
+ shadow = 1.0;
25608
+ } else {
25609
+ variance = max( variance, 0.0000001 );
25610
+ float d = shadowCoord.z - mean;
25611
+ float p_max = variance / ( variance + d * d );
25612
+ p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
25613
+ shadow = max( hard_shadow, p_max );
25614
+ }
25615
+ }
25616
+ return mix( 1.0, shadow, shadowIntensity );
25617
+ }
25618
+ #else
25619
+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
25620
+ float shadow = 1.0;
25621
+ shadowCoord.xyz /= shadowCoord.w;
25622
+ shadowCoord.z += shadowBias;
25623
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
25624
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
25625
+ if ( frustumTest ) {
25626
+ float depth = texture2D( shadowMap, shadowCoord.xy ).r;
25627
+ #ifdef USE_REVERSED_DEPTH_BUFFER
25628
+ shadow = step( depth, shadowCoord.z );
25629
+ #else
25630
+ shadow = step( shadowCoord.z, depth );
25631
+ #endif
25632
+ }
25633
+ return mix( 1.0, shadow, shadowIntensity );
25634
+ }
25635
+ #endif
25636
+ #if NUM_POINT_LIGHT_SHADOWS > 0
25637
+ #if defined( SHADOWMAP_TYPE_PCF )
25638
+ float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
25467
25639
  float shadow = 1.0;
25468
- shadowCoord.xyz /= shadowCoord.w;
25469
- shadowCoord.z += shadowBias;
25470
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
25471
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
25472
- if ( frustumTest ) {
25473
- #if defined( SHADOWMAP_TYPE_PCF )
25474
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
25475
- float dx0 = - texelSize.x * shadowRadius;
25476
- float dy0 = - texelSize.y * shadowRadius;
25477
- float dx1 = + texelSize.x * shadowRadius;
25478
- float dy1 = + texelSize.y * shadowRadius;
25479
- float dx2 = dx0 / 2.0;
25480
- float dy2 = dy0 / 2.0;
25481
- float dx3 = dx1 / 2.0;
25482
- float dy3 = dy1 / 2.0;
25483
- shadow = (
25484
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
25485
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
25486
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
25487
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
25488
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
25489
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
25490
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
25491
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
25492
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
25493
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
25494
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
25495
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
25496
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
25497
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
25498
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
25499
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
25500
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
25501
- ) * ( 1.0 / 17.0 );
25502
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
25503
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
25504
- float dx = texelSize.x;
25505
- float dy = texelSize.y;
25506
- vec2 uv = shadowCoord.xy;
25507
- vec2 f = fract( uv * shadowMapSize + 0.5 );
25508
- uv -= f * texelSize;
25640
+ vec3 lightToPosition = shadowCoord.xyz;
25641
+ vec3 bd3D = normalize( lightToPosition );
25642
+ vec3 absVec = abs( lightToPosition );
25643
+ float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
25644
+ if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
25645
+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
25646
+ dp += shadowBias;
25647
+ float texelSize = shadowRadius / shadowMapSize.x;
25648
+ vec3 absDir = abs( bd3D );
25649
+ vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
25650
+ tangent = normalize( cross( bd3D, tangent ) );
25651
+ vec3 bitangent = cross( bd3D, tangent );
25652
+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
25509
25653
  shadow = (
25510
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
25511
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
25512
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
25513
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
25514
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
25515
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
25516
- f.x ) +
25517
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
25518
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
25519
- f.x ) +
25520
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
25521
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
25522
- f.y ) +
25523
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
25524
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
25525
- f.y ) +
25526
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
25527
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
25528
- f.x ),
25529
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
25530
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
25531
- f.x ),
25532
- f.y )
25533
- ) * ( 1.0 / 9.0 );
25534
- #elif defined( SHADOWMAP_TYPE_VSM )
25535
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
25536
- #else
25537
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
25538
- #endif
25654
+ texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +
25655
+ texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +
25656
+ texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +
25657
+ texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +
25658
+ texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )
25659
+ ) * 0.2;
25539
25660
  }
25540
25661
  return mix( 1.0, shadow, shadowIntensity );
25541
25662
  }
25542
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
25543
- vec3 absV = abs( v );
25544
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
25545
- absV *= scaleToCube;
25546
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
25547
- vec2 planar = v.xy;
25548
- float almostATexel = 1.5 * texelSizeY;
25549
- float almostOne = 1.0 - almostATexel;
25550
- if ( absV.z >= almostOne ) {
25551
- if ( v.z > 0.0 )
25552
- planar.x = 4.0 - v.x;
25553
- } else if ( absV.x >= almostOne ) {
25554
- float signX = sign( v.x );
25555
- planar.x = v.z * signX + 2.0 * signX;
25556
- } else if ( absV.y >= almostOne ) {
25557
- float signY = sign( v.y );
25558
- planar.x = v.x + 2.0 * signY + 2.0;
25559
- planar.y = v.z * signY - 2.0;
25560
- }
25561
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
25562
- }
25563
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
25663
+ #elif defined( SHADOWMAP_TYPE_BASIC )
25664
+ float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
25564
25665
  float shadow = 1.0;
25565
25666
  vec3 lightToPosition = shadowCoord.xyz;
25566
-
25567
- float lightToPositionLength = length( lightToPosition );
25568
- if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
25569
- float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
25570
- vec3 bd3D = normalize( lightToPosition );
25571
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
25572
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
25573
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
25574
- shadow = (
25575
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
25576
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
25577
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
25578
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
25579
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
25580
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
25581
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
25582
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
25583
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
25584
- ) * ( 1.0 / 9.0 );
25667
+ vec3 bd3D = normalize( lightToPosition );
25668
+ vec3 absVec = abs( lightToPosition );
25669
+ float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
25670
+ if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
25671
+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
25672
+ dp += shadowBias;
25673
+ float depth = textureCube( shadowMap, bd3D ).r;
25674
+ #ifdef USE_REVERSED_DEPTH_BUFFER
25675
+ shadow = step( depth, dp );
25585
25676
  #else
25586
- shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
25677
+ shadow = step( dp, depth );
25587
25678
  #endif
25588
25679
  }
25589
25680
  return mix( 1.0, shadow, shadowIntensity );
25590
25681
  }
25682
+ #endif
25683
+ #endif
25591
25684
  #endif`;
25592
25685
  var shadowmap_pars_vertex = `#if NUM_SPOT_LIGHT_COORDS > 0
25593
25686
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
@@ -25685,7 +25778,7 @@ var shadowmask_pars_fragment = `float getShadowMask() {
25685
25778
  }
25686
25779
  #pragma unroll_loop_end
25687
25780
  #endif
25688
- #if NUM_POINT_LIGHT_SHADOWS > 0
25781
+ #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
25689
25782
  PointLightShadow pointLight;
25690
25783
  #pragma unroll_loop_start
25691
25784
  for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
@@ -25867,7 +25960,7 @@ var transmission_fragment = `#ifdef USE_TRANSMISSION
25867
25960
  vec3 v = normalize( cameraPosition - pos );
25868
25961
  vec3 n = inverseTransformDirection( normal, viewMatrix );
25869
25962
  vec4 transmitted = getIBLVolumeRefraction(
25870
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
25963
+ n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
25871
25964
  pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
25872
25965
  material.attenuationColor, material.attenuationDistance );
25873
25966
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
@@ -26419,7 +26512,6 @@ uniform float nearDistance;
26419
26512
  uniform float farDistance;
26420
26513
  varying vec3 vWorldPosition;
26421
26514
  #include <common>
26422
- #include <packing>
26423
26515
  #include <uv_pars_fragment>
26424
26516
  #include <map_pars_fragment>
26425
26517
  #include <alphamap_pars_fragment>
@@ -26436,7 +26528,7 @@ void main () {
26436
26528
  float dist = length( vWorldPosition - referencePosition );
26437
26529
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
26438
26530
  dist = saturate( dist );
26439
- gl_FragColor = packDepthToRGBA( dist );
26531
+ gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
26440
26532
  }`;
26441
26533
  var vertex$c = `varying vec3 vWorldDirection;
26442
26534
  #include <common>
@@ -26634,7 +26726,6 @@ uniform vec3 diffuse;
26634
26726
  uniform vec3 emissive;
26635
26727
  uniform float opacity;
26636
26728
  #include <common>
26637
- #include <packing>
26638
26729
  #include <dithering_pars_fragment>
26639
26730
  #include <color_pars_fragment>
26640
26731
  #include <uv_pars_fragment>
@@ -26808,7 +26899,6 @@ uniform float opacity;
26808
26899
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
26809
26900
  varying vec3 vViewPosition;
26810
26901
  #endif
26811
- #include <packing>
26812
26902
  #include <uv_pars_fragment>
26813
26903
  #include <normal_pars_fragment>
26814
26904
  #include <bumpmap_pars_fragment>
@@ -26821,7 +26911,7 @@ void main() {
26821
26911
  #include <logdepthbuf_fragment>
26822
26912
  #include <normal_fragment_begin>
26823
26913
  #include <normal_fragment_maps>
26824
- gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
26914
+ gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
26825
26915
  #ifdef OPAQUE
26826
26916
  gl_FragColor.a = 1.0;
26827
26917
  #endif
@@ -26873,7 +26963,6 @@ uniform vec3 specular;
26873
26963
  uniform float shininess;
26874
26964
  uniform float opacity;
26875
26965
  #include <common>
26876
- #include <packing>
26877
26966
  #include <dithering_pars_fragment>
26878
26967
  #include <color_pars_fragment>
26879
26968
  #include <uv_pars_fragment>
@@ -27024,7 +27113,6 @@ uniform float opacity;
27024
27113
  #endif
27025
27114
  varying vec3 vViewPosition;
27026
27115
  #include <common>
27027
- #include <packing>
27028
27116
  #include <dithering_pars_fragment>
27029
27117
  #include <color_pars_fragment>
27030
27118
  #include <uv_pars_fragment>
@@ -27081,9 +27169,10 @@ void main() {
27081
27169
  #include <transmission_fragment>
27082
27170
  vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
27083
27171
  #ifdef USE_SHEEN
27084
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
27085
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
27086
- #endif
27172
+
27173
+ outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
27174
+
27175
+ #endif
27087
27176
  #ifdef USE_CLEARCOAT
27088
27177
  float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
27089
27178
  vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
@@ -27139,7 +27228,6 @@ uniform vec3 diffuse;
27139
27228
  uniform vec3 emissive;
27140
27229
  uniform float opacity;
27141
27230
  #include <common>
27142
- #include <packing>
27143
27231
  #include <dithering_pars_fragment>
27144
27232
  #include <color_pars_fragment>
27145
27233
  #include <uv_pars_fragment>
@@ -27273,7 +27361,6 @@ void main() {
27273
27361
  var fragment$2 = `uniform vec3 color;
27274
27362
  uniform float opacity;
27275
27363
  #include <common>
27276
- #include <packing>
27277
27364
  #include <fog_pars_fragment>
27278
27365
  #include <bsdfs>
27279
27366
  #include <lights_pars_begin>
@@ -27454,8 +27541,8 @@ var ShaderChunk = {
27454
27541
  cube_frag: fragment$f,
27455
27542
  depth_vert: vertex$e,
27456
27543
  depth_frag: fragment$e,
27457
- distanceRGBA_vert: vertex$d,
27458
- distanceRGBA_frag: fragment$d,
27544
+ distance_vert: vertex$d,
27545
+ distance_frag: fragment$d,
27459
27546
  equirect_vert: vertex$c,
27460
27547
  equirect_frag: fragment$c,
27461
27548
  linedashed_vert: vertex$b,
@@ -27501,7 +27588,8 @@ var UniformsLib = {
27501
27588
  flipEnvMap: { value: -1 },
27502
27589
  reflectivity: { value: 1 },
27503
27590
  ior: { value: 1.5 },
27504
- refractionRatio: { value: 0.98 }
27591
+ refractionRatio: { value: 0.98 },
27592
+ dfgLUT: { value: null }
27505
27593
  },
27506
27594
  aomap: {
27507
27595
  aoMap: { value: null },
@@ -27837,7 +27925,7 @@ var ShaderLib = {
27837
27925
  vertexShader: ShaderChunk.equirect_vert,
27838
27926
  fragmentShader: ShaderChunk.equirect_frag
27839
27927
  },
27840
- distanceRGBA: {
27928
+ distance: {
27841
27929
  uniforms: /* @__PURE__ */ mergeUniforms([
27842
27930
  UniformsLib.common,
27843
27931
  UniformsLib.displacementmap,
@@ -27847,8 +27935,8 @@ var ShaderLib = {
27847
27935
  farDistance: { value: 1000 }
27848
27936
  }
27849
27937
  ]),
27850
- vertexShader: ShaderChunk.distanceRGBA_vert,
27851
- fragmentShader: ShaderChunk.distanceRGBA_frag
27938
+ vertexShader: ShaderChunk.distance_vert,
27939
+ fragmentShader: ShaderChunk.distance_frag
27852
27940
  },
27853
27941
  shadow: {
27854
27942
  uniforms: /* @__PURE__ */ mergeUniforms([
@@ -27916,24 +28004,45 @@ ShaderLib.physical = {
27916
28004
  vertexShader: ShaderChunk.meshphysical_vert,
27917
28005
  fragmentShader: ShaderChunk.meshphysical_frag
27918
28006
  };
27919
- var PHI = (1 + Math.sqrt(5)) / 2;
27920
- var INV_PHI = 1 / PHI;
27921
- var _axisDirections = [
27922
- /* @__PURE__ */ new Vector3(-PHI, INV_PHI, 0),
27923
- /* @__PURE__ */ new Vector3(PHI, INV_PHI, 0),
27924
- /* @__PURE__ */ new Vector3(-INV_PHI, 0, PHI),
27925
- /* @__PURE__ */ new Vector3(INV_PHI, 0, PHI),
27926
- /* @__PURE__ */ new Vector3(0, PHI, -INV_PHI),
27927
- /* @__PURE__ */ new Vector3(0, PHI, INV_PHI),
27928
- /* @__PURE__ */ new Vector3(-1, 1, -1),
27929
- /* @__PURE__ */ new Vector3(1, 1, -1),
27930
- /* @__PURE__ */ new Vector3(-1, 1, 1),
27931
- /* @__PURE__ */ new Vector3(1, 1, 1)
27932
- ];
28007
+ var toneMappingMap = {
28008
+ [LinearToneMapping]: "LINEAR_TONE_MAPPING",
28009
+ [ReinhardToneMapping]: "REINHARD_TONE_MAPPING",
28010
+ [CineonToneMapping]: "CINEON_TONE_MAPPING",
28011
+ [ACESFilmicToneMapping]: "ACES_FILMIC_TONE_MAPPING",
28012
+ [AgXToneMapping]: "AGX_TONE_MAPPING",
28013
+ [NeutralToneMapping]: "NEUTRAL_TONE_MAPPING",
28014
+ [CustomToneMapping]: "CUSTOM_TONE_MAPPING"
28015
+ };
27933
28016
  var mat4array = new Float32Array(16);
27934
28017
  var mat3array = new Float32Array(9);
27935
28018
  var mat2array = new Float32Array(4);
28019
+ var toneMappingFunctions = {
28020
+ [LinearToneMapping]: "Linear",
28021
+ [ReinhardToneMapping]: "Reinhard",
28022
+ [CineonToneMapping]: "Cineon",
28023
+ [ACESFilmicToneMapping]: "ACESFilmic",
28024
+ [AgXToneMapping]: "AgX",
28025
+ [NeutralToneMapping]: "Neutral",
28026
+ [CustomToneMapping]: "Custom"
28027
+ };
27936
28028
  var shaderChunkMap = new Map;
28029
+ var shadowMapTypeDefines = {
28030
+ [PCFShadowMap]: "SHADOWMAP_TYPE_PCF",
28031
+ [VSMShadowMap]: "SHADOWMAP_TYPE_VSM"
28032
+ };
28033
+ var envMapTypeDefines = {
28034
+ [CubeReflectionMapping]: "ENVMAP_TYPE_CUBE",
28035
+ [CubeRefractionMapping]: "ENVMAP_TYPE_CUBE",
28036
+ [CubeUVReflectionMapping]: "ENVMAP_TYPE_CUBE_UV"
28037
+ };
28038
+ var envMapModeDefines = {
28039
+ [CubeRefractionMapping]: "ENVMAP_MODE_REFRACTION"
28040
+ };
28041
+ var envMapBlendingDefines = {
28042
+ [MultiplyOperation]: "ENVMAP_BLENDING_MULTIPLY",
28043
+ [MixOperation]: "ENVMAP_BLENDING_MIX",
28044
+ [AddOperation]: "ENVMAP_BLENDING_ADD"
28045
+ };
27937
28046
  var reversedFuncs = {
27938
28047
  [NeverDepth]: AlwaysDepth,
27939
28048
  [LessDepth]: GreaterDepth,
@@ -27944,6 +28053,520 @@ var reversedFuncs = {
27944
28053
  [NotEqualDepth]: EqualDepth,
27945
28054
  [GreaterEqualDepth]: LessEqualDepth
27946
28055
  };
28056
+ var DATA = new Uint16Array([
28057
+ 12469,
28058
+ 15057,
28059
+ 12620,
28060
+ 14925,
28061
+ 13266,
28062
+ 14620,
28063
+ 13807,
28064
+ 14376,
28065
+ 14323,
28066
+ 13990,
28067
+ 14545,
28068
+ 13625,
28069
+ 14713,
28070
+ 13328,
28071
+ 14840,
28072
+ 12882,
28073
+ 14931,
28074
+ 12528,
28075
+ 14996,
28076
+ 12233,
28077
+ 15039,
28078
+ 11829,
28079
+ 15066,
28080
+ 11525,
28081
+ 15080,
28082
+ 11295,
28083
+ 15085,
28084
+ 10976,
28085
+ 15082,
28086
+ 10705,
28087
+ 15073,
28088
+ 10495,
28089
+ 13880,
28090
+ 14564,
28091
+ 13898,
28092
+ 14542,
28093
+ 13977,
28094
+ 14430,
28095
+ 14158,
28096
+ 14124,
28097
+ 14393,
28098
+ 13732,
28099
+ 14556,
28100
+ 13410,
28101
+ 14702,
28102
+ 12996,
28103
+ 14814,
28104
+ 12596,
28105
+ 14891,
28106
+ 12291,
28107
+ 14937,
28108
+ 11834,
28109
+ 14957,
28110
+ 11489,
28111
+ 14958,
28112
+ 11194,
28113
+ 14943,
28114
+ 10803,
28115
+ 14921,
28116
+ 10506,
28117
+ 14893,
28118
+ 10278,
28119
+ 14858,
28120
+ 9960,
28121
+ 14484,
28122
+ 14039,
28123
+ 14487,
28124
+ 14025,
28125
+ 14499,
28126
+ 13941,
28127
+ 14524,
28128
+ 13740,
28129
+ 14574,
28130
+ 13468,
28131
+ 14654,
28132
+ 13106,
28133
+ 14743,
28134
+ 12678,
28135
+ 14818,
28136
+ 12344,
28137
+ 14867,
28138
+ 11893,
28139
+ 14889,
28140
+ 11509,
28141
+ 14893,
28142
+ 11180,
28143
+ 14881,
28144
+ 10751,
28145
+ 14852,
28146
+ 10428,
28147
+ 14812,
28148
+ 10128,
28149
+ 14765,
28150
+ 9754,
28151
+ 14712,
28152
+ 9466,
28153
+ 14764,
28154
+ 13480,
28155
+ 14764,
28156
+ 13475,
28157
+ 14766,
28158
+ 13440,
28159
+ 14766,
28160
+ 13347,
28161
+ 14769,
28162
+ 13070,
28163
+ 14786,
28164
+ 12713,
28165
+ 14816,
28166
+ 12387,
28167
+ 14844,
28168
+ 11957,
28169
+ 14860,
28170
+ 11549,
28171
+ 14868,
28172
+ 11215,
28173
+ 14855,
28174
+ 10751,
28175
+ 14825,
28176
+ 10403,
28177
+ 14782,
28178
+ 10044,
28179
+ 14729,
28180
+ 9651,
28181
+ 14666,
28182
+ 9352,
28183
+ 14599,
28184
+ 9029,
28185
+ 14967,
28186
+ 12835,
28187
+ 14966,
28188
+ 12831,
28189
+ 14963,
28190
+ 12804,
28191
+ 14954,
28192
+ 12723,
28193
+ 14936,
28194
+ 12564,
28195
+ 14917,
28196
+ 12347,
28197
+ 14900,
28198
+ 11958,
28199
+ 14886,
28200
+ 11569,
28201
+ 14878,
28202
+ 11247,
28203
+ 14859,
28204
+ 10765,
28205
+ 14828,
28206
+ 10401,
28207
+ 14784,
28208
+ 10011,
28209
+ 14727,
28210
+ 9600,
28211
+ 14660,
28212
+ 9289,
28213
+ 14586,
28214
+ 8893,
28215
+ 14508,
28216
+ 8533,
28217
+ 15111,
28218
+ 12234,
28219
+ 15110,
28220
+ 12234,
28221
+ 15104,
28222
+ 12216,
28223
+ 15092,
28224
+ 12156,
28225
+ 15067,
28226
+ 12010,
28227
+ 15028,
28228
+ 11776,
28229
+ 14981,
28230
+ 11500,
28231
+ 14942,
28232
+ 11205,
28233
+ 14902,
28234
+ 10752,
28235
+ 14861,
28236
+ 10393,
28237
+ 14812,
28238
+ 9991,
28239
+ 14752,
28240
+ 9570,
28241
+ 14682,
28242
+ 9252,
28243
+ 14603,
28244
+ 8808,
28245
+ 14519,
28246
+ 8445,
28247
+ 14431,
28248
+ 8145,
28249
+ 15209,
28250
+ 11449,
28251
+ 15208,
28252
+ 11451,
28253
+ 15202,
28254
+ 11451,
28255
+ 15190,
28256
+ 11438,
28257
+ 15163,
28258
+ 11384,
28259
+ 15117,
28260
+ 11274,
28261
+ 15055,
28262
+ 10979,
28263
+ 14994,
28264
+ 10648,
28265
+ 14932,
28266
+ 10343,
28267
+ 14871,
28268
+ 9936,
28269
+ 14803,
28270
+ 9532,
28271
+ 14729,
28272
+ 9218,
28273
+ 14645,
28274
+ 8742,
28275
+ 14556,
28276
+ 8381,
28277
+ 14461,
28278
+ 8020,
28279
+ 14365,
28280
+ 7603,
28281
+ 15273,
28282
+ 10603,
28283
+ 15272,
28284
+ 10607,
28285
+ 15267,
28286
+ 10619,
28287
+ 15256,
28288
+ 10631,
28289
+ 15231,
28290
+ 10614,
28291
+ 15182,
28292
+ 10535,
28293
+ 15118,
28294
+ 10389,
28295
+ 15042,
28296
+ 10167,
28297
+ 14963,
28298
+ 9787,
28299
+ 14883,
28300
+ 9447,
28301
+ 14800,
28302
+ 9115,
28303
+ 14710,
28304
+ 8665,
28305
+ 14615,
28306
+ 8318,
28307
+ 14514,
28308
+ 7911,
28309
+ 14411,
28310
+ 7507,
28311
+ 14279,
28312
+ 7198,
28313
+ 15314,
28314
+ 9675,
28315
+ 15313,
28316
+ 9683,
28317
+ 15309,
28318
+ 9712,
28319
+ 15298,
28320
+ 9759,
28321
+ 15277,
28322
+ 9797,
28323
+ 15229,
28324
+ 9773,
28325
+ 15166,
28326
+ 9668,
28327
+ 15084,
28328
+ 9487,
28329
+ 14995,
28330
+ 9274,
28331
+ 14898,
28332
+ 8910,
28333
+ 14800,
28334
+ 8539,
28335
+ 14697,
28336
+ 8234,
28337
+ 14590,
28338
+ 7790,
28339
+ 14479,
28340
+ 7409,
28341
+ 14367,
28342
+ 7067,
28343
+ 14178,
28344
+ 6621,
28345
+ 15337,
28346
+ 8619,
28347
+ 15337,
28348
+ 8631,
28349
+ 15333,
28350
+ 8677,
28351
+ 15325,
28352
+ 8769,
28353
+ 15305,
28354
+ 8871,
28355
+ 15264,
28356
+ 8940,
28357
+ 15202,
28358
+ 8909,
28359
+ 15119,
28360
+ 8775,
28361
+ 15022,
28362
+ 8565,
28363
+ 14916,
28364
+ 8328,
28365
+ 14804,
28366
+ 8009,
28367
+ 14688,
28368
+ 7614,
28369
+ 14569,
28370
+ 7287,
28371
+ 14448,
28372
+ 6888,
28373
+ 14321,
28374
+ 6483,
28375
+ 14088,
28376
+ 6171,
28377
+ 15350,
28378
+ 7402,
28379
+ 15350,
28380
+ 7419,
28381
+ 15347,
28382
+ 7480,
28383
+ 15340,
28384
+ 7613,
28385
+ 15322,
28386
+ 7804,
28387
+ 15287,
28388
+ 7973,
28389
+ 15229,
28390
+ 8057,
28391
+ 15148,
28392
+ 8012,
28393
+ 15046,
28394
+ 7846,
28395
+ 14933,
28396
+ 7611,
28397
+ 14810,
28398
+ 7357,
28399
+ 14682,
28400
+ 7069,
28401
+ 14552,
28402
+ 6656,
28403
+ 14421,
28404
+ 6316,
28405
+ 14251,
28406
+ 5948,
28407
+ 14007,
28408
+ 5528,
28409
+ 15356,
28410
+ 5942,
28411
+ 15356,
28412
+ 5977,
28413
+ 15353,
28414
+ 6119,
28415
+ 15348,
28416
+ 6294,
28417
+ 15332,
28418
+ 6551,
28419
+ 15302,
28420
+ 6824,
28421
+ 15249,
28422
+ 7044,
28423
+ 15171,
28424
+ 7122,
28425
+ 15070,
28426
+ 7050,
28427
+ 14949,
28428
+ 6861,
28429
+ 14818,
28430
+ 6611,
28431
+ 14679,
28432
+ 6349,
28433
+ 14538,
28434
+ 6067,
28435
+ 14398,
28436
+ 5651,
28437
+ 14189,
28438
+ 5311,
28439
+ 13935,
28440
+ 4958,
28441
+ 15359,
28442
+ 4123,
28443
+ 15359,
28444
+ 4153,
28445
+ 15356,
28446
+ 4296,
28447
+ 15353,
28448
+ 4646,
28449
+ 15338,
28450
+ 5160,
28451
+ 15311,
28452
+ 5508,
28453
+ 15263,
28454
+ 5829,
28455
+ 15188,
28456
+ 6042,
28457
+ 15088,
28458
+ 6094,
28459
+ 14966,
28460
+ 6001,
28461
+ 14826,
28462
+ 5796,
28463
+ 14678,
28464
+ 5543,
28465
+ 14527,
28466
+ 5287,
28467
+ 14377,
28468
+ 4985,
28469
+ 14133,
28470
+ 4586,
28471
+ 13869,
28472
+ 4257,
28473
+ 15360,
28474
+ 1563,
28475
+ 15360,
28476
+ 1642,
28477
+ 15358,
28478
+ 2076,
28479
+ 15354,
28480
+ 2636,
28481
+ 15341,
28482
+ 3350,
28483
+ 15317,
28484
+ 4019,
28485
+ 15273,
28486
+ 4429,
28487
+ 15203,
28488
+ 4732,
28489
+ 15105,
28490
+ 4911,
28491
+ 14981,
28492
+ 4932,
28493
+ 14836,
28494
+ 4818,
28495
+ 14679,
28496
+ 4621,
28497
+ 14517,
28498
+ 4386,
28499
+ 14359,
28500
+ 4156,
28501
+ 14083,
28502
+ 3795,
28503
+ 13808,
28504
+ 3437,
28505
+ 15360,
28506
+ 122,
28507
+ 15360,
28508
+ 137,
28509
+ 15358,
28510
+ 285,
28511
+ 15355,
28512
+ 636,
28513
+ 15344,
28514
+ 1274,
28515
+ 15322,
28516
+ 2177,
28517
+ 15281,
28518
+ 2765,
28519
+ 15215,
28520
+ 3223,
28521
+ 15120,
28522
+ 3451,
28523
+ 14995,
28524
+ 3569,
28525
+ 14846,
28526
+ 3567,
28527
+ 14681,
28528
+ 3466,
28529
+ 14511,
28530
+ 3305,
28531
+ 14344,
28532
+ 3121,
28533
+ 14037,
28534
+ 2800,
28535
+ 13753,
28536
+ 2467,
28537
+ 15360,
28538
+ 0,
28539
+ 15360,
28540
+ 1,
28541
+ 15359,
28542
+ 21,
28543
+ 15355,
28544
+ 89,
28545
+ 15346,
28546
+ 253,
28547
+ 15325,
28548
+ 479,
28549
+ 15287,
28550
+ 796,
28551
+ 15225,
28552
+ 1148,
28553
+ 15133,
28554
+ 1492,
28555
+ 15008,
28556
+ 1749,
28557
+ 14856,
28558
+ 1882,
28559
+ 14685,
28560
+ 1886,
28561
+ 14506,
28562
+ 1783,
28563
+ 14324,
28564
+ 1608,
28565
+ 13996,
28566
+ 1398,
28567
+ 13702,
28568
+ 1183
28569
+ ]);
27947
28570
 
27948
28571
  // src/library/bug-rangers-game-state.ts
27949
28572
  var dragStateAtom = atom2({