@gjsify/example-dom-three-geometry-teapot 0.1.15 → 0.2.0

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.
Files changed (3) hide show
  1. package/dist/browser.js +404 -157
  2. package/dist/gjs.js +904 -1554
  3. package/package.json +12 -12
package/dist/gjs.js CHANGED
@@ -10,10 +10,6 @@ var __esm = (fn, res) => function __init() {
10
10
  var __commonJS = (cb, mod) => function __require() {
11
11
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
12
  };
13
- var __export = (target, all) => {
14
- for (var name2 in all)
15
- __defProp(target, name2, { get: all[name2], enumerable: true });
16
- };
17
13
  var __copyProps = (to, from, except, desc) => {
18
14
  if (from && typeof from === "object" || typeof from === "function") {
19
15
  for (let key of __getOwnPropNames(from))
@@ -30,14 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
26
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
27
  mod
32
28
  ));
33
- var __toCommonJS = (mod) => {
34
- var ns = __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
- if (typeof ns.default !== "undefined") {
36
- var keys = Object.keys(ns);
37
- if (keys.length === 1 || (keys.length === 2 && keys.includes("__esModule"))) return ns.default;
38
- }
39
- return ns;
40
- };
41
29
 
42
30
  // ../../../packages/infra/esbuild-plugin-gjsify/dist/shims/console-gjs.js
43
31
  function _formatArgs(...args) {
@@ -83,10 +71,10 @@ var init_console_gjs = __esm({
83
71
  _groupIndentation;
84
72
  _timers = /* @__PURE__ */ new Map();
85
73
  _counters = /* @__PURE__ */ new Map();
86
- constructor(stdoutOrOptions, stderr2) {
74
+ constructor(stdoutOrOptions, stderr) {
87
75
  if (stdoutOrOptions && typeof stdoutOrOptions.write === "function") {
88
76
  this._stdout = stdoutOrOptions;
89
- this._stderr = stderr2 || this._stdout;
77
+ this._stderr = stderr || this._stdout;
90
78
  } else if (stdoutOrOptions && typeof stdoutOrOptions === "object") {
91
79
  const opts = stdoutOrOptions;
92
80
  this._stdout = opts.stdout;
@@ -265,22 +253,10 @@ var init_console_gjs = __esm({
265
253
  });
266
254
 
267
255
  // ../../../packages/gjs/utils/lib/esm/callable.js
268
- function makeCallable(Cls) {
269
- return new Proxy(Cls, {
270
- apply(target, thisArg, args) {
271
- const tmp = Reflect.construct(target, args, target);
272
- for (const key of Reflect.ownKeys(tmp)) {
273
- const desc = Object.getOwnPropertyDescriptor(tmp, key);
274
- if (desc) Object.defineProperty(thisArg, key, desc);
275
- }
276
- return thisArg;
277
- }
278
- });
279
- }
280
256
  var init_callable = __esm({
281
257
  "../../../packages/gjs/utils/lib/esm/callable.js"() {
282
258
  init_console_gjs();
283
- init_auto_globals_495e9d950c();
259
+ init_auto_globals_97a682e619();
284
260
  }
285
261
  });
286
262
 
@@ -322,7 +298,7 @@ var B64_CHARS, B64_LOOKUP;
322
298
  var init_base64 = __esm({
323
299
  "../../../packages/gjs/utils/lib/esm/base64.js"() {
324
300
  init_console_gjs();
325
- init_auto_globals_495e9d950c();
301
+ init_auto_globals_97a682e619();
326
302
  B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
327
303
  B64_LOOKUP = new Uint8Array(256);
328
304
  for (let i = 0; i < B64_CHARS.length; i++) B64_LOOKUP[B64_CHARS.charCodeAt(i)] = i;
@@ -333,7 +309,7 @@ var init_base64 = __esm({
333
309
  var init_byte_array = __esm({
334
310
  "../../../packages/gjs/utils/lib/esm/byte-array.js"() {
335
311
  init_console_gjs();
336
- init_auto_globals_495e9d950c();
312
+ init_auto_globals_97a682e619();
337
313
  }
338
314
  });
339
315
 
@@ -343,7 +319,7 @@ var glib_2_0_default;
343
319
  var init_glib_2_0 = __esm({
344
320
  "../../../node_modules/@girs/glib-2.0/glib-2.0.js"() {
345
321
  init_console_gjs();
346
- init_auto_globals_495e9d950c();
322
+ init_auto_globals_97a682e619();
347
323
  glib_2_0_default = GLib;
348
324
  }
349
325
  });
@@ -353,7 +329,7 @@ var glib_2_default;
353
329
  var init_glib_2 = __esm({
354
330
  "../../../node_modules/@girs/glib-2.0/index.js"() {
355
331
  init_console_gjs();
356
- init_auto_globals_495e9d950c();
332
+ init_auto_globals_97a682e619();
357
333
  init_glib_2_0();
358
334
  glib_2_default = glib_2_0_default;
359
335
  }
@@ -364,7 +340,7 @@ var byteArray;
364
340
  var init_cli = __esm({
365
341
  "../../../packages/gjs/utils/lib/esm/cli.js"() {
366
342
  init_console_gjs();
367
- init_auto_globals_495e9d950c();
343
+ init_auto_globals_97a682e619();
368
344
  init_glib_2();
369
345
  byteArray = imports.byteArray;
370
346
  }
@@ -374,7 +350,7 @@ var init_cli = __esm({
374
350
  var init_defer = __esm({
375
351
  "../../../packages/gjs/utils/lib/esm/defer.js"() {
376
352
  init_console_gjs();
377
- init_auto_globals_495e9d950c();
353
+ init_auto_globals_97a682e619();
378
354
  }
379
355
  });
380
356
 
@@ -413,7 +389,7 @@ var VALID_ENCODINGS;
413
389
  var init_encoding = __esm({
414
390
  "../../../packages/gjs/utils/lib/esm/encoding.js"() {
415
391
  init_console_gjs();
416
- init_auto_globals_495e9d950c();
392
+ init_auto_globals_97a682e619();
417
393
  VALID_ENCODINGS = ["utf8", "ascii", "latin1", "binary", "base64", "base64url", "hex", "ucs2", "utf16le"];
418
394
  }
419
395
  });
@@ -427,34 +403,15 @@ function registerGlobal(name2, value2) {
427
403
  var init_globals = __esm({
428
404
  "../../../packages/gjs/utils/lib/esm/globals.js"() {
429
405
  init_console_gjs();
430
- init_auto_globals_495e9d950c();
406
+ init_auto_globals_97a682e619();
431
407
  }
432
408
  });
433
409
 
434
410
  // ../../../packages/gjs/utils/lib/esm/error.js
435
- var initErrorV8Methods;
436
411
  var init_error = __esm({
437
412
  "../../../packages/gjs/utils/lib/esm/error.js"() {
438
413
  init_console_gjs();
439
- init_auto_globals_495e9d950c();
440
- initErrorV8Methods = (ErrorConstructor) => {
441
- if (!Error.captureStackTrace) {
442
- Error.captureStackTrace = function(targetObject, constructorOpt) {
443
- const container = new Error();
444
- const target = constructorOpt || targetObject;
445
- Object.defineProperty(target, "stack", {
446
- configurable: true,
447
- get: function getStack() {
448
- var stack = container.stack;
449
- Object.defineProperty(this, "stack", {
450
- value: stack
451
- });
452
- return stack;
453
- }
454
- });
455
- };
456
- }
457
- };
414
+ init_auto_globals_97a682e619();
458
415
  }
459
416
  });
460
417
 
@@ -463,7 +420,7 @@ var byteArray2;
463
420
  var init_file = __esm({
464
421
  "../../../packages/gjs/utils/lib/esm/file.js"() {
465
422
  init_console_gjs();
466
- init_auto_globals_495e9d950c();
423
+ init_auto_globals_97a682e619();
467
424
  init_glib_2();
468
425
  byteArray2 = imports.byteArray;
469
426
  }
@@ -475,7 +432,7 @@ var gio_2_0_default;
475
432
  var init_gio_2_0 = __esm({
476
433
  "../../../node_modules/@girs/gio-2.0/gio-2.0.js"() {
477
434
  init_console_gjs();
478
- init_auto_globals_495e9d950c();
435
+ init_auto_globals_97a682e619();
479
436
  gio_2_0_default = Gio;
480
437
  }
481
438
  });
@@ -485,7 +442,7 @@ var gio_2_default;
485
442
  var init_gio_2 = __esm({
486
443
  "../../../node_modules/@girs/gio-2.0/index.js"() {
487
444
  init_console_gjs();
488
- init_auto_globals_495e9d950c();
445
+ init_auto_globals_97a682e619();
489
446
  init_gio_2_0();
490
447
  gio_2_default = gio_2_0_default;
491
448
  }
@@ -496,7 +453,7 @@ import GioUnix from "gi://GioUnix?version=2.0";
496
453
  var init_giounix_2_0 = __esm({
497
454
  "../../../node_modules/@girs/giounix-2.0/giounix-2.0.js"() {
498
455
  init_console_gjs();
499
- init_auto_globals_495e9d950c();
456
+ init_auto_globals_97a682e619();
500
457
  }
501
458
  });
502
459
 
@@ -504,7 +461,7 @@ var init_giounix_2_0 = __esm({
504
461
  var init_giounix_2 = __esm({
505
462
  "../../../node_modules/@girs/giounix-2.0/index.js"() {
506
463
  init_console_gjs();
507
- init_auto_globals_495e9d950c();
464
+ init_auto_globals_97a682e619();
508
465
  init_giounix_2_0();
509
466
  }
510
467
  });
@@ -513,7 +470,7 @@ var init_giounix_2 = __esm({
513
470
  var init_fs = __esm({
514
471
  "../../../packages/gjs/utils/lib/esm/fs.js"() {
515
472
  init_console_gjs();
516
- init_auto_globals_495e9d950c();
473
+ init_auto_globals_97a682e619();
517
474
  init_gio_2();
518
475
  init_giounix_2();
519
476
  }
@@ -524,7 +481,7 @@ var byteArray3;
524
481
  var init_gio = __esm({
525
482
  "../../../packages/gjs/utils/lib/esm/gio.js"() {
526
483
  init_console_gjs();
527
- init_auto_globals_495e9d950c();
484
+ init_auto_globals_97a682e619();
528
485
  init_glib_2();
529
486
  byteArray3 = imports.byteArray;
530
487
  }
@@ -534,7 +491,7 @@ var init_gio = __esm({
534
491
  var init_gio_errors = __esm({
535
492
  "../../../packages/gjs/utils/lib/esm/gio-errors.js"() {
536
493
  init_console_gjs();
537
- init_auto_globals_495e9d950c();
494
+ init_auto_globals_97a682e619();
538
495
  }
539
496
  });
540
497
 
@@ -543,7 +500,7 @@ var warnNotImplemented;
543
500
  var init_message = __esm({
544
501
  "../../../packages/gjs/utils/lib/esm/message.js"() {
545
502
  init_console_gjs();
546
- init_auto_globals_495e9d950c();
503
+ init_auto_globals_97a682e619();
547
504
  warnNotImplemented = (msg) => {
548
505
  const message = msg ? `Not implemented: ${msg}` : "Not implemented";
549
506
  console.warn(message);
@@ -552,15 +509,19 @@ var init_message = __esm({
552
509
  }
553
510
  });
554
511
 
512
+ // ../../../packages/gjs/utils/lib/esm/microtask.js
513
+ var init_microtask = __esm({
514
+ "../../../packages/gjs/utils/lib/esm/microtask.js"() {
515
+ init_console_gjs();
516
+ init_auto_globals_97a682e619();
517
+ }
518
+ });
519
+
555
520
  // ../../../packages/gjs/utils/lib/esm/next-tick.js
556
- var nextTick;
557
521
  var init_next_tick = __esm({
558
522
  "../../../packages/gjs/utils/lib/esm/next-tick.js"() {
559
523
  init_console_gjs();
560
- init_auto_globals_495e9d950c();
561
- nextTick = typeof globalThis.process?.nextTick === "function" ? globalThis.process.nextTick : typeof globalThis.queueMicrotask === "function" ? (fn, ...args) => queueMicrotask(() => fn(...args)) : (fn, ...args) => {
562
- Promise.resolve().then(() => fn(...args));
563
- };
524
+ init_auto_globals_97a682e619();
564
525
  }
565
526
  });
566
527
 
@@ -569,7 +530,7 @@ var File;
569
530
  var init_path = __esm({
570
531
  "../../../packages/gjs/utils/lib/esm/path.js"() {
571
532
  init_console_gjs();
572
- init_auto_globals_495e9d950c();
533
+ init_auto_globals_97a682e619();
573
534
  init_gio_2();
574
535
  init_glib_2();
575
536
  ({ File } = gio_2_default);
@@ -581,7 +542,7 @@ var toString;
581
542
  var init_structured_clone = __esm({
582
543
  "../../../packages/gjs/utils/lib/esm/structured-clone.js"() {
583
544
  init_console_gjs();
584
- init_auto_globals_495e9d950c();
545
+ init_auto_globals_97a682e619();
585
546
  ({ toString } = Object.prototype);
586
547
  }
587
548
  });
@@ -590,7 +551,7 @@ var init_structured_clone = __esm({
590
551
  var init_main_loop = __esm({
591
552
  "../../../packages/gjs/utils/lib/esm/main-loop.js"() {
592
553
  init_console_gjs();
593
- init_auto_globals_495e9d950c();
554
+ init_auto_globals_97a682e619();
594
555
  }
595
556
  });
596
557
 
@@ -598,7 +559,7 @@ var init_main_loop = __esm({
598
559
  var init_esm = __esm({
599
560
  "../../../packages/gjs/utils/lib/esm/index.js"() {
600
561
  init_console_gjs();
601
- init_auto_globals_495e9d950c();
562
+ init_auto_globals_97a682e619();
602
563
  init_callable();
603
564
  init_base64();
604
565
  init_byte_array();
@@ -612,6 +573,7 @@ var init_esm = __esm({
612
573
  init_gio();
613
574
  init_gio_errors();
614
575
  init_message();
576
+ init_microtask();
615
577
  init_next_tick();
616
578
  init_path();
617
579
  init_structured_clone();
@@ -624,7 +586,7 @@ var _encoder, BlobPolyfill, FilePolyfill, Blob2, File2;
624
586
  var init_blob = __esm({
625
587
  "../../../packages/node/buffer/lib/esm/blob.js"() {
626
588
  init_console_gjs();
627
- init_auto_globals_495e9d950c();
589
+ init_auto_globals_97a682e619();
628
590
  _encoder = new TextEncoder();
629
591
  BlobPolyfill = class _BlobPolyfill {
630
592
  _parts;
@@ -694,7 +656,7 @@ var init_blob = __esm({
694
656
  var init_register = __esm({
695
657
  "../../../packages/node/buffer/lib/esm/register.js"() {
696
658
  init_console_gjs();
697
- init_auto_globals_495e9d950c();
659
+ init_auto_globals_97a682e619();
698
660
  init_esm();
699
661
  init_blob();
700
662
  registerGlobal("Blob", Blob2);
@@ -796,7 +758,7 @@ var NAMED_COLORS, BLACK;
796
758
  var init_color = __esm({
797
759
  "../../../packages/dom/canvas2d-core/lib/esm/color.js"() {
798
760
  init_console_gjs();
799
- init_auto_globals_495e9d950c();
761
+ init_auto_globals_97a682e619();
800
762
  NAMED_COLORS = {
801
763
  aliceblue: "#f0f8ff",
802
764
  antiquewhite: "#faebd7",
@@ -1055,7 +1017,7 @@ var COMPOSITE_OP_MAP, LINE_CAP_MAP, LINE_JOIN_MAP;
1055
1017
  var init_cairo_utils = __esm({
1056
1018
  "../../../packages/dom/canvas2d-core/lib/esm/cairo-utils.js"() {
1057
1019
  init_console_gjs();
1058
- init_auto_globals_495e9d950c();
1020
+ init_auto_globals_97a682e619();
1059
1021
  COMPOSITE_OP_MAP = {
1060
1022
  "source-over": 2,
1061
1023
  // OVER
@@ -1161,7 +1123,7 @@ function cloneState(state) {
1161
1123
  var init_canvas_state = __esm({
1162
1124
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-state.js"() {
1163
1125
  init_console_gjs();
1164
- init_auto_globals_495e9d950c();
1126
+ init_auto_globals_97a682e619();
1165
1127
  init_color();
1166
1128
  }
1167
1129
  });
@@ -1171,7 +1133,7 @@ var OurImageData;
1171
1133
  var init_image_data = __esm({
1172
1134
  "../../../packages/dom/canvas2d-core/lib/esm/image-data.js"() {
1173
1135
  init_console_gjs();
1174
- init_auto_globals_495e9d950c();
1136
+ init_auto_globals_97a682e619();
1175
1137
  OurImageData = class {
1176
1138
  constructor(swOrData, sh, maybeHeight) {
1177
1139
  this.colorSpace = "srgb";
@@ -1200,7 +1162,7 @@ var CanvasGradient;
1200
1162
  var init_canvas_gradient = __esm({
1201
1163
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-gradient.js"() {
1202
1164
  init_console_gjs();
1203
- init_auto_globals_495e9d950c();
1165
+ init_auto_globals_97a682e619();
1204
1166
  init_color();
1205
1167
  CanvasGradient = class {
1206
1168
  constructor(type, x0, y0, x1, y1, r0, r1) {
@@ -1230,7 +1192,7 @@ var CanvasPattern;
1230
1192
  var init_canvas_pattern = __esm({
1231
1193
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-pattern.js"() {
1232
1194
  init_console_gjs();
1233
- init_auto_globals_495e9d950c();
1195
+ init_auto_globals_97a682e619();
1234
1196
  CanvasPattern = class _CanvasPattern {
1235
1197
  constructor(surface, repetition) {
1236
1198
  this._pattern = new Cairo2.SurfacePattern(surface);
@@ -1292,7 +1254,7 @@ var Path2D;
1292
1254
  var init_canvas_path = __esm({
1293
1255
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-path.js"() {
1294
1256
  init_console_gjs();
1295
- init_auto_globals_495e9d950c();
1257
+ init_auto_globals_97a682e619();
1296
1258
  init_cairo_utils();
1297
1259
  Path2D = class _Path2D {
1298
1260
  constructor(pathOrSvg) {
@@ -1406,7 +1368,7 @@ var CanvasRenderingContext2D;
1406
1368
  var init_canvas_rendering_context_2d = __esm({
1407
1369
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-rendering-context-2d.js"() {
1408
1370
  init_console_gjs();
1409
- init_auto_globals_495e9d950c();
1371
+ init_auto_globals_97a682e619();
1410
1372
  init_color();
1411
1373
  init_cairo_utils();
1412
1374
  init_canvas_state();
@@ -2393,7 +2355,7 @@ var init_canvas_rendering_context_2d = __esm({
2393
2355
  var init_esm2 = __esm({
2394
2356
  "../../../packages/dom/canvas2d-core/lib/esm/index.js"() {
2395
2357
  init_console_gjs();
2396
- init_auto_globals_495e9d950c();
2358
+ init_auto_globals_97a682e619();
2397
2359
  init_canvas_rendering_context_2d();
2398
2360
  init_canvas_gradient();
2399
2361
  init_canvas_pattern();
@@ -2408,7 +2370,7 @@ var DOMExceptionCodes, _DOMExceptionPolyfill, DOMException2;
2408
2370
  var init_esm3 = __esm({
2409
2371
  "../../../packages/web/dom-exception/lib/esm/index.js"() {
2410
2372
  init_console_gjs();
2411
- init_auto_globals_495e9d950c();
2373
+ init_auto_globals_97a682e619();
2412
2374
  DOMExceptionCodes = {
2413
2375
  IndexSizeError: 1,
2414
2376
  HierarchyRequestError: 3,
@@ -2450,7 +2412,7 @@ var kType, kBubbles, kCancelable, kComposed, kTarget, kCurrentTarget, kEventPhas
2450
2412
  var init_esm4 = __esm({
2451
2413
  "../../../packages/web/dom-events/lib/esm/index.js"() {
2452
2414
  init_console_gjs();
2453
- init_auto_globals_495e9d950c();
2415
+ init_auto_globals_97a682e619();
2454
2416
  init_esm3();
2455
2417
  kType = /* @__PURE__ */ Symbol("type");
2456
2418
  kBubbles = /* @__PURE__ */ Symbol("bubbles");
@@ -2642,7 +2604,7 @@ var init_esm4 = __esm({
2642
2604
  addEventListener(type, callback, options) {
2643
2605
  if (callback === null) return;
2644
2606
  const capture = typeof options === "boolean" ? options : options?.capture ?? false;
2645
- const once2 = typeof options === "object" ? options?.once ?? false : false;
2607
+ const once = typeof options === "object" ? options?.once ?? false : false;
2646
2608
  const passive = typeof options === "object" ? options?.passive ?? false : false;
2647
2609
  let list = this._listeners.get(type);
2648
2610
  if (!list) {
@@ -2652,7 +2614,7 @@ var init_esm4 = __esm({
2652
2614
  for (const entry2 of list) {
2653
2615
  if (entry2.listener === callback && entry2.capture === capture) return;
2654
2616
  }
2655
- const entry = { listener: callback, capture, once: once2, passive, removed: false };
2617
+ const entry = { listener: callback, capture, once, passive, removed: false };
2656
2618
  list.push(entry);
2657
2619
  if (typeof options === "object" && options?.signal) {
2658
2620
  options.signal.addEventListener("abort", () => {
@@ -2914,7 +2876,7 @@ var NodeType;
2914
2876
  var init_node_type = __esm({
2915
2877
  "../../../packages/dom/dom-elements/lib/esm/node-type.js"() {
2916
2878
  init_console_gjs();
2917
- init_auto_globals_495e9d950c();
2879
+ init_auto_globals_97a682e619();
2918
2880
  NodeType = {
2919
2881
  ELEMENT_NODE: 1,
2920
2882
  ATTRIBUTE_NODE: 2,
@@ -2934,7 +2896,7 @@ var NodeList;
2934
2896
  var init_node_list = __esm({
2935
2897
  "../../../packages/dom/dom-elements/lib/esm/node-list.js"() {
2936
2898
  init_console_gjs();
2937
- init_auto_globals_495e9d950c();
2899
+ init_auto_globals_97a682e619();
2938
2900
  NodeList = class {
2939
2901
  constructor(items) {
2940
2902
  this._items = items;
@@ -2974,7 +2936,7 @@ var nodeType, parentNode, childNodesList, elementChildren, isConnected, tagName,
2974
2936
  var init_property_symbol = __esm({
2975
2937
  "../../../packages/dom/dom-elements/lib/esm/property-symbol.js"() {
2976
2938
  init_console_gjs();
2977
- init_auto_globals_495e9d950c();
2939
+ init_auto_globals_97a682e619();
2978
2940
  nodeType = /* @__PURE__ */ Symbol("nodeType");
2979
2941
  parentNode = /* @__PURE__ */ Symbol("parentNode");
2980
2942
  childNodesList = /* @__PURE__ */ Symbol("childNodesList");
@@ -2997,7 +2959,7 @@ var _a, _b, _c, _d, _e, Node;
2997
2959
  var init_node = __esm({
2998
2960
  "../../../packages/dom/dom-elements/lib/esm/node.js"() {
2999
2961
  init_console_gjs();
3000
- init_auto_globals_495e9d950c();
2962
+ init_auto_globals_97a682e619();
3001
2963
  init_esm4();
3002
2964
  init_node_type();
3003
2965
  init_node_list();
@@ -3247,7 +3209,7 @@ var Attr;
3247
3209
  var init_attr = __esm({
3248
3210
  "../../../packages/dom/dom-elements/lib/esm/attr.js"() {
3249
3211
  init_console_gjs();
3250
- init_auto_globals_495e9d950c();
3212
+ init_auto_globals_97a682e619();
3251
3213
  init_property_symbol();
3252
3214
  Attr = class {
3253
3215
  constructor(name2, value2, namespaceURI2 = null, prefix2 = null, ownerElement2 = null) {
@@ -3284,7 +3246,7 @@ var NamespaceURI;
3284
3246
  var init_namespace_uri = __esm({
3285
3247
  "../../../packages/dom/dom-elements/lib/esm/namespace-uri.js"() {
3286
3248
  init_console_gjs();
3287
- init_auto_globals_495e9d950c();
3249
+ init_auto_globals_97a682e619();
3288
3250
  NamespaceURI = {
3289
3251
  html: "http://www.w3.org/1999/xhtml",
3290
3252
  svg: "http://www.w3.org/2000/svg",
@@ -3300,7 +3262,7 @@ var NamedNodeMap;
3300
3262
  var init_named_node_map = __esm({
3301
3263
  "../../../packages/dom/dom-elements/lib/esm/named-node-map.js"() {
3302
3264
  init_console_gjs();
3303
- init_auto_globals_495e9d950c();
3265
+ init_auto_globals_97a682e619();
3304
3266
  init_attr();
3305
3267
  init_namespace_uri();
3306
3268
  NamedNodeMap = class {
@@ -3430,7 +3392,7 @@ var _a2, _b2, _c2, _d2, _e2, _f, Element;
3430
3392
  var init_element = __esm({
3431
3393
  "../../../packages/dom/dom-elements/lib/esm/element.js"() {
3432
3394
  init_console_gjs();
3433
- init_auto_globals_495e9d950c();
3395
+ init_auto_globals_97a682e619();
3434
3396
  init_node();
3435
3397
  init_node_type();
3436
3398
  init_named_node_map();
@@ -3682,7 +3644,7 @@ var CSSStyleDeclaration, HTMLElement;
3682
3644
  var init_html_element = __esm({
3683
3645
  "../../../packages/dom/dom-elements/lib/esm/html-element.js"() {
3684
3646
  init_console_gjs();
3685
- init_auto_globals_495e9d950c();
3647
+ init_auto_globals_97a682e619();
3686
3648
  init_esm4();
3687
3649
  init_element();
3688
3650
  init_property_symbol();
@@ -4112,7 +4074,7 @@ var HTMLCanvasElement2;
4112
4074
  var init_html_canvas_element = __esm({
4113
4075
  "../../../packages/dom/dom-elements/lib/esm/html-canvas-element.js"() {
4114
4076
  init_console_gjs();
4115
- init_auto_globals_495e9d950c();
4077
+ init_auto_globals_97a682e619();
4116
4078
  init_html_element();
4117
4079
  HTMLCanvasElement2 = class _HTMLCanvasElement extends HTMLElement {
4118
4080
  constructor() {
@@ -4192,7 +4154,7 @@ var DOMMatrix, DOMMatrixReadOnly;
4192
4154
  var init_dom_matrix = __esm({
4193
4155
  "../../../packages/dom/dom-elements/lib/esm/dom-matrix.js"() {
4194
4156
  init_console_gjs();
4195
- init_auto_globals_495e9d950c();
4157
+ init_auto_globals_97a682e619();
4196
4158
  DOMMatrix = class _DOMMatrix {
4197
4159
  constructor(init) {
4198
4160
  this.a = 1;
@@ -4330,7 +4292,7 @@ function defineGlobalIfMissing(name2, value2) {
4330
4292
  var init_helpers = __esm({
4331
4293
  "../../../packages/dom/dom-elements/lib/esm/register/helpers.js"() {
4332
4294
  init_console_gjs();
4333
- init_auto_globals_495e9d950c();
4295
+ init_auto_globals_97a682e619();
4334
4296
  }
4335
4297
  });
4336
4298
 
@@ -4339,7 +4301,7 @@ var CANVAS2D_KEY;
4339
4301
  var init_canvas = __esm({
4340
4302
  "../../../packages/dom/dom-elements/lib/esm/register/canvas.js"() {
4341
4303
  init_console_gjs();
4342
- init_auto_globals_495e9d950c();
4304
+ init_auto_globals_97a682e619();
4343
4305
  init_esm2();
4344
4306
  init_html_canvas_element();
4345
4307
  init_dom_matrix();
@@ -4364,7 +4326,7 @@ var CharacterData;
4364
4326
  var init_character_data = __esm({
4365
4327
  "../../../packages/dom/dom-elements/lib/esm/character-data.js"() {
4366
4328
  init_console_gjs();
4367
- init_auto_globals_495e9d950c();
4329
+ init_auto_globals_97a682e619();
4368
4330
  init_node();
4369
4331
  init_node_type();
4370
4332
  init_property_symbol();
@@ -4426,7 +4388,7 @@ var Comment;
4426
4388
  var init_comment = __esm({
4427
4389
  "../../../packages/dom/dom-elements/lib/esm/comment.js"() {
4428
4390
  init_console_gjs();
4429
- init_auto_globals_495e9d950c();
4391
+ init_auto_globals_97a682e619();
4430
4392
  init_character_data();
4431
4393
  init_node_type();
4432
4394
  init_property_symbol();
@@ -4454,7 +4416,7 @@ var gdkpixbuf_2_0_default;
4454
4416
  var init_gdkpixbuf_2_0 = __esm({
4455
4417
  "../../../node_modules/@girs/gdkpixbuf-2.0/gdkpixbuf-2.0.js"() {
4456
4418
  init_console_gjs();
4457
- init_auto_globals_495e9d950c();
4419
+ init_auto_globals_97a682e619();
4458
4420
  gdkpixbuf_2_0_default = GdkPixbuf2;
4459
4421
  }
4460
4422
  });
@@ -4464,7 +4426,7 @@ var gdkpixbuf_2_default;
4464
4426
  var init_gdkpixbuf_2 = __esm({
4465
4427
  "../../../node_modules/@girs/gdkpixbuf-2.0/index.js"() {
4466
4428
  init_console_gjs();
4467
- init_auto_globals_495e9d950c();
4429
+ init_auto_globals_97a682e619();
4468
4430
  init_gdkpixbuf_2_0();
4469
4431
  gdkpixbuf_2_default = gdkpixbuf_2_0_default;
4470
4432
  }
@@ -4476,7 +4438,7 @@ var HTMLImageElement2;
4476
4438
  var init_html_image_element = __esm({
4477
4439
  "../../../packages/dom/dom-elements/lib/esm/html-image-element.js"() {
4478
4440
  init_console_gjs();
4479
- init_auto_globals_495e9d950c();
4441
+ init_auto_globals_97a682e619();
4480
4442
  init_glib_2();
4481
4443
  init_gio_2();
4482
4444
  init_gdkpixbuf_2();
@@ -4711,7 +4673,7 @@ var HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUG
4711
4673
  var init_html_media_element = __esm({
4712
4674
  "../../../packages/dom/dom-elements/lib/esm/html-media-element.js"() {
4713
4675
  init_console_gjs();
4714
- init_auto_globals_495e9d950c();
4676
+ init_auto_globals_97a682e619();
4715
4677
  init_esm4();
4716
4678
  init_html_element();
4717
4679
  HAVE_NOTHING = 0;
@@ -4824,33 +4786,129 @@ var init_html_media_element = __esm({
4824
4786
  }
4825
4787
  });
4826
4788
 
4789
+ // ../../../packages/dom/dom-elements/lib/esm/gst-time.js
4790
+ function secondsToGstTime(seconds) {
4791
+ return BigInt(Math.round(seconds * NS_PER_SECOND));
4792
+ }
4793
+ function gstTimeToSeconds(nanoseconds) {
4794
+ return Number(nanoseconds) / NS_PER_SECOND;
4795
+ }
4796
+ var NS_PER_SECOND;
4797
+ var init_gst_time = __esm({
4798
+ "../../../packages/dom/dom-elements/lib/esm/gst-time.js"() {
4799
+ init_console_gjs();
4800
+ init_auto_globals_97a682e619();
4801
+ NS_PER_SECOND = 1e9;
4802
+ }
4803
+ });
4804
+
4827
4805
  // ../../../packages/dom/dom-elements/lib/esm/html-video-element.js
4828
- var HTMLVideoElement2;
4806
+ var GST_STATE_PLAYING, GST_STATE_PAUSED, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_TYPE_SET, GST_SEEK_TYPE_NONE, HTMLVideoElement2;
4829
4807
  var init_html_video_element = __esm({
4830
4808
  "../../../packages/dom/dom-elements/lib/esm/html-video-element.js"() {
4831
4809
  init_console_gjs();
4832
- init_auto_globals_495e9d950c();
4810
+ init_auto_globals_97a682e619();
4833
4811
  init_html_media_element();
4812
+ init_esm4();
4834
4813
  init_property_symbol();
4835
4814
  init_namespace_uri();
4815
+ init_gst_time();
4816
+ GST_STATE_PLAYING = 4;
4817
+ GST_STATE_PAUSED = 3;
4818
+ GST_FORMAT_TIME = 3;
4819
+ GST_SEEK_FLAG_FLUSH = 1;
4820
+ GST_SEEK_FLAG_KEY_UNIT = 4;
4821
+ GST_SEEK_TYPE_SET = 1;
4822
+ GST_SEEK_TYPE_NONE = 0;
4836
4823
  HTMLVideoElement2 = class extends HTMLMediaElement {
4837
4824
  constructor() {
4838
4825
  super();
4826
+ this._pipeline = null;
4839
4827
  this._videoWidth = 0;
4840
4828
  this._videoHeight = 0;
4841
4829
  this.poster = "";
4842
4830
  this[tagName] = "VIDEO";
4843
4831
  this[localName] = "video";
4844
4832
  this[namespaceURI] = NamespaceURI.html;
4833
+ const self2 = this;
4834
+ Object.defineProperty(this, "paused", {
4835
+ get() {
4836
+ if (!self2._pipeline) return true;
4837
+ const [, state] = self2._pipeline.get_state(0n);
4838
+ return state !== GST_STATE_PLAYING;
4839
+ },
4840
+ configurable: true,
4841
+ enumerable: true
4842
+ });
4843
+ Object.defineProperty(this, "currentTime", {
4844
+ get() {
4845
+ if (!self2._pipeline) return 0;
4846
+ const [ok, pos] = self2._pipeline.query_position(GST_FORMAT_TIME);
4847
+ return ok ? gstTimeToSeconds(pos) : 0;
4848
+ },
4849
+ set(seconds) {
4850
+ self2._pipeline?.seek(
4851
+ 1,
4852
+ GST_FORMAT_TIME,
4853
+ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
4854
+ GST_SEEK_TYPE_SET,
4855
+ secondsToGstTime(seconds),
4856
+ GST_SEEK_TYPE_NONE,
4857
+ -1n
4858
+ );
4859
+ },
4860
+ configurable: true,
4861
+ enumerable: true
4862
+ });
4863
+ Object.defineProperty(this, "duration", {
4864
+ get() {
4865
+ if (!self2._pipeline) return NaN;
4866
+ const [ok, dur] = self2._pipeline.query_duration(GST_FORMAT_TIME);
4867
+ return ok && Number(dur) > 0 ? gstTimeToSeconds(dur) : NaN;
4868
+ },
4869
+ configurable: true,
4870
+ enumerable: true
4871
+ });
4872
+ Object.defineProperty(this, "volume", {
4873
+ get() {
4874
+ return self2._playbin()?.volume ?? 1;
4875
+ },
4876
+ set(v) {
4877
+ const pb = self2._playbin();
4878
+ if (pb) pb.volume = Math.max(0, Math.min(1, v));
4879
+ },
4880
+ configurable: true,
4881
+ enumerable: true
4882
+ });
4883
+ Object.defineProperty(this, "muted", {
4884
+ get() {
4885
+ return self2._playbin()?.mute ?? false;
4886
+ },
4887
+ set(v) {
4888
+ const pb = self2._playbin();
4889
+ if (pb) pb.mute = v;
4890
+ },
4891
+ configurable: true,
4892
+ enumerable: true
4893
+ });
4894
+ }
4895
+ async play() {
4896
+ this._pipeline?.set_state(GST_STATE_PLAYING);
4897
+ this.dispatchEvent(new Event("play"));
4898
+ this.dispatchEvent(new Event("playing"));
4899
+ }
4900
+ pause() {
4901
+ this._pipeline?.set_state(GST_STATE_PAUSED);
4902
+ this.dispatchEvent(new Event("pause"));
4845
4903
  }
4846
- /** Intrinsic width of the video (set by the bridge when media metadata loads). */
4904
+ /** Intrinsic width of the video (set by bridge when media metadata loads). */
4847
4905
  get videoWidth() {
4848
4906
  return this._videoWidth;
4849
4907
  }
4850
4908
  set videoWidth(value2) {
4851
4909
  this._videoWidth = value2;
4852
4910
  }
4853
- /** Intrinsic height of the video (set by the bridge when media metadata loads). */
4911
+ /** Intrinsic height of the video (set by bridge when media metadata loads). */
4854
4912
  get videoHeight() {
4855
4913
  return this._videoHeight;
4856
4914
  }
@@ -4860,6 +4918,9 @@ var init_html_video_element = __esm({
4860
4918
  get [Symbol.toStringTag]() {
4861
4919
  return "HTMLVideoElement";
4862
4920
  }
4921
+ _playbin() {
4922
+ return this._pipeline?.get_by_name("playbin") ?? null;
4923
+ }
4863
4924
  };
4864
4925
  }
4865
4926
  });
@@ -4869,7 +4930,7 @@ var Text;
4869
4930
  var init_text = __esm({
4870
4931
  "../../../packages/dom/dom-elements/lib/esm/text.js"() {
4871
4932
  init_console_gjs();
4872
- init_auto_globals_495e9d950c();
4933
+ init_auto_globals_97a682e619();
4873
4934
  init_character_data();
4874
4935
  init_node_type();
4875
4936
  init_property_symbol();
@@ -4926,7 +4987,7 @@ var DocumentFragment;
4926
4987
  var init_document_fragment = __esm({
4927
4988
  "../../../packages/dom/dom-elements/lib/esm/document-fragment.js"() {
4928
4989
  init_console_gjs();
4929
- init_auto_globals_495e9d950c();
4990
+ init_auto_globals_97a682e619();
4930
4991
  init_node();
4931
4992
  init_text();
4932
4993
  init_node_type();
@@ -5044,7 +5105,7 @@ var Document, document2;
5044
5105
  var init_document = __esm({
5045
5106
  "../../../packages/dom/dom-elements/lib/esm/document.js"() {
5046
5107
  init_console_gjs();
5047
- init_auto_globals_495e9d950c();
5108
+ init_auto_globals_97a682e619();
5048
5109
  init_node();
5049
5110
  init_html_element();
5050
5111
  init_html_image_element();
@@ -5133,7 +5194,7 @@ var DOMTokenList;
5133
5194
  var init_dom_token_list = __esm({
5134
5195
  "../../../packages/dom/dom-elements/lib/esm/dom-token-list.js"() {
5135
5196
  init_console_gjs();
5136
- init_auto_globals_495e9d950c();
5197
+ init_auto_globals_97a682e619();
5137
5198
  DOMTokenList = class {
5138
5199
  constructor(ownerElement2, attributeName) {
5139
5200
  this._ownerElement = ownerElement2;
@@ -5248,7 +5309,7 @@ var Window;
5248
5309
  var init_document2 = __esm({
5249
5310
  "../../../packages/dom/dom-elements/lib/esm/register/document.js"() {
5250
5311
  init_console_gjs();
5251
- init_auto_globals_495e9d950c();
5312
+ init_auto_globals_97a682e619();
5252
5313
  init_esm4();
5253
5314
  init_comment();
5254
5315
  init_document();
@@ -5297,7 +5358,7 @@ var Image;
5297
5358
  var init_image = __esm({
5298
5359
  "../../../packages/dom/dom-elements/lib/esm/image.js"() {
5299
5360
  init_console_gjs();
5300
- init_auto_globals_495e9d950c();
5361
+ init_auto_globals_97a682e619();
5301
5362
  init_html_image_element();
5302
5363
  Image = class extends HTMLImageElement2 {
5303
5364
  /**
@@ -5323,7 +5384,7 @@ var init_image = __esm({
5323
5384
  var init_image2 = __esm({
5324
5385
  "../../../packages/dom/dom-elements/lib/esm/register/image.js"() {
5325
5386
  init_console_gjs();
5326
- init_auto_globals_495e9d950c();
5387
+ init_auto_globals_97a682e619();
5327
5388
  init_html_image_element();
5328
5389
  init_image();
5329
5390
  init_helpers();
@@ -5336,7 +5397,7 @@ var init_image2 = __esm({
5336
5397
  var init_navigator = __esm({
5337
5398
  "../../../packages/dom/dom-elements/lib/esm/register/navigator.js"() {
5338
5399
  init_console_gjs();
5339
- init_auto_globals_495e9d950c();
5400
+ init_auto_globals_97a682e619();
5340
5401
  if (typeof globalThis.navigator === "undefined") {
5341
5402
  globalThis.navigator = {};
5342
5403
  }
@@ -5451,7 +5512,7 @@ var textEncoder, textDecoder, hasSharedArrayBuffer, Buffer2, kMaxLength, kString
5451
5512
  var init_buffer = __esm({
5452
5513
  "../../../packages/node/buffer/lib/esm/buffer.js"() {
5453
5514
  init_console_gjs();
5454
- init_auto_globals_495e9d950c();
5515
+ init_auto_globals_97a682e619();
5455
5516
  init_esm();
5456
5517
  textEncoder = new TextEncoder();
5457
5518
  textDecoder = new TextDecoder();
@@ -6004,7 +6065,7 @@ var atob2, btoa;
6004
6065
  var init_esm5 = __esm({
6005
6066
  "../../../packages/node/buffer/lib/esm/index.js"() {
6006
6067
  init_console_gjs();
6007
- init_auto_globals_495e9d950c();
6068
+ init_auto_globals_97a682e619();
6008
6069
  init_buffer();
6009
6070
  atob2 = globalThis.atob;
6010
6071
  btoa = globalThis.btoa;
@@ -6015,7 +6076,7 @@ var init_esm5 = __esm({
6015
6076
  var init_buffer2 = __esm({
6016
6077
  "../../../packages/node/globals/lib/esm/register/buffer.js"() {
6017
6078
  init_console_gjs();
6018
- init_auto_globals_495e9d950c();
6079
+ init_auto_globals_97a682e619();
6019
6080
  init_esm5();
6020
6081
  init_register();
6021
6082
  if (!("Buffer" in globalThis)) {
@@ -6033,7 +6094,7 @@ var init_buffer2 = __esm({
6033
6094
  var init_encoding2 = __esm({
6034
6095
  "../../../packages/node/globals/lib/esm/register/encoding.js"() {
6035
6096
  init_console_gjs();
6036
- init_auto_globals_495e9d950c();
6097
+ init_auto_globals_97a682e619();
6037
6098
  init_glib_2();
6038
6099
  if (typeof globalThis.btoa !== "function") {
6039
6100
  Object.defineProperty(globalThis, "btoa", {
@@ -6067,1121 +6128,115 @@ var init_encoding2 = __esm({
6067
6128
  }
6068
6129
  });
6069
6130
 
6070
- // ../../../packages/node/globals/lib/esm/register/microtask.js
6071
- var init_microtask = __esm({
6072
- "../../../packages/node/globals/lib/esm/register/microtask.js"() {
6073
- init_console_gjs();
6074
- init_auto_globals_495e9d950c();
6075
- if (typeof queueMicrotask !== "function") {
6076
- Object.defineProperty(globalThis, "queueMicrotask", {
6077
- value: function queueMicrotask2(callback) {
6078
- Promise.resolve().then(callback).catch((err) => {
6079
- setTimeout(() => {
6080
- throw err;
6081
- }, 0);
6082
- });
6083
- },
6084
- enumerable: true,
6085
- writable: true,
6086
- configurable: true
6087
- });
6088
- }
6089
- }
6090
- });
6091
-
6092
- // ../../../packages/node/events/lib/esm/event-emitter.js
6093
- function onceWrapper() {
6094
- const { target, type, listener } = this;
6095
- if (this.wrapperFn) target.removeListener(type, this.wrapperFn);
6096
- const result = listener.apply(target, arguments);
6097
- return result;
6098
- }
6099
- function _onceWrap(target, type, listener) {
6100
- const state = { target, type, listener, wrapperFn: void 0 };
6101
- const wrapped = onceWrapper.bind(state);
6102
- state.wrapperFn = wrapped;
6103
- wrapped.listener = listener;
6104
- return wrapped;
6131
+ // ../../../packages/node/globals/lib/esm/register/timers.js
6132
+ function getGLib() {
6133
+ return globalThis.imports?.gi?.GLib;
6105
6134
  }
6106
- function arrayClone(arr) {
6107
- switch (arr.length) {
6108
- case 0:
6109
- return [];
6110
- case 1:
6111
- return [arr[0]];
6112
- case 2:
6113
- return [arr[0], arr[1]];
6114
- case 3:
6115
- return [arr[0], arr[1], arr[2]];
6116
- default:
6117
- return arr.slice();
6118
- }
6119
- }
6120
- function checkListener(listener) {
6121
- if (typeof listener !== "function") {
6122
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
6123
- }
6124
- }
6125
- function validateNumber(value2, name2) {
6126
- if (typeof value2 !== "number" || value2 !== value2) {
6127
- throw new TypeError(`The "${name2}" argument must be of type number. Received type ${typeof value2}`);
6128
- }
6129
- }
6130
- function spliceOne(list, index) {
6131
- for (; index + 1 < list.length; index++) {
6132
- list[index] = list[index + 1];
6135
+ function removeById(timeout) {
6136
+ if (timeout instanceof GjsifyTimeout) {
6137
+ timeout._cancel();
6138
+ } else if (typeof timeout === "number") {
6139
+ try {
6140
+ getGLib()?.Source.remove(timeout);
6141
+ } catch {
6142
+ }
6133
6143
  }
6134
- list.pop();
6135
6144
  }
6136
- function unwrapListeners(arr) {
6137
- const ret = new Array(arr.length);
6138
- for (let i = 0; i < ret.length; ++i) {
6139
- ret[i] = arr[i].listener ?? arr[i];
6140
- }
6141
- return ret;
6145
+ function setImmediate(callback, ...args) {
6146
+ return setTimeout(callback, 0, ...args);
6142
6147
  }
6143
- function createAbortError(signal) {
6144
- const err = new Error("The operation was aborted");
6145
- err.name = "AbortError";
6146
- err.code = "ABORT_ERR";
6147
- if (signal?.reason) {
6148
- err.cause = signal.reason;
6149
- }
6150
- return err;
6148
+ function clearImmediate(id) {
6149
+ clearTimeout(id);
6151
6150
  }
6152
- var kCapture, kRejection, EventEmitter;
6153
- var init_event_emitter = __esm({
6154
- "../../../packages/node/events/lib/esm/event-emitter.js"() {
6151
+ var _isGjsTimer, GjsifyTimeout;
6152
+ var init_timers = __esm({
6153
+ "../../../packages/node/globals/lib/esm/register/timers.js"() {
6155
6154
  init_console_gjs();
6156
- init_auto_globals_495e9d950c();
6157
- kCapture = /* @__PURE__ */ Symbol("kCapture");
6158
- kRejection = /* @__PURE__ */ Symbol.for("nodejs.rejection");
6159
- EventEmitter = class _EventEmitter {
6160
- static defaultMaxListeners = 10;
6161
- static errorMonitor = /* @__PURE__ */ Symbol("events.errorMonitor");
6162
- static captureRejectionSymbol = kRejection;
6163
- static _captureRejections = false;
6164
- static get captureRejections() {
6165
- return _EventEmitter._captureRejections;
6166
- }
6167
- static set captureRejections(value2) {
6168
- if (typeof value2 !== "boolean") {
6169
- throw new TypeError('The "captureRejections" argument must be of type boolean.');
6170
- }
6171
- _EventEmitter._captureRejections = value2;
6172
- }
6173
- _events;
6174
- _eventsCount;
6175
- _maxListeners;
6176
- [kCapture];
6177
- constructor(opts) {
6178
- this._events = /* @__PURE__ */ Object.create(null);
6179
- this._eventsCount = 0;
6180
- this._maxListeners = void 0;
6181
- this[kCapture] = opts?.captureRejections ?? _EventEmitter._captureRejections;
6182
- }
6183
- setMaxListeners(n) {
6184
- validateNumber(n, "n");
6185
- if (n < 0) {
6186
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n);
6187
- }
6188
- this._maxListeners = n;
6189
- return this;
6190
- }
6191
- getMaxListeners() {
6192
- return this._maxListeners ?? _EventEmitter.defaultMaxListeners;
6193
- }
6194
- emit(type, ...args) {
6195
- const events = this._events;
6196
- let doError = type === "error";
6197
- if (events !== void 0) {
6198
- if (doError && events[_EventEmitter.errorMonitor] !== void 0) {
6199
- this.emit(_EventEmitter.errorMonitor, ...args);
6200
- }
6201
- doError = doError && events.error === void 0;
6202
- } else if (!doError) {
6203
- return false;
6204
- }
6205
- if (doError) {
6206
- let er;
6207
- if (args.length > 0) {
6208
- er = args[0];
6209
- } else {
6210
- er = new Error("Unhandled error.");
6211
- }
6212
- if (er instanceof Error) {
6213
- throw er;
6214
- }
6215
- const err = new Error("Unhandled error. (" + er + ")");
6216
- err.context = er;
6217
- throw err;
6218
- }
6219
- const handler = events[type];
6220
- if (handler === void 0) {
6221
- return false;
6222
- }
6223
- if (typeof handler === "function") {
6224
- const result = handler.apply(this, args);
6225
- if (result !== void 0 && result !== null && this[kCapture]) {
6226
- this._addCatch(result, type, args);
6227
- }
6228
- } else {
6229
- const listeners = arrayClone(handler);
6230
- const len = listeners.length;
6231
- for (let i = 0; i < len; ++i) {
6232
- const result = listeners[i].apply(this, args);
6233
- if (result !== void 0 && result !== null && this[kCapture]) {
6234
- this._addCatch(result, type, args);
6235
- }
6236
- }
6237
- }
6238
- return true;
6239
- }
6240
- _addCatch(result, type, args) {
6241
- if (typeof result?.then === "function") {
6242
- result.then(void 0, (err) => {
6243
- const handler = this[kRejection];
6244
- if (typeof handler === "function") {
6245
- handler.call(this, err, type, ...args);
6246
- } else {
6247
- const prev = this[kCapture];
6248
- try {
6249
- this[kCapture] = false;
6250
- this.emit("error", err);
6251
- } finally {
6252
- this[kCapture] = prev;
6253
- }
6254
- }
6255
- });
6256
- }
6257
- }
6258
- addListener(type, listener) {
6259
- return this._addListener(type, listener, false);
6260
- }
6261
- on(type, listener) {
6262
- return this._addListener(type, listener, false);
6263
- }
6264
- prependListener(type, listener) {
6265
- return this._addListener(type, listener, true);
6266
- }
6267
- _addListener(type, listener, prepend) {
6268
- checkListener(listener);
6269
- let events = this._events;
6270
- if (events === void 0) {
6271
- events = this._events = /* @__PURE__ */ Object.create(null);
6272
- this._eventsCount = 0;
6273
- } else if (events.newListener !== void 0) {
6274
- this.emit("newListener", type, listener.listener ?? listener);
6275
- events = this._events;
6276
- }
6277
- let existing = events[type];
6278
- if (existing === void 0) {
6279
- events[type] = listener;
6280
- ++this._eventsCount;
6281
- } else if (typeof existing === "function") {
6282
- events[type] = prepend ? [listener, existing] : [existing, listener];
6283
- } else {
6284
- if (prepend) {
6285
- existing.unshift(listener);
6286
- } else {
6287
- existing.push(listener);
6288
- }
6289
- }
6290
- const m = this.getMaxListeners();
6291
- if (m > 0) {
6292
- const count2 = typeof events[type] === "function" ? 1 : events[type].length;
6293
- if (count2 > m && !events[type].warned) {
6294
- if (typeof events[type] !== "function") {
6295
- events[type].warned = true;
6296
- }
6297
- const w = new Error(
6298
- `Possible EventEmitter memory leak detected. ${count2} ${String(type)} listeners added to [${this.constructor.name}]. Use emitter.setMaxListeners() to increase limit`
6299
- );
6300
- w.name = "MaxListenersExceededWarning";
6301
- console.warn(w.message);
6155
+ init_auto_globals_97a682e619();
6156
+ _isGjsTimer = getGLib() !== void 0;
6157
+ GjsifyTimeout = class {
6158
+ _id = null;
6159
+ _refed = true;
6160
+ _callback;
6161
+ _delay;
6162
+ _args;
6163
+ _repeat;
6164
+ constructor(callback, delay, args, repeat) {
6165
+ this._callback = callback;
6166
+ this._delay = delay;
6167
+ this._args = args;
6168
+ this._repeat = repeat;
6169
+ this._schedule();
6170
+ }
6171
+ _schedule() {
6172
+ const GLib3 = getGLib();
6173
+ if (!GLib3) return;
6174
+ const timeoutAdd = GLib3.timeout_add.bind(GLib3);
6175
+ this._id = timeoutAdd(GLib3.PRIORITY_DEFAULT, this._delay, () => {
6176
+ try {
6177
+ this._callback.apply(globalThis, this._args);
6178
+ } catch (err) {
6179
+ setTimeout(() => {
6180
+ throw err;
6181
+ }, 0);
6302
6182
  }
6303
- }
6304
- return this;
6305
- }
6306
- once(type, listener) {
6307
- checkListener(listener);
6308
- this.on(type, _onceWrap(this, type, listener));
6309
- return this;
6183
+ if (this._repeat) return GLib3.SOURCE_CONTINUE;
6184
+ this._id = null;
6185
+ return GLib3.SOURCE_REMOVE;
6186
+ });
6310
6187
  }
6311
- prependOnceListener(type, listener) {
6312
- checkListener(listener);
6313
- this.prependListener(type, _onceWrap(this, type, listener));
6188
+ ref() {
6189
+ this._refed = true;
6314
6190
  return this;
6315
6191
  }
6316
- removeListener(type, listener) {
6317
- checkListener(listener);
6318
- const events = this._events;
6319
- if (events === void 0) {
6320
- return this;
6321
- }
6322
- const list = events[type];
6323
- if (list === void 0) {
6324
- return this;
6325
- }
6326
- if (list === listener || list.listener === listener) {
6327
- if (--this._eventsCount === 0) {
6328
- this._events = /* @__PURE__ */ Object.create(null);
6329
- } else {
6330
- delete events[type];
6331
- if (events.removeListener) {
6332
- this.emit("removeListener", type, list.listener ?? listener);
6333
- }
6334
- }
6335
- } else if (typeof list !== "function") {
6336
- let position = -1;
6337
- for (let i = list.length - 1; i >= 0; i--) {
6338
- if (list[i] === listener || list[i].listener === listener) {
6339
- position = i;
6340
- break;
6341
- }
6342
- }
6343
- if (position < 0) {
6344
- return this;
6345
- }
6346
- if (position === 0) {
6347
- list.shift();
6348
- } else {
6349
- spliceOne(list, position);
6350
- }
6351
- if (list.length === 1) {
6352
- events[type] = list[0];
6353
- }
6354
- if (events.removeListener !== void 0) {
6355
- this.emit("removeListener", type, listener.listener ?? listener);
6356
- }
6357
- }
6192
+ unref() {
6193
+ this._refed = false;
6358
6194
  return this;
6359
6195
  }
6360
- off(type, listener) {
6361
- return this.removeListener(type, listener);
6196
+ hasRef() {
6197
+ return this._refed;
6362
6198
  }
6363
- removeAllListeners(type) {
6364
- const events = this._events;
6365
- if (events === void 0) {
6366
- return this;
6367
- }
6368
- if (events.removeListener === void 0) {
6369
- if (arguments.length === 0) {
6370
- this._events = /* @__PURE__ */ Object.create(null);
6371
- this._eventsCount = 0;
6372
- } else if (events[type] !== void 0) {
6373
- if (--this._eventsCount === 0) {
6374
- this._events = /* @__PURE__ */ Object.create(null);
6375
- } else {
6376
- delete events[type];
6377
- }
6378
- }
6379
- return this;
6380
- }
6381
- if (arguments.length === 0) {
6382
- const keys = Object.keys(events);
6383
- for (let i = 0; i < keys.length; ++i) {
6384
- const key = keys[i];
6385
- if (key === "removeListener") continue;
6386
- this.removeAllListeners(key);
6387
- }
6388
- this.removeAllListeners("removeListener");
6389
- this._events = /* @__PURE__ */ Object.create(null);
6390
- this._eventsCount = 0;
6391
- return this;
6392
- }
6393
- const listeners = events[type];
6394
- if (typeof listeners === "function") {
6395
- this.removeListener(type, listeners);
6396
- } else if (listeners !== void 0) {
6397
- for (let i = listeners.length - 1; i >= 0; i--) {
6398
- this.removeListener(type, listeners[i]);
6399
- }
6400
- }
6199
+ refresh() {
6200
+ this._cancel();
6201
+ this._schedule();
6401
6202
  return this;
6402
6203
  }
6403
- listeners(type) {
6404
- const events = this._events;
6405
- if (events === void 0) {
6406
- return [];
6407
- }
6408
- const evlistener = events[type];
6409
- if (evlistener === void 0) {
6410
- return [];
6411
- }
6412
- if (typeof evlistener === "function") {
6413
- return [evlistener.listener ?? evlistener];
6414
- }
6415
- return unwrapListeners(evlistener);
6416
- }
6417
- rawListeners(type) {
6418
- const events = this._events;
6419
- if (events === void 0) {
6420
- return [];
6421
- }
6422
- const evlistener = events[type];
6423
- if (evlistener === void 0) {
6424
- return [];
6425
- }
6426
- if (typeof evlistener === "function") {
6427
- return [evlistener];
6428
- }
6429
- return arrayClone(evlistener);
6430
- }
6431
- listenerCount(type) {
6432
- const events = this._events;
6433
- if (events === void 0) {
6434
- return 0;
6435
- }
6436
- const evlistener = events[type];
6437
- if (evlistener === void 0) {
6438
- return 0;
6439
- }
6440
- if (typeof evlistener === "function") {
6441
- return 1;
6442
- }
6443
- return evlistener.length;
6444
- }
6445
- eventNames() {
6446
- return (this._eventsCount ?? 0) > 0 ? Reflect.ownKeys(this._events) : [];
6447
- }
6448
- // -- Static methods --
6449
- /**
6450
- * Returns a promise that resolves when the emitter emits the given event,
6451
- * or rejects if the emitter emits 'error' while waiting.
6452
- */
6453
- static once(emitter, name2, options) {
6454
- return new Promise((resolve, reject) => {
6455
- const signal = options?.signal;
6456
- if (signal?.aborted) {
6457
- reject(createAbortError(signal));
6458
- return;
6459
- }
6460
- if (typeof emitter.addEventListener === "function") {
6461
- const eventTarget = emitter;
6462
- const handler = (...args) => {
6463
- if (signal) {
6464
- signal.removeEventListener("abort", abortHandler2);
6465
- }
6466
- resolve(args);
6467
- };
6468
- const errorHandler2 = (err) => {
6469
- if (signal) {
6470
- signal.removeEventListener("abort", abortHandler2);
6471
- }
6472
- eventTarget.removeEventListener("error", errorHandler2);
6473
- reject(err);
6474
- };
6475
- const abortHandler2 = () => {
6476
- eventTarget.removeEventListener(name2, handler);
6477
- eventTarget.removeEventListener("error", errorHandler2);
6478
- reject(createAbortError(signal));
6479
- };
6480
- eventTarget.addEventListener(name2, handler, { once: true });
6481
- if (name2 !== "error") {
6482
- eventTarget.addEventListener("error", errorHandler2, { once: true });
6483
- }
6484
- if (signal) {
6485
- signal.addEventListener("abort", abortHandler2, { once: true });
6486
- }
6487
- return;
6488
- }
6489
- const ee = emitter;
6490
- const eventHandler = (...args) => {
6491
- if (signal) {
6492
- signal.removeEventListener("abort", abortHandler);
6493
- }
6494
- if (errorHandler !== void 0) {
6495
- ee.removeListener("error", errorHandler);
6496
- }
6497
- resolve(args);
6498
- };
6499
- let errorHandler;
6500
- if (name2 !== "error") {
6501
- errorHandler = (err) => {
6502
- ee.removeListener(name2, eventHandler);
6503
- if (signal) {
6504
- signal.removeEventListener("abort", abortHandler);
6505
- }
6506
- reject(err);
6507
- };
6508
- ee.once("error", errorHandler);
6509
- }
6510
- ee.once(name2, eventHandler);
6511
- const abortHandler = () => {
6512
- ee.removeListener(name2, eventHandler);
6513
- if (errorHandler) {
6514
- ee.removeListener("error", errorHandler);
6515
- }
6516
- reject(createAbortError(signal));
6517
- };
6518
- if (signal) {
6519
- signal.addEventListener("abort", abortHandler, { once: true });
6520
- }
6521
- });
6522
- }
6523
- /**
6524
- * Returns an async iterator that yields event arguments each time the emitter emits.
6525
- */
6526
- static on(emitter, event, options) {
6527
- const signal = options?.signal;
6528
- if (signal?.aborted) {
6529
- throw createAbortError(signal);
6530
- }
6531
- const highWaterMark = options?.highWaterMark ?? Number.MAX_SAFE_INTEGER;
6532
- const lowWaterMark = options?.lowWaterMark ?? 1;
6533
- validateNumber(highWaterMark, "highWaterMark");
6534
- validateNumber(lowWaterMark, "lowWaterMark");
6535
- const unconsumedEvents = [];
6536
- const unconsumedPromises = [];
6537
- let error3 = null;
6538
- let finished = false;
6539
- let paused = false;
6540
- const eventHandler = (...args) => {
6541
- if (unconsumedPromises.length > 0) {
6542
- const { resolve } = unconsumedPromises.shift();
6543
- resolve({ value: args, done: false });
6544
- } else {
6545
- unconsumedEvents.push(args);
6546
- if (unconsumedEvents.length >= highWaterMark && !paused) {
6547
- paused = true;
6548
- if (typeof emitter.pause === "function") {
6549
- emitter.pause();
6550
- }
6551
- }
6552
- }
6553
- };
6554
- const errorHandler = (err) => {
6555
- error3 = err;
6556
- if (unconsumedPromises.length > 0) {
6557
- const { reject } = unconsumedPromises.shift();
6558
- reject(err);
6559
- }
6560
- iterator.return();
6561
- };
6562
- const abortHandler = () => {
6563
- errorHandler(createAbortError(signal));
6564
- };
6565
- emitter.on(event, eventHandler);
6566
- if (event !== "error") {
6567
- emitter.on("error", errorHandler);
6568
- }
6569
- if (signal) {
6570
- signal.addEventListener("abort", abortHandler, { once: true });
6571
- }
6572
- const cleanup = () => {
6573
- emitter.removeListener(event, eventHandler);
6574
- emitter.removeListener("error", errorHandler);
6575
- if (signal) {
6576
- signal.removeEventListener("abort", abortHandler);
6577
- }
6578
- finished = true;
6579
- for (const { resolve } of unconsumedPromises) {
6580
- resolve({ value: void 0, done: true });
6581
- }
6582
- unconsumedPromises.length = 0;
6583
- unconsumedEvents.length = 0;
6584
- };
6585
- const iterator = {
6586
- next() {
6587
- if (unconsumedEvents.length > 0) {
6588
- const value2 = unconsumedEvents.shift();
6589
- if (paused && unconsumedEvents.length < lowWaterMark) {
6590
- paused = false;
6591
- if (typeof emitter.resume === "function") {
6592
- emitter.resume();
6593
- }
6594
- }
6595
- return Promise.resolve({ value: value2, done: false });
6596
- }
6597
- if (error3) {
6598
- const p = Promise.reject(error3);
6599
- error3 = null;
6600
- return p;
6601
- }
6602
- if (finished) {
6603
- return Promise.resolve({ value: void 0, done: true });
6604
- }
6605
- return new Promise((resolve, reject) => {
6606
- unconsumedPromises.push({ resolve, reject });
6607
- });
6608
- },
6609
- return() {
6610
- cleanup();
6611
- return Promise.resolve({ value: void 0, done: true });
6612
- },
6613
- throw(err) {
6614
- if (!finished) {
6615
- error3 = err;
6616
- cleanup();
6617
- }
6618
- return Promise.reject(err);
6619
- },
6620
- [Symbol.asyncIterator]() {
6621
- return this;
6622
- }
6623
- };
6624
- return iterator;
6625
- }
6626
- /**
6627
- * Returns the number of listeners listening to the event name.
6628
- * @deprecated Use emitter.listenerCount() instead.
6629
- */
6630
- static listenerCount(emitter, type) {
6631
- return emitter.listenerCount(type);
6632
- }
6633
- /**
6634
- * Returns a copy of the array of listeners for the event named eventName.
6635
- */
6636
- static getEventListeners(emitter, name2) {
6637
- if (typeof emitter.listeners === "function") {
6638
- return emitter.listeners(name2);
6639
- }
6640
- return [];
6641
- }
6642
- /**
6643
- * Set max listeners on one or more emitters.
6644
- */
6645
- static setMaxListeners(n, ...emitters) {
6646
- validateNumber(n, "n");
6647
- if (n < 0) {
6648
- throw new RangeError('The value of "n" is out of range.');
6649
- }
6650
- if (emitters.length === 0) {
6651
- _EventEmitter.defaultMaxListeners = n;
6652
- } else {
6653
- for (const emitter of emitters) {
6654
- if (typeof emitter.setMaxListeners === "function") {
6655
- emitter.setMaxListeners(n);
6656
- }
6657
- }
6658
- }
6659
- }
6660
- /**
6661
- * Returns the currently set max listeners on the emitter.
6662
- */
6663
- static getMaxListeners(emitter) {
6664
- if (typeof emitter.getMaxListeners === "function") {
6665
- return emitter.getMaxListeners();
6666
- }
6667
- return _EventEmitter.defaultMaxListeners;
6668
- }
6669
- /**
6670
- * Listens once to an abort event on the provided signal and returns a disposable.
6671
- */
6672
- static addAbortListener(signal, listener) {
6673
- if (signal.aborted) {
6674
- Promise.resolve().then(() => listener());
6675
- }
6676
- const handler = () => listener();
6677
- signal.addEventListener("abort", handler, { once: true });
6678
- return {
6679
- [Symbol.dispose]() {
6680
- signal.removeEventListener("abort", handler);
6681
- }
6682
- };
6683
- }
6684
- };
6685
- EventEmitter.EventEmitter = EventEmitter;
6686
- }
6687
- });
6688
-
6689
- // ../../../packages/node/events/lib/esm/index.js
6690
- var esm_exports = {};
6691
- __export(esm_exports, {
6692
- EventEmitter: () => EventEmitter2,
6693
- addAbortListener: () => addAbortListener,
6694
- captureRejectionSymbol: () => captureRejectionSymbol,
6695
- default: () => index_default,
6696
- defaultMaxListeners: () => defaultMaxListeners,
6697
- errorMonitor: () => errorMonitor,
6698
- getEventListeners: () => getEventListeners,
6699
- getMaxListeners: () => getMaxListeners,
6700
- listenerCount: () => listenerCount,
6701
- on: () => on,
6702
- once: () => once,
6703
- setMaxListeners: () => setMaxListeners
6704
- });
6705
- var EventEmitter2, captureRejectionSymbol, errorMonitor, defaultMaxListeners, setMaxListeners, getMaxListeners, once, on, getEventListeners, listenerCount, addAbortListener, index_default;
6706
- var init_esm6 = __esm({
6707
- "../../../packages/node/events/lib/esm/index.js"() {
6708
- init_console_gjs();
6709
- init_auto_globals_495e9d950c();
6710
- init_esm();
6711
- init_event_emitter();
6712
- EventEmitter2 = makeCallable(EventEmitter);
6713
- EventEmitter2.EventEmitter = EventEmitter2;
6714
- captureRejectionSymbol = EventEmitter2.captureRejectionSymbol;
6715
- errorMonitor = EventEmitter2.errorMonitor;
6716
- defaultMaxListeners = EventEmitter2.defaultMaxListeners;
6717
- setMaxListeners = EventEmitter2.setMaxListeners;
6718
- getMaxListeners = EventEmitter2.getMaxListeners;
6719
- once = EventEmitter2.once;
6720
- on = EventEmitter2.on;
6721
- getEventListeners = EventEmitter2.getEventListeners;
6722
- listenerCount = EventEmitter2.listenerCount;
6723
- addAbortListener = EventEmitter2.addAbortListener;
6724
- index_default = EventEmitter2;
6725
- }
6726
- });
6727
-
6728
- // ../../../packages/node/events/cjs-compat.cjs
6729
- var require_cjs_compat = __commonJS({
6730
- "../../../packages/node/events/cjs-compat.cjs"(exports, module) {
6731
- init_console_gjs();
6732
- init_auto_globals_495e9d950c();
6733
- var mod = (init_esm6(), __toCommonJS(esm_exports));
6734
- module.exports = mod.default || mod;
6735
- }
6736
- });
6737
-
6738
- // ../../../packages/node/process/lib/esm/index.js
6739
- function getGjsGlobal() {
6740
- return globalThis;
6741
- }
6742
- function detectGjsVersion() {
6743
- try {
6744
- const system = getGjsGlobal().imports?.system;
6745
- if (system?.version !== void 0) {
6746
- const v = Number(system.version);
6747
- const major = Math.floor(v / 1e4);
6748
- const minor = Math.floor(v % 1e4 / 100);
6749
- const patch = v % 100;
6750
- return `${major}.${minor}.${patch}`;
6751
- }
6752
- } catch {
6753
- }
6754
- return void 0;
6755
- }
6756
- function detectNodeVersion() {
6757
- if (typeof globalThis.process?.versions?.node === "string") {
6758
- return globalThis.process.versions.node;
6759
- }
6760
- return void 0;
6761
- }
6762
- function detectVersionInfo() {
6763
- const nodeVersion = detectNodeVersion();
6764
- if (nodeVersion) {
6765
- return {
6766
- version: globalThis.process.version,
6767
- versions: { ...globalThis.process.versions },
6768
- title: globalThis.process?.title || "node"
6769
- };
6770
- }
6771
- const gjsVersion = detectGjsVersion();
6772
- const versions2 = {
6773
- node: "20.0.0"
6774
- // Compatibility version — many npm packages check process.versions.node
6775
- };
6776
- if (gjsVersion) versions2.gjs = gjsVersion;
6777
- return {
6778
- version: "v20.0.0",
6779
- // Compatibility version for Node.js API level checks
6780
- versions: versions2,
6781
- title: "gjs"
6782
- };
6783
- }
6784
- function detectPpid() {
6785
- if (typeof globalThis.process?.ppid === "number") {
6786
- return globalThis.process.ppid;
6787
- }
6788
- try {
6789
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6790
- if (GLib3) {
6791
- const [, contents] = GLib3.file_get_contents("/proc/self/status");
6792
- if (contents) {
6793
- const str = new TextDecoder().decode(contents);
6794
- const match = str.match(/PPid:\s+(\d+)/);
6795
- if (match) return parseInt(match[1], 10);
6796
- }
6797
- }
6798
- } catch {
6799
- }
6800
- return 0;
6801
- }
6802
- function detectPlatform() {
6803
- try {
6804
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6805
- if (GLib3) {
6806
- const osInfo = GLib3.get_os_info("ID");
6807
- if (osInfo) return "linux";
6808
- }
6809
- } catch {
6810
- }
6811
- if (typeof getGjsGlobal().imports?.system !== "undefined") {
6812
- return "linux";
6813
- }
6814
- if (typeof globalThis.process?.platform === "string") {
6815
- return globalThis.process.platform;
6816
- }
6817
- return "linux";
6818
- }
6819
- function detectArch() {
6820
- if (typeof globalThis.process?.arch === "string") {
6821
- return globalThis.process.arch;
6822
- }
6823
- try {
6824
- const system = getGjsGlobal().imports?.system;
6825
- if (system?.programInvocationName) {
6826
- }
6827
- } catch {
6828
- }
6829
- return "x64";
6830
- }
6831
- function getCwd() {
6832
- try {
6833
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6834
- if (GLib3?.get_current_dir) return GLib3.get_current_dir();
6835
- } catch {
6836
- }
6837
- return "/";
6838
- }
6839
- function getEnvProxy() {
6840
- if (typeof globalThis.process?.env === "object") {
6841
- return globalThis.process.env;
6842
- }
6843
- try {
6844
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6845
- if (GLib3) {
6846
- return new Proxy({}, {
6847
- get(_target2, prop) {
6848
- if (typeof prop !== "string") return void 0;
6849
- return GLib3.getenv(prop) ?? void 0;
6850
- },
6851
- set(_target2, prop, value2) {
6852
- if (typeof prop !== "string") return false;
6853
- GLib3.setenv(prop, String(value2), true);
6854
- return true;
6855
- },
6856
- deleteProperty(_target2, prop) {
6857
- if (typeof prop !== "string") return false;
6858
- GLib3.unsetenv(prop);
6859
- return true;
6860
- },
6861
- has(_target2, prop) {
6862
- if (typeof prop !== "string") return false;
6863
- return GLib3.getenv(prop) !== null;
6864
- },
6865
- ownKeys(_target2) {
6866
- const envp = GLib3.listenv();
6867
- return envp;
6868
- },
6869
- getOwnPropertyDescriptor(_target2, prop) {
6870
- if (typeof prop !== "string") return void 0;
6871
- const val = GLib3.getenv(prop);
6872
- if (val === null) return void 0;
6873
- return { configurable: true, enumerable: true, writable: true, value: val };
6874
- }
6875
- });
6876
- }
6877
- } catch {
6878
- }
6879
- return {};
6880
- }
6881
- function getArgv() {
6882
- if (typeof globalThis.process?.argv !== "undefined") {
6883
- return globalThis.process.argv;
6884
- }
6885
- try {
6886
- const system = getGjsGlobal().imports?.system;
6887
- if (system?.programArgs) {
6888
- return ["gjs", system.programInvocationName || "", ...system.programArgs];
6889
- }
6890
- } catch {
6891
- }
6892
- return ["gjs"];
6893
- }
6894
- function getExecPath() {
6895
- if (typeof globalThis.process?.execPath === "string") {
6896
- return globalThis.process.execPath;
6897
- }
6898
- try {
6899
- const system = getGjsGlobal().imports?.system;
6900
- if (system?.programInvocationName) return system.programInvocationName;
6901
- } catch {
6902
- }
6903
- return "/usr/bin/gjs";
6904
- }
6905
- function getPid() {
6906
- if (typeof globalThis.process?.pid === "number") {
6907
- return globalThis.process.pid;
6908
- }
6909
- try {
6910
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6911
- if (GLib3) {
6912
- const [, contents] = GLib3.file_get_contents("/proc/self/stat");
6913
- if (contents) {
6914
- const str = new TextDecoder().decode(contents);
6915
- const pid2 = parseInt(str, 10);
6916
- if (!isNaN(pid2)) return pid2;
6917
- }
6918
- }
6919
- } catch {
6920
- }
6921
- return 0;
6922
- }
6923
- function getMonotonicTime() {
6924
- try {
6925
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6926
- if (GLib3?.get_monotonic_time) {
6927
- return BigInt(GLib3.get_monotonic_time()) * 1000n;
6928
- }
6929
- } catch {
6930
- }
6931
- if (typeof performance?.now === "function") {
6932
- return BigInt(Math.round(performance.now() * 1e6));
6933
- }
6934
- return BigInt(Date.now()) * 1000000n;
6935
- }
6936
- var import_events, startTime, hrtimeBase, Process, process, platform, arch, env, argv, argv0, execPath, pid, ppid, version, versions, cwd, chdir, exit, nextTick2, hrtime, uptime, memoryUsage, cpuUsage, kill, abort, umask, emitWarning, execArgv, config, stdout, stderr, stdin, index_default2;
6937
- var init_esm7 = __esm({
6938
- "../../../packages/node/process/lib/esm/index.js"() {
6939
- init_console_gjs();
6940
- init_auto_globals_495e9d950c();
6941
- import_events = __toESM(require_cjs_compat(), 1);
6942
- startTime = Date.now();
6943
- hrtimeBase = getMonotonicTime();
6944
- Process = class extends import_events.EventEmitter {
6945
- platform;
6946
- arch;
6947
- env;
6948
- argv;
6949
- argv0;
6950
- execPath;
6951
- pid;
6952
- ppid;
6953
- version;
6954
- versions;
6955
- title;
6956
- execArgv;
6957
- config;
6958
- exitCode;
6959
- constructor() {
6960
- super();
6961
- this.platform = detectPlatform();
6962
- this.arch = detectArch();
6963
- this.env = getEnvProxy();
6964
- this.argv = getArgv();
6965
- this.argv0 = this.argv[0] || "gjs";
6966
- this.execPath = getExecPath();
6967
- this.execArgv = globalThis.process?.execArgv ?? [];
6968
- this.config = globalThis.process?.config ?? { target_defaults: {}, variables: {} };
6969
- this.pid = getPid();
6970
- this.ppid = detectPpid();
6971
- const versionInfo = detectVersionInfo();
6972
- this.version = versionInfo.version;
6973
- this.versions = versionInfo.versions;
6974
- this.title = versionInfo.title;
6975
- }
6976
- cwd() {
6977
- return getCwd();
6978
- }
6979
- chdir(directory) {
6980
- try {
6981
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
6982
- if (GLib3?.chdir) {
6983
- if (!GLib3.file_test(
6984
- directory,
6985
- 16
6986
- /* G_FILE_TEST_EXISTS */
6987
- )) {
6988
- const err = new Error(`ENOENT: no such file or directory, chdir '${directory}'`);
6989
- err.code = "ENOENT";
6990
- err.syscall = "chdir";
6991
- err.path = directory;
6992
- throw err;
6993
- }
6994
- GLib3.chdir(directory);
6995
- return;
6996
- }
6997
- } catch (e) {
6998
- if (e && typeof e === "object" && e.code === "ENOENT") throw e;
6999
- }
7000
- const nativeProcess = globalThis.process;
7001
- if (nativeProcess && nativeProcess !== this && typeof nativeProcess.chdir === "function") {
7002
- nativeProcess.chdir(directory);
7003
- return;
7004
- }
7005
- throw new Error("process.chdir() is not supported in this environment");
7006
- }
7007
- kill(pid2, signal) {
7008
- const nativeProcess = globalThis.process;
7009
- if (nativeProcess && nativeProcess !== this && typeof nativeProcess.kill === "function") {
7010
- return nativeProcess.kill(pid2, signal);
7011
- }
6204
+ _cancel() {
6205
+ if (this._id === null) return;
7012
6206
  try {
7013
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
7014
- if (GLib3) {
7015
- const sig = typeof signal === "number" ? String(signal) : signal || "SIGTERM";
7016
- const sigArg = sig.startsWith("SIG") ? `-${sig.slice(3)}` : `-${sig}`;
7017
- GLib3.spawn_command_line_sync(`kill ${sigArg} ${pid2}`);
7018
- return true;
7019
- }
6207
+ getGLib()?.Source.remove(this._id);
7020
6208
  } catch {
7021
6209
  }
7022
- throw new Error("process.kill() is not supported in this environment");
6210
+ this._id = null;
7023
6211
  }
7024
- exit(code) {
7025
- this.exitCode = code ?? this.exitCode ?? 0;
7026
- this.emit("exit", this.exitCode);
7027
- try {
7028
- const system = getGjsGlobal().imports?.system;
7029
- if (system?.exit) {
7030
- system.exit(this.exitCode);
7031
- }
7032
- } catch {
7033
- }
7034
- const nativeProcess = globalThis.process;
7035
- if (nativeProcess && nativeProcess !== this && typeof nativeProcess.exit === "function") {
7036
- nativeProcess.exit(this.exitCode);
7037
- }
7038
- throw new Error(`process.exit(${this.exitCode})`);
6212
+ [Symbol.toPrimitive]() {
6213
+ return this._id;
7039
6214
  }
7040
- nextTick(callback, ...args) {
7041
- if (typeof queueMicrotask === "function") {
7042
- queueMicrotask(() => callback(...args));
7043
- } else {
7044
- Promise.resolve().then(() => callback(...args));
7045
- }
7046
- }
7047
- hrtime(time2) {
7048
- const now = getMonotonicTime() - hrtimeBase;
7049
- const seconds = Number(now / 1000000000n);
7050
- const nanoseconds = Number(now % 1000000000n);
7051
- if (time2) {
7052
- let diffSec = seconds - time2[0];
7053
- let diffNano = nanoseconds - time2[1];
7054
- if (diffNano < 0) {
7055
- diffSec--;
7056
- diffNano += 1e9;
7057
- }
7058
- return [diffSec, diffNano];
7059
- }
7060
- return [seconds, nanoseconds];
6215
+ [Symbol.dispose]() {
6216
+ this._cancel();
7061
6217
  }
7062
- uptime() {
7063
- return (Date.now() - startTime) / 1e3;
7064
- }
7065
- memoryUsage() {
7066
- try {
7067
- const GLib3 = getGjsGlobal().imports?.gi?.GLib;
7068
- if (GLib3) {
7069
- const [, contents] = GLib3.file_get_contents("/proc/self/status");
7070
- if (contents) {
7071
- const str = new TextDecoder().decode(contents);
7072
- const vmRSS = str.match(/VmRSS:\s+(\d+)/);
7073
- const rss = vmRSS ? parseInt(vmRSS[1], 10) * 1024 : 0;
7074
- return { rss, heapTotal: rss, heapUsed: rss, external: 0, arrayBuffers: 0 };
7075
- }
7076
- }
7077
- } catch {
7078
- }
7079
- const nativeProcess = globalThis.process;
7080
- if (nativeProcess && nativeProcess !== this && typeof nativeProcess.memoryUsage === "function") {
7081
- return nativeProcess.memoryUsage();
7082
- }
7083
- return { rss: 0, heapTotal: 0, heapUsed: 0, external: 0, arrayBuffers: 0 };
7084
- }
7085
- cpuUsage(previousValue) {
7086
- const nativeProcess = globalThis.process;
7087
- if (nativeProcess && nativeProcess !== this && typeof nativeProcess.cpuUsage === "function") {
7088
- return nativeProcess.cpuUsage(previousValue);
7089
- }
7090
- return { user: 0, system: 0 };
7091
- }
7092
- // Stub: stdout/stderr/stdin — these need stream to be implemented fully
7093
- // Note: Cannot check globalThis.process.stdout here — on GJS globalThis.process
7094
- // IS this instance, so that would cause infinite recursion.
7095
- stdout = { write: (data) => {
7096
- console.log(data);
7097
- return true;
7098
- }, fd: 1 };
7099
- stderr = { write: (data) => {
7100
- console.error(data);
7101
- return true;
7102
- }, fd: 2 };
7103
- stdin = { fd: 0 };
7104
- abort() {
7105
- this.exit(1);
7106
- }
7107
- // no-op stubs for compatibility
7108
- umask(mask) {
7109
- return 18;
7110
- }
7111
- emitWarning(warning, name2) {
7112
- if (typeof warning === "string") {
7113
- console.warn(`(${name2 || "Warning"}): ${warning}`);
7114
- } else {
7115
- console.warn(warning.message);
7116
- }
7117
- }
7118
- };
7119
- Process.prototype.hrtime.bigint = function() {
7120
- return getMonotonicTime() - hrtimeBase;
7121
6218
  };
7122
- process = new Process();
7123
- platform = process.platform;
7124
- arch = process.arch;
7125
- env = process.env;
7126
- argv = process.argv;
7127
- argv0 = process.argv0;
7128
- execPath = process.execPath;
7129
- pid = process.pid;
7130
- ppid = process.ppid;
7131
- version = process.version;
7132
- versions = process.versions;
7133
- cwd = process.cwd.bind(process);
7134
- chdir = process.chdir.bind(process);
7135
- exit = process.exit.bind(process);
7136
- nextTick2 = process.nextTick.bind(process);
7137
- hrtime = process.hrtime.bind(process);
7138
- uptime = process.uptime.bind(process);
7139
- memoryUsage = process.memoryUsage.bind(process);
7140
- cpuUsage = process.cpuUsage.bind(process);
7141
- kill = process.kill.bind(process);
7142
- abort = process.abort.bind(process);
7143
- umask = process.umask.bind(process);
7144
- emitWarning = process.emitWarning.bind(process);
7145
- execArgv = process.execArgv;
7146
- config = process.config;
7147
- stdout = process.stdout;
7148
- stderr = process.stderr;
7149
- stdin = process.stdin;
7150
- index_default2 = process;
7151
- }
7152
- });
7153
-
7154
- // ../../../packages/node/globals/lib/esm/register/process.js
7155
- var init_process = __esm({
7156
- "../../../packages/node/globals/lib/esm/register/process.js"() {
7157
- init_console_gjs();
7158
- init_auto_globals_495e9d950c();
7159
- init_esm();
7160
- init_esm7();
7161
- if (typeof Promise.withResolvers !== "function") {
7162
- Promise.withResolvers = function() {
7163
- let resolve;
7164
- let reject;
7165
- const promise = new Promise((res, rej) => {
7166
- resolve = res;
7167
- reject = rej;
7168
- });
7169
- return { promise, resolve, reject };
7170
- };
7171
- }
7172
- initErrorV8Methods(Error);
7173
- if (!("global" in globalThis)) {
7174
- Object.defineProperty(globalThis, "global", {
7175
- value: globalThis,
7176
- writable: false,
7177
- enumerable: false,
6219
+ if (_isGjsTimer) {
6220
+ const setT = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, false);
6221
+ const setI = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, true);
6222
+ const g = globalThis;
6223
+ g.setTimeout = setT;
6224
+ g.clearTimeout = removeById;
6225
+ g.setInterval = setI;
6226
+ g.clearInterval = removeById;
6227
+ }
6228
+ if (!("setImmediate" in globalThis)) {
6229
+ Object.defineProperty(globalThis, "setImmediate", {
6230
+ value: setImmediate,
6231
+ enumerable: true,
6232
+ writable: true,
7178
6233
  configurable: true
7179
6234
  });
7180
6235
  }
7181
- if (!("process" in globalThis)) {
7182
- Object.defineProperty(globalThis, "process", {
7183
- value: index_default2,
7184
- enumerable: false,
6236
+ if (!("clearImmediate" in globalThis)) {
6237
+ Object.defineProperty(globalThis, "clearImmediate", {
6238
+ value: clearImmediate,
6239
+ enumerable: true,
7185
6240
  writable: true,
7186
6241
  configurable: true
7187
6242
  });
@@ -7201,10 +6256,10 @@ function encodeComponent(s) {
7201
6256
  return encodeURIComponent(s).replace(/%20/g, "+");
7202
6257
  }
7203
6258
  var PARSE_FLAGS, URLSearchParams, URL2;
7204
- var init_esm8 = __esm({
6259
+ var init_esm6 = __esm({
7205
6260
  "../../../packages/node/url/lib/esm/index.js"() {
7206
6261
  init_console_gjs();
7207
- init_auto_globals_495e9d950c();
6262
+ init_auto_globals_97a682e619();
7208
6263
  init_glib_2();
7209
6264
  PARSE_FLAGS = glib_2_default.UriFlags.HAS_PASSWORD | glib_2_default.UriFlags.ENCODED | glib_2_default.UriFlags.SCHEME_NORMALIZE;
7210
6265
  URLSearchParams = class _URLSearchParams {
@@ -7404,6 +6459,44 @@ var init_esm8 = __esm({
7404
6459
  toJSON() {
7405
6460
  return this.href;
7406
6461
  }
6462
+ // ---- URL.createObjectURL / URL.revokeObjectURL ----
6463
+ //
6464
+ // Consumers like Excalibur.js do `const src = URL.createObjectURL(blob);
6465
+ // image.src = src;`. For that to work on GJS we need `src` to be a path
6466
+ // `HTMLImageElement` / `HTMLAudioElement` / `FontFace` can actually read —
6467
+ // i.e. a `file://` URL. We implement this as a static method on our own
6468
+ // URL class (no globalThis monkey-patching):
6469
+ //
6470
+ // - Fast path: if the Blob already carries a `_tmpPath` (e.g. written
6471
+ // by `@gjsify/fetch` XHR when `responseType='blob'`), wrap it as
6472
+ // `file://<_tmpPath>`.
6473
+ // - Slow path: if the Blob has `arrayBuffer()`/bytes but no `_tmpPath`,
6474
+ // materialise the bytes into a GLib temp file and wrap that. This
6475
+ // path is async in the spec — but W3C `createObjectURL` is sync. We
6476
+ // read the bytes via `GLib.Bytes`-style synchronous access when
6477
+ // possible and fall back to a sentinel if not.
6478
+ //
6479
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
6480
+ static _objectURLPaths = /* @__PURE__ */ new Map();
6481
+ static _objectURLCounter = 0;
6482
+ static createObjectURL(blob) {
6483
+ const tmp = blob?._tmpPath;
6484
+ if (typeof tmp === "string" && tmp.length > 0) {
6485
+ const url = `file://${tmp}`;
6486
+ _URL._objectURLPaths.set(url, tmp);
6487
+ return url;
6488
+ }
6489
+ return "file:///dev/null";
6490
+ }
6491
+ static revokeObjectURL(url) {
6492
+ const path = _URL._objectURLPaths.get(url);
6493
+ if (!path) return;
6494
+ try {
6495
+ glib_2_default.unlink(path);
6496
+ } catch {
6497
+ }
6498
+ _URL._objectURLPaths.delete(url);
6499
+ }
7407
6500
  };
7408
6501
  }
7409
6502
  });
@@ -7412,8 +6505,8 @@ var init_esm8 = __esm({
7412
6505
  var init_url = __esm({
7413
6506
  "../../../packages/node/globals/lib/esm/register/url.js"() {
7414
6507
  init_console_gjs();
7415
- init_auto_globals_495e9d950c();
7416
- init_esm8();
6508
+ init_auto_globals_97a682e619();
6509
+ init_esm6();
7417
6510
  if (typeof globalThis.URL !== "function") {
7418
6511
  Object.defineProperty(globalThis, "URL", {
7419
6512
  value: URL2,
@@ -7435,10 +6528,10 @@ var init_url = __esm({
7435
6528
 
7436
6529
  // ../../../packages/node/perf_hooks/lib/esm/index.js
7437
6530
  var performance2, PerformanceObserverStub, PerformanceEntryStub, PerformanceObserverEntryListStub, PerformanceObserver, PerformanceEntry, PerformanceObserverEntryList, PerformanceMark, PerformanceMeasure;
7438
- var init_esm9 = __esm({
6531
+ var init_esm7 = __esm({
7439
6532
  "../../../packages/node/perf_hooks/lib/esm/index.js"() {
7440
6533
  init_console_gjs();
7441
- init_auto_globals_495e9d950c();
6534
+ init_auto_globals_97a682e619();
7442
6535
  if (globalThis.performance) {
7443
6536
  performance2 = globalThis.performance;
7444
6537
  } else {
@@ -7464,17 +6557,17 @@ var init_esm9 = __esm({
7464
6557
  return entry;
7465
6558
  },
7466
6559
  measure(name2, startMark, endMark) {
7467
- let startTime2 = 0;
6560
+ let startTime = 0;
7468
6561
  let endTime = _now();
7469
6562
  if (startMark) {
7470
6563
  const s = _entries.find((e) => e.entryType === "mark" && e.name === startMark);
7471
- if (s) startTime2 = s.startTime;
6564
+ if (s) startTime = s.startTime;
7472
6565
  }
7473
6566
  if (endMark) {
7474
6567
  const e = _entries.find((e2) => e2.entryType === "mark" && e2.name === endMark);
7475
6568
  if (e) endTime = e.startTime;
7476
6569
  }
7477
- const entry = { name: name2, entryType: "measure", startTime: startTime2, duration: endTime - startTime2 };
6570
+ const entry = { name: name2, entryType: "measure", startTime, duration: endTime - startTime };
7478
6571
  _entries.push(entry);
7479
6572
  return entry;
7480
6573
  },
@@ -7557,8 +6650,8 @@ var init_esm9 = __esm({
7557
6650
  var init_performance = __esm({
7558
6651
  "../../../packages/web/web-globals/lib/esm/register/performance.js"() {
7559
6652
  init_console_gjs();
7560
- init_auto_globals_495e9d950c();
7561
- init_esm9();
6653
+ init_auto_globals_97a682e619();
6654
+ init_esm7();
7562
6655
  if (typeof globalThis.performance === "undefined") {
7563
6656
  globalThis.performance = performance2;
7564
6657
  }
@@ -7570,10 +6663,10 @@ var init_performance = __esm({
7570
6663
 
7571
6664
  // ../../../packages/web/abort-controller/lib/esm/index.js
7572
6665
  var kAbort, kInternal, AbortSignal2, AbortController2;
7573
- var init_esm10 = __esm({
6666
+ var init_esm8 = __esm({
7574
6667
  "../../../packages/web/abort-controller/lib/esm/index.js"() {
7575
6668
  init_console_gjs();
7576
- init_auto_globals_495e9d950c();
6669
+ init_auto_globals_97a682e619();
7577
6670
  init_esm4();
7578
6671
  kAbort = /* @__PURE__ */ Symbol("abort");
7579
6672
  kInternal = /* @__PURE__ */ Symbol("internal");
@@ -7662,8 +6755,8 @@ var init_esm10 = __esm({
7662
6755
  var init_register2 = __esm({
7663
6756
  "../../../packages/web/abort-controller/lib/esm/register.js"() {
7664
6757
  init_console_gjs();
7665
- init_auto_globals_495e9d950c();
7666
- init_esm10();
6758
+ init_auto_globals_97a682e619();
6759
+ init_esm8();
7667
6760
  if (typeof globalThis.AbortController === "undefined") {
7668
6761
  globalThis.AbortController = AbortController2;
7669
6762
  }
@@ -7678,7 +6771,7 @@ var toRegister;
7678
6771
  var init_custom_events = __esm({
7679
6772
  "../../../packages/web/dom-events/lib/esm/register/custom-events.js"() {
7680
6773
  init_console_gjs();
7681
- init_auto_globals_495e9d950c();
6774
+ init_auto_globals_97a682e619();
7682
6775
  init_esm4();
7683
6776
  toRegister = {
7684
6777
  CustomEvent: CustomEvent2,
@@ -7699,7 +6792,7 @@ var init_custom_events = __esm({
7699
6792
  var init_register3 = __esm({
7700
6793
  "../../../packages/web/dom-exception/lib/esm/register.js"() {
7701
6794
  init_console_gjs();
7702
- init_auto_globals_495e9d950c();
6795
+ init_auto_globals_97a682e619();
7703
6796
  init_esm3();
7704
6797
  if (typeof globalThis.DOMException === "undefined") {
7705
6798
  globalThis.DOMException = DOMException2;
@@ -7707,9 +6800,9 @@ var init_register3 = __esm({
7707
6800
  }
7708
6801
  });
7709
6802
 
7710
- // node_modules/.cache/gjsify/auto-globals-495e9d950c.mjs
7711
- var init_auto_globals_495e9d950c = __esm({
7712
- "node_modules/.cache/gjsify/auto-globals-495e9d950c.mjs"() {
6803
+ // node_modules/.cache/gjsify/auto-globals-97a682e619.mjs
6804
+ var init_auto_globals_97a682e619 = __esm({
6805
+ "node_modules/.cache/gjsify/auto-globals-97a682e619.mjs"() {
7713
6806
  init_register();
7714
6807
  init_canvas();
7715
6808
  init_document2();
@@ -7717,8 +6810,7 @@ var init_auto_globals_495e9d950c = __esm({
7717
6810
  init_navigator();
7718
6811
  init_buffer2();
7719
6812
  init_encoding2();
7720
- init_microtask();
7721
- init_process();
6813
+ init_timers();
7722
6814
  init_url();
7723
6815
  init_performance();
7724
6816
  init_register2();
@@ -7733,7 +6825,7 @@ var require_twiddle = __commonJS({
7733
6825
  "use strict";
7734
6826
  "use restrict";
7735
6827
  init_console_gjs();
7736
- init_auto_globals_495e9d950c();
6828
+ init_auto_globals_97a682e619();
7737
6829
  var INT_BITS = 32;
7738
6830
  exports.INT_BITS = INT_BITS;
7739
6831
  exports.INT_MAX = 2147483647;
@@ -7888,7 +6980,7 @@ var require_twiddle = __commonJS({
7888
6980
  var require_literals = __commonJS({
7889
6981
  "../../../node_modules/glsl-tokenizer/lib/literals.js"(exports, module) {
7890
6982
  init_console_gjs();
7891
- init_auto_globals_495e9d950c();
6983
+ init_auto_globals_97a682e619();
7892
6984
  module.exports = [
7893
6985
  // current
7894
6986
  "precision",
@@ -7988,7 +7080,7 @@ var require_literals = __commonJS({
7988
7080
  var require_operators = __commonJS({
7989
7081
  "../../../node_modules/glsl-tokenizer/lib/operators.js"(exports, module) {
7990
7082
  init_console_gjs();
7991
- init_auto_globals_495e9d950c();
7083
+ init_auto_globals_97a682e619();
7992
7084
  module.exports = [
7993
7085
  "<<=",
7994
7086
  ">>=",
@@ -8043,7 +7135,7 @@ var require_operators = __commonJS({
8043
7135
  var require_builtins = __commonJS({
8044
7136
  "../../../node_modules/glsl-tokenizer/lib/builtins.js"(exports, module) {
8045
7137
  init_console_gjs();
8046
- init_auto_globals_495e9d950c();
7138
+ init_auto_globals_97a682e619();
8047
7139
  module.exports = [
8048
7140
  // Keep this list sorted
8049
7141
  "abs",
@@ -8201,7 +7293,7 @@ var require_builtins = __commonJS({
8201
7293
  var require_literals_300es = __commonJS({
8202
7294
  "../../../node_modules/glsl-tokenizer/lib/literals-300es.js"(exports, module) {
8203
7295
  init_console_gjs();
8204
- init_auto_globals_495e9d950c();
7296
+ init_auto_globals_97a682e619();
8205
7297
  var v100 = require_literals();
8206
7298
  module.exports = v100.slice().concat([
8207
7299
  "layout",
@@ -8295,7 +7387,7 @@ var require_literals_300es = __commonJS({
8295
7387
  var require_builtins_300es = __commonJS({
8296
7388
  "../../../node_modules/glsl-tokenizer/lib/builtins-300es.js"(exports, module) {
8297
7389
  init_console_gjs();
8298
- init_auto_globals_495e9d950c();
7390
+ init_auto_globals_97a682e619();
8299
7391
  var v100 = require_builtins();
8300
7392
  v100 = v100.slice().filter(function(b) {
8301
7393
  return !/^(gl\_|texture)/.test(b);
@@ -8365,7 +7457,7 @@ var require_builtins_300es = __commonJS({
8365
7457
  var require_glsl_tokenizer = __commonJS({
8366
7458
  "../../../node_modules/glsl-tokenizer/index.js"(exports, module) {
8367
7459
  init_console_gjs();
8368
- init_auto_globals_495e9d950c();
7460
+ init_auto_globals_97a682e619();
8369
7461
  module.exports = tokenize2;
8370
7462
  var literals100 = require_literals();
8371
7463
  var operators = require_operators();
@@ -8698,7 +7790,7 @@ var require_glsl_tokenizer = __commonJS({
8698
7790
  var require_string = __commonJS({
8699
7791
  "../../../node_modules/glsl-tokenizer/string.js"(exports, module) {
8700
7792
  init_console_gjs();
8701
- init_auto_globals_495e9d950c();
7793
+ init_auto_globals_97a682e619();
8702
7794
  var tokenize2 = require_glsl_tokenizer();
8703
7795
  module.exports = tokenizeString;
8704
7796
  function tokenizeString(str, opt) {
@@ -8713,70 +7805,70 @@ var require_string = __commonJS({
8713
7805
 
8714
7806
  // src/gjs/gjs.ts
8715
7807
  init_console_gjs();
8716
- init_auto_globals_495e9d950c();
7808
+ init_auto_globals_97a682e619();
8717
7809
  import Adw2 from "gi://Adw?version=1";
8718
7810
  import Gio2 from "gi://Gio?version=2.0";
8719
7811
 
8720
7812
  // src/gjs/teapot-window.ts
8721
7813
  init_console_gjs();
8722
- init_auto_globals_495e9d950c();
7814
+ init_auto_globals_97a682e619();
8723
7815
  import GObject2 from "gi://GObject?version=2.0";
8724
7816
  import Gtk4 from "gi://Gtk?version=4.0";
8725
7817
  import Adw from "gi://Adw?version=1";
8726
7818
 
8727
- // ../../../packages/dom/webgl/lib/esm/index.js
7819
+ // ../../../packages/framework/webgl/lib/esm/index.js
8728
7820
  init_console_gjs();
8729
- init_auto_globals_495e9d950c();
7821
+ init_auto_globals_97a682e619();
8730
7822
 
8731
7823
  // ../../../node_modules/@girs/gjs/index.js
8732
7824
  init_console_gjs();
8733
- init_auto_globals_495e9d950c();
7825
+ init_auto_globals_97a682e619();
8734
7826
 
8735
7827
  // ../../../node_modules/@girs/gjs/gjs.js
8736
7828
  init_console_gjs();
8737
- init_auto_globals_495e9d950c();
7829
+ init_auto_globals_97a682e619();
8738
7830
  var imports2 = globalThis.imports || {};
8739
7831
 
8740
- // ../../../packages/dom/webgl/lib/esm/index.js
7832
+ // ../../../packages/framework/webgl/lib/esm/index.js
8741
7833
  init_gio_2();
8742
7834
 
8743
7835
  // ../../../node_modules/@girs/gtk-4.0/index.js
8744
7836
  init_console_gjs();
8745
- init_auto_globals_495e9d950c();
7837
+ init_auto_globals_97a682e619();
8746
7838
 
8747
7839
  // ../../../node_modules/@girs/gtk-4.0/gtk-4.0.js
8748
7840
  init_console_gjs();
8749
- init_auto_globals_495e9d950c();
7841
+ init_auto_globals_97a682e619();
8750
7842
  import Gtk from "gi://Gtk?version=4.0";
8751
7843
 
8752
- // ../../../packages/dom/webgl/lib/esm/webgl-rendering-context.js
7844
+ // ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
8753
7845
  init_console_gjs();
8754
- init_auto_globals_495e9d950c();
7846
+ init_auto_globals_97a682e619();
8755
7847
 
8756
7848
  // ../../../node_modules/@girs/gwebgl-0.1/index.js
8757
7849
  init_console_gjs();
8758
- init_auto_globals_495e9d950c();
7850
+ init_auto_globals_97a682e619();
8759
7851
 
8760
7852
  // ../../../node_modules/@girs/gwebgl-0.1/gwebgl-0.1.js
8761
7853
  init_console_gjs();
8762
- init_auto_globals_495e9d950c();
7854
+ init_auto_globals_97a682e619();
8763
7855
  import Gwebgl from "gi://Gwebgl?version=0.1";
8764
7856
  var gwebgl_0_1_default = Gwebgl;
8765
7857
 
8766
7858
  // ../../../node_modules/@girs/gwebgl-0.1/index.js
8767
7859
  var gwebgl_0_default = gwebgl_0_1_default;
8768
7860
 
8769
- // ../../../packages/dom/webgl/lib/esm/webgl-context-base.js
7861
+ // ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
8770
7862
  init_console_gjs();
8771
- init_auto_globals_495e9d950c();
7863
+ init_auto_globals_97a682e619();
8772
7864
  init_gdkpixbuf_2();
8773
7865
  var bits = __toESM(require_twiddle(), 1);
8774
7866
  var import_string = __toESM(require_string(), 1);
8775
7867
  import GdkPixbuf3 from "gi://GdkPixbuf?version=2.0";
8776
7868
 
8777
- // ../../../packages/dom/webgl/lib/esm/webgl-context-attributes.js
7869
+ // ../../../packages/framework/webgl/lib/esm/webgl-context-attributes.js
8778
7870
  init_console_gjs();
8779
- init_auto_globals_495e9d950c();
7871
+ init_auto_globals_97a682e619();
8780
7872
  var WebGLContextAttributes = class {
8781
7873
  constructor(alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat) {
8782
7874
  this.alpha = alpha;
@@ -8798,13 +7890,13 @@ var WebGLContextAttributes = class {
8798
7890
  }
8799
7891
  };
8800
7892
 
8801
- // ../../../packages/dom/webgl/lib/esm/utils.js
7893
+ // ../../../packages/framework/webgl/lib/esm/utils.js
8802
7894
  init_console_gjs();
8803
- init_auto_globals_495e9d950c();
7895
+ init_auto_globals_97a682e619();
8804
7896
 
8805
- // ../../../packages/dom/webgl/lib/esm/webgl-uniform-location.js
7897
+ // ../../../packages/framework/webgl/lib/esm/webgl-uniform-location.js
8806
7898
  init_console_gjs();
8807
- init_auto_globals_495e9d950c();
7899
+ init_auto_globals_97a682e619();
8808
7900
  var WebGLUniformLocation = class {
8809
7901
  constructor(_, program, info2) {
8810
7902
  this._linkCount = 0;
@@ -8817,7 +7909,7 @@ var WebGLUniformLocation = class {
8817
7909
  }
8818
7910
  };
8819
7911
 
8820
- // ../../../packages/dom/webgl/lib/esm/utils.js
7912
+ // ../../../packages/framework/webgl/lib/esm/utils.js
8821
7913
  init_glib_2();
8822
7914
  function checkObject(object) {
8823
7915
  return typeof object === "object" || object === void 0;
@@ -9000,9 +8092,9 @@ function premultiplyAlpha(data) {
9000
8092
  return out;
9001
8093
  }
9002
8094
 
9003
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-element-index-unit.js
8095
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-element-index-unit.js
9004
8096
  init_console_gjs();
9005
- init_auto_globals_495e9d950c();
8097
+ init_auto_globals_97a682e619();
9006
8098
  var OESElementIndexUint = class {
9007
8099
  };
9008
8100
  function getOESElementIndexUint(context) {
@@ -9014,9 +8106,9 @@ function getOESElementIndexUint(context) {
9014
8106
  return result;
9015
8107
  }
9016
8108
 
9017
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-standard-derivatives.js
8109
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-standard-derivatives.js
9018
8110
  init_console_gjs();
9019
- init_auto_globals_495e9d950c();
8111
+ init_auto_globals_97a682e619();
9020
8112
  var OESStandardDerivatives = class {
9021
8113
  constructor() {
9022
8114
  this.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 35723;
@@ -9031,9 +8123,9 @@ function getOESStandardDerivatives(context) {
9031
8123
  return result;
9032
8124
  }
9033
8125
 
9034
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-texture-float.js
8126
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float.js
9035
8127
  init_console_gjs();
9036
- init_auto_globals_495e9d950c();
8128
+ init_auto_globals_97a682e619();
9037
8129
  var OESTextureFloat = class {
9038
8130
  };
9039
8131
  function getOESTextureFloat(context) {
@@ -9045,9 +8137,9 @@ function getOESTextureFloat(context) {
9045
8137
  return result;
9046
8138
  }
9047
8139
 
9048
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-texture-float-linear.js
8140
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float-linear.js
9049
8141
  init_console_gjs();
9050
- init_auto_globals_495e9d950c();
8142
+ init_auto_globals_97a682e619();
9051
8143
  var OESTextureFloatLinear = class {
9052
8144
  };
9053
8145
  function getOESTextureFloatLinear(context) {
@@ -9059,9 +8151,9 @@ function getOESTextureFloatLinear(context) {
9059
8151
  return result;
9060
8152
  }
9061
8153
 
9062
- // ../../../packages/dom/webgl/lib/esm/extensions/stackgl-destroy-context.js
8154
+ // ../../../packages/framework/webgl/lib/esm/extensions/stackgl-destroy-context.js
9063
8155
  init_console_gjs();
9064
- init_auto_globals_495e9d950c();
8156
+ init_auto_globals_97a682e619();
9065
8157
  var STACKGLDestroyContext = class {
9066
8158
  constructor(ctx) {
9067
8159
  this.destroy = ctx.destroy.bind(ctx);
@@ -9071,9 +8163,9 @@ function getSTACKGLDestroyContext(ctx) {
9071
8163
  return new STACKGLDestroyContext(ctx);
9072
8164
  }
9073
8165
 
9074
- // ../../../packages/dom/webgl/lib/esm/extensions/stackgl-resize-drawing-buffer.js
8166
+ // ../../../packages/framework/webgl/lib/esm/extensions/stackgl-resize-drawing-buffer.js
9075
8167
  init_console_gjs();
9076
- init_auto_globals_495e9d950c();
8168
+ init_auto_globals_97a682e619();
9077
8169
  var STACKGLResizeDrawingBuffer = class {
9078
8170
  constructor(ctx) {
9079
8171
  this.resize = ctx.resize.bind(ctx);
@@ -9083,9 +8175,9 @@ function getSTACKGLResizeDrawingBuffer(ctx) {
9083
8175
  return new STACKGLResizeDrawingBuffer(ctx);
9084
8176
  }
9085
8177
 
9086
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-blend-minmax.js
8178
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-blend-minmax.js
9087
8179
  init_console_gjs();
9088
- init_auto_globals_495e9d950c();
8180
+ init_auto_globals_97a682e619();
9089
8181
  var EXTBlendMinMax = class {
9090
8182
  constructor() {
9091
8183
  this.MIN_EXT = 32775;
@@ -9101,9 +8193,9 @@ function getEXTBlendMinMax(context) {
9101
8193
  return result;
9102
8194
  }
9103
8195
 
9104
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-color-buffer-float.js
8196
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-float.js
9105
8197
  init_console_gjs();
9106
- init_auto_globals_495e9d950c();
8198
+ init_auto_globals_97a682e619();
9107
8199
  var EXTColorBufferFloat = class {
9108
8200
  };
9109
8201
  function getEXTColorBufferFloat(context) {
@@ -9114,9 +8206,9 @@ function getEXTColorBufferFloat(context) {
9114
8206
  return null;
9115
8207
  }
9116
8208
 
9117
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-color-buffer-half-float.js
8209
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-half-float.js
9118
8210
  init_console_gjs();
9119
- init_auto_globals_495e9d950c();
8211
+ init_auto_globals_97a682e619();
9120
8212
  var EXTColorBufferHalfFloat = class {
9121
8213
  };
9122
8214
  function getEXTColorBufferHalfFloat(context) {
@@ -9127,9 +8219,9 @@ function getEXTColorBufferHalfFloat(context) {
9127
8219
  return null;
9128
8220
  }
9129
8221
 
9130
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-texture-filter-anisotropic.js
8222
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-texture-filter-anisotropic.js
9131
8223
  init_console_gjs();
9132
- init_auto_globals_495e9d950c();
8224
+ init_auto_globals_97a682e619();
9133
8225
  var EXTTextureFilterAnisotropic = class {
9134
8226
  constructor() {
9135
8227
  this.TEXTURE_MAX_ANISOTROPY_EXT = 34046;
@@ -9145,9 +8237,9 @@ function getEXTTextureFilterAnisotropic(context) {
9145
8237
  return result;
9146
8238
  }
9147
8239
 
9148
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-texture-half-float.js
8240
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-half-float.js
9149
8241
  init_console_gjs();
9150
- init_auto_globals_495e9d950c();
8242
+ init_auto_globals_97a682e619();
9151
8243
  var OESTextureHalfFloat = class {
9152
8244
  constructor() {
9153
8245
  this.HALF_FLOAT_OES = 36193;
@@ -9164,9 +8256,9 @@ function getOESTextureHalfFloat(context) {
9164
8256
  return null;
9165
8257
  }
9166
8258
 
9167
- // ../../../packages/dom/webgl/lib/esm/webgl-active-info.js
8259
+ // ../../../packages/framework/webgl/lib/esm/webgl-active-info.js
9168
8260
  init_console_gjs();
9169
- init_auto_globals_495e9d950c();
8261
+ init_auto_globals_97a682e619();
9170
8262
  var WebGLActiveInfo = class {
9171
8263
  constructor(_) {
9172
8264
  this.size = _.size;
@@ -9175,13 +8267,13 @@ var WebGLActiveInfo = class {
9175
8267
  }
9176
8268
  };
9177
8269
 
9178
- // ../../../packages/dom/webgl/lib/esm/webgl-framebuffer.js
8270
+ // ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
9179
8271
  init_console_gjs();
9180
- init_auto_globals_495e9d950c();
8272
+ init_auto_globals_97a682e619();
9181
8273
 
9182
- // ../../../packages/dom/webgl/lib/esm/linkable.js
8274
+ // ../../../packages/framework/webgl/lib/esm/linkable.js
9183
8275
  init_console_gjs();
9184
- init_auto_globals_495e9d950c();
8276
+ init_auto_globals_97a682e619();
9185
8277
  var Linkable = class {
9186
8278
  constructor(_) {
9187
8279
  this._ = 0;
@@ -9230,7 +8322,7 @@ var Linkable = class {
9230
8322
  }
9231
8323
  };
9232
8324
 
9233
- // ../../../packages/dom/webgl/lib/esm/webgl-framebuffer.js
8325
+ // ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
9234
8326
  var WebGLFramebuffer = class extends Linkable {
9235
8327
  constructor(_, ctx) {
9236
8328
  super(_);
@@ -9336,9 +8428,9 @@ var WebGLFramebuffer = class extends Linkable {
9336
8428
  }
9337
8429
  };
9338
8430
 
9339
- // ../../../packages/dom/webgl/lib/esm/webgl-buffer.js
8431
+ // ../../../packages/framework/webgl/lib/esm/webgl-buffer.js
9340
8432
  init_console_gjs();
9341
- init_auto_globals_495e9d950c();
8433
+ init_auto_globals_97a682e619();
9342
8434
  var WebGLBuffer = class extends Linkable {
9343
8435
  constructor(_, ctx) {
9344
8436
  super(_);
@@ -9353,9 +8445,9 @@ var WebGLBuffer = class extends Linkable {
9353
8445
  }
9354
8446
  };
9355
8447
 
9356
- // ../../../packages/dom/webgl/lib/esm/webgl-drawing-buffer-wrapper.js
8448
+ // ../../../packages/framework/webgl/lib/esm/webgl-drawing-buffer-wrapper.js
9357
8449
  init_console_gjs();
9358
- init_auto_globals_495e9d950c();
8450
+ init_auto_globals_97a682e619();
9359
8451
  var WebGLDrawingBufferWrapper = class {
9360
8452
  constructor(framebuffer, color, depthStencil) {
9361
8453
  this._framebuffer = framebuffer;
@@ -9364,9 +8456,9 @@ var WebGLDrawingBufferWrapper = class {
9364
8456
  }
9365
8457
  };
9366
8458
 
9367
- // ../../../packages/dom/webgl/lib/esm/webgl-program.js
8459
+ // ../../../packages/framework/webgl/lib/esm/webgl-program.js
9368
8460
  init_console_gjs();
9369
- init_auto_globals_495e9d950c();
8461
+ init_auto_globals_97a682e619();
9370
8462
  var WebGLProgram = class extends Linkable {
9371
8463
  constructor(_, ctx) {
9372
8464
  super(_);
@@ -9389,9 +8481,9 @@ var WebGLProgram = class extends Linkable {
9389
8481
  }
9390
8482
  };
9391
8483
 
9392
- // ../../../packages/dom/webgl/lib/esm/webgl-renderbuffer.js
8484
+ // ../../../packages/framework/webgl/lib/esm/webgl-renderbuffer.js
9393
8485
  init_console_gjs();
9394
- init_auto_globals_495e9d950c();
8486
+ init_auto_globals_97a682e619();
9395
8487
  var WebGLRenderbuffer = class extends Linkable {
9396
8488
  constructor(_, ctx) {
9397
8489
  super(_);
@@ -9412,9 +8504,9 @@ var WebGLRenderbuffer = class extends Linkable {
9412
8504
  }
9413
8505
  };
9414
8506
 
9415
- // ../../../packages/dom/webgl/lib/esm/webgl-shader.js
8507
+ // ../../../packages/framework/webgl/lib/esm/webgl-shader.js
9416
8508
  init_console_gjs();
9417
- init_auto_globals_495e9d950c();
8509
+ init_auto_globals_97a682e619();
9418
8510
  var WebGLShader = class extends Linkable {
9419
8511
  constructor(_, ctx, type) {
9420
8512
  super(_);
@@ -9435,9 +8527,9 @@ var WebGLShader = class extends Linkable {
9435
8527
  }
9436
8528
  };
9437
8529
 
9438
- // ../../../packages/dom/webgl/lib/esm/webgl-shader-precision-format.js
8530
+ // ../../../packages/framework/webgl/lib/esm/webgl-shader-precision-format.js
9439
8531
  init_console_gjs();
9440
- init_auto_globals_495e9d950c();
8532
+ init_auto_globals_97a682e619();
9441
8533
  var WebGLShaderPrecisionFormat = class {
9442
8534
  constructor(_) {
9443
8535
  this.rangeMin = _.rangeMin;
@@ -9446,9 +8538,9 @@ var WebGLShaderPrecisionFormat = class {
9446
8538
  }
9447
8539
  };
9448
8540
 
9449
- // ../../../packages/dom/webgl/lib/esm/webgl-texture-unit.js
8541
+ // ../../../packages/framework/webgl/lib/esm/webgl-texture-unit.js
9450
8542
  init_console_gjs();
9451
- init_auto_globals_495e9d950c();
8543
+ init_auto_globals_97a682e619();
9452
8544
  var WebGLTextureUnit = class {
9453
8545
  constructor(ctx, idx) {
9454
8546
  this._mode = 0;
@@ -9459,9 +8551,9 @@ var WebGLTextureUnit = class {
9459
8551
  }
9460
8552
  };
9461
8553
 
9462
- // ../../../packages/dom/webgl/lib/esm/webgl-texture.js
8554
+ // ../../../packages/framework/webgl/lib/esm/webgl-texture.js
9463
8555
  init_console_gjs();
9464
- init_auto_globals_495e9d950c();
8556
+ init_auto_globals_97a682e619();
9465
8557
  var WebGLTexture = class extends Linkable {
9466
8558
  constructor(_, ctx) {
9467
8559
  super(_);
@@ -9480,9 +8572,9 @@ var WebGLTexture = class extends Linkable {
9480
8572
  }
9481
8573
  };
9482
8574
 
9483
- // ../../../packages/dom/webgl/lib/esm/webgl-vertex-attribute.js
8575
+ // ../../../packages/framework/webgl/lib/esm/webgl-vertex-attribute.js
9484
8576
  init_console_gjs();
9485
- init_auto_globals_495e9d950c();
8577
+ init_auto_globals_97a682e619();
9486
8578
  var WebGLVertexArrayObjectAttribute = class {
9487
8579
  constructor(ctx, idx) {
9488
8580
  this._isPointer = false;
@@ -9624,7 +8716,7 @@ var WebGLVertexArrayGlobalState = class {
9624
8716
  }
9625
8717
  };
9626
8718
 
9627
- // ../../../packages/dom/webgl/lib/esm/webgl-context-base.js
8719
+ // ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
9628
8720
  init_esm();
9629
8721
  var VERSION = "0.0.1";
9630
8722
  var CONTEXT_COUNTER = 0;
@@ -10416,9 +9508,9 @@ var WebGLContextBase = class {
10416
9508
  const glArea = this.canvas.getGlArea();
10417
9509
  const es = glArea.get_use_es();
10418
9510
  const usesGlsl1Syntax = /\b(attribute|varying)\b/.test(source);
10419
- const version2 = usesGlsl1Syntax ? es ? "100" : "120" : this._getGlslVersion(es);
10420
- if (version2) {
10421
- source = "#version " + version2 + "\n" + preamble + source;
9511
+ const version = usesGlsl1Syntax ? es ? "100" : "120" : this._getGlslVersion(es);
9512
+ if (version) {
9513
+ source = "#version " + version + "\n" + preamble + source;
10422
9514
  } else if (preamble) {
10423
9515
  source = preamble + source;
10424
9516
  }
@@ -12949,7 +12041,7 @@ var WebGLContextBase = class {
12949
12041
  }
12950
12042
  };
12951
12043
 
12952
- // ../../../packages/dom/webgl/lib/esm/webgl-rendering-context.js
12044
+ // ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
12953
12045
  var WebGLRenderingContext2 = class extends WebGLContextBase {
12954
12046
  constructor(canvas, options = {}) {
12955
12047
  super(canvas, options);
@@ -13132,14 +12224,14 @@ var WebGLRenderingContext2 = class extends WebGLContextBase {
13132
12224
  }
13133
12225
  };
13134
12226
 
13135
- // ../../../packages/dom/webgl/lib/esm/webgl2-rendering-context.js
12227
+ // ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
13136
12228
  init_console_gjs();
13137
- init_auto_globals_495e9d950c();
12229
+ init_auto_globals_97a682e619();
13138
12230
  import GdkPixbuf4 from "gi://GdkPixbuf?version=2.0";
13139
12231
 
13140
- // ../../../packages/dom/webgl/lib/esm/webgl-query.js
12232
+ // ../../../packages/framework/webgl/lib/esm/webgl-query.js
13141
12233
  init_console_gjs();
13142
- init_auto_globals_495e9d950c();
12234
+ init_auto_globals_97a682e619();
13143
12235
  var WebGLQuery = class extends Linkable {
13144
12236
  constructor(_, ctx) {
13145
12237
  super(_);
@@ -13152,9 +12244,9 @@ var WebGLQuery = class extends Linkable {
13152
12244
  }
13153
12245
  };
13154
12246
 
13155
- // ../../../packages/dom/webgl/lib/esm/webgl-sampler.js
12247
+ // ../../../packages/framework/webgl/lib/esm/webgl-sampler.js
13156
12248
  init_console_gjs();
13157
- init_auto_globals_495e9d950c();
12249
+ init_auto_globals_97a682e619();
13158
12250
  var WebGLSampler = class extends Linkable {
13159
12251
  constructor(_, ctx) {
13160
12252
  super(_);
@@ -13167,9 +12259,9 @@ var WebGLSampler = class extends Linkable {
13167
12259
  }
13168
12260
  };
13169
12261
 
13170
- // ../../../packages/dom/webgl/lib/esm/webgl-sync.js
12262
+ // ../../../packages/framework/webgl/lib/esm/webgl-sync.js
13171
12263
  init_console_gjs();
13172
- init_auto_globals_495e9d950c();
12264
+ init_auto_globals_97a682e619();
13173
12265
  var WebGLSync = class extends Linkable {
13174
12266
  constructor(_, ctx) {
13175
12267
  super(_);
@@ -13182,9 +12274,9 @@ var WebGLSync = class extends Linkable {
13182
12274
  }
13183
12275
  };
13184
12276
 
13185
- // ../../../packages/dom/webgl/lib/esm/webgl-transform-feedback.js
12277
+ // ../../../packages/framework/webgl/lib/esm/webgl-transform-feedback.js
13186
12278
  init_console_gjs();
13187
- init_auto_globals_495e9d950c();
12279
+ init_auto_globals_97a682e619();
13188
12280
  var WebGLTransformFeedback = class extends Linkable {
13189
12281
  constructor(_, ctx) {
13190
12282
  super(_);
@@ -13197,9 +12289,9 @@ var WebGLTransformFeedback = class extends Linkable {
13197
12289
  }
13198
12290
  };
13199
12291
 
13200
- // ../../../packages/dom/webgl/lib/esm/webgl-vertex-array-object.js
12292
+ // ../../../packages/framework/webgl/lib/esm/webgl-vertex-array-object.js
13201
12293
  init_console_gjs();
13202
- init_auto_globals_495e9d950c();
12294
+ init_auto_globals_97a682e619();
13203
12295
  var WebGLVertexArrayObject = class extends Linkable {
13204
12296
  constructor(_, ctx) {
13205
12297
  super(_);
@@ -13217,7 +12309,7 @@ var WebGLVertexArrayObject = class extends Linkable {
13217
12309
  }
13218
12310
  };
13219
12311
 
13220
- // ../../../packages/dom/webgl/lib/esm/webgl2-rendering-context.js
12312
+ // ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
13221
12313
  init_esm();
13222
12314
  var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextBase {
13223
12315
  constructor(canvas, options = {}) {
@@ -14027,8 +13119,18 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14027
13119
  this._native2.vertexAttribIPointer(index, size, type, stride, offset);
14028
13120
  }
14029
13121
  drawBuffers(buffers) {
14030
- const mapped = buffers.map((b) => b === 1029 ? this.COLOR_ATTACHMENT0 : b);
14031
- this._native2.drawBuffers(Array.from(mapped));
13122
+ let hasBack = false;
13123
+ for (let i = 0; i < buffers.length; i++) {
13124
+ if (buffers[i] === 1029) {
13125
+ hasBack = true;
13126
+ break;
13127
+ }
13128
+ }
13129
+ if (!hasBack) {
13130
+ this._native2.drawBuffers(buffers);
13131
+ return;
13132
+ }
13133
+ this._native2.drawBuffers(buffers.map((b) => b === 1029 ? this.COLOR_ATTACHMENT0 : b));
14032
13134
  }
14033
13135
  drawRangeElements(mode, start2, end, count2, type, offset) {
14034
13136
  if (count2 < 0 || offset < 0) {
@@ -14125,10 +13227,10 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14125
13227
  void drawbuffer;
14126
13228
  }
14127
13229
  invalidateFramebuffer(target, attachments) {
14128
- this._native2.invalidateFramebuffer(target, Array.from(attachments));
13230
+ this._native2.invalidateFramebuffer(target, attachments);
14129
13231
  }
14130
13232
  invalidateSubFramebuffer(target, attachments, x, y, width, height) {
14131
- this._native2.invalidateSubFramebuffer(target, Array.from(attachments), x, y, width, height);
13233
+ this._native2.invalidateSubFramebuffer(target, attachments, x, y, width, height);
14132
13234
  }
14133
13235
  readBuffer(src) {
14134
13236
  this._native2.readBuffer(src);
@@ -14172,53 +13274,53 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14172
13274
  uniform1uiv(location, data, _srcOffset, _srcLength) {
14173
13275
  if (!location) return;
14174
13276
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14175
- this._native2.uniform1uiv(location._, arr.length, Array.from(arr));
13277
+ this._native2.uniform1uiv(location._, arr.length, arr);
14176
13278
  }
14177
13279
  uniform2uiv(location, data, _srcOffset, _srcLength) {
14178
13280
  if (!location) return;
14179
13281
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14180
- this._native2.uniform2uiv(location._, arr.length / 2, Array.from(arr));
13282
+ this._native2.uniform2uiv(location._, arr.length / 2, arr);
14181
13283
  }
14182
13284
  uniform3uiv(location, data, _srcOffset, _srcLength) {
14183
13285
  if (!location) return;
14184
13286
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14185
- this._native2.uniform3uiv(location._, arr.length / 3, Array.from(arr));
13287
+ this._native2.uniform3uiv(location._, arr.length / 3, arr);
14186
13288
  }
14187
13289
  uniform4uiv(location, data, _srcOffset, _srcLength) {
14188
13290
  if (!location) return;
14189
13291
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14190
- this._native2.uniform4uiv(location._, arr.length / 4, Array.from(arr));
13292
+ this._native2.uniform4uiv(location._, arr.length / 4, arr);
14191
13293
  }
14192
13294
  // ─── Non-square Matrix Uniforms ───────────────────────────────────────
14193
13295
  uniformMatrix2x3fv(location, transpose, data, _srcOffset, _srcLength) {
14194
13296
  if (!location) return;
14195
13297
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14196
- this._native2.uniformMatrix2x3fv(location._, transpose, Array.from(arr));
13298
+ this._native2.uniformMatrix2x3fv(location._, transpose, arr);
14197
13299
  }
14198
13300
  uniformMatrix3x2fv(location, transpose, data, _srcOffset, _srcLength) {
14199
13301
  if (!location) return;
14200
13302
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14201
- this._native2.uniformMatrix3x2fv(location._, transpose, Array.from(arr));
13303
+ this._native2.uniformMatrix3x2fv(location._, transpose, arr);
14202
13304
  }
14203
13305
  uniformMatrix2x4fv(location, transpose, data, _srcOffset, _srcLength) {
14204
13306
  if (!location) return;
14205
13307
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14206
- this._native2.uniformMatrix2x4fv(location._, transpose, Array.from(arr));
13308
+ this._native2.uniformMatrix2x4fv(location._, transpose, arr);
14207
13309
  }
14208
13310
  uniformMatrix4x2fv(location, transpose, data, _srcOffset, _srcLength) {
14209
13311
  if (!location) return;
14210
13312
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14211
- this._native2.uniformMatrix4x2fv(location._, transpose, Array.from(arr));
13313
+ this._native2.uniformMatrix4x2fv(location._, transpose, arr);
14212
13314
  }
14213
13315
  uniformMatrix3x4fv(location, transpose, data, _srcOffset, _srcLength) {
14214
13316
  if (!location) return;
14215
13317
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14216
- this._native2.uniformMatrix3x4fv(location._, transpose, Array.from(arr));
13318
+ this._native2.uniformMatrix3x4fv(location._, transpose, arr);
14217
13319
  }
14218
13320
  uniformMatrix4x3fv(location, transpose, data, _srcOffset, _srcLength) {
14219
13321
  if (!location) return;
14220
13322
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14221
- this._native2.uniformMatrix4x3fv(location._, transpose, Array.from(arr));
13323
+ this._native2.uniformMatrix4x3fv(location._, transpose, arr);
14222
13324
  }
14223
13325
  // ─── getUniform — WebGL2 uint type support ────────────────────────────
14224
13326
  /** WebGL1 getUniform falls to default:null for UNSIGNED_INT types. Handle them here. */
@@ -14473,16 +13575,16 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14473
13575
  }
14474
13576
  };
14475
13577
 
14476
- // ../../../packages/dom/webgl/lib/esm/html-canvas-element.js
13578
+ // ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
14477
13579
  init_console_gjs();
14478
- init_auto_globals_495e9d950c();
13580
+ init_auto_globals_97a682e619();
14479
13581
 
14480
13582
  // ../../../packages/dom/dom-elements/lib/esm/index.js
14481
13583
  init_console_gjs();
14482
- init_auto_globals_495e9d950c();
13584
+ init_auto_globals_97a682e619();
14483
13585
  init_html_canvas_element();
14484
13586
 
14485
- // ../../../packages/dom/webgl/lib/esm/html-canvas-element.js
13587
+ // ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
14486
13588
  var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
14487
13589
  constructor(gtkGlArea) {
14488
13590
  super();
@@ -14543,27 +13645,27 @@ var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
14543
13645
  }
14544
13646
  };
14545
13647
 
14546
- // ../../../packages/dom/webgl/lib/esm/webgl-bridge.js
13648
+ // ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
14547
13649
  init_console_gjs();
14548
- init_auto_globals_495e9d950c();
13650
+ init_auto_globals_97a682e619();
14549
13651
  import GObject from "gi://GObject";
14550
13652
  import GLib2 from "gi://GLib?version=2.0";
14551
13653
  import Gtk3 from "gi://Gtk?version=4.0";
14552
13654
 
14553
- // ../../../packages/dom/event-bridge/lib/esm/index.js
13655
+ // ../../../packages/framework/event-bridge/lib/esm/index.js
14554
13656
  init_console_gjs();
14555
- init_auto_globals_495e9d950c();
13657
+ init_auto_globals_97a682e619();
14556
13658
 
14557
- // ../../../packages/dom/event-bridge/lib/esm/event-bridge.js
13659
+ // ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
14558
13660
  init_console_gjs();
14559
- init_auto_globals_495e9d950c();
13661
+ init_auto_globals_97a682e619();
14560
13662
  init_esm4();
14561
13663
  import Gtk2 from "gi://Gtk?version=4.0";
14562
13664
  import Gdk4 from "gi://Gdk?version=4.0";
14563
13665
 
14564
- // ../../../packages/dom/event-bridge/lib/esm/key-map.js
13666
+ // ../../../packages/framework/event-bridge/lib/esm/key-map.js
14565
13667
  init_console_gjs();
14566
- init_auto_globals_495e9d950c();
13668
+ init_auto_globals_97a682e619();
14567
13669
  import Gdk3 from "gi://Gdk?version=4.0";
14568
13670
  var SPECIAL_KEYS = {
14569
13671
  Return: "Enter",
@@ -14752,7 +13854,7 @@ function gdkKeyvalToLocation(keyval) {
14752
13854
  return 0;
14753
13855
  }
14754
13856
 
14755
- // ../../../packages/dom/event-bridge/lib/esm/event-bridge.js
13857
+ // ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
14756
13858
  function extractModifiers(controller) {
14757
13859
  const mods = controller.get_current_event_state();
14758
13860
  return {
@@ -14938,7 +14040,7 @@ function attachEventControllers(widget, getElement, options) {
14938
14040
  widget.add_controller(focusCtrl);
14939
14041
  }
14940
14042
 
14941
- // ../../../packages/dom/webgl/lib/esm/webgl-bridge.js
14043
+ // ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
14942
14044
  init_esm4();
14943
14045
  var WebGLBridge = GObject.registerClass(
14944
14046
  { GTypeName: "GjsifyWebGLBridge" },
@@ -14957,6 +14059,12 @@ var WebGLBridge = GObject.registerClass(
14957
14059
  this.set_has_depth_buffer(true);
14958
14060
  this.set_has_stencil_buffer(true);
14959
14061
  attachEventControllers(this, () => this._canvas, { captureKeys: true });
14062
+ this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
14063
+ if (this._frameCallback !== null) {
14064
+ this.queue_render();
14065
+ }
14066
+ return GLib2.SOURCE_CONTINUE;
14067
+ });
14960
14068
  const initId = this.connect("render", () => {
14961
14069
  this.disconnect(initId);
14962
14070
  this.make_current();
@@ -14972,6 +14080,18 @@ var WebGLBridge = GObject.registerClass(
14972
14080
  }
14973
14081
  this._readyCallbacks = [];
14974
14082
  }
14083
+ this._renderTag = this.connect("render", (_widget) => {
14084
+ if (this._frameCallback !== null) {
14085
+ const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
14086
+ if (globalThis.__GJSIFY_DEBUG_RAF === true) {
14087
+ console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
14088
+ }
14089
+ const cb = this._frameCallback;
14090
+ this._frameCallback = null;
14091
+ cb(time2);
14092
+ }
14093
+ return true;
14094
+ });
14975
14095
  return true;
14976
14096
  });
14977
14097
  this.connect("resize", () => {
@@ -15035,30 +14155,13 @@ var WebGLBridge = GObject.registerClass(
15035
14155
  }
15036
14156
  /**
15037
14157
  * Schedules a single animation frame callback, matching the browser `requestAnimationFrame` API.
15038
- * Backed by GTK frame clock (vsync-synced) + the GLArea render signal.
15039
- * Returns 0 (handle cancel not yet implemented).
14158
+ * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
14159
+ * render signal handler. Both are installed once at construction / first render respectively,
14160
+ * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
14161
+ * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
15040
14162
  */
15041
14163
  requestAnimationFrame(cb) {
15042
14164
  this._frameCallback = cb;
15043
- if (this._tickCallbackId === null) {
15044
- this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
15045
- this._tickCallbackId = null;
15046
- if (this._renderTag === null) {
15047
- this._renderTag = this.connect("render", (_widget2) => {
15048
- this.disconnect(this._renderTag);
15049
- this._renderTag = null;
15050
- const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
15051
- if (globalThis.__GJSIFY_DEBUG_RAF === true) {
15052
- console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
15053
- }
15054
- this._frameCallback?.(time2);
15055
- return true;
15056
- });
15057
- }
15058
- this.queue_render();
15059
- return GLib2.SOURCE_REMOVE;
15060
- });
15061
- }
15062
14165
  this.queue_render();
15063
14166
  return 0;
15064
14167
  }
@@ -15080,22 +14183,22 @@ var WebGLBridge = GObject.registerClass(
15080
14183
  }
15081
14184
  );
15082
14185
 
15083
- // ../../../packages/dom/webgl/lib/esm/index.js
14186
+ // ../../../packages/framework/webgl/lib/esm/index.js
15084
14187
  globalThis.WebGLRenderingContext = WebGLRenderingContext2;
15085
14188
  globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
15086
14189
 
15087
14190
  // src/three-demo.ts
15088
14191
  init_console_gjs();
15089
- init_auto_globals_495e9d950c();
14192
+ init_auto_globals_97a682e619();
15090
14193
 
15091
14194
  // ../../../node_modules/three/build/three.module.js
15092
14195
  init_console_gjs();
15093
- init_auto_globals_495e9d950c();
14196
+ init_auto_globals_97a682e619();
15094
14197
 
15095
14198
  // ../../../node_modules/three/build/three.core.js
15096
14199
  init_console_gjs();
15097
- init_auto_globals_495e9d950c();
15098
- var REVISION = "183";
14200
+ init_auto_globals_97a682e619();
14201
+ var REVISION = "184";
15099
14202
  var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
15100
14203
  var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
15101
14204
  var CullFaceNone = 0;
@@ -15819,6 +14922,9 @@ var MathUtils = {
15819
14922
  denormalize
15820
14923
  };
15821
14924
  var Vector2 = class _Vector2 {
14925
+ static {
14926
+ _Vector2.prototype.isVector2 = true;
14927
+ }
15822
14928
  /**
15823
14929
  * Constructs a new 2D vector.
15824
14930
  *
@@ -15826,7 +14932,6 @@ var Vector2 = class _Vector2 {
15826
14932
  * @param {number} [y=0] - The y value of this vector.
15827
14933
  */
15828
14934
  constructor(x = 0, y = 0) {
15829
- _Vector2.prototype.isVector2 = true;
15830
14935
  this.x = x;
15831
14936
  this.y = y;
15832
14937
  }
@@ -17044,6 +16149,9 @@ var Quaternion = class {
17044
16149
  }
17045
16150
  };
17046
16151
  var Vector3 = class _Vector3 {
16152
+ static {
16153
+ _Vector3.prototype.isVector3 = true;
16154
+ }
17047
16155
  /**
17048
16156
  * Constructs a new 3D vector.
17049
16157
  *
@@ -17052,7 +16160,6 @@ var Vector3 = class _Vector3 {
17052
16160
  * @param {number} [z=0] - The z value of this vector.
17053
16161
  */
17054
16162
  constructor(x = 0, y = 0, z = 0) {
17055
- _Vector3.prototype.isVector3 = true;
17056
16163
  this.x = x;
17057
16164
  this.y = y;
17058
16165
  this.z = z;
@@ -17950,6 +17057,9 @@ var Vector3 = class _Vector3 {
17950
17057
  var _vector$c = /* @__PURE__ */ new Vector3();
17951
17058
  var _quaternion$5 = /* @__PURE__ */ new Quaternion();
17952
17059
  var Matrix3 = class _Matrix3 {
17060
+ static {
17061
+ _Matrix3.prototype.isMatrix3 = true;
17062
+ }
17953
17063
  /**
17954
17064
  * Constructs a new 3x3 matrix. The arguments are supposed to be
17955
17065
  * in row-major order. If no arguments are provided, the constructor
@@ -17966,7 +17076,6 @@ var Matrix3 = class _Matrix3 {
17966
17076
  * @param {number} [n33] - 3-3 matrix element.
17967
17077
  */
17968
17078
  constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
17969
- _Matrix3.prototype.isMatrix3 = true;
17970
17079
  this.elements = [
17971
17080
  1,
17972
17081
  0,
@@ -18666,7 +17775,7 @@ var Source = class {
18666
17775
  if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
18667
17776
  target.set(data.videoWidth, data.videoHeight, 0);
18668
17777
  } else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
18669
- target.set(data.displayHeight, data.displayWidth, 0);
17778
+ target.set(data.displayWidth, data.displayHeight, 0);
18670
17779
  } else if (data !== null) {
18671
17780
  target.set(data.width, data.height, data.depth || 0);
18672
17781
  } else {
@@ -18796,6 +17905,7 @@ var Texture = class _Texture extends EventDispatcher {
18796
17905
  this.isRenderTargetTexture = false;
18797
17906
  this.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;
18798
17907
  this.pmremVersion = 0;
17908
+ this.normalized = false;
18799
17909
  }
18800
17910
  /**
18801
17911
  * The width of the texture in pixels.
@@ -18823,11 +17933,11 @@ var Texture = class _Texture extends EventDispatcher {
18823
17933
  get image() {
18824
17934
  return this.source.data;
18825
17935
  }
18826
- set image(value2 = null) {
17936
+ set image(value2) {
18827
17937
  this.source.data = value2;
18828
17938
  }
18829
17939
  /**
18830
- * Updates the texture transformation matrix from the from the properties {@link Texture#offset},
17940
+ * Updates the texture transformation matrix from the properties {@link Texture#offset},
18831
17941
  * {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.
18832
17942
  */
18833
17943
  updateMatrix() {
@@ -18876,6 +17986,7 @@ var Texture = class _Texture extends EventDispatcher {
18876
17986
  this.format = source.format;
18877
17987
  this.internalFormat = source.internalFormat;
18878
17988
  this.type = source.type;
17989
+ this.normalized = source.normalized;
18879
17990
  this.offset.copy(source.offset);
18880
17991
  this.repeat.copy(source.repeat);
18881
17992
  this.center.copy(source.center);
@@ -18952,6 +18063,7 @@ var Texture = class _Texture extends EventDispatcher {
18952
18063
  format: this.format,
18953
18064
  internalFormat: this.internalFormat,
18954
18065
  type: this.type,
18066
+ normalized: this.normalized,
18955
18067
  colorSpace: this.colorSpace,
18956
18068
  minFilter: this.minFilter,
18957
18069
  magFilter: this.magFilter,
@@ -19057,6 +18169,9 @@ Texture.DEFAULT_IMAGE = null;
19057
18169
  Texture.DEFAULT_MAPPING = UVMapping;
19058
18170
  Texture.DEFAULT_ANISOTROPY = 1;
19059
18171
  var Vector4 = class _Vector4 {
18172
+ static {
18173
+ _Vector4.prototype.isVector4 = true;
18174
+ }
19060
18175
  /**
19061
18176
  * Constructs a new 4D vector.
19062
18177
  *
@@ -19066,7 +18181,6 @@ var Vector4 = class _Vector4 {
19066
18181
  * @param {number} [w=1] - The w value of this vector.
19067
18182
  */
19068
18183
  constructor(x = 0, y = 0, z = 0, w = 1) {
19069
- _Vector4.prototype.isVector4 = true;
19070
18184
  this.x = x;
19071
18185
  this.y = y;
19072
18186
  this.z = z;
@@ -19974,6 +19088,7 @@ var RenderTarget = class extends EventDispatcher {
19974
19088
  this.resolveStencilBuffer = source.resolveStencilBuffer;
19975
19089
  if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
19976
19090
  this.samples = source.samples;
19091
+ this.multiview = source.multiview;
19977
19092
  return this;
19978
19093
  }
19979
19094
  /**
@@ -20061,6 +19176,9 @@ var Data3DTexture = class extends Texture {
20061
19176
  }
20062
19177
  };
20063
19178
  var Matrix4 = class _Matrix4 {
19179
+ static {
19180
+ _Matrix4.prototype.isMatrix4 = true;
19181
+ }
20064
19182
  /**
20065
19183
  * Constructs a new 4x4 matrix. The arguments are supposed to be
20066
19184
  * in row-major order. If no arguments are provided, the constructor
@@ -20084,7 +19202,6 @@ var Matrix4 = class _Matrix4 {
20084
19202
  * @param {number} [n44] - 4-4 matrix element.
20085
19203
  */
20086
19204
  constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
20087
- _Matrix4.prototype.isMatrix4 = true;
20088
19205
  this.elements = [
20089
19206
  1,
20090
19207
  0,
@@ -22447,9 +21564,7 @@ var Object3D = class _Object3D extends EventDispatcher {
22447
21564
  this.rotation.order = source.rotation.order;
22448
21565
  this.quaternion.copy(source.quaternion);
22449
21566
  this.scale.copy(source.scale);
22450
- if (source.pivot !== null) {
22451
- this.pivot = source.pivot.clone();
22452
- }
21567
+ this.pivot = source.pivot !== null ? source.pivot.clone() : null;
22453
21568
  this.matrix.copy(source.matrix);
22454
21569
  this.matrixWorld.copy(source.matrixWorld);
22455
21570
  this.matrixAutoUpdate = source.matrixAutoUpdate;
@@ -22539,6 +21654,7 @@ var WebXRController = class {
22539
21654
  this._grip.linearVelocity = new Vector3();
22540
21655
  this._grip.hasAngularVelocity = false;
22541
21656
  this._grip.angularVelocity = new Vector3();
21657
+ this._grip.eventsEnabled = false;
22542
21658
  }
22543
21659
  return this._grip;
22544
21660
  }
@@ -22668,6 +21784,13 @@ var WebXRController = class {
22668
21784
  } else {
22669
21785
  grip.hasAngularVelocity = false;
22670
21786
  }
21787
+ if (grip.eventsEnabled) {
21788
+ grip.dispatchEvent({
21789
+ type: "gripUpdated",
21790
+ data: inputSource,
21791
+ target: this
21792
+ });
21793
+ }
22671
21794
  }
22672
21795
  }
22673
21796
  }
@@ -23680,7 +22803,7 @@ var Triangle = class _Triangle {
23680
22803
  static isFrontFacing(a, b, c, direction) {
23681
22804
  _v0$2.subVectors(c, b);
23682
22805
  _v1$5.subVectors(a, b);
23683
- return _v0$2.cross(_v1$5).dot(direction) < 0 ? true : false;
22806
+ return _v0$2.cross(_v1$5).dot(direction) < 0;
23684
22807
  }
23685
22808
  /**
23686
22809
  * Sets the triangle's vertices by copying the given values.
@@ -24441,7 +23564,7 @@ function satForAxes(axes, v0, v1, v2, extents) {
24441
23564
  var _vector$a = /* @__PURE__ */ new Vector3();
24442
23565
  var _vector2$1 = /* @__PURE__ */ new Vector2();
24443
23566
  var _id$2 = 0;
24444
- var BufferAttribute = class {
23567
+ var BufferAttribute = class extends EventDispatcher {
24445
23568
  /**
24446
23569
  * Constructs a new buffer attribute.
24447
23570
  *
@@ -24450,6 +23573,7 @@ var BufferAttribute = class {
24450
23573
  * @param {boolean} [normalized=false] - Whether the data are normalized or not.
24451
23574
  */
24452
23575
  constructor(array, itemSize, normalized = false) {
23576
+ super();
24453
23577
  if (Array.isArray(array)) {
24454
23578
  throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
24455
23579
  }
@@ -24846,6 +23970,12 @@ var BufferAttribute = class {
24846
23970
  if (this.usage !== StaticDrawUsage) data.usage = this.usage;
24847
23971
  return data;
24848
23972
  }
23973
+ /**
23974
+ * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
23975
+ */
23976
+ dispose() {
23977
+ this.dispatchEvent({ type: "dispose" });
23978
+ }
24849
23979
  };
24850
23980
  var Uint16BufferAttribute = class extends BufferAttribute {
24851
23981
  /**
@@ -27200,9 +26330,10 @@ var Plane = class {
27200
26330
  *
27201
26331
  * @param {Line3} line - The line to compute the intersection for.
27202
26332
  * @param {Vector3} target - The target vector that is used to store the method's result.
27203
- * @return {?Vector3} The intersection point.
26333
+ * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
26334
+ * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
27204
26335
  */
27205
- intersectLine(line, target) {
26336
+ intersectLine(line, target, clampToLine = true) {
27206
26337
  const direction = line.delta(_vector1);
27207
26338
  const denominator = this.normal.dot(direction);
27208
26339
  if (denominator === 0) {
@@ -27212,7 +26343,7 @@ var Plane = class {
27212
26343
  return null;
27213
26344
  }
27214
26345
  const t = -(line.start.dot(this.normal) + this.constant) / denominator;
27215
- if (t < 0 || t > 1) {
26346
+ if (clampToLine === true && (t < 0 || t > 1)) {
27216
26347
  return null;
27217
26348
  }
27218
26349
  return target.copy(line.start).addScaledVector(direction, t);
@@ -27783,7 +26914,7 @@ function cloneUniforms(src) {
27783
26914
  dst[u] = {};
27784
26915
  for (const p in src[u]) {
27785
26916
  const property = src[u][p];
27786
- if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
26917
+ if (isThreeObject(property)) {
27787
26918
  if (property.isRenderTargetTexture) {
27788
26919
  warn2("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
27789
26920
  dst[u][p] = null;
@@ -27791,7 +26922,15 @@ function cloneUniforms(src) {
27791
26922
  dst[u][p] = property.clone();
27792
26923
  }
27793
26924
  } else if (Array.isArray(property)) {
27794
- dst[u][p] = property.slice();
26925
+ if (isThreeObject(property[0])) {
26926
+ const clonedProperty = [];
26927
+ for (let i = 0, l = property.length; i < l; i++) {
26928
+ clonedProperty[i] = property[i].clone();
26929
+ }
26930
+ dst[u][p] = clonedProperty;
26931
+ } else {
26932
+ dst[u][p] = property.slice();
26933
+ }
27795
26934
  } else {
27796
26935
  dst[u][p] = property;
27797
26936
  }
@@ -27809,6 +26948,9 @@ function mergeUniforms(uniforms) {
27809
26948
  }
27810
26949
  return merged;
27811
26950
  }
26951
+ function isThreeObject(property) {
26952
+ return property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion);
26953
+ }
27812
26954
  function cloneUniformsGroups(src) {
27813
26955
  const dst = [];
27814
26956
  for (let u = 0; u < src.length; u++) {
@@ -28707,10 +27849,10 @@ var KeyframeTrack = class {
28707
27849
  * @param {number} endTime - The end time.
28708
27850
  * @return {KeyframeTrack} A reference to this keyframe track.
28709
27851
  */
28710
- trim(startTime2, endTime) {
27852
+ trim(startTime, endTime) {
28711
27853
  const times = this.times, nKeys = times.length;
28712
27854
  let from = 0, to = nKeys - 1;
28713
- while (from !== nKeys && times[from] < startTime2) {
27855
+ while (from !== nKeys && times[from] < startTime) {
28714
27856
  ++from;
28715
27857
  }
28716
27858
  while (to !== -1 && times[to] > endTime) {
@@ -30760,6 +29902,77 @@ var Spherical = class {
30760
29902
  return new this.constructor().copy(this);
30761
29903
  }
30762
29904
  };
29905
+ var Matrix2 = class _Matrix2 {
29906
+ static {
29907
+ _Matrix2.prototype.isMatrix2 = true;
29908
+ }
29909
+ /**
29910
+ * Constructs a new 2x2 matrix. The arguments are supposed to be
29911
+ * in row-major order. If no arguments are provided, the constructor
29912
+ * initializes the matrix as an identity matrix.
29913
+ *
29914
+ * @param {number} [n11] - 1-1 matrix element.
29915
+ * @param {number} [n12] - 1-2 matrix element.
29916
+ * @param {number} [n21] - 2-1 matrix element.
29917
+ * @param {number} [n22] - 2-2 matrix element.
29918
+ */
29919
+ constructor(n11, n12, n21, n22) {
29920
+ this.elements = [
29921
+ 1,
29922
+ 0,
29923
+ 0,
29924
+ 1
29925
+ ];
29926
+ if (n11 !== void 0) {
29927
+ this.set(n11, n12, n21, n22);
29928
+ }
29929
+ }
29930
+ /**
29931
+ * Sets this matrix to the 2x2 identity matrix.
29932
+ *
29933
+ * @return {Matrix2} A reference to this matrix.
29934
+ */
29935
+ identity() {
29936
+ this.set(
29937
+ 1,
29938
+ 0,
29939
+ 0,
29940
+ 1
29941
+ );
29942
+ return this;
29943
+ }
29944
+ /**
29945
+ * Sets the elements of the matrix from the given array.
29946
+ *
29947
+ * @param {Array<number>} array - The matrix elements in column-major order.
29948
+ * @param {number} [offset=0] - Index of the first element in the array.
29949
+ * @return {Matrix2} A reference to this matrix.
29950
+ */
29951
+ fromArray(array, offset = 0) {
29952
+ for (let i = 0; i < 4; i++) {
29953
+ this.elements[i] = array[i + offset];
29954
+ }
29955
+ return this;
29956
+ }
29957
+ /**
29958
+ * Sets the elements of the matrix.The arguments are supposed to be
29959
+ * in row-major order.
29960
+ *
29961
+ * @param {number} n11 - 1-1 matrix element.
29962
+ * @param {number} n12 - 1-2 matrix element.
29963
+ * @param {number} n21 - 2-1 matrix element.
29964
+ * @param {number} n22 - 2-2 matrix element.
29965
+ * @return {Matrix2} A reference to this matrix.
29966
+ */
29967
+ set(n11, n12, n21, n22) {
29968
+ const te = this.elements;
29969
+ te[0] = n11;
29970
+ te[2] = n12;
29971
+ te[1] = n21;
29972
+ te[3] = n22;
29973
+ return this;
29974
+ }
29975
+ };
30763
29976
  var Controls = class extends EventDispatcher {
30764
29977
  /**
30765
29978
  * Constructs a new controls instance.
@@ -30950,11 +30163,12 @@ function WebGLAnimation() {
30950
30163
  start: function() {
30951
30164
  if (isAnimating === true) return;
30952
30165
  if (animationLoop === null) return;
30166
+ if (context === null) return;
30953
30167
  requestId = context.requestAnimationFrame(onAnimationFrame);
30954
30168
  isAnimating = true;
30955
30169
  },
30956
30170
  stop: function() {
30957
- context.cancelAnimationFrame(requestId);
30171
+ if (context !== null) context.cancelAnimationFrame(requestId);
30958
30172
  isAnimating = false;
30959
30173
  },
30960
30174
  setAnimationLoop: function(callback) {
@@ -31121,8 +30335,8 @@ var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = textur
31121
30335
  var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif";
31122
30336
  var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
31123
30337
  var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
31124
- var envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n #endif\n#endif";
31125
- var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif";
30338
+ var envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n #endif\n#endif";
30339
+ var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif";
31126
30340
  var envmap_pars_fragment = "#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif";
31127
30341
  var envmap_pars_vertex = "#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif";
31128
30342
  var envmap_vertex = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif";
@@ -31134,17 +30348,18 @@ var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D grad
31134
30348
  var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
31135
30349
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
31136
30350
  var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert";
31137
- var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif";
30351
+ var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif\n#include <lightprobes_pars_fragment>";
31138
30352
  var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif";
31139
30353
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
31140
30354
  var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon";
31141
30355
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
31142
30356
  var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong";
31143
30357
  var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
31144
- var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid 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 ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n 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 ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid 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 ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid 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) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
31145
- var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
30358
+ var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid 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 ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n 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 ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid 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 ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid 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) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
30359
+ var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n #ifdef USE_LIGHT_PROBES_GRID\n vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );\n irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
31146
30360
  var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif";
31147
30361
  var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n #if defined( LAMBERT ) || defined( PHONG )\n irradiance += iblIrradiance;\n #endif\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
30362
+ var lightprobes_pars_fragment = "#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n vec3 res = probesResolution;\n vec3 gridRange = probesMax - probesMin;\n vec3 resMinusOne = res - 1.0;\n vec3 probeSpacing = gridRange / resMinusOne;\n vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n uvw = uvw * resMinusOne / res + 0.5 / res;\n float nz = res.z;\n float paddedSlices = nz + 2.0;\n float atlasDepth = 7.0 * paddedSlices;\n float uvZBase = uvw.z * nz + 1.0;\n vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n vec3 c0 = s0.xyz;\n vec3 c1 = vec3( s0.w, s1.xy );\n vec3 c2 = vec3( s1.zw, s2.x );\n vec3 c3 = s2.yzw;\n vec3 c4 = s3.xyz;\n vec3 c5 = vec3( s3.w, s4.xy );\n vec3 c6 = vec3( s4.zw, s5.x );\n vec3 c7 = s5.yzw;\n vec3 c8 = s6.xyz;\n float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n vec3 result = c0 * 0.886227;\n result += c1 * 2.0 * 0.511664 * y;\n result += c2 * 2.0 * 0.511664 * z;\n result += c3 * 2.0 * 0.511664 * x;\n result += c4 * 2.0 * 0.429043 * x * y;\n result += c5 * 2.0 * 0.429043 * y * z;\n result += c6 * ( 0.743125 * z * z - 0.247708 );\n result += c7 * 2.0 * 0.429043 * x * z;\n result += c8 * 0.429043 * ( x * x - y * y );\n return max( result, vec3( 0.0 ) );\n}\n#endif";
31148
30363
  var logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
31149
30364
  var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
31150
30365
  var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
@@ -31161,7 +30376,7 @@ var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetB
31161
30376
  var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif";
31162
30377
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif";
31163
30378
  var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;";
31164
- var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
30379
+ var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #if defined( USE_PACKED_NORMALMAP )\n mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n #endif\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
31165
30380
  var normal_pars_fragment = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif";
31166
30381
  var normal_pars_vertex = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif";
31167
30382
  var normal_vertex = "#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif";
@@ -31180,7 +30395,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
31180
30395
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
31181
30396
  var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif";
31182
30397
  var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif";
31183
- var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
30398
+ var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n #ifdef HAS_NORMAL\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #else\n vec3 shadowWorldNormal = vec3( 0.0 );\n #endif\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
31184
30399
  var shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}";
31185
30400
  var skinbase_vertex = "#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
31186
30401
  var skinning_pars_vertex = "#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif";
@@ -31199,7 +30414,7 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defin
31199
30414
  var vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
31200
30415
  var fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
31201
30416
  var vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}";
31202
- var fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
30417
+ var fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
31203
30418
  var vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}";
31204
30419
  var fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
31205
30420
  var vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}";
@@ -31287,6 +30502,7 @@ var ShaderChunk = {
31287
30502
  lights_fragment_begin,
31288
30503
  lights_fragment_maps,
31289
30504
  lights_fragment_end,
30505
+ lightprobes_pars_fragment,
31290
30506
  logdepthbuf_fragment,
31291
30507
  logdepthbuf_pars_fragment,
31292
30508
  logdepthbuf_pars_vertex,
@@ -31390,7 +30606,6 @@ var UniformsLib = {
31390
30606
  envmap: {
31391
30607
  envMap: { value: null },
31392
30608
  envMapRotation: { value: /* @__PURE__ */ new Matrix3() },
31393
- flipEnvMap: { value: -1 },
31394
30609
  reflectivity: { value: 1 },
31395
30610
  // basic, lambert, phong
31396
30611
  ior: { value: 1.5 },
@@ -31509,7 +30724,11 @@ var UniformsLib = {
31509
30724
  height: {}
31510
30725
  } },
31511
30726
  ltc_1: { value: null },
31512
- ltc_2: { value: null }
30727
+ ltc_2: { value: null },
30728
+ probesSH: { value: null },
30729
+ probesMin: { value: /* @__PURE__ */ new Vector3() },
30730
+ probesMax: { value: /* @__PURE__ */ new Vector3() },
30731
+ probesResolution: { value: /* @__PURE__ */ new Vector3() }
31513
30732
  },
31514
30733
  points: {
31515
30734
  diffuse: { value: /* @__PURE__ */ new Color(16777215) },
@@ -31710,7 +30929,6 @@ var ShaderLib = {
31710
30929
  backgroundCube: {
31711
30930
  uniforms: {
31712
30931
  envMap: { value: null },
31713
- flipEnvMap: { value: -1 },
31714
30932
  backgroundBlurriness: { value: 0 },
31715
30933
  backgroundIntensity: { value: 1 },
31716
30934
  backgroundRotation: { value: /* @__PURE__ */ new Matrix3() }
@@ -31814,8 +31032,9 @@ ShaderLib.physical = {
31814
31032
  fragmentShader: ShaderChunk.meshphysical_frag
31815
31033
  };
31816
31034
  var _rgb = { r: 0, b: 0, g: 0 };
31817
- var _e1$1 = /* @__PURE__ */ new Euler();
31818
31035
  var _m1$12 = /* @__PURE__ */ new Matrix4();
31036
+ var _m$1 = /* @__PURE__ */ new Matrix3();
31037
+ _m$1.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
31819
31038
  function WebGLBackground(renderer, environments, state, objects, alpha, premultipliedAlpha) {
31820
31039
  const clearColor = new Color(0);
31821
31040
  let clearAlpha = alpha === true ? 0 : 1;
@@ -31884,19 +31103,13 @@ function WebGLBackground(renderer, environments, state, objects, alpha, premulti
31884
31103
  });
31885
31104
  objects.update(boxMesh);
31886
31105
  }
31887
- _e1$1.copy(scene.backgroundRotation);
31888
- _e1$1.x *= -1;
31889
- _e1$1.y *= -1;
31890
- _e1$1.z *= -1;
31891
- if (background.isCubeTexture && background.isRenderTargetTexture === false) {
31892
- _e1$1.y *= -1;
31893
- _e1$1.z *= -1;
31894
- }
31895
31106
  boxMesh.material.uniforms.envMap.value = background;
31896
- boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
31897
31107
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
31898
31108
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
31899
- boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(_e1$1));
31109
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(scene.backgroundRotation)).transpose();
31110
+ if (background.isCubeTexture && background.isRenderTargetTexture === false) {
31111
+ boxMesh.material.uniforms.backgroundRotation.value.premultiply(_m$1);
31112
+ }
31900
31113
  boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer;
31901
31114
  if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
31902
31115
  boxMesh.material.needsUpdate = true;
@@ -32372,27 +31585,10 @@ function WebGLBufferRenderer(gl, extensions, info2) {
32372
31585
  }
32373
31586
  info2.update(elementCount, mode, 1);
32374
31587
  }
32375
- function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
32376
- if (drawCount === 0) return;
32377
- const extension = extensions.get("WEBGL_multi_draw");
32378
- if (extension === null) {
32379
- for (let i = 0; i < starts.length; i++) {
32380
- renderInstances(starts[i], counts[i], primcount[i]);
32381
- }
32382
- } else {
32383
- extension.multiDrawArraysInstancedWEBGL(mode, starts, 0, counts, 0, primcount, 0, drawCount);
32384
- let elementCount = 0;
32385
- for (let i = 0; i < drawCount; i++) {
32386
- elementCount += counts[i] * primcount[i];
32387
- }
32388
- info2.update(elementCount, mode, 1);
32389
- }
32390
- }
32391
31588
  this.setMode = setMode;
32392
31589
  this.render = render;
32393
31590
  this.renderInstances = renderInstances;
32394
31591
  this.renderMultiDraw = renderMultiDraw;
32395
- this.renderMultiDrawInstances = renderMultiDrawInstances;
32396
31592
  }
32397
31593
  function WebGLCapabilities(gl, extensions, parameters, utils) {
32398
31594
  let maxAnisotropy;
@@ -32442,6 +31638,9 @@ function WebGLCapabilities(gl, extensions, parameters, utils) {
32442
31638
  }
32443
31639
  const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
32444
31640
  const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has("EXT_clip_control");
31641
+ if (parameters.reversedDepthBuffer === true && reversedDepthBuffer === false) {
31642
+ warn2("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");
31643
+ }
32445
31644
  const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
32446
31645
  const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
32447
31646
  const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
@@ -33705,13 +32904,13 @@ function WebGLGeometries(gl, attributes2, info2, bindingStates) {
33705
32904
  const indices = [];
33706
32905
  const geometryIndex = geometry.index;
33707
32906
  const geometryPosition = geometry.attributes.position;
33708
- let version2 = 0;
32907
+ let version = 0;
33709
32908
  if (geometryPosition === void 0) {
33710
32909
  return;
33711
32910
  }
33712
32911
  if (geometryIndex !== null) {
33713
32912
  const array = geometryIndex.array;
33714
- version2 = geometryIndex.version;
32913
+ version = geometryIndex.version;
33715
32914
  for (let i = 0, l = array.length; i < l; i += 3) {
33716
32915
  const a = array[i + 0];
33717
32916
  const b = array[i + 1];
@@ -33720,7 +32919,7 @@ function WebGLGeometries(gl, attributes2, info2, bindingStates) {
33720
32919
  }
33721
32920
  } else {
33722
32921
  const array = geometryPosition.array;
33723
- version2 = geometryPosition.version;
32922
+ version = geometryPosition.version;
33724
32923
  for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) {
33725
32924
  const a = i + 0;
33726
32925
  const b = i + 1;
@@ -33729,7 +32928,7 @@ function WebGLGeometries(gl, attributes2, info2, bindingStates) {
33729
32928
  }
33730
32929
  }
33731
32930
  const attribute = new (geometryPosition.count >= 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1);
33732
- attribute.version = version2;
32931
+ attribute.version = version;
33733
32932
  const previousAttribute = wireframeAttributes.get(geometry);
33734
32933
  if (previousAttribute) attributes2.remove(previousAttribute);
33735
32934
  wireframeAttributes.set(geometry, attribute);
@@ -33783,28 +32982,11 @@ function WebGLIndexedBufferRenderer(gl, extensions, info2) {
33783
32982
  }
33784
32983
  info2.update(elementCount, mode, 1);
33785
32984
  }
33786
- function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
33787
- if (drawCount === 0) return;
33788
- const extension = extensions.get("WEBGL_multi_draw");
33789
- if (extension === null) {
33790
- for (let i = 0; i < starts.length; i++) {
33791
- renderInstances(starts[i] / bytesPerElement, counts[i], primcount[i]);
33792
- }
33793
- } else {
33794
- extension.multiDrawElementsInstancedWEBGL(mode, counts, 0, type, starts, 0, primcount, 0, drawCount);
33795
- let elementCount = 0;
33796
- for (let i = 0; i < drawCount; i++) {
33797
- elementCount += counts[i] * primcount[i];
33798
- }
33799
- info2.update(elementCount, mode, 1);
33800
- }
33801
- }
33802
32985
  this.setMode = setMode;
33803
32986
  this.setIndex = setIndex;
33804
32987
  this.render = render;
33805
32988
  this.renderInstances = renderInstances;
33806
32989
  this.renderMultiDraw = renderMultiDraw;
33807
- this.renderMultiDrawInstances = renderMultiDrawInstances;
33808
32990
  }
33809
32991
  function WebGLInfo(gl) {
33810
32992
  const memory = {
@@ -34007,7 +33189,8 @@ function WebGLOutput(type, width, height, depth, stencil) {
34007
33189
  const targetA = new WebGLRenderTarget(width, height, {
34008
33190
  type,
34009
33191
  depthBuffer: depth,
34010
- stencilBuffer: stencil
33192
+ stencilBuffer: stencil,
33193
+ depthTexture: depth ? new DepthTexture(width, height) : void 0
34011
33194
  });
34012
33195
  const targetB = new WebGLRenderTarget(width, height, {
34013
33196
  type: HalfFloatType,
@@ -34160,6 +33343,7 @@ function WebGLOutput(type, width, height, depth, stencil) {
34160
33343
  return _isCompositing;
34161
33344
  };
34162
33345
  this.dispose = function() {
33346
+ if (targetA.depthTexture) targetA.depthTexture.dispose();
34163
33347
  targetA.dispose();
34164
33348
  targetB.dispose();
34165
33349
  geometry.dispose();
@@ -35171,6 +34355,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
35171
34355
  parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "",
35172
34356
  //
35173
34357
  parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "",
34358
+ parameters.vertexNormals ? "#define HAS_NORMAL" : "",
35174
34359
  parameters.vertexColors ? "#define USE_COLOR" : "",
35175
34360
  parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
35176
34361
  parameters.vertexUv1s ? "#define USE_UV1" : "",
@@ -35257,6 +34442,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
35257
34442
  parameters.normalMap ? "#define USE_NORMALMAP" : "",
35258
34443
  parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "",
35259
34444
  parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "",
34445
+ parameters.packedNormalMap ? "#define USE_PACKED_NORMALMAP" : "",
35260
34446
  parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
35261
34447
  parameters.anisotropy ? "#define USE_ANISOTROPY" : "",
35262
34448
  parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "",
@@ -35297,6 +34483,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
35297
34483
  parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "",
35298
34484
  parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
35299
34485
  parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "",
34486
+ parameters.numLightProbeGrids > 0 ? "#define USE_LIGHT_PROBES_GRID" : "",
35300
34487
  parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "",
35301
34488
  parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "",
35302
34489
  parameters.logarithmicDepthBuffer ? "#define USE_LOGARITHMIC_DEPTH_BUFFER" : "",
@@ -35511,6 +34698,9 @@ var WebGLShaderStage = class {
35511
34698
  this.usedTimes = 0;
35512
34699
  }
35513
34700
  };
34701
+ function isPackedRGFormat(format) {
34702
+ return format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;
34703
+ }
35514
34704
  function WebGLPrograms(renderer, environments, extensions, capabilities, bindingStates, clipping) {
35515
34705
  const _programLayers = new Layers();
35516
34706
  const _customShaders = new WebGLShaderCache();
@@ -35541,7 +34731,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35541
34731
  if (value2 === 0) return "uv";
35542
34732
  return `uv${value2}`;
35543
34733
  }
35544
- function getParameters(material, lights, shadows, scene, object) {
34734
+ function getParameters(material, lights, shadows, scene, object, lightProbeGrids) {
35545
34735
  const fog = scene.fog;
35546
34736
  const geometry = object.geometry;
35547
34737
  const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
@@ -35636,7 +34826,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35636
34826
  instancing: IS_INSTANCEDMESH,
35637
34827
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
35638
34828
  instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
35639
- outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace,
34829
+ outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace,
35640
34830
  alphaToCoverage: !!material.alphaToCoverage,
35641
34831
  map: HAS_MAP,
35642
34832
  matcap: HAS_MATCAP,
@@ -35651,6 +34841,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35651
34841
  emissiveMap: HAS_EMISSIVEMAP,
35652
34842
  normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
35653
34843
  normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
34844
+ packedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat(material.normalMap.format),
35654
34845
  metalnessMap: HAS_METALNESSMAP,
35655
34846
  roughnessMap: HAS_ROUGHNESSMAP,
35656
34847
  anisotropy: HAS_ANISOTROPY,
@@ -35704,6 +34895,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35704
34895
  alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),
35705
34896
  //
35706
34897
  vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),
34898
+ vertexNormals: !!geometry.attributes.normal,
35707
34899
  vertexColors: material.vertexColors,
35708
34900
  vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,
35709
34901
  pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),
@@ -35731,6 +34923,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35731
34923
  numSpotLightShadows: lights.spotShadowMap.length,
35732
34924
  numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
35733
34925
  numLightProbes: lights.numLightProbes,
34926
+ numLightProbeGrids: lightProbeGrids.length,
35734
34927
  numClippingPlanes: clipping.numPlanes,
35735
34928
  numClipIntersection: clipping.numIntersection,
35736
34929
  dithering: material.dithering,
@@ -35874,6 +35067,10 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35874
35067
  _programLayers.enable(20);
35875
35068
  if (parameters.gradientMap)
35876
35069
  _programLayers.enable(21);
35070
+ if (parameters.packedNormalMap)
35071
+ _programLayers.enable(22);
35072
+ if (parameters.vertexNormals)
35073
+ _programLayers.enable(23);
35877
35074
  array.push(_programLayers.mask);
35878
35075
  _programLayers.disableAll();
35879
35076
  if (parameters.fog)
@@ -35920,6 +35117,8 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35920
35117
  _programLayers.enable(20);
35921
35118
  if (parameters.alphaToCoverage)
35922
35119
  _programLayers.enable(21);
35120
+ if (parameters.numLightProbeGrids > 0)
35121
+ _programLayers.enable(22);
35923
35122
  array.push(_programLayers.mask);
35924
35123
  }
35925
35124
  function getUniforms(material) {
@@ -36519,10 +35718,12 @@ function WebGLRenderState(extensions) {
36519
35718
  const lights = new WebGLLights(extensions);
36520
35719
  const lightsArray = [];
36521
35720
  const shadowsArray = [];
35721
+ const lightProbeGridArray = [];
36522
35722
  function init(camera) {
36523
35723
  state.camera = camera;
36524
35724
  lightsArray.length = 0;
36525
35725
  shadowsArray.length = 0;
35726
+ lightProbeGridArray.length = 0;
36526
35727
  }
36527
35728
  function pushLight(light) {
36528
35729
  lightsArray.push(light);
@@ -36530,6 +35731,9 @@ function WebGLRenderState(extensions) {
36530
35731
  function pushShadow(shadowLight) {
36531
35732
  shadowsArray.push(shadowLight);
36532
35733
  }
35734
+ function pushLightProbeGrid(volume) {
35735
+ lightProbeGridArray.push(volume);
35736
+ }
36533
35737
  function setupLights() {
36534
35738
  lights.setup(lightsArray);
36535
35739
  }
@@ -36539,9 +35743,11 @@ function WebGLRenderState(extensions) {
36539
35743
  const state = {
36540
35744
  lightsArray,
36541
35745
  shadowsArray,
35746
+ lightProbeGridArray,
36542
35747
  camera: null,
36543
35748
  lights,
36544
- transmissionRenderTarget: {}
35749
+ transmissionRenderTarget: {},
35750
+ textureUnits: 0
36545
35751
  };
36546
35752
  return {
36547
35753
  init,
@@ -36549,7 +35755,8 @@ function WebGLRenderState(extensions) {
36549
35755
  setupLights,
36550
35756
  setupLightsView,
36551
35757
  pushLight,
36552
- pushShadow
35758
+ pushShadow,
35759
+ pushLightProbeGrid
36553
35760
  };
36554
35761
  }
36555
35762
  function WebGLRenderStates(extensions) {
@@ -37109,6 +36316,7 @@ function WebGLState(gl, extensions) {
37109
36316
  const uboBindings = /* @__PURE__ */ new WeakMap();
37110
36317
  const uboProgramMap = /* @__PURE__ */ new WeakMap();
37111
36318
  let enabledCapabilities = {};
36319
+ let parameters = {};
37112
36320
  let currentBoundFramebuffers = {};
37113
36321
  let currentDrawbuffers = /* @__PURE__ */ new WeakMap();
37114
36322
  let defaultDrawbuffers = [];
@@ -37131,14 +36339,14 @@ function WebGLState(gl, extensions) {
37131
36339
  let currentPolygonOffsetUnits = null;
37132
36340
  const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
37133
36341
  let lineWidthAvailable = false;
37134
- let version2 = 0;
36342
+ let version = 0;
37135
36343
  const glVersion = gl.getParameter(gl.VERSION);
37136
36344
  if (glVersion.indexOf("WebGL") !== -1) {
37137
- version2 = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]);
37138
- lineWidthAvailable = version2 >= 1;
36345
+ version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]);
36346
+ lineWidthAvailable = version >= 1;
37139
36347
  } else if (glVersion.indexOf("OpenGL ES") !== -1) {
37140
- version2 = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]);
37141
- lineWidthAvailable = version2 >= 2;
36348
+ version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]);
36349
+ lineWidthAvailable = version >= 2;
37142
36350
  }
37143
36351
  let currentTextureSlot = null;
37144
36352
  let currentBoundTextures = {};
@@ -37533,6 +36741,19 @@ function WebGLState(gl, extensions) {
37533
36741
  error2("WebGLState:", e);
37534
36742
  }
37535
36743
  }
36744
+ function getParameter(name2) {
36745
+ if (parameters[name2] !== void 0) {
36746
+ return parameters[name2];
36747
+ } else {
36748
+ return gl.getParameter(name2);
36749
+ }
36750
+ }
36751
+ function pixelStorei(name2, value2) {
36752
+ if (parameters[name2] !== value2) {
36753
+ gl.pixelStorei(name2, value2);
36754
+ parameters[name2] = value2;
36755
+ }
36756
+ }
37536
36757
  function scissor(scissor2) {
37537
36758
  if (currentScissor.equals(scissor2) === false) {
37538
36759
  gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w);
@@ -37598,7 +36819,21 @@ function WebGLState(gl, extensions) {
37598
36819
  gl.lineWidth(1);
37599
36820
  gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
37600
36821
  gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
36822
+ gl.pixelStorei(gl.PACK_ALIGNMENT, 4);
36823
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
36824
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
36825
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
36826
+ gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL);
36827
+ gl.pixelStorei(gl.PACK_ROW_LENGTH, 0);
36828
+ gl.pixelStorei(gl.PACK_SKIP_PIXELS, 0);
36829
+ gl.pixelStorei(gl.PACK_SKIP_ROWS, 0);
36830
+ gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
36831
+ gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
36832
+ gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
36833
+ gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
36834
+ gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
37601
36835
  enabledCapabilities = {};
36836
+ parameters = {};
37602
36837
  currentTextureSlot = null;
37603
36838
  currentBoundTextures = {};
37604
36839
  currentBoundFramebuffers = {};
@@ -37652,6 +36887,8 @@ function WebGLState(gl, extensions) {
37652
36887
  compressedTexImage3D,
37653
36888
  texImage2D,
37654
36889
  texImage3D,
36890
+ pixelStorei,
36891
+ getParameter,
37655
36892
  updateUBOMapping,
37656
36893
  uniformBlockBinding,
37657
36894
  texStorage2D,
@@ -37670,6 +36907,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37670
36907
  const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent);
37671
36908
  const _imageDimensions = new Vector2();
37672
36909
  const _videoTextures = /* @__PURE__ */ new WeakMap();
36910
+ const _htmlTextures = /* @__PURE__ */ new Set();
37673
36911
  let _canvas2;
37674
36912
  const _sources = /* @__PURE__ */ new WeakMap();
37675
36913
  let useOffscreenCanvas = false;
@@ -37719,16 +36957,25 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37719
36957
  if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY;
37720
36958
  return _gl.TEXTURE_2D;
37721
36959
  }
37722
- function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) {
36960
+ function getInternalFormat(internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false) {
37723
36961
  if (internalFormatName !== null) {
37724
36962
  if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName];
37725
36963
  warn2("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'");
37726
36964
  }
36965
+ let ext_texture_norm16;
36966
+ if (normalized) {
36967
+ ext_texture_norm16 = extensions.get("EXT_texture_norm16");
36968
+ if (!ext_texture_norm16) {
36969
+ warn2("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension");
36970
+ }
36971
+ }
37727
36972
  let internalFormat = glFormat;
37728
36973
  if (glFormat === _gl.RED) {
37729
36974
  if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
37730
36975
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
37731
36976
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
36977
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_EXT;
36978
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
37732
36979
  }
37733
36980
  if (glFormat === _gl.RED_INTEGER) {
37734
36981
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;
@@ -37742,6 +36989,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37742
36989
  if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
37743
36990
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
37744
36991
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
36992
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_EXT;
36993
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
37745
36994
  }
37746
36995
  if (glFormat === _gl.RG_INTEGER) {
37747
36996
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI;
@@ -37768,6 +37017,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37768
37017
  if (glType === _gl.INT) internalFormat = _gl.RGBA32I;
37769
37018
  }
37770
37019
  if (glFormat === _gl.RGB) {
37020
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_EXT;
37021
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
37771
37022
  if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5;
37772
37023
  if (glType === _gl.UNSIGNED_INT_10F_11F_11F_REV) internalFormat = _gl.R11F_G11F_B10F;
37773
37024
  }
@@ -37776,6 +37027,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37776
37027
  if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
37777
37028
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
37778
37029
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
37030
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_EXT;
37031
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
37779
37032
  if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
37780
37033
  if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
37781
37034
  }
@@ -37824,6 +37077,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37824
37077
  if (texture.isVideoTexture) {
37825
37078
  _videoTextures.delete(texture);
37826
37079
  }
37080
+ if (texture.isHTMLTexture) {
37081
+ _htmlTextures.delete(texture);
37082
+ }
37827
37083
  }
37828
37084
  function onRenderTargetDispose(event) {
37829
37085
  const renderTarget = event.target;
@@ -37900,6 +37156,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
37900
37156
  function resetTextureUnits() {
37901
37157
  textureUnits = 0;
37902
37158
  }
37159
+ function getTextureUnits() {
37160
+ return textureUnits;
37161
+ }
37162
+ function setTextureUnits(value2) {
37163
+ textureUnits = value2;
37164
+ }
37903
37165
  function allocateTextureUnit() {
37904
37166
  const textureUnit = textureUnits;
37905
37167
  if (textureUnit >= capabilities.maxTextures) {
@@ -38082,10 +37344,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38082
37344
  }
38083
37345
  }
38084
37346
  updateRanges.length = mergeIndex + 1;
38085
- const currentUnpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);
38086
- const currentUnpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);
38087
- const currentUnpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);
38088
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
37347
+ const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
37348
+ const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
37349
+ const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
37350
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
38089
37351
  for (let i = 0, l = updateRanges.length; i < l; i++) {
38090
37352
  const range = updateRanges[i];
38091
37353
  const pixelStart = Math.floor(range.start / componentStride);
@@ -38094,14 +37356,14 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38094
37356
  const y = Math.floor(pixelStart / image.width);
38095
37357
  const width = pixelCount;
38096
37358
  const height = 1;
38097
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x);
38098
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
37359
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x);
37360
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
38099
37361
  state.texSubImage2D(_gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data);
38100
37362
  }
38101
37363
  texture.clearUpdateRanges();
38102
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
38103
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
38104
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
37364
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
37365
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
37366
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
38105
37367
  }
38106
37368
  }
38107
37369
  function uploadTexture(textureProperties, texture, slot) {
@@ -38114,18 +37376,21 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38114
37376
  const sourceProperties = properties.get(source);
38115
37377
  if (source.version !== sourceProperties.__version || forceUpload === true) {
38116
37378
  state.activeTexture(_gl.TEXTURE0 + slot);
38117
- const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
38118
- const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
38119
- const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
38120
- _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
38121
- _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
38122
- _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
38123
- _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
37379
+ const isImageBitmap = typeof ImageBitmap !== "undefined" && texture.image instanceof ImageBitmap;
37380
+ if (isImageBitmap === false) {
37381
+ const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
37382
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
37383
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
37384
+ state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
37385
+ state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
37386
+ state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
37387
+ }
37388
+ state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
38124
37389
  let image = resizeImage(texture.image, false, capabilities.maxTextureSize);
38125
37390
  image = verifyColorSpace(texture, image);
38126
37391
  const glFormat = utils.convert(texture.format, texture.colorSpace);
38127
37392
  const glType = utils.convert(texture.type);
38128
- let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture);
37393
+ let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture);
38129
37394
  setTextureParameters(textureType, texture);
38130
37395
  let mipmap;
38131
37396
  const mipmaps = texture.mipmaps;
@@ -38287,6 +37552,35 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38287
37552
  }
38288
37553
  }
38289
37554
  }
37555
+ } else if (texture.isHTMLTexture) {
37556
+ if ("texElementImage2D" in _gl) {
37557
+ const canvas = _gl.canvas;
37558
+ if (!canvas.hasAttribute("layoutsubtree")) {
37559
+ canvas.setAttribute("layoutsubtree", "true");
37560
+ }
37561
+ if (image.parentNode !== canvas) {
37562
+ canvas.appendChild(image);
37563
+ _htmlTextures.add(texture);
37564
+ canvas.onpaint = (event) => {
37565
+ const changed = event.changedElements;
37566
+ for (const t of _htmlTextures) {
37567
+ if (changed.includes(t.image)) {
37568
+ t.needsUpdate = true;
37569
+ }
37570
+ }
37571
+ };
37572
+ canvas.requestPaint();
37573
+ return;
37574
+ }
37575
+ const level = 0;
37576
+ const internalFormat = _gl.RGBA;
37577
+ const srcFormat = _gl.RGBA;
37578
+ const srcType = _gl.UNSIGNED_BYTE;
37579
+ _gl.texElementImage2D(_gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image);
37580
+ _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR);
37581
+ _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
37582
+ _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
37583
+ }
38290
37584
  } else {
38291
37585
  if (mipmaps.length > 0) {
38292
37586
  if (useTexStorage && allocateMemory) {
@@ -38337,10 +37631,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38337
37631
  const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
38338
37632
  const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
38339
37633
  const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
38340
- _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
38341
- _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
38342
- _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
38343
- _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
37634
+ state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
37635
+ state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
37636
+ state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
37637
+ state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
38344
37638
  const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;
38345
37639
  const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
38346
37640
  const cubeImage = [];
@@ -38352,7 +37646,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38352
37646
  }
38353
37647
  cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);
38354
37648
  }
38355
- const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
37649
+ const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
38356
37650
  const useTexStorage = texture.isVideoTexture !== true;
38357
37651
  const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true;
38358
37652
  const dataReady = source.dataReady;
@@ -38449,7 +37743,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38449
37743
  function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) {
38450
37744
  const glFormat = utils.convert(texture.format, texture.colorSpace);
38451
37745
  const glType = utils.convert(texture.type);
38452
- const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
37746
+ const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
38453
37747
  const renderTargetProperties = properties.get(renderTarget);
38454
37748
  const textureProperties = properties.get(texture);
38455
37749
  textureProperties.__renderTarget = renderTarget;
@@ -38491,7 +37785,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38491
37785
  const texture = textures[i];
38492
37786
  const glFormat = utils.convert(texture.format, texture.colorSpace);
38493
37787
  const glType = utils.convert(texture.type);
38494
- const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
37788
+ const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
38495
37789
  if (useMultisampledRTT(renderTarget)) {
38496
37790
  multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, getRenderTargetSamples(renderTarget), glInternalFormat, renderTarget.width, renderTarget.height);
38497
37791
  } else if (useMultisample) {
@@ -38691,7 +37985,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38691
37985
  _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
38692
37986
  const glFormat = utils.convert(texture2.format, texture2.colorSpace);
38693
37987
  const glType = utils.convert(texture2.type);
38694
- const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
37988
+ const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.normalized, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
38695
37989
  const samples = getRenderTargetSamples(renderTarget);
38696
37990
  _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
38697
37991
  _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
@@ -38887,6 +38181,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38887
38181
  }
38888
38182
  this.allocateTextureUnit = allocateTextureUnit;
38889
38183
  this.resetTextureUnits = resetTextureUnits;
38184
+ this.getTextureUnits = getTextureUnits;
38185
+ this.setTextureUnits = setTextureUnits;
38890
38186
  this.setTexture2D = setTexture2D;
38891
38187
  this.setTexture2DArray = setTexture2DArray;
38892
38188
  this.setTexture3D = setTexture3D;
@@ -39607,8 +38903,9 @@ var WebXRManager = class extends EventDispatcher {
39607
38903
  };
39608
38904
  }
39609
38905
  };
39610
- var _e1 = /* @__PURE__ */ new Euler();
39611
38906
  var _m12 = /* @__PURE__ */ new Matrix4();
38907
+ var _m = /* @__PURE__ */ new Matrix3();
38908
+ _m.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
39612
38909
  function WebGLMaterials(renderer, properties) {
39613
38910
  function refreshTransformUniform(map, uniform) {
39614
38911
  if (map.matrixAutoUpdate === true) {
@@ -39626,7 +38923,9 @@ function WebGLMaterials(renderer, properties) {
39626
38923
  }
39627
38924
  }
39628
38925
  function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
39629
- if (material.isMeshBasicMaterial) {
38926
+ if (material.isNodeMaterial) {
38927
+ material.uniformsNeedUpdate = false;
38928
+ } else if (material.isMeshBasicMaterial) {
39630
38929
  refreshUniformsCommon(uniforms, material);
39631
38930
  } else if (material.isMeshLambertMaterial) {
39632
38931
  refreshUniformsCommon(uniforms, material);
@@ -39728,16 +39027,10 @@ function WebGLMaterials(renderer, properties) {
39728
39027
  const envMapRotation = materialProperties.envMapRotation;
39729
39028
  if (envMap) {
39730
39029
  uniforms.envMap.value = envMap;
39731
- _e1.copy(envMapRotation);
39732
- _e1.x *= -1;
39733
- _e1.y *= -1;
39734
- _e1.z *= -1;
39030
+ uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(envMapRotation)).transpose();
39735
39031
  if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) {
39736
- _e1.y *= -1;
39737
- _e1.z *= -1;
39032
+ uniforms.envMapRotation.value.premultiply(_m);
39738
39033
  }
39739
- uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(_e1));
39740
- uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
39741
39034
  uniforms.reflectivity.value = material.reflectivity;
39742
39035
  uniforms.ior.value = material.ior;
39743
39036
  uniforms.refractionRatio.value = material.refractionRatio;
@@ -40003,6 +39296,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40003
39296
  uniform.__data[9] = value2.elements[7];
40004
39297
  uniform.__data[10] = value2.elements[8];
40005
39298
  uniform.__data[11] = 0;
39299
+ } else if (ArrayBuffer.isView(value2)) {
39300
+ uniform.__data.set(new value2.constructor(value2.buffer, value2.byteOffset, uniform.__data.length));
40006
39301
  } else {
40007
39302
  value2.toArray(uniform.__data, arrayOffset);
40008
39303
  arrayOffset += info3.storage / Float32Array.BYTES_PER_ELEMENT;
@@ -40020,6 +39315,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40020
39315
  if (cache[indexString] === void 0) {
40021
39316
  if (typeof value2 === "number" || typeof value2 === "boolean") {
40022
39317
  cache[indexString] = value2;
39318
+ } else if (ArrayBuffer.isView(value2)) {
39319
+ cache[indexString] = value2.slice();
40023
39320
  } else {
40024
39321
  cache[indexString] = value2.clone();
40025
39322
  }
@@ -40031,6 +39328,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40031
39328
  cache[indexString] = value2;
40032
39329
  return true;
40033
39330
  }
39331
+ } else if (ArrayBuffer.isView(value2)) {
39332
+ return true;
40034
39333
  } else {
40035
39334
  if (cachedObject.equals(value2) === false) {
40036
39335
  cachedObject.copy(value2);
@@ -40098,6 +39397,9 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40098
39397
  info3.storage = 64;
40099
39398
  } else if (value2.isTexture) {
40100
39399
  warn2("WebGLRenderer: Texture samplers can not be part of an uniforms group.");
39400
+ } else if (ArrayBuffer.isView(value2)) {
39401
+ info3.boundary = 16;
39402
+ info3.storage = value2.byteLength;
40101
39403
  } else {
40102
39404
  warn2("WebGLRenderer: Unsupported uniform value type.", value2);
40103
39405
  }
@@ -40701,6 +40003,7 @@ var WebGLRenderer = class {
40701
40003
  ]);
40702
40004
  const uintClearColor = new Uint32Array(4);
40703
40005
  const intClearColor = new Int32Array(4);
40006
+ const objectPosition = new Vector3();
40704
40007
  let currentRenderList = null;
40705
40008
  let currentRenderState = null;
40706
40009
  const renderListStack = [];
@@ -40731,6 +40034,7 @@ var WebGLRenderer = class {
40731
40034
  this.transmissionResolutionScale = 1;
40732
40035
  const _this = this;
40733
40036
  let _isContextLost = false;
40037
+ let _nodesHandler = null;
40734
40038
  this._outputColorSpace = SRGBColorSpace;
40735
40039
  let _currentActiveCubeFace = 0;
40736
40040
  let _currentActiveMipmapLevel = 0;
@@ -40899,13 +40203,13 @@ var WebGLRenderer = class {
40899
40203
  };
40900
40204
  this.setEffects = function(effects) {
40901
40205
  if (_outputBufferType === UnsignedByteType) {
40902
- console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
40206
+ error2("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
40903
40207
  return;
40904
40208
  }
40905
40209
  if (effects) {
40906
40210
  for (let i = 0; i < effects.length; i++) {
40907
40211
  if (effects[i].isOutputPass === true) {
40908
- console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
40212
+ warn2("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
40909
40213
  break;
40910
40214
  }
40911
40215
  }
@@ -40996,6 +40300,7 @@ var WebGLRenderer = class {
40996
40300
  }
40997
40301
  if (depth2) {
40998
40302
  bits2 |= _gl.DEPTH_BUFFER_BIT;
40303
+ this.state.buffers.depth.setMask(true);
40999
40304
  }
41000
40305
  if (stencil2) {
41001
40306
  bits2 |= _gl.STENCIL_BUFFER_BIT;
@@ -41014,6 +40319,10 @@ var WebGLRenderer = class {
41014
40319
  this.clearStencil = function() {
41015
40320
  this.clear(false, false, true);
41016
40321
  };
40322
+ this.setNodesHandler = function(nodesHandler) {
40323
+ nodesHandler.setRenderer(this);
40324
+ _nodesHandler = nodesHandler;
40325
+ };
41017
40326
  this.dispose = function() {
41018
40327
  canvas.removeEventListener("webglcontextlost", onContextLost, false);
41019
40328
  canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
@@ -41136,23 +40445,18 @@ var WebGLRenderer = class {
41136
40445
  renderer.setMode(_gl.TRIANGLES);
41137
40446
  }
41138
40447
  if (object.isBatchedMesh) {
41139
- if (object._multiDrawInstances !== null) {
41140
- warnOnce("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");
41141
- renderer.renderMultiDrawInstances(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances);
41142
- } else {
41143
- if (!extensions.get("WEBGL_multi_draw")) {
41144
- const starts = object._multiDrawStarts;
41145
- const counts = object._multiDrawCounts;
41146
- const drawCount2 = object._multiDrawCount;
41147
- const bytesPerElement = index ? attributes2.get(index).bytesPerElement : 1;
41148
- const uniforms = properties.get(material).currentProgram.getUniforms();
41149
- for (let i = 0; i < drawCount2; i++) {
41150
- uniforms.setValue(_gl, "_gl_DrawID", i);
41151
- renderer.render(starts[i] / bytesPerElement, counts[i]);
41152
- }
41153
- } else {
41154
- renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
40448
+ if (!extensions.get("WEBGL_multi_draw")) {
40449
+ const starts = object._multiDrawStarts;
40450
+ const counts = object._multiDrawCounts;
40451
+ const drawCount2 = object._multiDrawCount;
40452
+ const bytesPerElement = index ? attributes2.get(index).bytesPerElement : 1;
40453
+ const uniforms = properties.get(material).currentProgram.getUniforms();
40454
+ for (let i = 0; i < drawCount2; i++) {
40455
+ uniforms.setValue(_gl, "_gl_DrawID", i);
40456
+ renderer.render(starts[i] / bytesPerElement, counts[i]);
41155
40457
  }
40458
+ } else {
40459
+ renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
41156
40460
  }
41157
40461
  } else if (object.isInstancedMesh) {
41158
40462
  renderer.renderInstances(drawStart, drawCount, object.count);
@@ -41273,6 +40577,9 @@ var WebGLRenderer = class {
41273
40577
  return;
41274
40578
  }
41275
40579
  if (_isContextLost === true) return;
40580
+ if (_nodesHandler !== null) {
40581
+ _nodesHandler.renderStart(scene, camera);
40582
+ }
41276
40583
  const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
41277
40584
  const useOutput = output !== null && (_currentRenderTarget === null || isXRPresenting) && output.begin(_this, _currentRenderTarget);
41278
40585
  if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
@@ -41284,6 +40591,7 @@ var WebGLRenderer = class {
41284
40591
  if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
41285
40592
  currentRenderState = renderStates.get(scene, renderStateStack.length);
41286
40593
  currentRenderState.init(camera);
40594
+ currentRenderState.state.textureUnits = textures.getTextureUnits();
41287
40595
  renderStateStack.push(currentRenderState);
41288
40596
  _projScreenMatrix3.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
41289
40597
  _frustum.setFromProjectionMatrix(_projScreenMatrix3, WebGLCoordinateSystem, camera.reversedDepth);
@@ -41351,6 +40659,7 @@ var WebGLRenderer = class {
41351
40659
  renderStateStack.pop();
41352
40660
  if (renderStateStack.length > 0) {
41353
40661
  currentRenderState = renderStateStack[renderStateStack.length - 1];
40662
+ textures.setTextureUnits(currentRenderState.state.textureUnits);
41354
40663
  if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera);
41355
40664
  } else {
41356
40665
  currentRenderState = null;
@@ -41361,6 +40670,9 @@ var WebGLRenderer = class {
41361
40670
  } else {
41362
40671
  currentRenderList = null;
41363
40672
  }
40673
+ if (_nodesHandler !== null) {
40674
+ _nodesHandler.renderEnd();
40675
+ }
41364
40676
  };
41365
40677
  function projectObject(object, camera, groupOrder, sortObjects) {
41366
40678
  if (object.visible === false) return;
@@ -41370,6 +40682,8 @@ var WebGLRenderer = class {
41370
40682
  groupOrder = object.renderOrder;
41371
40683
  } else if (object.isLOD) {
41372
40684
  if (object.autoUpdate === true) object.update(camera);
40685
+ } else if (object.isLightProbeGrid) {
40686
+ currentRenderState.pushLightProbeGrid(object);
41373
40687
  } else if (object.isLight) {
41374
40688
  currentRenderState.pushLight(object);
41375
40689
  if (object.castShadow) {
@@ -41536,7 +40850,7 @@ var WebGLRenderer = class {
41536
40850
  const lights = currentRenderState.state.lights;
41537
40851
  const shadowsArray = currentRenderState.state.shadowsArray;
41538
40852
  const lightsStateVersion = lights.state.version;
41539
- const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
40853
+ const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray);
41540
40854
  const programCacheKey = programCache.getProgramCacheKey(parameters2);
41541
40855
  let programs = materialProperties.programs;
41542
40856
  materialProperties.environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
@@ -41557,6 +40871,9 @@ var WebGLRenderer = class {
41557
40871
  }
41558
40872
  } else {
41559
40873
  parameters2.uniforms = programCache.getUniforms(material);
40874
+ if (_nodesHandler !== null && material.isNodeMaterial) {
40875
+ _nodesHandler.build(material, object, parameters2);
40876
+ }
41560
40877
  material.onBeforeCompile(parameters2, _this);
41561
40878
  program = programCache.acquireProgram(parameters2, programCacheKey);
41562
40879
  programs.set(programCacheKey, program);
@@ -41587,6 +40904,7 @@ var WebGLRenderer = class {
41587
40904
  uniforms.spotLightMap.value = lights.state.spotLightMap;
41588
40905
  uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
41589
40906
  }
40907
+ materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
41590
40908
  materialProperties.currentProgram = program;
41591
40909
  materialProperties.uniformsList = null;
41592
40910
  return program;
@@ -41617,12 +40935,24 @@ var WebGLRenderer = class {
41617
40935
  materialProperties.vertexTangents = parameters2.vertexTangents;
41618
40936
  materialProperties.toneMapping = parameters2.toneMapping;
41619
40937
  }
40938
+ function findLightProbeGrid(volumes, object) {
40939
+ if (volumes.length === 0) return null;
40940
+ if (volumes.length === 1) {
40941
+ return volumes[0].texture !== null ? volumes[0] : null;
40942
+ }
40943
+ objectPosition.setFromMatrixPosition(object.matrixWorld);
40944
+ for (let i = 0, l = volumes.length; i < l; i++) {
40945
+ const v = volumes[i];
40946
+ if (v.texture !== null && v.boundingBox.containsPoint(objectPosition)) return v;
40947
+ }
40948
+ return null;
40949
+ }
41620
40950
  function setProgram(camera, scene, geometry, material, object) {
41621
40951
  if (scene.isScene !== true) scene = _emptyScene;
41622
40952
  textures.resetTextureUnits();
41623
40953
  const fog = scene.fog;
41624
40954
  const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
41625
- const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace;
40955
+ const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace;
41626
40956
  const usePMREM = material.isMeshStandardMaterial || material.isMeshLambertMaterial && !material.envMap || material.isMeshPhongMaterial && !material.envMap;
41627
40957
  const envMap = environments.get(material.envMap || environment, usePMREM);
41628
40958
  const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
@@ -41696,6 +41026,8 @@ var WebGLRenderer = class {
41696
41026
  needsProgramChange = true;
41697
41027
  } else if (materialProperties.morphTargetsCount !== morphTargetsCount) {
41698
41028
  needsProgramChange = true;
41029
+ } else if (!!materialProperties.lightProbeGrid !== currentRenderState.state.lightProbeGridArray.length > 0) {
41030
+ needsProgramChange = true;
41699
41031
  }
41700
41032
  } else {
41701
41033
  needsProgramChange = true;
@@ -41704,6 +41036,9 @@ var WebGLRenderer = class {
41704
41036
  let program = materialProperties.currentProgram;
41705
41037
  if (needsProgramChange === true) {
41706
41038
  program = getProgram(material, scene, object);
41039
+ if (_nodesHandler && material.isNodeMaterial) {
41040
+ _nodesHandler.onUpdateProgram(material, program, materialProperties);
41041
+ }
41707
41042
  }
41708
41043
  let refreshProgram = false;
41709
41044
  let refreshMaterial = false;
@@ -41718,6 +41053,13 @@ var WebGLRenderer = class {
41718
41053
  _currentMaterialId = material.id;
41719
41054
  refreshMaterial = true;
41720
41055
  }
41056
+ if (materialProperties.needsLights) {
41057
+ const objectVolume = findLightProbeGrid(currentRenderState.state.lightProbeGridArray, object);
41058
+ if (materialProperties.lightProbeGrid !== objectVolume) {
41059
+ materialProperties.lightProbeGrid = objectVolume;
41060
+ refreshMaterial = true;
41061
+ }
41062
+ }
41721
41063
  if (refreshProgram || _currentCamera !== camera) {
41722
41064
  const reversedDepthBuffer2 = state.buffers.depth.getReversed();
41723
41065
  if (reversedDepthBuffer2 && camera.reversedDepth !== true) {
@@ -41799,6 +41141,13 @@ var WebGLRenderer = class {
41799
41141
  materials.refreshFogUniforms(m_uniforms, fog);
41800
41142
  }
41801
41143
  materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]);
41144
+ if (materialProperties.needsLights && materialProperties.lightProbeGrid) {
41145
+ const volume = materialProperties.lightProbeGrid;
41146
+ m_uniforms.probesSH.value = volume.texture;
41147
+ m_uniforms.probesMin.value.copy(volume.boundingBox.min);
41148
+ m_uniforms.probesMax.value.copy(volume.boundingBox.max);
41149
+ m_uniforms.probesResolution.value.copy(volume.resolution);
41150
+ }
41802
41151
  WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures);
41803
41152
  }
41804
41153
  if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
@@ -41811,7 +41160,7 @@ var WebGLRenderer = class {
41811
41160
  p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix);
41812
41161
  p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix);
41813
41162
  p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld);
41814
- if (material.isShaderMaterial || material.isRawShaderMaterial) {
41163
+ if (material.uniformsGroups !== void 0) {
41815
41164
  const groups = material.uniformsGroups;
41816
41165
  for (let i = 0, l = groups.length; i < l; i++) {
41817
41166
  const group2 = groups[i];
@@ -42080,19 +41429,20 @@ var WebGLRenderer = class {
42080
41429
  textures.setTexture2D(dstTexture, 0);
42081
41430
  glTarget = _gl.TEXTURE_2D;
42082
41431
  }
42083
- _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
42084
- _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
42085
- _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
42086
- const currentUnpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);
42087
- const currentUnpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
42088
- const currentUnpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);
42089
- const currentUnpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);
42090
- const currentUnpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES);
42091
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
42092
- _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
42093
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
42094
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
42095
- _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
41432
+ state.activeTexture(_gl.TEXTURE0);
41433
+ state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
41434
+ state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
41435
+ state.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
41436
+ const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
41437
+ const currentUnpackImageHeight = state.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
41438
+ const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
41439
+ const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
41440
+ const currentUnpackSkipImages = state.getParameter(_gl.UNPACK_SKIP_IMAGES);
41441
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
41442
+ state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
41443
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
41444
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
41445
+ state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
42096
41446
  const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
42097
41447
  const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
42098
41448
  if (srcTexture.isDepthTexture) {
@@ -42156,11 +41506,11 @@ var WebGLRenderer = class {
42156
41506
  }
42157
41507
  }
42158
41508
  }
42159
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
42160
- _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
42161
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
42162
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
42163
- _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
41509
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
41510
+ state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
41511
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
41512
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
41513
+ state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
42164
41514
  if (dstLevel === 0 && dstTexture.generateMipmaps) {
42165
41515
  _gl.generateMipmap(glTarget);
42166
41516
  }
@@ -42225,7 +41575,7 @@ var WebGLRenderer = class {
42225
41575
 
42226
41576
  // ../../../node_modules/three/examples/jsm/controls/OrbitControls.js
42227
41577
  init_console_gjs();
42228
- init_auto_globals_495e9d950c();
41578
+ init_auto_globals_97a682e619();
42229
41579
  var _changeEvent = { type: "change" };
42230
41580
  var _startEvent = { type: "start" };
42231
41581
  var _endEvent = { type: "end" };
@@ -42367,7 +41717,7 @@ var OrbitControls = class extends Controls {
42367
41717
  this.stopListenToKeyEvents();
42368
41718
  const document3 = this.domElement.getRootNode();
42369
41719
  document3.removeEventListener("keydown", this._interceptControlDown, { capture: true });
42370
- this.domElement.style.touchAction = "auto";
41720
+ this.domElement.style.touchAction = "";
42371
41721
  }
42372
41722
  dispose() {
42373
41723
  this.disconnect();
@@ -43137,7 +42487,7 @@ function interceptControlUp(event) {
43137
42487
 
43138
42488
  // ../../../node_modules/three/examples/jsm/geometries/TeapotGeometry.js
43139
42489
  init_console_gjs();
43140
- init_auto_globals_495e9d950c();
42490
+ init_auto_globals_97a682e619();
43141
42491
  var TeapotGeometry = class extends BufferGeometry {
43142
42492
  /**
43143
42493
  * Constructs a new teapot geometry.
@@ -46097,7 +45447,7 @@ start.__type = [() => __\u03A9HTMLCanvasElement, "canvas", () => __\u03A9StartOp
46097
45447
 
46098
45448
  // blueprint:./teapot-window.blp
46099
45449
  init_console_gjs();
46100
- init_auto_globals_495e9d950c();
45450
+ init_auto_globals_97a682e619();
46101
45451
  var teapot_window_default = '<?xml version="1.0" encoding="UTF-8"?>\n<!--\nDO NOT EDIT!\nThis file was @generated by blueprint-compiler. Instead, edit the\ncorresponding .blp file and regenerate this file with blueprint-compiler.\n-->\n<interface>\n <requires lib="gtk" version="4.0"/>\n <template class="TeapotWindow" parent="AdwApplicationWindow">\n <property name="default-width">1100</property>\n <property name="default-height">700</property>\n <property name="title">Three.js Teapot</property>\n <child type="breakpoint">\n <object class="AdwBreakpoint">\n <condition>max-width: 799sp</condition>\n <setter object="splitView" property="collapsed">true</setter>\n <setter object="splitView" property="show-sidebar">false</setter>\n </object>\n </child>\n <child type="breakpoint">\n <object class="AdwBreakpoint">\n <condition>min-width: 800sp</condition>\n <setter object="splitView" property="collapsed">false</setter>\n <setter object="splitView" property="show-sidebar">true</setter>\n </object>\n </child>\n <property name="content">\n <object class="GtkBox">\n <property name="orientation">1</property>\n <child>\n <object class="AdwHeaderBar">\n <child type="start">\n <object class="GtkToggleButton" id="sidebarToggleButton">\n <property name="icon-name">sidebar-show-symbolic</property>\n <property name="tooltip-text">Toggle Sidebar</property>\n <property name="active" bind-source="splitView" bind-property="show-sidebar" bind-flags="sync-create"/>\n </object>\n </child>\n <child type="end">\n <object class="GtkButton" id="pauseButton">\n <property name="icon-name">media-playback-pause-symbolic</property>\n <property name="tooltip-text">Pause Rendering</property>\n </object>\n </child>\n </object>\n </child>\n <child>\n <object class="AdwOverlaySplitView" id="splitView">\n <property name="sidebar-width-fraction">0.3</property>\n <property name="min-sidebar-width">280</property>\n <property name="max-sidebar-width">400</property>\n <property name="show-sidebar" bind-source="sidebarToggleButton" bind-property="active" bind-flags="sync-create"/>\n <property name="sidebar">\n <object class="GtkScrolledWindow">\n <property name="hscrollbar-policy">2</property>\n <child>\n <object class="GtkBox">\n <property name="orientation">1</property>\n <property name="spacing">12</property>\n <property name="margin-top">12</property>\n <property name="margin-bottom">12</property>\n <property name="margin-start">12</property>\n <property name="margin-end">12</property>\n <child>\n <object class="AdwPreferencesGroup">\n <property name="title">Geometry</property>\n <child>\n <object class="AdwComboRow" id="tessRow">\n <property name="title">Tessellation Level</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="lidRow">\n <property name="title">Display Lid</property>\n <property name="active">true</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="bodyRow">\n <property name="title">Display Body</property>\n <property name="active">true</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="bottomRow">\n <property name="title">Display Bottom</property>\n <property name="active">true</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="fitLidRow">\n <property name="title">Snug Lid</property>\n <property name="active">false</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="nonblinnRow">\n <property name="title">Original Scale</property>\n <property name="active">false</property>\n </object>\n </child>\n </object>\n </child>\n <child>\n <object class="AdwPreferencesGroup">\n <property name="title">Material</property>\n <child>\n <object class="AdwComboRow" id="shadingRow">\n <property name="title">Shading</property>\n </object>\n </child>\n </object>\n </child>\n </object>\n </child>\n </object>\n </property>\n <property name="content">\n <object class="GtkBox" id="glAreaContainer">\n <property name="hexpand">true</property>\n <property name="vexpand">true</property>\n </object>\n </property>\n </object>\n </child>\n </object>\n </property>\n </template>\n</interface>';
46102
45452
 
46103
45453
  // src/gjs/teapot-window.ts