tempest.games 0.3.0 → 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,9 +15298,10 @@ var init_env = __esm(() => {
15297
15298
  },
15298
15299
  clientPrefix: `VITE_`,
15299
15300
  client: {
15301
+ VITE_HIDE_DEVTOOLS: requiredBool,
15300
15302
  VITE_BACKEND_ORIGIN: str,
15301
15303
  VITE_DEV_FRONTEND_HOST: type(`string | undefined`),
15302
- VITE_DEV_HTTPS: maybeBool.pipe((s) => s === `true`)
15304
+ VITE_DEV_HTTPS: optionalBool
15303
15305
  },
15304
15306
  runtimeEnv: import.meta.env,
15305
15307
  emptyStringAsUndefined: true
@@ -18919,8 +18921,10 @@ class UList3 extends Set {
18919
18921
  }
18920
18922
  }
18921
18923
 
18922
- // ../../node_modules/.pnpm/three@0.180.0/node_modules/three/build/three.core.js
18923
- 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;
18924
18928
  var NeverDepth = 0;
18925
18929
  var AlwaysDepth = 1;
18926
18930
  var LessDepth = 2;
@@ -18929,7 +18933,20 @@ var EqualDepth = 4;
18929
18933
  var GreaterEqualDepth = 5;
18930
18934
  var GreaterDepth = 6;
18931
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;
18932
18946
  var UVMapping = 300;
18947
+ var CubeReflectionMapping = 301;
18948
+ var CubeRefractionMapping = 302;
18949
+ var CubeUVReflectionMapping = 306;
18933
18950
  var RepeatWrapping = 1000;
18934
18951
  var ClampToEdgeWrapping = 1001;
18935
18952
  var MirroredRepeatWrapping = 1002;
@@ -18950,6 +18967,37 @@ var LinearTransfer = "linear";
18950
18967
  var SRGBTransfer = "srgb";
18951
18968
  var WebGLCoordinateSystem = 2000;
18952
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
+ }
18953
19001
  class EventDispatcher {
18954
19002
  addEventListener(type2, listener) {
18955
19003
  if (this._listeners === undefined)
@@ -19290,15 +19338,15 @@ class Quaternion {
19290
19338
  }
19291
19339
  static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
19292
19340
  let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3];
19293
- const x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3];
19294
- 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) {
19295
19343
  dst[dstOffset + 0] = x0;
19296
19344
  dst[dstOffset + 1] = y0;
19297
19345
  dst[dstOffset + 2] = z0;
19298
19346
  dst[dstOffset + 3] = w0;
19299
19347
  return;
19300
19348
  }
19301
- if (t === 1) {
19349
+ if (t >= 1) {
19302
19350
  dst[dstOffset + 0] = x1;
19303
19351
  dst[dstOffset + 1] = y1;
19304
19352
  dst[dstOffset + 2] = z1;
@@ -19306,19 +19354,29 @@ class Quaternion {
19306
19354
  return;
19307
19355
  }
19308
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
+ }
19309
19365
  let s = 1 - t;
19310
- const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, dir = cos >= 0 ? 1 : -1, sqrSin = 1 - cos * cos;
19311
- if (sqrSin > Number.EPSILON) {
19312
- const sin = Math.sqrt(sqrSin), len = Math.atan2(sin, cos * dir);
19313
- s = Math.sin(s * len) / sin;
19314
- t = Math.sin(t * len) / sin;
19315
- }
19316
- const tDir = t * dir;
19317
- x0 = x0 * s + x1 * tDir;
19318
- y0 = y0 * s + y1 * tDir;
19319
- z0 = z0 * s + z1 * tDir;
19320
- w0 = w0 * s + w1 * tDir;
19321
- 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;
19322
19380
  const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);
19323
19381
  x0 *= f;
19324
19382
  y0 *= f;
@@ -19441,7 +19499,7 @@ class Quaternion {
19441
19499
  this._w = c1 * c2 * c3 + s1 * s2 * s3;
19442
19500
  break;
19443
19501
  default:
19444
- console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + order);
19502
+ warn("Quaternion: .setFromEuler() encountered an unknown order: " + order);
19445
19503
  }
19446
19504
  if (update === true)
19447
19505
  this._onChangeCallback();
@@ -19576,46 +19634,37 @@ class Quaternion {
19576
19634
  return this;
19577
19635
  }
19578
19636
  slerp(qb, t) {
19579
- if (t === 0)
19637
+ if (t <= 0)
19580
19638
  return this;
19581
- if (t === 1)
19639
+ if (t >= 1)
19582
19640
  return this.copy(qb);
19583
- const x = this._x, y = this._y, z = this._z, w = this._w;
19584
- let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
19585
- if (cosHalfTheta < 0) {
19586
- this._w = -qb._w;
19587
- this._x = -qb._x;
19588
- this._y = -qb._y;
19589
- this._z = -qb._z;
19590
- 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();
19591
19661
  } else {
19592
- this.copy(qb);
19593
- }
19594
- if (cosHalfTheta >= 1) {
19595
- this._w = w;
19596
- this._x = x;
19597
- this._y = y;
19598
- this._z = z;
19599
- return this;
19600
- }
19601
- const sqrSinHalfTheta = 1 - cosHalfTheta * cosHalfTheta;
19602
- if (sqrSinHalfTheta <= Number.EPSILON) {
19603
- const s = 1 - t;
19604
- this._w = s * w + t * this._w;
19605
- this._x = s * x + t * this._x;
19606
- this._y = s * y + t * this._y;
19607
- 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;
19608
19666
  this.normalize();
19609
- return this;
19610
19667
  }
19611
- const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);
19612
- const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);
19613
- const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, ratioB = Math.sin(t * halfTheta) / sinHalfTheta;
19614
- this._w = w * ratioA + this._w * ratioB;
19615
- this._x = x * ratioA + this._x * ratioB;
19616
- this._y = y * ratioA + this._y * ratioB;
19617
- this._z = z * ratioA + this._z * ratioB;
19618
- this._onChangeCallback();
19619
19668
  return this;
19620
19669
  }
19621
19670
  slerpQuaternions(qa, qb, t) {
@@ -20309,16 +20358,6 @@ class Matrix3 {
20309
20358
  }
20310
20359
  }
20311
20360
  var _m3 = /* @__PURE__ */ new Matrix3;
20312
- function createElementNS(name) {
20313
- return document.createElementNS("http://www.w3.org/1999/xhtml", name);
20314
- }
20315
- var _cache = {};
20316
- function warnOnce(message) {
20317
- if (message in _cache)
20318
- return;
20319
- _cache[message] = true;
20320
- console.warn(message);
20321
- }
20322
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);
20323
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);
20324
20363
  function createColorManagement() {
@@ -20379,11 +20418,11 @@ function createColorManagement() {
20379
20418
  return this.spaces[colorSpace].workingColorSpaceConfig.unpackColorSpace;
20380
20419
  },
20381
20420
  fromWorkingColorSpace: function(color, targetColorSpace) {
20382
- warnOnce("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().");
20421
+ warnOnce("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().");
20383
20422
  return ColorManagement.workingToColorSpace(color, targetColorSpace);
20384
20423
  },
20385
20424
  toWorkingColorSpace: function(color, sourceColorSpace) {
20386
- warnOnce("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().");
20425
+ warnOnce("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().");
20387
20426
  return ColorManagement.colorSpaceToWorking(color, sourceColorSpace);
20388
20427
  }
20389
20428
  };
@@ -20477,7 +20516,7 @@ class ImageUtils {
20477
20516
  height: image.height
20478
20517
  };
20479
20518
  } else {
20480
- 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.");
20481
20520
  return image;
20482
20521
  }
20483
20522
  }
@@ -20497,7 +20536,7 @@ class Source {
20497
20536
  const data = this.data;
20498
20537
  if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
20499
20538
  target.set(data.videoWidth, data.videoHeight, 0);
20500
- } else if (data instanceof VideoFrame) {
20539
+ } else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
20501
20540
  target.set(data.displayHeight, data.displayWidth, 0);
20502
20541
  } else if (data !== null) {
20503
20542
  target.set(data.width, data.height, data.depth || 0);
@@ -20554,7 +20593,7 @@ function serializeImage(image) {
20554
20593
  type: image.data.constructor.name
20555
20594
  };
20556
20595
  } else {
20557
- console.warn("THREE.Texture: Unable to serialize Texture.");
20596
+ warn("Texture: Unable to serialize Texture.");
20558
20597
  return {};
20559
20598
  }
20560
20599
  }
@@ -20664,12 +20703,12 @@ class Texture extends EventDispatcher {
20664
20703
  for (const key in values) {
20665
20704
  const newValue = values[key];
20666
20705
  if (newValue === undefined) {
20667
- console.warn(`THREE.Texture.setValues(): parameter '${key}' has value of undefined.`);
20706
+ warn(`Texture.setValues(): parameter '${key}' has value of undefined.`);
20668
20707
  continue;
20669
20708
  }
20670
20709
  const currentValue = this[key];
20671
20710
  if (currentValue === undefined) {
20672
- console.warn(`THREE.Texture.setValues(): property '${key}' does not exist.`);
20711
+ warn(`Texture.setValues(): property '${key}' does not exist.`);
20673
20712
  continue;
20674
20713
  }
20675
20714
  if (currentValue && newValue && (currentValue.isVector2 && newValue.isVector2)) {
@@ -20870,6 +20909,12 @@ class Matrix4 {
20870
20909
  return this;
20871
20910
  }
20872
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
+ }
20873
20918
  xAxis.setFromMatrixColumn(this, 0);
20874
20919
  yAxis.setFromMatrixColumn(this, 1);
20875
20920
  zAxis.setFromMatrixColumn(this, 2);
@@ -20880,6 +20925,9 @@ class Matrix4 {
20880
20925
  return this;
20881
20926
  }
20882
20927
  extractRotation(m) {
20928
+ if (m.determinant() === 0) {
20929
+ return this.identity();
20930
+ }
20883
20931
  const te = this.elements;
20884
20932
  const me = m.elements;
20885
20933
  const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length();
@@ -21080,7 +21128,13 @@ class Matrix4 {
21080
21128
  const n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13];
21081
21129
  const n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14];
21082
21130
  const n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15];
21083
- 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);
21084
21138
  }
21085
21139
  transpose() {
21086
21140
  const te = this.elements;
@@ -21234,15 +21288,20 @@ class Matrix4 {
21234
21288
  }
21235
21289
  decompose(position, quaternion, scale) {
21236
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
+ }
21237
21299
  let sx = _v1$5.set(te[0], te[1], te[2]).length();
21238
21300
  const sy = _v1$5.set(te[4], te[5], te[6]).length();
21239
21301
  const sz = _v1$5.set(te[8], te[9], te[10]).length();
21240
21302
  const det = this.determinant();
21241
21303
  if (det < 0)
21242
21304
  sx = -sx;
21243
- position.x = te[12];
21244
- position.y = te[13];
21245
- position.z = te[14];
21246
21305
  _m1$2.copy(this);
21247
21306
  const invSX = 1 / sx;
21248
21307
  const invSY = 1 / sy;
@@ -21508,7 +21567,7 @@ class Euler {
21508
21567
  }
21509
21568
  break;
21510
21569
  default:
21511
- console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + order);
21570
+ warn("Euler: .setFromRotationMatrix() encountered an unknown order: " + order);
21512
21571
  }
21513
21572
  this._order = order;
21514
21573
  if (update === true)
@@ -21767,7 +21826,7 @@ class Object3D extends EventDispatcher {
21767
21826
  return this;
21768
21827
  }
21769
21828
  if (object2 === this) {
21770
- 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);
21771
21830
  return this;
21772
21831
  }
21773
21832
  if (object2 && object2.isObject3D) {
@@ -21779,7 +21838,7 @@ class Object3D extends EventDispatcher {
21779
21838
  this.dispatchEvent(_childaddedEvent);
21780
21839
  _childaddedEvent.child = null;
21781
21840
  } else {
21782
- 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);
21783
21842
  }
21784
21843
  return this;
21785
21844
  }
@@ -22395,7 +22454,7 @@ class Color {
22395
22454
  if (string2 === undefined)
22396
22455
  return;
22397
22456
  if (parseFloat(string2) < 1) {
22398
- console.warn("THREE.Color: Alpha component of " + style + " will be ignored.");
22457
+ warn("Color: Alpha component of " + style + " will be ignored.");
22399
22458
  }
22400
22459
  }
22401
22460
  let m;
@@ -22423,7 +22482,7 @@ class Color {
22423
22482
  }
22424
22483
  break;
22425
22484
  default:
22426
- console.warn("THREE.Color: Unknown color model " + style);
22485
+ warn("Color: Unknown color model " + style);
22427
22486
  }
22428
22487
  } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) {
22429
22488
  const hex2 = m[1];
@@ -22433,7 +22492,7 @@ class Color {
22433
22492
  } else if (size === 6) {
22434
22493
  return this.setHex(parseInt(hex2, 16), colorSpace);
22435
22494
  } else {
22436
- console.warn("THREE.Color: Invalid hex color " + style);
22495
+ warn("Color: Invalid hex color " + style);
22437
22496
  }
22438
22497
  } else if (style && style.length > 0) {
22439
22498
  return this.setColorName(style, colorSpace);
@@ -22445,7 +22504,7 @@ class Color {
22445
22504
  if (hex2 !== undefined) {
22446
22505
  this.setHex(hex2, colorSpace);
22447
22506
  } else {
22448
- console.warn("THREE.Color: Unknown color " + style);
22507
+ warn("Color: Unknown color " + style);
22449
22508
  }
22450
22509
  return this;
22451
22510
  }
@@ -22646,7 +22705,7 @@ function cloneUniforms(src) {
22646
22705
  const property = src[u][p];
22647
22706
  if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
22648
22707
  if (property.isRenderTargetTexture) {
22649
- 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().");
22650
22709
  dst[u][p] = null;
22651
22710
  } else {
22652
22711
  dst[u][p] = property.clone();
@@ -22678,9 +22737,6 @@ function convertArray(array, type2) {
22678
22737
  }
22679
22738
  return Array.prototype.slice.call(array);
22680
22739
  }
22681
- function isTypedArray(object2) {
22682
- return ArrayBuffer.isView(object2) && !(object2 instanceof DataView);
22683
- }
22684
22740
  class Interpolant {
22685
22741
  constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
22686
22742
  this.parameterPositions = parameterPositions;
@@ -22932,7 +22988,7 @@ class KeyframeTrack {
22932
22988
  throw new Error(message);
22933
22989
  }
22934
22990
  }
22935
- console.warn("THREE.KeyframeTrack:", message);
22991
+ warn("KeyframeTrack:", message);
22936
22992
  return this;
22937
22993
  }
22938
22994
  this.createInterpolant = factoryMethod;
@@ -22994,24 +23050,24 @@ class KeyframeTrack {
22994
23050
  let valid = true;
22995
23051
  const valueSize = this.getValueSize();
22996
23052
  if (valueSize - Math.floor(valueSize) !== 0) {
22997
- console.error("THREE.KeyframeTrack: Invalid value size in track.", this);
23053
+ error("KeyframeTrack: Invalid value size in track.", this);
22998
23054
  valid = false;
22999
23055
  }
23000
23056
  const times = this.times, values = this.values, nKeys = times.length;
23001
23057
  if (nKeys === 0) {
23002
- console.error("THREE.KeyframeTrack: Track is empty.", this);
23058
+ error("KeyframeTrack: Track is empty.", this);
23003
23059
  valid = false;
23004
23060
  }
23005
23061
  let prevTime = null;
23006
23062
  for (let i = 0;i !== nKeys; i++) {
23007
23063
  const currTime = times[i];
23008
23064
  if (typeof currTime === "number" && isNaN(currTime)) {
23009
- 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);
23010
23066
  valid = false;
23011
23067
  break;
23012
23068
  }
23013
23069
  if (prevTime !== null && prevTime > currTime) {
23014
- console.error("THREE.KeyframeTrack: Out of order keys.", this, i, currTime, prevTime);
23070
+ error("KeyframeTrack: Out of order keys.", this, i, currTime, prevTime);
23015
23071
  valid = false;
23016
23072
  break;
23017
23073
  }
@@ -23022,7 +23078,7 @@ class KeyframeTrack {
23022
23078
  for (let i = 0, n = values.length;i !== n; ++i) {
23023
23079
  const value3 = values[i];
23024
23080
  if (isNaN(value3)) {
23025
- 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);
23026
23082
  valid = false;
23027
23083
  break;
23028
23084
  }
@@ -23172,7 +23228,7 @@ class LoadingManager {
23172
23228
  this.onLoad = onLoad3;
23173
23229
  this.onProgress = onProgress;
23174
23230
  this.onError = onError;
23175
- this.abortController = new AbortController;
23231
+ this._abortController = null;
23176
23232
  this.itemStart = function(url3) {
23177
23233
  itemsTotal++;
23178
23234
  if (isLoading === false) {
@@ -23234,10 +23290,16 @@ class LoadingManager {
23234
23290
  };
23235
23291
  this.abort = function() {
23236
23292
  this.abortController.abort();
23237
- this.abortController = new AbortController;
23293
+ this._abortController = null;
23238
23294
  return this;
23239
23295
  };
23240
23296
  }
23297
+ get abortController() {
23298
+ if (!this._abortController) {
23299
+ this._abortController = new AbortController;
23300
+ }
23301
+ return this._abortController;
23302
+ }
23241
23303
  }
23242
23304
  var DefaultLoadingManager = /* @__PURE__ */ new LoadingManager;
23243
23305
 
@@ -23493,7 +23555,7 @@ class PropertyBinding {
23493
23555
  this.getValue = this._getValue_unavailable;
23494
23556
  this.setValue = this._setValue_unavailable;
23495
23557
  if (!targetObject) {
23496
- console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + ".");
23558
+ warn("PropertyBinding: No target node found for track: " + this.path + ".");
23497
23559
  return;
23498
23560
  }
23499
23561
  if (objectName) {
@@ -23501,18 +23563,18 @@ class PropertyBinding {
23501
23563
  switch (objectName) {
23502
23564
  case "materials":
23503
23565
  if (!targetObject.material) {
23504
- 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);
23505
23567
  return;
23506
23568
  }
23507
23569
  if (!targetObject.material.materials) {
23508
- 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);
23509
23571
  return;
23510
23572
  }
23511
23573
  targetObject = targetObject.material.materials;
23512
23574
  break;
23513
23575
  case "bones":
23514
23576
  if (!targetObject.skeleton) {
23515
- 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);
23516
23578
  return;
23517
23579
  }
23518
23580
  targetObject = targetObject.skeleton.bones;
@@ -23529,25 +23591,25 @@ class PropertyBinding {
23529
23591
  break;
23530
23592
  }
23531
23593
  if (!targetObject.material) {
23532
- 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);
23533
23595
  return;
23534
23596
  }
23535
23597
  if (!targetObject.material.map) {
23536
- 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);
23537
23599
  return;
23538
23600
  }
23539
23601
  targetObject = targetObject.material.map;
23540
23602
  break;
23541
23603
  default:
23542
23604
  if (targetObject[objectName] === undefined) {
23543
- 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);
23544
23606
  return;
23545
23607
  }
23546
23608
  targetObject = targetObject[objectName];
23547
23609
  }
23548
23610
  if (objectIndex !== undefined) {
23549
23611
  if (targetObject[objectIndex] === undefined) {
23550
- 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);
23551
23613
  return;
23552
23614
  }
23553
23615
  targetObject = targetObject[objectIndex];
@@ -23556,7 +23618,7 @@ class PropertyBinding {
23556
23618
  const nodeProperty = targetObject[propertyName];
23557
23619
  if (nodeProperty === undefined) {
23558
23620
  const nodeName = parsedPath.nodeName;
23559
- 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);
23560
23622
  return;
23561
23623
  }
23562
23624
  let versioning = this.Versioning.None;
@@ -23570,11 +23632,11 @@ class PropertyBinding {
23570
23632
  if (propertyIndex !== undefined) {
23571
23633
  if (propertyName === "morphTargetInfluences") {
23572
23634
  if (!targetObject.geometry) {
23573
- 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);
23574
23636
  return;
23575
23637
  }
23576
23638
  if (!targetObject.geometry.morphAttributes) {
23577
- 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);
23578
23640
  return;
23579
23641
  }
23580
23642
  if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) {
@@ -23650,13 +23712,13 @@ if (typeof __THREE_DEVTOOLS__ !== "undefined") {
23650
23712
  }
23651
23713
  if (typeof window !== "undefined") {
23652
23714
  if (window.__THREE__) {
23653
- console.warn("WARNING: Multiple instances of Three.js being imported.");
23715
+ warn("WARNING: Multiple instances of Three.js being imported.");
23654
23716
  } else {
23655
23717
  window.__THREE__ = REVISION;
23656
23718
  }
23657
23719
  }
23658
23720
 
23659
- // ../../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
23660
23722
  var alphahash_fragment = `#ifdef USE_ALPHAHASH
23661
23723
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
23662
23724
  #endif`;
@@ -24014,13 +24076,6 @@ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
24014
24076
  vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
24015
24077
  return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
24016
24078
  }
24017
- mat3 transposeMat3( const in mat3 m ) {
24018
- mat3 tmp;
24019
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
24020
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
24021
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
24022
- return tmp;
24023
- }
24024
24079
  bool isPerspectiveMatrix( mat4 m ) {
24025
24080
  return m[ 2 ][ 3 ] == - 1.0;
24026
24081
  }
@@ -24231,7 +24286,6 @@ var envmap_common_pars_fragment = `#ifdef USE_ENVMAP
24231
24286
  #else
24232
24287
  uniform sampler2D envMap;
24233
24288
  #endif
24234
-
24235
24289
  #endif`;
24236
24290
  var envmap_pars_fragment = `#ifdef USE_ENVMAP
24237
24291
  uniform float reflectivity;
@@ -24464,7 +24518,7 @@ var envmap_physical_pars_fragment = `#ifdef USE_ENVMAP
24464
24518
  vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
24465
24519
  #ifdef ENVMAP_TYPE_CUBE_UV
24466
24520
  vec3 reflectVec = reflect( - viewDir, normal );
24467
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
24521
+ reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
24468
24522
  reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
24469
24523
  vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
24470
24524
  return envMapColor.rgb * envMapIntensity;
@@ -24524,7 +24578,9 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
24524
24578
  #define RE_Direct RE_Direct_BlinnPhong
24525
24579
  #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`;
24526
24580
  var lights_physical_fragment = `PhysicalMaterial material;
24527
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
24581
+ material.diffuseColor = diffuseColor.rgb;
24582
+ material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
24583
+ material.metalness = metalnessFactor;
24528
24584
  vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
24529
24585
  float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
24530
24586
  material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
@@ -24546,9 +24602,11 @@ material.roughness = min( material.roughness, 1.0 );
24546
24602
  vec3 specularColorFactor = vec3( 1.0 );
24547
24603
  material.specularF90 = 1.0;
24548
24604
  #endif
24549
- 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 );
24550
24607
  #else
24551
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
24608
+ material.specularColor = vec3( 0.04 );
24609
+ material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
24552
24610
  material.specularF90 = 1.0;
24553
24611
  #endif
24554
24612
  #ifdef USE_CLEARCOAT
@@ -24586,7 +24644,7 @@ material.roughness = min( material.roughness, 1.0 );
24586
24644
  #ifdef USE_SHEEN_COLORMAP
24587
24645
  material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
24588
24646
  #endif
24589
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
24647
+ material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
24590
24648
  #ifdef USE_SHEEN_ROUGHNESSMAP
24591
24649
  material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
24592
24650
  #endif
@@ -24610,10 +24668,14 @@ material.roughness = min( material.roughness, 1.0 );
24610
24668
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
24611
24669
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
24612
24670
  #endif`;
24613
- var lights_physical_pars_fragment = `struct PhysicalMaterial {
24671
+ var lights_physical_pars_fragment = `uniform sampler2D dfgLUT;
24672
+ struct PhysicalMaterial {
24614
24673
  vec3 diffuseColor;
24615
- float roughness;
24674
+ vec3 diffuseContribution;
24616
24675
  vec3 specularColor;
24676
+ vec3 specularColorBlended;
24677
+ float roughness;
24678
+ float metalness;
24617
24679
  float specularF90;
24618
24680
  float dispersion;
24619
24681
  #ifdef USE_CLEARCOAT
@@ -24628,6 +24690,8 @@ var lights_physical_pars_fragment = `struct PhysicalMaterial {
24628
24690
  float iridescenceThickness;
24629
24691
  vec3 iridescenceFresnel;
24630
24692
  vec3 iridescenceF0;
24693
+ vec3 iridescenceFresnelDielectric;
24694
+ vec3 iridescenceFresnelMetallic;
24631
24695
  #endif
24632
24696
  #ifdef USE_SHEEN
24633
24697
  vec3 sheenColor;
@@ -24676,7 +24740,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
24676
24740
  float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
24677
24741
  float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
24678
24742
  float v = 0.5 / ( gv + gl );
24679
- return saturate(v);
24743
+ return v;
24680
24744
  }
24681
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 ) {
24682
24746
  float a2 = alphaT * alphaB;
@@ -24704,7 +24768,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
24704
24768
  }
24705
24769
  #endif
24706
24770
  vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
24707
- vec3 f0 = material.specularColor;
24771
+ vec3 f0 = material.specularColorBlended;
24708
24772
  float f90 = material.specularF90;
24709
24773
  float roughness = material.roughness;
24710
24774
  float alpha = pow2( roughness );
@@ -24762,7 +24826,7 @@ vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m
24762
24826
  vec3 T1, T2;
24763
24827
  T1 = normalize( V - N * dot( V, N ) );
24764
24828
  T2 = - cross( N, T1 );
24765
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
24829
+ mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
24766
24830
  vec3 coords[ 4 ];
24767
24831
  coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
24768
24832
  coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
@@ -24804,22 +24868,15 @@ vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no
24804
24868
  float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
24805
24869
  float dotNV = saturate( dot( normal, viewDir ) );
24806
24870
  float r2 = roughness * roughness;
24807
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
24808
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
24809
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
24810
- return saturate( DG * RECIPROCAL_PI );
24811
- }
24812
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
24813
- float dotNV = saturate( dot( normal, viewDir ) );
24814
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
24815
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
24816
- vec4 r = roughness * c0 + c1;
24817
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
24818
- vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
24819
- 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 );
24820
24876
  }
24821
24877
  vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
24822
- vec2 fab = DFGApprox( normal, viewDir, roughness );
24878
+ float dotNV = saturate( dot( normal, viewDir ) );
24879
+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
24823
24880
  return specularColor * fab.x + specularF90 * fab.y;
24824
24881
  }
24825
24882
  #ifdef USE_IRIDESCENCE
@@ -24827,7 +24884,8 @@ void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 view
24827
24884
  #else
24828
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 ) {
24829
24886
  #endif
24830
- vec2 fab = DFGApprox( normal, viewDir, roughness );
24887
+ float dotNV = saturate( dot( normal, viewDir ) );
24888
+ vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
24831
24889
  #ifdef USE_IRIDESCENCE
24832
24890
  vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
24833
24891
  #else
@@ -24840,6 +24898,24 @@ void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const
24840
24898
  singleScatter += FssEss;
24841
24899
  multiScatter += Fms * Ems;
24842
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
+ }
24843
24919
  #if NUM_RECT_AREA_LIGHTS > 0
24844
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 ) {
24845
24921
  vec3 normal = geometryNormal;
@@ -24862,9 +24938,9 @@ void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const
24862
24938
  vec3( 0, 1, 0 ),
24863
24939
  vec3( t1.z, 0, t1.w )
24864
24940
  );
24865
- 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 );
24866
24942
  reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
24867
- 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 );
24868
24944
  }
24869
24945
  #endif
24870
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 ) {
@@ -24876,34 +24952,63 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geome
24876
24952
  clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
24877
24953
  #endif
24878
24954
  #ifdef USE_SHEEN
24879
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
24880
- #endif
24881
- reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
24882
- 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 );
24883
24968
  }
24884
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 ) {
24885
- 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;
24886
24977
  }
24887
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) {
24888
24979
  #ifdef USE_CLEARCOAT
24889
24980
  clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
24890
24981
  #endif
24891
24982
  #ifdef USE_SHEEN
24892
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
24893
- #endif
24894
- vec3 singleScattering = vec3( 0.0 );
24895
- vec3 multiScattering = vec3( 0.0 );
24896
- 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 );
24897
24989
  #ifdef USE_IRIDESCENCE
24898
- 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 );
24899
24992
  #else
24900
- 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;
24901
25009
  #endif
24902
- vec3 totalScattering = singleScattering + multiScattering;
24903
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
24904
- reflectedLight.indirectSpecular += radiance * singleScattering;
24905
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
24906
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
25010
+ reflectedLight.indirectSpecular += indirectSpecular;
25011
+ reflectedLight.indirectDiffuse += indirectDiffuse;
24907
25012
  }
24908
25013
  #define RE_Direct RE_Direct_Physical
24909
25014
  #define RE_Direct_RectArea RE_Direct_RectArea_Physical
@@ -24928,7 +25033,9 @@ vec3 geometryClearcoatNormal = vec3( 0.0 );
24928
25033
  material.iridescence = saturate( material.iridescence );
24929
25034
  }
24930
25035
  if ( material.iridescence > 0.0 ) {
24931
- 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 );
24932
25039
  material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
24933
25040
  }
24934
25041
  #endif
@@ -24942,7 +25049,7 @@ IncidentLight directLight;
24942
25049
  for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
24943
25050
  pointLight = pointLights[ i ];
24944
25051
  getPointLightInfo( pointLight, geometryPosition, directLight );
24945
- #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 ) )
24946
25053
  pointLightShadow = pointLightShadows[ i ];
24947
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;
24948
25055
  #endif
@@ -25400,7 +25507,11 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25400
25507
  #endif
25401
25508
  #ifdef USE_SHADOWMAP
25402
25509
  #if NUM_DIR_LIGHT_SHADOWS > 0
25403
- 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
25404
25515
  varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
25405
25516
  struct DirectionalLightShadow {
25406
25517
  float shadowIntensity;
@@ -25412,7 +25523,11 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25412
25523
  uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
25413
25524
  #endif
25414
25525
  #if NUM_SPOT_LIGHT_SHADOWS > 0
25415
- 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
25416
25531
  struct SpotLightShadow {
25417
25532
  float shadowIntensity;
25418
25533
  float shadowBias;
@@ -25423,7 +25538,11 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25423
25538
  uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
25424
25539
  #endif
25425
25540
  #if NUM_POINT_LIGHT_SHADOWS > 0
25426
- 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
25427
25546
  varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
25428
25547
  struct PointLightShadow {
25429
25548
  float shadowIntensity;
@@ -25436,157 +25555,132 @@ var shadowmap_pars_fragment = `#if NUM_SPOT_LIGHT_COORDS > 0
25436
25555
  };
25437
25556
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
25438
25557
  #endif
25439
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
25440
- float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
25441
- #ifdef USE_REVERSED_DEPTH_BUFFER
25442
- return step( depth, compare );
25443
- #else
25444
- return step( compare, depth );
25445
- #endif
25446
- }
25447
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
25448
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
25449
- }
25450
- float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
25451
- float occlusion = 1.0;
25452
- vec2 distribution = texture2DDistribution( shadow, uv );
25453
- #ifdef USE_REVERSED_DEPTH_BUFFER
25454
- float hard_shadow = step( distribution.x, compare );
25455
- #else
25456
- float hard_shadow = step( compare, distribution.x );
25457
- #endif
25458
- if ( hard_shadow != 1.0 ) {
25459
- float distance = compare - distribution.x;
25460
- float variance = max( 0.00000, distribution.y * distribution.y );
25461
- 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 ) ) ) );
25462
25561
  }
25463
- return occlusion;
25464
- }
25465
- 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 ) {
25466
25639
  float shadow = 1.0;
25467
- shadowCoord.xyz /= shadowCoord.w;
25468
- shadowCoord.z += shadowBias;
25469
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
25470
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
25471
- if ( frustumTest ) {
25472
- #if defined( SHADOWMAP_TYPE_PCF )
25473
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
25474
- float dx0 = - texelSize.x * shadowRadius;
25475
- float dy0 = - texelSize.y * shadowRadius;
25476
- float dx1 = + texelSize.x * shadowRadius;
25477
- float dy1 = + texelSize.y * shadowRadius;
25478
- float dx2 = dx0 / 2.0;
25479
- float dy2 = dy0 / 2.0;
25480
- float dx3 = dx1 / 2.0;
25481
- float dy3 = dy1 / 2.0;
25482
- shadow = (
25483
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
25484
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
25485
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
25486
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
25487
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
25488
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
25489
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
25490
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
25491
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
25492
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
25493
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
25494
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
25495
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
25496
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
25497
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
25498
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
25499
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
25500
- ) * ( 1.0 / 17.0 );
25501
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
25502
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
25503
- float dx = texelSize.x;
25504
- float dy = texelSize.y;
25505
- vec2 uv = shadowCoord.xy;
25506
- vec2 f = fract( uv * shadowMapSize + 0.5 );
25507
- 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;
25508
25653
  shadow = (
25509
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
25510
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
25511
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
25512
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
25513
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
25514
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
25515
- f.x ) +
25516
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
25517
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
25518
- f.x ) +
25519
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
25520
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
25521
- f.y ) +
25522
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
25523
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
25524
- f.y ) +
25525
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
25526
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
25527
- f.x ),
25528
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
25529
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
25530
- f.x ),
25531
- f.y )
25532
- ) * ( 1.0 / 9.0 );
25533
- #elif defined( SHADOWMAP_TYPE_VSM )
25534
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
25535
- #else
25536
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
25537
- #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;
25538
25660
  }
25539
25661
  return mix( 1.0, shadow, shadowIntensity );
25540
25662
  }
25541
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
25542
- vec3 absV = abs( v );
25543
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
25544
- absV *= scaleToCube;
25545
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
25546
- vec2 planar = v.xy;
25547
- float almostATexel = 1.5 * texelSizeY;
25548
- float almostOne = 1.0 - almostATexel;
25549
- if ( absV.z >= almostOne ) {
25550
- if ( v.z > 0.0 )
25551
- planar.x = 4.0 - v.x;
25552
- } else if ( absV.x >= almostOne ) {
25553
- float signX = sign( v.x );
25554
- planar.x = v.z * signX + 2.0 * signX;
25555
- } else if ( absV.y >= almostOne ) {
25556
- float signY = sign( v.y );
25557
- planar.x = v.x + 2.0 * signY + 2.0;
25558
- planar.y = v.z * signY - 2.0;
25559
- }
25560
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
25561
- }
25562
- 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 ) {
25563
25665
  float shadow = 1.0;
25564
25666
  vec3 lightToPosition = shadowCoord.xyz;
25565
-
25566
- float lightToPositionLength = length( lightToPosition );
25567
- if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
25568
- float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
25569
- vec3 bd3D = normalize( lightToPosition );
25570
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
25571
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
25572
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
25573
- shadow = (
25574
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
25575
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
25576
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
25577
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
25578
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
25579
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
25580
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
25581
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
25582
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
25583
- ) * ( 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 );
25584
25676
  #else
25585
- shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
25677
+ shadow = step( dp, depth );
25586
25678
  #endif
25587
25679
  }
25588
25680
  return mix( 1.0, shadow, shadowIntensity );
25589
25681
  }
25682
+ #endif
25683
+ #endif
25590
25684
  #endif`;
25591
25685
  var shadowmap_pars_vertex = `#if NUM_SPOT_LIGHT_COORDS > 0
25592
25686
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
@@ -25684,7 +25778,7 @@ var shadowmask_pars_fragment = `float getShadowMask() {
25684
25778
  }
25685
25779
  #pragma unroll_loop_end
25686
25780
  #endif
25687
- #if NUM_POINT_LIGHT_SHADOWS > 0
25781
+ #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
25688
25782
  PointLightShadow pointLight;
25689
25783
  #pragma unroll_loop_start
25690
25784
  for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
@@ -25866,7 +25960,7 @@ var transmission_fragment = `#ifdef USE_TRANSMISSION
25866
25960
  vec3 v = normalize( cameraPosition - pos );
25867
25961
  vec3 n = inverseTransformDirection( normal, viewMatrix );
25868
25962
  vec4 transmitted = getIBLVolumeRefraction(
25869
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
25963
+ n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
25870
25964
  pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
25871
25965
  material.attenuationColor, material.attenuationDistance );
25872
25966
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
@@ -26418,7 +26512,6 @@ uniform float nearDistance;
26418
26512
  uniform float farDistance;
26419
26513
  varying vec3 vWorldPosition;
26420
26514
  #include <common>
26421
- #include <packing>
26422
26515
  #include <uv_pars_fragment>
26423
26516
  #include <map_pars_fragment>
26424
26517
  #include <alphamap_pars_fragment>
@@ -26435,7 +26528,7 @@ void main () {
26435
26528
  float dist = length( vWorldPosition - referencePosition );
26436
26529
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
26437
26530
  dist = saturate( dist );
26438
- gl_FragColor = packDepthToRGBA( dist );
26531
+ gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
26439
26532
  }`;
26440
26533
  var vertex$c = `varying vec3 vWorldDirection;
26441
26534
  #include <common>
@@ -26633,7 +26726,6 @@ uniform vec3 diffuse;
26633
26726
  uniform vec3 emissive;
26634
26727
  uniform float opacity;
26635
26728
  #include <common>
26636
- #include <packing>
26637
26729
  #include <dithering_pars_fragment>
26638
26730
  #include <color_pars_fragment>
26639
26731
  #include <uv_pars_fragment>
@@ -26807,7 +26899,6 @@ uniform float opacity;
26807
26899
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
26808
26900
  varying vec3 vViewPosition;
26809
26901
  #endif
26810
- #include <packing>
26811
26902
  #include <uv_pars_fragment>
26812
26903
  #include <normal_pars_fragment>
26813
26904
  #include <bumpmap_pars_fragment>
@@ -26820,7 +26911,7 @@ void main() {
26820
26911
  #include <logdepthbuf_fragment>
26821
26912
  #include <normal_fragment_begin>
26822
26913
  #include <normal_fragment_maps>
26823
- gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
26914
+ gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
26824
26915
  #ifdef OPAQUE
26825
26916
  gl_FragColor.a = 1.0;
26826
26917
  #endif
@@ -26872,7 +26963,6 @@ uniform vec3 specular;
26872
26963
  uniform float shininess;
26873
26964
  uniform float opacity;
26874
26965
  #include <common>
26875
- #include <packing>
26876
26966
  #include <dithering_pars_fragment>
26877
26967
  #include <color_pars_fragment>
26878
26968
  #include <uv_pars_fragment>
@@ -27023,7 +27113,6 @@ uniform float opacity;
27023
27113
  #endif
27024
27114
  varying vec3 vViewPosition;
27025
27115
  #include <common>
27026
- #include <packing>
27027
27116
  #include <dithering_pars_fragment>
27028
27117
  #include <color_pars_fragment>
27029
27118
  #include <uv_pars_fragment>
@@ -27080,9 +27169,10 @@ void main() {
27080
27169
  #include <transmission_fragment>
27081
27170
  vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
27082
27171
  #ifdef USE_SHEEN
27083
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
27084
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
27085
- #endif
27172
+
27173
+ outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
27174
+
27175
+ #endif
27086
27176
  #ifdef USE_CLEARCOAT
27087
27177
  float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
27088
27178
  vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
@@ -27138,7 +27228,6 @@ uniform vec3 diffuse;
27138
27228
  uniform vec3 emissive;
27139
27229
  uniform float opacity;
27140
27230
  #include <common>
27141
- #include <packing>
27142
27231
  #include <dithering_pars_fragment>
27143
27232
  #include <color_pars_fragment>
27144
27233
  #include <uv_pars_fragment>
@@ -27272,7 +27361,6 @@ void main() {
27272
27361
  var fragment$2 = `uniform vec3 color;
27273
27362
  uniform float opacity;
27274
27363
  #include <common>
27275
- #include <packing>
27276
27364
  #include <fog_pars_fragment>
27277
27365
  #include <bsdfs>
27278
27366
  #include <lights_pars_begin>
@@ -27453,8 +27541,8 @@ var ShaderChunk = {
27453
27541
  cube_frag: fragment$f,
27454
27542
  depth_vert: vertex$e,
27455
27543
  depth_frag: fragment$e,
27456
- distanceRGBA_vert: vertex$d,
27457
- distanceRGBA_frag: fragment$d,
27544
+ distance_vert: vertex$d,
27545
+ distance_frag: fragment$d,
27458
27546
  equirect_vert: vertex$c,
27459
27547
  equirect_frag: fragment$c,
27460
27548
  linedashed_vert: vertex$b,
@@ -27500,7 +27588,8 @@ var UniformsLib = {
27500
27588
  flipEnvMap: { value: -1 },
27501
27589
  reflectivity: { value: 1 },
27502
27590
  ior: { value: 1.5 },
27503
- refractionRatio: { value: 0.98 }
27591
+ refractionRatio: { value: 0.98 },
27592
+ dfgLUT: { value: null }
27504
27593
  },
27505
27594
  aomap: {
27506
27595
  aoMap: { value: null },
@@ -27836,7 +27925,7 @@ var ShaderLib = {
27836
27925
  vertexShader: ShaderChunk.equirect_vert,
27837
27926
  fragmentShader: ShaderChunk.equirect_frag
27838
27927
  },
27839
- distanceRGBA: {
27928
+ distance: {
27840
27929
  uniforms: /* @__PURE__ */ mergeUniforms([
27841
27930
  UniformsLib.common,
27842
27931
  UniformsLib.displacementmap,
@@ -27846,8 +27935,8 @@ var ShaderLib = {
27846
27935
  farDistance: { value: 1000 }
27847
27936
  }
27848
27937
  ]),
27849
- vertexShader: ShaderChunk.distanceRGBA_vert,
27850
- fragmentShader: ShaderChunk.distanceRGBA_frag
27938
+ vertexShader: ShaderChunk.distance_vert,
27939
+ fragmentShader: ShaderChunk.distance_frag
27851
27940
  },
27852
27941
  shadow: {
27853
27942
  uniforms: /* @__PURE__ */ mergeUniforms([
@@ -27915,24 +28004,45 @@ ShaderLib.physical = {
27915
28004
  vertexShader: ShaderChunk.meshphysical_vert,
27916
28005
  fragmentShader: ShaderChunk.meshphysical_frag
27917
28006
  };
27918
- var PHI = (1 + Math.sqrt(5)) / 2;
27919
- var INV_PHI = 1 / PHI;
27920
- var _axisDirections = [
27921
- /* @__PURE__ */ new Vector3(-PHI, INV_PHI, 0),
27922
- /* @__PURE__ */ new Vector3(PHI, INV_PHI, 0),
27923
- /* @__PURE__ */ new Vector3(-INV_PHI, 0, PHI),
27924
- /* @__PURE__ */ new Vector3(INV_PHI, 0, PHI),
27925
- /* @__PURE__ */ new Vector3(0, PHI, -INV_PHI),
27926
- /* @__PURE__ */ new Vector3(0, PHI, INV_PHI),
27927
- /* @__PURE__ */ new Vector3(-1, 1, -1),
27928
- /* @__PURE__ */ new Vector3(1, 1, -1),
27929
- /* @__PURE__ */ new Vector3(-1, 1, 1),
27930
- /* @__PURE__ */ new Vector3(1, 1, 1)
27931
- ];
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
+ };
27932
28016
  var mat4array = new Float32Array(16);
27933
28017
  var mat3array = new Float32Array(9);
27934
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
+ };
27935
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
+ };
27936
28046
  var reversedFuncs = {
27937
28047
  [NeverDepth]: AlwaysDepth,
27938
28048
  [LessDepth]: GreaterDepth,
@@ -27943,6 +28053,520 @@ var reversedFuncs = {
27943
28053
  [NotEqualDepth]: EqualDepth,
27944
28054
  [GreaterEqualDepth]: LessEqualDepth
27945
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
+ ]);
27946
28570
 
27947
28571
  // src/library/bug-rangers-game-state.ts
27948
28572
  var dragStateAtom = atom2({