@gjsify/example-dom-three-postprocessing-pixel 0.1.15 → 0.3.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 +1299 -485
  3. package/package.json +12 -12
package/dist/gjs.js CHANGED
@@ -1,3 +1,4 @@
1
+ if(typeof globalThis.process==="undefined"){const _s=imports.system,_G=imports.gi.GLib;globalThis.process={platform:"linux",arch:"x64",version:"v20.0.0",env:new Proxy({},{get(_,p){return typeof p==="string"?(_G.getenv(p)??undefined):undefined},set(_,p,v){if(typeof p==="string")_G.setenv(p,String(v),true);return true},has(_,p){return typeof p==="string"&&_G.getenv(p)!==null},deleteProperty(_,p){if(typeof p==="string")_G.unsetenv(p);return true},ownKeys(){return _G.listenv()??[]},getOwnPropertyDescriptor(_,p){const v=_G.getenv(p);return v!==null?{value:v,writable:true,enumerable:true,configurable:true}:undefined}}),argv:_s?.programArgs?["gjs",_s.programInvocationName||"",..._s.programArgs]:["gjs"],versions:{},config:{},cwd(){return _G.get_current_dir()||"/"},exit(c){_s.exit(c??0)},stderr:{write(s){printerr(s)}},stdout:{write(s){print(s)}},stdin:null,exitCode:undefined,nextTick(fn,...a){Promise.resolve().then(()=>fn(...a))},hrtime(t){return t?[0,0]:[0,0]},};}
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -10,10 +11,6 @@ var __esm = (fn, res) => function __init() {
10
11
  var __commonJS = (cb, mod) => function __require() {
11
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
13
  };
13
- var __export = (target, all) => {
14
- for (var name2 in all)
15
- __defProp(target, name2, { get: all[name2], enumerable: true });
16
- };
17
14
  var __copyProps = (to, from, except, desc) => {
18
15
  if (from && typeof from === "object" || typeof from === "function") {
19
16
  for (let key of __getOwnPropNames(from))
@@ -30,14 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
27
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
28
  mod
32
29
  ));
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
30
 
42
31
  // ../../../packages/infra/esbuild-plugin-gjsify/dist/shims/console-gjs.js
43
32
  function _formatArgs(...args) {
@@ -280,7 +269,7 @@ function makeCallable(Cls) {
280
269
  var init_callable = __esm({
281
270
  "../../../packages/gjs/utils/lib/esm/callable.js"() {
282
271
  init_console_gjs();
283
- init_auto_globals_495e9d950c();
272
+ init_auto_globals_53fe98c6e6();
284
273
  }
285
274
  });
286
275
 
@@ -322,7 +311,7 @@ var B64_CHARS, B64_LOOKUP;
322
311
  var init_base64 = __esm({
323
312
  "../../../packages/gjs/utils/lib/esm/base64.js"() {
324
313
  init_console_gjs();
325
- init_auto_globals_495e9d950c();
314
+ init_auto_globals_53fe98c6e6();
326
315
  B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
327
316
  B64_LOOKUP = new Uint8Array(256);
328
317
  for (let i = 0; i < B64_CHARS.length; i++) B64_LOOKUP[B64_CHARS.charCodeAt(i)] = i;
@@ -333,7 +322,7 @@ var init_base64 = __esm({
333
322
  var init_byte_array = __esm({
334
323
  "../../../packages/gjs/utils/lib/esm/byte-array.js"() {
335
324
  init_console_gjs();
336
- init_auto_globals_495e9d950c();
325
+ init_auto_globals_53fe98c6e6();
337
326
  }
338
327
  });
339
328
 
@@ -343,7 +332,7 @@ var glib_2_0_default;
343
332
  var init_glib_2_0 = __esm({
344
333
  "../../../node_modules/@girs/glib-2.0/glib-2.0.js"() {
345
334
  init_console_gjs();
346
- init_auto_globals_495e9d950c();
335
+ init_auto_globals_53fe98c6e6();
347
336
  glib_2_0_default = GLib;
348
337
  }
349
338
  });
@@ -353,7 +342,7 @@ var glib_2_default;
353
342
  var init_glib_2 = __esm({
354
343
  "../../../node_modules/@girs/glib-2.0/index.js"() {
355
344
  init_console_gjs();
356
- init_auto_globals_495e9d950c();
345
+ init_auto_globals_53fe98c6e6();
357
346
  init_glib_2_0();
358
347
  glib_2_default = glib_2_0_default;
359
348
  }
@@ -364,7 +353,7 @@ var byteArray;
364
353
  var init_cli = __esm({
365
354
  "../../../packages/gjs/utils/lib/esm/cli.js"() {
366
355
  init_console_gjs();
367
- init_auto_globals_495e9d950c();
356
+ init_auto_globals_53fe98c6e6();
368
357
  init_glib_2();
369
358
  byteArray = imports.byteArray;
370
359
  }
@@ -374,7 +363,7 @@ var init_cli = __esm({
374
363
  var init_defer = __esm({
375
364
  "../../../packages/gjs/utils/lib/esm/defer.js"() {
376
365
  init_console_gjs();
377
- init_auto_globals_495e9d950c();
366
+ init_auto_globals_53fe98c6e6();
378
367
  }
379
368
  });
380
369
 
@@ -413,7 +402,7 @@ var VALID_ENCODINGS;
413
402
  var init_encoding = __esm({
414
403
  "../../../packages/gjs/utils/lib/esm/encoding.js"() {
415
404
  init_console_gjs();
416
- init_auto_globals_495e9d950c();
405
+ init_auto_globals_53fe98c6e6();
417
406
  VALID_ENCODINGS = ["utf8", "ascii", "latin1", "binary", "base64", "base64url", "hex", "ucs2", "utf16le"];
418
407
  }
419
408
  });
@@ -427,7 +416,7 @@ function registerGlobal(name2, value2) {
427
416
  var init_globals = __esm({
428
417
  "../../../packages/gjs/utils/lib/esm/globals.js"() {
429
418
  init_console_gjs();
430
- init_auto_globals_495e9d950c();
419
+ init_auto_globals_53fe98c6e6();
431
420
  }
432
421
  });
433
422
 
@@ -436,7 +425,7 @@ var initErrorV8Methods;
436
425
  var init_error = __esm({
437
426
  "../../../packages/gjs/utils/lib/esm/error.js"() {
438
427
  init_console_gjs();
439
- init_auto_globals_495e9d950c();
428
+ init_auto_globals_53fe98c6e6();
440
429
  initErrorV8Methods = (ErrorConstructor) => {
441
430
  if (!Error.captureStackTrace) {
442
431
  Error.captureStackTrace = function(targetObject, constructorOpt) {
@@ -463,7 +452,7 @@ var byteArray2;
463
452
  var init_file = __esm({
464
453
  "../../../packages/gjs/utils/lib/esm/file.js"() {
465
454
  init_console_gjs();
466
- init_auto_globals_495e9d950c();
455
+ init_auto_globals_53fe98c6e6();
467
456
  init_glib_2();
468
457
  byteArray2 = imports.byteArray;
469
458
  }
@@ -475,7 +464,7 @@ var gio_2_0_default;
475
464
  var init_gio_2_0 = __esm({
476
465
  "../../../node_modules/@girs/gio-2.0/gio-2.0.js"() {
477
466
  init_console_gjs();
478
- init_auto_globals_495e9d950c();
467
+ init_auto_globals_53fe98c6e6();
479
468
  gio_2_0_default = Gio;
480
469
  }
481
470
  });
@@ -485,7 +474,7 @@ var gio_2_default;
485
474
  var init_gio_2 = __esm({
486
475
  "../../../node_modules/@girs/gio-2.0/index.js"() {
487
476
  init_console_gjs();
488
- init_auto_globals_495e9d950c();
477
+ init_auto_globals_53fe98c6e6();
489
478
  init_gio_2_0();
490
479
  gio_2_default = gio_2_0_default;
491
480
  }
@@ -496,7 +485,7 @@ import GioUnix from "gi://GioUnix?version=2.0";
496
485
  var init_giounix_2_0 = __esm({
497
486
  "../../../node_modules/@girs/giounix-2.0/giounix-2.0.js"() {
498
487
  init_console_gjs();
499
- init_auto_globals_495e9d950c();
488
+ init_auto_globals_53fe98c6e6();
500
489
  }
501
490
  });
502
491
 
@@ -504,7 +493,7 @@ var init_giounix_2_0 = __esm({
504
493
  var init_giounix_2 = __esm({
505
494
  "../../../node_modules/@girs/giounix-2.0/index.js"() {
506
495
  init_console_gjs();
507
- init_auto_globals_495e9d950c();
496
+ init_auto_globals_53fe98c6e6();
508
497
  init_giounix_2_0();
509
498
  }
510
499
  });
@@ -513,7 +502,7 @@ var init_giounix_2 = __esm({
513
502
  var init_fs = __esm({
514
503
  "../../../packages/gjs/utils/lib/esm/fs.js"() {
515
504
  init_console_gjs();
516
- init_auto_globals_495e9d950c();
505
+ init_auto_globals_53fe98c6e6();
517
506
  init_gio_2();
518
507
  init_giounix_2();
519
508
  }
@@ -524,7 +513,7 @@ var byteArray3;
524
513
  var init_gio = __esm({
525
514
  "../../../packages/gjs/utils/lib/esm/gio.js"() {
526
515
  init_console_gjs();
527
- init_auto_globals_495e9d950c();
516
+ init_auto_globals_53fe98c6e6();
528
517
  init_glib_2();
529
518
  byteArray3 = imports.byteArray;
530
519
  }
@@ -534,7 +523,7 @@ var init_gio = __esm({
534
523
  var init_gio_errors = __esm({
535
524
  "../../../packages/gjs/utils/lib/esm/gio-errors.js"() {
536
525
  init_console_gjs();
537
- init_auto_globals_495e9d950c();
526
+ init_auto_globals_53fe98c6e6();
538
527
  }
539
528
  });
540
529
 
@@ -543,7 +532,7 @@ var warnNotImplemented;
543
532
  var init_message = __esm({
544
533
  "../../../packages/gjs/utils/lib/esm/message.js"() {
545
534
  init_console_gjs();
546
- init_auto_globals_495e9d950c();
535
+ init_auto_globals_53fe98c6e6();
547
536
  warnNotImplemented = (msg) => {
548
537
  const message = msg ? `Not implemented: ${msg}` : "Not implemented";
549
538
  console.warn(message);
@@ -552,15 +541,23 @@ var init_message = __esm({
552
541
  }
553
542
  });
554
543
 
544
+ // ../../../packages/gjs/utils/lib/esm/microtask.js
545
+ var queueMicrotask2;
546
+ var init_microtask = __esm({
547
+ "../../../packages/gjs/utils/lib/esm/microtask.js"() {
548
+ init_console_gjs();
549
+ init_auto_globals_53fe98c6e6();
550
+ queueMicrotask2 = (fn) => {
551
+ Promise.resolve().then(fn);
552
+ };
553
+ }
554
+ });
555
+
555
556
  // ../../../packages/gjs/utils/lib/esm/next-tick.js
556
- var nextTick;
557
557
  var init_next_tick = __esm({
558
558
  "../../../packages/gjs/utils/lib/esm/next-tick.js"() {
559
559
  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
- };
560
+ init_auto_globals_53fe98c6e6();
564
561
  }
565
562
  });
566
563
 
@@ -569,7 +566,7 @@ var File;
569
566
  var init_path = __esm({
570
567
  "../../../packages/gjs/utils/lib/esm/path.js"() {
571
568
  init_console_gjs();
572
- init_auto_globals_495e9d950c();
569
+ init_auto_globals_53fe98c6e6();
573
570
  init_gio_2();
574
571
  init_glib_2();
575
572
  ({ File } = gio_2_default);
@@ -581,16 +578,41 @@ var toString;
581
578
  var init_structured_clone = __esm({
582
579
  "../../../packages/gjs/utils/lib/esm/structured-clone.js"() {
583
580
  init_console_gjs();
584
- init_auto_globals_495e9d950c();
581
+ init_auto_globals_53fe98c6e6();
585
582
  ({ toString } = Object.prototype);
586
583
  }
587
584
  });
588
585
 
589
586
  // ../../../packages/gjs/utils/lib/esm/main-loop.js
587
+ function ensureMainLoop() {
588
+ const gjsImports = globalThis.imports;
589
+ if (!gjsImports) return void 0;
590
+ if (_started) return _loop;
591
+ const GLibModule = gjsImports.gi.GLib;
592
+ _loop = new GLibModule.MainLoop(null, false);
593
+ _started = true;
594
+ if (GLibModule.main_depth() === 0) {
595
+ try {
596
+ _loop.runAsync();
597
+ } catch {
598
+ }
599
+ }
600
+ return _loop;
601
+ }
602
+ function quitMainLoop() {
603
+ if (_loop) {
604
+ _loop.quit();
605
+ _started = false;
606
+ _loop = null;
607
+ }
608
+ }
609
+ var _started, _loop;
590
610
  var init_main_loop = __esm({
591
611
  "../../../packages/gjs/utils/lib/esm/main-loop.js"() {
592
612
  init_console_gjs();
593
- init_auto_globals_495e9d950c();
613
+ init_auto_globals_53fe98c6e6();
614
+ _started = false;
615
+ _loop = null;
594
616
  }
595
617
  });
596
618
 
@@ -598,7 +620,7 @@ var init_main_loop = __esm({
598
620
  var init_esm = __esm({
599
621
  "../../../packages/gjs/utils/lib/esm/index.js"() {
600
622
  init_console_gjs();
601
- init_auto_globals_495e9d950c();
623
+ init_auto_globals_53fe98c6e6();
602
624
  init_callable();
603
625
  init_base64();
604
626
  init_byte_array();
@@ -612,6 +634,7 @@ var init_esm = __esm({
612
634
  init_gio();
613
635
  init_gio_errors();
614
636
  init_message();
637
+ init_microtask();
615
638
  init_next_tick();
616
639
  init_path();
617
640
  init_structured_clone();
@@ -624,7 +647,7 @@ var _encoder, BlobPolyfill, FilePolyfill, Blob2, File2;
624
647
  var init_blob = __esm({
625
648
  "../../../packages/node/buffer/lib/esm/blob.js"() {
626
649
  init_console_gjs();
627
- init_auto_globals_495e9d950c();
650
+ init_auto_globals_53fe98c6e6();
628
651
  _encoder = new TextEncoder();
629
652
  BlobPolyfill = class _BlobPolyfill {
630
653
  _parts;
@@ -694,7 +717,7 @@ var init_blob = __esm({
694
717
  var init_register = __esm({
695
718
  "../../../packages/node/buffer/lib/esm/register.js"() {
696
719
  init_console_gjs();
697
- init_auto_globals_495e9d950c();
720
+ init_auto_globals_53fe98c6e6();
698
721
  init_esm();
699
722
  init_blob();
700
723
  registerGlobal("Blob", Blob2);
@@ -796,7 +819,7 @@ var NAMED_COLORS, BLACK;
796
819
  var init_color = __esm({
797
820
  "../../../packages/dom/canvas2d-core/lib/esm/color.js"() {
798
821
  init_console_gjs();
799
- init_auto_globals_495e9d950c();
822
+ init_auto_globals_53fe98c6e6();
800
823
  NAMED_COLORS = {
801
824
  aliceblue: "#f0f8ff",
802
825
  antiquewhite: "#faebd7",
@@ -1055,7 +1078,7 @@ var COMPOSITE_OP_MAP, LINE_CAP_MAP, LINE_JOIN_MAP;
1055
1078
  var init_cairo_utils = __esm({
1056
1079
  "../../../packages/dom/canvas2d-core/lib/esm/cairo-utils.js"() {
1057
1080
  init_console_gjs();
1058
- init_auto_globals_495e9d950c();
1081
+ init_auto_globals_53fe98c6e6();
1059
1082
  COMPOSITE_OP_MAP = {
1060
1083
  "source-over": 2,
1061
1084
  // OVER
@@ -1161,7 +1184,7 @@ function cloneState(state) {
1161
1184
  var init_canvas_state = __esm({
1162
1185
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-state.js"() {
1163
1186
  init_console_gjs();
1164
- init_auto_globals_495e9d950c();
1187
+ init_auto_globals_53fe98c6e6();
1165
1188
  init_color();
1166
1189
  }
1167
1190
  });
@@ -1171,7 +1194,7 @@ var OurImageData;
1171
1194
  var init_image_data = __esm({
1172
1195
  "../../../packages/dom/canvas2d-core/lib/esm/image-data.js"() {
1173
1196
  init_console_gjs();
1174
- init_auto_globals_495e9d950c();
1197
+ init_auto_globals_53fe98c6e6();
1175
1198
  OurImageData = class {
1176
1199
  constructor(swOrData, sh, maybeHeight) {
1177
1200
  this.colorSpace = "srgb";
@@ -1200,7 +1223,7 @@ var CanvasGradient;
1200
1223
  var init_canvas_gradient = __esm({
1201
1224
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-gradient.js"() {
1202
1225
  init_console_gjs();
1203
- init_auto_globals_495e9d950c();
1226
+ init_auto_globals_53fe98c6e6();
1204
1227
  init_color();
1205
1228
  CanvasGradient = class {
1206
1229
  constructor(type, x0, y0, x1, y1, r0, r1) {
@@ -1230,7 +1253,7 @@ var CanvasPattern;
1230
1253
  var init_canvas_pattern = __esm({
1231
1254
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-pattern.js"() {
1232
1255
  init_console_gjs();
1233
- init_auto_globals_495e9d950c();
1256
+ init_auto_globals_53fe98c6e6();
1234
1257
  CanvasPattern = class _CanvasPattern {
1235
1258
  constructor(surface, repetition) {
1236
1259
  this._pattern = new Cairo2.SurfacePattern(surface);
@@ -1292,7 +1315,7 @@ var Path2D;
1292
1315
  var init_canvas_path = __esm({
1293
1316
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-path.js"() {
1294
1317
  init_console_gjs();
1295
- init_auto_globals_495e9d950c();
1318
+ init_auto_globals_53fe98c6e6();
1296
1319
  init_cairo_utils();
1297
1320
  Path2D = class _Path2D {
1298
1321
  constructor(pathOrSvg) {
@@ -1406,7 +1429,7 @@ var CanvasRenderingContext2D;
1406
1429
  var init_canvas_rendering_context_2d = __esm({
1407
1430
  "../../../packages/dom/canvas2d-core/lib/esm/canvas-rendering-context-2d.js"() {
1408
1431
  init_console_gjs();
1409
- init_auto_globals_495e9d950c();
1432
+ init_auto_globals_53fe98c6e6();
1410
1433
  init_color();
1411
1434
  init_cairo_utils();
1412
1435
  init_canvas_state();
@@ -2393,7 +2416,7 @@ var init_canvas_rendering_context_2d = __esm({
2393
2416
  var init_esm2 = __esm({
2394
2417
  "../../../packages/dom/canvas2d-core/lib/esm/index.js"() {
2395
2418
  init_console_gjs();
2396
- init_auto_globals_495e9d950c();
2419
+ init_auto_globals_53fe98c6e6();
2397
2420
  init_canvas_rendering_context_2d();
2398
2421
  init_canvas_gradient();
2399
2422
  init_canvas_pattern();
@@ -2408,7 +2431,7 @@ var DOMExceptionCodes, _DOMExceptionPolyfill, DOMException2;
2408
2431
  var init_esm3 = __esm({
2409
2432
  "../../../packages/web/dom-exception/lib/esm/index.js"() {
2410
2433
  init_console_gjs();
2411
- init_auto_globals_495e9d950c();
2434
+ init_auto_globals_53fe98c6e6();
2412
2435
  DOMExceptionCodes = {
2413
2436
  IndexSizeError: 1,
2414
2437
  HierarchyRequestError: 3,
@@ -2450,7 +2473,7 @@ var kType, kBubbles, kCancelable, kComposed, kTarget, kCurrentTarget, kEventPhas
2450
2473
  var init_esm4 = __esm({
2451
2474
  "../../../packages/web/dom-events/lib/esm/index.js"() {
2452
2475
  init_console_gjs();
2453
- init_auto_globals_495e9d950c();
2476
+ init_auto_globals_53fe98c6e6();
2454
2477
  init_esm3();
2455
2478
  kType = /* @__PURE__ */ Symbol("type");
2456
2479
  kBubbles = /* @__PURE__ */ Symbol("bubbles");
@@ -2914,7 +2937,7 @@ var NodeType;
2914
2937
  var init_node_type = __esm({
2915
2938
  "../../../packages/dom/dom-elements/lib/esm/node-type.js"() {
2916
2939
  init_console_gjs();
2917
- init_auto_globals_495e9d950c();
2940
+ init_auto_globals_53fe98c6e6();
2918
2941
  NodeType = {
2919
2942
  ELEMENT_NODE: 1,
2920
2943
  ATTRIBUTE_NODE: 2,
@@ -2934,7 +2957,7 @@ var NodeList;
2934
2957
  var init_node_list = __esm({
2935
2958
  "../../../packages/dom/dom-elements/lib/esm/node-list.js"() {
2936
2959
  init_console_gjs();
2937
- init_auto_globals_495e9d950c();
2960
+ init_auto_globals_53fe98c6e6();
2938
2961
  NodeList = class {
2939
2962
  constructor(items) {
2940
2963
  this._items = items;
@@ -2974,7 +2997,7 @@ var nodeType, parentNode, childNodesList, elementChildren, isConnected, tagName,
2974
2997
  var init_property_symbol = __esm({
2975
2998
  "../../../packages/dom/dom-elements/lib/esm/property-symbol.js"() {
2976
2999
  init_console_gjs();
2977
- init_auto_globals_495e9d950c();
3000
+ init_auto_globals_53fe98c6e6();
2978
3001
  nodeType = /* @__PURE__ */ Symbol("nodeType");
2979
3002
  parentNode = /* @__PURE__ */ Symbol("parentNode");
2980
3003
  childNodesList = /* @__PURE__ */ Symbol("childNodesList");
@@ -2997,7 +3020,7 @@ var _a, _b, _c, _d, _e, Node;
2997
3020
  var init_node = __esm({
2998
3021
  "../../../packages/dom/dom-elements/lib/esm/node.js"() {
2999
3022
  init_console_gjs();
3000
- init_auto_globals_495e9d950c();
3023
+ init_auto_globals_53fe98c6e6();
3001
3024
  init_esm4();
3002
3025
  init_node_type();
3003
3026
  init_node_list();
@@ -3247,7 +3270,7 @@ var Attr;
3247
3270
  var init_attr = __esm({
3248
3271
  "../../../packages/dom/dom-elements/lib/esm/attr.js"() {
3249
3272
  init_console_gjs();
3250
- init_auto_globals_495e9d950c();
3273
+ init_auto_globals_53fe98c6e6();
3251
3274
  init_property_symbol();
3252
3275
  Attr = class {
3253
3276
  constructor(name2, value2, namespaceURI2 = null, prefix2 = null, ownerElement2 = null) {
@@ -3284,7 +3307,7 @@ var NamespaceURI;
3284
3307
  var init_namespace_uri = __esm({
3285
3308
  "../../../packages/dom/dom-elements/lib/esm/namespace-uri.js"() {
3286
3309
  init_console_gjs();
3287
- init_auto_globals_495e9d950c();
3310
+ init_auto_globals_53fe98c6e6();
3288
3311
  NamespaceURI = {
3289
3312
  html: "http://www.w3.org/1999/xhtml",
3290
3313
  svg: "http://www.w3.org/2000/svg",
@@ -3300,7 +3323,7 @@ var NamedNodeMap;
3300
3323
  var init_named_node_map = __esm({
3301
3324
  "../../../packages/dom/dom-elements/lib/esm/named-node-map.js"() {
3302
3325
  init_console_gjs();
3303
- init_auto_globals_495e9d950c();
3326
+ init_auto_globals_53fe98c6e6();
3304
3327
  init_attr();
3305
3328
  init_namespace_uri();
3306
3329
  NamedNodeMap = class {
@@ -3430,7 +3453,7 @@ var _a2, _b2, _c2, _d2, _e2, _f, Element;
3430
3453
  var init_element = __esm({
3431
3454
  "../../../packages/dom/dom-elements/lib/esm/element.js"() {
3432
3455
  init_console_gjs();
3433
- init_auto_globals_495e9d950c();
3456
+ init_auto_globals_53fe98c6e6();
3434
3457
  init_node();
3435
3458
  init_node_type();
3436
3459
  init_named_node_map();
@@ -3682,7 +3705,7 @@ var CSSStyleDeclaration, HTMLElement;
3682
3705
  var init_html_element = __esm({
3683
3706
  "../../../packages/dom/dom-elements/lib/esm/html-element.js"() {
3684
3707
  init_console_gjs();
3685
- init_auto_globals_495e9d950c();
3708
+ init_auto_globals_53fe98c6e6();
3686
3709
  init_esm4();
3687
3710
  init_element();
3688
3711
  init_property_symbol();
@@ -4112,7 +4135,7 @@ var HTMLCanvasElement2;
4112
4135
  var init_html_canvas_element = __esm({
4113
4136
  "../../../packages/dom/dom-elements/lib/esm/html-canvas-element.js"() {
4114
4137
  init_console_gjs();
4115
- init_auto_globals_495e9d950c();
4138
+ init_auto_globals_53fe98c6e6();
4116
4139
  init_html_element();
4117
4140
  HTMLCanvasElement2 = class _HTMLCanvasElement extends HTMLElement {
4118
4141
  constructor() {
@@ -4192,7 +4215,7 @@ var DOMMatrix, DOMMatrixReadOnly;
4192
4215
  var init_dom_matrix = __esm({
4193
4216
  "../../../packages/dom/dom-elements/lib/esm/dom-matrix.js"() {
4194
4217
  init_console_gjs();
4195
- init_auto_globals_495e9d950c();
4218
+ init_auto_globals_53fe98c6e6();
4196
4219
  DOMMatrix = class _DOMMatrix {
4197
4220
  constructor(init) {
4198
4221
  this.a = 1;
@@ -4330,7 +4353,7 @@ function defineGlobalIfMissing(name2, value2) {
4330
4353
  var init_helpers = __esm({
4331
4354
  "../../../packages/dom/dom-elements/lib/esm/register/helpers.js"() {
4332
4355
  init_console_gjs();
4333
- init_auto_globals_495e9d950c();
4356
+ init_auto_globals_53fe98c6e6();
4334
4357
  }
4335
4358
  });
4336
4359
 
@@ -4339,7 +4362,7 @@ var CANVAS2D_KEY;
4339
4362
  var init_canvas = __esm({
4340
4363
  "../../../packages/dom/dom-elements/lib/esm/register/canvas.js"() {
4341
4364
  init_console_gjs();
4342
- init_auto_globals_495e9d950c();
4365
+ init_auto_globals_53fe98c6e6();
4343
4366
  init_esm2();
4344
4367
  init_html_canvas_element();
4345
4368
  init_dom_matrix();
@@ -4364,7 +4387,7 @@ var CharacterData;
4364
4387
  var init_character_data = __esm({
4365
4388
  "../../../packages/dom/dom-elements/lib/esm/character-data.js"() {
4366
4389
  init_console_gjs();
4367
- init_auto_globals_495e9d950c();
4390
+ init_auto_globals_53fe98c6e6();
4368
4391
  init_node();
4369
4392
  init_node_type();
4370
4393
  init_property_symbol();
@@ -4426,7 +4449,7 @@ var Comment;
4426
4449
  var init_comment = __esm({
4427
4450
  "../../../packages/dom/dom-elements/lib/esm/comment.js"() {
4428
4451
  init_console_gjs();
4429
- init_auto_globals_495e9d950c();
4452
+ init_auto_globals_53fe98c6e6();
4430
4453
  init_character_data();
4431
4454
  init_node_type();
4432
4455
  init_property_symbol();
@@ -4454,7 +4477,7 @@ var gdkpixbuf_2_0_default;
4454
4477
  var init_gdkpixbuf_2_0 = __esm({
4455
4478
  "../../../node_modules/@girs/gdkpixbuf-2.0/gdkpixbuf-2.0.js"() {
4456
4479
  init_console_gjs();
4457
- init_auto_globals_495e9d950c();
4480
+ init_auto_globals_53fe98c6e6();
4458
4481
  gdkpixbuf_2_0_default = GdkPixbuf2;
4459
4482
  }
4460
4483
  });
@@ -4464,7 +4487,7 @@ var gdkpixbuf_2_default;
4464
4487
  var init_gdkpixbuf_2 = __esm({
4465
4488
  "../../../node_modules/@girs/gdkpixbuf-2.0/index.js"() {
4466
4489
  init_console_gjs();
4467
- init_auto_globals_495e9d950c();
4490
+ init_auto_globals_53fe98c6e6();
4468
4491
  init_gdkpixbuf_2_0();
4469
4492
  gdkpixbuf_2_default = gdkpixbuf_2_0_default;
4470
4493
  }
@@ -4476,7 +4499,7 @@ var HTMLImageElement2;
4476
4499
  var init_html_image_element = __esm({
4477
4500
  "../../../packages/dom/dom-elements/lib/esm/html-image-element.js"() {
4478
4501
  init_console_gjs();
4479
- init_auto_globals_495e9d950c();
4502
+ init_auto_globals_53fe98c6e6();
4480
4503
  init_glib_2();
4481
4504
  init_gio_2();
4482
4505
  init_gdkpixbuf_2();
@@ -4711,7 +4734,7 @@ var HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUG
4711
4734
  var init_html_media_element = __esm({
4712
4735
  "../../../packages/dom/dom-elements/lib/esm/html-media-element.js"() {
4713
4736
  init_console_gjs();
4714
- init_auto_globals_495e9d950c();
4737
+ init_auto_globals_53fe98c6e6();
4715
4738
  init_esm4();
4716
4739
  init_html_element();
4717
4740
  HAVE_NOTHING = 0;
@@ -4824,33 +4847,129 @@ var init_html_media_element = __esm({
4824
4847
  }
4825
4848
  });
4826
4849
 
4850
+ // ../../../packages/dom/dom-elements/lib/esm/gst-time.js
4851
+ function secondsToGstTime(seconds) {
4852
+ return BigInt(Math.round(seconds * NS_PER_SECOND));
4853
+ }
4854
+ function gstTimeToSeconds(nanoseconds) {
4855
+ return Number(nanoseconds) / NS_PER_SECOND;
4856
+ }
4857
+ var NS_PER_SECOND;
4858
+ var init_gst_time = __esm({
4859
+ "../../../packages/dom/dom-elements/lib/esm/gst-time.js"() {
4860
+ init_console_gjs();
4861
+ init_auto_globals_53fe98c6e6();
4862
+ NS_PER_SECOND = 1e9;
4863
+ }
4864
+ });
4865
+
4827
4866
  // ../../../packages/dom/dom-elements/lib/esm/html-video-element.js
4828
- var HTMLVideoElement2;
4867
+ 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
4868
  var init_html_video_element = __esm({
4830
4869
  "../../../packages/dom/dom-elements/lib/esm/html-video-element.js"() {
4831
4870
  init_console_gjs();
4832
- init_auto_globals_495e9d950c();
4871
+ init_auto_globals_53fe98c6e6();
4833
4872
  init_html_media_element();
4873
+ init_esm4();
4834
4874
  init_property_symbol();
4835
4875
  init_namespace_uri();
4876
+ init_gst_time();
4877
+ GST_STATE_PLAYING = 4;
4878
+ GST_STATE_PAUSED = 3;
4879
+ GST_FORMAT_TIME = 3;
4880
+ GST_SEEK_FLAG_FLUSH = 1;
4881
+ GST_SEEK_FLAG_KEY_UNIT = 4;
4882
+ GST_SEEK_TYPE_SET = 1;
4883
+ GST_SEEK_TYPE_NONE = 0;
4836
4884
  HTMLVideoElement2 = class extends HTMLMediaElement {
4837
4885
  constructor() {
4838
4886
  super();
4887
+ this._pipeline = null;
4839
4888
  this._videoWidth = 0;
4840
4889
  this._videoHeight = 0;
4841
4890
  this.poster = "";
4842
4891
  this[tagName] = "VIDEO";
4843
4892
  this[localName] = "video";
4844
4893
  this[namespaceURI] = NamespaceURI.html;
4894
+ const self2 = this;
4895
+ Object.defineProperty(this, "paused", {
4896
+ get() {
4897
+ if (!self2._pipeline) return true;
4898
+ const [, state] = self2._pipeline.get_state(0n);
4899
+ return state !== GST_STATE_PLAYING;
4900
+ },
4901
+ configurable: true,
4902
+ enumerable: true
4903
+ });
4904
+ Object.defineProperty(this, "currentTime", {
4905
+ get() {
4906
+ if (!self2._pipeline) return 0;
4907
+ const [ok, pos] = self2._pipeline.query_position(GST_FORMAT_TIME);
4908
+ return ok ? gstTimeToSeconds(pos) : 0;
4909
+ },
4910
+ set(seconds) {
4911
+ self2._pipeline?.seek(
4912
+ 1,
4913
+ GST_FORMAT_TIME,
4914
+ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
4915
+ GST_SEEK_TYPE_SET,
4916
+ secondsToGstTime(seconds),
4917
+ GST_SEEK_TYPE_NONE,
4918
+ -1n
4919
+ );
4920
+ },
4921
+ configurable: true,
4922
+ enumerable: true
4923
+ });
4924
+ Object.defineProperty(this, "duration", {
4925
+ get() {
4926
+ if (!self2._pipeline) return NaN;
4927
+ const [ok, dur] = self2._pipeline.query_duration(GST_FORMAT_TIME);
4928
+ return ok && Number(dur) > 0 ? gstTimeToSeconds(dur) : NaN;
4929
+ },
4930
+ configurable: true,
4931
+ enumerable: true
4932
+ });
4933
+ Object.defineProperty(this, "volume", {
4934
+ get() {
4935
+ return self2._playbin()?.volume ?? 1;
4936
+ },
4937
+ set(v) {
4938
+ const pb = self2._playbin();
4939
+ if (pb) pb.volume = Math.max(0, Math.min(1, v));
4940
+ },
4941
+ configurable: true,
4942
+ enumerable: true
4943
+ });
4944
+ Object.defineProperty(this, "muted", {
4945
+ get() {
4946
+ return self2._playbin()?.mute ?? false;
4947
+ },
4948
+ set(v) {
4949
+ const pb = self2._playbin();
4950
+ if (pb) pb.mute = v;
4951
+ },
4952
+ configurable: true,
4953
+ enumerable: true
4954
+ });
4955
+ }
4956
+ async play() {
4957
+ this._pipeline?.set_state(GST_STATE_PLAYING);
4958
+ this.dispatchEvent(new Event("play"));
4959
+ this.dispatchEvent(new Event("playing"));
4960
+ }
4961
+ pause() {
4962
+ this._pipeline?.set_state(GST_STATE_PAUSED);
4963
+ this.dispatchEvent(new Event("pause"));
4845
4964
  }
4846
- /** Intrinsic width of the video (set by the bridge when media metadata loads). */
4965
+ /** Intrinsic width of the video (set by bridge when media metadata loads). */
4847
4966
  get videoWidth() {
4848
4967
  return this._videoWidth;
4849
4968
  }
4850
4969
  set videoWidth(value2) {
4851
4970
  this._videoWidth = value2;
4852
4971
  }
4853
- /** Intrinsic height of the video (set by the bridge when media metadata loads). */
4972
+ /** Intrinsic height of the video (set by bridge when media metadata loads). */
4854
4973
  get videoHeight() {
4855
4974
  return this._videoHeight;
4856
4975
  }
@@ -4860,6 +4979,9 @@ var init_html_video_element = __esm({
4860
4979
  get [Symbol.toStringTag]() {
4861
4980
  return "HTMLVideoElement";
4862
4981
  }
4982
+ _playbin() {
4983
+ return this._pipeline?.get_by_name("playbin") ?? null;
4984
+ }
4863
4985
  };
4864
4986
  }
4865
4987
  });
@@ -4869,7 +4991,7 @@ var Text;
4869
4991
  var init_text = __esm({
4870
4992
  "../../../packages/dom/dom-elements/lib/esm/text.js"() {
4871
4993
  init_console_gjs();
4872
- init_auto_globals_495e9d950c();
4994
+ init_auto_globals_53fe98c6e6();
4873
4995
  init_character_data();
4874
4996
  init_node_type();
4875
4997
  init_property_symbol();
@@ -4926,7 +5048,7 @@ var DocumentFragment;
4926
5048
  var init_document_fragment = __esm({
4927
5049
  "../../../packages/dom/dom-elements/lib/esm/document-fragment.js"() {
4928
5050
  init_console_gjs();
4929
- init_auto_globals_495e9d950c();
5051
+ init_auto_globals_53fe98c6e6();
4930
5052
  init_node();
4931
5053
  init_text();
4932
5054
  init_node_type();
@@ -5044,7 +5166,7 @@ var Document, document2;
5044
5166
  var init_document = __esm({
5045
5167
  "../../../packages/dom/dom-elements/lib/esm/document.js"() {
5046
5168
  init_console_gjs();
5047
- init_auto_globals_495e9d950c();
5169
+ init_auto_globals_53fe98c6e6();
5048
5170
  init_node();
5049
5171
  init_html_element();
5050
5172
  init_html_image_element();
@@ -5133,7 +5255,7 @@ var DOMTokenList;
5133
5255
  var init_dom_token_list = __esm({
5134
5256
  "../../../packages/dom/dom-elements/lib/esm/dom-token-list.js"() {
5135
5257
  init_console_gjs();
5136
- init_auto_globals_495e9d950c();
5258
+ init_auto_globals_53fe98c6e6();
5137
5259
  DOMTokenList = class {
5138
5260
  constructor(ownerElement2, attributeName) {
5139
5261
  this._ownerElement = ownerElement2;
@@ -5248,7 +5370,7 @@ var Window;
5248
5370
  var init_document2 = __esm({
5249
5371
  "../../../packages/dom/dom-elements/lib/esm/register/document.js"() {
5250
5372
  init_console_gjs();
5251
- init_auto_globals_495e9d950c();
5373
+ init_auto_globals_53fe98c6e6();
5252
5374
  init_esm4();
5253
5375
  init_comment();
5254
5376
  init_document();
@@ -5297,7 +5419,7 @@ var Image;
5297
5419
  var init_image = __esm({
5298
5420
  "../../../packages/dom/dom-elements/lib/esm/image.js"() {
5299
5421
  init_console_gjs();
5300
- init_auto_globals_495e9d950c();
5422
+ init_auto_globals_53fe98c6e6();
5301
5423
  init_html_image_element();
5302
5424
  Image = class extends HTMLImageElement2 {
5303
5425
  /**
@@ -5323,7 +5445,7 @@ var init_image = __esm({
5323
5445
  var init_image2 = __esm({
5324
5446
  "../../../packages/dom/dom-elements/lib/esm/register/image.js"() {
5325
5447
  init_console_gjs();
5326
- init_auto_globals_495e9d950c();
5448
+ init_auto_globals_53fe98c6e6();
5327
5449
  init_html_image_element();
5328
5450
  init_image();
5329
5451
  init_helpers();
@@ -5336,7 +5458,7 @@ var init_image2 = __esm({
5336
5458
  var init_navigator = __esm({
5337
5459
  "../../../packages/dom/dom-elements/lib/esm/register/navigator.js"() {
5338
5460
  init_console_gjs();
5339
- init_auto_globals_495e9d950c();
5461
+ init_auto_globals_53fe98c6e6();
5340
5462
  if (typeof globalThis.navigator === "undefined") {
5341
5463
  globalThis.navigator = {};
5342
5464
  }
@@ -5451,7 +5573,7 @@ var textEncoder, textDecoder, hasSharedArrayBuffer, Buffer2, kMaxLength, kString
5451
5573
  var init_buffer = __esm({
5452
5574
  "../../../packages/node/buffer/lib/esm/buffer.js"() {
5453
5575
  init_console_gjs();
5454
- init_auto_globals_495e9d950c();
5576
+ init_auto_globals_53fe98c6e6();
5455
5577
  init_esm();
5456
5578
  textEncoder = new TextEncoder();
5457
5579
  textDecoder = new TextDecoder();
@@ -6004,7 +6126,7 @@ var atob2, btoa;
6004
6126
  var init_esm5 = __esm({
6005
6127
  "../../../packages/node/buffer/lib/esm/index.js"() {
6006
6128
  init_console_gjs();
6007
- init_auto_globals_495e9d950c();
6129
+ init_auto_globals_53fe98c6e6();
6008
6130
  init_buffer();
6009
6131
  atob2 = globalThis.atob;
6010
6132
  btoa = globalThis.btoa;
@@ -6015,7 +6137,7 @@ var init_esm5 = __esm({
6015
6137
  var init_buffer2 = __esm({
6016
6138
  "../../../packages/node/globals/lib/esm/register/buffer.js"() {
6017
6139
  init_console_gjs();
6018
- init_auto_globals_495e9d950c();
6140
+ init_auto_globals_53fe98c6e6();
6019
6141
  init_esm5();
6020
6142
  init_register();
6021
6143
  if (!("Buffer" in globalThis)) {
@@ -6033,7 +6155,7 @@ var init_buffer2 = __esm({
6033
6155
  var init_encoding2 = __esm({
6034
6156
  "../../../packages/node/globals/lib/esm/register/encoding.js"() {
6035
6157
  init_console_gjs();
6036
- init_auto_globals_495e9d950c();
6158
+ init_auto_globals_53fe98c6e6();
6037
6159
  init_glib_2();
6038
6160
  if (typeof globalThis.btoa !== "function") {
6039
6161
  Object.defineProperty(globalThis, "btoa", {
@@ -6068,19 +6190,14 @@ var init_encoding2 = __esm({
6068
6190
  });
6069
6191
 
6070
6192
  // ../../../packages/node/globals/lib/esm/register/microtask.js
6071
- var init_microtask = __esm({
6193
+ var init_microtask2 = __esm({
6072
6194
  "../../../packages/node/globals/lib/esm/register/microtask.js"() {
6073
6195
  init_console_gjs();
6074
- init_auto_globals_495e9d950c();
6196
+ init_auto_globals_53fe98c6e6();
6197
+ init_esm();
6075
6198
  if (typeof queueMicrotask !== "function") {
6076
6199
  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
- },
6200
+ value: queueMicrotask2,
6084
6201
  enumerable: true,
6085
6202
  writable: true,
6086
6203
  configurable: true
@@ -6153,7 +6270,7 @@ var kCapture, kRejection, EventEmitter;
6153
6270
  var init_event_emitter = __esm({
6154
6271
  "../../../packages/node/events/lib/esm/event-emitter.js"() {
6155
6272
  init_console_gjs();
6156
- init_auto_globals_495e9d950c();
6273
+ init_auto_globals_53fe98c6e6();
6157
6274
  kCapture = /* @__PURE__ */ Symbol("kCapture");
6158
6275
  kRejection = /* @__PURE__ */ Symbol.for("nodejs.rejection");
6159
6276
  EventEmitter = class _EventEmitter {
@@ -6683,30 +6800,48 @@ var init_event_emitter = __esm({
6683
6800
  }
6684
6801
  };
6685
6802
  EventEmitter.EventEmitter = EventEmitter;
6803
+ {
6804
+ const methods = [
6805
+ "setMaxListeners",
6806
+ "getMaxListeners",
6807
+ "emit",
6808
+ "addListener",
6809
+ "on",
6810
+ "prependListener",
6811
+ "once",
6812
+ "prependOnceListener",
6813
+ "removeListener",
6814
+ "off",
6815
+ "removeAllListeners",
6816
+ "listeners",
6817
+ "rawListeners",
6818
+ "listenerCount",
6819
+ "eventNames"
6820
+ ];
6821
+ for (const m of methods) {
6822
+ const fn = EventEmitter.prototype[m];
6823
+ if (typeof fn === "function") {
6824
+ Object.defineProperty(EventEmitter.prototype, m, {
6825
+ enumerable: true,
6826
+ configurable: true,
6827
+ writable: true,
6828
+ value: fn
6829
+ });
6830
+ }
6831
+ }
6832
+ Object.defineProperty(EventEmitter.prototype, "_events", { enumerable: true, configurable: true, writable: true, value: void 0 });
6833
+ Object.defineProperty(EventEmitter.prototype, "_eventsCount", { enumerable: true, configurable: true, writable: true, value: 0 });
6834
+ Object.defineProperty(EventEmitter.prototype, "_maxListeners", { enumerable: true, configurable: true, writable: true, value: void 0 });
6835
+ }
6686
6836
  }
6687
6837
  });
6688
6838
 
6689
6839
  // ../../../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;
6840
+ var EventEmitter2, captureRejectionSymbol, errorMonitor, defaultMaxListeners, setMaxListeners, getMaxListeners, once, on, getEventListeners, listenerCount, addAbortListener;
6706
6841
  var init_esm6 = __esm({
6707
6842
  "../../../packages/node/events/lib/esm/index.js"() {
6708
6843
  init_console_gjs();
6709
- init_auto_globals_495e9d950c();
6844
+ init_auto_globals_53fe98c6e6();
6710
6845
  init_esm();
6711
6846
  init_event_emitter();
6712
6847
  EventEmitter2 = makeCallable(EventEmitter);
@@ -6721,17 +6856,24 @@ var init_esm6 = __esm({
6721
6856
  getEventListeners = EventEmitter2.getEventListeners;
6722
6857
  listenerCount = EventEmitter2.listenerCount;
6723
6858
  addAbortListener = EventEmitter2.addAbortListener;
6724
- index_default = EventEmitter2;
6725
6859
  }
6726
6860
  });
6727
6861
 
6728
- // ../../../packages/node/events/cjs-compat.cjs
6729
- var require_cjs_compat = __commonJS({
6730
- "../../../packages/node/events/cjs-compat.cjs"(exports, module) {
6862
+ // ../../../packages/node/terminal-native/lib/esm/index.js
6863
+ var _mod, _gi, nativeTerminal;
6864
+ var init_esm7 = __esm({
6865
+ "../../../packages/node/terminal-native/lib/esm/index.js"() {
6731
6866
  init_console_gjs();
6732
- init_auto_globals_495e9d950c();
6733
- var mod = (init_esm6(), __toCommonJS(esm_exports));
6734
- module.exports = mod.default || mod;
6867
+ init_auto_globals_53fe98c6e6();
6868
+ _mod = null;
6869
+ _gi = globalThis.imports?.gi;
6870
+ if (_gi) {
6871
+ try {
6872
+ _mod = _gi["GjsifyTerminal"];
6873
+ } catch {
6874
+ }
6875
+ }
6876
+ nativeTerminal = _mod;
6735
6877
  }
6736
6878
  });
6737
6879
 
@@ -6820,12 +6962,6 @@ function detectArch() {
6820
6962
  if (typeof globalThis.process?.arch === "string") {
6821
6963
  return globalThis.process.arch;
6822
6964
  }
6823
- try {
6824
- const system = getGjsGlobal().imports?.system;
6825
- if (system?.programInvocationName) {
6826
- }
6827
- } catch {
6828
- }
6829
6965
  return "x64";
6830
6966
  }
6831
6967
  function getCwd() {
@@ -6920,6 +7056,22 @@ function getPid() {
6920
7056
  }
6921
7057
  return 0;
6922
7058
  }
7059
+ function getGioNamespace() {
7060
+ const _gi2 = globalThis.imports?.gi;
7061
+ if (!_gi2) return null;
7062
+ let gio = null;
7063
+ try {
7064
+ gio = _gi2["GioUnix"];
7065
+ } catch {
7066
+ }
7067
+ if (!gio) {
7068
+ try {
7069
+ gio = _gi2["Gio"];
7070
+ } catch {
7071
+ }
7072
+ }
7073
+ return gio;
7074
+ }
6923
7075
  function getMonotonicTime() {
6924
7076
  try {
6925
7077
  const GLib4 = getGjsGlobal().imports?.gi?.GLib;
@@ -6933,15 +7085,248 @@ function getMonotonicTime() {
6933
7085
  }
6934
7086
  return BigInt(Date.now()) * 1000000n;
6935
7087
  }
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({
7088
+ var _encoder2, startTime, ProcessWriteStream, ProcessReadStream, hrtimeBase, Process, process, platform, arch, env, argv, argv0, execPath, pid, ppid, version, versions, cwd, chdir, exit, nextTick, hrtime, uptime, memoryUsage, cpuUsage, kill, abort, umask, emitWarning, execArgv, config, stdout, stderr, stdin, index_default;
7089
+ var init_esm8 = __esm({
6938
7090
  "../../../packages/node/process/lib/esm/index.js"() {
6939
7091
  init_console_gjs();
6940
- init_auto_globals_495e9d950c();
6941
- import_events = __toESM(require_cjs_compat(), 1);
7092
+ init_auto_globals_53fe98c6e6();
7093
+ init_esm6();
7094
+ init_esm();
7095
+ init_esm7();
7096
+ _encoder2 = new TextEncoder();
6942
7097
  startTime = Date.now();
7098
+ ProcessWriteStream = class extends EventEmitter2 {
7099
+ fd;
7100
+ // Required by Stream.pipe(): without this, pipe skips dest.write() entirely.
7101
+ writable = true;
7102
+ _outGio = null;
7103
+ constructor(fd) {
7104
+ super();
7105
+ this.fd = fd;
7106
+ const gio = getGioNamespace();
7107
+ if (gio) {
7108
+ const Cls = gio.UnixOutputStream ?? gio.OutputStream;
7109
+ if (Cls) {
7110
+ try {
7111
+ this._outGio = Cls.new(this.fd, false);
7112
+ } catch {
7113
+ }
7114
+ }
7115
+ }
7116
+ }
7117
+ write(data) {
7118
+ if (this._outGio) {
7119
+ try {
7120
+ const bytes = typeof data === "string" ? _encoder2.encode(data) : data;
7121
+ this._outGio.write_all(bytes, null);
7122
+ return true;
7123
+ } catch {
7124
+ }
7125
+ }
7126
+ if (this.fd === 2) {
7127
+ console.error(data);
7128
+ } else {
7129
+ console.log(data);
7130
+ }
7131
+ return true;
7132
+ }
7133
+ get isTTY() {
7134
+ if (nativeTerminal) return nativeTerminal.Terminal.is_tty(this.fd);
7135
+ try {
7136
+ const GLib4 = getGjsGlobal().imports?.gi?.GLib;
7137
+ if (GLib4) return !!GLib4.log_writer_supports_color(this.fd);
7138
+ } catch {
7139
+ }
7140
+ return false;
7141
+ }
7142
+ get columns() {
7143
+ if (nativeTerminal) {
7144
+ const [ok, , cols] = nativeTerminal.Terminal.get_size(this.fd);
7145
+ if (ok && cols > 0) return cols;
7146
+ }
7147
+ try {
7148
+ const GLib4 = getGjsGlobal().imports?.gi?.GLib;
7149
+ if (GLib4) {
7150
+ const c = parseInt(GLib4.getenv("COLUMNS") ?? "0", 10);
7151
+ if (c > 0) return c;
7152
+ }
7153
+ } catch {
7154
+ }
7155
+ return 80;
7156
+ }
7157
+ // stdout/stderr must never be closed — the process owns the fds.
7158
+ // pipe() calls end() when its source emits 'end' (e.g. MuteStream); no-op here.
7159
+ end() {
7160
+ }
7161
+ destroy() {
7162
+ }
7163
+ get rows() {
7164
+ if (nativeTerminal) {
7165
+ const [ok, rows] = nativeTerminal.Terminal.get_size(this.fd);
7166
+ if (ok && rows > 0) return rows;
7167
+ }
7168
+ try {
7169
+ const GLib4 = getGjsGlobal().imports?.gi?.GLib;
7170
+ if (GLib4) {
7171
+ const r = parseInt(GLib4.getenv("LINES") ?? "0", 10);
7172
+ if (r > 0) return r;
7173
+ }
7174
+ } catch {
7175
+ }
7176
+ return 24;
7177
+ }
7178
+ };
7179
+ ProcessReadStream = class extends EventEmitter2 {
7180
+ fd;
7181
+ isRaw = false;
7182
+ // Do NOT expose `readableFlowing` as an instance property: @inquirer/core uses
7183
+ // `'readableFlowing' in input` to defer startCycle() via setImmediate. In GJS,
7184
+ // setImmediate fires as a microtask — the property must stay absent so
7185
+ // @inquirer/core calls startCycle() synchronously on its own schedule.
7186
+ _gio = null;
7187
+ _stdinGio = null;
7188
+ _reading = false;
7189
+ _flowing = false;
7190
+ _sttyCleanupRegistered = false;
7191
+ _mainLoopHeld = false;
7192
+ // True while a read_bytes_async is in-flight. Prevents a second concurrent
7193
+ // read from starting when pause()+resume() fires between GLib iterations.
7194
+ _pendingRead = false;
7195
+ constructor(fd) {
7196
+ super();
7197
+ this.fd = fd;
7198
+ this._gio = getGioNamespace();
7199
+ }
7200
+ get isTTY() {
7201
+ if (nativeTerminal) return nativeTerminal.Terminal.is_tty(this.fd);
7202
+ return false;
7203
+ }
7204
+ setRawMode(mode) {
7205
+ if (nativeTerminal) {
7206
+ const ok = nativeTerminal.Terminal.set_raw_mode(this.fd, mode);
7207
+ if (ok) {
7208
+ this.isRaw = mode;
7209
+ return this;
7210
+ }
7211
+ }
7212
+ this._setRawModeViaStty(mode);
7213
+ this.isRaw = mode;
7214
+ return this;
7215
+ }
7216
+ _setRawModeViaStty(mode) {
7217
+ try {
7218
+ const _gi2 = globalThis.imports?.gi;
7219
+ const Gio3 = _gi2?.Gio ?? _gi2?.["Gio"];
7220
+ if (!Gio3) return;
7221
+ const STDIN_INHERIT = Gio3.SubprocessFlags?.STDIN_INHERIT ?? 2;
7222
+ const argv2 = mode ? ["stty", "-icanon", "-echo", "-icrnl", "min", "1", "time", "0"] : ["stty", "icanon", "echo", "icrnl"];
7223
+ const launcher = new Gio3.SubprocessLauncher({ flags: STDIN_INHERIT });
7224
+ const proc = launcher.spawnv(argv2);
7225
+ proc.wait(null);
7226
+ if (mode && !this._sttyCleanupRegistered) {
7227
+ this._sttyCleanupRegistered = true;
7228
+ const proc_ = globalThis.process;
7229
+ if (proc_?.once && typeof proc_.once === "function") {
7230
+ proc_.once("exit", () => this._setRawModeViaStty(false));
7231
+ }
7232
+ }
7233
+ } catch {
7234
+ }
7235
+ }
7236
+ setEncoding(_enc) {
7237
+ return this;
7238
+ }
7239
+ resume() {
7240
+ this._flowing = true;
7241
+ if (this._gio && this.fd === 0 && !this._reading) {
7242
+ this._startReading();
7243
+ }
7244
+ return this;
7245
+ }
7246
+ pause() {
7247
+ this._flowing = false;
7248
+ this._reading = false;
7249
+ if (this._mainLoopHeld) {
7250
+ this._mainLoopHeld = false;
7251
+ const _gi2 = globalThis.imports?.gi;
7252
+ const GLib4 = _gi2?.GLib ?? _gi2?.["GLib"];
7253
+ if (GLib4?.idle_add) {
7254
+ GLib4.idle_add(300, () => {
7255
+ if (!this._mainLoopHeld) quitMainLoop();
7256
+ return false;
7257
+ });
7258
+ } else {
7259
+ quitMainLoop();
7260
+ }
7261
+ }
7262
+ return this;
7263
+ }
7264
+ read() {
7265
+ return null;
7266
+ }
7267
+ _startReading() {
7268
+ if (!this._gio || this._reading) return;
7269
+ if (this._pendingRead) {
7270
+ this._reading = true;
7271
+ if (!this._mainLoopHeld) {
7272
+ this._mainLoopHeld = true;
7273
+ ensureMainLoop();
7274
+ }
7275
+ return;
7276
+ }
7277
+ this._reading = true;
7278
+ if (!this._mainLoopHeld) {
7279
+ this._mainLoopHeld = true;
7280
+ ensureMainLoop();
7281
+ }
7282
+ if (!this._stdinGio) {
7283
+ const Cls = this._gio.UnixInputStream ?? this._gio.InputStream;
7284
+ if (!Cls) {
7285
+ this._reading = false;
7286
+ return;
7287
+ }
7288
+ try {
7289
+ this._stdinGio = Cls.new(this.fd, false);
7290
+ } catch {
7291
+ this._reading = false;
7292
+ return;
7293
+ }
7294
+ }
7295
+ const loop = () => {
7296
+ if (!this._reading) {
7297
+ this._pendingRead = false;
7298
+ return;
7299
+ }
7300
+ this._pendingRead = true;
7301
+ this._stdinGio.read_bytes_async(
7302
+ 4096,
7303
+ 0,
7304
+ null,
7305
+ (src, res) => {
7306
+ this._pendingRead = false;
7307
+ try {
7308
+ const bytes = src.read_bytes_finish(res);
7309
+ const data = bytes?.get_data?.() ?? null;
7310
+ if (data && data.byteLength > 0) {
7311
+ this.emit("data", Buffer.from(data));
7312
+ } else if (data !== null && data.byteLength === 0) {
7313
+ this._reading = false;
7314
+ this.emit("end");
7315
+ return;
7316
+ }
7317
+ } catch {
7318
+ this._reading = false;
7319
+ return;
7320
+ }
7321
+ if (this._reading) loop();
7322
+ }
7323
+ );
7324
+ };
7325
+ loop();
7326
+ }
7327
+ };
6943
7328
  hrtimeBase = getMonotonicTime();
6944
- Process = class extends import_events.EventEmitter {
7329
+ Process = class extends EventEmitter2 {
6945
7330
  platform;
6946
7331
  arch;
6947
7332
  env;
@@ -7024,11 +7409,25 @@ var init_esm7 = __esm({
7024
7409
  exit(code) {
7025
7410
  this.exitCode = code ?? this.exitCode ?? 0;
7026
7411
  this.emit("exit", this.exitCode);
7412
+ const gjsImports = getGjsGlobal().imports;
7413
+ const GLib4 = gjsImports?.gi?.GLib;
7414
+ const system = gjsImports?.system;
7415
+ const idleAdd = GLib4?.idle_add;
7416
+ const sourceRemove = GLib4?.SOURCE_REMOVE;
7417
+ const priorityDefault = GLib4?.PRIORITY_DEFAULT;
7418
+ if (system?.exit && idleAdd && typeof priorityDefault === "number" && typeof sourceRemove === "boolean") {
7419
+ const exitCodeNow = this.exitCode;
7420
+ ensureMainLoop();
7421
+ idleAdd(priorityDefault, () => {
7422
+ quitMainLoop();
7423
+ system.exit(exitCodeNow);
7424
+ return sourceRemove;
7425
+ });
7426
+ return new Promise(() => {
7427
+ });
7428
+ }
7027
7429
  try {
7028
- const system = getGjsGlobal().imports?.system;
7029
- if (system?.exit) {
7030
- system.exit(this.exitCode);
7031
- }
7430
+ if (system?.exit) system.exit(this.exitCode);
7032
7431
  } catch {
7033
7432
  }
7034
7433
  const nativeProcess = globalThis.process;
@@ -7089,18 +7488,11 @@ var init_esm7 = __esm({
7089
7488
  }
7090
7489
  return { user: 0, system: 0 };
7091
7490
  }
7092
- // Stub: stdout/stderr/stdin — these need stream to be implemented fully
7093
7491
  // Note: Cannot check globalThis.process.stdout here — on GJS globalThis.process
7094
7492
  // 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 };
7493
+ stdout = new ProcessWriteStream(1);
7494
+ stderr = new ProcessWriteStream(2);
7495
+ stdin = new ProcessReadStream(0);
7104
7496
  abort() {
7105
7497
  this.exit(1);
7106
7498
  }
@@ -7120,6 +7512,17 @@ var init_esm7 = __esm({
7120
7512
  return getMonotonicTime() - hrtimeBase;
7121
7513
  };
7122
7514
  process = new Process();
7515
+ if (nativeTerminal) {
7516
+ try {
7517
+ const watcher = new nativeTerminal.ResizeWatcher();
7518
+ watcher.connect("resized", (_obj2, _rows, _cols) => {
7519
+ process.stdout.emit("resize");
7520
+ process.stderr.emit("resize");
7521
+ });
7522
+ watcher.start();
7523
+ } catch {
7524
+ }
7525
+ }
7123
7526
  platform = process.platform;
7124
7527
  arch = process.arch;
7125
7528
  env = process.env;
@@ -7133,7 +7536,7 @@ var init_esm7 = __esm({
7133
7536
  cwd = process.cwd.bind(process);
7134
7537
  chdir = process.chdir.bind(process);
7135
7538
  exit = process.exit.bind(process);
7136
- nextTick2 = process.nextTick.bind(process);
7539
+ nextTick = process.nextTick.bind(process);
7137
7540
  hrtime = process.hrtime.bind(process);
7138
7541
  uptime = process.uptime.bind(process);
7139
7542
  memoryUsage = process.memoryUsage.bind(process);
@@ -7147,7 +7550,7 @@ var init_esm7 = __esm({
7147
7550
  stdout = process.stdout;
7148
7551
  stderr = process.stderr;
7149
7552
  stdin = process.stdin;
7150
- index_default2 = process;
7553
+ index_default = process;
7151
7554
  }
7152
7555
  });
7153
7556
 
@@ -7155,9 +7558,9 @@ var init_esm7 = __esm({
7155
7558
  var init_process = __esm({
7156
7559
  "../../../packages/node/globals/lib/esm/register/process.js"() {
7157
7560
  init_console_gjs();
7158
- init_auto_globals_495e9d950c();
7561
+ init_auto_globals_53fe98c6e6();
7159
7562
  init_esm();
7160
- init_esm7();
7563
+ init_esm8();
7161
7564
  if (typeof Promise.withResolvers !== "function") {
7162
7565
  Promise.withResolvers = function() {
7163
7566
  let resolve;
@@ -7178,10 +7581,124 @@ var init_process = __esm({
7178
7581
  configurable: true
7179
7582
  });
7180
7583
  }
7181
- if (!("process" in globalThis)) {
7182
- Object.defineProperty(globalThis, "process", {
7183
- value: index_default2,
7184
- enumerable: false,
7584
+ Object.defineProperty(globalThis, "process", {
7585
+ value: index_default,
7586
+ enumerable: false,
7587
+ writable: true,
7588
+ configurable: true
7589
+ });
7590
+ }
7591
+ });
7592
+
7593
+ // ../../../packages/node/globals/lib/esm/register/timers.js
7594
+ function getGLib() {
7595
+ return globalThis.imports?.gi?.GLib;
7596
+ }
7597
+ function removeById(timeout) {
7598
+ if (timeout instanceof GjsifyTimeout) {
7599
+ timeout._cancel();
7600
+ } else if (typeof timeout === "number") {
7601
+ try {
7602
+ getGLib()?.Source.remove(timeout);
7603
+ } catch {
7604
+ }
7605
+ }
7606
+ }
7607
+ function setImmediate(callback, ...args) {
7608
+ return setTimeout(callback, 0, ...args);
7609
+ }
7610
+ function clearImmediate(id) {
7611
+ clearTimeout(id);
7612
+ }
7613
+ var _isGjsTimer, GjsifyTimeout;
7614
+ var init_timers = __esm({
7615
+ "../../../packages/node/globals/lib/esm/register/timers.js"() {
7616
+ init_console_gjs();
7617
+ init_auto_globals_53fe98c6e6();
7618
+ _isGjsTimer = getGLib() !== void 0;
7619
+ GjsifyTimeout = class {
7620
+ _id = null;
7621
+ _refed = true;
7622
+ _callback;
7623
+ _delay;
7624
+ _args;
7625
+ _repeat;
7626
+ constructor(callback, delay, args, repeat) {
7627
+ this._callback = callback;
7628
+ this._delay = delay;
7629
+ this._args = args;
7630
+ this._repeat = repeat;
7631
+ this._schedule();
7632
+ }
7633
+ _schedule() {
7634
+ const GLib4 = getGLib();
7635
+ if (!GLib4) return;
7636
+ const timeoutAdd = GLib4.timeout_add.bind(GLib4);
7637
+ this._id = timeoutAdd(GLib4.PRIORITY_DEFAULT, this._delay, () => {
7638
+ try {
7639
+ this._callback.apply(globalThis, this._args);
7640
+ } catch (err) {
7641
+ setTimeout(() => {
7642
+ throw err;
7643
+ }, 0);
7644
+ }
7645
+ if (this._repeat) return GLib4.SOURCE_CONTINUE;
7646
+ this._id = null;
7647
+ return GLib4.SOURCE_REMOVE;
7648
+ });
7649
+ }
7650
+ ref() {
7651
+ this._refed = true;
7652
+ return this;
7653
+ }
7654
+ unref() {
7655
+ this._refed = false;
7656
+ return this;
7657
+ }
7658
+ hasRef() {
7659
+ return this._refed;
7660
+ }
7661
+ refresh() {
7662
+ this._cancel();
7663
+ this._schedule();
7664
+ return this;
7665
+ }
7666
+ _cancel() {
7667
+ if (this._id === null) return;
7668
+ try {
7669
+ getGLib()?.Source.remove(this._id);
7670
+ } catch {
7671
+ }
7672
+ this._id = null;
7673
+ }
7674
+ [Symbol.toPrimitive]() {
7675
+ return this._id;
7676
+ }
7677
+ [Symbol.dispose]() {
7678
+ this._cancel();
7679
+ }
7680
+ };
7681
+ if (_isGjsTimer) {
7682
+ const setT = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, false);
7683
+ const setI = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, true);
7684
+ const g = globalThis;
7685
+ g.setTimeout = setT;
7686
+ g.clearTimeout = removeById;
7687
+ g.setInterval = setI;
7688
+ g.clearInterval = removeById;
7689
+ }
7690
+ if (!("setImmediate" in globalThis)) {
7691
+ Object.defineProperty(globalThis, "setImmediate", {
7692
+ value: setImmediate,
7693
+ enumerable: true,
7694
+ writable: true,
7695
+ configurable: true
7696
+ });
7697
+ }
7698
+ if (!("clearImmediate" in globalThis)) {
7699
+ Object.defineProperty(globalThis, "clearImmediate", {
7700
+ value: clearImmediate,
7701
+ enumerable: true,
7185
7702
  writable: true,
7186
7703
  configurable: true
7187
7704
  });
@@ -7201,10 +7718,10 @@ function encodeComponent(s) {
7201
7718
  return encodeURIComponent(s).replace(/%20/g, "+");
7202
7719
  }
7203
7720
  var PARSE_FLAGS, URLSearchParams, URL2;
7204
- var init_esm8 = __esm({
7721
+ var init_esm9 = __esm({
7205
7722
  "../../../packages/node/url/lib/esm/index.js"() {
7206
7723
  init_console_gjs();
7207
- init_auto_globals_495e9d950c();
7724
+ init_auto_globals_53fe98c6e6();
7208
7725
  init_glib_2();
7209
7726
  PARSE_FLAGS = glib_2_default.UriFlags.HAS_PASSWORD | glib_2_default.UriFlags.ENCODED | glib_2_default.UriFlags.SCHEME_NORMALIZE;
7210
7727
  URLSearchParams = class _URLSearchParams {
@@ -7404,6 +7921,44 @@ var init_esm8 = __esm({
7404
7921
  toJSON() {
7405
7922
  return this.href;
7406
7923
  }
7924
+ // ---- URL.createObjectURL / URL.revokeObjectURL ----
7925
+ //
7926
+ // Consumers like Excalibur.js do `const src = URL.createObjectURL(blob);
7927
+ // image.src = src;`. For that to work on GJS we need `src` to be a path
7928
+ // `HTMLImageElement` / `HTMLAudioElement` / `FontFace` can actually read —
7929
+ // i.e. a `file://` URL. We implement this as a static method on our own
7930
+ // URL class (no globalThis monkey-patching):
7931
+ //
7932
+ // - Fast path: if the Blob already carries a `_tmpPath` (e.g. written
7933
+ // by `@gjsify/fetch` XHR when `responseType='blob'`), wrap it as
7934
+ // `file://<_tmpPath>`.
7935
+ // - Slow path: if the Blob has `arrayBuffer()`/bytes but no `_tmpPath`,
7936
+ // materialise the bytes into a GLib temp file and wrap that. This
7937
+ // path is async in the spec — but W3C `createObjectURL` is sync. We
7938
+ // read the bytes via `GLib.Bytes`-style synchronous access when
7939
+ // possible and fall back to a sentinel if not.
7940
+ //
7941
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
7942
+ static _objectURLPaths = /* @__PURE__ */ new Map();
7943
+ static _objectURLCounter = 0;
7944
+ static createObjectURL(blob) {
7945
+ const tmp = blob?._tmpPath;
7946
+ if (typeof tmp === "string" && tmp.length > 0) {
7947
+ const url = `file://${tmp}`;
7948
+ _URL._objectURLPaths.set(url, tmp);
7949
+ return url;
7950
+ }
7951
+ return "file:///dev/null";
7952
+ }
7953
+ static revokeObjectURL(url) {
7954
+ const path = _URL._objectURLPaths.get(url);
7955
+ if (!path) return;
7956
+ try {
7957
+ glib_2_default.unlink(path);
7958
+ } catch {
7959
+ }
7960
+ _URL._objectURLPaths.delete(url);
7961
+ }
7407
7962
  };
7408
7963
  }
7409
7964
  });
@@ -7412,8 +7967,8 @@ var init_esm8 = __esm({
7412
7967
  var init_url = __esm({
7413
7968
  "../../../packages/node/globals/lib/esm/register/url.js"() {
7414
7969
  init_console_gjs();
7415
- init_auto_globals_495e9d950c();
7416
- init_esm8();
7970
+ init_auto_globals_53fe98c6e6();
7971
+ init_esm9();
7417
7972
  if (typeof globalThis.URL !== "function") {
7418
7973
  Object.defineProperty(globalThis, "URL", {
7419
7974
  value: URL2,
@@ -7435,10 +7990,10 @@ var init_url = __esm({
7435
7990
 
7436
7991
  // ../../../packages/node/perf_hooks/lib/esm/index.js
7437
7992
  var performance2, PerformanceObserverStub, PerformanceEntryStub, PerformanceObserverEntryListStub, PerformanceObserver, PerformanceEntry, PerformanceObserverEntryList, PerformanceMark, PerformanceMeasure;
7438
- var init_esm9 = __esm({
7993
+ var init_esm10 = __esm({
7439
7994
  "../../../packages/node/perf_hooks/lib/esm/index.js"() {
7440
7995
  init_console_gjs();
7441
- init_auto_globals_495e9d950c();
7996
+ init_auto_globals_53fe98c6e6();
7442
7997
  if (globalThis.performance) {
7443
7998
  performance2 = globalThis.performance;
7444
7999
  } else {
@@ -7557,8 +8112,8 @@ var init_esm9 = __esm({
7557
8112
  var init_performance = __esm({
7558
8113
  "../../../packages/web/web-globals/lib/esm/register/performance.js"() {
7559
8114
  init_console_gjs();
7560
- init_auto_globals_495e9d950c();
7561
- init_esm9();
8115
+ init_auto_globals_53fe98c6e6();
8116
+ init_esm10();
7562
8117
  if (typeof globalThis.performance === "undefined") {
7563
8118
  globalThis.performance = performance2;
7564
8119
  }
@@ -7570,10 +8125,10 @@ var init_performance = __esm({
7570
8125
 
7571
8126
  // ../../../packages/web/abort-controller/lib/esm/index.js
7572
8127
  var kAbort, kInternal, AbortSignal2, AbortController2;
7573
- var init_esm10 = __esm({
8128
+ var init_esm11 = __esm({
7574
8129
  "../../../packages/web/abort-controller/lib/esm/index.js"() {
7575
8130
  init_console_gjs();
7576
- init_auto_globals_495e9d950c();
8131
+ init_auto_globals_53fe98c6e6();
7577
8132
  init_esm4();
7578
8133
  kAbort = /* @__PURE__ */ Symbol("abort");
7579
8134
  kInternal = /* @__PURE__ */ Symbol("internal");
@@ -7662,8 +8217,8 @@ var init_esm10 = __esm({
7662
8217
  var init_register2 = __esm({
7663
8218
  "../../../packages/web/abort-controller/lib/esm/register.js"() {
7664
8219
  init_console_gjs();
7665
- init_auto_globals_495e9d950c();
7666
- init_esm10();
8220
+ init_auto_globals_53fe98c6e6();
8221
+ init_esm11();
7667
8222
  if (typeof globalThis.AbortController === "undefined") {
7668
8223
  globalThis.AbortController = AbortController2;
7669
8224
  }
@@ -7678,7 +8233,7 @@ var toRegister;
7678
8233
  var init_custom_events = __esm({
7679
8234
  "../../../packages/web/dom-events/lib/esm/register/custom-events.js"() {
7680
8235
  init_console_gjs();
7681
- init_auto_globals_495e9d950c();
8236
+ init_auto_globals_53fe98c6e6();
7682
8237
  init_esm4();
7683
8238
  toRegister = {
7684
8239
  CustomEvent: CustomEvent2,
@@ -7699,7 +8254,7 @@ var init_custom_events = __esm({
7699
8254
  var init_register3 = __esm({
7700
8255
  "../../../packages/web/dom-exception/lib/esm/register.js"() {
7701
8256
  init_console_gjs();
7702
- init_auto_globals_495e9d950c();
8257
+ init_auto_globals_53fe98c6e6();
7703
8258
  init_esm3();
7704
8259
  if (typeof globalThis.DOMException === "undefined") {
7705
8260
  globalThis.DOMException = DOMException2;
@@ -7707,9 +8262,9 @@ var init_register3 = __esm({
7707
8262
  }
7708
8263
  });
7709
8264
 
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"() {
8265
+ // node_modules/.cache/gjsify/auto-globals-53fe98c6e6.mjs
8266
+ var init_auto_globals_53fe98c6e6 = __esm({
8267
+ "node_modules/.cache/gjsify/auto-globals-53fe98c6e6.mjs"() {
7713
8268
  init_register();
7714
8269
  init_canvas();
7715
8270
  init_document2();
@@ -7717,8 +8272,9 @@ var init_auto_globals_495e9d950c = __esm({
7717
8272
  init_navigator();
7718
8273
  init_buffer2();
7719
8274
  init_encoding2();
7720
- init_microtask();
8275
+ init_microtask2();
7721
8276
  init_process();
8277
+ init_timers();
7722
8278
  init_url();
7723
8279
  init_performance();
7724
8280
  init_register2();
@@ -7733,7 +8289,7 @@ var require_twiddle = __commonJS({
7733
8289
  "use strict";
7734
8290
  "use restrict";
7735
8291
  init_console_gjs();
7736
- init_auto_globals_495e9d950c();
8292
+ init_auto_globals_53fe98c6e6();
7737
8293
  var INT_BITS = 32;
7738
8294
  exports.INT_BITS = INT_BITS;
7739
8295
  exports.INT_MAX = 2147483647;
@@ -7888,7 +8444,7 @@ var require_twiddle = __commonJS({
7888
8444
  var require_literals = __commonJS({
7889
8445
  "../../../node_modules/glsl-tokenizer/lib/literals.js"(exports, module) {
7890
8446
  init_console_gjs();
7891
- init_auto_globals_495e9d950c();
8447
+ init_auto_globals_53fe98c6e6();
7892
8448
  module.exports = [
7893
8449
  // current
7894
8450
  "precision",
@@ -7988,7 +8544,7 @@ var require_literals = __commonJS({
7988
8544
  var require_operators = __commonJS({
7989
8545
  "../../../node_modules/glsl-tokenizer/lib/operators.js"(exports, module) {
7990
8546
  init_console_gjs();
7991
- init_auto_globals_495e9d950c();
8547
+ init_auto_globals_53fe98c6e6();
7992
8548
  module.exports = [
7993
8549
  "<<=",
7994
8550
  ">>=",
@@ -8043,7 +8599,7 @@ var require_operators = __commonJS({
8043
8599
  var require_builtins = __commonJS({
8044
8600
  "../../../node_modules/glsl-tokenizer/lib/builtins.js"(exports, module) {
8045
8601
  init_console_gjs();
8046
- init_auto_globals_495e9d950c();
8602
+ init_auto_globals_53fe98c6e6();
8047
8603
  module.exports = [
8048
8604
  // Keep this list sorted
8049
8605
  "abs",
@@ -8201,7 +8757,7 @@ var require_builtins = __commonJS({
8201
8757
  var require_literals_300es = __commonJS({
8202
8758
  "../../../node_modules/glsl-tokenizer/lib/literals-300es.js"(exports, module) {
8203
8759
  init_console_gjs();
8204
- init_auto_globals_495e9d950c();
8760
+ init_auto_globals_53fe98c6e6();
8205
8761
  var v100 = require_literals();
8206
8762
  module.exports = v100.slice().concat([
8207
8763
  "layout",
@@ -8295,7 +8851,7 @@ var require_literals_300es = __commonJS({
8295
8851
  var require_builtins_300es = __commonJS({
8296
8852
  "../../../node_modules/glsl-tokenizer/lib/builtins-300es.js"(exports, module) {
8297
8853
  init_console_gjs();
8298
- init_auto_globals_495e9d950c();
8854
+ init_auto_globals_53fe98c6e6();
8299
8855
  var v100 = require_builtins();
8300
8856
  v100 = v100.slice().filter(function(b) {
8301
8857
  return !/^(gl\_|texture)/.test(b);
@@ -8365,7 +8921,7 @@ var require_builtins_300es = __commonJS({
8365
8921
  var require_glsl_tokenizer = __commonJS({
8366
8922
  "../../../node_modules/glsl-tokenizer/index.js"(exports, module) {
8367
8923
  init_console_gjs();
8368
- init_auto_globals_495e9d950c();
8924
+ init_auto_globals_53fe98c6e6();
8369
8925
  module.exports = tokenize2;
8370
8926
  var literals100 = require_literals();
8371
8927
  var operators = require_operators();
@@ -8698,7 +9254,7 @@ var require_glsl_tokenizer = __commonJS({
8698
9254
  var require_string = __commonJS({
8699
9255
  "../../../node_modules/glsl-tokenizer/string.js"(exports, module) {
8700
9256
  init_console_gjs();
8701
- init_auto_globals_495e9d950c();
9257
+ init_auto_globals_53fe98c6e6();
8702
9258
  var tokenize2 = require_glsl_tokenizer();
8703
9259
  module.exports = tokenizeString;
8704
9260
  function tokenizeString(str, opt) {
@@ -8713,71 +9269,71 @@ var require_string = __commonJS({
8713
9269
 
8714
9270
  // src/gjs/gjs.ts
8715
9271
  init_console_gjs();
8716
- init_auto_globals_495e9d950c();
9272
+ init_auto_globals_53fe98c6e6();
8717
9273
  import Adw2 from "gi://Adw?version=1";
8718
9274
  import Gio2 from "gi://Gio?version=2.0";
8719
9275
 
8720
9276
  // src/gjs/pixel-window.ts
8721
9277
  init_console_gjs();
8722
- init_auto_globals_495e9d950c();
9278
+ init_auto_globals_53fe98c6e6();
8723
9279
  import GObject2 from "gi://GObject?version=2.0";
8724
9280
  import GLib3 from "gi://GLib?version=2.0";
8725
9281
  import Gtk4 from "gi://Gtk?version=4.0";
8726
9282
  import Adw from "gi://Adw?version=1";
8727
9283
 
8728
- // ../../../packages/dom/webgl/lib/esm/index.js
9284
+ // ../../../packages/framework/webgl/lib/esm/index.js
8729
9285
  init_console_gjs();
8730
- init_auto_globals_495e9d950c();
9286
+ init_auto_globals_53fe98c6e6();
8731
9287
 
8732
9288
  // ../../../node_modules/@girs/gjs/index.js
8733
9289
  init_console_gjs();
8734
- init_auto_globals_495e9d950c();
9290
+ init_auto_globals_53fe98c6e6();
8735
9291
 
8736
9292
  // ../../../node_modules/@girs/gjs/gjs.js
8737
9293
  init_console_gjs();
8738
- init_auto_globals_495e9d950c();
9294
+ init_auto_globals_53fe98c6e6();
8739
9295
  var imports2 = globalThis.imports || {};
8740
9296
 
8741
- // ../../../packages/dom/webgl/lib/esm/index.js
9297
+ // ../../../packages/framework/webgl/lib/esm/index.js
8742
9298
  init_gio_2();
8743
9299
 
8744
9300
  // ../../../node_modules/@girs/gtk-4.0/index.js
8745
9301
  init_console_gjs();
8746
- init_auto_globals_495e9d950c();
9302
+ init_auto_globals_53fe98c6e6();
8747
9303
 
8748
9304
  // ../../../node_modules/@girs/gtk-4.0/gtk-4.0.js
8749
9305
  init_console_gjs();
8750
- init_auto_globals_495e9d950c();
9306
+ init_auto_globals_53fe98c6e6();
8751
9307
  import Gtk from "gi://Gtk?version=4.0";
8752
9308
 
8753
- // ../../../packages/dom/webgl/lib/esm/webgl-rendering-context.js
9309
+ // ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
8754
9310
  init_console_gjs();
8755
- init_auto_globals_495e9d950c();
9311
+ init_auto_globals_53fe98c6e6();
8756
9312
 
8757
9313
  // ../../../node_modules/@girs/gwebgl-0.1/index.js
8758
9314
  init_console_gjs();
8759
- init_auto_globals_495e9d950c();
9315
+ init_auto_globals_53fe98c6e6();
8760
9316
 
8761
9317
  // ../../../node_modules/@girs/gwebgl-0.1/gwebgl-0.1.js
8762
9318
  init_console_gjs();
8763
- init_auto_globals_495e9d950c();
9319
+ init_auto_globals_53fe98c6e6();
8764
9320
  import Gwebgl from "gi://Gwebgl?version=0.1";
8765
9321
  var gwebgl_0_1_default = Gwebgl;
8766
9322
 
8767
9323
  // ../../../node_modules/@girs/gwebgl-0.1/index.js
8768
9324
  var gwebgl_0_default = gwebgl_0_1_default;
8769
9325
 
8770
- // ../../../packages/dom/webgl/lib/esm/webgl-context-base.js
9326
+ // ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
8771
9327
  init_console_gjs();
8772
- init_auto_globals_495e9d950c();
9328
+ init_auto_globals_53fe98c6e6();
8773
9329
  init_gdkpixbuf_2();
8774
9330
  var bits = __toESM(require_twiddle(), 1);
8775
9331
  var import_string = __toESM(require_string(), 1);
8776
9332
  import GdkPixbuf3 from "gi://GdkPixbuf?version=2.0";
8777
9333
 
8778
- // ../../../packages/dom/webgl/lib/esm/webgl-context-attributes.js
9334
+ // ../../../packages/framework/webgl/lib/esm/webgl-context-attributes.js
8779
9335
  init_console_gjs();
8780
- init_auto_globals_495e9d950c();
9336
+ init_auto_globals_53fe98c6e6();
8781
9337
  var WebGLContextAttributes = class {
8782
9338
  constructor(alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat) {
8783
9339
  this.alpha = alpha;
@@ -8799,13 +9355,13 @@ var WebGLContextAttributes = class {
8799
9355
  }
8800
9356
  };
8801
9357
 
8802
- // ../../../packages/dom/webgl/lib/esm/utils.js
9358
+ // ../../../packages/framework/webgl/lib/esm/utils.js
8803
9359
  init_console_gjs();
8804
- init_auto_globals_495e9d950c();
9360
+ init_auto_globals_53fe98c6e6();
8805
9361
 
8806
- // ../../../packages/dom/webgl/lib/esm/webgl-uniform-location.js
9362
+ // ../../../packages/framework/webgl/lib/esm/webgl-uniform-location.js
8807
9363
  init_console_gjs();
8808
- init_auto_globals_495e9d950c();
9364
+ init_auto_globals_53fe98c6e6();
8809
9365
  var WebGLUniformLocation = class {
8810
9366
  constructor(_, program, info2) {
8811
9367
  this._linkCount = 0;
@@ -8818,7 +9374,7 @@ var WebGLUniformLocation = class {
8818
9374
  }
8819
9375
  };
8820
9376
 
8821
- // ../../../packages/dom/webgl/lib/esm/utils.js
9377
+ // ../../../packages/framework/webgl/lib/esm/utils.js
8822
9378
  init_glib_2();
8823
9379
  function checkObject(object) {
8824
9380
  return typeof object === "object" || object === void 0;
@@ -9001,9 +9557,9 @@ function premultiplyAlpha(data) {
9001
9557
  return out;
9002
9558
  }
9003
9559
 
9004
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-element-index-unit.js
9560
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-element-index-unit.js
9005
9561
  init_console_gjs();
9006
- init_auto_globals_495e9d950c();
9562
+ init_auto_globals_53fe98c6e6();
9007
9563
  var OESElementIndexUint = class {
9008
9564
  };
9009
9565
  function getOESElementIndexUint(context) {
@@ -9015,9 +9571,9 @@ function getOESElementIndexUint(context) {
9015
9571
  return result;
9016
9572
  }
9017
9573
 
9018
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-standard-derivatives.js
9574
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-standard-derivatives.js
9019
9575
  init_console_gjs();
9020
- init_auto_globals_495e9d950c();
9576
+ init_auto_globals_53fe98c6e6();
9021
9577
  var OESStandardDerivatives = class {
9022
9578
  constructor() {
9023
9579
  this.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 35723;
@@ -9032,9 +9588,9 @@ function getOESStandardDerivatives(context) {
9032
9588
  return result;
9033
9589
  }
9034
9590
 
9035
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-texture-float.js
9591
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float.js
9036
9592
  init_console_gjs();
9037
- init_auto_globals_495e9d950c();
9593
+ init_auto_globals_53fe98c6e6();
9038
9594
  var OESTextureFloat = class {
9039
9595
  };
9040
9596
  function getOESTextureFloat(context) {
@@ -9046,9 +9602,9 @@ function getOESTextureFloat(context) {
9046
9602
  return result;
9047
9603
  }
9048
9604
 
9049
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-texture-float-linear.js
9605
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float-linear.js
9050
9606
  init_console_gjs();
9051
- init_auto_globals_495e9d950c();
9607
+ init_auto_globals_53fe98c6e6();
9052
9608
  var OESTextureFloatLinear = class {
9053
9609
  };
9054
9610
  function getOESTextureFloatLinear(context) {
@@ -9060,9 +9616,9 @@ function getOESTextureFloatLinear(context) {
9060
9616
  return result;
9061
9617
  }
9062
9618
 
9063
- // ../../../packages/dom/webgl/lib/esm/extensions/stackgl-destroy-context.js
9619
+ // ../../../packages/framework/webgl/lib/esm/extensions/stackgl-destroy-context.js
9064
9620
  init_console_gjs();
9065
- init_auto_globals_495e9d950c();
9621
+ init_auto_globals_53fe98c6e6();
9066
9622
  var STACKGLDestroyContext = class {
9067
9623
  constructor(ctx) {
9068
9624
  this.destroy = ctx.destroy.bind(ctx);
@@ -9072,9 +9628,9 @@ function getSTACKGLDestroyContext(ctx) {
9072
9628
  return new STACKGLDestroyContext(ctx);
9073
9629
  }
9074
9630
 
9075
- // ../../../packages/dom/webgl/lib/esm/extensions/stackgl-resize-drawing-buffer.js
9631
+ // ../../../packages/framework/webgl/lib/esm/extensions/stackgl-resize-drawing-buffer.js
9076
9632
  init_console_gjs();
9077
- init_auto_globals_495e9d950c();
9633
+ init_auto_globals_53fe98c6e6();
9078
9634
  var STACKGLResizeDrawingBuffer = class {
9079
9635
  constructor(ctx) {
9080
9636
  this.resize = ctx.resize.bind(ctx);
@@ -9084,9 +9640,9 @@ function getSTACKGLResizeDrawingBuffer(ctx) {
9084
9640
  return new STACKGLResizeDrawingBuffer(ctx);
9085
9641
  }
9086
9642
 
9087
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-blend-minmax.js
9643
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-blend-minmax.js
9088
9644
  init_console_gjs();
9089
- init_auto_globals_495e9d950c();
9645
+ init_auto_globals_53fe98c6e6();
9090
9646
  var EXTBlendMinMax = class {
9091
9647
  constructor() {
9092
9648
  this.MIN_EXT = 32775;
@@ -9102,9 +9658,9 @@ function getEXTBlendMinMax(context) {
9102
9658
  return result;
9103
9659
  }
9104
9660
 
9105
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-color-buffer-float.js
9661
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-float.js
9106
9662
  init_console_gjs();
9107
- init_auto_globals_495e9d950c();
9663
+ init_auto_globals_53fe98c6e6();
9108
9664
  var EXTColorBufferFloat = class {
9109
9665
  };
9110
9666
  function getEXTColorBufferFloat(context) {
@@ -9115,9 +9671,9 @@ function getEXTColorBufferFloat(context) {
9115
9671
  return null;
9116
9672
  }
9117
9673
 
9118
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-color-buffer-half-float.js
9674
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-half-float.js
9119
9675
  init_console_gjs();
9120
- init_auto_globals_495e9d950c();
9676
+ init_auto_globals_53fe98c6e6();
9121
9677
  var EXTColorBufferHalfFloat = class {
9122
9678
  };
9123
9679
  function getEXTColorBufferHalfFloat(context) {
@@ -9128,9 +9684,9 @@ function getEXTColorBufferHalfFloat(context) {
9128
9684
  return null;
9129
9685
  }
9130
9686
 
9131
- // ../../../packages/dom/webgl/lib/esm/extensions/ext-texture-filter-anisotropic.js
9687
+ // ../../../packages/framework/webgl/lib/esm/extensions/ext-texture-filter-anisotropic.js
9132
9688
  init_console_gjs();
9133
- init_auto_globals_495e9d950c();
9689
+ init_auto_globals_53fe98c6e6();
9134
9690
  var EXTTextureFilterAnisotropic = class {
9135
9691
  constructor() {
9136
9692
  this.TEXTURE_MAX_ANISOTROPY_EXT = 34046;
@@ -9146,9 +9702,9 @@ function getEXTTextureFilterAnisotropic(context) {
9146
9702
  return result;
9147
9703
  }
9148
9704
 
9149
- // ../../../packages/dom/webgl/lib/esm/extensions/oes-texture-half-float.js
9705
+ // ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-half-float.js
9150
9706
  init_console_gjs();
9151
- init_auto_globals_495e9d950c();
9707
+ init_auto_globals_53fe98c6e6();
9152
9708
  var OESTextureHalfFloat = class {
9153
9709
  constructor() {
9154
9710
  this.HALF_FLOAT_OES = 36193;
@@ -9165,9 +9721,9 @@ function getOESTextureHalfFloat(context) {
9165
9721
  return null;
9166
9722
  }
9167
9723
 
9168
- // ../../../packages/dom/webgl/lib/esm/webgl-active-info.js
9724
+ // ../../../packages/framework/webgl/lib/esm/webgl-active-info.js
9169
9725
  init_console_gjs();
9170
- init_auto_globals_495e9d950c();
9726
+ init_auto_globals_53fe98c6e6();
9171
9727
  var WebGLActiveInfo = class {
9172
9728
  constructor(_) {
9173
9729
  this.size = _.size;
@@ -9176,13 +9732,13 @@ var WebGLActiveInfo = class {
9176
9732
  }
9177
9733
  };
9178
9734
 
9179
- // ../../../packages/dom/webgl/lib/esm/webgl-framebuffer.js
9735
+ // ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
9180
9736
  init_console_gjs();
9181
- init_auto_globals_495e9d950c();
9737
+ init_auto_globals_53fe98c6e6();
9182
9738
 
9183
- // ../../../packages/dom/webgl/lib/esm/linkable.js
9739
+ // ../../../packages/framework/webgl/lib/esm/linkable.js
9184
9740
  init_console_gjs();
9185
- init_auto_globals_495e9d950c();
9741
+ init_auto_globals_53fe98c6e6();
9186
9742
  var Linkable = class {
9187
9743
  constructor(_) {
9188
9744
  this._ = 0;
@@ -9231,7 +9787,7 @@ var Linkable = class {
9231
9787
  }
9232
9788
  };
9233
9789
 
9234
- // ../../../packages/dom/webgl/lib/esm/webgl-framebuffer.js
9790
+ // ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
9235
9791
  var WebGLFramebuffer = class extends Linkable {
9236
9792
  constructor(_, ctx) {
9237
9793
  super(_);
@@ -9337,9 +9893,9 @@ var WebGLFramebuffer = class extends Linkable {
9337
9893
  }
9338
9894
  };
9339
9895
 
9340
- // ../../../packages/dom/webgl/lib/esm/webgl-buffer.js
9896
+ // ../../../packages/framework/webgl/lib/esm/webgl-buffer.js
9341
9897
  init_console_gjs();
9342
- init_auto_globals_495e9d950c();
9898
+ init_auto_globals_53fe98c6e6();
9343
9899
  var WebGLBuffer = class extends Linkable {
9344
9900
  constructor(_, ctx) {
9345
9901
  super(_);
@@ -9354,9 +9910,9 @@ var WebGLBuffer = class extends Linkable {
9354
9910
  }
9355
9911
  };
9356
9912
 
9357
- // ../../../packages/dom/webgl/lib/esm/webgl-drawing-buffer-wrapper.js
9913
+ // ../../../packages/framework/webgl/lib/esm/webgl-drawing-buffer-wrapper.js
9358
9914
  init_console_gjs();
9359
- init_auto_globals_495e9d950c();
9915
+ init_auto_globals_53fe98c6e6();
9360
9916
  var WebGLDrawingBufferWrapper = class {
9361
9917
  constructor(framebuffer, color, depthStencil) {
9362
9918
  this._framebuffer = framebuffer;
@@ -9365,9 +9921,9 @@ var WebGLDrawingBufferWrapper = class {
9365
9921
  }
9366
9922
  };
9367
9923
 
9368
- // ../../../packages/dom/webgl/lib/esm/webgl-program.js
9924
+ // ../../../packages/framework/webgl/lib/esm/webgl-program.js
9369
9925
  init_console_gjs();
9370
- init_auto_globals_495e9d950c();
9926
+ init_auto_globals_53fe98c6e6();
9371
9927
  var WebGLProgram = class extends Linkable {
9372
9928
  constructor(_, ctx) {
9373
9929
  super(_);
@@ -9390,9 +9946,9 @@ var WebGLProgram = class extends Linkable {
9390
9946
  }
9391
9947
  };
9392
9948
 
9393
- // ../../../packages/dom/webgl/lib/esm/webgl-renderbuffer.js
9949
+ // ../../../packages/framework/webgl/lib/esm/webgl-renderbuffer.js
9394
9950
  init_console_gjs();
9395
- init_auto_globals_495e9d950c();
9951
+ init_auto_globals_53fe98c6e6();
9396
9952
  var WebGLRenderbuffer = class extends Linkable {
9397
9953
  constructor(_, ctx) {
9398
9954
  super(_);
@@ -9413,9 +9969,9 @@ var WebGLRenderbuffer = class extends Linkable {
9413
9969
  }
9414
9970
  };
9415
9971
 
9416
- // ../../../packages/dom/webgl/lib/esm/webgl-shader.js
9972
+ // ../../../packages/framework/webgl/lib/esm/webgl-shader.js
9417
9973
  init_console_gjs();
9418
- init_auto_globals_495e9d950c();
9974
+ init_auto_globals_53fe98c6e6();
9419
9975
  var WebGLShader = class extends Linkable {
9420
9976
  constructor(_, ctx, type) {
9421
9977
  super(_);
@@ -9436,9 +9992,9 @@ var WebGLShader = class extends Linkable {
9436
9992
  }
9437
9993
  };
9438
9994
 
9439
- // ../../../packages/dom/webgl/lib/esm/webgl-shader-precision-format.js
9995
+ // ../../../packages/framework/webgl/lib/esm/webgl-shader-precision-format.js
9440
9996
  init_console_gjs();
9441
- init_auto_globals_495e9d950c();
9997
+ init_auto_globals_53fe98c6e6();
9442
9998
  var WebGLShaderPrecisionFormat = class {
9443
9999
  constructor(_) {
9444
10000
  this.rangeMin = _.rangeMin;
@@ -9447,9 +10003,9 @@ var WebGLShaderPrecisionFormat = class {
9447
10003
  }
9448
10004
  };
9449
10005
 
9450
- // ../../../packages/dom/webgl/lib/esm/webgl-texture-unit.js
10006
+ // ../../../packages/framework/webgl/lib/esm/webgl-texture-unit.js
9451
10007
  init_console_gjs();
9452
- init_auto_globals_495e9d950c();
10008
+ init_auto_globals_53fe98c6e6();
9453
10009
  var WebGLTextureUnit = class {
9454
10010
  constructor(ctx, idx) {
9455
10011
  this._mode = 0;
@@ -9460,9 +10016,9 @@ var WebGLTextureUnit = class {
9460
10016
  }
9461
10017
  };
9462
10018
 
9463
- // ../../../packages/dom/webgl/lib/esm/webgl-texture.js
10019
+ // ../../../packages/framework/webgl/lib/esm/webgl-texture.js
9464
10020
  init_console_gjs();
9465
- init_auto_globals_495e9d950c();
10021
+ init_auto_globals_53fe98c6e6();
9466
10022
  var WebGLTexture = class extends Linkable {
9467
10023
  constructor(_, ctx) {
9468
10024
  super(_);
@@ -9481,9 +10037,9 @@ var WebGLTexture = class extends Linkable {
9481
10037
  }
9482
10038
  };
9483
10039
 
9484
- // ../../../packages/dom/webgl/lib/esm/webgl-vertex-attribute.js
10040
+ // ../../../packages/framework/webgl/lib/esm/webgl-vertex-attribute.js
9485
10041
  init_console_gjs();
9486
- init_auto_globals_495e9d950c();
10042
+ init_auto_globals_53fe98c6e6();
9487
10043
  var WebGLVertexArrayObjectAttribute = class {
9488
10044
  constructor(ctx, idx) {
9489
10045
  this._isPointer = false;
@@ -9625,7 +10181,7 @@ var WebGLVertexArrayGlobalState = class {
9625
10181
  }
9626
10182
  };
9627
10183
 
9628
- // ../../../packages/dom/webgl/lib/esm/webgl-context-base.js
10184
+ // ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
9629
10185
  init_esm();
9630
10186
  var VERSION = "0.0.1";
9631
10187
  var CONTEXT_COUNTER = 0;
@@ -12950,7 +13506,7 @@ var WebGLContextBase = class {
12950
13506
  }
12951
13507
  };
12952
13508
 
12953
- // ../../../packages/dom/webgl/lib/esm/webgl-rendering-context.js
13509
+ // ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
12954
13510
  var WebGLRenderingContext2 = class extends WebGLContextBase {
12955
13511
  constructor(canvas, options = {}) {
12956
13512
  super(canvas, options);
@@ -13133,14 +13689,14 @@ var WebGLRenderingContext2 = class extends WebGLContextBase {
13133
13689
  }
13134
13690
  };
13135
13691
 
13136
- // ../../../packages/dom/webgl/lib/esm/webgl2-rendering-context.js
13692
+ // ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
13137
13693
  init_console_gjs();
13138
- init_auto_globals_495e9d950c();
13694
+ init_auto_globals_53fe98c6e6();
13139
13695
  import GdkPixbuf4 from "gi://GdkPixbuf?version=2.0";
13140
13696
 
13141
- // ../../../packages/dom/webgl/lib/esm/webgl-query.js
13697
+ // ../../../packages/framework/webgl/lib/esm/webgl-query.js
13142
13698
  init_console_gjs();
13143
- init_auto_globals_495e9d950c();
13699
+ init_auto_globals_53fe98c6e6();
13144
13700
  var WebGLQuery = class extends Linkable {
13145
13701
  constructor(_, ctx) {
13146
13702
  super(_);
@@ -13153,9 +13709,9 @@ var WebGLQuery = class extends Linkable {
13153
13709
  }
13154
13710
  };
13155
13711
 
13156
- // ../../../packages/dom/webgl/lib/esm/webgl-sampler.js
13712
+ // ../../../packages/framework/webgl/lib/esm/webgl-sampler.js
13157
13713
  init_console_gjs();
13158
- init_auto_globals_495e9d950c();
13714
+ init_auto_globals_53fe98c6e6();
13159
13715
  var WebGLSampler = class extends Linkable {
13160
13716
  constructor(_, ctx) {
13161
13717
  super(_);
@@ -13168,9 +13724,9 @@ var WebGLSampler = class extends Linkable {
13168
13724
  }
13169
13725
  };
13170
13726
 
13171
- // ../../../packages/dom/webgl/lib/esm/webgl-sync.js
13727
+ // ../../../packages/framework/webgl/lib/esm/webgl-sync.js
13172
13728
  init_console_gjs();
13173
- init_auto_globals_495e9d950c();
13729
+ init_auto_globals_53fe98c6e6();
13174
13730
  var WebGLSync = class extends Linkable {
13175
13731
  constructor(_, ctx) {
13176
13732
  super(_);
@@ -13183,9 +13739,9 @@ var WebGLSync = class extends Linkable {
13183
13739
  }
13184
13740
  };
13185
13741
 
13186
- // ../../../packages/dom/webgl/lib/esm/webgl-transform-feedback.js
13742
+ // ../../../packages/framework/webgl/lib/esm/webgl-transform-feedback.js
13187
13743
  init_console_gjs();
13188
- init_auto_globals_495e9d950c();
13744
+ init_auto_globals_53fe98c6e6();
13189
13745
  var WebGLTransformFeedback = class extends Linkable {
13190
13746
  constructor(_, ctx) {
13191
13747
  super(_);
@@ -13198,9 +13754,9 @@ var WebGLTransformFeedback = class extends Linkable {
13198
13754
  }
13199
13755
  };
13200
13756
 
13201
- // ../../../packages/dom/webgl/lib/esm/webgl-vertex-array-object.js
13757
+ // ../../../packages/framework/webgl/lib/esm/webgl-vertex-array-object.js
13202
13758
  init_console_gjs();
13203
- init_auto_globals_495e9d950c();
13759
+ init_auto_globals_53fe98c6e6();
13204
13760
  var WebGLVertexArrayObject = class extends Linkable {
13205
13761
  constructor(_, ctx) {
13206
13762
  super(_);
@@ -13218,7 +13774,7 @@ var WebGLVertexArrayObject = class extends Linkable {
13218
13774
  }
13219
13775
  };
13220
13776
 
13221
- // ../../../packages/dom/webgl/lib/esm/webgl2-rendering-context.js
13777
+ // ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
13222
13778
  init_esm();
13223
13779
  var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextBase {
13224
13780
  constructor(canvas, options = {}) {
@@ -14028,8 +14584,18 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14028
14584
  this._native2.vertexAttribIPointer(index, size, type, stride, offset);
14029
14585
  }
14030
14586
  drawBuffers(buffers) {
14031
- const mapped = buffers.map((b) => b === 1029 ? this.COLOR_ATTACHMENT0 : b);
14032
- this._native2.drawBuffers(Array.from(mapped));
14587
+ let hasBack = false;
14588
+ for (let i = 0; i < buffers.length; i++) {
14589
+ if (buffers[i] === 1029) {
14590
+ hasBack = true;
14591
+ break;
14592
+ }
14593
+ }
14594
+ if (!hasBack) {
14595
+ this._native2.drawBuffers(buffers);
14596
+ return;
14597
+ }
14598
+ this._native2.drawBuffers(buffers.map((b) => b === 1029 ? this.COLOR_ATTACHMENT0 : b));
14033
14599
  }
14034
14600
  drawRangeElements(mode, start2, end, count2, type, offset) {
14035
14601
  if (count2 < 0 || offset < 0) {
@@ -14126,10 +14692,10 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14126
14692
  void drawbuffer;
14127
14693
  }
14128
14694
  invalidateFramebuffer(target, attachments) {
14129
- this._native2.invalidateFramebuffer(target, Array.from(attachments));
14695
+ this._native2.invalidateFramebuffer(target, attachments);
14130
14696
  }
14131
14697
  invalidateSubFramebuffer(target, attachments, x, y, width, height) {
14132
- this._native2.invalidateSubFramebuffer(target, Array.from(attachments), x, y, width, height);
14698
+ this._native2.invalidateSubFramebuffer(target, attachments, x, y, width, height);
14133
14699
  }
14134
14700
  readBuffer(src) {
14135
14701
  this._native2.readBuffer(src);
@@ -14173,53 +14739,53 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14173
14739
  uniform1uiv(location, data, _srcOffset, _srcLength) {
14174
14740
  if (!location) return;
14175
14741
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14176
- this._native2.uniform1uiv(location._, arr.length, Array.from(arr));
14742
+ this._native2.uniform1uiv(location._, arr.length, arr);
14177
14743
  }
14178
14744
  uniform2uiv(location, data, _srcOffset, _srcLength) {
14179
14745
  if (!location) return;
14180
14746
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14181
- this._native2.uniform2uiv(location._, arr.length / 2, Array.from(arr));
14747
+ this._native2.uniform2uiv(location._, arr.length / 2, arr);
14182
14748
  }
14183
14749
  uniform3uiv(location, data, _srcOffset, _srcLength) {
14184
14750
  if (!location) return;
14185
14751
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14186
- this._native2.uniform3uiv(location._, arr.length / 3, Array.from(arr));
14752
+ this._native2.uniform3uiv(location._, arr.length / 3, arr);
14187
14753
  }
14188
14754
  uniform4uiv(location, data, _srcOffset, _srcLength) {
14189
14755
  if (!location) return;
14190
14756
  const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
14191
- this._native2.uniform4uiv(location._, arr.length / 4, Array.from(arr));
14757
+ this._native2.uniform4uiv(location._, arr.length / 4, arr);
14192
14758
  }
14193
14759
  // ─── Non-square Matrix Uniforms ───────────────────────────────────────
14194
14760
  uniformMatrix2x3fv(location, transpose, data, _srcOffset, _srcLength) {
14195
14761
  if (!location) return;
14196
14762
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14197
- this._native2.uniformMatrix2x3fv(location._, transpose, Array.from(arr));
14763
+ this._native2.uniformMatrix2x3fv(location._, transpose, arr);
14198
14764
  }
14199
14765
  uniformMatrix3x2fv(location, transpose, data, _srcOffset, _srcLength) {
14200
14766
  if (!location) return;
14201
14767
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14202
- this._native2.uniformMatrix3x2fv(location._, transpose, Array.from(arr));
14768
+ this._native2.uniformMatrix3x2fv(location._, transpose, arr);
14203
14769
  }
14204
14770
  uniformMatrix2x4fv(location, transpose, data, _srcOffset, _srcLength) {
14205
14771
  if (!location) return;
14206
14772
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14207
- this._native2.uniformMatrix2x4fv(location._, transpose, Array.from(arr));
14773
+ this._native2.uniformMatrix2x4fv(location._, transpose, arr);
14208
14774
  }
14209
14775
  uniformMatrix4x2fv(location, transpose, data, _srcOffset, _srcLength) {
14210
14776
  if (!location) return;
14211
14777
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14212
- this._native2.uniformMatrix4x2fv(location._, transpose, Array.from(arr));
14778
+ this._native2.uniformMatrix4x2fv(location._, transpose, arr);
14213
14779
  }
14214
14780
  uniformMatrix3x4fv(location, transpose, data, _srcOffset, _srcLength) {
14215
14781
  if (!location) return;
14216
14782
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14217
- this._native2.uniformMatrix3x4fv(location._, transpose, Array.from(arr));
14783
+ this._native2.uniformMatrix3x4fv(location._, transpose, arr);
14218
14784
  }
14219
14785
  uniformMatrix4x3fv(location, transpose, data, _srcOffset, _srcLength) {
14220
14786
  if (!location) return;
14221
14787
  const arr = data instanceof Float32Array ? data : new Float32Array(data);
14222
- this._native2.uniformMatrix4x3fv(location._, transpose, Array.from(arr));
14788
+ this._native2.uniformMatrix4x3fv(location._, transpose, arr);
14223
14789
  }
14224
14790
  // ─── getUniform — WebGL2 uint type support ────────────────────────────
14225
14791
  /** WebGL1 getUniform falls to default:null for UNSIGNED_INT types. Handle them here. */
@@ -14474,16 +15040,16 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
14474
15040
  }
14475
15041
  };
14476
15042
 
14477
- // ../../../packages/dom/webgl/lib/esm/html-canvas-element.js
15043
+ // ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
14478
15044
  init_console_gjs();
14479
- init_auto_globals_495e9d950c();
15045
+ init_auto_globals_53fe98c6e6();
14480
15046
 
14481
15047
  // ../../../packages/dom/dom-elements/lib/esm/index.js
14482
15048
  init_console_gjs();
14483
- init_auto_globals_495e9d950c();
15049
+ init_auto_globals_53fe98c6e6();
14484
15050
  init_html_canvas_element();
14485
15051
 
14486
- // ../../../packages/dom/webgl/lib/esm/html-canvas-element.js
15052
+ // ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
14487
15053
  var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
14488
15054
  constructor(gtkGlArea) {
14489
15055
  super();
@@ -14544,27 +15110,27 @@ var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
14544
15110
  }
14545
15111
  };
14546
15112
 
14547
- // ../../../packages/dom/webgl/lib/esm/webgl-bridge.js
15113
+ // ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
14548
15114
  init_console_gjs();
14549
- init_auto_globals_495e9d950c();
15115
+ init_auto_globals_53fe98c6e6();
14550
15116
  import GObject from "gi://GObject";
14551
15117
  import GLib2 from "gi://GLib?version=2.0";
14552
15118
  import Gtk3 from "gi://Gtk?version=4.0";
14553
15119
 
14554
- // ../../../packages/dom/event-bridge/lib/esm/index.js
15120
+ // ../../../packages/framework/event-bridge/lib/esm/index.js
14555
15121
  init_console_gjs();
14556
- init_auto_globals_495e9d950c();
15122
+ init_auto_globals_53fe98c6e6();
14557
15123
 
14558
- // ../../../packages/dom/event-bridge/lib/esm/event-bridge.js
15124
+ // ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
14559
15125
  init_console_gjs();
14560
- init_auto_globals_495e9d950c();
15126
+ init_auto_globals_53fe98c6e6();
14561
15127
  init_esm4();
14562
15128
  import Gtk2 from "gi://Gtk?version=4.0";
14563
15129
  import Gdk4 from "gi://Gdk?version=4.0";
14564
15130
 
14565
- // ../../../packages/dom/event-bridge/lib/esm/key-map.js
15131
+ // ../../../packages/framework/event-bridge/lib/esm/key-map.js
14566
15132
  init_console_gjs();
14567
- init_auto_globals_495e9d950c();
15133
+ init_auto_globals_53fe98c6e6();
14568
15134
  import Gdk3 from "gi://Gdk?version=4.0";
14569
15135
  var SPECIAL_KEYS = {
14570
15136
  Return: "Enter",
@@ -14753,7 +15319,7 @@ function gdkKeyvalToLocation(keyval) {
14753
15319
  return 0;
14754
15320
  }
14755
15321
 
14756
- // ../../../packages/dom/event-bridge/lib/esm/event-bridge.js
15322
+ // ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
14757
15323
  function extractModifiers(controller) {
14758
15324
  const mods = controller.get_current_event_state();
14759
15325
  return {
@@ -14939,7 +15505,7 @@ function attachEventControllers(widget, getElement, options) {
14939
15505
  widget.add_controller(focusCtrl);
14940
15506
  }
14941
15507
 
14942
- // ../../../packages/dom/webgl/lib/esm/webgl-bridge.js
15508
+ // ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
14943
15509
  init_esm4();
14944
15510
  var WebGLBridge = GObject.registerClass(
14945
15511
  { GTypeName: "GjsifyWebGLBridge" },
@@ -14958,6 +15524,12 @@ var WebGLBridge = GObject.registerClass(
14958
15524
  this.set_has_depth_buffer(true);
14959
15525
  this.set_has_stencil_buffer(true);
14960
15526
  attachEventControllers(this, () => this._canvas, { captureKeys: true });
15527
+ this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
15528
+ if (this._frameCallback !== null) {
15529
+ this.queue_render();
15530
+ }
15531
+ return GLib2.SOURCE_CONTINUE;
15532
+ });
14961
15533
  const initId = this.connect("render", () => {
14962
15534
  this.disconnect(initId);
14963
15535
  this.make_current();
@@ -14973,6 +15545,18 @@ var WebGLBridge = GObject.registerClass(
14973
15545
  }
14974
15546
  this._readyCallbacks = [];
14975
15547
  }
15548
+ this._renderTag = this.connect("render", (_widget) => {
15549
+ if (this._frameCallback !== null) {
15550
+ const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
15551
+ if (globalThis.__GJSIFY_DEBUG_RAF === true) {
15552
+ console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
15553
+ }
15554
+ const cb = this._frameCallback;
15555
+ this._frameCallback = null;
15556
+ cb(time2);
15557
+ }
15558
+ return true;
15559
+ });
14976
15560
  return true;
14977
15561
  });
14978
15562
  this.connect("resize", () => {
@@ -15036,30 +15620,13 @@ var WebGLBridge = GObject.registerClass(
15036
15620
  }
15037
15621
  /**
15038
15622
  * Schedules a single animation frame callback, matching the browser `requestAnimationFrame` API.
15039
- * Backed by GTK frame clock (vsync-synced) + the GLArea render signal.
15040
- * Returns 0 (handle cancel not yet implemented).
15623
+ * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
15624
+ * render signal handler. Both are installed once at construction / first render respectively,
15625
+ * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
15626
+ * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
15041
15627
  */
15042
15628
  requestAnimationFrame(cb) {
15043
15629
  this._frameCallback = cb;
15044
- if (this._tickCallbackId === null) {
15045
- this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
15046
- this._tickCallbackId = null;
15047
- if (this._renderTag === null) {
15048
- this._renderTag = this.connect("render", (_widget2) => {
15049
- this.disconnect(this._renderTag);
15050
- this._renderTag = null;
15051
- const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
15052
- if (globalThis.__GJSIFY_DEBUG_RAF === true) {
15053
- console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
15054
- }
15055
- this._frameCallback?.(time2);
15056
- return true;
15057
- });
15058
- }
15059
- this.queue_render();
15060
- return GLib2.SOURCE_REMOVE;
15061
- });
15062
- }
15063
15630
  this.queue_render();
15064
15631
  return 0;
15065
15632
  }
@@ -15081,22 +15648,22 @@ var WebGLBridge = GObject.registerClass(
15081
15648
  }
15082
15649
  );
15083
15650
 
15084
- // ../../../packages/dom/webgl/lib/esm/index.js
15651
+ // ../../../packages/framework/webgl/lib/esm/index.js
15085
15652
  globalThis.WebGLRenderingContext = WebGLRenderingContext2;
15086
15653
  globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
15087
15654
 
15088
15655
  // src/three-demo.ts
15089
15656
  init_console_gjs();
15090
- init_auto_globals_495e9d950c();
15657
+ init_auto_globals_53fe98c6e6();
15091
15658
 
15092
15659
  // ../../../node_modules/three/build/three.module.js
15093
15660
  init_console_gjs();
15094
- init_auto_globals_495e9d950c();
15661
+ init_auto_globals_53fe98c6e6();
15095
15662
 
15096
15663
  // ../../../node_modules/three/build/three.core.js
15097
15664
  init_console_gjs();
15098
- init_auto_globals_495e9d950c();
15099
- var REVISION = "183";
15665
+ init_auto_globals_53fe98c6e6();
15666
+ var REVISION = "184";
15100
15667
  var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
15101
15668
  var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
15102
15669
  var CullFaceNone = 0;
@@ -15820,6 +16387,9 @@ var MathUtils = {
15820
16387
  denormalize
15821
16388
  };
15822
16389
  var Vector2 = class _Vector2 {
16390
+ static {
16391
+ _Vector2.prototype.isVector2 = true;
16392
+ }
15823
16393
  /**
15824
16394
  * Constructs a new 2D vector.
15825
16395
  *
@@ -15827,7 +16397,6 @@ var Vector2 = class _Vector2 {
15827
16397
  * @param {number} [y=0] - The y value of this vector.
15828
16398
  */
15829
16399
  constructor(x = 0, y = 0) {
15830
- _Vector2.prototype.isVector2 = true;
15831
16400
  this.x = x;
15832
16401
  this.y = y;
15833
16402
  }
@@ -17045,6 +17614,9 @@ var Quaternion = class {
17045
17614
  }
17046
17615
  };
17047
17616
  var Vector3 = class _Vector3 {
17617
+ static {
17618
+ _Vector3.prototype.isVector3 = true;
17619
+ }
17048
17620
  /**
17049
17621
  * Constructs a new 3D vector.
17050
17622
  *
@@ -17053,7 +17625,6 @@ var Vector3 = class _Vector3 {
17053
17625
  * @param {number} [z=0] - The z value of this vector.
17054
17626
  */
17055
17627
  constructor(x = 0, y = 0, z = 0) {
17056
- _Vector3.prototype.isVector3 = true;
17057
17628
  this.x = x;
17058
17629
  this.y = y;
17059
17630
  this.z = z;
@@ -17951,6 +18522,9 @@ var Vector3 = class _Vector3 {
17951
18522
  var _vector$c = /* @__PURE__ */ new Vector3();
17952
18523
  var _quaternion$5 = /* @__PURE__ */ new Quaternion();
17953
18524
  var Matrix3 = class _Matrix3 {
18525
+ static {
18526
+ _Matrix3.prototype.isMatrix3 = true;
18527
+ }
17954
18528
  /**
17955
18529
  * Constructs a new 3x3 matrix. The arguments are supposed to be
17956
18530
  * in row-major order. If no arguments are provided, the constructor
@@ -17967,7 +18541,6 @@ var Matrix3 = class _Matrix3 {
17967
18541
  * @param {number} [n33] - 3-3 matrix element.
17968
18542
  */
17969
18543
  constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
17970
- _Matrix3.prototype.isMatrix3 = true;
17971
18544
  this.elements = [
17972
18545
  1,
17973
18546
  0,
@@ -18667,7 +19240,7 @@ var Source = class {
18667
19240
  if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
18668
19241
  target.set(data.videoWidth, data.videoHeight, 0);
18669
19242
  } else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
18670
- target.set(data.displayHeight, data.displayWidth, 0);
19243
+ target.set(data.displayWidth, data.displayHeight, 0);
18671
19244
  } else if (data !== null) {
18672
19245
  target.set(data.width, data.height, data.depth || 0);
18673
19246
  } else {
@@ -18797,6 +19370,7 @@ var Texture = class _Texture extends EventDispatcher {
18797
19370
  this.isRenderTargetTexture = false;
18798
19371
  this.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;
18799
19372
  this.pmremVersion = 0;
19373
+ this.normalized = false;
18800
19374
  }
18801
19375
  /**
18802
19376
  * The width of the texture in pixels.
@@ -18824,11 +19398,11 @@ var Texture = class _Texture extends EventDispatcher {
18824
19398
  get image() {
18825
19399
  return this.source.data;
18826
19400
  }
18827
- set image(value2 = null) {
19401
+ set image(value2) {
18828
19402
  this.source.data = value2;
18829
19403
  }
18830
19404
  /**
18831
- * Updates the texture transformation matrix from the from the properties {@link Texture#offset},
19405
+ * Updates the texture transformation matrix from the properties {@link Texture#offset},
18832
19406
  * {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.
18833
19407
  */
18834
19408
  updateMatrix() {
@@ -18877,6 +19451,7 @@ var Texture = class _Texture extends EventDispatcher {
18877
19451
  this.format = source.format;
18878
19452
  this.internalFormat = source.internalFormat;
18879
19453
  this.type = source.type;
19454
+ this.normalized = source.normalized;
18880
19455
  this.offset.copy(source.offset);
18881
19456
  this.repeat.copy(source.repeat);
18882
19457
  this.center.copy(source.center);
@@ -18953,6 +19528,7 @@ var Texture = class _Texture extends EventDispatcher {
18953
19528
  format: this.format,
18954
19529
  internalFormat: this.internalFormat,
18955
19530
  type: this.type,
19531
+ normalized: this.normalized,
18956
19532
  colorSpace: this.colorSpace,
18957
19533
  minFilter: this.minFilter,
18958
19534
  magFilter: this.magFilter,
@@ -19058,6 +19634,9 @@ Texture.DEFAULT_IMAGE = null;
19058
19634
  Texture.DEFAULT_MAPPING = UVMapping;
19059
19635
  Texture.DEFAULT_ANISOTROPY = 1;
19060
19636
  var Vector4 = class _Vector4 {
19637
+ static {
19638
+ _Vector4.prototype.isVector4 = true;
19639
+ }
19061
19640
  /**
19062
19641
  * Constructs a new 4D vector.
19063
19642
  *
@@ -19067,7 +19646,6 @@ var Vector4 = class _Vector4 {
19067
19646
  * @param {number} [w=1] - The w value of this vector.
19068
19647
  */
19069
19648
  constructor(x = 0, y = 0, z = 0, w = 1) {
19070
- _Vector4.prototype.isVector4 = true;
19071
19649
  this.x = x;
19072
19650
  this.y = y;
19073
19651
  this.z = z;
@@ -19975,6 +20553,7 @@ var RenderTarget = class extends EventDispatcher {
19975
20553
  this.resolveStencilBuffer = source.resolveStencilBuffer;
19976
20554
  if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
19977
20555
  this.samples = source.samples;
20556
+ this.multiview = source.multiview;
19978
20557
  return this;
19979
20558
  }
19980
20559
  /**
@@ -20062,6 +20641,9 @@ var Data3DTexture = class extends Texture {
20062
20641
  }
20063
20642
  };
20064
20643
  var Matrix4 = class _Matrix4 {
20644
+ static {
20645
+ _Matrix4.prototype.isMatrix4 = true;
20646
+ }
20065
20647
  /**
20066
20648
  * Constructs a new 4x4 matrix. The arguments are supposed to be
20067
20649
  * in row-major order. If no arguments are provided, the constructor
@@ -20085,7 +20667,6 @@ var Matrix4 = class _Matrix4 {
20085
20667
  * @param {number} [n44] - 4-4 matrix element.
20086
20668
  */
20087
20669
  constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
20088
- _Matrix4.prototype.isMatrix4 = true;
20089
20670
  this.elements = [
20090
20671
  1,
20091
20672
  0,
@@ -22448,9 +23029,7 @@ var Object3D = class _Object3D extends EventDispatcher {
22448
23029
  this.rotation.order = source.rotation.order;
22449
23030
  this.quaternion.copy(source.quaternion);
22450
23031
  this.scale.copy(source.scale);
22451
- if (source.pivot !== null) {
22452
- this.pivot = source.pivot.clone();
22453
- }
23032
+ this.pivot = source.pivot !== null ? source.pivot.clone() : null;
22454
23033
  this.matrix.copy(source.matrix);
22455
23034
  this.matrixWorld.copy(source.matrixWorld);
22456
23035
  this.matrixAutoUpdate = source.matrixAutoUpdate;
@@ -22540,6 +23119,7 @@ var WebXRController = class {
22540
23119
  this._grip.linearVelocity = new Vector3();
22541
23120
  this._grip.hasAngularVelocity = false;
22542
23121
  this._grip.angularVelocity = new Vector3();
23122
+ this._grip.eventsEnabled = false;
22543
23123
  }
22544
23124
  return this._grip;
22545
23125
  }
@@ -22669,6 +23249,13 @@ var WebXRController = class {
22669
23249
  } else {
22670
23250
  grip.hasAngularVelocity = false;
22671
23251
  }
23252
+ if (grip.eventsEnabled) {
23253
+ grip.dispatchEvent({
23254
+ type: "gripUpdated",
23255
+ data: inputSource,
23256
+ target: this
23257
+ });
23258
+ }
22672
23259
  }
22673
23260
  }
22674
23261
  }
@@ -23681,7 +24268,7 @@ var Triangle = class _Triangle {
23681
24268
  static isFrontFacing(a, b, c, direction) {
23682
24269
  _v0$2.subVectors(c, b);
23683
24270
  _v1$5.subVectors(a, b);
23684
- return _v0$2.cross(_v1$5).dot(direction) < 0 ? true : false;
24271
+ return _v0$2.cross(_v1$5).dot(direction) < 0;
23685
24272
  }
23686
24273
  /**
23687
24274
  * Sets the triangle's vertices by copying the given values.
@@ -24442,7 +25029,7 @@ function satForAxes(axes, v0, v1, v2, extents) {
24442
25029
  var _vector$a = /* @__PURE__ */ new Vector3();
24443
25030
  var _vector2$1 = /* @__PURE__ */ new Vector2();
24444
25031
  var _id$2 = 0;
24445
- var BufferAttribute = class {
25032
+ var BufferAttribute = class extends EventDispatcher {
24446
25033
  /**
24447
25034
  * Constructs a new buffer attribute.
24448
25035
  *
@@ -24451,6 +25038,7 @@ var BufferAttribute = class {
24451
25038
  * @param {boolean} [normalized=false] - Whether the data are normalized or not.
24452
25039
  */
24453
25040
  constructor(array, itemSize, normalized = false) {
25041
+ super();
24454
25042
  if (Array.isArray(array)) {
24455
25043
  throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
24456
25044
  }
@@ -24847,6 +25435,12 @@ var BufferAttribute = class {
24847
25435
  if (this.usage !== StaticDrawUsage) data.usage = this.usage;
24848
25436
  return data;
24849
25437
  }
25438
+ /**
25439
+ * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
25440
+ */
25441
+ dispose() {
25442
+ this.dispatchEvent({ type: "dispose" });
25443
+ }
24850
25444
  };
24851
25445
  var Uint16BufferAttribute = class extends BufferAttribute {
24852
25446
  /**
@@ -27201,9 +27795,10 @@ var Plane = class {
27201
27795
  *
27202
27796
  * @param {Line3} line - The line to compute the intersection for.
27203
27797
  * @param {Vector3} target - The target vector that is used to store the method's result.
27204
- * @return {?Vector3} The intersection point.
27798
+ * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
27799
+ * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
27205
27800
  */
27206
- intersectLine(line, target) {
27801
+ intersectLine(line, target, clampToLine = true) {
27207
27802
  const direction = line.delta(_vector1);
27208
27803
  const denominator = this.normal.dot(direction);
27209
27804
  if (denominator === 0) {
@@ -27213,7 +27808,7 @@ var Plane = class {
27213
27808
  return null;
27214
27809
  }
27215
27810
  const t = -(line.start.dot(this.normal) + this.constant) / denominator;
27216
- if (t < 0 || t > 1) {
27811
+ if (clampToLine === true && (t < 0 || t > 1)) {
27217
27812
  return null;
27218
27813
  }
27219
27814
  return target.copy(line.start).addScaledVector(direction, t);
@@ -28105,7 +28700,7 @@ function cloneUniforms(src) {
28105
28700
  dst[u] = {};
28106
28701
  for (const p in src[u]) {
28107
28702
  const property = src[u][p];
28108
- if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
28703
+ if (isThreeObject(property)) {
28109
28704
  if (property.isRenderTargetTexture) {
28110
28705
  warn2("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
28111
28706
  dst[u][p] = null;
@@ -28113,7 +28708,15 @@ function cloneUniforms(src) {
28113
28708
  dst[u][p] = property.clone();
28114
28709
  }
28115
28710
  } else if (Array.isArray(property)) {
28116
- dst[u][p] = property.slice();
28711
+ if (isThreeObject(property[0])) {
28712
+ const clonedProperty = [];
28713
+ for (let i = 0, l = property.length; i < l; i++) {
28714
+ clonedProperty[i] = property[i].clone();
28715
+ }
28716
+ dst[u][p] = clonedProperty;
28717
+ } else {
28718
+ dst[u][p] = property.slice();
28719
+ }
28117
28720
  } else {
28118
28721
  dst[u][p] = property;
28119
28722
  }
@@ -28131,6 +28734,9 @@ function mergeUniforms(uniforms) {
28131
28734
  }
28132
28735
  return merged;
28133
28736
  }
28737
+ function isThreeObject(property) {
28738
+ return property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion);
28739
+ }
28134
28740
  function cloneUniformsGroups(src) {
28135
28741
  const dst = [];
28136
28742
  for (let u = 0; u < src.length; u++) {
@@ -31203,6 +31809,77 @@ var Spherical = class {
31203
31809
  return new this.constructor().copy(this);
31204
31810
  }
31205
31811
  };
31812
+ var Matrix2 = class _Matrix2 {
31813
+ static {
31814
+ _Matrix2.prototype.isMatrix2 = true;
31815
+ }
31816
+ /**
31817
+ * Constructs a new 2x2 matrix. The arguments are supposed to be
31818
+ * in row-major order. If no arguments are provided, the constructor
31819
+ * initializes the matrix as an identity matrix.
31820
+ *
31821
+ * @param {number} [n11] - 1-1 matrix element.
31822
+ * @param {number} [n12] - 1-2 matrix element.
31823
+ * @param {number} [n21] - 2-1 matrix element.
31824
+ * @param {number} [n22] - 2-2 matrix element.
31825
+ */
31826
+ constructor(n11, n12, n21, n22) {
31827
+ this.elements = [
31828
+ 1,
31829
+ 0,
31830
+ 0,
31831
+ 1
31832
+ ];
31833
+ if (n11 !== void 0) {
31834
+ this.set(n11, n12, n21, n22);
31835
+ }
31836
+ }
31837
+ /**
31838
+ * Sets this matrix to the 2x2 identity matrix.
31839
+ *
31840
+ * @return {Matrix2} A reference to this matrix.
31841
+ */
31842
+ identity() {
31843
+ this.set(
31844
+ 1,
31845
+ 0,
31846
+ 0,
31847
+ 1
31848
+ );
31849
+ return this;
31850
+ }
31851
+ /**
31852
+ * Sets the elements of the matrix from the given array.
31853
+ *
31854
+ * @param {Array<number>} array - The matrix elements in column-major order.
31855
+ * @param {number} [offset=0] - Index of the first element in the array.
31856
+ * @return {Matrix2} A reference to this matrix.
31857
+ */
31858
+ fromArray(array, offset = 0) {
31859
+ for (let i = 0; i < 4; i++) {
31860
+ this.elements[i] = array[i + offset];
31861
+ }
31862
+ return this;
31863
+ }
31864
+ /**
31865
+ * Sets the elements of the matrix.The arguments are supposed to be
31866
+ * in row-major order.
31867
+ *
31868
+ * @param {number} n11 - 1-1 matrix element.
31869
+ * @param {number} n12 - 1-2 matrix element.
31870
+ * @param {number} n21 - 2-1 matrix element.
31871
+ * @param {number} n22 - 2-2 matrix element.
31872
+ * @return {Matrix2} A reference to this matrix.
31873
+ */
31874
+ set(n11, n12, n21, n22) {
31875
+ const te = this.elements;
31876
+ te[0] = n11;
31877
+ te[2] = n12;
31878
+ te[1] = n21;
31879
+ te[3] = n22;
31880
+ return this;
31881
+ }
31882
+ };
31206
31883
  var Controls = class extends EventDispatcher {
31207
31884
  /**
31208
31885
  * Constructs a new controls instance.
@@ -31393,11 +32070,12 @@ function WebGLAnimation() {
31393
32070
  start: function() {
31394
32071
  if (isAnimating === true) return;
31395
32072
  if (animationLoop === null) return;
32073
+ if (context === null) return;
31396
32074
  requestId = context.requestAnimationFrame(onAnimationFrame);
31397
32075
  isAnimating = true;
31398
32076
  },
31399
32077
  stop: function() {
31400
- context.cancelAnimationFrame(requestId);
32078
+ if (context !== null) context.cancelAnimationFrame(requestId);
31401
32079
  isAnimating = false;
31402
32080
  },
31403
32081
  setAnimationLoop: function(callback) {
@@ -31564,8 +32242,8 @@ var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = textur
31564
32242
  var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif";
31565
32243
  var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
31566
32244
  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}";
31567
- 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";
31568
- 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";
32245
+ 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";
32246
+ 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";
31569
32247
  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";
31570
32248
  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";
31571
32249
  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";
@@ -31577,17 +32255,18 @@ var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D grad
31577
32255
  var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
31578
32256
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
31579
32257
  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";
31580
- 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";
32258
+ 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>";
31581
32259
  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";
31582
32260
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
31583
32261
  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";
31584
32262
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
31585
32263
  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";
31586
32264
  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";
31587
- 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}";
31588
- 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";
32265
+ 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}";
32266
+ 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";
31589
32267
  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";
31590
32268
  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";
32269
+ 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";
31591
32270
  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";
31592
32271
  var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
31593
32272
  var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
@@ -31604,7 +32283,7 @@ var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetB
31604
32283
  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";
31605
32284
  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";
31606
32285
  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;";
31607
- 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";
32286
+ 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";
31608
32287
  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";
31609
32288
  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";
31610
32289
  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";
@@ -31623,7 +32302,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
31623
32302
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
31624
32303
  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";
31625
32304
  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";
31626
- 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";
32305
+ 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";
31627
32306
  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}";
31628
32307
  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";
31629
32308
  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";
@@ -31642,7 +32321,7 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defin
31642
32321
  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}";
31643
32322
  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}";
31644
32323
  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}";
31645
- 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}";
32324
+ 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}";
31646
32325
  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}";
31647
32326
  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}";
31648
32327
  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}";
@@ -31730,6 +32409,7 @@ var ShaderChunk = {
31730
32409
  lights_fragment_begin,
31731
32410
  lights_fragment_maps,
31732
32411
  lights_fragment_end,
32412
+ lightprobes_pars_fragment,
31733
32413
  logdepthbuf_fragment,
31734
32414
  logdepthbuf_pars_fragment,
31735
32415
  logdepthbuf_pars_vertex,
@@ -31833,7 +32513,6 @@ var UniformsLib = {
31833
32513
  envmap: {
31834
32514
  envMap: { value: null },
31835
32515
  envMapRotation: { value: /* @__PURE__ */ new Matrix3() },
31836
- flipEnvMap: { value: -1 },
31837
32516
  reflectivity: { value: 1 },
31838
32517
  // basic, lambert, phong
31839
32518
  ior: { value: 1.5 },
@@ -31952,7 +32631,11 @@ var UniformsLib = {
31952
32631
  height: {}
31953
32632
  } },
31954
32633
  ltc_1: { value: null },
31955
- ltc_2: { value: null }
32634
+ ltc_2: { value: null },
32635
+ probesSH: { value: null },
32636
+ probesMin: { value: /* @__PURE__ */ new Vector3() },
32637
+ probesMax: { value: /* @__PURE__ */ new Vector3() },
32638
+ probesResolution: { value: /* @__PURE__ */ new Vector3() }
31956
32639
  },
31957
32640
  points: {
31958
32641
  diffuse: { value: /* @__PURE__ */ new Color(16777215) },
@@ -32153,7 +32836,6 @@ var ShaderLib = {
32153
32836
  backgroundCube: {
32154
32837
  uniforms: {
32155
32838
  envMap: { value: null },
32156
- flipEnvMap: { value: -1 },
32157
32839
  backgroundBlurriness: { value: 0 },
32158
32840
  backgroundIntensity: { value: 1 },
32159
32841
  backgroundRotation: { value: /* @__PURE__ */ new Matrix3() }
@@ -32257,8 +32939,9 @@ ShaderLib.physical = {
32257
32939
  fragmentShader: ShaderChunk.meshphysical_frag
32258
32940
  };
32259
32941
  var _rgb = { r: 0, b: 0, g: 0 };
32260
- var _e1$1 = /* @__PURE__ */ new Euler();
32261
32942
  var _m1$12 = /* @__PURE__ */ new Matrix4();
32943
+ var _m$1 = /* @__PURE__ */ new Matrix3();
32944
+ _m$1.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
32262
32945
  function WebGLBackground(renderer, environments, state, objects, alpha, premultipliedAlpha) {
32263
32946
  const clearColor = new Color(0);
32264
32947
  let clearAlpha = alpha === true ? 0 : 1;
@@ -32327,19 +33010,13 @@ function WebGLBackground(renderer, environments, state, objects, alpha, premulti
32327
33010
  });
32328
33011
  objects.update(boxMesh);
32329
33012
  }
32330
- _e1$1.copy(scene.backgroundRotation);
32331
- _e1$1.x *= -1;
32332
- _e1$1.y *= -1;
32333
- _e1$1.z *= -1;
32334
- if (background.isCubeTexture && background.isRenderTargetTexture === false) {
32335
- _e1$1.y *= -1;
32336
- _e1$1.z *= -1;
32337
- }
32338
33013
  boxMesh.material.uniforms.envMap.value = background;
32339
- boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
32340
33014
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
32341
33015
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
32342
- boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(_e1$1));
33016
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(scene.backgroundRotation)).transpose();
33017
+ if (background.isCubeTexture && background.isRenderTargetTexture === false) {
33018
+ boxMesh.material.uniforms.backgroundRotation.value.premultiply(_m$1);
33019
+ }
32343
33020
  boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer;
32344
33021
  if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
32345
33022
  boxMesh.material.needsUpdate = true;
@@ -32815,27 +33492,10 @@ function WebGLBufferRenderer(gl, extensions, info2) {
32815
33492
  }
32816
33493
  info2.update(elementCount, mode, 1);
32817
33494
  }
32818
- function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
32819
- if (drawCount === 0) return;
32820
- const extension = extensions.get("WEBGL_multi_draw");
32821
- if (extension === null) {
32822
- for (let i = 0; i < starts.length; i++) {
32823
- renderInstances(starts[i], counts[i], primcount[i]);
32824
- }
32825
- } else {
32826
- extension.multiDrawArraysInstancedWEBGL(mode, starts, 0, counts, 0, primcount, 0, drawCount);
32827
- let elementCount = 0;
32828
- for (let i = 0; i < drawCount; i++) {
32829
- elementCount += counts[i] * primcount[i];
32830
- }
32831
- info2.update(elementCount, mode, 1);
32832
- }
32833
- }
32834
33495
  this.setMode = setMode;
32835
33496
  this.render = render;
32836
33497
  this.renderInstances = renderInstances;
32837
33498
  this.renderMultiDraw = renderMultiDraw;
32838
- this.renderMultiDrawInstances = renderMultiDrawInstances;
32839
33499
  }
32840
33500
  function WebGLCapabilities(gl, extensions, parameters, utils) {
32841
33501
  let maxAnisotropy;
@@ -32885,6 +33545,9 @@ function WebGLCapabilities(gl, extensions, parameters, utils) {
32885
33545
  }
32886
33546
  const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
32887
33547
  const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has("EXT_clip_control");
33548
+ if (parameters.reversedDepthBuffer === true && reversedDepthBuffer === false) {
33549
+ warn2("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");
33550
+ }
32888
33551
  const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
32889
33552
  const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
32890
33553
  const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
@@ -34226,28 +34889,11 @@ function WebGLIndexedBufferRenderer(gl, extensions, info2) {
34226
34889
  }
34227
34890
  info2.update(elementCount, mode, 1);
34228
34891
  }
34229
- function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
34230
- if (drawCount === 0) return;
34231
- const extension = extensions.get("WEBGL_multi_draw");
34232
- if (extension === null) {
34233
- for (let i = 0; i < starts.length; i++) {
34234
- renderInstances(starts[i] / bytesPerElement, counts[i], primcount[i]);
34235
- }
34236
- } else {
34237
- extension.multiDrawElementsInstancedWEBGL(mode, counts, 0, type, starts, 0, primcount, 0, drawCount);
34238
- let elementCount = 0;
34239
- for (let i = 0; i < drawCount; i++) {
34240
- elementCount += counts[i] * primcount[i];
34241
- }
34242
- info2.update(elementCount, mode, 1);
34243
- }
34244
- }
34245
34892
  this.setMode = setMode;
34246
34893
  this.setIndex = setIndex;
34247
34894
  this.render = render;
34248
34895
  this.renderInstances = renderInstances;
34249
34896
  this.renderMultiDraw = renderMultiDraw;
34250
- this.renderMultiDrawInstances = renderMultiDrawInstances;
34251
34897
  }
34252
34898
  function WebGLInfo(gl) {
34253
34899
  const memory = {
@@ -34450,7 +35096,8 @@ function WebGLOutput(type, width, height, depth, stencil) {
34450
35096
  const targetA = new WebGLRenderTarget(width, height, {
34451
35097
  type,
34452
35098
  depthBuffer: depth,
34453
- stencilBuffer: stencil
35099
+ stencilBuffer: stencil,
35100
+ depthTexture: depth ? new DepthTexture(width, height) : void 0
34454
35101
  });
34455
35102
  const targetB = new WebGLRenderTarget(width, height, {
34456
35103
  type: HalfFloatType,
@@ -34603,6 +35250,7 @@ function WebGLOutput(type, width, height, depth, stencil) {
34603
35250
  return _isCompositing;
34604
35251
  };
34605
35252
  this.dispose = function() {
35253
+ if (targetA.depthTexture) targetA.depthTexture.dispose();
34606
35254
  targetA.dispose();
34607
35255
  targetB.dispose();
34608
35256
  geometry.dispose();
@@ -35614,6 +36262,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
35614
36262
  parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "",
35615
36263
  //
35616
36264
  parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "",
36265
+ parameters.vertexNormals ? "#define HAS_NORMAL" : "",
35617
36266
  parameters.vertexColors ? "#define USE_COLOR" : "",
35618
36267
  parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
35619
36268
  parameters.vertexUv1s ? "#define USE_UV1" : "",
@@ -35700,6 +36349,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
35700
36349
  parameters.normalMap ? "#define USE_NORMALMAP" : "",
35701
36350
  parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "",
35702
36351
  parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "",
36352
+ parameters.packedNormalMap ? "#define USE_PACKED_NORMALMAP" : "",
35703
36353
  parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
35704
36354
  parameters.anisotropy ? "#define USE_ANISOTROPY" : "",
35705
36355
  parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "",
@@ -35740,6 +36390,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
35740
36390
  parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "",
35741
36391
  parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
35742
36392
  parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "",
36393
+ parameters.numLightProbeGrids > 0 ? "#define USE_LIGHT_PROBES_GRID" : "",
35743
36394
  parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "",
35744
36395
  parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "",
35745
36396
  parameters.logarithmicDepthBuffer ? "#define USE_LOGARITHMIC_DEPTH_BUFFER" : "",
@@ -35954,6 +36605,9 @@ var WebGLShaderStage = class {
35954
36605
  this.usedTimes = 0;
35955
36606
  }
35956
36607
  };
36608
+ function isPackedRGFormat(format) {
36609
+ return format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;
36610
+ }
35957
36611
  function WebGLPrograms(renderer, environments, extensions, capabilities, bindingStates, clipping) {
35958
36612
  const _programLayers = new Layers();
35959
36613
  const _customShaders = new WebGLShaderCache();
@@ -35984,7 +36638,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
35984
36638
  if (value2 === 0) return "uv";
35985
36639
  return `uv${value2}`;
35986
36640
  }
35987
- function getParameters(material, lights, shadows, scene, object) {
36641
+ function getParameters(material, lights, shadows, scene, object, lightProbeGrids) {
35988
36642
  const fog = scene.fog;
35989
36643
  const geometry = object.geometry;
35990
36644
  const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
@@ -36079,7 +36733,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36079
36733
  instancing: IS_INSTANCEDMESH,
36080
36734
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
36081
36735
  instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
36082
- outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace,
36736
+ outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace,
36083
36737
  alphaToCoverage: !!material.alphaToCoverage,
36084
36738
  map: HAS_MAP,
36085
36739
  matcap: HAS_MATCAP,
@@ -36094,6 +36748,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36094
36748
  emissiveMap: HAS_EMISSIVEMAP,
36095
36749
  normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
36096
36750
  normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
36751
+ packedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat(material.normalMap.format),
36097
36752
  metalnessMap: HAS_METALNESSMAP,
36098
36753
  roughnessMap: HAS_ROUGHNESSMAP,
36099
36754
  anisotropy: HAS_ANISOTROPY,
@@ -36147,6 +36802,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36147
36802
  alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),
36148
36803
  //
36149
36804
  vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),
36805
+ vertexNormals: !!geometry.attributes.normal,
36150
36806
  vertexColors: material.vertexColors,
36151
36807
  vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,
36152
36808
  pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),
@@ -36174,6 +36830,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36174
36830
  numSpotLightShadows: lights.spotShadowMap.length,
36175
36831
  numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
36176
36832
  numLightProbes: lights.numLightProbes,
36833
+ numLightProbeGrids: lightProbeGrids.length,
36177
36834
  numClippingPlanes: clipping.numPlanes,
36178
36835
  numClipIntersection: clipping.numIntersection,
36179
36836
  dithering: material.dithering,
@@ -36317,6 +36974,10 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36317
36974
  _programLayers.enable(20);
36318
36975
  if (parameters.gradientMap)
36319
36976
  _programLayers.enable(21);
36977
+ if (parameters.packedNormalMap)
36978
+ _programLayers.enable(22);
36979
+ if (parameters.vertexNormals)
36980
+ _programLayers.enable(23);
36320
36981
  array.push(_programLayers.mask);
36321
36982
  _programLayers.disableAll();
36322
36983
  if (parameters.fog)
@@ -36363,6 +37024,8 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36363
37024
  _programLayers.enable(20);
36364
37025
  if (parameters.alphaToCoverage)
36365
37026
  _programLayers.enable(21);
37027
+ if (parameters.numLightProbeGrids > 0)
37028
+ _programLayers.enable(22);
36366
37029
  array.push(_programLayers.mask);
36367
37030
  }
36368
37031
  function getUniforms(material) {
@@ -36962,10 +37625,12 @@ function WebGLRenderState(extensions) {
36962
37625
  const lights = new WebGLLights(extensions);
36963
37626
  const lightsArray = [];
36964
37627
  const shadowsArray = [];
37628
+ const lightProbeGridArray = [];
36965
37629
  function init(camera) {
36966
37630
  state.camera = camera;
36967
37631
  lightsArray.length = 0;
36968
37632
  shadowsArray.length = 0;
37633
+ lightProbeGridArray.length = 0;
36969
37634
  }
36970
37635
  function pushLight(light) {
36971
37636
  lightsArray.push(light);
@@ -36973,6 +37638,9 @@ function WebGLRenderState(extensions) {
36973
37638
  function pushShadow(shadowLight) {
36974
37639
  shadowsArray.push(shadowLight);
36975
37640
  }
37641
+ function pushLightProbeGrid(volume) {
37642
+ lightProbeGridArray.push(volume);
37643
+ }
36976
37644
  function setupLights() {
36977
37645
  lights.setup(lightsArray);
36978
37646
  }
@@ -36982,9 +37650,11 @@ function WebGLRenderState(extensions) {
36982
37650
  const state = {
36983
37651
  lightsArray,
36984
37652
  shadowsArray,
37653
+ lightProbeGridArray,
36985
37654
  camera: null,
36986
37655
  lights,
36987
- transmissionRenderTarget: {}
37656
+ transmissionRenderTarget: {},
37657
+ textureUnits: 0
36988
37658
  };
36989
37659
  return {
36990
37660
  init,
@@ -36992,7 +37662,8 @@ function WebGLRenderState(extensions) {
36992
37662
  setupLights,
36993
37663
  setupLightsView,
36994
37664
  pushLight,
36995
- pushShadow
37665
+ pushShadow,
37666
+ pushLightProbeGrid
36996
37667
  };
36997
37668
  }
36998
37669
  function WebGLRenderStates(extensions) {
@@ -37552,6 +38223,7 @@ function WebGLState(gl, extensions) {
37552
38223
  const uboBindings = /* @__PURE__ */ new WeakMap();
37553
38224
  const uboProgramMap = /* @__PURE__ */ new WeakMap();
37554
38225
  let enabledCapabilities = {};
38226
+ let parameters = {};
37555
38227
  let currentBoundFramebuffers = {};
37556
38228
  let currentDrawbuffers = /* @__PURE__ */ new WeakMap();
37557
38229
  let defaultDrawbuffers = [];
@@ -37976,6 +38648,19 @@ function WebGLState(gl, extensions) {
37976
38648
  error2("WebGLState:", e);
37977
38649
  }
37978
38650
  }
38651
+ function getParameter(name2) {
38652
+ if (parameters[name2] !== void 0) {
38653
+ return parameters[name2];
38654
+ } else {
38655
+ return gl.getParameter(name2);
38656
+ }
38657
+ }
38658
+ function pixelStorei(name2, value2) {
38659
+ if (parameters[name2] !== value2) {
38660
+ gl.pixelStorei(name2, value2);
38661
+ parameters[name2] = value2;
38662
+ }
38663
+ }
37979
38664
  function scissor(scissor2) {
37980
38665
  if (currentScissor.equals(scissor2) === false) {
37981
38666
  gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w);
@@ -38041,7 +38726,21 @@ function WebGLState(gl, extensions) {
38041
38726
  gl.lineWidth(1);
38042
38727
  gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
38043
38728
  gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
38729
+ gl.pixelStorei(gl.PACK_ALIGNMENT, 4);
38730
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
38731
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
38732
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
38733
+ gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL);
38734
+ gl.pixelStorei(gl.PACK_ROW_LENGTH, 0);
38735
+ gl.pixelStorei(gl.PACK_SKIP_PIXELS, 0);
38736
+ gl.pixelStorei(gl.PACK_SKIP_ROWS, 0);
38737
+ gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
38738
+ gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
38739
+ gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
38740
+ gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
38741
+ gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
38044
38742
  enabledCapabilities = {};
38743
+ parameters = {};
38045
38744
  currentTextureSlot = null;
38046
38745
  currentBoundTextures = {};
38047
38746
  currentBoundFramebuffers = {};
@@ -38095,6 +38794,8 @@ function WebGLState(gl, extensions) {
38095
38794
  compressedTexImage3D,
38096
38795
  texImage2D,
38097
38796
  texImage3D,
38797
+ pixelStorei,
38798
+ getParameter,
38098
38799
  updateUBOMapping,
38099
38800
  uniformBlockBinding,
38100
38801
  texStorage2D,
@@ -38113,6 +38814,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38113
38814
  const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent);
38114
38815
  const _imageDimensions = new Vector2();
38115
38816
  const _videoTextures = /* @__PURE__ */ new WeakMap();
38817
+ const _htmlTextures = /* @__PURE__ */ new Set();
38116
38818
  let _canvas2;
38117
38819
  const _sources = /* @__PURE__ */ new WeakMap();
38118
38820
  let useOffscreenCanvas = false;
@@ -38162,16 +38864,25 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38162
38864
  if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY;
38163
38865
  return _gl.TEXTURE_2D;
38164
38866
  }
38165
- function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) {
38867
+ function getInternalFormat(internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false) {
38166
38868
  if (internalFormatName !== null) {
38167
38869
  if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName];
38168
38870
  warn2("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'");
38169
38871
  }
38872
+ let ext_texture_norm16;
38873
+ if (normalized) {
38874
+ ext_texture_norm16 = extensions.get("EXT_texture_norm16");
38875
+ if (!ext_texture_norm16) {
38876
+ warn2("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension");
38877
+ }
38878
+ }
38170
38879
  let internalFormat = glFormat;
38171
38880
  if (glFormat === _gl.RED) {
38172
38881
  if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
38173
38882
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
38174
38883
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
38884
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_EXT;
38885
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
38175
38886
  }
38176
38887
  if (glFormat === _gl.RED_INTEGER) {
38177
38888
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;
@@ -38185,6 +38896,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38185
38896
  if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
38186
38897
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
38187
38898
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
38899
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_EXT;
38900
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
38188
38901
  }
38189
38902
  if (glFormat === _gl.RG_INTEGER) {
38190
38903
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI;
@@ -38211,6 +38924,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38211
38924
  if (glType === _gl.INT) internalFormat = _gl.RGBA32I;
38212
38925
  }
38213
38926
  if (glFormat === _gl.RGB) {
38927
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_EXT;
38928
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
38214
38929
  if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5;
38215
38930
  if (glType === _gl.UNSIGNED_INT_10F_11F_11F_REV) internalFormat = _gl.R11F_G11F_B10F;
38216
38931
  }
@@ -38219,6 +38934,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38219
38934
  if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
38220
38935
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
38221
38936
  if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
38937
+ if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_EXT;
38938
+ if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
38222
38939
  if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
38223
38940
  if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
38224
38941
  }
@@ -38267,6 +38984,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38267
38984
  if (texture.isVideoTexture) {
38268
38985
  _videoTextures.delete(texture);
38269
38986
  }
38987
+ if (texture.isHTMLTexture) {
38988
+ _htmlTextures.delete(texture);
38989
+ }
38270
38990
  }
38271
38991
  function onRenderTargetDispose(event) {
38272
38992
  const renderTarget = event.target;
@@ -38343,6 +39063,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38343
39063
  function resetTextureUnits() {
38344
39064
  textureUnits = 0;
38345
39065
  }
39066
+ function getTextureUnits() {
39067
+ return textureUnits;
39068
+ }
39069
+ function setTextureUnits(value2) {
39070
+ textureUnits = value2;
39071
+ }
38346
39072
  function allocateTextureUnit() {
38347
39073
  const textureUnit = textureUnits;
38348
39074
  if (textureUnit >= capabilities.maxTextures) {
@@ -38525,10 +39251,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38525
39251
  }
38526
39252
  }
38527
39253
  updateRanges.length = mergeIndex + 1;
38528
- const currentUnpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);
38529
- const currentUnpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);
38530
- const currentUnpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);
38531
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
39254
+ const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
39255
+ const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
39256
+ const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
39257
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
38532
39258
  for (let i = 0, l = updateRanges.length; i < l; i++) {
38533
39259
  const range = updateRanges[i];
38534
39260
  const pixelStart = Math.floor(range.start / componentStride);
@@ -38537,14 +39263,14 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38537
39263
  const y = Math.floor(pixelStart / image.width);
38538
39264
  const width = pixelCount;
38539
39265
  const height = 1;
38540
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x);
38541
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
39266
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x);
39267
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
38542
39268
  state.texSubImage2D(_gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data);
38543
39269
  }
38544
39270
  texture.clearUpdateRanges();
38545
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
38546
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
38547
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
39271
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
39272
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
39273
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
38548
39274
  }
38549
39275
  }
38550
39276
  function uploadTexture(textureProperties, texture, slot) {
@@ -38557,18 +39283,21 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38557
39283
  const sourceProperties = properties.get(source);
38558
39284
  if (source.version !== sourceProperties.__version || forceUpload === true) {
38559
39285
  state.activeTexture(_gl.TEXTURE0 + slot);
38560
- const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
38561
- const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
38562
- const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
38563
- _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
38564
- _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
38565
- _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
38566
- _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
39286
+ const isImageBitmap = typeof ImageBitmap !== "undefined" && texture.image instanceof ImageBitmap;
39287
+ if (isImageBitmap === false) {
39288
+ const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
39289
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
39290
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
39291
+ state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
39292
+ state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
39293
+ state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
39294
+ }
39295
+ state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
38567
39296
  let image = resizeImage(texture.image, false, capabilities.maxTextureSize);
38568
39297
  image = verifyColorSpace(texture, image);
38569
39298
  const glFormat = utils.convert(texture.format, texture.colorSpace);
38570
39299
  const glType = utils.convert(texture.type);
38571
- let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture);
39300
+ let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture);
38572
39301
  setTextureParameters(textureType, texture);
38573
39302
  let mipmap;
38574
39303
  const mipmaps = texture.mipmaps;
@@ -38730,6 +39459,35 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38730
39459
  }
38731
39460
  }
38732
39461
  }
39462
+ } else if (texture.isHTMLTexture) {
39463
+ if ("texElementImage2D" in _gl) {
39464
+ const canvas = _gl.canvas;
39465
+ if (!canvas.hasAttribute("layoutsubtree")) {
39466
+ canvas.setAttribute("layoutsubtree", "true");
39467
+ }
39468
+ if (image.parentNode !== canvas) {
39469
+ canvas.appendChild(image);
39470
+ _htmlTextures.add(texture);
39471
+ canvas.onpaint = (event) => {
39472
+ const changed = event.changedElements;
39473
+ for (const t of _htmlTextures) {
39474
+ if (changed.includes(t.image)) {
39475
+ t.needsUpdate = true;
39476
+ }
39477
+ }
39478
+ };
39479
+ canvas.requestPaint();
39480
+ return;
39481
+ }
39482
+ const level = 0;
39483
+ const internalFormat = _gl.RGBA;
39484
+ const srcFormat = _gl.RGBA;
39485
+ const srcType = _gl.UNSIGNED_BYTE;
39486
+ _gl.texElementImage2D(_gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image);
39487
+ _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR);
39488
+ _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
39489
+ _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
39490
+ }
38733
39491
  } else {
38734
39492
  if (mipmaps.length > 0) {
38735
39493
  if (useTexStorage && allocateMemory) {
@@ -38780,10 +39538,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38780
39538
  const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
38781
39539
  const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
38782
39540
  const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
38783
- _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
38784
- _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
38785
- _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
38786
- _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
39541
+ state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
39542
+ state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
39543
+ state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
39544
+ state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
38787
39545
  const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;
38788
39546
  const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
38789
39547
  const cubeImage = [];
@@ -38795,7 +39553,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38795
39553
  }
38796
39554
  cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);
38797
39555
  }
38798
- const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
39556
+ 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);
38799
39557
  const useTexStorage = texture.isVideoTexture !== true;
38800
39558
  const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true;
38801
39559
  const dataReady = source.dataReady;
@@ -38892,7 +39650,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38892
39650
  function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) {
38893
39651
  const glFormat = utils.convert(texture.format, texture.colorSpace);
38894
39652
  const glType = utils.convert(texture.type);
38895
- const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
39653
+ const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
38896
39654
  const renderTargetProperties = properties.get(renderTarget);
38897
39655
  const textureProperties = properties.get(texture);
38898
39656
  textureProperties.__renderTarget = renderTarget;
@@ -38934,7 +39692,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38934
39692
  const texture = textures[i];
38935
39693
  const glFormat = utils.convert(texture.format, texture.colorSpace);
38936
39694
  const glType = utils.convert(texture.type);
38937
- const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
39695
+ const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
38938
39696
  if (useMultisampledRTT(renderTarget)) {
38939
39697
  multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, getRenderTargetSamples(renderTarget), glInternalFormat, renderTarget.width, renderTarget.height);
38940
39698
  } else if (useMultisample) {
@@ -39134,7 +39892,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
39134
39892
  _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
39135
39893
  const glFormat = utils.convert(texture2.format, texture2.colorSpace);
39136
39894
  const glType = utils.convert(texture2.type);
39137
- const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
39895
+ const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.normalized, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
39138
39896
  const samples = getRenderTargetSamples(renderTarget);
39139
39897
  _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
39140
39898
  _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
@@ -39330,6 +40088,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
39330
40088
  }
39331
40089
  this.allocateTextureUnit = allocateTextureUnit;
39332
40090
  this.resetTextureUnits = resetTextureUnits;
40091
+ this.getTextureUnits = getTextureUnits;
40092
+ this.setTextureUnits = setTextureUnits;
39333
40093
  this.setTexture2D = setTexture2D;
39334
40094
  this.setTexture2DArray = setTexture2DArray;
39335
40095
  this.setTexture3D = setTexture3D;
@@ -40050,8 +40810,9 @@ var WebXRManager = class extends EventDispatcher {
40050
40810
  };
40051
40811
  }
40052
40812
  };
40053
- var _e1 = /* @__PURE__ */ new Euler();
40054
40813
  var _m12 = /* @__PURE__ */ new Matrix4();
40814
+ var _m = /* @__PURE__ */ new Matrix3();
40815
+ _m.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
40055
40816
  function WebGLMaterials(renderer, properties) {
40056
40817
  function refreshTransformUniform(map, uniform) {
40057
40818
  if (map.matrixAutoUpdate === true) {
@@ -40069,7 +40830,9 @@ function WebGLMaterials(renderer, properties) {
40069
40830
  }
40070
40831
  }
40071
40832
  function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
40072
- if (material.isMeshBasicMaterial) {
40833
+ if (material.isNodeMaterial) {
40834
+ material.uniformsNeedUpdate = false;
40835
+ } else if (material.isMeshBasicMaterial) {
40073
40836
  refreshUniformsCommon(uniforms, material);
40074
40837
  } else if (material.isMeshLambertMaterial) {
40075
40838
  refreshUniformsCommon(uniforms, material);
@@ -40171,16 +40934,10 @@ function WebGLMaterials(renderer, properties) {
40171
40934
  const envMapRotation = materialProperties.envMapRotation;
40172
40935
  if (envMap) {
40173
40936
  uniforms.envMap.value = envMap;
40174
- _e1.copy(envMapRotation);
40175
- _e1.x *= -1;
40176
- _e1.y *= -1;
40177
- _e1.z *= -1;
40937
+ uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(envMapRotation)).transpose();
40178
40938
  if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) {
40179
- _e1.y *= -1;
40180
- _e1.z *= -1;
40939
+ uniforms.envMapRotation.value.premultiply(_m);
40181
40940
  }
40182
- uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(_e1));
40183
- uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
40184
40941
  uniforms.reflectivity.value = material.reflectivity;
40185
40942
  uniforms.ior.value = material.ior;
40186
40943
  uniforms.refractionRatio.value = material.refractionRatio;
@@ -40446,6 +41203,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40446
41203
  uniform.__data[9] = value2.elements[7];
40447
41204
  uniform.__data[10] = value2.elements[8];
40448
41205
  uniform.__data[11] = 0;
41206
+ } else if (ArrayBuffer.isView(value2)) {
41207
+ uniform.__data.set(new value2.constructor(value2.buffer, value2.byteOffset, uniform.__data.length));
40449
41208
  } else {
40450
41209
  value2.toArray(uniform.__data, arrayOffset);
40451
41210
  arrayOffset += info3.storage / Float32Array.BYTES_PER_ELEMENT;
@@ -40463,6 +41222,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40463
41222
  if (cache[indexString] === void 0) {
40464
41223
  if (typeof value2 === "number" || typeof value2 === "boolean") {
40465
41224
  cache[indexString] = value2;
41225
+ } else if (ArrayBuffer.isView(value2)) {
41226
+ cache[indexString] = value2.slice();
40466
41227
  } else {
40467
41228
  cache[indexString] = value2.clone();
40468
41229
  }
@@ -40474,6 +41235,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40474
41235
  cache[indexString] = value2;
40475
41236
  return true;
40476
41237
  }
41238
+ } else if (ArrayBuffer.isView(value2)) {
41239
+ return true;
40477
41240
  } else {
40478
41241
  if (cachedObject.equals(value2) === false) {
40479
41242
  cachedObject.copy(value2);
@@ -40541,6 +41304,9 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
40541
41304
  info3.storage = 64;
40542
41305
  } else if (value2.isTexture) {
40543
41306
  warn2("WebGLRenderer: Texture samplers can not be part of an uniforms group.");
41307
+ } else if (ArrayBuffer.isView(value2)) {
41308
+ info3.boundary = 16;
41309
+ info3.storage = value2.byteLength;
40544
41310
  } else {
40545
41311
  warn2("WebGLRenderer: Unsupported uniform value type.", value2);
40546
41312
  }
@@ -41144,6 +41910,7 @@ var WebGLRenderer = class {
41144
41910
  ]);
41145
41911
  const uintClearColor = new Uint32Array(4);
41146
41912
  const intClearColor = new Int32Array(4);
41913
+ const objectPosition = new Vector3();
41147
41914
  let currentRenderList = null;
41148
41915
  let currentRenderState = null;
41149
41916
  const renderListStack = [];
@@ -41174,6 +41941,7 @@ var WebGLRenderer = class {
41174
41941
  this.transmissionResolutionScale = 1;
41175
41942
  const _this = this;
41176
41943
  let _isContextLost = false;
41944
+ let _nodesHandler = null;
41177
41945
  this._outputColorSpace = SRGBColorSpace;
41178
41946
  let _currentActiveCubeFace = 0;
41179
41947
  let _currentActiveMipmapLevel = 0;
@@ -41342,13 +42110,13 @@ var WebGLRenderer = class {
41342
42110
  };
41343
42111
  this.setEffects = function(effects) {
41344
42112
  if (_outputBufferType === UnsignedByteType) {
41345
- console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
42113
+ error2("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
41346
42114
  return;
41347
42115
  }
41348
42116
  if (effects) {
41349
42117
  for (let i = 0; i < effects.length; i++) {
41350
42118
  if (effects[i].isOutputPass === true) {
41351
- console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
42119
+ warn2("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
41352
42120
  break;
41353
42121
  }
41354
42122
  }
@@ -41439,6 +42207,7 @@ var WebGLRenderer = class {
41439
42207
  }
41440
42208
  if (depth2) {
41441
42209
  bits2 |= _gl.DEPTH_BUFFER_BIT;
42210
+ this.state.buffers.depth.setMask(true);
41442
42211
  }
41443
42212
  if (stencil2) {
41444
42213
  bits2 |= _gl.STENCIL_BUFFER_BIT;
@@ -41457,6 +42226,10 @@ var WebGLRenderer = class {
41457
42226
  this.clearStencil = function() {
41458
42227
  this.clear(false, false, true);
41459
42228
  };
42229
+ this.setNodesHandler = function(nodesHandler) {
42230
+ nodesHandler.setRenderer(this);
42231
+ _nodesHandler = nodesHandler;
42232
+ };
41460
42233
  this.dispose = function() {
41461
42234
  canvas.removeEventListener("webglcontextlost", onContextLost, false);
41462
42235
  canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
@@ -41579,23 +42352,18 @@ var WebGLRenderer = class {
41579
42352
  renderer.setMode(_gl.TRIANGLES);
41580
42353
  }
41581
42354
  if (object.isBatchedMesh) {
41582
- if (object._multiDrawInstances !== null) {
41583
- warnOnce("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");
41584
- renderer.renderMultiDrawInstances(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances);
41585
- } else {
41586
- if (!extensions.get("WEBGL_multi_draw")) {
41587
- const starts = object._multiDrawStarts;
41588
- const counts = object._multiDrawCounts;
41589
- const drawCount2 = object._multiDrawCount;
41590
- const bytesPerElement = index ? attributes2.get(index).bytesPerElement : 1;
41591
- const uniforms = properties.get(material).currentProgram.getUniforms();
41592
- for (let i = 0; i < drawCount2; i++) {
41593
- uniforms.setValue(_gl, "_gl_DrawID", i);
41594
- renderer.render(starts[i] / bytesPerElement, counts[i]);
41595
- }
41596
- } else {
41597
- renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
42355
+ if (!extensions.get("WEBGL_multi_draw")) {
42356
+ const starts = object._multiDrawStarts;
42357
+ const counts = object._multiDrawCounts;
42358
+ const drawCount2 = object._multiDrawCount;
42359
+ const bytesPerElement = index ? attributes2.get(index).bytesPerElement : 1;
42360
+ const uniforms = properties.get(material).currentProgram.getUniforms();
42361
+ for (let i = 0; i < drawCount2; i++) {
42362
+ uniforms.setValue(_gl, "_gl_DrawID", i);
42363
+ renderer.render(starts[i] / bytesPerElement, counts[i]);
41598
42364
  }
42365
+ } else {
42366
+ renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
41599
42367
  }
41600
42368
  } else if (object.isInstancedMesh) {
41601
42369
  renderer.renderInstances(drawStart, drawCount, object.count);
@@ -41716,6 +42484,9 @@ var WebGLRenderer = class {
41716
42484
  return;
41717
42485
  }
41718
42486
  if (_isContextLost === true) return;
42487
+ if (_nodesHandler !== null) {
42488
+ _nodesHandler.renderStart(scene, camera);
42489
+ }
41719
42490
  const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
41720
42491
  const useOutput = output !== null && (_currentRenderTarget === null || isXRPresenting) && output.begin(_this, _currentRenderTarget);
41721
42492
  if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
@@ -41727,6 +42498,7 @@ var WebGLRenderer = class {
41727
42498
  if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
41728
42499
  currentRenderState = renderStates.get(scene, renderStateStack.length);
41729
42500
  currentRenderState.init(camera);
42501
+ currentRenderState.state.textureUnits = textures.getTextureUnits();
41730
42502
  renderStateStack.push(currentRenderState);
41731
42503
  _projScreenMatrix3.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
41732
42504
  _frustum.setFromProjectionMatrix(_projScreenMatrix3, WebGLCoordinateSystem, camera.reversedDepth);
@@ -41794,6 +42566,7 @@ var WebGLRenderer = class {
41794
42566
  renderStateStack.pop();
41795
42567
  if (renderStateStack.length > 0) {
41796
42568
  currentRenderState = renderStateStack[renderStateStack.length - 1];
42569
+ textures.setTextureUnits(currentRenderState.state.textureUnits);
41797
42570
  if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera);
41798
42571
  } else {
41799
42572
  currentRenderState = null;
@@ -41804,6 +42577,9 @@ var WebGLRenderer = class {
41804
42577
  } else {
41805
42578
  currentRenderList = null;
41806
42579
  }
42580
+ if (_nodesHandler !== null) {
42581
+ _nodesHandler.renderEnd();
42582
+ }
41807
42583
  };
41808
42584
  function projectObject(object, camera, groupOrder, sortObjects) {
41809
42585
  if (object.visible === false) return;
@@ -41813,6 +42589,8 @@ var WebGLRenderer = class {
41813
42589
  groupOrder = object.renderOrder;
41814
42590
  } else if (object.isLOD) {
41815
42591
  if (object.autoUpdate === true) object.update(camera);
42592
+ } else if (object.isLightProbeGrid) {
42593
+ currentRenderState.pushLightProbeGrid(object);
41816
42594
  } else if (object.isLight) {
41817
42595
  currentRenderState.pushLight(object);
41818
42596
  if (object.castShadow) {
@@ -41979,7 +42757,7 @@ var WebGLRenderer = class {
41979
42757
  const lights = currentRenderState.state.lights;
41980
42758
  const shadowsArray = currentRenderState.state.shadowsArray;
41981
42759
  const lightsStateVersion = lights.state.version;
41982
- const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
42760
+ const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray);
41983
42761
  const programCacheKey = programCache.getProgramCacheKey(parameters2);
41984
42762
  let programs = materialProperties.programs;
41985
42763
  materialProperties.environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
@@ -42000,6 +42778,9 @@ var WebGLRenderer = class {
42000
42778
  }
42001
42779
  } else {
42002
42780
  parameters2.uniforms = programCache.getUniforms(material);
42781
+ if (_nodesHandler !== null && material.isNodeMaterial) {
42782
+ _nodesHandler.build(material, object, parameters2);
42783
+ }
42003
42784
  material.onBeforeCompile(parameters2, _this);
42004
42785
  program = programCache.acquireProgram(parameters2, programCacheKey);
42005
42786
  programs.set(programCacheKey, program);
@@ -42030,6 +42811,7 @@ var WebGLRenderer = class {
42030
42811
  uniforms.spotLightMap.value = lights.state.spotLightMap;
42031
42812
  uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
42032
42813
  }
42814
+ materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
42033
42815
  materialProperties.currentProgram = program;
42034
42816
  materialProperties.uniformsList = null;
42035
42817
  return program;
@@ -42060,12 +42842,24 @@ var WebGLRenderer = class {
42060
42842
  materialProperties.vertexTangents = parameters2.vertexTangents;
42061
42843
  materialProperties.toneMapping = parameters2.toneMapping;
42062
42844
  }
42845
+ function findLightProbeGrid(volumes, object) {
42846
+ if (volumes.length === 0) return null;
42847
+ if (volumes.length === 1) {
42848
+ return volumes[0].texture !== null ? volumes[0] : null;
42849
+ }
42850
+ objectPosition.setFromMatrixPosition(object.matrixWorld);
42851
+ for (let i = 0, l = volumes.length; i < l; i++) {
42852
+ const v = volumes[i];
42853
+ if (v.texture !== null && v.boundingBox.containsPoint(objectPosition)) return v;
42854
+ }
42855
+ return null;
42856
+ }
42063
42857
  function setProgram(camera, scene, geometry, material, object) {
42064
42858
  if (scene.isScene !== true) scene = _emptyScene;
42065
42859
  textures.resetTextureUnits();
42066
42860
  const fog = scene.fog;
42067
42861
  const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
42068
- const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace;
42862
+ const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace;
42069
42863
  const usePMREM = material.isMeshStandardMaterial || material.isMeshLambertMaterial && !material.envMap || material.isMeshPhongMaterial && !material.envMap;
42070
42864
  const envMap = environments.get(material.envMap || environment, usePMREM);
42071
42865
  const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
@@ -42139,6 +42933,8 @@ var WebGLRenderer = class {
42139
42933
  needsProgramChange = true;
42140
42934
  } else if (materialProperties.morphTargetsCount !== morphTargetsCount) {
42141
42935
  needsProgramChange = true;
42936
+ } else if (!!materialProperties.lightProbeGrid !== currentRenderState.state.lightProbeGridArray.length > 0) {
42937
+ needsProgramChange = true;
42142
42938
  }
42143
42939
  } else {
42144
42940
  needsProgramChange = true;
@@ -42147,6 +42943,9 @@ var WebGLRenderer = class {
42147
42943
  let program = materialProperties.currentProgram;
42148
42944
  if (needsProgramChange === true) {
42149
42945
  program = getProgram(material, scene, object);
42946
+ if (_nodesHandler && material.isNodeMaterial) {
42947
+ _nodesHandler.onUpdateProgram(material, program, materialProperties);
42948
+ }
42150
42949
  }
42151
42950
  let refreshProgram = false;
42152
42951
  let refreshMaterial = false;
@@ -42161,6 +42960,13 @@ var WebGLRenderer = class {
42161
42960
  _currentMaterialId = material.id;
42162
42961
  refreshMaterial = true;
42163
42962
  }
42963
+ if (materialProperties.needsLights) {
42964
+ const objectVolume = findLightProbeGrid(currentRenderState.state.lightProbeGridArray, object);
42965
+ if (materialProperties.lightProbeGrid !== objectVolume) {
42966
+ materialProperties.lightProbeGrid = objectVolume;
42967
+ refreshMaterial = true;
42968
+ }
42969
+ }
42164
42970
  if (refreshProgram || _currentCamera !== camera) {
42165
42971
  const reversedDepthBuffer2 = state.buffers.depth.getReversed();
42166
42972
  if (reversedDepthBuffer2 && camera.reversedDepth !== true) {
@@ -42242,6 +43048,13 @@ var WebGLRenderer = class {
42242
43048
  materials.refreshFogUniforms(m_uniforms, fog);
42243
43049
  }
42244
43050
  materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]);
43051
+ if (materialProperties.needsLights && materialProperties.lightProbeGrid) {
43052
+ const volume = materialProperties.lightProbeGrid;
43053
+ m_uniforms.probesSH.value = volume.texture;
43054
+ m_uniforms.probesMin.value.copy(volume.boundingBox.min);
43055
+ m_uniforms.probesMax.value.copy(volume.boundingBox.max);
43056
+ m_uniforms.probesResolution.value.copy(volume.resolution);
43057
+ }
42245
43058
  WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures);
42246
43059
  }
42247
43060
  if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
@@ -42254,7 +43067,7 @@ var WebGLRenderer = class {
42254
43067
  p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix);
42255
43068
  p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix);
42256
43069
  p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld);
42257
- if (material.isShaderMaterial || material.isRawShaderMaterial) {
43070
+ if (material.uniformsGroups !== void 0) {
42258
43071
  const groups = material.uniformsGroups;
42259
43072
  for (let i = 0, l = groups.length; i < l; i++) {
42260
43073
  const group2 = groups[i];
@@ -42523,19 +43336,20 @@ var WebGLRenderer = class {
42523
43336
  textures.setTexture2D(dstTexture, 0);
42524
43337
  glTarget = _gl.TEXTURE_2D;
42525
43338
  }
42526
- _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
42527
- _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
42528
- _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
42529
- const currentUnpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);
42530
- const currentUnpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
42531
- const currentUnpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);
42532
- const currentUnpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);
42533
- const currentUnpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES);
42534
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
42535
- _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
42536
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
42537
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
42538
- _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
43339
+ state.activeTexture(_gl.TEXTURE0);
43340
+ state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
43341
+ state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
43342
+ state.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
43343
+ const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
43344
+ const currentUnpackImageHeight = state.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
43345
+ const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
43346
+ const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
43347
+ const currentUnpackSkipImages = state.getParameter(_gl.UNPACK_SKIP_IMAGES);
43348
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
43349
+ state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
43350
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
43351
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
43352
+ state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
42539
43353
  const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
42540
43354
  const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
42541
43355
  if (srcTexture.isDepthTexture) {
@@ -42599,11 +43413,11 @@ var WebGLRenderer = class {
42599
43413
  }
42600
43414
  }
42601
43415
  }
42602
- _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
42603
- _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
42604
- _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
42605
- _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
42606
- _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
43416
+ state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
43417
+ state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
43418
+ state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
43419
+ state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
43420
+ state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
42607
43421
  if (dstLevel === 0 && dstTexture.generateMipmaps) {
42608
43422
  _gl.generateMipmap(glTarget);
42609
43423
  }
@@ -42668,7 +43482,7 @@ var WebGLRenderer = class {
42668
43482
 
42669
43483
  // ../../../node_modules/three/examples/jsm/controls/OrbitControls.js
42670
43484
  init_console_gjs();
42671
- init_auto_globals_495e9d950c();
43485
+ init_auto_globals_53fe98c6e6();
42672
43486
  var _changeEvent = { type: "change" };
42673
43487
  var _startEvent = { type: "start" };
42674
43488
  var _endEvent = { type: "end" };
@@ -42810,7 +43624,7 @@ var OrbitControls = class extends Controls {
42810
43624
  this.stopListenToKeyEvents();
42811
43625
  const document3 = this.domElement.getRootNode();
42812
43626
  document3.removeEventListener("keydown", this._interceptControlDown, { capture: true });
42813
- this.domElement.style.touchAction = "auto";
43627
+ this.domElement.style.touchAction = "";
42814
43628
  }
42815
43629
  dispose() {
42816
43630
  this.disconnect();
@@ -43580,11 +44394,11 @@ function interceptControlUp(event) {
43580
44394
 
43581
44395
  // ../../../node_modules/three/examples/jsm/postprocessing/EffectComposer.js
43582
44396
  init_console_gjs();
43583
- init_auto_globals_495e9d950c();
44397
+ init_auto_globals_53fe98c6e6();
43584
44398
 
43585
44399
  // ../../../node_modules/three/examples/jsm/shaders/CopyShader.js
43586
44400
  init_console_gjs();
43587
- init_auto_globals_495e9d950c();
44401
+ init_auto_globals_53fe98c6e6();
43588
44402
  var CopyShader = {
43589
44403
  name: "CopyShader",
43590
44404
  uniforms: {
@@ -43626,11 +44440,11 @@ var CopyShader = {
43626
44440
 
43627
44441
  // ../../../node_modules/three/examples/jsm/postprocessing/ShaderPass.js
43628
44442
  init_console_gjs();
43629
- init_auto_globals_495e9d950c();
44443
+ init_auto_globals_53fe98c6e6();
43630
44444
 
43631
44445
  // ../../../node_modules/three/examples/jsm/postprocessing/Pass.js
43632
44446
  init_console_gjs();
43633
- init_auto_globals_495e9d950c();
44447
+ init_auto_globals_53fe98c6e6();
43634
44448
  var Pass = class {
43635
44449
  /**
43636
44450
  * Constructs a new pass.
@@ -43788,7 +44602,7 @@ var ShaderPass = class extends Pass {
43788
44602
 
43789
44603
  // ../../../node_modules/three/examples/jsm/postprocessing/MaskPass.js
43790
44604
  init_console_gjs();
43791
- init_auto_globals_495e9d950c();
44605
+ init_auto_globals_53fe98c6e6();
43792
44606
  var MaskPass = class extends Pass {
43793
44607
  /**
43794
44608
  * Constructs a new mask pass.
@@ -44063,7 +44877,7 @@ var EffectComposer = class {
44063
44877
 
44064
44878
  // ../../../node_modules/three/examples/jsm/postprocessing/RenderPixelatedPass.js
44065
44879
  init_console_gjs();
44066
- init_auto_globals_495e9d950c();
44880
+ init_auto_globals_53fe98c6e6();
44067
44881
  var RenderPixelatedPass = class extends Pass {
44068
44882
  /**
44069
44883
  * Constructs a new render pixelated pass.
@@ -44285,11 +45099,11 @@ var RenderPixelatedPass = class extends Pass {
44285
45099
 
44286
45100
  // ../../../node_modules/three/examples/jsm/postprocessing/OutputPass.js
44287
45101
  init_console_gjs();
44288
- init_auto_globals_495e9d950c();
45102
+ init_auto_globals_53fe98c6e6();
44289
45103
 
44290
45104
  // ../../../node_modules/three/examples/jsm/shaders/OutputShader.js
44291
45105
  init_console_gjs();
44292
- init_auto_globals_495e9d950c();
45106
+ init_auto_globals_53fe98c6e6();
44293
45107
  var OutputShader = {
44294
45108
  name: "OutputShader",
44295
45109
  uniforms: {
@@ -45898,7 +46712,7 @@ start.__type = [() => __\u03A9HTMLCanvasElement, "canvas", () => __\u03A9StartOp
45898
46712
 
45899
46713
  // blueprint:./pixel-window.blp
45900
46714
  init_console_gjs();
45901
- init_auto_globals_495e9d950c();
46715
+ init_auto_globals_53fe98c6e6();
45902
46716
  var pixel_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="PixelWindow" parent="AdwApplicationWindow">\n <property name="default-width">1100</property>\n <property name="default-height">700</property>\n <property name="title">Pixel Post-Processing</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">Post-Processing</property>\n <child>\n <object class="AdwSpinRow" id="pixelSizeRow">\n <property name="title">Pixel Size</property>\n </object>\n </child>\n <child>\n <object class="AdwSpinRow" id="normalEdgeRow">\n <property name="title">Normal Edge</property>\n </object>\n </child>\n <child>\n <object class="AdwSpinRow" id="depthEdgeRow">\n <property name="title">Depth Edge</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="pixelAlignRow">\n <property name="title">Pixel-Aligned Panning</property>\n <property name="active">true</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>';
45903
46717
 
45904
46718
  // src/gjs/pixel-window.ts