@gjsify/example-dom-three-postprocessing-pixel 0.1.15 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +404 -157
- package/dist/gjs.js +911 -1561
- package/package.json +12 -12
package/dist/gjs.js
CHANGED
|
@@ -10,10 +10,6 @@ var __esm = (fn, res) => function __init() {
|
|
|
10
10
|
var __commonJS = (cb, mod) => function __require() {
|
|
11
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
12
|
};
|
|
13
|
-
var __export = (target, all) => {
|
|
14
|
-
for (var name2 in all)
|
|
15
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
16
|
-
};
|
|
17
13
|
var __copyProps = (to, from, except, desc) => {
|
|
18
14
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
15
|
for (let key of __getOwnPropNames(from))
|
|
@@ -30,14 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
26
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
27
|
mod
|
|
32
28
|
));
|
|
33
|
-
var __toCommonJS = (mod) => {
|
|
34
|
-
var ns = __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
if (typeof ns.default !== "undefined") {
|
|
36
|
-
var keys = Object.keys(ns);
|
|
37
|
-
if (keys.length === 1 || (keys.length === 2 && keys.includes("__esModule"))) return ns.default;
|
|
38
|
-
}
|
|
39
|
-
return ns;
|
|
40
|
-
};
|
|
41
29
|
|
|
42
30
|
// ../../../packages/infra/esbuild-plugin-gjsify/dist/shims/console-gjs.js
|
|
43
31
|
function _formatArgs(...args) {
|
|
@@ -83,10 +71,10 @@ var init_console_gjs = __esm({
|
|
|
83
71
|
_groupIndentation;
|
|
84
72
|
_timers = /* @__PURE__ */ new Map();
|
|
85
73
|
_counters = /* @__PURE__ */ new Map();
|
|
86
|
-
constructor(stdoutOrOptions,
|
|
74
|
+
constructor(stdoutOrOptions, stderr) {
|
|
87
75
|
if (stdoutOrOptions && typeof stdoutOrOptions.write === "function") {
|
|
88
76
|
this._stdout = stdoutOrOptions;
|
|
89
|
-
this._stderr =
|
|
77
|
+
this._stderr = stderr || this._stdout;
|
|
90
78
|
} else if (stdoutOrOptions && typeof stdoutOrOptions === "object") {
|
|
91
79
|
const opts = stdoutOrOptions;
|
|
92
80
|
this._stdout = opts.stdout;
|
|
@@ -265,22 +253,10 @@ var init_console_gjs = __esm({
|
|
|
265
253
|
});
|
|
266
254
|
|
|
267
255
|
// ../../../packages/gjs/utils/lib/esm/callable.js
|
|
268
|
-
function makeCallable(Cls) {
|
|
269
|
-
return new Proxy(Cls, {
|
|
270
|
-
apply(target, thisArg, args) {
|
|
271
|
-
const tmp = Reflect.construct(target, args, target);
|
|
272
|
-
for (const key of Reflect.ownKeys(tmp)) {
|
|
273
|
-
const desc = Object.getOwnPropertyDescriptor(tmp, key);
|
|
274
|
-
if (desc) Object.defineProperty(thisArg, key, desc);
|
|
275
|
-
}
|
|
276
|
-
return thisArg;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
256
|
var init_callable = __esm({
|
|
281
257
|
"../../../packages/gjs/utils/lib/esm/callable.js"() {
|
|
282
258
|
init_console_gjs();
|
|
283
|
-
|
|
259
|
+
init_auto_globals_97a682e619();
|
|
284
260
|
}
|
|
285
261
|
});
|
|
286
262
|
|
|
@@ -322,7 +298,7 @@ var B64_CHARS, B64_LOOKUP;
|
|
|
322
298
|
var init_base64 = __esm({
|
|
323
299
|
"../../../packages/gjs/utils/lib/esm/base64.js"() {
|
|
324
300
|
init_console_gjs();
|
|
325
|
-
|
|
301
|
+
init_auto_globals_97a682e619();
|
|
326
302
|
B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
327
303
|
B64_LOOKUP = new Uint8Array(256);
|
|
328
304
|
for (let i = 0; i < B64_CHARS.length; i++) B64_LOOKUP[B64_CHARS.charCodeAt(i)] = i;
|
|
@@ -333,7 +309,7 @@ var init_base64 = __esm({
|
|
|
333
309
|
var init_byte_array = __esm({
|
|
334
310
|
"../../../packages/gjs/utils/lib/esm/byte-array.js"() {
|
|
335
311
|
init_console_gjs();
|
|
336
|
-
|
|
312
|
+
init_auto_globals_97a682e619();
|
|
337
313
|
}
|
|
338
314
|
});
|
|
339
315
|
|
|
@@ -343,7 +319,7 @@ var glib_2_0_default;
|
|
|
343
319
|
var init_glib_2_0 = __esm({
|
|
344
320
|
"../../../node_modules/@girs/glib-2.0/glib-2.0.js"() {
|
|
345
321
|
init_console_gjs();
|
|
346
|
-
|
|
322
|
+
init_auto_globals_97a682e619();
|
|
347
323
|
glib_2_0_default = GLib;
|
|
348
324
|
}
|
|
349
325
|
});
|
|
@@ -353,7 +329,7 @@ var glib_2_default;
|
|
|
353
329
|
var init_glib_2 = __esm({
|
|
354
330
|
"../../../node_modules/@girs/glib-2.0/index.js"() {
|
|
355
331
|
init_console_gjs();
|
|
356
|
-
|
|
332
|
+
init_auto_globals_97a682e619();
|
|
357
333
|
init_glib_2_0();
|
|
358
334
|
glib_2_default = glib_2_0_default;
|
|
359
335
|
}
|
|
@@ -364,7 +340,7 @@ var byteArray;
|
|
|
364
340
|
var init_cli = __esm({
|
|
365
341
|
"../../../packages/gjs/utils/lib/esm/cli.js"() {
|
|
366
342
|
init_console_gjs();
|
|
367
|
-
|
|
343
|
+
init_auto_globals_97a682e619();
|
|
368
344
|
init_glib_2();
|
|
369
345
|
byteArray = imports.byteArray;
|
|
370
346
|
}
|
|
@@ -374,7 +350,7 @@ var init_cli = __esm({
|
|
|
374
350
|
var init_defer = __esm({
|
|
375
351
|
"../../../packages/gjs/utils/lib/esm/defer.js"() {
|
|
376
352
|
init_console_gjs();
|
|
377
|
-
|
|
353
|
+
init_auto_globals_97a682e619();
|
|
378
354
|
}
|
|
379
355
|
});
|
|
380
356
|
|
|
@@ -413,7 +389,7 @@ var VALID_ENCODINGS;
|
|
|
413
389
|
var init_encoding = __esm({
|
|
414
390
|
"../../../packages/gjs/utils/lib/esm/encoding.js"() {
|
|
415
391
|
init_console_gjs();
|
|
416
|
-
|
|
392
|
+
init_auto_globals_97a682e619();
|
|
417
393
|
VALID_ENCODINGS = ["utf8", "ascii", "latin1", "binary", "base64", "base64url", "hex", "ucs2", "utf16le"];
|
|
418
394
|
}
|
|
419
395
|
});
|
|
@@ -427,34 +403,15 @@ function registerGlobal(name2, value2) {
|
|
|
427
403
|
var init_globals = __esm({
|
|
428
404
|
"../../../packages/gjs/utils/lib/esm/globals.js"() {
|
|
429
405
|
init_console_gjs();
|
|
430
|
-
|
|
406
|
+
init_auto_globals_97a682e619();
|
|
431
407
|
}
|
|
432
408
|
});
|
|
433
409
|
|
|
434
410
|
// ../../../packages/gjs/utils/lib/esm/error.js
|
|
435
|
-
var initErrorV8Methods;
|
|
436
411
|
var init_error = __esm({
|
|
437
412
|
"../../../packages/gjs/utils/lib/esm/error.js"() {
|
|
438
413
|
init_console_gjs();
|
|
439
|
-
|
|
440
|
-
initErrorV8Methods = (ErrorConstructor) => {
|
|
441
|
-
if (!Error.captureStackTrace) {
|
|
442
|
-
Error.captureStackTrace = function(targetObject, constructorOpt) {
|
|
443
|
-
const container = new Error();
|
|
444
|
-
const target = constructorOpt || targetObject;
|
|
445
|
-
Object.defineProperty(target, "stack", {
|
|
446
|
-
configurable: true,
|
|
447
|
-
get: function getStack() {
|
|
448
|
-
var stack = container.stack;
|
|
449
|
-
Object.defineProperty(this, "stack", {
|
|
450
|
-
value: stack
|
|
451
|
-
});
|
|
452
|
-
return stack;
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
};
|
|
414
|
+
init_auto_globals_97a682e619();
|
|
458
415
|
}
|
|
459
416
|
});
|
|
460
417
|
|
|
@@ -463,7 +420,7 @@ var byteArray2;
|
|
|
463
420
|
var init_file = __esm({
|
|
464
421
|
"../../../packages/gjs/utils/lib/esm/file.js"() {
|
|
465
422
|
init_console_gjs();
|
|
466
|
-
|
|
423
|
+
init_auto_globals_97a682e619();
|
|
467
424
|
init_glib_2();
|
|
468
425
|
byteArray2 = imports.byteArray;
|
|
469
426
|
}
|
|
@@ -475,7 +432,7 @@ var gio_2_0_default;
|
|
|
475
432
|
var init_gio_2_0 = __esm({
|
|
476
433
|
"../../../node_modules/@girs/gio-2.0/gio-2.0.js"() {
|
|
477
434
|
init_console_gjs();
|
|
478
|
-
|
|
435
|
+
init_auto_globals_97a682e619();
|
|
479
436
|
gio_2_0_default = Gio;
|
|
480
437
|
}
|
|
481
438
|
});
|
|
@@ -485,7 +442,7 @@ var gio_2_default;
|
|
|
485
442
|
var init_gio_2 = __esm({
|
|
486
443
|
"../../../node_modules/@girs/gio-2.0/index.js"() {
|
|
487
444
|
init_console_gjs();
|
|
488
|
-
|
|
445
|
+
init_auto_globals_97a682e619();
|
|
489
446
|
init_gio_2_0();
|
|
490
447
|
gio_2_default = gio_2_0_default;
|
|
491
448
|
}
|
|
@@ -496,7 +453,7 @@ import GioUnix from "gi://GioUnix?version=2.0";
|
|
|
496
453
|
var init_giounix_2_0 = __esm({
|
|
497
454
|
"../../../node_modules/@girs/giounix-2.0/giounix-2.0.js"() {
|
|
498
455
|
init_console_gjs();
|
|
499
|
-
|
|
456
|
+
init_auto_globals_97a682e619();
|
|
500
457
|
}
|
|
501
458
|
});
|
|
502
459
|
|
|
@@ -504,7 +461,7 @@ var init_giounix_2_0 = __esm({
|
|
|
504
461
|
var init_giounix_2 = __esm({
|
|
505
462
|
"../../../node_modules/@girs/giounix-2.0/index.js"() {
|
|
506
463
|
init_console_gjs();
|
|
507
|
-
|
|
464
|
+
init_auto_globals_97a682e619();
|
|
508
465
|
init_giounix_2_0();
|
|
509
466
|
}
|
|
510
467
|
});
|
|
@@ -513,7 +470,7 @@ var init_giounix_2 = __esm({
|
|
|
513
470
|
var init_fs = __esm({
|
|
514
471
|
"../../../packages/gjs/utils/lib/esm/fs.js"() {
|
|
515
472
|
init_console_gjs();
|
|
516
|
-
|
|
473
|
+
init_auto_globals_97a682e619();
|
|
517
474
|
init_gio_2();
|
|
518
475
|
init_giounix_2();
|
|
519
476
|
}
|
|
@@ -524,7 +481,7 @@ var byteArray3;
|
|
|
524
481
|
var init_gio = __esm({
|
|
525
482
|
"../../../packages/gjs/utils/lib/esm/gio.js"() {
|
|
526
483
|
init_console_gjs();
|
|
527
|
-
|
|
484
|
+
init_auto_globals_97a682e619();
|
|
528
485
|
init_glib_2();
|
|
529
486
|
byteArray3 = imports.byteArray;
|
|
530
487
|
}
|
|
@@ -534,7 +491,7 @@ var init_gio = __esm({
|
|
|
534
491
|
var init_gio_errors = __esm({
|
|
535
492
|
"../../../packages/gjs/utils/lib/esm/gio-errors.js"() {
|
|
536
493
|
init_console_gjs();
|
|
537
|
-
|
|
494
|
+
init_auto_globals_97a682e619();
|
|
538
495
|
}
|
|
539
496
|
});
|
|
540
497
|
|
|
@@ -543,7 +500,7 @@ var warnNotImplemented;
|
|
|
543
500
|
var init_message = __esm({
|
|
544
501
|
"../../../packages/gjs/utils/lib/esm/message.js"() {
|
|
545
502
|
init_console_gjs();
|
|
546
|
-
|
|
503
|
+
init_auto_globals_97a682e619();
|
|
547
504
|
warnNotImplemented = (msg) => {
|
|
548
505
|
const message = msg ? `Not implemented: ${msg}` : "Not implemented";
|
|
549
506
|
console.warn(message);
|
|
@@ -552,15 +509,19 @@ var init_message = __esm({
|
|
|
552
509
|
}
|
|
553
510
|
});
|
|
554
511
|
|
|
512
|
+
// ../../../packages/gjs/utils/lib/esm/microtask.js
|
|
513
|
+
var init_microtask = __esm({
|
|
514
|
+
"../../../packages/gjs/utils/lib/esm/microtask.js"() {
|
|
515
|
+
init_console_gjs();
|
|
516
|
+
init_auto_globals_97a682e619();
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
|
|
555
520
|
// ../../../packages/gjs/utils/lib/esm/next-tick.js
|
|
556
|
-
var nextTick;
|
|
557
521
|
var init_next_tick = __esm({
|
|
558
522
|
"../../../packages/gjs/utils/lib/esm/next-tick.js"() {
|
|
559
523
|
init_console_gjs();
|
|
560
|
-
|
|
561
|
-
nextTick = typeof globalThis.process?.nextTick === "function" ? globalThis.process.nextTick : typeof globalThis.queueMicrotask === "function" ? (fn, ...args) => queueMicrotask(() => fn(...args)) : (fn, ...args) => {
|
|
562
|
-
Promise.resolve().then(() => fn(...args));
|
|
563
|
-
};
|
|
524
|
+
init_auto_globals_97a682e619();
|
|
564
525
|
}
|
|
565
526
|
});
|
|
566
527
|
|
|
@@ -569,7 +530,7 @@ var File;
|
|
|
569
530
|
var init_path = __esm({
|
|
570
531
|
"../../../packages/gjs/utils/lib/esm/path.js"() {
|
|
571
532
|
init_console_gjs();
|
|
572
|
-
|
|
533
|
+
init_auto_globals_97a682e619();
|
|
573
534
|
init_gio_2();
|
|
574
535
|
init_glib_2();
|
|
575
536
|
({ File } = gio_2_default);
|
|
@@ -581,7 +542,7 @@ var toString;
|
|
|
581
542
|
var init_structured_clone = __esm({
|
|
582
543
|
"../../../packages/gjs/utils/lib/esm/structured-clone.js"() {
|
|
583
544
|
init_console_gjs();
|
|
584
|
-
|
|
545
|
+
init_auto_globals_97a682e619();
|
|
585
546
|
({ toString } = Object.prototype);
|
|
586
547
|
}
|
|
587
548
|
});
|
|
@@ -590,7 +551,7 @@ var init_structured_clone = __esm({
|
|
|
590
551
|
var init_main_loop = __esm({
|
|
591
552
|
"../../../packages/gjs/utils/lib/esm/main-loop.js"() {
|
|
592
553
|
init_console_gjs();
|
|
593
|
-
|
|
554
|
+
init_auto_globals_97a682e619();
|
|
594
555
|
}
|
|
595
556
|
});
|
|
596
557
|
|
|
@@ -598,7 +559,7 @@ var init_main_loop = __esm({
|
|
|
598
559
|
var init_esm = __esm({
|
|
599
560
|
"../../../packages/gjs/utils/lib/esm/index.js"() {
|
|
600
561
|
init_console_gjs();
|
|
601
|
-
|
|
562
|
+
init_auto_globals_97a682e619();
|
|
602
563
|
init_callable();
|
|
603
564
|
init_base64();
|
|
604
565
|
init_byte_array();
|
|
@@ -612,6 +573,7 @@ var init_esm = __esm({
|
|
|
612
573
|
init_gio();
|
|
613
574
|
init_gio_errors();
|
|
614
575
|
init_message();
|
|
576
|
+
init_microtask();
|
|
615
577
|
init_next_tick();
|
|
616
578
|
init_path();
|
|
617
579
|
init_structured_clone();
|
|
@@ -624,7 +586,7 @@ var _encoder, BlobPolyfill, FilePolyfill, Blob2, File2;
|
|
|
624
586
|
var init_blob = __esm({
|
|
625
587
|
"../../../packages/node/buffer/lib/esm/blob.js"() {
|
|
626
588
|
init_console_gjs();
|
|
627
|
-
|
|
589
|
+
init_auto_globals_97a682e619();
|
|
628
590
|
_encoder = new TextEncoder();
|
|
629
591
|
BlobPolyfill = class _BlobPolyfill {
|
|
630
592
|
_parts;
|
|
@@ -694,7 +656,7 @@ var init_blob = __esm({
|
|
|
694
656
|
var init_register = __esm({
|
|
695
657
|
"../../../packages/node/buffer/lib/esm/register.js"() {
|
|
696
658
|
init_console_gjs();
|
|
697
|
-
|
|
659
|
+
init_auto_globals_97a682e619();
|
|
698
660
|
init_esm();
|
|
699
661
|
init_blob();
|
|
700
662
|
registerGlobal("Blob", Blob2);
|
|
@@ -796,7 +758,7 @@ var NAMED_COLORS, BLACK;
|
|
|
796
758
|
var init_color = __esm({
|
|
797
759
|
"../../../packages/dom/canvas2d-core/lib/esm/color.js"() {
|
|
798
760
|
init_console_gjs();
|
|
799
|
-
|
|
761
|
+
init_auto_globals_97a682e619();
|
|
800
762
|
NAMED_COLORS = {
|
|
801
763
|
aliceblue: "#f0f8ff",
|
|
802
764
|
antiquewhite: "#faebd7",
|
|
@@ -1055,7 +1017,7 @@ var COMPOSITE_OP_MAP, LINE_CAP_MAP, LINE_JOIN_MAP;
|
|
|
1055
1017
|
var init_cairo_utils = __esm({
|
|
1056
1018
|
"../../../packages/dom/canvas2d-core/lib/esm/cairo-utils.js"() {
|
|
1057
1019
|
init_console_gjs();
|
|
1058
|
-
|
|
1020
|
+
init_auto_globals_97a682e619();
|
|
1059
1021
|
COMPOSITE_OP_MAP = {
|
|
1060
1022
|
"source-over": 2,
|
|
1061
1023
|
// OVER
|
|
@@ -1161,7 +1123,7 @@ function cloneState(state) {
|
|
|
1161
1123
|
var init_canvas_state = __esm({
|
|
1162
1124
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-state.js"() {
|
|
1163
1125
|
init_console_gjs();
|
|
1164
|
-
|
|
1126
|
+
init_auto_globals_97a682e619();
|
|
1165
1127
|
init_color();
|
|
1166
1128
|
}
|
|
1167
1129
|
});
|
|
@@ -1171,7 +1133,7 @@ var OurImageData;
|
|
|
1171
1133
|
var init_image_data = __esm({
|
|
1172
1134
|
"../../../packages/dom/canvas2d-core/lib/esm/image-data.js"() {
|
|
1173
1135
|
init_console_gjs();
|
|
1174
|
-
|
|
1136
|
+
init_auto_globals_97a682e619();
|
|
1175
1137
|
OurImageData = class {
|
|
1176
1138
|
constructor(swOrData, sh, maybeHeight) {
|
|
1177
1139
|
this.colorSpace = "srgb";
|
|
@@ -1200,7 +1162,7 @@ var CanvasGradient;
|
|
|
1200
1162
|
var init_canvas_gradient = __esm({
|
|
1201
1163
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-gradient.js"() {
|
|
1202
1164
|
init_console_gjs();
|
|
1203
|
-
|
|
1165
|
+
init_auto_globals_97a682e619();
|
|
1204
1166
|
init_color();
|
|
1205
1167
|
CanvasGradient = class {
|
|
1206
1168
|
constructor(type, x0, y0, x1, y1, r0, r1) {
|
|
@@ -1230,7 +1192,7 @@ var CanvasPattern;
|
|
|
1230
1192
|
var init_canvas_pattern = __esm({
|
|
1231
1193
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-pattern.js"() {
|
|
1232
1194
|
init_console_gjs();
|
|
1233
|
-
|
|
1195
|
+
init_auto_globals_97a682e619();
|
|
1234
1196
|
CanvasPattern = class _CanvasPattern {
|
|
1235
1197
|
constructor(surface, repetition) {
|
|
1236
1198
|
this._pattern = new Cairo2.SurfacePattern(surface);
|
|
@@ -1292,7 +1254,7 @@ var Path2D;
|
|
|
1292
1254
|
var init_canvas_path = __esm({
|
|
1293
1255
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-path.js"() {
|
|
1294
1256
|
init_console_gjs();
|
|
1295
|
-
|
|
1257
|
+
init_auto_globals_97a682e619();
|
|
1296
1258
|
init_cairo_utils();
|
|
1297
1259
|
Path2D = class _Path2D {
|
|
1298
1260
|
constructor(pathOrSvg) {
|
|
@@ -1406,7 +1368,7 @@ var CanvasRenderingContext2D;
|
|
|
1406
1368
|
var init_canvas_rendering_context_2d = __esm({
|
|
1407
1369
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-rendering-context-2d.js"() {
|
|
1408
1370
|
init_console_gjs();
|
|
1409
|
-
|
|
1371
|
+
init_auto_globals_97a682e619();
|
|
1410
1372
|
init_color();
|
|
1411
1373
|
init_cairo_utils();
|
|
1412
1374
|
init_canvas_state();
|
|
@@ -2393,7 +2355,7 @@ var init_canvas_rendering_context_2d = __esm({
|
|
|
2393
2355
|
var init_esm2 = __esm({
|
|
2394
2356
|
"../../../packages/dom/canvas2d-core/lib/esm/index.js"() {
|
|
2395
2357
|
init_console_gjs();
|
|
2396
|
-
|
|
2358
|
+
init_auto_globals_97a682e619();
|
|
2397
2359
|
init_canvas_rendering_context_2d();
|
|
2398
2360
|
init_canvas_gradient();
|
|
2399
2361
|
init_canvas_pattern();
|
|
@@ -2408,7 +2370,7 @@ var DOMExceptionCodes, _DOMExceptionPolyfill, DOMException2;
|
|
|
2408
2370
|
var init_esm3 = __esm({
|
|
2409
2371
|
"../../../packages/web/dom-exception/lib/esm/index.js"() {
|
|
2410
2372
|
init_console_gjs();
|
|
2411
|
-
|
|
2373
|
+
init_auto_globals_97a682e619();
|
|
2412
2374
|
DOMExceptionCodes = {
|
|
2413
2375
|
IndexSizeError: 1,
|
|
2414
2376
|
HierarchyRequestError: 3,
|
|
@@ -2450,7 +2412,7 @@ var kType, kBubbles, kCancelable, kComposed, kTarget, kCurrentTarget, kEventPhas
|
|
|
2450
2412
|
var init_esm4 = __esm({
|
|
2451
2413
|
"../../../packages/web/dom-events/lib/esm/index.js"() {
|
|
2452
2414
|
init_console_gjs();
|
|
2453
|
-
|
|
2415
|
+
init_auto_globals_97a682e619();
|
|
2454
2416
|
init_esm3();
|
|
2455
2417
|
kType = /* @__PURE__ */ Symbol("type");
|
|
2456
2418
|
kBubbles = /* @__PURE__ */ Symbol("bubbles");
|
|
@@ -2642,7 +2604,7 @@ var init_esm4 = __esm({
|
|
|
2642
2604
|
addEventListener(type, callback, options) {
|
|
2643
2605
|
if (callback === null) return;
|
|
2644
2606
|
const capture = typeof options === "boolean" ? options : options?.capture ?? false;
|
|
2645
|
-
const
|
|
2607
|
+
const once = typeof options === "object" ? options?.once ?? false : false;
|
|
2646
2608
|
const passive = typeof options === "object" ? options?.passive ?? false : false;
|
|
2647
2609
|
let list = this._listeners.get(type);
|
|
2648
2610
|
if (!list) {
|
|
@@ -2652,7 +2614,7 @@ var init_esm4 = __esm({
|
|
|
2652
2614
|
for (const entry2 of list) {
|
|
2653
2615
|
if (entry2.listener === callback && entry2.capture === capture) return;
|
|
2654
2616
|
}
|
|
2655
|
-
const entry = { listener: callback, capture, once
|
|
2617
|
+
const entry = { listener: callback, capture, once, passive, removed: false };
|
|
2656
2618
|
list.push(entry);
|
|
2657
2619
|
if (typeof options === "object" && options?.signal) {
|
|
2658
2620
|
options.signal.addEventListener("abort", () => {
|
|
@@ -2914,7 +2876,7 @@ var NodeType;
|
|
|
2914
2876
|
var init_node_type = __esm({
|
|
2915
2877
|
"../../../packages/dom/dom-elements/lib/esm/node-type.js"() {
|
|
2916
2878
|
init_console_gjs();
|
|
2917
|
-
|
|
2879
|
+
init_auto_globals_97a682e619();
|
|
2918
2880
|
NodeType = {
|
|
2919
2881
|
ELEMENT_NODE: 1,
|
|
2920
2882
|
ATTRIBUTE_NODE: 2,
|
|
@@ -2934,7 +2896,7 @@ var NodeList;
|
|
|
2934
2896
|
var init_node_list = __esm({
|
|
2935
2897
|
"../../../packages/dom/dom-elements/lib/esm/node-list.js"() {
|
|
2936
2898
|
init_console_gjs();
|
|
2937
|
-
|
|
2899
|
+
init_auto_globals_97a682e619();
|
|
2938
2900
|
NodeList = class {
|
|
2939
2901
|
constructor(items) {
|
|
2940
2902
|
this._items = items;
|
|
@@ -2974,7 +2936,7 @@ var nodeType, parentNode, childNodesList, elementChildren, isConnected, tagName,
|
|
|
2974
2936
|
var init_property_symbol = __esm({
|
|
2975
2937
|
"../../../packages/dom/dom-elements/lib/esm/property-symbol.js"() {
|
|
2976
2938
|
init_console_gjs();
|
|
2977
|
-
|
|
2939
|
+
init_auto_globals_97a682e619();
|
|
2978
2940
|
nodeType = /* @__PURE__ */ Symbol("nodeType");
|
|
2979
2941
|
parentNode = /* @__PURE__ */ Symbol("parentNode");
|
|
2980
2942
|
childNodesList = /* @__PURE__ */ Symbol("childNodesList");
|
|
@@ -2997,7 +2959,7 @@ var _a, _b, _c, _d, _e, Node;
|
|
|
2997
2959
|
var init_node = __esm({
|
|
2998
2960
|
"../../../packages/dom/dom-elements/lib/esm/node.js"() {
|
|
2999
2961
|
init_console_gjs();
|
|
3000
|
-
|
|
2962
|
+
init_auto_globals_97a682e619();
|
|
3001
2963
|
init_esm4();
|
|
3002
2964
|
init_node_type();
|
|
3003
2965
|
init_node_list();
|
|
@@ -3247,7 +3209,7 @@ var Attr;
|
|
|
3247
3209
|
var init_attr = __esm({
|
|
3248
3210
|
"../../../packages/dom/dom-elements/lib/esm/attr.js"() {
|
|
3249
3211
|
init_console_gjs();
|
|
3250
|
-
|
|
3212
|
+
init_auto_globals_97a682e619();
|
|
3251
3213
|
init_property_symbol();
|
|
3252
3214
|
Attr = class {
|
|
3253
3215
|
constructor(name2, value2, namespaceURI2 = null, prefix2 = null, ownerElement2 = null) {
|
|
@@ -3284,7 +3246,7 @@ var NamespaceURI;
|
|
|
3284
3246
|
var init_namespace_uri = __esm({
|
|
3285
3247
|
"../../../packages/dom/dom-elements/lib/esm/namespace-uri.js"() {
|
|
3286
3248
|
init_console_gjs();
|
|
3287
|
-
|
|
3249
|
+
init_auto_globals_97a682e619();
|
|
3288
3250
|
NamespaceURI = {
|
|
3289
3251
|
html: "http://www.w3.org/1999/xhtml",
|
|
3290
3252
|
svg: "http://www.w3.org/2000/svg",
|
|
@@ -3300,7 +3262,7 @@ var NamedNodeMap;
|
|
|
3300
3262
|
var init_named_node_map = __esm({
|
|
3301
3263
|
"../../../packages/dom/dom-elements/lib/esm/named-node-map.js"() {
|
|
3302
3264
|
init_console_gjs();
|
|
3303
|
-
|
|
3265
|
+
init_auto_globals_97a682e619();
|
|
3304
3266
|
init_attr();
|
|
3305
3267
|
init_namespace_uri();
|
|
3306
3268
|
NamedNodeMap = class {
|
|
@@ -3430,7 +3392,7 @@ var _a2, _b2, _c2, _d2, _e2, _f, Element;
|
|
|
3430
3392
|
var init_element = __esm({
|
|
3431
3393
|
"../../../packages/dom/dom-elements/lib/esm/element.js"() {
|
|
3432
3394
|
init_console_gjs();
|
|
3433
|
-
|
|
3395
|
+
init_auto_globals_97a682e619();
|
|
3434
3396
|
init_node();
|
|
3435
3397
|
init_node_type();
|
|
3436
3398
|
init_named_node_map();
|
|
@@ -3682,7 +3644,7 @@ var CSSStyleDeclaration, HTMLElement;
|
|
|
3682
3644
|
var init_html_element = __esm({
|
|
3683
3645
|
"../../../packages/dom/dom-elements/lib/esm/html-element.js"() {
|
|
3684
3646
|
init_console_gjs();
|
|
3685
|
-
|
|
3647
|
+
init_auto_globals_97a682e619();
|
|
3686
3648
|
init_esm4();
|
|
3687
3649
|
init_element();
|
|
3688
3650
|
init_property_symbol();
|
|
@@ -4112,7 +4074,7 @@ var HTMLCanvasElement2;
|
|
|
4112
4074
|
var init_html_canvas_element = __esm({
|
|
4113
4075
|
"../../../packages/dom/dom-elements/lib/esm/html-canvas-element.js"() {
|
|
4114
4076
|
init_console_gjs();
|
|
4115
|
-
|
|
4077
|
+
init_auto_globals_97a682e619();
|
|
4116
4078
|
init_html_element();
|
|
4117
4079
|
HTMLCanvasElement2 = class _HTMLCanvasElement extends HTMLElement {
|
|
4118
4080
|
constructor() {
|
|
@@ -4192,7 +4154,7 @@ var DOMMatrix, DOMMatrixReadOnly;
|
|
|
4192
4154
|
var init_dom_matrix = __esm({
|
|
4193
4155
|
"../../../packages/dom/dom-elements/lib/esm/dom-matrix.js"() {
|
|
4194
4156
|
init_console_gjs();
|
|
4195
|
-
|
|
4157
|
+
init_auto_globals_97a682e619();
|
|
4196
4158
|
DOMMatrix = class _DOMMatrix {
|
|
4197
4159
|
constructor(init) {
|
|
4198
4160
|
this.a = 1;
|
|
@@ -4330,7 +4292,7 @@ function defineGlobalIfMissing(name2, value2) {
|
|
|
4330
4292
|
var init_helpers = __esm({
|
|
4331
4293
|
"../../../packages/dom/dom-elements/lib/esm/register/helpers.js"() {
|
|
4332
4294
|
init_console_gjs();
|
|
4333
|
-
|
|
4295
|
+
init_auto_globals_97a682e619();
|
|
4334
4296
|
}
|
|
4335
4297
|
});
|
|
4336
4298
|
|
|
@@ -4339,7 +4301,7 @@ var CANVAS2D_KEY;
|
|
|
4339
4301
|
var init_canvas = __esm({
|
|
4340
4302
|
"../../../packages/dom/dom-elements/lib/esm/register/canvas.js"() {
|
|
4341
4303
|
init_console_gjs();
|
|
4342
|
-
|
|
4304
|
+
init_auto_globals_97a682e619();
|
|
4343
4305
|
init_esm2();
|
|
4344
4306
|
init_html_canvas_element();
|
|
4345
4307
|
init_dom_matrix();
|
|
@@ -4364,7 +4326,7 @@ var CharacterData;
|
|
|
4364
4326
|
var init_character_data = __esm({
|
|
4365
4327
|
"../../../packages/dom/dom-elements/lib/esm/character-data.js"() {
|
|
4366
4328
|
init_console_gjs();
|
|
4367
|
-
|
|
4329
|
+
init_auto_globals_97a682e619();
|
|
4368
4330
|
init_node();
|
|
4369
4331
|
init_node_type();
|
|
4370
4332
|
init_property_symbol();
|
|
@@ -4426,7 +4388,7 @@ var Comment;
|
|
|
4426
4388
|
var init_comment = __esm({
|
|
4427
4389
|
"../../../packages/dom/dom-elements/lib/esm/comment.js"() {
|
|
4428
4390
|
init_console_gjs();
|
|
4429
|
-
|
|
4391
|
+
init_auto_globals_97a682e619();
|
|
4430
4392
|
init_character_data();
|
|
4431
4393
|
init_node_type();
|
|
4432
4394
|
init_property_symbol();
|
|
@@ -4454,7 +4416,7 @@ var gdkpixbuf_2_0_default;
|
|
|
4454
4416
|
var init_gdkpixbuf_2_0 = __esm({
|
|
4455
4417
|
"../../../node_modules/@girs/gdkpixbuf-2.0/gdkpixbuf-2.0.js"() {
|
|
4456
4418
|
init_console_gjs();
|
|
4457
|
-
|
|
4419
|
+
init_auto_globals_97a682e619();
|
|
4458
4420
|
gdkpixbuf_2_0_default = GdkPixbuf2;
|
|
4459
4421
|
}
|
|
4460
4422
|
});
|
|
@@ -4464,7 +4426,7 @@ var gdkpixbuf_2_default;
|
|
|
4464
4426
|
var init_gdkpixbuf_2 = __esm({
|
|
4465
4427
|
"../../../node_modules/@girs/gdkpixbuf-2.0/index.js"() {
|
|
4466
4428
|
init_console_gjs();
|
|
4467
|
-
|
|
4429
|
+
init_auto_globals_97a682e619();
|
|
4468
4430
|
init_gdkpixbuf_2_0();
|
|
4469
4431
|
gdkpixbuf_2_default = gdkpixbuf_2_0_default;
|
|
4470
4432
|
}
|
|
@@ -4476,7 +4438,7 @@ var HTMLImageElement2;
|
|
|
4476
4438
|
var init_html_image_element = __esm({
|
|
4477
4439
|
"../../../packages/dom/dom-elements/lib/esm/html-image-element.js"() {
|
|
4478
4440
|
init_console_gjs();
|
|
4479
|
-
|
|
4441
|
+
init_auto_globals_97a682e619();
|
|
4480
4442
|
init_glib_2();
|
|
4481
4443
|
init_gio_2();
|
|
4482
4444
|
init_gdkpixbuf_2();
|
|
@@ -4711,7 +4673,7 @@ var HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUG
|
|
|
4711
4673
|
var init_html_media_element = __esm({
|
|
4712
4674
|
"../../../packages/dom/dom-elements/lib/esm/html-media-element.js"() {
|
|
4713
4675
|
init_console_gjs();
|
|
4714
|
-
|
|
4676
|
+
init_auto_globals_97a682e619();
|
|
4715
4677
|
init_esm4();
|
|
4716
4678
|
init_html_element();
|
|
4717
4679
|
HAVE_NOTHING = 0;
|
|
@@ -4824,33 +4786,129 @@ var init_html_media_element = __esm({
|
|
|
4824
4786
|
}
|
|
4825
4787
|
});
|
|
4826
4788
|
|
|
4789
|
+
// ../../../packages/dom/dom-elements/lib/esm/gst-time.js
|
|
4790
|
+
function secondsToGstTime(seconds) {
|
|
4791
|
+
return BigInt(Math.round(seconds * NS_PER_SECOND));
|
|
4792
|
+
}
|
|
4793
|
+
function gstTimeToSeconds(nanoseconds) {
|
|
4794
|
+
return Number(nanoseconds) / NS_PER_SECOND;
|
|
4795
|
+
}
|
|
4796
|
+
var NS_PER_SECOND;
|
|
4797
|
+
var init_gst_time = __esm({
|
|
4798
|
+
"../../../packages/dom/dom-elements/lib/esm/gst-time.js"() {
|
|
4799
|
+
init_console_gjs();
|
|
4800
|
+
init_auto_globals_97a682e619();
|
|
4801
|
+
NS_PER_SECOND = 1e9;
|
|
4802
|
+
}
|
|
4803
|
+
});
|
|
4804
|
+
|
|
4827
4805
|
// ../../../packages/dom/dom-elements/lib/esm/html-video-element.js
|
|
4828
|
-
var HTMLVideoElement2;
|
|
4806
|
+
var GST_STATE_PLAYING, GST_STATE_PAUSED, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_TYPE_SET, GST_SEEK_TYPE_NONE, HTMLVideoElement2;
|
|
4829
4807
|
var init_html_video_element = __esm({
|
|
4830
4808
|
"../../../packages/dom/dom-elements/lib/esm/html-video-element.js"() {
|
|
4831
4809
|
init_console_gjs();
|
|
4832
|
-
|
|
4810
|
+
init_auto_globals_97a682e619();
|
|
4833
4811
|
init_html_media_element();
|
|
4812
|
+
init_esm4();
|
|
4834
4813
|
init_property_symbol();
|
|
4835
4814
|
init_namespace_uri();
|
|
4815
|
+
init_gst_time();
|
|
4816
|
+
GST_STATE_PLAYING = 4;
|
|
4817
|
+
GST_STATE_PAUSED = 3;
|
|
4818
|
+
GST_FORMAT_TIME = 3;
|
|
4819
|
+
GST_SEEK_FLAG_FLUSH = 1;
|
|
4820
|
+
GST_SEEK_FLAG_KEY_UNIT = 4;
|
|
4821
|
+
GST_SEEK_TYPE_SET = 1;
|
|
4822
|
+
GST_SEEK_TYPE_NONE = 0;
|
|
4836
4823
|
HTMLVideoElement2 = class extends HTMLMediaElement {
|
|
4837
4824
|
constructor() {
|
|
4838
4825
|
super();
|
|
4826
|
+
this._pipeline = null;
|
|
4839
4827
|
this._videoWidth = 0;
|
|
4840
4828
|
this._videoHeight = 0;
|
|
4841
4829
|
this.poster = "";
|
|
4842
4830
|
this[tagName] = "VIDEO";
|
|
4843
4831
|
this[localName] = "video";
|
|
4844
4832
|
this[namespaceURI] = NamespaceURI.html;
|
|
4833
|
+
const self2 = this;
|
|
4834
|
+
Object.defineProperty(this, "paused", {
|
|
4835
|
+
get() {
|
|
4836
|
+
if (!self2._pipeline) return true;
|
|
4837
|
+
const [, state] = self2._pipeline.get_state(0n);
|
|
4838
|
+
return state !== GST_STATE_PLAYING;
|
|
4839
|
+
},
|
|
4840
|
+
configurable: true,
|
|
4841
|
+
enumerable: true
|
|
4842
|
+
});
|
|
4843
|
+
Object.defineProperty(this, "currentTime", {
|
|
4844
|
+
get() {
|
|
4845
|
+
if (!self2._pipeline) return 0;
|
|
4846
|
+
const [ok, pos] = self2._pipeline.query_position(GST_FORMAT_TIME);
|
|
4847
|
+
return ok ? gstTimeToSeconds(pos) : 0;
|
|
4848
|
+
},
|
|
4849
|
+
set(seconds) {
|
|
4850
|
+
self2._pipeline?.seek(
|
|
4851
|
+
1,
|
|
4852
|
+
GST_FORMAT_TIME,
|
|
4853
|
+
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
|
|
4854
|
+
GST_SEEK_TYPE_SET,
|
|
4855
|
+
secondsToGstTime(seconds),
|
|
4856
|
+
GST_SEEK_TYPE_NONE,
|
|
4857
|
+
-1n
|
|
4858
|
+
);
|
|
4859
|
+
},
|
|
4860
|
+
configurable: true,
|
|
4861
|
+
enumerable: true
|
|
4862
|
+
});
|
|
4863
|
+
Object.defineProperty(this, "duration", {
|
|
4864
|
+
get() {
|
|
4865
|
+
if (!self2._pipeline) return NaN;
|
|
4866
|
+
const [ok, dur] = self2._pipeline.query_duration(GST_FORMAT_TIME);
|
|
4867
|
+
return ok && Number(dur) > 0 ? gstTimeToSeconds(dur) : NaN;
|
|
4868
|
+
},
|
|
4869
|
+
configurable: true,
|
|
4870
|
+
enumerable: true
|
|
4871
|
+
});
|
|
4872
|
+
Object.defineProperty(this, "volume", {
|
|
4873
|
+
get() {
|
|
4874
|
+
return self2._playbin()?.volume ?? 1;
|
|
4875
|
+
},
|
|
4876
|
+
set(v) {
|
|
4877
|
+
const pb = self2._playbin();
|
|
4878
|
+
if (pb) pb.volume = Math.max(0, Math.min(1, v));
|
|
4879
|
+
},
|
|
4880
|
+
configurable: true,
|
|
4881
|
+
enumerable: true
|
|
4882
|
+
});
|
|
4883
|
+
Object.defineProperty(this, "muted", {
|
|
4884
|
+
get() {
|
|
4885
|
+
return self2._playbin()?.mute ?? false;
|
|
4886
|
+
},
|
|
4887
|
+
set(v) {
|
|
4888
|
+
const pb = self2._playbin();
|
|
4889
|
+
if (pb) pb.mute = v;
|
|
4890
|
+
},
|
|
4891
|
+
configurable: true,
|
|
4892
|
+
enumerable: true
|
|
4893
|
+
});
|
|
4894
|
+
}
|
|
4895
|
+
async play() {
|
|
4896
|
+
this._pipeline?.set_state(GST_STATE_PLAYING);
|
|
4897
|
+
this.dispatchEvent(new Event("play"));
|
|
4898
|
+
this.dispatchEvent(new Event("playing"));
|
|
4899
|
+
}
|
|
4900
|
+
pause() {
|
|
4901
|
+
this._pipeline?.set_state(GST_STATE_PAUSED);
|
|
4902
|
+
this.dispatchEvent(new Event("pause"));
|
|
4845
4903
|
}
|
|
4846
|
-
/** Intrinsic width of the video (set by
|
|
4904
|
+
/** Intrinsic width of the video (set by bridge when media metadata loads). */
|
|
4847
4905
|
get videoWidth() {
|
|
4848
4906
|
return this._videoWidth;
|
|
4849
4907
|
}
|
|
4850
4908
|
set videoWidth(value2) {
|
|
4851
4909
|
this._videoWidth = value2;
|
|
4852
4910
|
}
|
|
4853
|
-
/** Intrinsic height of the video (set by
|
|
4911
|
+
/** Intrinsic height of the video (set by bridge when media metadata loads). */
|
|
4854
4912
|
get videoHeight() {
|
|
4855
4913
|
return this._videoHeight;
|
|
4856
4914
|
}
|
|
@@ -4860,6 +4918,9 @@ var init_html_video_element = __esm({
|
|
|
4860
4918
|
get [Symbol.toStringTag]() {
|
|
4861
4919
|
return "HTMLVideoElement";
|
|
4862
4920
|
}
|
|
4921
|
+
_playbin() {
|
|
4922
|
+
return this._pipeline?.get_by_name("playbin") ?? null;
|
|
4923
|
+
}
|
|
4863
4924
|
};
|
|
4864
4925
|
}
|
|
4865
4926
|
});
|
|
@@ -4869,7 +4930,7 @@ var Text;
|
|
|
4869
4930
|
var init_text = __esm({
|
|
4870
4931
|
"../../../packages/dom/dom-elements/lib/esm/text.js"() {
|
|
4871
4932
|
init_console_gjs();
|
|
4872
|
-
|
|
4933
|
+
init_auto_globals_97a682e619();
|
|
4873
4934
|
init_character_data();
|
|
4874
4935
|
init_node_type();
|
|
4875
4936
|
init_property_symbol();
|
|
@@ -4926,7 +4987,7 @@ var DocumentFragment;
|
|
|
4926
4987
|
var init_document_fragment = __esm({
|
|
4927
4988
|
"../../../packages/dom/dom-elements/lib/esm/document-fragment.js"() {
|
|
4928
4989
|
init_console_gjs();
|
|
4929
|
-
|
|
4990
|
+
init_auto_globals_97a682e619();
|
|
4930
4991
|
init_node();
|
|
4931
4992
|
init_text();
|
|
4932
4993
|
init_node_type();
|
|
@@ -5044,7 +5105,7 @@ var Document, document2;
|
|
|
5044
5105
|
var init_document = __esm({
|
|
5045
5106
|
"../../../packages/dom/dom-elements/lib/esm/document.js"() {
|
|
5046
5107
|
init_console_gjs();
|
|
5047
|
-
|
|
5108
|
+
init_auto_globals_97a682e619();
|
|
5048
5109
|
init_node();
|
|
5049
5110
|
init_html_element();
|
|
5050
5111
|
init_html_image_element();
|
|
@@ -5133,7 +5194,7 @@ var DOMTokenList;
|
|
|
5133
5194
|
var init_dom_token_list = __esm({
|
|
5134
5195
|
"../../../packages/dom/dom-elements/lib/esm/dom-token-list.js"() {
|
|
5135
5196
|
init_console_gjs();
|
|
5136
|
-
|
|
5197
|
+
init_auto_globals_97a682e619();
|
|
5137
5198
|
DOMTokenList = class {
|
|
5138
5199
|
constructor(ownerElement2, attributeName) {
|
|
5139
5200
|
this._ownerElement = ownerElement2;
|
|
@@ -5248,7 +5309,7 @@ var Window;
|
|
|
5248
5309
|
var init_document2 = __esm({
|
|
5249
5310
|
"../../../packages/dom/dom-elements/lib/esm/register/document.js"() {
|
|
5250
5311
|
init_console_gjs();
|
|
5251
|
-
|
|
5312
|
+
init_auto_globals_97a682e619();
|
|
5252
5313
|
init_esm4();
|
|
5253
5314
|
init_comment();
|
|
5254
5315
|
init_document();
|
|
@@ -5297,7 +5358,7 @@ var Image;
|
|
|
5297
5358
|
var init_image = __esm({
|
|
5298
5359
|
"../../../packages/dom/dom-elements/lib/esm/image.js"() {
|
|
5299
5360
|
init_console_gjs();
|
|
5300
|
-
|
|
5361
|
+
init_auto_globals_97a682e619();
|
|
5301
5362
|
init_html_image_element();
|
|
5302
5363
|
Image = class extends HTMLImageElement2 {
|
|
5303
5364
|
/**
|
|
@@ -5323,7 +5384,7 @@ var init_image = __esm({
|
|
|
5323
5384
|
var init_image2 = __esm({
|
|
5324
5385
|
"../../../packages/dom/dom-elements/lib/esm/register/image.js"() {
|
|
5325
5386
|
init_console_gjs();
|
|
5326
|
-
|
|
5387
|
+
init_auto_globals_97a682e619();
|
|
5327
5388
|
init_html_image_element();
|
|
5328
5389
|
init_image();
|
|
5329
5390
|
init_helpers();
|
|
@@ -5336,7 +5397,7 @@ var init_image2 = __esm({
|
|
|
5336
5397
|
var init_navigator = __esm({
|
|
5337
5398
|
"../../../packages/dom/dom-elements/lib/esm/register/navigator.js"() {
|
|
5338
5399
|
init_console_gjs();
|
|
5339
|
-
|
|
5400
|
+
init_auto_globals_97a682e619();
|
|
5340
5401
|
if (typeof globalThis.navigator === "undefined") {
|
|
5341
5402
|
globalThis.navigator = {};
|
|
5342
5403
|
}
|
|
@@ -5451,7 +5512,7 @@ var textEncoder, textDecoder, hasSharedArrayBuffer, Buffer2, kMaxLength, kString
|
|
|
5451
5512
|
var init_buffer = __esm({
|
|
5452
5513
|
"../../../packages/node/buffer/lib/esm/buffer.js"() {
|
|
5453
5514
|
init_console_gjs();
|
|
5454
|
-
|
|
5515
|
+
init_auto_globals_97a682e619();
|
|
5455
5516
|
init_esm();
|
|
5456
5517
|
textEncoder = new TextEncoder();
|
|
5457
5518
|
textDecoder = new TextDecoder();
|
|
@@ -6004,7 +6065,7 @@ var atob2, btoa;
|
|
|
6004
6065
|
var init_esm5 = __esm({
|
|
6005
6066
|
"../../../packages/node/buffer/lib/esm/index.js"() {
|
|
6006
6067
|
init_console_gjs();
|
|
6007
|
-
|
|
6068
|
+
init_auto_globals_97a682e619();
|
|
6008
6069
|
init_buffer();
|
|
6009
6070
|
atob2 = globalThis.atob;
|
|
6010
6071
|
btoa = globalThis.btoa;
|
|
@@ -6015,7 +6076,7 @@ var init_esm5 = __esm({
|
|
|
6015
6076
|
var init_buffer2 = __esm({
|
|
6016
6077
|
"../../../packages/node/globals/lib/esm/register/buffer.js"() {
|
|
6017
6078
|
init_console_gjs();
|
|
6018
|
-
|
|
6079
|
+
init_auto_globals_97a682e619();
|
|
6019
6080
|
init_esm5();
|
|
6020
6081
|
init_register();
|
|
6021
6082
|
if (!("Buffer" in globalThis)) {
|
|
@@ -6033,7 +6094,7 @@ var init_buffer2 = __esm({
|
|
|
6033
6094
|
var init_encoding2 = __esm({
|
|
6034
6095
|
"../../../packages/node/globals/lib/esm/register/encoding.js"() {
|
|
6035
6096
|
init_console_gjs();
|
|
6036
|
-
|
|
6097
|
+
init_auto_globals_97a682e619();
|
|
6037
6098
|
init_glib_2();
|
|
6038
6099
|
if (typeof globalThis.btoa !== "function") {
|
|
6039
6100
|
Object.defineProperty(globalThis, "btoa", {
|
|
@@ -6067,1121 +6128,115 @@ var init_encoding2 = __esm({
|
|
|
6067
6128
|
}
|
|
6068
6129
|
});
|
|
6069
6130
|
|
|
6070
|
-
// ../../../packages/node/globals/lib/esm/register/
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
init_console_gjs();
|
|
6074
|
-
init_auto_globals_495e9d950c();
|
|
6075
|
-
if (typeof queueMicrotask !== "function") {
|
|
6076
|
-
Object.defineProperty(globalThis, "queueMicrotask", {
|
|
6077
|
-
value: function queueMicrotask2(callback) {
|
|
6078
|
-
Promise.resolve().then(callback).catch((err) => {
|
|
6079
|
-
setTimeout(() => {
|
|
6080
|
-
throw err;
|
|
6081
|
-
}, 0);
|
|
6082
|
-
});
|
|
6083
|
-
},
|
|
6084
|
-
enumerable: true,
|
|
6085
|
-
writable: true,
|
|
6086
|
-
configurable: true
|
|
6087
|
-
});
|
|
6088
|
-
}
|
|
6089
|
-
}
|
|
6090
|
-
});
|
|
6091
|
-
|
|
6092
|
-
// ../../../packages/node/events/lib/esm/event-emitter.js
|
|
6093
|
-
function onceWrapper() {
|
|
6094
|
-
const { target, type, listener } = this;
|
|
6095
|
-
if (this.wrapperFn) target.removeListener(type, this.wrapperFn);
|
|
6096
|
-
const result = listener.apply(target, arguments);
|
|
6097
|
-
return result;
|
|
6098
|
-
}
|
|
6099
|
-
function _onceWrap(target, type, listener) {
|
|
6100
|
-
const state = { target, type, listener, wrapperFn: void 0 };
|
|
6101
|
-
const wrapped = onceWrapper.bind(state);
|
|
6102
|
-
state.wrapperFn = wrapped;
|
|
6103
|
-
wrapped.listener = listener;
|
|
6104
|
-
return wrapped;
|
|
6131
|
+
// ../../../packages/node/globals/lib/esm/register/timers.js
|
|
6132
|
+
function getGLib() {
|
|
6133
|
+
return globalThis.imports?.gi?.GLib;
|
|
6105
6134
|
}
|
|
6106
|
-
function
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
case 3:
|
|
6115
|
-
return [arr[0], arr[1], arr[2]];
|
|
6116
|
-
default:
|
|
6117
|
-
return arr.slice();
|
|
6118
|
-
}
|
|
6119
|
-
}
|
|
6120
|
-
function checkListener(listener) {
|
|
6121
|
-
if (typeof listener !== "function") {
|
|
6122
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
6123
|
-
}
|
|
6124
|
-
}
|
|
6125
|
-
function validateNumber(value2, name2) {
|
|
6126
|
-
if (typeof value2 !== "number" || value2 !== value2) {
|
|
6127
|
-
throw new TypeError(`The "${name2}" argument must be of type number. Received type ${typeof value2}`);
|
|
6128
|
-
}
|
|
6129
|
-
}
|
|
6130
|
-
function spliceOne(list, index) {
|
|
6131
|
-
for (; index + 1 < list.length; index++) {
|
|
6132
|
-
list[index] = list[index + 1];
|
|
6135
|
+
function removeById(timeout) {
|
|
6136
|
+
if (timeout instanceof GjsifyTimeout) {
|
|
6137
|
+
timeout._cancel();
|
|
6138
|
+
} else if (typeof timeout === "number") {
|
|
6139
|
+
try {
|
|
6140
|
+
getGLib()?.Source.remove(timeout);
|
|
6141
|
+
} catch {
|
|
6142
|
+
}
|
|
6133
6143
|
}
|
|
6134
|
-
list.pop();
|
|
6135
6144
|
}
|
|
6136
|
-
function
|
|
6137
|
-
|
|
6138
|
-
for (let i = 0; i < ret.length; ++i) {
|
|
6139
|
-
ret[i] = arr[i].listener ?? arr[i];
|
|
6140
|
-
}
|
|
6141
|
-
return ret;
|
|
6145
|
+
function setImmediate(callback, ...args) {
|
|
6146
|
+
return setTimeout(callback, 0, ...args);
|
|
6142
6147
|
}
|
|
6143
|
-
function
|
|
6144
|
-
|
|
6145
|
-
err.name = "AbortError";
|
|
6146
|
-
err.code = "ABORT_ERR";
|
|
6147
|
-
if (signal?.reason) {
|
|
6148
|
-
err.cause = signal.reason;
|
|
6149
|
-
}
|
|
6150
|
-
return err;
|
|
6148
|
+
function clearImmediate(id) {
|
|
6149
|
+
clearTimeout(id);
|
|
6151
6150
|
}
|
|
6152
|
-
var
|
|
6153
|
-
var
|
|
6154
|
-
"../../../packages/node/
|
|
6151
|
+
var _isGjsTimer, GjsifyTimeout;
|
|
6152
|
+
var init_timers = __esm({
|
|
6153
|
+
"../../../packages/node/globals/lib/esm/register/timers.js"() {
|
|
6155
6154
|
init_console_gjs();
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
setMaxListeners(n) {
|
|
6184
|
-
validateNumber(n, "n");
|
|
6185
|
-
if (n < 0) {
|
|
6186
|
-
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n);
|
|
6187
|
-
}
|
|
6188
|
-
this._maxListeners = n;
|
|
6189
|
-
return this;
|
|
6190
|
-
}
|
|
6191
|
-
getMaxListeners() {
|
|
6192
|
-
return this._maxListeners ?? _EventEmitter.defaultMaxListeners;
|
|
6193
|
-
}
|
|
6194
|
-
emit(type, ...args) {
|
|
6195
|
-
const events = this._events;
|
|
6196
|
-
let doError = type === "error";
|
|
6197
|
-
if (events !== void 0) {
|
|
6198
|
-
if (doError && events[_EventEmitter.errorMonitor] !== void 0) {
|
|
6199
|
-
this.emit(_EventEmitter.errorMonitor, ...args);
|
|
6200
|
-
}
|
|
6201
|
-
doError = doError && events.error === void 0;
|
|
6202
|
-
} else if (!doError) {
|
|
6203
|
-
return false;
|
|
6204
|
-
}
|
|
6205
|
-
if (doError) {
|
|
6206
|
-
let er;
|
|
6207
|
-
if (args.length > 0) {
|
|
6208
|
-
er = args[0];
|
|
6209
|
-
} else {
|
|
6210
|
-
er = new Error("Unhandled error.");
|
|
6211
|
-
}
|
|
6212
|
-
if (er instanceof Error) {
|
|
6213
|
-
throw er;
|
|
6214
|
-
}
|
|
6215
|
-
const err = new Error("Unhandled error. (" + er + ")");
|
|
6216
|
-
err.context = er;
|
|
6217
|
-
throw err;
|
|
6218
|
-
}
|
|
6219
|
-
const handler = events[type];
|
|
6220
|
-
if (handler === void 0) {
|
|
6221
|
-
return false;
|
|
6222
|
-
}
|
|
6223
|
-
if (typeof handler === "function") {
|
|
6224
|
-
const result = handler.apply(this, args);
|
|
6225
|
-
if (result !== void 0 && result !== null && this[kCapture]) {
|
|
6226
|
-
this._addCatch(result, type, args);
|
|
6227
|
-
}
|
|
6228
|
-
} else {
|
|
6229
|
-
const listeners = arrayClone(handler);
|
|
6230
|
-
const len = listeners.length;
|
|
6231
|
-
for (let i = 0; i < len; ++i) {
|
|
6232
|
-
const result = listeners[i].apply(this, args);
|
|
6233
|
-
if (result !== void 0 && result !== null && this[kCapture]) {
|
|
6234
|
-
this._addCatch(result, type, args);
|
|
6235
|
-
}
|
|
6236
|
-
}
|
|
6237
|
-
}
|
|
6238
|
-
return true;
|
|
6239
|
-
}
|
|
6240
|
-
_addCatch(result, type, args) {
|
|
6241
|
-
if (typeof result?.then === "function") {
|
|
6242
|
-
result.then(void 0, (err) => {
|
|
6243
|
-
const handler = this[kRejection];
|
|
6244
|
-
if (typeof handler === "function") {
|
|
6245
|
-
handler.call(this, err, type, ...args);
|
|
6246
|
-
} else {
|
|
6247
|
-
const prev = this[kCapture];
|
|
6248
|
-
try {
|
|
6249
|
-
this[kCapture] = false;
|
|
6250
|
-
this.emit("error", err);
|
|
6251
|
-
} finally {
|
|
6252
|
-
this[kCapture] = prev;
|
|
6253
|
-
}
|
|
6254
|
-
}
|
|
6255
|
-
});
|
|
6256
|
-
}
|
|
6257
|
-
}
|
|
6258
|
-
addListener(type, listener) {
|
|
6259
|
-
return this._addListener(type, listener, false);
|
|
6260
|
-
}
|
|
6261
|
-
on(type, listener) {
|
|
6262
|
-
return this._addListener(type, listener, false);
|
|
6263
|
-
}
|
|
6264
|
-
prependListener(type, listener) {
|
|
6265
|
-
return this._addListener(type, listener, true);
|
|
6266
|
-
}
|
|
6267
|
-
_addListener(type, listener, prepend) {
|
|
6268
|
-
checkListener(listener);
|
|
6269
|
-
let events = this._events;
|
|
6270
|
-
if (events === void 0) {
|
|
6271
|
-
events = this._events = /* @__PURE__ */ Object.create(null);
|
|
6272
|
-
this._eventsCount = 0;
|
|
6273
|
-
} else if (events.newListener !== void 0) {
|
|
6274
|
-
this.emit("newListener", type, listener.listener ?? listener);
|
|
6275
|
-
events = this._events;
|
|
6276
|
-
}
|
|
6277
|
-
let existing = events[type];
|
|
6278
|
-
if (existing === void 0) {
|
|
6279
|
-
events[type] = listener;
|
|
6280
|
-
++this._eventsCount;
|
|
6281
|
-
} else if (typeof existing === "function") {
|
|
6282
|
-
events[type] = prepend ? [listener, existing] : [existing, listener];
|
|
6283
|
-
} else {
|
|
6284
|
-
if (prepend) {
|
|
6285
|
-
existing.unshift(listener);
|
|
6286
|
-
} else {
|
|
6287
|
-
existing.push(listener);
|
|
6288
|
-
}
|
|
6289
|
-
}
|
|
6290
|
-
const m = this.getMaxListeners();
|
|
6291
|
-
if (m > 0) {
|
|
6292
|
-
const count2 = typeof events[type] === "function" ? 1 : events[type].length;
|
|
6293
|
-
if (count2 > m && !events[type].warned) {
|
|
6294
|
-
if (typeof events[type] !== "function") {
|
|
6295
|
-
events[type].warned = true;
|
|
6296
|
-
}
|
|
6297
|
-
const w = new Error(
|
|
6298
|
-
`Possible EventEmitter memory leak detected. ${count2} ${String(type)} listeners added to [${this.constructor.name}]. Use emitter.setMaxListeners() to increase limit`
|
|
6299
|
-
);
|
|
6300
|
-
w.name = "MaxListenersExceededWarning";
|
|
6301
|
-
console.warn(w.message);
|
|
6155
|
+
init_auto_globals_97a682e619();
|
|
6156
|
+
_isGjsTimer = getGLib() !== void 0;
|
|
6157
|
+
GjsifyTimeout = class {
|
|
6158
|
+
_id = null;
|
|
6159
|
+
_refed = true;
|
|
6160
|
+
_callback;
|
|
6161
|
+
_delay;
|
|
6162
|
+
_args;
|
|
6163
|
+
_repeat;
|
|
6164
|
+
constructor(callback, delay, args, repeat) {
|
|
6165
|
+
this._callback = callback;
|
|
6166
|
+
this._delay = delay;
|
|
6167
|
+
this._args = args;
|
|
6168
|
+
this._repeat = repeat;
|
|
6169
|
+
this._schedule();
|
|
6170
|
+
}
|
|
6171
|
+
_schedule() {
|
|
6172
|
+
const GLib4 = getGLib();
|
|
6173
|
+
if (!GLib4) return;
|
|
6174
|
+
const timeoutAdd = GLib4.timeout_add.bind(GLib4);
|
|
6175
|
+
this._id = timeoutAdd(GLib4.PRIORITY_DEFAULT, this._delay, () => {
|
|
6176
|
+
try {
|
|
6177
|
+
this._callback.apply(globalThis, this._args);
|
|
6178
|
+
} catch (err) {
|
|
6179
|
+
setTimeout(() => {
|
|
6180
|
+
throw err;
|
|
6181
|
+
}, 0);
|
|
6302
6182
|
}
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
checkListener(listener);
|
|
6308
|
-
this.on(type, _onceWrap(this, type, listener));
|
|
6309
|
-
return this;
|
|
6183
|
+
if (this._repeat) return GLib4.SOURCE_CONTINUE;
|
|
6184
|
+
this._id = null;
|
|
6185
|
+
return GLib4.SOURCE_REMOVE;
|
|
6186
|
+
});
|
|
6310
6187
|
}
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
this.prependListener(type, _onceWrap(this, type, listener));
|
|
6188
|
+
ref() {
|
|
6189
|
+
this._refed = true;
|
|
6314
6190
|
return this;
|
|
6315
6191
|
}
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
const events = this._events;
|
|
6319
|
-
if (events === void 0) {
|
|
6320
|
-
return this;
|
|
6321
|
-
}
|
|
6322
|
-
const list = events[type];
|
|
6323
|
-
if (list === void 0) {
|
|
6324
|
-
return this;
|
|
6325
|
-
}
|
|
6326
|
-
if (list === listener || list.listener === listener) {
|
|
6327
|
-
if (--this._eventsCount === 0) {
|
|
6328
|
-
this._events = /* @__PURE__ */ Object.create(null);
|
|
6329
|
-
} else {
|
|
6330
|
-
delete events[type];
|
|
6331
|
-
if (events.removeListener) {
|
|
6332
|
-
this.emit("removeListener", type, list.listener ?? listener);
|
|
6333
|
-
}
|
|
6334
|
-
}
|
|
6335
|
-
} else if (typeof list !== "function") {
|
|
6336
|
-
let position = -1;
|
|
6337
|
-
for (let i = list.length - 1; i >= 0; i--) {
|
|
6338
|
-
if (list[i] === listener || list[i].listener === listener) {
|
|
6339
|
-
position = i;
|
|
6340
|
-
break;
|
|
6341
|
-
}
|
|
6342
|
-
}
|
|
6343
|
-
if (position < 0) {
|
|
6344
|
-
return this;
|
|
6345
|
-
}
|
|
6346
|
-
if (position === 0) {
|
|
6347
|
-
list.shift();
|
|
6348
|
-
} else {
|
|
6349
|
-
spliceOne(list, position);
|
|
6350
|
-
}
|
|
6351
|
-
if (list.length === 1) {
|
|
6352
|
-
events[type] = list[0];
|
|
6353
|
-
}
|
|
6354
|
-
if (events.removeListener !== void 0) {
|
|
6355
|
-
this.emit("removeListener", type, listener.listener ?? listener);
|
|
6356
|
-
}
|
|
6357
|
-
}
|
|
6192
|
+
unref() {
|
|
6193
|
+
this._refed = false;
|
|
6358
6194
|
return this;
|
|
6359
6195
|
}
|
|
6360
|
-
|
|
6361
|
-
return this.
|
|
6196
|
+
hasRef() {
|
|
6197
|
+
return this._refed;
|
|
6362
6198
|
}
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
return this;
|
|
6367
|
-
}
|
|
6368
|
-
if (events.removeListener === void 0) {
|
|
6369
|
-
if (arguments.length === 0) {
|
|
6370
|
-
this._events = /* @__PURE__ */ Object.create(null);
|
|
6371
|
-
this._eventsCount = 0;
|
|
6372
|
-
} else if (events[type] !== void 0) {
|
|
6373
|
-
if (--this._eventsCount === 0) {
|
|
6374
|
-
this._events = /* @__PURE__ */ Object.create(null);
|
|
6375
|
-
} else {
|
|
6376
|
-
delete events[type];
|
|
6377
|
-
}
|
|
6378
|
-
}
|
|
6379
|
-
return this;
|
|
6380
|
-
}
|
|
6381
|
-
if (arguments.length === 0) {
|
|
6382
|
-
const keys = Object.keys(events);
|
|
6383
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
6384
|
-
const key = keys[i];
|
|
6385
|
-
if (key === "removeListener") continue;
|
|
6386
|
-
this.removeAllListeners(key);
|
|
6387
|
-
}
|
|
6388
|
-
this.removeAllListeners("removeListener");
|
|
6389
|
-
this._events = /* @__PURE__ */ Object.create(null);
|
|
6390
|
-
this._eventsCount = 0;
|
|
6391
|
-
return this;
|
|
6392
|
-
}
|
|
6393
|
-
const listeners = events[type];
|
|
6394
|
-
if (typeof listeners === "function") {
|
|
6395
|
-
this.removeListener(type, listeners);
|
|
6396
|
-
} else if (listeners !== void 0) {
|
|
6397
|
-
for (let i = listeners.length - 1; i >= 0; i--) {
|
|
6398
|
-
this.removeListener(type, listeners[i]);
|
|
6399
|
-
}
|
|
6400
|
-
}
|
|
6199
|
+
refresh() {
|
|
6200
|
+
this._cancel();
|
|
6201
|
+
this._schedule();
|
|
6401
6202
|
return this;
|
|
6402
6203
|
}
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
if (events === void 0) {
|
|
6406
|
-
return [];
|
|
6407
|
-
}
|
|
6408
|
-
const evlistener = events[type];
|
|
6409
|
-
if (evlistener === void 0) {
|
|
6410
|
-
return [];
|
|
6411
|
-
}
|
|
6412
|
-
if (typeof evlistener === "function") {
|
|
6413
|
-
return [evlistener.listener ?? evlistener];
|
|
6414
|
-
}
|
|
6415
|
-
return unwrapListeners(evlistener);
|
|
6416
|
-
}
|
|
6417
|
-
rawListeners(type) {
|
|
6418
|
-
const events = this._events;
|
|
6419
|
-
if (events === void 0) {
|
|
6420
|
-
return [];
|
|
6421
|
-
}
|
|
6422
|
-
const evlistener = events[type];
|
|
6423
|
-
if (evlistener === void 0) {
|
|
6424
|
-
return [];
|
|
6425
|
-
}
|
|
6426
|
-
if (typeof evlistener === "function") {
|
|
6427
|
-
return [evlistener];
|
|
6428
|
-
}
|
|
6429
|
-
return arrayClone(evlistener);
|
|
6430
|
-
}
|
|
6431
|
-
listenerCount(type) {
|
|
6432
|
-
const events = this._events;
|
|
6433
|
-
if (events === void 0) {
|
|
6434
|
-
return 0;
|
|
6435
|
-
}
|
|
6436
|
-
const evlistener = events[type];
|
|
6437
|
-
if (evlistener === void 0) {
|
|
6438
|
-
return 0;
|
|
6439
|
-
}
|
|
6440
|
-
if (typeof evlistener === "function") {
|
|
6441
|
-
return 1;
|
|
6442
|
-
}
|
|
6443
|
-
return evlistener.length;
|
|
6444
|
-
}
|
|
6445
|
-
eventNames() {
|
|
6446
|
-
return (this._eventsCount ?? 0) > 0 ? Reflect.ownKeys(this._events) : [];
|
|
6447
|
-
}
|
|
6448
|
-
// -- Static methods --
|
|
6449
|
-
/**
|
|
6450
|
-
* Returns a promise that resolves when the emitter emits the given event,
|
|
6451
|
-
* or rejects if the emitter emits 'error' while waiting.
|
|
6452
|
-
*/
|
|
6453
|
-
static once(emitter, name2, options) {
|
|
6454
|
-
return new Promise((resolve, reject) => {
|
|
6455
|
-
const signal = options?.signal;
|
|
6456
|
-
if (signal?.aborted) {
|
|
6457
|
-
reject(createAbortError(signal));
|
|
6458
|
-
return;
|
|
6459
|
-
}
|
|
6460
|
-
if (typeof emitter.addEventListener === "function") {
|
|
6461
|
-
const eventTarget = emitter;
|
|
6462
|
-
const handler = (...args) => {
|
|
6463
|
-
if (signal) {
|
|
6464
|
-
signal.removeEventListener("abort", abortHandler2);
|
|
6465
|
-
}
|
|
6466
|
-
resolve(args);
|
|
6467
|
-
};
|
|
6468
|
-
const errorHandler2 = (err) => {
|
|
6469
|
-
if (signal) {
|
|
6470
|
-
signal.removeEventListener("abort", abortHandler2);
|
|
6471
|
-
}
|
|
6472
|
-
eventTarget.removeEventListener("error", errorHandler2);
|
|
6473
|
-
reject(err);
|
|
6474
|
-
};
|
|
6475
|
-
const abortHandler2 = () => {
|
|
6476
|
-
eventTarget.removeEventListener(name2, handler);
|
|
6477
|
-
eventTarget.removeEventListener("error", errorHandler2);
|
|
6478
|
-
reject(createAbortError(signal));
|
|
6479
|
-
};
|
|
6480
|
-
eventTarget.addEventListener(name2, handler, { once: true });
|
|
6481
|
-
if (name2 !== "error") {
|
|
6482
|
-
eventTarget.addEventListener("error", errorHandler2, { once: true });
|
|
6483
|
-
}
|
|
6484
|
-
if (signal) {
|
|
6485
|
-
signal.addEventListener("abort", abortHandler2, { once: true });
|
|
6486
|
-
}
|
|
6487
|
-
return;
|
|
6488
|
-
}
|
|
6489
|
-
const ee = emitter;
|
|
6490
|
-
const eventHandler = (...args) => {
|
|
6491
|
-
if (signal) {
|
|
6492
|
-
signal.removeEventListener("abort", abortHandler);
|
|
6493
|
-
}
|
|
6494
|
-
if (errorHandler !== void 0) {
|
|
6495
|
-
ee.removeListener("error", errorHandler);
|
|
6496
|
-
}
|
|
6497
|
-
resolve(args);
|
|
6498
|
-
};
|
|
6499
|
-
let errorHandler;
|
|
6500
|
-
if (name2 !== "error") {
|
|
6501
|
-
errorHandler = (err) => {
|
|
6502
|
-
ee.removeListener(name2, eventHandler);
|
|
6503
|
-
if (signal) {
|
|
6504
|
-
signal.removeEventListener("abort", abortHandler);
|
|
6505
|
-
}
|
|
6506
|
-
reject(err);
|
|
6507
|
-
};
|
|
6508
|
-
ee.once("error", errorHandler);
|
|
6509
|
-
}
|
|
6510
|
-
ee.once(name2, eventHandler);
|
|
6511
|
-
const abortHandler = () => {
|
|
6512
|
-
ee.removeListener(name2, eventHandler);
|
|
6513
|
-
if (errorHandler) {
|
|
6514
|
-
ee.removeListener("error", errorHandler);
|
|
6515
|
-
}
|
|
6516
|
-
reject(createAbortError(signal));
|
|
6517
|
-
};
|
|
6518
|
-
if (signal) {
|
|
6519
|
-
signal.addEventListener("abort", abortHandler, { once: true });
|
|
6520
|
-
}
|
|
6521
|
-
});
|
|
6522
|
-
}
|
|
6523
|
-
/**
|
|
6524
|
-
* Returns an async iterator that yields event arguments each time the emitter emits.
|
|
6525
|
-
*/
|
|
6526
|
-
static on(emitter, event, options) {
|
|
6527
|
-
const signal = options?.signal;
|
|
6528
|
-
if (signal?.aborted) {
|
|
6529
|
-
throw createAbortError(signal);
|
|
6530
|
-
}
|
|
6531
|
-
const highWaterMark = options?.highWaterMark ?? Number.MAX_SAFE_INTEGER;
|
|
6532
|
-
const lowWaterMark = options?.lowWaterMark ?? 1;
|
|
6533
|
-
validateNumber(highWaterMark, "highWaterMark");
|
|
6534
|
-
validateNumber(lowWaterMark, "lowWaterMark");
|
|
6535
|
-
const unconsumedEvents = [];
|
|
6536
|
-
const unconsumedPromises = [];
|
|
6537
|
-
let error3 = null;
|
|
6538
|
-
let finished = false;
|
|
6539
|
-
let paused = false;
|
|
6540
|
-
const eventHandler = (...args) => {
|
|
6541
|
-
if (unconsumedPromises.length > 0) {
|
|
6542
|
-
const { resolve } = unconsumedPromises.shift();
|
|
6543
|
-
resolve({ value: args, done: false });
|
|
6544
|
-
} else {
|
|
6545
|
-
unconsumedEvents.push(args);
|
|
6546
|
-
if (unconsumedEvents.length >= highWaterMark && !paused) {
|
|
6547
|
-
paused = true;
|
|
6548
|
-
if (typeof emitter.pause === "function") {
|
|
6549
|
-
emitter.pause();
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6552
|
-
}
|
|
6553
|
-
};
|
|
6554
|
-
const errorHandler = (err) => {
|
|
6555
|
-
error3 = err;
|
|
6556
|
-
if (unconsumedPromises.length > 0) {
|
|
6557
|
-
const { reject } = unconsumedPromises.shift();
|
|
6558
|
-
reject(err);
|
|
6559
|
-
}
|
|
6560
|
-
iterator.return();
|
|
6561
|
-
};
|
|
6562
|
-
const abortHandler = () => {
|
|
6563
|
-
errorHandler(createAbortError(signal));
|
|
6564
|
-
};
|
|
6565
|
-
emitter.on(event, eventHandler);
|
|
6566
|
-
if (event !== "error") {
|
|
6567
|
-
emitter.on("error", errorHandler);
|
|
6568
|
-
}
|
|
6569
|
-
if (signal) {
|
|
6570
|
-
signal.addEventListener("abort", abortHandler, { once: true });
|
|
6571
|
-
}
|
|
6572
|
-
const cleanup = () => {
|
|
6573
|
-
emitter.removeListener(event, eventHandler);
|
|
6574
|
-
emitter.removeListener("error", errorHandler);
|
|
6575
|
-
if (signal) {
|
|
6576
|
-
signal.removeEventListener("abort", abortHandler);
|
|
6577
|
-
}
|
|
6578
|
-
finished = true;
|
|
6579
|
-
for (const { resolve } of unconsumedPromises) {
|
|
6580
|
-
resolve({ value: void 0, done: true });
|
|
6581
|
-
}
|
|
6582
|
-
unconsumedPromises.length = 0;
|
|
6583
|
-
unconsumedEvents.length = 0;
|
|
6584
|
-
};
|
|
6585
|
-
const iterator = {
|
|
6586
|
-
next() {
|
|
6587
|
-
if (unconsumedEvents.length > 0) {
|
|
6588
|
-
const value2 = unconsumedEvents.shift();
|
|
6589
|
-
if (paused && unconsumedEvents.length < lowWaterMark) {
|
|
6590
|
-
paused = false;
|
|
6591
|
-
if (typeof emitter.resume === "function") {
|
|
6592
|
-
emitter.resume();
|
|
6593
|
-
}
|
|
6594
|
-
}
|
|
6595
|
-
return Promise.resolve({ value: value2, done: false });
|
|
6596
|
-
}
|
|
6597
|
-
if (error3) {
|
|
6598
|
-
const p = Promise.reject(error3);
|
|
6599
|
-
error3 = null;
|
|
6600
|
-
return p;
|
|
6601
|
-
}
|
|
6602
|
-
if (finished) {
|
|
6603
|
-
return Promise.resolve({ value: void 0, done: true });
|
|
6604
|
-
}
|
|
6605
|
-
return new Promise((resolve, reject) => {
|
|
6606
|
-
unconsumedPromises.push({ resolve, reject });
|
|
6607
|
-
});
|
|
6608
|
-
},
|
|
6609
|
-
return() {
|
|
6610
|
-
cleanup();
|
|
6611
|
-
return Promise.resolve({ value: void 0, done: true });
|
|
6612
|
-
},
|
|
6613
|
-
throw(err) {
|
|
6614
|
-
if (!finished) {
|
|
6615
|
-
error3 = err;
|
|
6616
|
-
cleanup();
|
|
6617
|
-
}
|
|
6618
|
-
return Promise.reject(err);
|
|
6619
|
-
},
|
|
6620
|
-
[Symbol.asyncIterator]() {
|
|
6621
|
-
return this;
|
|
6622
|
-
}
|
|
6623
|
-
};
|
|
6624
|
-
return iterator;
|
|
6625
|
-
}
|
|
6626
|
-
/**
|
|
6627
|
-
* Returns the number of listeners listening to the event name.
|
|
6628
|
-
* @deprecated Use emitter.listenerCount() instead.
|
|
6629
|
-
*/
|
|
6630
|
-
static listenerCount(emitter, type) {
|
|
6631
|
-
return emitter.listenerCount(type);
|
|
6632
|
-
}
|
|
6633
|
-
/**
|
|
6634
|
-
* Returns a copy of the array of listeners for the event named eventName.
|
|
6635
|
-
*/
|
|
6636
|
-
static getEventListeners(emitter, name2) {
|
|
6637
|
-
if (typeof emitter.listeners === "function") {
|
|
6638
|
-
return emitter.listeners(name2);
|
|
6639
|
-
}
|
|
6640
|
-
return [];
|
|
6641
|
-
}
|
|
6642
|
-
/**
|
|
6643
|
-
* Set max listeners on one or more emitters.
|
|
6644
|
-
*/
|
|
6645
|
-
static setMaxListeners(n, ...emitters) {
|
|
6646
|
-
validateNumber(n, "n");
|
|
6647
|
-
if (n < 0) {
|
|
6648
|
-
throw new RangeError('The value of "n" is out of range.');
|
|
6649
|
-
}
|
|
6650
|
-
if (emitters.length === 0) {
|
|
6651
|
-
_EventEmitter.defaultMaxListeners = n;
|
|
6652
|
-
} else {
|
|
6653
|
-
for (const emitter of emitters) {
|
|
6654
|
-
if (typeof emitter.setMaxListeners === "function") {
|
|
6655
|
-
emitter.setMaxListeners(n);
|
|
6656
|
-
}
|
|
6657
|
-
}
|
|
6658
|
-
}
|
|
6659
|
-
}
|
|
6660
|
-
/**
|
|
6661
|
-
* Returns the currently set max listeners on the emitter.
|
|
6662
|
-
*/
|
|
6663
|
-
static getMaxListeners(emitter) {
|
|
6664
|
-
if (typeof emitter.getMaxListeners === "function") {
|
|
6665
|
-
return emitter.getMaxListeners();
|
|
6666
|
-
}
|
|
6667
|
-
return _EventEmitter.defaultMaxListeners;
|
|
6668
|
-
}
|
|
6669
|
-
/**
|
|
6670
|
-
* Listens once to an abort event on the provided signal and returns a disposable.
|
|
6671
|
-
*/
|
|
6672
|
-
static addAbortListener(signal, listener) {
|
|
6673
|
-
if (signal.aborted) {
|
|
6674
|
-
Promise.resolve().then(() => listener());
|
|
6675
|
-
}
|
|
6676
|
-
const handler = () => listener();
|
|
6677
|
-
signal.addEventListener("abort", handler, { once: true });
|
|
6678
|
-
return {
|
|
6679
|
-
[Symbol.dispose]() {
|
|
6680
|
-
signal.removeEventListener("abort", handler);
|
|
6681
|
-
}
|
|
6682
|
-
};
|
|
6683
|
-
}
|
|
6684
|
-
};
|
|
6685
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
6686
|
-
}
|
|
6687
|
-
});
|
|
6688
|
-
|
|
6689
|
-
// ../../../packages/node/events/lib/esm/index.js
|
|
6690
|
-
var esm_exports = {};
|
|
6691
|
-
__export(esm_exports, {
|
|
6692
|
-
EventEmitter: () => EventEmitter2,
|
|
6693
|
-
addAbortListener: () => addAbortListener,
|
|
6694
|
-
captureRejectionSymbol: () => captureRejectionSymbol,
|
|
6695
|
-
default: () => index_default,
|
|
6696
|
-
defaultMaxListeners: () => defaultMaxListeners,
|
|
6697
|
-
errorMonitor: () => errorMonitor,
|
|
6698
|
-
getEventListeners: () => getEventListeners,
|
|
6699
|
-
getMaxListeners: () => getMaxListeners,
|
|
6700
|
-
listenerCount: () => listenerCount,
|
|
6701
|
-
on: () => on,
|
|
6702
|
-
once: () => once,
|
|
6703
|
-
setMaxListeners: () => setMaxListeners
|
|
6704
|
-
});
|
|
6705
|
-
var EventEmitter2, captureRejectionSymbol, errorMonitor, defaultMaxListeners, setMaxListeners, getMaxListeners, once, on, getEventListeners, listenerCount, addAbortListener, index_default;
|
|
6706
|
-
var init_esm6 = __esm({
|
|
6707
|
-
"../../../packages/node/events/lib/esm/index.js"() {
|
|
6708
|
-
init_console_gjs();
|
|
6709
|
-
init_auto_globals_495e9d950c();
|
|
6710
|
-
init_esm();
|
|
6711
|
-
init_event_emitter();
|
|
6712
|
-
EventEmitter2 = makeCallable(EventEmitter);
|
|
6713
|
-
EventEmitter2.EventEmitter = EventEmitter2;
|
|
6714
|
-
captureRejectionSymbol = EventEmitter2.captureRejectionSymbol;
|
|
6715
|
-
errorMonitor = EventEmitter2.errorMonitor;
|
|
6716
|
-
defaultMaxListeners = EventEmitter2.defaultMaxListeners;
|
|
6717
|
-
setMaxListeners = EventEmitter2.setMaxListeners;
|
|
6718
|
-
getMaxListeners = EventEmitter2.getMaxListeners;
|
|
6719
|
-
once = EventEmitter2.once;
|
|
6720
|
-
on = EventEmitter2.on;
|
|
6721
|
-
getEventListeners = EventEmitter2.getEventListeners;
|
|
6722
|
-
listenerCount = EventEmitter2.listenerCount;
|
|
6723
|
-
addAbortListener = EventEmitter2.addAbortListener;
|
|
6724
|
-
index_default = EventEmitter2;
|
|
6725
|
-
}
|
|
6726
|
-
});
|
|
6727
|
-
|
|
6728
|
-
// ../../../packages/node/events/cjs-compat.cjs
|
|
6729
|
-
var require_cjs_compat = __commonJS({
|
|
6730
|
-
"../../../packages/node/events/cjs-compat.cjs"(exports, module) {
|
|
6731
|
-
init_console_gjs();
|
|
6732
|
-
init_auto_globals_495e9d950c();
|
|
6733
|
-
var mod = (init_esm6(), __toCommonJS(esm_exports));
|
|
6734
|
-
module.exports = mod.default || mod;
|
|
6735
|
-
}
|
|
6736
|
-
});
|
|
6737
|
-
|
|
6738
|
-
// ../../../packages/node/process/lib/esm/index.js
|
|
6739
|
-
function getGjsGlobal() {
|
|
6740
|
-
return globalThis;
|
|
6741
|
-
}
|
|
6742
|
-
function detectGjsVersion() {
|
|
6743
|
-
try {
|
|
6744
|
-
const system = getGjsGlobal().imports?.system;
|
|
6745
|
-
if (system?.version !== void 0) {
|
|
6746
|
-
const v = Number(system.version);
|
|
6747
|
-
const major = Math.floor(v / 1e4);
|
|
6748
|
-
const minor = Math.floor(v % 1e4 / 100);
|
|
6749
|
-
const patch = v % 100;
|
|
6750
|
-
return `${major}.${minor}.${patch}`;
|
|
6751
|
-
}
|
|
6752
|
-
} catch {
|
|
6753
|
-
}
|
|
6754
|
-
return void 0;
|
|
6755
|
-
}
|
|
6756
|
-
function detectNodeVersion() {
|
|
6757
|
-
if (typeof globalThis.process?.versions?.node === "string") {
|
|
6758
|
-
return globalThis.process.versions.node;
|
|
6759
|
-
}
|
|
6760
|
-
return void 0;
|
|
6761
|
-
}
|
|
6762
|
-
function detectVersionInfo() {
|
|
6763
|
-
const nodeVersion = detectNodeVersion();
|
|
6764
|
-
if (nodeVersion) {
|
|
6765
|
-
return {
|
|
6766
|
-
version: globalThis.process.version,
|
|
6767
|
-
versions: { ...globalThis.process.versions },
|
|
6768
|
-
title: globalThis.process?.title || "node"
|
|
6769
|
-
};
|
|
6770
|
-
}
|
|
6771
|
-
const gjsVersion = detectGjsVersion();
|
|
6772
|
-
const versions2 = {
|
|
6773
|
-
node: "20.0.0"
|
|
6774
|
-
// Compatibility version — many npm packages check process.versions.node
|
|
6775
|
-
};
|
|
6776
|
-
if (gjsVersion) versions2.gjs = gjsVersion;
|
|
6777
|
-
return {
|
|
6778
|
-
version: "v20.0.0",
|
|
6779
|
-
// Compatibility version for Node.js API level checks
|
|
6780
|
-
versions: versions2,
|
|
6781
|
-
title: "gjs"
|
|
6782
|
-
};
|
|
6783
|
-
}
|
|
6784
|
-
function detectPpid() {
|
|
6785
|
-
if (typeof globalThis.process?.ppid === "number") {
|
|
6786
|
-
return globalThis.process.ppid;
|
|
6787
|
-
}
|
|
6788
|
-
try {
|
|
6789
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6790
|
-
if (GLib4) {
|
|
6791
|
-
const [, contents] = GLib4.file_get_contents("/proc/self/status");
|
|
6792
|
-
if (contents) {
|
|
6793
|
-
const str = new TextDecoder().decode(contents);
|
|
6794
|
-
const match = str.match(/PPid:\s+(\d+)/);
|
|
6795
|
-
if (match) return parseInt(match[1], 10);
|
|
6796
|
-
}
|
|
6797
|
-
}
|
|
6798
|
-
} catch {
|
|
6799
|
-
}
|
|
6800
|
-
return 0;
|
|
6801
|
-
}
|
|
6802
|
-
function detectPlatform() {
|
|
6803
|
-
try {
|
|
6804
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6805
|
-
if (GLib4) {
|
|
6806
|
-
const osInfo = GLib4.get_os_info("ID");
|
|
6807
|
-
if (osInfo) return "linux";
|
|
6808
|
-
}
|
|
6809
|
-
} catch {
|
|
6810
|
-
}
|
|
6811
|
-
if (typeof getGjsGlobal().imports?.system !== "undefined") {
|
|
6812
|
-
return "linux";
|
|
6813
|
-
}
|
|
6814
|
-
if (typeof globalThis.process?.platform === "string") {
|
|
6815
|
-
return globalThis.process.platform;
|
|
6816
|
-
}
|
|
6817
|
-
return "linux";
|
|
6818
|
-
}
|
|
6819
|
-
function detectArch() {
|
|
6820
|
-
if (typeof globalThis.process?.arch === "string") {
|
|
6821
|
-
return globalThis.process.arch;
|
|
6822
|
-
}
|
|
6823
|
-
try {
|
|
6824
|
-
const system = getGjsGlobal().imports?.system;
|
|
6825
|
-
if (system?.programInvocationName) {
|
|
6826
|
-
}
|
|
6827
|
-
} catch {
|
|
6828
|
-
}
|
|
6829
|
-
return "x64";
|
|
6830
|
-
}
|
|
6831
|
-
function getCwd() {
|
|
6832
|
-
try {
|
|
6833
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6834
|
-
if (GLib4?.get_current_dir) return GLib4.get_current_dir();
|
|
6835
|
-
} catch {
|
|
6836
|
-
}
|
|
6837
|
-
return "/";
|
|
6838
|
-
}
|
|
6839
|
-
function getEnvProxy() {
|
|
6840
|
-
if (typeof globalThis.process?.env === "object") {
|
|
6841
|
-
return globalThis.process.env;
|
|
6842
|
-
}
|
|
6843
|
-
try {
|
|
6844
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6845
|
-
if (GLib4) {
|
|
6846
|
-
return new Proxy({}, {
|
|
6847
|
-
get(_target2, prop) {
|
|
6848
|
-
if (typeof prop !== "string") return void 0;
|
|
6849
|
-
return GLib4.getenv(prop) ?? void 0;
|
|
6850
|
-
},
|
|
6851
|
-
set(_target2, prop, value2) {
|
|
6852
|
-
if (typeof prop !== "string") return false;
|
|
6853
|
-
GLib4.setenv(prop, String(value2), true);
|
|
6854
|
-
return true;
|
|
6855
|
-
},
|
|
6856
|
-
deleteProperty(_target2, prop) {
|
|
6857
|
-
if (typeof prop !== "string") return false;
|
|
6858
|
-
GLib4.unsetenv(prop);
|
|
6859
|
-
return true;
|
|
6860
|
-
},
|
|
6861
|
-
has(_target2, prop) {
|
|
6862
|
-
if (typeof prop !== "string") return false;
|
|
6863
|
-
return GLib4.getenv(prop) !== null;
|
|
6864
|
-
},
|
|
6865
|
-
ownKeys(_target2) {
|
|
6866
|
-
const envp = GLib4.listenv();
|
|
6867
|
-
return envp;
|
|
6868
|
-
},
|
|
6869
|
-
getOwnPropertyDescriptor(_target2, prop) {
|
|
6870
|
-
if (typeof prop !== "string") return void 0;
|
|
6871
|
-
const val = GLib4.getenv(prop);
|
|
6872
|
-
if (val === null) return void 0;
|
|
6873
|
-
return { configurable: true, enumerable: true, writable: true, value: val };
|
|
6874
|
-
}
|
|
6875
|
-
});
|
|
6876
|
-
}
|
|
6877
|
-
} catch {
|
|
6878
|
-
}
|
|
6879
|
-
return {};
|
|
6880
|
-
}
|
|
6881
|
-
function getArgv() {
|
|
6882
|
-
if (typeof globalThis.process?.argv !== "undefined") {
|
|
6883
|
-
return globalThis.process.argv;
|
|
6884
|
-
}
|
|
6885
|
-
try {
|
|
6886
|
-
const system = getGjsGlobal().imports?.system;
|
|
6887
|
-
if (system?.programArgs) {
|
|
6888
|
-
return ["gjs", system.programInvocationName || "", ...system.programArgs];
|
|
6889
|
-
}
|
|
6890
|
-
} catch {
|
|
6891
|
-
}
|
|
6892
|
-
return ["gjs"];
|
|
6893
|
-
}
|
|
6894
|
-
function getExecPath() {
|
|
6895
|
-
if (typeof globalThis.process?.execPath === "string") {
|
|
6896
|
-
return globalThis.process.execPath;
|
|
6897
|
-
}
|
|
6898
|
-
try {
|
|
6899
|
-
const system = getGjsGlobal().imports?.system;
|
|
6900
|
-
if (system?.programInvocationName) return system.programInvocationName;
|
|
6901
|
-
} catch {
|
|
6902
|
-
}
|
|
6903
|
-
return "/usr/bin/gjs";
|
|
6904
|
-
}
|
|
6905
|
-
function getPid() {
|
|
6906
|
-
if (typeof globalThis.process?.pid === "number") {
|
|
6907
|
-
return globalThis.process.pid;
|
|
6908
|
-
}
|
|
6909
|
-
try {
|
|
6910
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6911
|
-
if (GLib4) {
|
|
6912
|
-
const [, contents] = GLib4.file_get_contents("/proc/self/stat");
|
|
6913
|
-
if (contents) {
|
|
6914
|
-
const str = new TextDecoder().decode(contents);
|
|
6915
|
-
const pid2 = parseInt(str, 10);
|
|
6916
|
-
if (!isNaN(pid2)) return pid2;
|
|
6917
|
-
}
|
|
6918
|
-
}
|
|
6919
|
-
} catch {
|
|
6920
|
-
}
|
|
6921
|
-
return 0;
|
|
6922
|
-
}
|
|
6923
|
-
function getMonotonicTime() {
|
|
6924
|
-
try {
|
|
6925
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6926
|
-
if (GLib4?.get_monotonic_time) {
|
|
6927
|
-
return BigInt(GLib4.get_monotonic_time()) * 1000n;
|
|
6928
|
-
}
|
|
6929
|
-
} catch {
|
|
6930
|
-
}
|
|
6931
|
-
if (typeof performance?.now === "function") {
|
|
6932
|
-
return BigInt(Math.round(performance.now() * 1e6));
|
|
6933
|
-
}
|
|
6934
|
-
return BigInt(Date.now()) * 1000000n;
|
|
6935
|
-
}
|
|
6936
|
-
var import_events, startTime, hrtimeBase, Process, process, platform, arch, env, argv, argv0, execPath, pid, ppid, version, versions, cwd, chdir, exit, nextTick2, hrtime, uptime, memoryUsage, cpuUsage, kill, abort, umask, emitWarning, execArgv, config, stdout, stderr, stdin, index_default2;
|
|
6937
|
-
var init_esm7 = __esm({
|
|
6938
|
-
"../../../packages/node/process/lib/esm/index.js"() {
|
|
6939
|
-
init_console_gjs();
|
|
6940
|
-
init_auto_globals_495e9d950c();
|
|
6941
|
-
import_events = __toESM(require_cjs_compat(), 1);
|
|
6942
|
-
startTime = Date.now();
|
|
6943
|
-
hrtimeBase = getMonotonicTime();
|
|
6944
|
-
Process = class extends import_events.EventEmitter {
|
|
6945
|
-
platform;
|
|
6946
|
-
arch;
|
|
6947
|
-
env;
|
|
6948
|
-
argv;
|
|
6949
|
-
argv0;
|
|
6950
|
-
execPath;
|
|
6951
|
-
pid;
|
|
6952
|
-
ppid;
|
|
6953
|
-
version;
|
|
6954
|
-
versions;
|
|
6955
|
-
title;
|
|
6956
|
-
execArgv;
|
|
6957
|
-
config;
|
|
6958
|
-
exitCode;
|
|
6959
|
-
constructor() {
|
|
6960
|
-
super();
|
|
6961
|
-
this.platform = detectPlatform();
|
|
6962
|
-
this.arch = detectArch();
|
|
6963
|
-
this.env = getEnvProxy();
|
|
6964
|
-
this.argv = getArgv();
|
|
6965
|
-
this.argv0 = this.argv[0] || "gjs";
|
|
6966
|
-
this.execPath = getExecPath();
|
|
6967
|
-
this.execArgv = globalThis.process?.execArgv ?? [];
|
|
6968
|
-
this.config = globalThis.process?.config ?? { target_defaults: {}, variables: {} };
|
|
6969
|
-
this.pid = getPid();
|
|
6970
|
-
this.ppid = detectPpid();
|
|
6971
|
-
const versionInfo = detectVersionInfo();
|
|
6972
|
-
this.version = versionInfo.version;
|
|
6973
|
-
this.versions = versionInfo.versions;
|
|
6974
|
-
this.title = versionInfo.title;
|
|
6975
|
-
}
|
|
6976
|
-
cwd() {
|
|
6977
|
-
return getCwd();
|
|
6978
|
-
}
|
|
6979
|
-
chdir(directory) {
|
|
6980
|
-
try {
|
|
6981
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
6982
|
-
if (GLib4?.chdir) {
|
|
6983
|
-
if (!GLib4.file_test(
|
|
6984
|
-
directory,
|
|
6985
|
-
16
|
|
6986
|
-
/* G_FILE_TEST_EXISTS */
|
|
6987
|
-
)) {
|
|
6988
|
-
const err = new Error(`ENOENT: no such file or directory, chdir '${directory}'`);
|
|
6989
|
-
err.code = "ENOENT";
|
|
6990
|
-
err.syscall = "chdir";
|
|
6991
|
-
err.path = directory;
|
|
6992
|
-
throw err;
|
|
6993
|
-
}
|
|
6994
|
-
GLib4.chdir(directory);
|
|
6995
|
-
return;
|
|
6996
|
-
}
|
|
6997
|
-
} catch (e) {
|
|
6998
|
-
if (e && typeof e === "object" && e.code === "ENOENT") throw e;
|
|
6999
|
-
}
|
|
7000
|
-
const nativeProcess = globalThis.process;
|
|
7001
|
-
if (nativeProcess && nativeProcess !== this && typeof nativeProcess.chdir === "function") {
|
|
7002
|
-
nativeProcess.chdir(directory);
|
|
7003
|
-
return;
|
|
7004
|
-
}
|
|
7005
|
-
throw new Error("process.chdir() is not supported in this environment");
|
|
7006
|
-
}
|
|
7007
|
-
kill(pid2, signal) {
|
|
7008
|
-
const nativeProcess = globalThis.process;
|
|
7009
|
-
if (nativeProcess && nativeProcess !== this && typeof nativeProcess.kill === "function") {
|
|
7010
|
-
return nativeProcess.kill(pid2, signal);
|
|
7011
|
-
}
|
|
6204
|
+
_cancel() {
|
|
6205
|
+
if (this._id === null) return;
|
|
7012
6206
|
try {
|
|
7013
|
-
|
|
7014
|
-
if (GLib4) {
|
|
7015
|
-
const sig = typeof signal === "number" ? String(signal) : signal || "SIGTERM";
|
|
7016
|
-
const sigArg = sig.startsWith("SIG") ? `-${sig.slice(3)}` : `-${sig}`;
|
|
7017
|
-
GLib4.spawn_command_line_sync(`kill ${sigArg} ${pid2}`);
|
|
7018
|
-
return true;
|
|
7019
|
-
}
|
|
6207
|
+
getGLib()?.Source.remove(this._id);
|
|
7020
6208
|
} catch {
|
|
7021
6209
|
}
|
|
7022
|
-
|
|
6210
|
+
this._id = null;
|
|
7023
6211
|
}
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
this.emit("exit", this.exitCode);
|
|
7027
|
-
try {
|
|
7028
|
-
const system = getGjsGlobal().imports?.system;
|
|
7029
|
-
if (system?.exit) {
|
|
7030
|
-
system.exit(this.exitCode);
|
|
7031
|
-
}
|
|
7032
|
-
} catch {
|
|
7033
|
-
}
|
|
7034
|
-
const nativeProcess = globalThis.process;
|
|
7035
|
-
if (nativeProcess && nativeProcess !== this && typeof nativeProcess.exit === "function") {
|
|
7036
|
-
nativeProcess.exit(this.exitCode);
|
|
7037
|
-
}
|
|
7038
|
-
throw new Error(`process.exit(${this.exitCode})`);
|
|
6212
|
+
[Symbol.toPrimitive]() {
|
|
6213
|
+
return this._id;
|
|
7039
6214
|
}
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
queueMicrotask(() => callback(...args));
|
|
7043
|
-
} else {
|
|
7044
|
-
Promise.resolve().then(() => callback(...args));
|
|
7045
|
-
}
|
|
7046
|
-
}
|
|
7047
|
-
hrtime(time2) {
|
|
7048
|
-
const now = getMonotonicTime() - hrtimeBase;
|
|
7049
|
-
const seconds = Number(now / 1000000000n);
|
|
7050
|
-
const nanoseconds = Number(now % 1000000000n);
|
|
7051
|
-
if (time2) {
|
|
7052
|
-
let diffSec = seconds - time2[0];
|
|
7053
|
-
let diffNano = nanoseconds - time2[1];
|
|
7054
|
-
if (diffNano < 0) {
|
|
7055
|
-
diffSec--;
|
|
7056
|
-
diffNano += 1e9;
|
|
7057
|
-
}
|
|
7058
|
-
return [diffSec, diffNano];
|
|
7059
|
-
}
|
|
7060
|
-
return [seconds, nanoseconds];
|
|
6215
|
+
[Symbol.dispose]() {
|
|
6216
|
+
this._cancel();
|
|
7061
6217
|
}
|
|
7062
|
-
uptime() {
|
|
7063
|
-
return (Date.now() - startTime) / 1e3;
|
|
7064
|
-
}
|
|
7065
|
-
memoryUsage() {
|
|
7066
|
-
try {
|
|
7067
|
-
const GLib4 = getGjsGlobal().imports?.gi?.GLib;
|
|
7068
|
-
if (GLib4) {
|
|
7069
|
-
const [, contents] = GLib4.file_get_contents("/proc/self/status");
|
|
7070
|
-
if (contents) {
|
|
7071
|
-
const str = new TextDecoder().decode(contents);
|
|
7072
|
-
const vmRSS = str.match(/VmRSS:\s+(\d+)/);
|
|
7073
|
-
const rss = vmRSS ? parseInt(vmRSS[1], 10) * 1024 : 0;
|
|
7074
|
-
return { rss, heapTotal: rss, heapUsed: rss, external: 0, arrayBuffers: 0 };
|
|
7075
|
-
}
|
|
7076
|
-
}
|
|
7077
|
-
} catch {
|
|
7078
|
-
}
|
|
7079
|
-
const nativeProcess = globalThis.process;
|
|
7080
|
-
if (nativeProcess && nativeProcess !== this && typeof nativeProcess.memoryUsage === "function") {
|
|
7081
|
-
return nativeProcess.memoryUsage();
|
|
7082
|
-
}
|
|
7083
|
-
return { rss: 0, heapTotal: 0, heapUsed: 0, external: 0, arrayBuffers: 0 };
|
|
7084
|
-
}
|
|
7085
|
-
cpuUsage(previousValue) {
|
|
7086
|
-
const nativeProcess = globalThis.process;
|
|
7087
|
-
if (nativeProcess && nativeProcess !== this && typeof nativeProcess.cpuUsage === "function") {
|
|
7088
|
-
return nativeProcess.cpuUsage(previousValue);
|
|
7089
|
-
}
|
|
7090
|
-
return { user: 0, system: 0 };
|
|
7091
|
-
}
|
|
7092
|
-
// Stub: stdout/stderr/stdin — these need stream to be implemented fully
|
|
7093
|
-
// Note: Cannot check globalThis.process.stdout here — on GJS globalThis.process
|
|
7094
|
-
// IS this instance, so that would cause infinite recursion.
|
|
7095
|
-
stdout = { write: (data) => {
|
|
7096
|
-
console.log(data);
|
|
7097
|
-
return true;
|
|
7098
|
-
}, fd: 1 };
|
|
7099
|
-
stderr = { write: (data) => {
|
|
7100
|
-
console.error(data);
|
|
7101
|
-
return true;
|
|
7102
|
-
}, fd: 2 };
|
|
7103
|
-
stdin = { fd: 0 };
|
|
7104
|
-
abort() {
|
|
7105
|
-
this.exit(1);
|
|
7106
|
-
}
|
|
7107
|
-
// no-op stubs for compatibility
|
|
7108
|
-
umask(mask) {
|
|
7109
|
-
return 18;
|
|
7110
|
-
}
|
|
7111
|
-
emitWarning(warning, name2) {
|
|
7112
|
-
if (typeof warning === "string") {
|
|
7113
|
-
console.warn(`(${name2 || "Warning"}): ${warning}`);
|
|
7114
|
-
} else {
|
|
7115
|
-
console.warn(warning.message);
|
|
7116
|
-
}
|
|
7117
|
-
}
|
|
7118
|
-
};
|
|
7119
|
-
Process.prototype.hrtime.bigint = function() {
|
|
7120
|
-
return getMonotonicTime() - hrtimeBase;
|
|
7121
6218
|
};
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
nextTick2 = process.nextTick.bind(process);
|
|
7137
|
-
hrtime = process.hrtime.bind(process);
|
|
7138
|
-
uptime = process.uptime.bind(process);
|
|
7139
|
-
memoryUsage = process.memoryUsage.bind(process);
|
|
7140
|
-
cpuUsage = process.cpuUsage.bind(process);
|
|
7141
|
-
kill = process.kill.bind(process);
|
|
7142
|
-
abort = process.abort.bind(process);
|
|
7143
|
-
umask = process.umask.bind(process);
|
|
7144
|
-
emitWarning = process.emitWarning.bind(process);
|
|
7145
|
-
execArgv = process.execArgv;
|
|
7146
|
-
config = process.config;
|
|
7147
|
-
stdout = process.stdout;
|
|
7148
|
-
stderr = process.stderr;
|
|
7149
|
-
stdin = process.stdin;
|
|
7150
|
-
index_default2 = process;
|
|
7151
|
-
}
|
|
7152
|
-
});
|
|
7153
|
-
|
|
7154
|
-
// ../../../packages/node/globals/lib/esm/register/process.js
|
|
7155
|
-
var init_process = __esm({
|
|
7156
|
-
"../../../packages/node/globals/lib/esm/register/process.js"() {
|
|
7157
|
-
init_console_gjs();
|
|
7158
|
-
init_auto_globals_495e9d950c();
|
|
7159
|
-
init_esm();
|
|
7160
|
-
init_esm7();
|
|
7161
|
-
if (typeof Promise.withResolvers !== "function") {
|
|
7162
|
-
Promise.withResolvers = function() {
|
|
7163
|
-
let resolve;
|
|
7164
|
-
let reject;
|
|
7165
|
-
const promise = new Promise((res, rej) => {
|
|
7166
|
-
resolve = res;
|
|
7167
|
-
reject = rej;
|
|
7168
|
-
});
|
|
7169
|
-
return { promise, resolve, reject };
|
|
7170
|
-
};
|
|
7171
|
-
}
|
|
7172
|
-
initErrorV8Methods(Error);
|
|
7173
|
-
if (!("global" in globalThis)) {
|
|
7174
|
-
Object.defineProperty(globalThis, "global", {
|
|
7175
|
-
value: globalThis,
|
|
7176
|
-
writable: false,
|
|
7177
|
-
enumerable: false,
|
|
6219
|
+
if (_isGjsTimer) {
|
|
6220
|
+
const setT = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, false);
|
|
6221
|
+
const setI = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, true);
|
|
6222
|
+
const g = globalThis;
|
|
6223
|
+
g.setTimeout = setT;
|
|
6224
|
+
g.clearTimeout = removeById;
|
|
6225
|
+
g.setInterval = setI;
|
|
6226
|
+
g.clearInterval = removeById;
|
|
6227
|
+
}
|
|
6228
|
+
if (!("setImmediate" in globalThis)) {
|
|
6229
|
+
Object.defineProperty(globalThis, "setImmediate", {
|
|
6230
|
+
value: setImmediate,
|
|
6231
|
+
enumerable: true,
|
|
6232
|
+
writable: true,
|
|
7178
6233
|
configurable: true
|
|
7179
6234
|
});
|
|
7180
6235
|
}
|
|
7181
|
-
if (!("
|
|
7182
|
-
Object.defineProperty(globalThis, "
|
|
7183
|
-
value:
|
|
7184
|
-
enumerable:
|
|
6236
|
+
if (!("clearImmediate" in globalThis)) {
|
|
6237
|
+
Object.defineProperty(globalThis, "clearImmediate", {
|
|
6238
|
+
value: clearImmediate,
|
|
6239
|
+
enumerable: true,
|
|
7185
6240
|
writable: true,
|
|
7186
6241
|
configurable: true
|
|
7187
6242
|
});
|
|
@@ -7201,10 +6256,10 @@ function encodeComponent(s) {
|
|
|
7201
6256
|
return encodeURIComponent(s).replace(/%20/g, "+");
|
|
7202
6257
|
}
|
|
7203
6258
|
var PARSE_FLAGS, URLSearchParams, URL2;
|
|
7204
|
-
var
|
|
6259
|
+
var init_esm6 = __esm({
|
|
7205
6260
|
"../../../packages/node/url/lib/esm/index.js"() {
|
|
7206
6261
|
init_console_gjs();
|
|
7207
|
-
|
|
6262
|
+
init_auto_globals_97a682e619();
|
|
7208
6263
|
init_glib_2();
|
|
7209
6264
|
PARSE_FLAGS = glib_2_default.UriFlags.HAS_PASSWORD | glib_2_default.UriFlags.ENCODED | glib_2_default.UriFlags.SCHEME_NORMALIZE;
|
|
7210
6265
|
URLSearchParams = class _URLSearchParams {
|
|
@@ -7404,6 +6459,44 @@ var init_esm8 = __esm({
|
|
|
7404
6459
|
toJSON() {
|
|
7405
6460
|
return this.href;
|
|
7406
6461
|
}
|
|
6462
|
+
// ---- URL.createObjectURL / URL.revokeObjectURL ----
|
|
6463
|
+
//
|
|
6464
|
+
// Consumers like Excalibur.js do `const src = URL.createObjectURL(blob);
|
|
6465
|
+
// image.src = src;`. For that to work on GJS we need `src` to be a path
|
|
6466
|
+
// `HTMLImageElement` / `HTMLAudioElement` / `FontFace` can actually read —
|
|
6467
|
+
// i.e. a `file://` URL. We implement this as a static method on our own
|
|
6468
|
+
// URL class (no globalThis monkey-patching):
|
|
6469
|
+
//
|
|
6470
|
+
// - Fast path: if the Blob already carries a `_tmpPath` (e.g. written
|
|
6471
|
+
// by `@gjsify/fetch` XHR when `responseType='blob'`), wrap it as
|
|
6472
|
+
// `file://<_tmpPath>`.
|
|
6473
|
+
// - Slow path: if the Blob has `arrayBuffer()`/bytes but no `_tmpPath`,
|
|
6474
|
+
// materialise the bytes into a GLib temp file and wrap that. This
|
|
6475
|
+
// path is async in the spec — but W3C `createObjectURL` is sync. We
|
|
6476
|
+
// read the bytes via `GLib.Bytes`-style synchronous access when
|
|
6477
|
+
// possible and fall back to a sentinel if not.
|
|
6478
|
+
//
|
|
6479
|
+
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
|
|
6480
|
+
static _objectURLPaths = /* @__PURE__ */ new Map();
|
|
6481
|
+
static _objectURLCounter = 0;
|
|
6482
|
+
static createObjectURL(blob) {
|
|
6483
|
+
const tmp = blob?._tmpPath;
|
|
6484
|
+
if (typeof tmp === "string" && tmp.length > 0) {
|
|
6485
|
+
const url = `file://${tmp}`;
|
|
6486
|
+
_URL._objectURLPaths.set(url, tmp);
|
|
6487
|
+
return url;
|
|
6488
|
+
}
|
|
6489
|
+
return "file:///dev/null";
|
|
6490
|
+
}
|
|
6491
|
+
static revokeObjectURL(url) {
|
|
6492
|
+
const path = _URL._objectURLPaths.get(url);
|
|
6493
|
+
if (!path) return;
|
|
6494
|
+
try {
|
|
6495
|
+
glib_2_default.unlink(path);
|
|
6496
|
+
} catch {
|
|
6497
|
+
}
|
|
6498
|
+
_URL._objectURLPaths.delete(url);
|
|
6499
|
+
}
|
|
7407
6500
|
};
|
|
7408
6501
|
}
|
|
7409
6502
|
});
|
|
@@ -7412,8 +6505,8 @@ var init_esm8 = __esm({
|
|
|
7412
6505
|
var init_url = __esm({
|
|
7413
6506
|
"../../../packages/node/globals/lib/esm/register/url.js"() {
|
|
7414
6507
|
init_console_gjs();
|
|
7415
|
-
|
|
7416
|
-
|
|
6508
|
+
init_auto_globals_97a682e619();
|
|
6509
|
+
init_esm6();
|
|
7417
6510
|
if (typeof globalThis.URL !== "function") {
|
|
7418
6511
|
Object.defineProperty(globalThis, "URL", {
|
|
7419
6512
|
value: URL2,
|
|
@@ -7435,10 +6528,10 @@ var init_url = __esm({
|
|
|
7435
6528
|
|
|
7436
6529
|
// ../../../packages/node/perf_hooks/lib/esm/index.js
|
|
7437
6530
|
var performance2, PerformanceObserverStub, PerformanceEntryStub, PerformanceObserverEntryListStub, PerformanceObserver, PerformanceEntry, PerformanceObserverEntryList, PerformanceMark, PerformanceMeasure;
|
|
7438
|
-
var
|
|
6531
|
+
var init_esm7 = __esm({
|
|
7439
6532
|
"../../../packages/node/perf_hooks/lib/esm/index.js"() {
|
|
7440
6533
|
init_console_gjs();
|
|
7441
|
-
|
|
6534
|
+
init_auto_globals_97a682e619();
|
|
7442
6535
|
if (globalThis.performance) {
|
|
7443
6536
|
performance2 = globalThis.performance;
|
|
7444
6537
|
} else {
|
|
@@ -7464,17 +6557,17 @@ var init_esm9 = __esm({
|
|
|
7464
6557
|
return entry;
|
|
7465
6558
|
},
|
|
7466
6559
|
measure(name2, startMark, endMark) {
|
|
7467
|
-
let
|
|
6560
|
+
let startTime = 0;
|
|
7468
6561
|
let endTime = _now();
|
|
7469
6562
|
if (startMark) {
|
|
7470
6563
|
const s = _entries.find((e) => e.entryType === "mark" && e.name === startMark);
|
|
7471
|
-
if (s)
|
|
6564
|
+
if (s) startTime = s.startTime;
|
|
7472
6565
|
}
|
|
7473
6566
|
if (endMark) {
|
|
7474
6567
|
const e = _entries.find((e2) => e2.entryType === "mark" && e2.name === endMark);
|
|
7475
6568
|
if (e) endTime = e.startTime;
|
|
7476
6569
|
}
|
|
7477
|
-
const entry = { name: name2, entryType: "measure", startTime
|
|
6570
|
+
const entry = { name: name2, entryType: "measure", startTime, duration: endTime - startTime };
|
|
7478
6571
|
_entries.push(entry);
|
|
7479
6572
|
return entry;
|
|
7480
6573
|
},
|
|
@@ -7557,8 +6650,8 @@ var init_esm9 = __esm({
|
|
|
7557
6650
|
var init_performance = __esm({
|
|
7558
6651
|
"../../../packages/web/web-globals/lib/esm/register/performance.js"() {
|
|
7559
6652
|
init_console_gjs();
|
|
7560
|
-
|
|
7561
|
-
|
|
6653
|
+
init_auto_globals_97a682e619();
|
|
6654
|
+
init_esm7();
|
|
7562
6655
|
if (typeof globalThis.performance === "undefined") {
|
|
7563
6656
|
globalThis.performance = performance2;
|
|
7564
6657
|
}
|
|
@@ -7570,10 +6663,10 @@ var init_performance = __esm({
|
|
|
7570
6663
|
|
|
7571
6664
|
// ../../../packages/web/abort-controller/lib/esm/index.js
|
|
7572
6665
|
var kAbort, kInternal, AbortSignal2, AbortController2;
|
|
7573
|
-
var
|
|
6666
|
+
var init_esm8 = __esm({
|
|
7574
6667
|
"../../../packages/web/abort-controller/lib/esm/index.js"() {
|
|
7575
6668
|
init_console_gjs();
|
|
7576
|
-
|
|
6669
|
+
init_auto_globals_97a682e619();
|
|
7577
6670
|
init_esm4();
|
|
7578
6671
|
kAbort = /* @__PURE__ */ Symbol("abort");
|
|
7579
6672
|
kInternal = /* @__PURE__ */ Symbol("internal");
|
|
@@ -7662,8 +6755,8 @@ var init_esm10 = __esm({
|
|
|
7662
6755
|
var init_register2 = __esm({
|
|
7663
6756
|
"../../../packages/web/abort-controller/lib/esm/register.js"() {
|
|
7664
6757
|
init_console_gjs();
|
|
7665
|
-
|
|
7666
|
-
|
|
6758
|
+
init_auto_globals_97a682e619();
|
|
6759
|
+
init_esm8();
|
|
7667
6760
|
if (typeof globalThis.AbortController === "undefined") {
|
|
7668
6761
|
globalThis.AbortController = AbortController2;
|
|
7669
6762
|
}
|
|
@@ -7678,7 +6771,7 @@ var toRegister;
|
|
|
7678
6771
|
var init_custom_events = __esm({
|
|
7679
6772
|
"../../../packages/web/dom-events/lib/esm/register/custom-events.js"() {
|
|
7680
6773
|
init_console_gjs();
|
|
7681
|
-
|
|
6774
|
+
init_auto_globals_97a682e619();
|
|
7682
6775
|
init_esm4();
|
|
7683
6776
|
toRegister = {
|
|
7684
6777
|
CustomEvent: CustomEvent2,
|
|
@@ -7699,7 +6792,7 @@ var init_custom_events = __esm({
|
|
|
7699
6792
|
var init_register3 = __esm({
|
|
7700
6793
|
"../../../packages/web/dom-exception/lib/esm/register.js"() {
|
|
7701
6794
|
init_console_gjs();
|
|
7702
|
-
|
|
6795
|
+
init_auto_globals_97a682e619();
|
|
7703
6796
|
init_esm3();
|
|
7704
6797
|
if (typeof globalThis.DOMException === "undefined") {
|
|
7705
6798
|
globalThis.DOMException = DOMException2;
|
|
@@ -7707,9 +6800,9 @@ var init_register3 = __esm({
|
|
|
7707
6800
|
}
|
|
7708
6801
|
});
|
|
7709
6802
|
|
|
7710
|
-
// node_modules/.cache/gjsify/auto-globals-
|
|
7711
|
-
var
|
|
7712
|
-
"node_modules/.cache/gjsify/auto-globals-
|
|
6803
|
+
// node_modules/.cache/gjsify/auto-globals-97a682e619.mjs
|
|
6804
|
+
var init_auto_globals_97a682e619 = __esm({
|
|
6805
|
+
"node_modules/.cache/gjsify/auto-globals-97a682e619.mjs"() {
|
|
7713
6806
|
init_register();
|
|
7714
6807
|
init_canvas();
|
|
7715
6808
|
init_document2();
|
|
@@ -7717,8 +6810,7 @@ var init_auto_globals_495e9d950c = __esm({
|
|
|
7717
6810
|
init_navigator();
|
|
7718
6811
|
init_buffer2();
|
|
7719
6812
|
init_encoding2();
|
|
7720
|
-
|
|
7721
|
-
init_process();
|
|
6813
|
+
init_timers();
|
|
7722
6814
|
init_url();
|
|
7723
6815
|
init_performance();
|
|
7724
6816
|
init_register2();
|
|
@@ -7733,7 +6825,7 @@ var require_twiddle = __commonJS({
|
|
|
7733
6825
|
"use strict";
|
|
7734
6826
|
"use restrict";
|
|
7735
6827
|
init_console_gjs();
|
|
7736
|
-
|
|
6828
|
+
init_auto_globals_97a682e619();
|
|
7737
6829
|
var INT_BITS = 32;
|
|
7738
6830
|
exports.INT_BITS = INT_BITS;
|
|
7739
6831
|
exports.INT_MAX = 2147483647;
|
|
@@ -7888,7 +6980,7 @@ var require_twiddle = __commonJS({
|
|
|
7888
6980
|
var require_literals = __commonJS({
|
|
7889
6981
|
"../../../node_modules/glsl-tokenizer/lib/literals.js"(exports, module) {
|
|
7890
6982
|
init_console_gjs();
|
|
7891
|
-
|
|
6983
|
+
init_auto_globals_97a682e619();
|
|
7892
6984
|
module.exports = [
|
|
7893
6985
|
// current
|
|
7894
6986
|
"precision",
|
|
@@ -7988,7 +7080,7 @@ var require_literals = __commonJS({
|
|
|
7988
7080
|
var require_operators = __commonJS({
|
|
7989
7081
|
"../../../node_modules/glsl-tokenizer/lib/operators.js"(exports, module) {
|
|
7990
7082
|
init_console_gjs();
|
|
7991
|
-
|
|
7083
|
+
init_auto_globals_97a682e619();
|
|
7992
7084
|
module.exports = [
|
|
7993
7085
|
"<<=",
|
|
7994
7086
|
">>=",
|
|
@@ -8043,7 +7135,7 @@ var require_operators = __commonJS({
|
|
|
8043
7135
|
var require_builtins = __commonJS({
|
|
8044
7136
|
"../../../node_modules/glsl-tokenizer/lib/builtins.js"(exports, module) {
|
|
8045
7137
|
init_console_gjs();
|
|
8046
|
-
|
|
7138
|
+
init_auto_globals_97a682e619();
|
|
8047
7139
|
module.exports = [
|
|
8048
7140
|
// Keep this list sorted
|
|
8049
7141
|
"abs",
|
|
@@ -8201,7 +7293,7 @@ var require_builtins = __commonJS({
|
|
|
8201
7293
|
var require_literals_300es = __commonJS({
|
|
8202
7294
|
"../../../node_modules/glsl-tokenizer/lib/literals-300es.js"(exports, module) {
|
|
8203
7295
|
init_console_gjs();
|
|
8204
|
-
|
|
7296
|
+
init_auto_globals_97a682e619();
|
|
8205
7297
|
var v100 = require_literals();
|
|
8206
7298
|
module.exports = v100.slice().concat([
|
|
8207
7299
|
"layout",
|
|
@@ -8295,7 +7387,7 @@ var require_literals_300es = __commonJS({
|
|
|
8295
7387
|
var require_builtins_300es = __commonJS({
|
|
8296
7388
|
"../../../node_modules/glsl-tokenizer/lib/builtins-300es.js"(exports, module) {
|
|
8297
7389
|
init_console_gjs();
|
|
8298
|
-
|
|
7390
|
+
init_auto_globals_97a682e619();
|
|
8299
7391
|
var v100 = require_builtins();
|
|
8300
7392
|
v100 = v100.slice().filter(function(b) {
|
|
8301
7393
|
return !/^(gl\_|texture)/.test(b);
|
|
@@ -8365,7 +7457,7 @@ var require_builtins_300es = __commonJS({
|
|
|
8365
7457
|
var require_glsl_tokenizer = __commonJS({
|
|
8366
7458
|
"../../../node_modules/glsl-tokenizer/index.js"(exports, module) {
|
|
8367
7459
|
init_console_gjs();
|
|
8368
|
-
|
|
7460
|
+
init_auto_globals_97a682e619();
|
|
8369
7461
|
module.exports = tokenize2;
|
|
8370
7462
|
var literals100 = require_literals();
|
|
8371
7463
|
var operators = require_operators();
|
|
@@ -8698,7 +7790,7 @@ var require_glsl_tokenizer = __commonJS({
|
|
|
8698
7790
|
var require_string = __commonJS({
|
|
8699
7791
|
"../../../node_modules/glsl-tokenizer/string.js"(exports, module) {
|
|
8700
7792
|
init_console_gjs();
|
|
8701
|
-
|
|
7793
|
+
init_auto_globals_97a682e619();
|
|
8702
7794
|
var tokenize2 = require_glsl_tokenizer();
|
|
8703
7795
|
module.exports = tokenizeString;
|
|
8704
7796
|
function tokenizeString(str, opt) {
|
|
@@ -8713,71 +7805,71 @@ var require_string = __commonJS({
|
|
|
8713
7805
|
|
|
8714
7806
|
// src/gjs/gjs.ts
|
|
8715
7807
|
init_console_gjs();
|
|
8716
|
-
|
|
7808
|
+
init_auto_globals_97a682e619();
|
|
8717
7809
|
import Adw2 from "gi://Adw?version=1";
|
|
8718
7810
|
import Gio2 from "gi://Gio?version=2.0";
|
|
8719
7811
|
|
|
8720
7812
|
// src/gjs/pixel-window.ts
|
|
8721
7813
|
init_console_gjs();
|
|
8722
|
-
|
|
7814
|
+
init_auto_globals_97a682e619();
|
|
8723
7815
|
import GObject2 from "gi://GObject?version=2.0";
|
|
8724
7816
|
import GLib3 from "gi://GLib?version=2.0";
|
|
8725
7817
|
import Gtk4 from "gi://Gtk?version=4.0";
|
|
8726
7818
|
import Adw from "gi://Adw?version=1";
|
|
8727
7819
|
|
|
8728
|
-
// ../../../packages/
|
|
7820
|
+
// ../../../packages/framework/webgl/lib/esm/index.js
|
|
8729
7821
|
init_console_gjs();
|
|
8730
|
-
|
|
7822
|
+
init_auto_globals_97a682e619();
|
|
8731
7823
|
|
|
8732
7824
|
// ../../../node_modules/@girs/gjs/index.js
|
|
8733
7825
|
init_console_gjs();
|
|
8734
|
-
|
|
7826
|
+
init_auto_globals_97a682e619();
|
|
8735
7827
|
|
|
8736
7828
|
// ../../../node_modules/@girs/gjs/gjs.js
|
|
8737
7829
|
init_console_gjs();
|
|
8738
|
-
|
|
7830
|
+
init_auto_globals_97a682e619();
|
|
8739
7831
|
var imports2 = globalThis.imports || {};
|
|
8740
7832
|
|
|
8741
|
-
// ../../../packages/
|
|
7833
|
+
// ../../../packages/framework/webgl/lib/esm/index.js
|
|
8742
7834
|
init_gio_2();
|
|
8743
7835
|
|
|
8744
7836
|
// ../../../node_modules/@girs/gtk-4.0/index.js
|
|
8745
7837
|
init_console_gjs();
|
|
8746
|
-
|
|
7838
|
+
init_auto_globals_97a682e619();
|
|
8747
7839
|
|
|
8748
7840
|
// ../../../node_modules/@girs/gtk-4.0/gtk-4.0.js
|
|
8749
7841
|
init_console_gjs();
|
|
8750
|
-
|
|
7842
|
+
init_auto_globals_97a682e619();
|
|
8751
7843
|
import Gtk from "gi://Gtk?version=4.0";
|
|
8752
7844
|
|
|
8753
|
-
// ../../../packages/
|
|
7845
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
|
|
8754
7846
|
init_console_gjs();
|
|
8755
|
-
|
|
7847
|
+
init_auto_globals_97a682e619();
|
|
8756
7848
|
|
|
8757
7849
|
// ../../../node_modules/@girs/gwebgl-0.1/index.js
|
|
8758
7850
|
init_console_gjs();
|
|
8759
|
-
|
|
7851
|
+
init_auto_globals_97a682e619();
|
|
8760
7852
|
|
|
8761
7853
|
// ../../../node_modules/@girs/gwebgl-0.1/gwebgl-0.1.js
|
|
8762
7854
|
init_console_gjs();
|
|
8763
|
-
|
|
7855
|
+
init_auto_globals_97a682e619();
|
|
8764
7856
|
import Gwebgl from "gi://Gwebgl?version=0.1";
|
|
8765
7857
|
var gwebgl_0_1_default = Gwebgl;
|
|
8766
7858
|
|
|
8767
7859
|
// ../../../node_modules/@girs/gwebgl-0.1/index.js
|
|
8768
7860
|
var gwebgl_0_default = gwebgl_0_1_default;
|
|
8769
7861
|
|
|
8770
|
-
// ../../../packages/
|
|
7862
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
|
|
8771
7863
|
init_console_gjs();
|
|
8772
|
-
|
|
7864
|
+
init_auto_globals_97a682e619();
|
|
8773
7865
|
init_gdkpixbuf_2();
|
|
8774
7866
|
var bits = __toESM(require_twiddle(), 1);
|
|
8775
7867
|
var import_string = __toESM(require_string(), 1);
|
|
8776
7868
|
import GdkPixbuf3 from "gi://GdkPixbuf?version=2.0";
|
|
8777
7869
|
|
|
8778
|
-
// ../../../packages/
|
|
7870
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-context-attributes.js
|
|
8779
7871
|
init_console_gjs();
|
|
8780
|
-
|
|
7872
|
+
init_auto_globals_97a682e619();
|
|
8781
7873
|
var WebGLContextAttributes = class {
|
|
8782
7874
|
constructor(alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat) {
|
|
8783
7875
|
this.alpha = alpha;
|
|
@@ -8799,13 +7891,13 @@ var WebGLContextAttributes = class {
|
|
|
8799
7891
|
}
|
|
8800
7892
|
};
|
|
8801
7893
|
|
|
8802
|
-
// ../../../packages/
|
|
7894
|
+
// ../../../packages/framework/webgl/lib/esm/utils.js
|
|
8803
7895
|
init_console_gjs();
|
|
8804
|
-
|
|
7896
|
+
init_auto_globals_97a682e619();
|
|
8805
7897
|
|
|
8806
|
-
// ../../../packages/
|
|
7898
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-uniform-location.js
|
|
8807
7899
|
init_console_gjs();
|
|
8808
|
-
|
|
7900
|
+
init_auto_globals_97a682e619();
|
|
8809
7901
|
var WebGLUniformLocation = class {
|
|
8810
7902
|
constructor(_, program, info2) {
|
|
8811
7903
|
this._linkCount = 0;
|
|
@@ -8818,7 +7910,7 @@ var WebGLUniformLocation = class {
|
|
|
8818
7910
|
}
|
|
8819
7911
|
};
|
|
8820
7912
|
|
|
8821
|
-
// ../../../packages/
|
|
7913
|
+
// ../../../packages/framework/webgl/lib/esm/utils.js
|
|
8822
7914
|
init_glib_2();
|
|
8823
7915
|
function checkObject(object) {
|
|
8824
7916
|
return typeof object === "object" || object === void 0;
|
|
@@ -9001,9 +8093,9 @@ function premultiplyAlpha(data) {
|
|
|
9001
8093
|
return out;
|
|
9002
8094
|
}
|
|
9003
8095
|
|
|
9004
|
-
// ../../../packages/
|
|
8096
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-element-index-unit.js
|
|
9005
8097
|
init_console_gjs();
|
|
9006
|
-
|
|
8098
|
+
init_auto_globals_97a682e619();
|
|
9007
8099
|
var OESElementIndexUint = class {
|
|
9008
8100
|
};
|
|
9009
8101
|
function getOESElementIndexUint(context) {
|
|
@@ -9015,9 +8107,9 @@ function getOESElementIndexUint(context) {
|
|
|
9015
8107
|
return result;
|
|
9016
8108
|
}
|
|
9017
8109
|
|
|
9018
|
-
// ../../../packages/
|
|
8110
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-standard-derivatives.js
|
|
9019
8111
|
init_console_gjs();
|
|
9020
|
-
|
|
8112
|
+
init_auto_globals_97a682e619();
|
|
9021
8113
|
var OESStandardDerivatives = class {
|
|
9022
8114
|
constructor() {
|
|
9023
8115
|
this.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 35723;
|
|
@@ -9032,9 +8124,9 @@ function getOESStandardDerivatives(context) {
|
|
|
9032
8124
|
return result;
|
|
9033
8125
|
}
|
|
9034
8126
|
|
|
9035
|
-
// ../../../packages/
|
|
8127
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float.js
|
|
9036
8128
|
init_console_gjs();
|
|
9037
|
-
|
|
8129
|
+
init_auto_globals_97a682e619();
|
|
9038
8130
|
var OESTextureFloat = class {
|
|
9039
8131
|
};
|
|
9040
8132
|
function getOESTextureFloat(context) {
|
|
@@ -9046,9 +8138,9 @@ function getOESTextureFloat(context) {
|
|
|
9046
8138
|
return result;
|
|
9047
8139
|
}
|
|
9048
8140
|
|
|
9049
|
-
// ../../../packages/
|
|
8141
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float-linear.js
|
|
9050
8142
|
init_console_gjs();
|
|
9051
|
-
|
|
8143
|
+
init_auto_globals_97a682e619();
|
|
9052
8144
|
var OESTextureFloatLinear = class {
|
|
9053
8145
|
};
|
|
9054
8146
|
function getOESTextureFloatLinear(context) {
|
|
@@ -9060,9 +8152,9 @@ function getOESTextureFloatLinear(context) {
|
|
|
9060
8152
|
return result;
|
|
9061
8153
|
}
|
|
9062
8154
|
|
|
9063
|
-
// ../../../packages/
|
|
8155
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/stackgl-destroy-context.js
|
|
9064
8156
|
init_console_gjs();
|
|
9065
|
-
|
|
8157
|
+
init_auto_globals_97a682e619();
|
|
9066
8158
|
var STACKGLDestroyContext = class {
|
|
9067
8159
|
constructor(ctx) {
|
|
9068
8160
|
this.destroy = ctx.destroy.bind(ctx);
|
|
@@ -9072,9 +8164,9 @@ function getSTACKGLDestroyContext(ctx) {
|
|
|
9072
8164
|
return new STACKGLDestroyContext(ctx);
|
|
9073
8165
|
}
|
|
9074
8166
|
|
|
9075
|
-
// ../../../packages/
|
|
8167
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/stackgl-resize-drawing-buffer.js
|
|
9076
8168
|
init_console_gjs();
|
|
9077
|
-
|
|
8169
|
+
init_auto_globals_97a682e619();
|
|
9078
8170
|
var STACKGLResizeDrawingBuffer = class {
|
|
9079
8171
|
constructor(ctx) {
|
|
9080
8172
|
this.resize = ctx.resize.bind(ctx);
|
|
@@ -9084,9 +8176,9 @@ function getSTACKGLResizeDrawingBuffer(ctx) {
|
|
|
9084
8176
|
return new STACKGLResizeDrawingBuffer(ctx);
|
|
9085
8177
|
}
|
|
9086
8178
|
|
|
9087
|
-
// ../../../packages/
|
|
8179
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-blend-minmax.js
|
|
9088
8180
|
init_console_gjs();
|
|
9089
|
-
|
|
8181
|
+
init_auto_globals_97a682e619();
|
|
9090
8182
|
var EXTBlendMinMax = class {
|
|
9091
8183
|
constructor() {
|
|
9092
8184
|
this.MIN_EXT = 32775;
|
|
@@ -9102,9 +8194,9 @@ function getEXTBlendMinMax(context) {
|
|
|
9102
8194
|
return result;
|
|
9103
8195
|
}
|
|
9104
8196
|
|
|
9105
|
-
// ../../../packages/
|
|
8197
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-float.js
|
|
9106
8198
|
init_console_gjs();
|
|
9107
|
-
|
|
8199
|
+
init_auto_globals_97a682e619();
|
|
9108
8200
|
var EXTColorBufferFloat = class {
|
|
9109
8201
|
};
|
|
9110
8202
|
function getEXTColorBufferFloat(context) {
|
|
@@ -9115,9 +8207,9 @@ function getEXTColorBufferFloat(context) {
|
|
|
9115
8207
|
return null;
|
|
9116
8208
|
}
|
|
9117
8209
|
|
|
9118
|
-
// ../../../packages/
|
|
8210
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-half-float.js
|
|
9119
8211
|
init_console_gjs();
|
|
9120
|
-
|
|
8212
|
+
init_auto_globals_97a682e619();
|
|
9121
8213
|
var EXTColorBufferHalfFloat = class {
|
|
9122
8214
|
};
|
|
9123
8215
|
function getEXTColorBufferHalfFloat(context) {
|
|
@@ -9128,9 +8220,9 @@ function getEXTColorBufferHalfFloat(context) {
|
|
|
9128
8220
|
return null;
|
|
9129
8221
|
}
|
|
9130
8222
|
|
|
9131
|
-
// ../../../packages/
|
|
8223
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-texture-filter-anisotropic.js
|
|
9132
8224
|
init_console_gjs();
|
|
9133
|
-
|
|
8225
|
+
init_auto_globals_97a682e619();
|
|
9134
8226
|
var EXTTextureFilterAnisotropic = class {
|
|
9135
8227
|
constructor() {
|
|
9136
8228
|
this.TEXTURE_MAX_ANISOTROPY_EXT = 34046;
|
|
@@ -9146,9 +8238,9 @@ function getEXTTextureFilterAnisotropic(context) {
|
|
|
9146
8238
|
return result;
|
|
9147
8239
|
}
|
|
9148
8240
|
|
|
9149
|
-
// ../../../packages/
|
|
8241
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-half-float.js
|
|
9150
8242
|
init_console_gjs();
|
|
9151
|
-
|
|
8243
|
+
init_auto_globals_97a682e619();
|
|
9152
8244
|
var OESTextureHalfFloat = class {
|
|
9153
8245
|
constructor() {
|
|
9154
8246
|
this.HALF_FLOAT_OES = 36193;
|
|
@@ -9165,9 +8257,9 @@ function getOESTextureHalfFloat(context) {
|
|
|
9165
8257
|
return null;
|
|
9166
8258
|
}
|
|
9167
8259
|
|
|
9168
|
-
// ../../../packages/
|
|
8260
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-active-info.js
|
|
9169
8261
|
init_console_gjs();
|
|
9170
|
-
|
|
8262
|
+
init_auto_globals_97a682e619();
|
|
9171
8263
|
var WebGLActiveInfo = class {
|
|
9172
8264
|
constructor(_) {
|
|
9173
8265
|
this.size = _.size;
|
|
@@ -9176,13 +8268,13 @@ var WebGLActiveInfo = class {
|
|
|
9176
8268
|
}
|
|
9177
8269
|
};
|
|
9178
8270
|
|
|
9179
|
-
// ../../../packages/
|
|
8271
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
|
|
9180
8272
|
init_console_gjs();
|
|
9181
|
-
|
|
8273
|
+
init_auto_globals_97a682e619();
|
|
9182
8274
|
|
|
9183
|
-
// ../../../packages/
|
|
8275
|
+
// ../../../packages/framework/webgl/lib/esm/linkable.js
|
|
9184
8276
|
init_console_gjs();
|
|
9185
|
-
|
|
8277
|
+
init_auto_globals_97a682e619();
|
|
9186
8278
|
var Linkable = class {
|
|
9187
8279
|
constructor(_) {
|
|
9188
8280
|
this._ = 0;
|
|
@@ -9231,7 +8323,7 @@ var Linkable = class {
|
|
|
9231
8323
|
}
|
|
9232
8324
|
};
|
|
9233
8325
|
|
|
9234
|
-
// ../../../packages/
|
|
8326
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
|
|
9235
8327
|
var WebGLFramebuffer = class extends Linkable {
|
|
9236
8328
|
constructor(_, ctx) {
|
|
9237
8329
|
super(_);
|
|
@@ -9337,9 +8429,9 @@ var WebGLFramebuffer = class extends Linkable {
|
|
|
9337
8429
|
}
|
|
9338
8430
|
};
|
|
9339
8431
|
|
|
9340
|
-
// ../../../packages/
|
|
8432
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-buffer.js
|
|
9341
8433
|
init_console_gjs();
|
|
9342
|
-
|
|
8434
|
+
init_auto_globals_97a682e619();
|
|
9343
8435
|
var WebGLBuffer = class extends Linkable {
|
|
9344
8436
|
constructor(_, ctx) {
|
|
9345
8437
|
super(_);
|
|
@@ -9354,9 +8446,9 @@ var WebGLBuffer = class extends Linkable {
|
|
|
9354
8446
|
}
|
|
9355
8447
|
};
|
|
9356
8448
|
|
|
9357
|
-
// ../../../packages/
|
|
8449
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-drawing-buffer-wrapper.js
|
|
9358
8450
|
init_console_gjs();
|
|
9359
|
-
|
|
8451
|
+
init_auto_globals_97a682e619();
|
|
9360
8452
|
var WebGLDrawingBufferWrapper = class {
|
|
9361
8453
|
constructor(framebuffer, color, depthStencil) {
|
|
9362
8454
|
this._framebuffer = framebuffer;
|
|
@@ -9365,9 +8457,9 @@ var WebGLDrawingBufferWrapper = class {
|
|
|
9365
8457
|
}
|
|
9366
8458
|
};
|
|
9367
8459
|
|
|
9368
|
-
// ../../../packages/
|
|
8460
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-program.js
|
|
9369
8461
|
init_console_gjs();
|
|
9370
|
-
|
|
8462
|
+
init_auto_globals_97a682e619();
|
|
9371
8463
|
var WebGLProgram = class extends Linkable {
|
|
9372
8464
|
constructor(_, ctx) {
|
|
9373
8465
|
super(_);
|
|
@@ -9390,9 +8482,9 @@ var WebGLProgram = class extends Linkable {
|
|
|
9390
8482
|
}
|
|
9391
8483
|
};
|
|
9392
8484
|
|
|
9393
|
-
// ../../../packages/
|
|
8485
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-renderbuffer.js
|
|
9394
8486
|
init_console_gjs();
|
|
9395
|
-
|
|
8487
|
+
init_auto_globals_97a682e619();
|
|
9396
8488
|
var WebGLRenderbuffer = class extends Linkable {
|
|
9397
8489
|
constructor(_, ctx) {
|
|
9398
8490
|
super(_);
|
|
@@ -9413,9 +8505,9 @@ var WebGLRenderbuffer = class extends Linkable {
|
|
|
9413
8505
|
}
|
|
9414
8506
|
};
|
|
9415
8507
|
|
|
9416
|
-
// ../../../packages/
|
|
8508
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-shader.js
|
|
9417
8509
|
init_console_gjs();
|
|
9418
|
-
|
|
8510
|
+
init_auto_globals_97a682e619();
|
|
9419
8511
|
var WebGLShader = class extends Linkable {
|
|
9420
8512
|
constructor(_, ctx, type) {
|
|
9421
8513
|
super(_);
|
|
@@ -9436,9 +8528,9 @@ var WebGLShader = class extends Linkable {
|
|
|
9436
8528
|
}
|
|
9437
8529
|
};
|
|
9438
8530
|
|
|
9439
|
-
// ../../../packages/
|
|
8531
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-shader-precision-format.js
|
|
9440
8532
|
init_console_gjs();
|
|
9441
|
-
|
|
8533
|
+
init_auto_globals_97a682e619();
|
|
9442
8534
|
var WebGLShaderPrecisionFormat = class {
|
|
9443
8535
|
constructor(_) {
|
|
9444
8536
|
this.rangeMin = _.rangeMin;
|
|
@@ -9447,9 +8539,9 @@ var WebGLShaderPrecisionFormat = class {
|
|
|
9447
8539
|
}
|
|
9448
8540
|
};
|
|
9449
8541
|
|
|
9450
|
-
// ../../../packages/
|
|
8542
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-texture-unit.js
|
|
9451
8543
|
init_console_gjs();
|
|
9452
|
-
|
|
8544
|
+
init_auto_globals_97a682e619();
|
|
9453
8545
|
var WebGLTextureUnit = class {
|
|
9454
8546
|
constructor(ctx, idx) {
|
|
9455
8547
|
this._mode = 0;
|
|
@@ -9460,9 +8552,9 @@ var WebGLTextureUnit = class {
|
|
|
9460
8552
|
}
|
|
9461
8553
|
};
|
|
9462
8554
|
|
|
9463
|
-
// ../../../packages/
|
|
8555
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-texture.js
|
|
9464
8556
|
init_console_gjs();
|
|
9465
|
-
|
|
8557
|
+
init_auto_globals_97a682e619();
|
|
9466
8558
|
var WebGLTexture = class extends Linkable {
|
|
9467
8559
|
constructor(_, ctx) {
|
|
9468
8560
|
super(_);
|
|
@@ -9481,9 +8573,9 @@ var WebGLTexture = class extends Linkable {
|
|
|
9481
8573
|
}
|
|
9482
8574
|
};
|
|
9483
8575
|
|
|
9484
|
-
// ../../../packages/
|
|
8576
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-vertex-attribute.js
|
|
9485
8577
|
init_console_gjs();
|
|
9486
|
-
|
|
8578
|
+
init_auto_globals_97a682e619();
|
|
9487
8579
|
var WebGLVertexArrayObjectAttribute = class {
|
|
9488
8580
|
constructor(ctx, idx) {
|
|
9489
8581
|
this._isPointer = false;
|
|
@@ -9625,7 +8717,7 @@ var WebGLVertexArrayGlobalState = class {
|
|
|
9625
8717
|
}
|
|
9626
8718
|
};
|
|
9627
8719
|
|
|
9628
|
-
// ../../../packages/
|
|
8720
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
|
|
9629
8721
|
init_esm();
|
|
9630
8722
|
var VERSION = "0.0.1";
|
|
9631
8723
|
var CONTEXT_COUNTER = 0;
|
|
@@ -10417,9 +9509,9 @@ var WebGLContextBase = class {
|
|
|
10417
9509
|
const glArea = this.canvas.getGlArea();
|
|
10418
9510
|
const es = glArea.get_use_es();
|
|
10419
9511
|
const usesGlsl1Syntax = /\b(attribute|varying)\b/.test(source);
|
|
10420
|
-
const
|
|
10421
|
-
if (
|
|
10422
|
-
source = "#version " +
|
|
9512
|
+
const version = usesGlsl1Syntax ? es ? "100" : "120" : this._getGlslVersion(es);
|
|
9513
|
+
if (version) {
|
|
9514
|
+
source = "#version " + version + "\n" + preamble + source;
|
|
10423
9515
|
} else if (preamble) {
|
|
10424
9516
|
source = preamble + source;
|
|
10425
9517
|
}
|
|
@@ -12950,7 +12042,7 @@ var WebGLContextBase = class {
|
|
|
12950
12042
|
}
|
|
12951
12043
|
};
|
|
12952
12044
|
|
|
12953
|
-
// ../../../packages/
|
|
12045
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
|
|
12954
12046
|
var WebGLRenderingContext2 = class extends WebGLContextBase {
|
|
12955
12047
|
constructor(canvas, options = {}) {
|
|
12956
12048
|
super(canvas, options);
|
|
@@ -13133,14 +12225,14 @@ var WebGLRenderingContext2 = class extends WebGLContextBase {
|
|
|
13133
12225
|
}
|
|
13134
12226
|
};
|
|
13135
12227
|
|
|
13136
|
-
// ../../../packages/
|
|
12228
|
+
// ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
|
|
13137
12229
|
init_console_gjs();
|
|
13138
|
-
|
|
12230
|
+
init_auto_globals_97a682e619();
|
|
13139
12231
|
import GdkPixbuf4 from "gi://GdkPixbuf?version=2.0";
|
|
13140
12232
|
|
|
13141
|
-
// ../../../packages/
|
|
12233
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-query.js
|
|
13142
12234
|
init_console_gjs();
|
|
13143
|
-
|
|
12235
|
+
init_auto_globals_97a682e619();
|
|
13144
12236
|
var WebGLQuery = class extends Linkable {
|
|
13145
12237
|
constructor(_, ctx) {
|
|
13146
12238
|
super(_);
|
|
@@ -13153,9 +12245,9 @@ var WebGLQuery = class extends Linkable {
|
|
|
13153
12245
|
}
|
|
13154
12246
|
};
|
|
13155
12247
|
|
|
13156
|
-
// ../../../packages/
|
|
12248
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-sampler.js
|
|
13157
12249
|
init_console_gjs();
|
|
13158
|
-
|
|
12250
|
+
init_auto_globals_97a682e619();
|
|
13159
12251
|
var WebGLSampler = class extends Linkable {
|
|
13160
12252
|
constructor(_, ctx) {
|
|
13161
12253
|
super(_);
|
|
@@ -13168,9 +12260,9 @@ var WebGLSampler = class extends Linkable {
|
|
|
13168
12260
|
}
|
|
13169
12261
|
};
|
|
13170
12262
|
|
|
13171
|
-
// ../../../packages/
|
|
12263
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-sync.js
|
|
13172
12264
|
init_console_gjs();
|
|
13173
|
-
|
|
12265
|
+
init_auto_globals_97a682e619();
|
|
13174
12266
|
var WebGLSync = class extends Linkable {
|
|
13175
12267
|
constructor(_, ctx) {
|
|
13176
12268
|
super(_);
|
|
@@ -13183,9 +12275,9 @@ var WebGLSync = class extends Linkable {
|
|
|
13183
12275
|
}
|
|
13184
12276
|
};
|
|
13185
12277
|
|
|
13186
|
-
// ../../../packages/
|
|
12278
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-transform-feedback.js
|
|
13187
12279
|
init_console_gjs();
|
|
13188
|
-
|
|
12280
|
+
init_auto_globals_97a682e619();
|
|
13189
12281
|
var WebGLTransformFeedback = class extends Linkable {
|
|
13190
12282
|
constructor(_, ctx) {
|
|
13191
12283
|
super(_);
|
|
@@ -13198,9 +12290,9 @@ var WebGLTransformFeedback = class extends Linkable {
|
|
|
13198
12290
|
}
|
|
13199
12291
|
};
|
|
13200
12292
|
|
|
13201
|
-
// ../../../packages/
|
|
12293
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-vertex-array-object.js
|
|
13202
12294
|
init_console_gjs();
|
|
13203
|
-
|
|
12295
|
+
init_auto_globals_97a682e619();
|
|
13204
12296
|
var WebGLVertexArrayObject = class extends Linkable {
|
|
13205
12297
|
constructor(_, ctx) {
|
|
13206
12298
|
super(_);
|
|
@@ -13218,7 +12310,7 @@ var WebGLVertexArrayObject = class extends Linkable {
|
|
|
13218
12310
|
}
|
|
13219
12311
|
};
|
|
13220
12312
|
|
|
13221
|
-
// ../../../packages/
|
|
12313
|
+
// ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
|
|
13222
12314
|
init_esm();
|
|
13223
12315
|
var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextBase {
|
|
13224
12316
|
constructor(canvas, options = {}) {
|
|
@@ -14028,8 +13120,18 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14028
13120
|
this._native2.vertexAttribIPointer(index, size, type, stride, offset);
|
|
14029
13121
|
}
|
|
14030
13122
|
drawBuffers(buffers) {
|
|
14031
|
-
|
|
14032
|
-
|
|
13123
|
+
let hasBack = false;
|
|
13124
|
+
for (let i = 0; i < buffers.length; i++) {
|
|
13125
|
+
if (buffers[i] === 1029) {
|
|
13126
|
+
hasBack = true;
|
|
13127
|
+
break;
|
|
13128
|
+
}
|
|
13129
|
+
}
|
|
13130
|
+
if (!hasBack) {
|
|
13131
|
+
this._native2.drawBuffers(buffers);
|
|
13132
|
+
return;
|
|
13133
|
+
}
|
|
13134
|
+
this._native2.drawBuffers(buffers.map((b) => b === 1029 ? this.COLOR_ATTACHMENT0 : b));
|
|
14033
13135
|
}
|
|
14034
13136
|
drawRangeElements(mode, start2, end, count2, type, offset) {
|
|
14035
13137
|
if (count2 < 0 || offset < 0) {
|
|
@@ -14126,10 +13228,10 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14126
13228
|
void drawbuffer;
|
|
14127
13229
|
}
|
|
14128
13230
|
invalidateFramebuffer(target, attachments) {
|
|
14129
|
-
this._native2.invalidateFramebuffer(target,
|
|
13231
|
+
this._native2.invalidateFramebuffer(target, attachments);
|
|
14130
13232
|
}
|
|
14131
13233
|
invalidateSubFramebuffer(target, attachments, x, y, width, height) {
|
|
14132
|
-
this._native2.invalidateSubFramebuffer(target,
|
|
13234
|
+
this._native2.invalidateSubFramebuffer(target, attachments, x, y, width, height);
|
|
14133
13235
|
}
|
|
14134
13236
|
readBuffer(src) {
|
|
14135
13237
|
this._native2.readBuffer(src);
|
|
@@ -14173,53 +13275,53 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14173
13275
|
uniform1uiv(location, data, _srcOffset, _srcLength) {
|
|
14174
13276
|
if (!location) return;
|
|
14175
13277
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14176
|
-
this._native2.uniform1uiv(location._, arr.length,
|
|
13278
|
+
this._native2.uniform1uiv(location._, arr.length, arr);
|
|
14177
13279
|
}
|
|
14178
13280
|
uniform2uiv(location, data, _srcOffset, _srcLength) {
|
|
14179
13281
|
if (!location) return;
|
|
14180
13282
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14181
|
-
this._native2.uniform2uiv(location._, arr.length / 2,
|
|
13283
|
+
this._native2.uniform2uiv(location._, arr.length / 2, arr);
|
|
14182
13284
|
}
|
|
14183
13285
|
uniform3uiv(location, data, _srcOffset, _srcLength) {
|
|
14184
13286
|
if (!location) return;
|
|
14185
13287
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14186
|
-
this._native2.uniform3uiv(location._, arr.length / 3,
|
|
13288
|
+
this._native2.uniform3uiv(location._, arr.length / 3, arr);
|
|
14187
13289
|
}
|
|
14188
13290
|
uniform4uiv(location, data, _srcOffset, _srcLength) {
|
|
14189
13291
|
if (!location) return;
|
|
14190
13292
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14191
|
-
this._native2.uniform4uiv(location._, arr.length / 4,
|
|
13293
|
+
this._native2.uniform4uiv(location._, arr.length / 4, arr);
|
|
14192
13294
|
}
|
|
14193
13295
|
// ─── Non-square Matrix Uniforms ───────────────────────────────────────
|
|
14194
13296
|
uniformMatrix2x3fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14195
13297
|
if (!location) return;
|
|
14196
13298
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14197
|
-
this._native2.uniformMatrix2x3fv(location._, transpose,
|
|
13299
|
+
this._native2.uniformMatrix2x3fv(location._, transpose, arr);
|
|
14198
13300
|
}
|
|
14199
13301
|
uniformMatrix3x2fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14200
13302
|
if (!location) return;
|
|
14201
13303
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14202
|
-
this._native2.uniformMatrix3x2fv(location._, transpose,
|
|
13304
|
+
this._native2.uniformMatrix3x2fv(location._, transpose, arr);
|
|
14203
13305
|
}
|
|
14204
13306
|
uniformMatrix2x4fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14205
13307
|
if (!location) return;
|
|
14206
13308
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14207
|
-
this._native2.uniformMatrix2x4fv(location._, transpose,
|
|
13309
|
+
this._native2.uniformMatrix2x4fv(location._, transpose, arr);
|
|
14208
13310
|
}
|
|
14209
13311
|
uniformMatrix4x2fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14210
13312
|
if (!location) return;
|
|
14211
13313
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14212
|
-
this._native2.uniformMatrix4x2fv(location._, transpose,
|
|
13314
|
+
this._native2.uniformMatrix4x2fv(location._, transpose, arr);
|
|
14213
13315
|
}
|
|
14214
13316
|
uniformMatrix3x4fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14215
13317
|
if (!location) return;
|
|
14216
13318
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14217
|
-
this._native2.uniformMatrix3x4fv(location._, transpose,
|
|
13319
|
+
this._native2.uniformMatrix3x4fv(location._, transpose, arr);
|
|
14218
13320
|
}
|
|
14219
13321
|
uniformMatrix4x3fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14220
13322
|
if (!location) return;
|
|
14221
13323
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14222
|
-
this._native2.uniformMatrix4x3fv(location._, transpose,
|
|
13324
|
+
this._native2.uniformMatrix4x3fv(location._, transpose, arr);
|
|
14223
13325
|
}
|
|
14224
13326
|
// ─── getUniform — WebGL2 uint type support ────────────────────────────
|
|
14225
13327
|
/** WebGL1 getUniform falls to default:null for UNSIGNED_INT types. Handle them here. */
|
|
@@ -14474,16 +13576,16 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14474
13576
|
}
|
|
14475
13577
|
};
|
|
14476
13578
|
|
|
14477
|
-
// ../../../packages/
|
|
13579
|
+
// ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
|
|
14478
13580
|
init_console_gjs();
|
|
14479
|
-
|
|
13581
|
+
init_auto_globals_97a682e619();
|
|
14480
13582
|
|
|
14481
13583
|
// ../../../packages/dom/dom-elements/lib/esm/index.js
|
|
14482
13584
|
init_console_gjs();
|
|
14483
|
-
|
|
13585
|
+
init_auto_globals_97a682e619();
|
|
14484
13586
|
init_html_canvas_element();
|
|
14485
13587
|
|
|
14486
|
-
// ../../../packages/
|
|
13588
|
+
// ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
|
|
14487
13589
|
var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
|
|
14488
13590
|
constructor(gtkGlArea) {
|
|
14489
13591
|
super();
|
|
@@ -14544,27 +13646,27 @@ var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
|
|
|
14544
13646
|
}
|
|
14545
13647
|
};
|
|
14546
13648
|
|
|
14547
|
-
// ../../../packages/
|
|
13649
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
|
|
14548
13650
|
init_console_gjs();
|
|
14549
|
-
|
|
13651
|
+
init_auto_globals_97a682e619();
|
|
14550
13652
|
import GObject from "gi://GObject";
|
|
14551
13653
|
import GLib2 from "gi://GLib?version=2.0";
|
|
14552
13654
|
import Gtk3 from "gi://Gtk?version=4.0";
|
|
14553
13655
|
|
|
14554
|
-
// ../../../packages/
|
|
13656
|
+
// ../../../packages/framework/event-bridge/lib/esm/index.js
|
|
14555
13657
|
init_console_gjs();
|
|
14556
|
-
|
|
13658
|
+
init_auto_globals_97a682e619();
|
|
14557
13659
|
|
|
14558
|
-
// ../../../packages/
|
|
13660
|
+
// ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
|
|
14559
13661
|
init_console_gjs();
|
|
14560
|
-
|
|
13662
|
+
init_auto_globals_97a682e619();
|
|
14561
13663
|
init_esm4();
|
|
14562
13664
|
import Gtk2 from "gi://Gtk?version=4.0";
|
|
14563
13665
|
import Gdk4 from "gi://Gdk?version=4.0";
|
|
14564
13666
|
|
|
14565
|
-
// ../../../packages/
|
|
13667
|
+
// ../../../packages/framework/event-bridge/lib/esm/key-map.js
|
|
14566
13668
|
init_console_gjs();
|
|
14567
|
-
|
|
13669
|
+
init_auto_globals_97a682e619();
|
|
14568
13670
|
import Gdk3 from "gi://Gdk?version=4.0";
|
|
14569
13671
|
var SPECIAL_KEYS = {
|
|
14570
13672
|
Return: "Enter",
|
|
@@ -14753,7 +13855,7 @@ function gdkKeyvalToLocation(keyval) {
|
|
|
14753
13855
|
return 0;
|
|
14754
13856
|
}
|
|
14755
13857
|
|
|
14756
|
-
// ../../../packages/
|
|
13858
|
+
// ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
|
|
14757
13859
|
function extractModifiers(controller) {
|
|
14758
13860
|
const mods = controller.get_current_event_state();
|
|
14759
13861
|
return {
|
|
@@ -14939,7 +14041,7 @@ function attachEventControllers(widget, getElement, options) {
|
|
|
14939
14041
|
widget.add_controller(focusCtrl);
|
|
14940
14042
|
}
|
|
14941
14043
|
|
|
14942
|
-
// ../../../packages/
|
|
14044
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
|
|
14943
14045
|
init_esm4();
|
|
14944
14046
|
var WebGLBridge = GObject.registerClass(
|
|
14945
14047
|
{ GTypeName: "GjsifyWebGLBridge" },
|
|
@@ -14958,6 +14060,12 @@ var WebGLBridge = GObject.registerClass(
|
|
|
14958
14060
|
this.set_has_depth_buffer(true);
|
|
14959
14061
|
this.set_has_stencil_buffer(true);
|
|
14960
14062
|
attachEventControllers(this, () => this._canvas, { captureKeys: true });
|
|
14063
|
+
this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
|
|
14064
|
+
if (this._frameCallback !== null) {
|
|
14065
|
+
this.queue_render();
|
|
14066
|
+
}
|
|
14067
|
+
return GLib2.SOURCE_CONTINUE;
|
|
14068
|
+
});
|
|
14961
14069
|
const initId = this.connect("render", () => {
|
|
14962
14070
|
this.disconnect(initId);
|
|
14963
14071
|
this.make_current();
|
|
@@ -14973,6 +14081,18 @@ var WebGLBridge = GObject.registerClass(
|
|
|
14973
14081
|
}
|
|
14974
14082
|
this._readyCallbacks = [];
|
|
14975
14083
|
}
|
|
14084
|
+
this._renderTag = this.connect("render", (_widget) => {
|
|
14085
|
+
if (this._frameCallback !== null) {
|
|
14086
|
+
const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
|
|
14087
|
+
if (globalThis.__GJSIFY_DEBUG_RAF === true) {
|
|
14088
|
+
console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
|
|
14089
|
+
}
|
|
14090
|
+
const cb = this._frameCallback;
|
|
14091
|
+
this._frameCallback = null;
|
|
14092
|
+
cb(time2);
|
|
14093
|
+
}
|
|
14094
|
+
return true;
|
|
14095
|
+
});
|
|
14976
14096
|
return true;
|
|
14977
14097
|
});
|
|
14978
14098
|
this.connect("resize", () => {
|
|
@@ -15036,30 +14156,13 @@ var WebGLBridge = GObject.registerClass(
|
|
|
15036
14156
|
}
|
|
15037
14157
|
/**
|
|
15038
14158
|
* Schedules a single animation frame callback, matching the browser `requestAnimationFrame` API.
|
|
15039
|
-
* Backed by GTK frame clock (vsync-synced) +
|
|
15040
|
-
*
|
|
14159
|
+
* Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
|
|
14160
|
+
* render signal handler. Both are installed once at construction / first render respectively,
|
|
14161
|
+
* eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
|
|
14162
|
+
* Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
|
|
15041
14163
|
*/
|
|
15042
14164
|
requestAnimationFrame(cb) {
|
|
15043
14165
|
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
14166
|
this.queue_render();
|
|
15064
14167
|
return 0;
|
|
15065
14168
|
}
|
|
@@ -15081,22 +14184,22 @@ var WebGLBridge = GObject.registerClass(
|
|
|
15081
14184
|
}
|
|
15082
14185
|
);
|
|
15083
14186
|
|
|
15084
|
-
// ../../../packages/
|
|
14187
|
+
// ../../../packages/framework/webgl/lib/esm/index.js
|
|
15085
14188
|
globalThis.WebGLRenderingContext = WebGLRenderingContext2;
|
|
15086
14189
|
globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
15087
14190
|
|
|
15088
14191
|
// src/three-demo.ts
|
|
15089
14192
|
init_console_gjs();
|
|
15090
|
-
|
|
14193
|
+
init_auto_globals_97a682e619();
|
|
15091
14194
|
|
|
15092
14195
|
// ../../../node_modules/three/build/three.module.js
|
|
15093
14196
|
init_console_gjs();
|
|
15094
|
-
|
|
14197
|
+
init_auto_globals_97a682e619();
|
|
15095
14198
|
|
|
15096
14199
|
// ../../../node_modules/three/build/three.core.js
|
|
15097
14200
|
init_console_gjs();
|
|
15098
|
-
|
|
15099
|
-
var REVISION = "
|
|
14201
|
+
init_auto_globals_97a682e619();
|
|
14202
|
+
var REVISION = "184";
|
|
15100
14203
|
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
15101
14204
|
var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
15102
14205
|
var CullFaceNone = 0;
|
|
@@ -15820,6 +14923,9 @@ var MathUtils = {
|
|
|
15820
14923
|
denormalize
|
|
15821
14924
|
};
|
|
15822
14925
|
var Vector2 = class _Vector2 {
|
|
14926
|
+
static {
|
|
14927
|
+
_Vector2.prototype.isVector2 = true;
|
|
14928
|
+
}
|
|
15823
14929
|
/**
|
|
15824
14930
|
* Constructs a new 2D vector.
|
|
15825
14931
|
*
|
|
@@ -15827,7 +14933,6 @@ var Vector2 = class _Vector2 {
|
|
|
15827
14933
|
* @param {number} [y=0] - The y value of this vector.
|
|
15828
14934
|
*/
|
|
15829
14935
|
constructor(x = 0, y = 0) {
|
|
15830
|
-
_Vector2.prototype.isVector2 = true;
|
|
15831
14936
|
this.x = x;
|
|
15832
14937
|
this.y = y;
|
|
15833
14938
|
}
|
|
@@ -17045,6 +16150,9 @@ var Quaternion = class {
|
|
|
17045
16150
|
}
|
|
17046
16151
|
};
|
|
17047
16152
|
var Vector3 = class _Vector3 {
|
|
16153
|
+
static {
|
|
16154
|
+
_Vector3.prototype.isVector3 = true;
|
|
16155
|
+
}
|
|
17048
16156
|
/**
|
|
17049
16157
|
* Constructs a new 3D vector.
|
|
17050
16158
|
*
|
|
@@ -17053,7 +16161,6 @@ var Vector3 = class _Vector3 {
|
|
|
17053
16161
|
* @param {number} [z=0] - The z value of this vector.
|
|
17054
16162
|
*/
|
|
17055
16163
|
constructor(x = 0, y = 0, z = 0) {
|
|
17056
|
-
_Vector3.prototype.isVector3 = true;
|
|
17057
16164
|
this.x = x;
|
|
17058
16165
|
this.y = y;
|
|
17059
16166
|
this.z = z;
|
|
@@ -17951,6 +17058,9 @@ var Vector3 = class _Vector3 {
|
|
|
17951
17058
|
var _vector$c = /* @__PURE__ */ new Vector3();
|
|
17952
17059
|
var _quaternion$5 = /* @__PURE__ */ new Quaternion();
|
|
17953
17060
|
var Matrix3 = class _Matrix3 {
|
|
17061
|
+
static {
|
|
17062
|
+
_Matrix3.prototype.isMatrix3 = true;
|
|
17063
|
+
}
|
|
17954
17064
|
/**
|
|
17955
17065
|
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
17956
17066
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -17967,7 +17077,6 @@ var Matrix3 = class _Matrix3 {
|
|
|
17967
17077
|
* @param {number} [n33] - 3-3 matrix element.
|
|
17968
17078
|
*/
|
|
17969
17079
|
constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
|
|
17970
|
-
_Matrix3.prototype.isMatrix3 = true;
|
|
17971
17080
|
this.elements = [
|
|
17972
17081
|
1,
|
|
17973
17082
|
0,
|
|
@@ -18667,7 +17776,7 @@ var Source = class {
|
|
|
18667
17776
|
if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
|
|
18668
17777
|
target.set(data.videoWidth, data.videoHeight, 0);
|
|
18669
17778
|
} else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
|
|
18670
|
-
target.set(data.
|
|
17779
|
+
target.set(data.displayWidth, data.displayHeight, 0);
|
|
18671
17780
|
} else if (data !== null) {
|
|
18672
17781
|
target.set(data.width, data.height, data.depth || 0);
|
|
18673
17782
|
} else {
|
|
@@ -18797,6 +17906,7 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18797
17906
|
this.isRenderTargetTexture = false;
|
|
18798
17907
|
this.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;
|
|
18799
17908
|
this.pmremVersion = 0;
|
|
17909
|
+
this.normalized = false;
|
|
18800
17910
|
}
|
|
18801
17911
|
/**
|
|
18802
17912
|
* The width of the texture in pixels.
|
|
@@ -18824,11 +17934,11 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18824
17934
|
get image() {
|
|
18825
17935
|
return this.source.data;
|
|
18826
17936
|
}
|
|
18827
|
-
set image(value2
|
|
17937
|
+
set image(value2) {
|
|
18828
17938
|
this.source.data = value2;
|
|
18829
17939
|
}
|
|
18830
17940
|
/**
|
|
18831
|
-
* Updates the texture transformation matrix from the
|
|
17941
|
+
* Updates the texture transformation matrix from the properties {@link Texture#offset},
|
|
18832
17942
|
* {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.
|
|
18833
17943
|
*/
|
|
18834
17944
|
updateMatrix() {
|
|
@@ -18877,6 +17987,7 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18877
17987
|
this.format = source.format;
|
|
18878
17988
|
this.internalFormat = source.internalFormat;
|
|
18879
17989
|
this.type = source.type;
|
|
17990
|
+
this.normalized = source.normalized;
|
|
18880
17991
|
this.offset.copy(source.offset);
|
|
18881
17992
|
this.repeat.copy(source.repeat);
|
|
18882
17993
|
this.center.copy(source.center);
|
|
@@ -18953,6 +18064,7 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18953
18064
|
format: this.format,
|
|
18954
18065
|
internalFormat: this.internalFormat,
|
|
18955
18066
|
type: this.type,
|
|
18067
|
+
normalized: this.normalized,
|
|
18956
18068
|
colorSpace: this.colorSpace,
|
|
18957
18069
|
minFilter: this.minFilter,
|
|
18958
18070
|
magFilter: this.magFilter,
|
|
@@ -19058,6 +18170,9 @@ Texture.DEFAULT_IMAGE = null;
|
|
|
19058
18170
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
19059
18171
|
Texture.DEFAULT_ANISOTROPY = 1;
|
|
19060
18172
|
var Vector4 = class _Vector4 {
|
|
18173
|
+
static {
|
|
18174
|
+
_Vector4.prototype.isVector4 = true;
|
|
18175
|
+
}
|
|
19061
18176
|
/**
|
|
19062
18177
|
* Constructs a new 4D vector.
|
|
19063
18178
|
*
|
|
@@ -19067,7 +18182,6 @@ var Vector4 = class _Vector4 {
|
|
|
19067
18182
|
* @param {number} [w=1] - The w value of this vector.
|
|
19068
18183
|
*/
|
|
19069
18184
|
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
19070
|
-
_Vector4.prototype.isVector4 = true;
|
|
19071
18185
|
this.x = x;
|
|
19072
18186
|
this.y = y;
|
|
19073
18187
|
this.z = z;
|
|
@@ -19975,6 +19089,7 @@ var RenderTarget = class extends EventDispatcher {
|
|
|
19975
19089
|
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
19976
19090
|
if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
|
|
19977
19091
|
this.samples = source.samples;
|
|
19092
|
+
this.multiview = source.multiview;
|
|
19978
19093
|
return this;
|
|
19979
19094
|
}
|
|
19980
19095
|
/**
|
|
@@ -20062,6 +19177,9 @@ var Data3DTexture = class extends Texture {
|
|
|
20062
19177
|
}
|
|
20063
19178
|
};
|
|
20064
19179
|
var Matrix4 = class _Matrix4 {
|
|
19180
|
+
static {
|
|
19181
|
+
_Matrix4.prototype.isMatrix4 = true;
|
|
19182
|
+
}
|
|
20065
19183
|
/**
|
|
20066
19184
|
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
20067
19185
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -20085,7 +19203,6 @@ var Matrix4 = class _Matrix4 {
|
|
|
20085
19203
|
* @param {number} [n44] - 4-4 matrix element.
|
|
20086
19204
|
*/
|
|
20087
19205
|
constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
|
|
20088
|
-
_Matrix4.prototype.isMatrix4 = true;
|
|
20089
19206
|
this.elements = [
|
|
20090
19207
|
1,
|
|
20091
19208
|
0,
|
|
@@ -22448,9 +21565,7 @@ var Object3D = class _Object3D extends EventDispatcher {
|
|
|
22448
21565
|
this.rotation.order = source.rotation.order;
|
|
22449
21566
|
this.quaternion.copy(source.quaternion);
|
|
22450
21567
|
this.scale.copy(source.scale);
|
|
22451
|
-
|
|
22452
|
-
this.pivot = source.pivot.clone();
|
|
22453
|
-
}
|
|
21568
|
+
this.pivot = source.pivot !== null ? source.pivot.clone() : null;
|
|
22454
21569
|
this.matrix.copy(source.matrix);
|
|
22455
21570
|
this.matrixWorld.copy(source.matrixWorld);
|
|
22456
21571
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
@@ -22540,6 +21655,7 @@ var WebXRController = class {
|
|
|
22540
21655
|
this._grip.linearVelocity = new Vector3();
|
|
22541
21656
|
this._grip.hasAngularVelocity = false;
|
|
22542
21657
|
this._grip.angularVelocity = new Vector3();
|
|
21658
|
+
this._grip.eventsEnabled = false;
|
|
22543
21659
|
}
|
|
22544
21660
|
return this._grip;
|
|
22545
21661
|
}
|
|
@@ -22669,6 +21785,13 @@ var WebXRController = class {
|
|
|
22669
21785
|
} else {
|
|
22670
21786
|
grip.hasAngularVelocity = false;
|
|
22671
21787
|
}
|
|
21788
|
+
if (grip.eventsEnabled) {
|
|
21789
|
+
grip.dispatchEvent({
|
|
21790
|
+
type: "gripUpdated",
|
|
21791
|
+
data: inputSource,
|
|
21792
|
+
target: this
|
|
21793
|
+
});
|
|
21794
|
+
}
|
|
22672
21795
|
}
|
|
22673
21796
|
}
|
|
22674
21797
|
}
|
|
@@ -23681,7 +22804,7 @@ var Triangle = class _Triangle {
|
|
|
23681
22804
|
static isFrontFacing(a, b, c, direction) {
|
|
23682
22805
|
_v0$2.subVectors(c, b);
|
|
23683
22806
|
_v1$5.subVectors(a, b);
|
|
23684
|
-
return _v0$2.cross(_v1$5).dot(direction) < 0
|
|
22807
|
+
return _v0$2.cross(_v1$5).dot(direction) < 0;
|
|
23685
22808
|
}
|
|
23686
22809
|
/**
|
|
23687
22810
|
* Sets the triangle's vertices by copying the given values.
|
|
@@ -24442,7 +23565,7 @@ function satForAxes(axes, v0, v1, v2, extents) {
|
|
|
24442
23565
|
var _vector$a = /* @__PURE__ */ new Vector3();
|
|
24443
23566
|
var _vector2$1 = /* @__PURE__ */ new Vector2();
|
|
24444
23567
|
var _id$2 = 0;
|
|
24445
|
-
var BufferAttribute = class {
|
|
23568
|
+
var BufferAttribute = class extends EventDispatcher {
|
|
24446
23569
|
/**
|
|
24447
23570
|
* Constructs a new buffer attribute.
|
|
24448
23571
|
*
|
|
@@ -24451,6 +23574,7 @@ var BufferAttribute = class {
|
|
|
24451
23574
|
* @param {boolean} [normalized=false] - Whether the data are normalized or not.
|
|
24452
23575
|
*/
|
|
24453
23576
|
constructor(array, itemSize, normalized = false) {
|
|
23577
|
+
super();
|
|
24454
23578
|
if (Array.isArray(array)) {
|
|
24455
23579
|
throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
|
|
24456
23580
|
}
|
|
@@ -24847,6 +23971,12 @@ var BufferAttribute = class {
|
|
|
24847
23971
|
if (this.usage !== StaticDrawUsage) data.usage = this.usage;
|
|
24848
23972
|
return data;
|
|
24849
23973
|
}
|
|
23974
|
+
/**
|
|
23975
|
+
* Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
|
|
23976
|
+
*/
|
|
23977
|
+
dispose() {
|
|
23978
|
+
this.dispatchEvent({ type: "dispose" });
|
|
23979
|
+
}
|
|
24850
23980
|
};
|
|
24851
23981
|
var Uint16BufferAttribute = class extends BufferAttribute {
|
|
24852
23982
|
/**
|
|
@@ -27201,9 +26331,10 @@ var Plane = class {
|
|
|
27201
26331
|
*
|
|
27202
26332
|
* @param {Line3} line - The line to compute the intersection for.
|
|
27203
26333
|
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
27204
|
-
* @
|
|
26334
|
+
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
26335
|
+
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
27205
26336
|
*/
|
|
27206
|
-
intersectLine(line, target) {
|
|
26337
|
+
intersectLine(line, target, clampToLine = true) {
|
|
27207
26338
|
const direction = line.delta(_vector1);
|
|
27208
26339
|
const denominator = this.normal.dot(direction);
|
|
27209
26340
|
if (denominator === 0) {
|
|
@@ -27213,7 +26344,7 @@ var Plane = class {
|
|
|
27213
26344
|
return null;
|
|
27214
26345
|
}
|
|
27215
26346
|
const t = -(line.start.dot(this.normal) + this.constant) / denominator;
|
|
27216
|
-
if (t < 0 || t > 1) {
|
|
26347
|
+
if (clampToLine === true && (t < 0 || t > 1)) {
|
|
27217
26348
|
return null;
|
|
27218
26349
|
}
|
|
27219
26350
|
return target.copy(line.start).addScaledVector(direction, t);
|
|
@@ -28105,7 +27236,7 @@ function cloneUniforms(src) {
|
|
|
28105
27236
|
dst[u] = {};
|
|
28106
27237
|
for (const p in src[u]) {
|
|
28107
27238
|
const property = src[u][p];
|
|
28108
|
-
if (
|
|
27239
|
+
if (isThreeObject(property)) {
|
|
28109
27240
|
if (property.isRenderTargetTexture) {
|
|
28110
27241
|
warn2("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
|
|
28111
27242
|
dst[u][p] = null;
|
|
@@ -28113,7 +27244,15 @@ function cloneUniforms(src) {
|
|
|
28113
27244
|
dst[u][p] = property.clone();
|
|
28114
27245
|
}
|
|
28115
27246
|
} else if (Array.isArray(property)) {
|
|
28116
|
-
|
|
27247
|
+
if (isThreeObject(property[0])) {
|
|
27248
|
+
const clonedProperty = [];
|
|
27249
|
+
for (let i = 0, l = property.length; i < l; i++) {
|
|
27250
|
+
clonedProperty[i] = property[i].clone();
|
|
27251
|
+
}
|
|
27252
|
+
dst[u][p] = clonedProperty;
|
|
27253
|
+
} else {
|
|
27254
|
+
dst[u][p] = property.slice();
|
|
27255
|
+
}
|
|
28117
27256
|
} else {
|
|
28118
27257
|
dst[u][p] = property;
|
|
28119
27258
|
}
|
|
@@ -28131,6 +27270,9 @@ function mergeUniforms(uniforms) {
|
|
|
28131
27270
|
}
|
|
28132
27271
|
return merged;
|
|
28133
27272
|
}
|
|
27273
|
+
function isThreeObject(property) {
|
|
27274
|
+
return property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion);
|
|
27275
|
+
}
|
|
28134
27276
|
function cloneUniformsGroups(src) {
|
|
28135
27277
|
const dst = [];
|
|
28136
27278
|
for (let u = 0; u < src.length; u++) {
|
|
@@ -28989,10 +28131,10 @@ var KeyframeTrack = class {
|
|
|
28989
28131
|
* @param {number} endTime - The end time.
|
|
28990
28132
|
* @return {KeyframeTrack} A reference to this keyframe track.
|
|
28991
28133
|
*/
|
|
28992
|
-
trim(
|
|
28134
|
+
trim(startTime, endTime) {
|
|
28993
28135
|
const times = this.times, nKeys = times.length;
|
|
28994
28136
|
let from = 0, to = nKeys - 1;
|
|
28995
|
-
while (from !== nKeys && times[from] <
|
|
28137
|
+
while (from !== nKeys && times[from] < startTime) {
|
|
28996
28138
|
++from;
|
|
28997
28139
|
}
|
|
28998
28140
|
while (to !== -1 && times[to] > endTime) {
|
|
@@ -31203,6 +30345,77 @@ var Spherical = class {
|
|
|
31203
30345
|
return new this.constructor().copy(this);
|
|
31204
30346
|
}
|
|
31205
30347
|
};
|
|
30348
|
+
var Matrix2 = class _Matrix2 {
|
|
30349
|
+
static {
|
|
30350
|
+
_Matrix2.prototype.isMatrix2 = true;
|
|
30351
|
+
}
|
|
30352
|
+
/**
|
|
30353
|
+
* Constructs a new 2x2 matrix. The arguments are supposed to be
|
|
30354
|
+
* in row-major order. If no arguments are provided, the constructor
|
|
30355
|
+
* initializes the matrix as an identity matrix.
|
|
30356
|
+
*
|
|
30357
|
+
* @param {number} [n11] - 1-1 matrix element.
|
|
30358
|
+
* @param {number} [n12] - 1-2 matrix element.
|
|
30359
|
+
* @param {number} [n21] - 2-1 matrix element.
|
|
30360
|
+
* @param {number} [n22] - 2-2 matrix element.
|
|
30361
|
+
*/
|
|
30362
|
+
constructor(n11, n12, n21, n22) {
|
|
30363
|
+
this.elements = [
|
|
30364
|
+
1,
|
|
30365
|
+
0,
|
|
30366
|
+
0,
|
|
30367
|
+
1
|
|
30368
|
+
];
|
|
30369
|
+
if (n11 !== void 0) {
|
|
30370
|
+
this.set(n11, n12, n21, n22);
|
|
30371
|
+
}
|
|
30372
|
+
}
|
|
30373
|
+
/**
|
|
30374
|
+
* Sets this matrix to the 2x2 identity matrix.
|
|
30375
|
+
*
|
|
30376
|
+
* @return {Matrix2} A reference to this matrix.
|
|
30377
|
+
*/
|
|
30378
|
+
identity() {
|
|
30379
|
+
this.set(
|
|
30380
|
+
1,
|
|
30381
|
+
0,
|
|
30382
|
+
0,
|
|
30383
|
+
1
|
|
30384
|
+
);
|
|
30385
|
+
return this;
|
|
30386
|
+
}
|
|
30387
|
+
/**
|
|
30388
|
+
* Sets the elements of the matrix from the given array.
|
|
30389
|
+
*
|
|
30390
|
+
* @param {Array<number>} array - The matrix elements in column-major order.
|
|
30391
|
+
* @param {number} [offset=0] - Index of the first element in the array.
|
|
30392
|
+
* @return {Matrix2} A reference to this matrix.
|
|
30393
|
+
*/
|
|
30394
|
+
fromArray(array, offset = 0) {
|
|
30395
|
+
for (let i = 0; i < 4; i++) {
|
|
30396
|
+
this.elements[i] = array[i + offset];
|
|
30397
|
+
}
|
|
30398
|
+
return this;
|
|
30399
|
+
}
|
|
30400
|
+
/**
|
|
30401
|
+
* Sets the elements of the matrix.The arguments are supposed to be
|
|
30402
|
+
* in row-major order.
|
|
30403
|
+
*
|
|
30404
|
+
* @param {number} n11 - 1-1 matrix element.
|
|
30405
|
+
* @param {number} n12 - 1-2 matrix element.
|
|
30406
|
+
* @param {number} n21 - 2-1 matrix element.
|
|
30407
|
+
* @param {number} n22 - 2-2 matrix element.
|
|
30408
|
+
* @return {Matrix2} A reference to this matrix.
|
|
30409
|
+
*/
|
|
30410
|
+
set(n11, n12, n21, n22) {
|
|
30411
|
+
const te = this.elements;
|
|
30412
|
+
te[0] = n11;
|
|
30413
|
+
te[2] = n12;
|
|
30414
|
+
te[1] = n21;
|
|
30415
|
+
te[3] = n22;
|
|
30416
|
+
return this;
|
|
30417
|
+
}
|
|
30418
|
+
};
|
|
31206
30419
|
var Controls = class extends EventDispatcher {
|
|
31207
30420
|
/**
|
|
31208
30421
|
* Constructs a new controls instance.
|
|
@@ -31393,11 +30606,12 @@ function WebGLAnimation() {
|
|
|
31393
30606
|
start: function() {
|
|
31394
30607
|
if (isAnimating === true) return;
|
|
31395
30608
|
if (animationLoop === null) return;
|
|
30609
|
+
if (context === null) return;
|
|
31396
30610
|
requestId = context.requestAnimationFrame(onAnimationFrame);
|
|
31397
30611
|
isAnimating = true;
|
|
31398
30612
|
},
|
|
31399
30613
|
stop: function() {
|
|
31400
|
-
context.cancelAnimationFrame(requestId);
|
|
30614
|
+
if (context !== null) context.cancelAnimationFrame(requestId);
|
|
31401
30615
|
isAnimating = false;
|
|
31402
30616
|
},
|
|
31403
30617
|
setAnimationLoop: function(callback) {
|
|
@@ -31564,8 +30778,8 @@ var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = textur
|
|
|
31564
30778
|
var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif";
|
|
31565
30779
|
var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
31566
30780
|
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 *
|
|
31568
|
-
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform
|
|
30781
|
+
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";
|
|
30782
|
+
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
30783
|
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
30784
|
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
30785
|
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 +30791,18 @@ var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D grad
|
|
|
31577
30791
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
|
|
31578
30792
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
31579
30793
|
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";
|
|
30794
|
+
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
30795
|
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
30796
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
31583
30797
|
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
30798
|
var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
|
|
31585
30799
|
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
30800
|
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";
|
|
30801
|
+
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}";
|
|
30802
|
+
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
30803
|
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
30804
|
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";
|
|
30805
|
+
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
30806
|
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
30807
|
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
30808
|
var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
@@ -31604,7 +30819,7 @@ var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetB
|
|
|
31604
30819
|
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
30820
|
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
30821
|
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";
|
|
30822
|
+
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
30823
|
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
30824
|
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
30825
|
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 +30838,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
31623
30838
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
|
|
31624
30839
|
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
30840
|
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";
|
|
30841
|
+
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
30842
|
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
30843
|
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
30844
|
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 +30857,7 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defin
|
|
|
31642
30857
|
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
30858
|
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
30859
|
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
|
|
30860
|
+
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
30861
|
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
30862
|
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
30863
|
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 +30945,7 @@ var ShaderChunk = {
|
|
|
31730
30945
|
lights_fragment_begin,
|
|
31731
30946
|
lights_fragment_maps,
|
|
31732
30947
|
lights_fragment_end,
|
|
30948
|
+
lightprobes_pars_fragment,
|
|
31733
30949
|
logdepthbuf_fragment,
|
|
31734
30950
|
logdepthbuf_pars_fragment,
|
|
31735
30951
|
logdepthbuf_pars_vertex,
|
|
@@ -31833,7 +31049,6 @@ var UniformsLib = {
|
|
|
31833
31049
|
envmap: {
|
|
31834
31050
|
envMap: { value: null },
|
|
31835
31051
|
envMapRotation: { value: /* @__PURE__ */ new Matrix3() },
|
|
31836
|
-
flipEnvMap: { value: -1 },
|
|
31837
31052
|
reflectivity: { value: 1 },
|
|
31838
31053
|
// basic, lambert, phong
|
|
31839
31054
|
ior: { value: 1.5 },
|
|
@@ -31952,7 +31167,11 @@ var UniformsLib = {
|
|
|
31952
31167
|
height: {}
|
|
31953
31168
|
} },
|
|
31954
31169
|
ltc_1: { value: null },
|
|
31955
|
-
ltc_2: { value: null }
|
|
31170
|
+
ltc_2: { value: null },
|
|
31171
|
+
probesSH: { value: null },
|
|
31172
|
+
probesMin: { value: /* @__PURE__ */ new Vector3() },
|
|
31173
|
+
probesMax: { value: /* @__PURE__ */ new Vector3() },
|
|
31174
|
+
probesResolution: { value: /* @__PURE__ */ new Vector3() }
|
|
31956
31175
|
},
|
|
31957
31176
|
points: {
|
|
31958
31177
|
diffuse: { value: /* @__PURE__ */ new Color(16777215) },
|
|
@@ -32153,7 +31372,6 @@ var ShaderLib = {
|
|
|
32153
31372
|
backgroundCube: {
|
|
32154
31373
|
uniforms: {
|
|
32155
31374
|
envMap: { value: null },
|
|
32156
|
-
flipEnvMap: { value: -1 },
|
|
32157
31375
|
backgroundBlurriness: { value: 0 },
|
|
32158
31376
|
backgroundIntensity: { value: 1 },
|
|
32159
31377
|
backgroundRotation: { value: /* @__PURE__ */ new Matrix3() }
|
|
@@ -32257,8 +31475,9 @@ ShaderLib.physical = {
|
|
|
32257
31475
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
32258
31476
|
};
|
|
32259
31477
|
var _rgb = { r: 0, b: 0, g: 0 };
|
|
32260
|
-
var _e1$1 = /* @__PURE__ */ new Euler();
|
|
32261
31478
|
var _m1$12 = /* @__PURE__ */ new Matrix4();
|
|
31479
|
+
var _m$1 = /* @__PURE__ */ new Matrix3();
|
|
31480
|
+
_m$1.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
32262
31481
|
function WebGLBackground(renderer, environments, state, objects, alpha, premultipliedAlpha) {
|
|
32263
31482
|
const clearColor = new Color(0);
|
|
32264
31483
|
let clearAlpha = alpha === true ? 0 : 1;
|
|
@@ -32327,19 +31546,13 @@ function WebGLBackground(renderer, environments, state, objects, alpha, premulti
|
|
|
32327
31546
|
});
|
|
32328
31547
|
objects.update(boxMesh);
|
|
32329
31548
|
}
|
|
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
31549
|
boxMesh.material.uniforms.envMap.value = background;
|
|
32339
|
-
boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
|
|
32340
31550
|
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
32341
31551
|
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
32342
|
-
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(
|
|
31552
|
+
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(scene.backgroundRotation)).transpose();
|
|
31553
|
+
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
31554
|
+
boxMesh.material.uniforms.backgroundRotation.value.premultiply(_m$1);
|
|
31555
|
+
}
|
|
32343
31556
|
boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer;
|
|
32344
31557
|
if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
|
|
32345
31558
|
boxMesh.material.needsUpdate = true;
|
|
@@ -32815,27 +32028,10 @@ function WebGLBufferRenderer(gl, extensions, info2) {
|
|
|
32815
32028
|
}
|
|
32816
32029
|
info2.update(elementCount, mode, 1);
|
|
32817
32030
|
}
|
|
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
32031
|
this.setMode = setMode;
|
|
32835
32032
|
this.render = render;
|
|
32836
32033
|
this.renderInstances = renderInstances;
|
|
32837
32034
|
this.renderMultiDraw = renderMultiDraw;
|
|
32838
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
32839
32035
|
}
|
|
32840
32036
|
function WebGLCapabilities(gl, extensions, parameters, utils) {
|
|
32841
32037
|
let maxAnisotropy;
|
|
@@ -32885,6 +32081,9 @@ function WebGLCapabilities(gl, extensions, parameters, utils) {
|
|
|
32885
32081
|
}
|
|
32886
32082
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
32887
32083
|
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has("EXT_clip_control");
|
|
32084
|
+
if (parameters.reversedDepthBuffer === true && reversedDepthBuffer === false) {
|
|
32085
|
+
warn2("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");
|
|
32086
|
+
}
|
|
32888
32087
|
const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
|
|
32889
32088
|
const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
32890
32089
|
const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
@@ -34148,13 +33347,13 @@ function WebGLGeometries(gl, attributes2, info2, bindingStates) {
|
|
|
34148
33347
|
const indices = [];
|
|
34149
33348
|
const geometryIndex = geometry.index;
|
|
34150
33349
|
const geometryPosition = geometry.attributes.position;
|
|
34151
|
-
let
|
|
33350
|
+
let version = 0;
|
|
34152
33351
|
if (geometryPosition === void 0) {
|
|
34153
33352
|
return;
|
|
34154
33353
|
}
|
|
34155
33354
|
if (geometryIndex !== null) {
|
|
34156
33355
|
const array = geometryIndex.array;
|
|
34157
|
-
|
|
33356
|
+
version = geometryIndex.version;
|
|
34158
33357
|
for (let i = 0, l = array.length; i < l; i += 3) {
|
|
34159
33358
|
const a = array[i + 0];
|
|
34160
33359
|
const b = array[i + 1];
|
|
@@ -34163,7 +33362,7 @@ function WebGLGeometries(gl, attributes2, info2, bindingStates) {
|
|
|
34163
33362
|
}
|
|
34164
33363
|
} else {
|
|
34165
33364
|
const array = geometryPosition.array;
|
|
34166
|
-
|
|
33365
|
+
version = geometryPosition.version;
|
|
34167
33366
|
for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) {
|
|
34168
33367
|
const a = i + 0;
|
|
34169
33368
|
const b = i + 1;
|
|
@@ -34172,7 +33371,7 @@ function WebGLGeometries(gl, attributes2, info2, bindingStates) {
|
|
|
34172
33371
|
}
|
|
34173
33372
|
}
|
|
34174
33373
|
const attribute = new (geometryPosition.count >= 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1);
|
|
34175
|
-
attribute.version =
|
|
33374
|
+
attribute.version = version;
|
|
34176
33375
|
const previousAttribute = wireframeAttributes.get(geometry);
|
|
34177
33376
|
if (previousAttribute) attributes2.remove(previousAttribute);
|
|
34178
33377
|
wireframeAttributes.set(geometry, attribute);
|
|
@@ -34226,28 +33425,11 @@ function WebGLIndexedBufferRenderer(gl, extensions, info2) {
|
|
|
34226
33425
|
}
|
|
34227
33426
|
info2.update(elementCount, mode, 1);
|
|
34228
33427
|
}
|
|
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
33428
|
this.setMode = setMode;
|
|
34246
33429
|
this.setIndex = setIndex;
|
|
34247
33430
|
this.render = render;
|
|
34248
33431
|
this.renderInstances = renderInstances;
|
|
34249
33432
|
this.renderMultiDraw = renderMultiDraw;
|
|
34250
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
34251
33433
|
}
|
|
34252
33434
|
function WebGLInfo(gl) {
|
|
34253
33435
|
const memory = {
|
|
@@ -34450,7 +33632,8 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
34450
33632
|
const targetA = new WebGLRenderTarget(width, height, {
|
|
34451
33633
|
type,
|
|
34452
33634
|
depthBuffer: depth,
|
|
34453
|
-
stencilBuffer: stencil
|
|
33635
|
+
stencilBuffer: stencil,
|
|
33636
|
+
depthTexture: depth ? new DepthTexture(width, height) : void 0
|
|
34454
33637
|
});
|
|
34455
33638
|
const targetB = new WebGLRenderTarget(width, height, {
|
|
34456
33639
|
type: HalfFloatType,
|
|
@@ -34603,6 +33786,7 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
34603
33786
|
return _isCompositing;
|
|
34604
33787
|
};
|
|
34605
33788
|
this.dispose = function() {
|
|
33789
|
+
if (targetA.depthTexture) targetA.depthTexture.dispose();
|
|
34606
33790
|
targetA.dispose();
|
|
34607
33791
|
targetB.dispose();
|
|
34608
33792
|
geometry.dispose();
|
|
@@ -35614,6 +34798,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35614
34798
|
parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "",
|
|
35615
34799
|
//
|
|
35616
34800
|
parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "",
|
|
34801
|
+
parameters.vertexNormals ? "#define HAS_NORMAL" : "",
|
|
35617
34802
|
parameters.vertexColors ? "#define USE_COLOR" : "",
|
|
35618
34803
|
parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
|
|
35619
34804
|
parameters.vertexUv1s ? "#define USE_UV1" : "",
|
|
@@ -35700,6 +34885,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35700
34885
|
parameters.normalMap ? "#define USE_NORMALMAP" : "",
|
|
35701
34886
|
parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "",
|
|
35702
34887
|
parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "",
|
|
34888
|
+
parameters.packedNormalMap ? "#define USE_PACKED_NORMALMAP" : "",
|
|
35703
34889
|
parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
|
|
35704
34890
|
parameters.anisotropy ? "#define USE_ANISOTROPY" : "",
|
|
35705
34891
|
parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "",
|
|
@@ -35740,6 +34926,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35740
34926
|
parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "",
|
|
35741
34927
|
parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
|
|
35742
34928
|
parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "",
|
|
34929
|
+
parameters.numLightProbeGrids > 0 ? "#define USE_LIGHT_PROBES_GRID" : "",
|
|
35743
34930
|
parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "",
|
|
35744
34931
|
parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "",
|
|
35745
34932
|
parameters.logarithmicDepthBuffer ? "#define USE_LOGARITHMIC_DEPTH_BUFFER" : "",
|
|
@@ -35954,6 +35141,9 @@ var WebGLShaderStage = class {
|
|
|
35954
35141
|
this.usedTimes = 0;
|
|
35955
35142
|
}
|
|
35956
35143
|
};
|
|
35144
|
+
function isPackedRGFormat(format) {
|
|
35145
|
+
return format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;
|
|
35146
|
+
}
|
|
35957
35147
|
function WebGLPrograms(renderer, environments, extensions, capabilities, bindingStates, clipping) {
|
|
35958
35148
|
const _programLayers = new Layers();
|
|
35959
35149
|
const _customShaders = new WebGLShaderCache();
|
|
@@ -35984,7 +35174,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35984
35174
|
if (value2 === 0) return "uv";
|
|
35985
35175
|
return `uv${value2}`;
|
|
35986
35176
|
}
|
|
35987
|
-
function getParameters(material, lights, shadows, scene, object) {
|
|
35177
|
+
function getParameters(material, lights, shadows, scene, object, lightProbeGrids) {
|
|
35988
35178
|
const fog = scene.fog;
|
|
35989
35179
|
const geometry = object.geometry;
|
|
35990
35180
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -36079,7 +35269,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
36079
35269
|
instancing: IS_INSTANCEDMESH,
|
|
36080
35270
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
36081
35271
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
36082
|
-
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace :
|
|
35272
|
+
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace,
|
|
36083
35273
|
alphaToCoverage: !!material.alphaToCoverage,
|
|
36084
35274
|
map: HAS_MAP,
|
|
36085
35275
|
matcap: HAS_MATCAP,
|
|
@@ -36094,6 +35284,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
36094
35284
|
emissiveMap: HAS_EMISSIVEMAP,
|
|
36095
35285
|
normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
|
|
36096
35286
|
normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
|
|
35287
|
+
packedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat(material.normalMap.format),
|
|
36097
35288
|
metalnessMap: HAS_METALNESSMAP,
|
|
36098
35289
|
roughnessMap: HAS_ROUGHNESSMAP,
|
|
36099
35290
|
anisotropy: HAS_ANISOTROPY,
|
|
@@ -36147,6 +35338,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
36147
35338
|
alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),
|
|
36148
35339
|
//
|
|
36149
35340
|
vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),
|
|
35341
|
+
vertexNormals: !!geometry.attributes.normal,
|
|
36150
35342
|
vertexColors: material.vertexColors,
|
|
36151
35343
|
vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
36152
35344
|
pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),
|
|
@@ -36174,6 +35366,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
36174
35366
|
numSpotLightShadows: lights.spotShadowMap.length,
|
|
36175
35367
|
numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
|
|
36176
35368
|
numLightProbes: lights.numLightProbes,
|
|
35369
|
+
numLightProbeGrids: lightProbeGrids.length,
|
|
36177
35370
|
numClippingPlanes: clipping.numPlanes,
|
|
36178
35371
|
numClipIntersection: clipping.numIntersection,
|
|
36179
35372
|
dithering: material.dithering,
|
|
@@ -36317,6 +35510,10 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
36317
35510
|
_programLayers.enable(20);
|
|
36318
35511
|
if (parameters.gradientMap)
|
|
36319
35512
|
_programLayers.enable(21);
|
|
35513
|
+
if (parameters.packedNormalMap)
|
|
35514
|
+
_programLayers.enable(22);
|
|
35515
|
+
if (parameters.vertexNormals)
|
|
35516
|
+
_programLayers.enable(23);
|
|
36320
35517
|
array.push(_programLayers.mask);
|
|
36321
35518
|
_programLayers.disableAll();
|
|
36322
35519
|
if (parameters.fog)
|
|
@@ -36363,6 +35560,8 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
36363
35560
|
_programLayers.enable(20);
|
|
36364
35561
|
if (parameters.alphaToCoverage)
|
|
36365
35562
|
_programLayers.enable(21);
|
|
35563
|
+
if (parameters.numLightProbeGrids > 0)
|
|
35564
|
+
_programLayers.enable(22);
|
|
36366
35565
|
array.push(_programLayers.mask);
|
|
36367
35566
|
}
|
|
36368
35567
|
function getUniforms(material) {
|
|
@@ -36962,10 +36161,12 @@ function WebGLRenderState(extensions) {
|
|
|
36962
36161
|
const lights = new WebGLLights(extensions);
|
|
36963
36162
|
const lightsArray = [];
|
|
36964
36163
|
const shadowsArray = [];
|
|
36164
|
+
const lightProbeGridArray = [];
|
|
36965
36165
|
function init(camera) {
|
|
36966
36166
|
state.camera = camera;
|
|
36967
36167
|
lightsArray.length = 0;
|
|
36968
36168
|
shadowsArray.length = 0;
|
|
36169
|
+
lightProbeGridArray.length = 0;
|
|
36969
36170
|
}
|
|
36970
36171
|
function pushLight(light) {
|
|
36971
36172
|
lightsArray.push(light);
|
|
@@ -36973,6 +36174,9 @@ function WebGLRenderState(extensions) {
|
|
|
36973
36174
|
function pushShadow(shadowLight) {
|
|
36974
36175
|
shadowsArray.push(shadowLight);
|
|
36975
36176
|
}
|
|
36177
|
+
function pushLightProbeGrid(volume) {
|
|
36178
|
+
lightProbeGridArray.push(volume);
|
|
36179
|
+
}
|
|
36976
36180
|
function setupLights() {
|
|
36977
36181
|
lights.setup(lightsArray);
|
|
36978
36182
|
}
|
|
@@ -36982,9 +36186,11 @@ function WebGLRenderState(extensions) {
|
|
|
36982
36186
|
const state = {
|
|
36983
36187
|
lightsArray,
|
|
36984
36188
|
shadowsArray,
|
|
36189
|
+
lightProbeGridArray,
|
|
36985
36190
|
camera: null,
|
|
36986
36191
|
lights,
|
|
36987
|
-
transmissionRenderTarget: {}
|
|
36192
|
+
transmissionRenderTarget: {},
|
|
36193
|
+
textureUnits: 0
|
|
36988
36194
|
};
|
|
36989
36195
|
return {
|
|
36990
36196
|
init,
|
|
@@ -36992,7 +36198,8 @@ function WebGLRenderState(extensions) {
|
|
|
36992
36198
|
setupLights,
|
|
36993
36199
|
setupLightsView,
|
|
36994
36200
|
pushLight,
|
|
36995
|
-
pushShadow
|
|
36201
|
+
pushShadow,
|
|
36202
|
+
pushLightProbeGrid
|
|
36996
36203
|
};
|
|
36997
36204
|
}
|
|
36998
36205
|
function WebGLRenderStates(extensions) {
|
|
@@ -37552,6 +36759,7 @@ function WebGLState(gl, extensions) {
|
|
|
37552
36759
|
const uboBindings = /* @__PURE__ */ new WeakMap();
|
|
37553
36760
|
const uboProgramMap = /* @__PURE__ */ new WeakMap();
|
|
37554
36761
|
let enabledCapabilities = {};
|
|
36762
|
+
let parameters = {};
|
|
37555
36763
|
let currentBoundFramebuffers = {};
|
|
37556
36764
|
let currentDrawbuffers = /* @__PURE__ */ new WeakMap();
|
|
37557
36765
|
let defaultDrawbuffers = [];
|
|
@@ -37574,14 +36782,14 @@ function WebGLState(gl, extensions) {
|
|
|
37574
36782
|
let currentPolygonOffsetUnits = null;
|
|
37575
36783
|
const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
37576
36784
|
let lineWidthAvailable = false;
|
|
37577
|
-
let
|
|
36785
|
+
let version = 0;
|
|
37578
36786
|
const glVersion = gl.getParameter(gl.VERSION);
|
|
37579
36787
|
if (glVersion.indexOf("WebGL") !== -1) {
|
|
37580
|
-
|
|
37581
|
-
lineWidthAvailable =
|
|
36788
|
+
version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]);
|
|
36789
|
+
lineWidthAvailable = version >= 1;
|
|
37582
36790
|
} else if (glVersion.indexOf("OpenGL ES") !== -1) {
|
|
37583
|
-
|
|
37584
|
-
lineWidthAvailable =
|
|
36791
|
+
version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]);
|
|
36792
|
+
lineWidthAvailable = version >= 2;
|
|
37585
36793
|
}
|
|
37586
36794
|
let currentTextureSlot = null;
|
|
37587
36795
|
let currentBoundTextures = {};
|
|
@@ -37976,6 +37184,19 @@ function WebGLState(gl, extensions) {
|
|
|
37976
37184
|
error2("WebGLState:", e);
|
|
37977
37185
|
}
|
|
37978
37186
|
}
|
|
37187
|
+
function getParameter(name2) {
|
|
37188
|
+
if (parameters[name2] !== void 0) {
|
|
37189
|
+
return parameters[name2];
|
|
37190
|
+
} else {
|
|
37191
|
+
return gl.getParameter(name2);
|
|
37192
|
+
}
|
|
37193
|
+
}
|
|
37194
|
+
function pixelStorei(name2, value2) {
|
|
37195
|
+
if (parameters[name2] !== value2) {
|
|
37196
|
+
gl.pixelStorei(name2, value2);
|
|
37197
|
+
parameters[name2] = value2;
|
|
37198
|
+
}
|
|
37199
|
+
}
|
|
37979
37200
|
function scissor(scissor2) {
|
|
37980
37201
|
if (currentScissor.equals(scissor2) === false) {
|
|
37981
37202
|
gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w);
|
|
@@ -38041,7 +37262,21 @@ function WebGLState(gl, extensions) {
|
|
|
38041
37262
|
gl.lineWidth(1);
|
|
38042
37263
|
gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
|
|
38043
37264
|
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
|
|
37265
|
+
gl.pixelStorei(gl.PACK_ALIGNMENT, 4);
|
|
37266
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
37267
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
37268
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
37269
|
+
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL);
|
|
37270
|
+
gl.pixelStorei(gl.PACK_ROW_LENGTH, 0);
|
|
37271
|
+
gl.pixelStorei(gl.PACK_SKIP_PIXELS, 0);
|
|
37272
|
+
gl.pixelStorei(gl.PACK_SKIP_ROWS, 0);
|
|
37273
|
+
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
|
|
37274
|
+
gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
|
|
37275
|
+
gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
|
|
37276
|
+
gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
|
|
37277
|
+
gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
|
|
38044
37278
|
enabledCapabilities = {};
|
|
37279
|
+
parameters = {};
|
|
38045
37280
|
currentTextureSlot = null;
|
|
38046
37281
|
currentBoundTextures = {};
|
|
38047
37282
|
currentBoundFramebuffers = {};
|
|
@@ -38095,6 +37330,8 @@ function WebGLState(gl, extensions) {
|
|
|
38095
37330
|
compressedTexImage3D,
|
|
38096
37331
|
texImage2D,
|
|
38097
37332
|
texImage3D,
|
|
37333
|
+
pixelStorei,
|
|
37334
|
+
getParameter,
|
|
38098
37335
|
updateUBOMapping,
|
|
38099
37336
|
uniformBlockBinding,
|
|
38100
37337
|
texStorage2D,
|
|
@@ -38113,6 +37350,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38113
37350
|
const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent);
|
|
38114
37351
|
const _imageDimensions = new Vector2();
|
|
38115
37352
|
const _videoTextures = /* @__PURE__ */ new WeakMap();
|
|
37353
|
+
const _htmlTextures = /* @__PURE__ */ new Set();
|
|
38116
37354
|
let _canvas2;
|
|
38117
37355
|
const _sources = /* @__PURE__ */ new WeakMap();
|
|
38118
37356
|
let useOffscreenCanvas = false;
|
|
@@ -38162,16 +37400,25 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38162
37400
|
if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY;
|
|
38163
37401
|
return _gl.TEXTURE_2D;
|
|
38164
37402
|
}
|
|
38165
|
-
function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) {
|
|
37403
|
+
function getInternalFormat(internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false) {
|
|
38166
37404
|
if (internalFormatName !== null) {
|
|
38167
37405
|
if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName];
|
|
38168
37406
|
warn2("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'");
|
|
38169
37407
|
}
|
|
37408
|
+
let ext_texture_norm16;
|
|
37409
|
+
if (normalized) {
|
|
37410
|
+
ext_texture_norm16 = extensions.get("EXT_texture_norm16");
|
|
37411
|
+
if (!ext_texture_norm16) {
|
|
37412
|
+
warn2("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension");
|
|
37413
|
+
}
|
|
37414
|
+
}
|
|
38170
37415
|
let internalFormat = glFormat;
|
|
38171
37416
|
if (glFormat === _gl.RED) {
|
|
38172
37417
|
if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
|
|
38173
37418
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
|
|
38174
37419
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
|
|
37420
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_EXT;
|
|
37421
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
|
|
38175
37422
|
}
|
|
38176
37423
|
if (glFormat === _gl.RED_INTEGER) {
|
|
38177
37424
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;
|
|
@@ -38185,6 +37432,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38185
37432
|
if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
|
|
38186
37433
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
|
|
38187
37434
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
|
|
37435
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_EXT;
|
|
37436
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
|
|
38188
37437
|
}
|
|
38189
37438
|
if (glFormat === _gl.RG_INTEGER) {
|
|
38190
37439
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI;
|
|
@@ -38211,6 +37460,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38211
37460
|
if (glType === _gl.INT) internalFormat = _gl.RGBA32I;
|
|
38212
37461
|
}
|
|
38213
37462
|
if (glFormat === _gl.RGB) {
|
|
37463
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_EXT;
|
|
37464
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
|
|
38214
37465
|
if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5;
|
|
38215
37466
|
if (glType === _gl.UNSIGNED_INT_10F_11F_11F_REV) internalFormat = _gl.R11F_G11F_B10F;
|
|
38216
37467
|
}
|
|
@@ -38219,6 +37470,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38219
37470
|
if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
|
|
38220
37471
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
|
|
38221
37472
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
37473
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_EXT;
|
|
37474
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
|
|
38222
37475
|
if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
|
|
38223
37476
|
if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
|
|
38224
37477
|
}
|
|
@@ -38267,6 +37520,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38267
37520
|
if (texture.isVideoTexture) {
|
|
38268
37521
|
_videoTextures.delete(texture);
|
|
38269
37522
|
}
|
|
37523
|
+
if (texture.isHTMLTexture) {
|
|
37524
|
+
_htmlTextures.delete(texture);
|
|
37525
|
+
}
|
|
38270
37526
|
}
|
|
38271
37527
|
function onRenderTargetDispose(event) {
|
|
38272
37528
|
const renderTarget = event.target;
|
|
@@ -38343,6 +37599,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38343
37599
|
function resetTextureUnits() {
|
|
38344
37600
|
textureUnits = 0;
|
|
38345
37601
|
}
|
|
37602
|
+
function getTextureUnits() {
|
|
37603
|
+
return textureUnits;
|
|
37604
|
+
}
|
|
37605
|
+
function setTextureUnits(value2) {
|
|
37606
|
+
textureUnits = value2;
|
|
37607
|
+
}
|
|
38346
37608
|
function allocateTextureUnit() {
|
|
38347
37609
|
const textureUnit = textureUnits;
|
|
38348
37610
|
if (textureUnit >= capabilities.maxTextures) {
|
|
@@ -38525,10 +37787,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38525
37787
|
}
|
|
38526
37788
|
}
|
|
38527
37789
|
updateRanges.length = mergeIndex + 1;
|
|
38528
|
-
const currentUnpackRowLen =
|
|
38529
|
-
const currentUnpackSkipPixels =
|
|
38530
|
-
const currentUnpackSkipRows =
|
|
38531
|
-
|
|
37790
|
+
const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
37791
|
+
const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
37792
|
+
const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
37793
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
38532
37794
|
for (let i = 0, l = updateRanges.length; i < l; i++) {
|
|
38533
37795
|
const range = updateRanges[i];
|
|
38534
37796
|
const pixelStart = Math.floor(range.start / componentStride);
|
|
@@ -38537,14 +37799,14 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38537
37799
|
const y = Math.floor(pixelStart / image.width);
|
|
38538
37800
|
const width = pixelCount;
|
|
38539
37801
|
const height = 1;
|
|
38540
|
-
|
|
38541
|
-
|
|
37802
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x);
|
|
37803
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
|
|
38542
37804
|
state.texSubImage2D(_gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data);
|
|
38543
37805
|
}
|
|
38544
37806
|
texture.clearUpdateRanges();
|
|
38545
|
-
|
|
38546
|
-
|
|
38547
|
-
|
|
37807
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
37808
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
37809
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
38548
37810
|
}
|
|
38549
37811
|
}
|
|
38550
37812
|
function uploadTexture(textureProperties, texture, slot) {
|
|
@@ -38557,18 +37819,21 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38557
37819
|
const sourceProperties = properties.get(source);
|
|
38558
37820
|
if (source.version !== sourceProperties.__version || forceUpload === true) {
|
|
38559
37821
|
state.activeTexture(_gl.TEXTURE0 + slot);
|
|
38560
|
-
const
|
|
38561
|
-
|
|
38562
|
-
|
|
38563
|
-
|
|
38564
|
-
|
|
38565
|
-
|
|
38566
|
-
|
|
37822
|
+
const isImageBitmap = typeof ImageBitmap !== "undefined" && texture.image instanceof ImageBitmap;
|
|
37823
|
+
if (isImageBitmap === false) {
|
|
37824
|
+
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
37825
|
+
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
37826
|
+
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
37827
|
+
state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
37828
|
+
state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
37829
|
+
state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
37830
|
+
}
|
|
37831
|
+
state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
38567
37832
|
let image = resizeImage(texture.image, false, capabilities.maxTextureSize);
|
|
38568
37833
|
image = verifyColorSpace(texture, image);
|
|
38569
37834
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38570
37835
|
const glType = utils.convert(texture.type);
|
|
38571
|
-
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture);
|
|
37836
|
+
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture);
|
|
38572
37837
|
setTextureParameters(textureType, texture);
|
|
38573
37838
|
let mipmap;
|
|
38574
37839
|
const mipmaps = texture.mipmaps;
|
|
@@ -38730,6 +37995,35 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38730
37995
|
}
|
|
38731
37996
|
}
|
|
38732
37997
|
}
|
|
37998
|
+
} else if (texture.isHTMLTexture) {
|
|
37999
|
+
if ("texElementImage2D" in _gl) {
|
|
38000
|
+
const canvas = _gl.canvas;
|
|
38001
|
+
if (!canvas.hasAttribute("layoutsubtree")) {
|
|
38002
|
+
canvas.setAttribute("layoutsubtree", "true");
|
|
38003
|
+
}
|
|
38004
|
+
if (image.parentNode !== canvas) {
|
|
38005
|
+
canvas.appendChild(image);
|
|
38006
|
+
_htmlTextures.add(texture);
|
|
38007
|
+
canvas.onpaint = (event) => {
|
|
38008
|
+
const changed = event.changedElements;
|
|
38009
|
+
for (const t of _htmlTextures) {
|
|
38010
|
+
if (changed.includes(t.image)) {
|
|
38011
|
+
t.needsUpdate = true;
|
|
38012
|
+
}
|
|
38013
|
+
}
|
|
38014
|
+
};
|
|
38015
|
+
canvas.requestPaint();
|
|
38016
|
+
return;
|
|
38017
|
+
}
|
|
38018
|
+
const level = 0;
|
|
38019
|
+
const internalFormat = _gl.RGBA;
|
|
38020
|
+
const srcFormat = _gl.RGBA;
|
|
38021
|
+
const srcType = _gl.UNSIGNED_BYTE;
|
|
38022
|
+
_gl.texElementImage2D(_gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image);
|
|
38023
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR);
|
|
38024
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
|
|
38025
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
|
|
38026
|
+
}
|
|
38733
38027
|
} else {
|
|
38734
38028
|
if (mipmaps.length > 0) {
|
|
38735
38029
|
if (useTexStorage && allocateMemory) {
|
|
@@ -38780,10 +38074,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38780
38074
|
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
38781
38075
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
38782
38076
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
38783
|
-
|
|
38784
|
-
|
|
38785
|
-
|
|
38786
|
-
|
|
38077
|
+
state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
38078
|
+
state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
38079
|
+
state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
38080
|
+
state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
38787
38081
|
const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;
|
|
38788
38082
|
const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
|
|
38789
38083
|
const cubeImage = [];
|
|
@@ -38795,7 +38089,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38795
38089
|
}
|
|
38796
38090
|
cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);
|
|
38797
38091
|
}
|
|
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);
|
|
38092
|
+
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
38093
|
const useTexStorage = texture.isVideoTexture !== true;
|
|
38800
38094
|
const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true;
|
|
38801
38095
|
const dataReady = source.dataReady;
|
|
@@ -38892,7 +38186,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38892
38186
|
function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) {
|
|
38893
38187
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38894
38188
|
const glType = utils.convert(texture.type);
|
|
38895
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38189
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38896
38190
|
const renderTargetProperties = properties.get(renderTarget);
|
|
38897
38191
|
const textureProperties = properties.get(texture);
|
|
38898
38192
|
textureProperties.__renderTarget = renderTarget;
|
|
@@ -38934,7 +38228,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38934
38228
|
const texture = textures[i];
|
|
38935
38229
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38936
38230
|
const glType = utils.convert(texture.type);
|
|
38937
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38231
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38938
38232
|
if (useMultisampledRTT(renderTarget)) {
|
|
38939
38233
|
multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, getRenderTargetSamples(renderTarget), glInternalFormat, renderTarget.width, renderTarget.height);
|
|
38940
38234
|
} else if (useMultisample) {
|
|
@@ -39134,7 +38428,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
39134
38428
|
_gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
|
|
39135
38429
|
const glFormat = utils.convert(texture2.format, texture2.colorSpace);
|
|
39136
38430
|
const glType = utils.convert(texture2.type);
|
|
39137
|
-
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
|
|
38431
|
+
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.normalized, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
|
|
39138
38432
|
const samples = getRenderTargetSamples(renderTarget);
|
|
39139
38433
|
_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
|
|
39140
38434
|
_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
|
|
@@ -39330,6 +38624,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
39330
38624
|
}
|
|
39331
38625
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
39332
38626
|
this.resetTextureUnits = resetTextureUnits;
|
|
38627
|
+
this.getTextureUnits = getTextureUnits;
|
|
38628
|
+
this.setTextureUnits = setTextureUnits;
|
|
39333
38629
|
this.setTexture2D = setTexture2D;
|
|
39334
38630
|
this.setTexture2DArray = setTexture2DArray;
|
|
39335
38631
|
this.setTexture3D = setTexture3D;
|
|
@@ -40050,8 +39346,9 @@ var WebXRManager = class extends EventDispatcher {
|
|
|
40050
39346
|
};
|
|
40051
39347
|
}
|
|
40052
39348
|
};
|
|
40053
|
-
var _e1 = /* @__PURE__ */ new Euler();
|
|
40054
39349
|
var _m12 = /* @__PURE__ */ new Matrix4();
|
|
39350
|
+
var _m = /* @__PURE__ */ new Matrix3();
|
|
39351
|
+
_m.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
40055
39352
|
function WebGLMaterials(renderer, properties) {
|
|
40056
39353
|
function refreshTransformUniform(map, uniform) {
|
|
40057
39354
|
if (map.matrixAutoUpdate === true) {
|
|
@@ -40069,7 +39366,9 @@ function WebGLMaterials(renderer, properties) {
|
|
|
40069
39366
|
}
|
|
40070
39367
|
}
|
|
40071
39368
|
function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
|
|
40072
|
-
if (material.
|
|
39369
|
+
if (material.isNodeMaterial) {
|
|
39370
|
+
material.uniformsNeedUpdate = false;
|
|
39371
|
+
} else if (material.isMeshBasicMaterial) {
|
|
40073
39372
|
refreshUniformsCommon(uniforms, material);
|
|
40074
39373
|
} else if (material.isMeshLambertMaterial) {
|
|
40075
39374
|
refreshUniformsCommon(uniforms, material);
|
|
@@ -40171,16 +39470,10 @@ function WebGLMaterials(renderer, properties) {
|
|
|
40171
39470
|
const envMapRotation = materialProperties.envMapRotation;
|
|
40172
39471
|
if (envMap) {
|
|
40173
39472
|
uniforms.envMap.value = envMap;
|
|
40174
|
-
|
|
40175
|
-
_e1.x *= -1;
|
|
40176
|
-
_e1.y *= -1;
|
|
40177
|
-
_e1.z *= -1;
|
|
39473
|
+
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(envMapRotation)).transpose();
|
|
40178
39474
|
if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) {
|
|
40179
|
-
|
|
40180
|
-
_e1.z *= -1;
|
|
39475
|
+
uniforms.envMapRotation.value.premultiply(_m);
|
|
40181
39476
|
}
|
|
40182
|
-
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(_e1));
|
|
40183
|
-
uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
|
|
40184
39477
|
uniforms.reflectivity.value = material.reflectivity;
|
|
40185
39478
|
uniforms.ior.value = material.ior;
|
|
40186
39479
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
@@ -40446,6 +39739,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40446
39739
|
uniform.__data[9] = value2.elements[7];
|
|
40447
39740
|
uniform.__data[10] = value2.elements[8];
|
|
40448
39741
|
uniform.__data[11] = 0;
|
|
39742
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
39743
|
+
uniform.__data.set(new value2.constructor(value2.buffer, value2.byteOffset, uniform.__data.length));
|
|
40449
39744
|
} else {
|
|
40450
39745
|
value2.toArray(uniform.__data, arrayOffset);
|
|
40451
39746
|
arrayOffset += info3.storage / Float32Array.BYTES_PER_ELEMENT;
|
|
@@ -40463,6 +39758,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40463
39758
|
if (cache[indexString] === void 0) {
|
|
40464
39759
|
if (typeof value2 === "number" || typeof value2 === "boolean") {
|
|
40465
39760
|
cache[indexString] = value2;
|
|
39761
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
39762
|
+
cache[indexString] = value2.slice();
|
|
40466
39763
|
} else {
|
|
40467
39764
|
cache[indexString] = value2.clone();
|
|
40468
39765
|
}
|
|
@@ -40474,6 +39771,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40474
39771
|
cache[indexString] = value2;
|
|
40475
39772
|
return true;
|
|
40476
39773
|
}
|
|
39774
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
39775
|
+
return true;
|
|
40477
39776
|
} else {
|
|
40478
39777
|
if (cachedObject.equals(value2) === false) {
|
|
40479
39778
|
cachedObject.copy(value2);
|
|
@@ -40541,6 +39840,9 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40541
39840
|
info3.storage = 64;
|
|
40542
39841
|
} else if (value2.isTexture) {
|
|
40543
39842
|
warn2("WebGLRenderer: Texture samplers can not be part of an uniforms group.");
|
|
39843
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
39844
|
+
info3.boundary = 16;
|
|
39845
|
+
info3.storage = value2.byteLength;
|
|
40544
39846
|
} else {
|
|
40545
39847
|
warn2("WebGLRenderer: Unsupported uniform value type.", value2);
|
|
40546
39848
|
}
|
|
@@ -41144,6 +40446,7 @@ var WebGLRenderer = class {
|
|
|
41144
40446
|
]);
|
|
41145
40447
|
const uintClearColor = new Uint32Array(4);
|
|
41146
40448
|
const intClearColor = new Int32Array(4);
|
|
40449
|
+
const objectPosition = new Vector3();
|
|
41147
40450
|
let currentRenderList = null;
|
|
41148
40451
|
let currentRenderState = null;
|
|
41149
40452
|
const renderListStack = [];
|
|
@@ -41174,6 +40477,7 @@ var WebGLRenderer = class {
|
|
|
41174
40477
|
this.transmissionResolutionScale = 1;
|
|
41175
40478
|
const _this = this;
|
|
41176
40479
|
let _isContextLost = false;
|
|
40480
|
+
let _nodesHandler = null;
|
|
41177
40481
|
this._outputColorSpace = SRGBColorSpace;
|
|
41178
40482
|
let _currentActiveCubeFace = 0;
|
|
41179
40483
|
let _currentActiveMipmapLevel = 0;
|
|
@@ -41342,13 +40646,13 @@ var WebGLRenderer = class {
|
|
|
41342
40646
|
};
|
|
41343
40647
|
this.setEffects = function(effects) {
|
|
41344
40648
|
if (_outputBufferType === UnsignedByteType) {
|
|
41345
|
-
|
|
40649
|
+
error2("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
|
|
41346
40650
|
return;
|
|
41347
40651
|
}
|
|
41348
40652
|
if (effects) {
|
|
41349
40653
|
for (let i = 0; i < effects.length; i++) {
|
|
41350
40654
|
if (effects[i].isOutputPass === true) {
|
|
41351
|
-
|
|
40655
|
+
warn2("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
|
|
41352
40656
|
break;
|
|
41353
40657
|
}
|
|
41354
40658
|
}
|
|
@@ -41439,6 +40743,7 @@ var WebGLRenderer = class {
|
|
|
41439
40743
|
}
|
|
41440
40744
|
if (depth2) {
|
|
41441
40745
|
bits2 |= _gl.DEPTH_BUFFER_BIT;
|
|
40746
|
+
this.state.buffers.depth.setMask(true);
|
|
41442
40747
|
}
|
|
41443
40748
|
if (stencil2) {
|
|
41444
40749
|
bits2 |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -41457,6 +40762,10 @@ var WebGLRenderer = class {
|
|
|
41457
40762
|
this.clearStencil = function() {
|
|
41458
40763
|
this.clear(false, false, true);
|
|
41459
40764
|
};
|
|
40765
|
+
this.setNodesHandler = function(nodesHandler) {
|
|
40766
|
+
nodesHandler.setRenderer(this);
|
|
40767
|
+
_nodesHandler = nodesHandler;
|
|
40768
|
+
};
|
|
41460
40769
|
this.dispose = function() {
|
|
41461
40770
|
canvas.removeEventListener("webglcontextlost", onContextLost, false);
|
|
41462
40771
|
canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
|
|
@@ -41579,23 +40888,18 @@ var WebGLRenderer = class {
|
|
|
41579
40888
|
renderer.setMode(_gl.TRIANGLES);
|
|
41580
40889
|
}
|
|
41581
40890
|
if (object.isBatchedMesh) {
|
|
41582
|
-
if (
|
|
41583
|
-
|
|
41584
|
-
|
|
41585
|
-
|
|
41586
|
-
|
|
41587
|
-
|
|
41588
|
-
|
|
41589
|
-
|
|
41590
|
-
|
|
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);
|
|
40891
|
+
if (!extensions.get("WEBGL_multi_draw")) {
|
|
40892
|
+
const starts = object._multiDrawStarts;
|
|
40893
|
+
const counts = object._multiDrawCounts;
|
|
40894
|
+
const drawCount2 = object._multiDrawCount;
|
|
40895
|
+
const bytesPerElement = index ? attributes2.get(index).bytesPerElement : 1;
|
|
40896
|
+
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
40897
|
+
for (let i = 0; i < drawCount2; i++) {
|
|
40898
|
+
uniforms.setValue(_gl, "_gl_DrawID", i);
|
|
40899
|
+
renderer.render(starts[i] / bytesPerElement, counts[i]);
|
|
41598
40900
|
}
|
|
40901
|
+
} else {
|
|
40902
|
+
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
41599
40903
|
}
|
|
41600
40904
|
} else if (object.isInstancedMesh) {
|
|
41601
40905
|
renderer.renderInstances(drawStart, drawCount, object.count);
|
|
@@ -41716,6 +41020,9 @@ var WebGLRenderer = class {
|
|
|
41716
41020
|
return;
|
|
41717
41021
|
}
|
|
41718
41022
|
if (_isContextLost === true) return;
|
|
41023
|
+
if (_nodesHandler !== null) {
|
|
41024
|
+
_nodesHandler.renderStart(scene, camera);
|
|
41025
|
+
}
|
|
41719
41026
|
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
41720
41027
|
const useOutput = output !== null && (_currentRenderTarget === null || isXRPresenting) && output.begin(_this, _currentRenderTarget);
|
|
41721
41028
|
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
@@ -41727,6 +41034,7 @@ var WebGLRenderer = class {
|
|
|
41727
41034
|
if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
|
|
41728
41035
|
currentRenderState = renderStates.get(scene, renderStateStack.length);
|
|
41729
41036
|
currentRenderState.init(camera);
|
|
41037
|
+
currentRenderState.state.textureUnits = textures.getTextureUnits();
|
|
41730
41038
|
renderStateStack.push(currentRenderState);
|
|
41731
41039
|
_projScreenMatrix3.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
41732
41040
|
_frustum.setFromProjectionMatrix(_projScreenMatrix3, WebGLCoordinateSystem, camera.reversedDepth);
|
|
@@ -41794,6 +41102,7 @@ var WebGLRenderer = class {
|
|
|
41794
41102
|
renderStateStack.pop();
|
|
41795
41103
|
if (renderStateStack.length > 0) {
|
|
41796
41104
|
currentRenderState = renderStateStack[renderStateStack.length - 1];
|
|
41105
|
+
textures.setTextureUnits(currentRenderState.state.textureUnits);
|
|
41797
41106
|
if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera);
|
|
41798
41107
|
} else {
|
|
41799
41108
|
currentRenderState = null;
|
|
@@ -41804,6 +41113,9 @@ var WebGLRenderer = class {
|
|
|
41804
41113
|
} else {
|
|
41805
41114
|
currentRenderList = null;
|
|
41806
41115
|
}
|
|
41116
|
+
if (_nodesHandler !== null) {
|
|
41117
|
+
_nodesHandler.renderEnd();
|
|
41118
|
+
}
|
|
41807
41119
|
};
|
|
41808
41120
|
function projectObject(object, camera, groupOrder, sortObjects) {
|
|
41809
41121
|
if (object.visible === false) return;
|
|
@@ -41813,6 +41125,8 @@ var WebGLRenderer = class {
|
|
|
41813
41125
|
groupOrder = object.renderOrder;
|
|
41814
41126
|
} else if (object.isLOD) {
|
|
41815
41127
|
if (object.autoUpdate === true) object.update(camera);
|
|
41128
|
+
} else if (object.isLightProbeGrid) {
|
|
41129
|
+
currentRenderState.pushLightProbeGrid(object);
|
|
41816
41130
|
} else if (object.isLight) {
|
|
41817
41131
|
currentRenderState.pushLight(object);
|
|
41818
41132
|
if (object.castShadow) {
|
|
@@ -41979,7 +41293,7 @@ var WebGLRenderer = class {
|
|
|
41979
41293
|
const lights = currentRenderState.state.lights;
|
|
41980
41294
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
41981
41295
|
const lightsStateVersion = lights.state.version;
|
|
41982
|
-
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
|
|
41296
|
+
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray);
|
|
41983
41297
|
const programCacheKey = programCache.getProgramCacheKey(parameters2);
|
|
41984
41298
|
let programs = materialProperties.programs;
|
|
41985
41299
|
materialProperties.environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -42000,6 +41314,9 @@ var WebGLRenderer = class {
|
|
|
42000
41314
|
}
|
|
42001
41315
|
} else {
|
|
42002
41316
|
parameters2.uniforms = programCache.getUniforms(material);
|
|
41317
|
+
if (_nodesHandler !== null && material.isNodeMaterial) {
|
|
41318
|
+
_nodesHandler.build(material, object, parameters2);
|
|
41319
|
+
}
|
|
42003
41320
|
material.onBeforeCompile(parameters2, _this);
|
|
42004
41321
|
program = programCache.acquireProgram(parameters2, programCacheKey);
|
|
42005
41322
|
programs.set(programCacheKey, program);
|
|
@@ -42030,6 +41347,7 @@ var WebGLRenderer = class {
|
|
|
42030
41347
|
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
42031
41348
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
|
|
42032
41349
|
}
|
|
41350
|
+
materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
|
|
42033
41351
|
materialProperties.currentProgram = program;
|
|
42034
41352
|
materialProperties.uniformsList = null;
|
|
42035
41353
|
return program;
|
|
@@ -42060,12 +41378,24 @@ var WebGLRenderer = class {
|
|
|
42060
41378
|
materialProperties.vertexTangents = parameters2.vertexTangents;
|
|
42061
41379
|
materialProperties.toneMapping = parameters2.toneMapping;
|
|
42062
41380
|
}
|
|
41381
|
+
function findLightProbeGrid(volumes, object) {
|
|
41382
|
+
if (volumes.length === 0) return null;
|
|
41383
|
+
if (volumes.length === 1) {
|
|
41384
|
+
return volumes[0].texture !== null ? volumes[0] : null;
|
|
41385
|
+
}
|
|
41386
|
+
objectPosition.setFromMatrixPosition(object.matrixWorld);
|
|
41387
|
+
for (let i = 0, l = volumes.length; i < l; i++) {
|
|
41388
|
+
const v = volumes[i];
|
|
41389
|
+
if (v.texture !== null && v.boundingBox.containsPoint(objectPosition)) return v;
|
|
41390
|
+
}
|
|
41391
|
+
return null;
|
|
41392
|
+
}
|
|
42063
41393
|
function setProgram(camera, scene, geometry, material, object) {
|
|
42064
41394
|
if (scene.isScene !== true) scene = _emptyScene;
|
|
42065
41395
|
textures.resetTextureUnits();
|
|
42066
41396
|
const fog = scene.fog;
|
|
42067
41397
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
42068
|
-
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace :
|
|
41398
|
+
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace;
|
|
42069
41399
|
const usePMREM = material.isMeshStandardMaterial || material.isMeshLambertMaterial && !material.envMap || material.isMeshPhongMaterial && !material.envMap;
|
|
42070
41400
|
const envMap = environments.get(material.envMap || environment, usePMREM);
|
|
42071
41401
|
const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
@@ -42139,6 +41469,8 @@ var WebGLRenderer = class {
|
|
|
42139
41469
|
needsProgramChange = true;
|
|
42140
41470
|
} else if (materialProperties.morphTargetsCount !== morphTargetsCount) {
|
|
42141
41471
|
needsProgramChange = true;
|
|
41472
|
+
} else if (!!materialProperties.lightProbeGrid !== currentRenderState.state.lightProbeGridArray.length > 0) {
|
|
41473
|
+
needsProgramChange = true;
|
|
42142
41474
|
}
|
|
42143
41475
|
} else {
|
|
42144
41476
|
needsProgramChange = true;
|
|
@@ -42147,6 +41479,9 @@ var WebGLRenderer = class {
|
|
|
42147
41479
|
let program = materialProperties.currentProgram;
|
|
42148
41480
|
if (needsProgramChange === true) {
|
|
42149
41481
|
program = getProgram(material, scene, object);
|
|
41482
|
+
if (_nodesHandler && material.isNodeMaterial) {
|
|
41483
|
+
_nodesHandler.onUpdateProgram(material, program, materialProperties);
|
|
41484
|
+
}
|
|
42150
41485
|
}
|
|
42151
41486
|
let refreshProgram = false;
|
|
42152
41487
|
let refreshMaterial = false;
|
|
@@ -42161,6 +41496,13 @@ var WebGLRenderer = class {
|
|
|
42161
41496
|
_currentMaterialId = material.id;
|
|
42162
41497
|
refreshMaterial = true;
|
|
42163
41498
|
}
|
|
41499
|
+
if (materialProperties.needsLights) {
|
|
41500
|
+
const objectVolume = findLightProbeGrid(currentRenderState.state.lightProbeGridArray, object);
|
|
41501
|
+
if (materialProperties.lightProbeGrid !== objectVolume) {
|
|
41502
|
+
materialProperties.lightProbeGrid = objectVolume;
|
|
41503
|
+
refreshMaterial = true;
|
|
41504
|
+
}
|
|
41505
|
+
}
|
|
42164
41506
|
if (refreshProgram || _currentCamera !== camera) {
|
|
42165
41507
|
const reversedDepthBuffer2 = state.buffers.depth.getReversed();
|
|
42166
41508
|
if (reversedDepthBuffer2 && camera.reversedDepth !== true) {
|
|
@@ -42242,6 +41584,13 @@ var WebGLRenderer = class {
|
|
|
42242
41584
|
materials.refreshFogUniforms(m_uniforms, fog);
|
|
42243
41585
|
}
|
|
42244
41586
|
materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]);
|
|
41587
|
+
if (materialProperties.needsLights && materialProperties.lightProbeGrid) {
|
|
41588
|
+
const volume = materialProperties.lightProbeGrid;
|
|
41589
|
+
m_uniforms.probesSH.value = volume.texture;
|
|
41590
|
+
m_uniforms.probesMin.value.copy(volume.boundingBox.min);
|
|
41591
|
+
m_uniforms.probesMax.value.copy(volume.boundingBox.max);
|
|
41592
|
+
m_uniforms.probesResolution.value.copy(volume.resolution);
|
|
41593
|
+
}
|
|
42245
41594
|
WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures);
|
|
42246
41595
|
}
|
|
42247
41596
|
if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
|
|
@@ -42254,7 +41603,7 @@ var WebGLRenderer = class {
|
|
|
42254
41603
|
p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix);
|
|
42255
41604
|
p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix);
|
|
42256
41605
|
p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld);
|
|
42257
|
-
if (material.
|
|
41606
|
+
if (material.uniformsGroups !== void 0) {
|
|
42258
41607
|
const groups = material.uniformsGroups;
|
|
42259
41608
|
for (let i = 0, l = groups.length; i < l; i++) {
|
|
42260
41609
|
const group2 = groups[i];
|
|
@@ -42523,19 +41872,20 @@ var WebGLRenderer = class {
|
|
|
42523
41872
|
textures.setTexture2D(dstTexture, 0);
|
|
42524
41873
|
glTarget = _gl.TEXTURE_2D;
|
|
42525
41874
|
}
|
|
42526
|
-
|
|
42527
|
-
|
|
42528
|
-
|
|
42529
|
-
|
|
42530
|
-
const
|
|
42531
|
-
const
|
|
42532
|
-
const
|
|
42533
|
-
const
|
|
42534
|
-
|
|
42535
|
-
|
|
42536
|
-
|
|
42537
|
-
|
|
42538
|
-
|
|
41875
|
+
state.activeTexture(_gl.TEXTURE0);
|
|
41876
|
+
state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
|
|
41877
|
+
state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
|
|
41878
|
+
state.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
|
|
41879
|
+
const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
41880
|
+
const currentUnpackImageHeight = state.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
|
|
41881
|
+
const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
41882
|
+
const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
41883
|
+
const currentUnpackSkipImages = state.getParameter(_gl.UNPACK_SKIP_IMAGES);
|
|
41884
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
41885
|
+
state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
|
|
41886
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
|
|
41887
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
|
|
41888
|
+
state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
|
|
42539
41889
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
42540
41890
|
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
|
|
42541
41891
|
if (srcTexture.isDepthTexture) {
|
|
@@ -42599,11 +41949,11 @@ var WebGLRenderer = class {
|
|
|
42599
41949
|
}
|
|
42600
41950
|
}
|
|
42601
41951
|
}
|
|
42602
|
-
|
|
42603
|
-
|
|
42604
|
-
|
|
42605
|
-
|
|
42606
|
-
|
|
41952
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
41953
|
+
state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
|
|
41954
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
41955
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
41956
|
+
state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
|
|
42607
41957
|
if (dstLevel === 0 && dstTexture.generateMipmaps) {
|
|
42608
41958
|
_gl.generateMipmap(glTarget);
|
|
42609
41959
|
}
|
|
@@ -42668,7 +42018,7 @@ var WebGLRenderer = class {
|
|
|
42668
42018
|
|
|
42669
42019
|
// ../../../node_modules/three/examples/jsm/controls/OrbitControls.js
|
|
42670
42020
|
init_console_gjs();
|
|
42671
|
-
|
|
42021
|
+
init_auto_globals_97a682e619();
|
|
42672
42022
|
var _changeEvent = { type: "change" };
|
|
42673
42023
|
var _startEvent = { type: "start" };
|
|
42674
42024
|
var _endEvent = { type: "end" };
|
|
@@ -42810,7 +42160,7 @@ var OrbitControls = class extends Controls {
|
|
|
42810
42160
|
this.stopListenToKeyEvents();
|
|
42811
42161
|
const document3 = this.domElement.getRootNode();
|
|
42812
42162
|
document3.removeEventListener("keydown", this._interceptControlDown, { capture: true });
|
|
42813
|
-
this.domElement.style.touchAction = "
|
|
42163
|
+
this.domElement.style.touchAction = "";
|
|
42814
42164
|
}
|
|
42815
42165
|
dispose() {
|
|
42816
42166
|
this.disconnect();
|
|
@@ -43580,11 +42930,11 @@ function interceptControlUp(event) {
|
|
|
43580
42930
|
|
|
43581
42931
|
// ../../../node_modules/three/examples/jsm/postprocessing/EffectComposer.js
|
|
43582
42932
|
init_console_gjs();
|
|
43583
|
-
|
|
42933
|
+
init_auto_globals_97a682e619();
|
|
43584
42934
|
|
|
43585
42935
|
// ../../../node_modules/three/examples/jsm/shaders/CopyShader.js
|
|
43586
42936
|
init_console_gjs();
|
|
43587
|
-
|
|
42937
|
+
init_auto_globals_97a682e619();
|
|
43588
42938
|
var CopyShader = {
|
|
43589
42939
|
name: "CopyShader",
|
|
43590
42940
|
uniforms: {
|
|
@@ -43626,11 +42976,11 @@ var CopyShader = {
|
|
|
43626
42976
|
|
|
43627
42977
|
// ../../../node_modules/three/examples/jsm/postprocessing/ShaderPass.js
|
|
43628
42978
|
init_console_gjs();
|
|
43629
|
-
|
|
42979
|
+
init_auto_globals_97a682e619();
|
|
43630
42980
|
|
|
43631
42981
|
// ../../../node_modules/three/examples/jsm/postprocessing/Pass.js
|
|
43632
42982
|
init_console_gjs();
|
|
43633
|
-
|
|
42983
|
+
init_auto_globals_97a682e619();
|
|
43634
42984
|
var Pass = class {
|
|
43635
42985
|
/**
|
|
43636
42986
|
* Constructs a new pass.
|
|
@@ -43788,7 +43138,7 @@ var ShaderPass = class extends Pass {
|
|
|
43788
43138
|
|
|
43789
43139
|
// ../../../node_modules/three/examples/jsm/postprocessing/MaskPass.js
|
|
43790
43140
|
init_console_gjs();
|
|
43791
|
-
|
|
43141
|
+
init_auto_globals_97a682e619();
|
|
43792
43142
|
var MaskPass = class extends Pass {
|
|
43793
43143
|
/**
|
|
43794
43144
|
* Constructs a new mask pass.
|
|
@@ -44063,7 +43413,7 @@ var EffectComposer = class {
|
|
|
44063
43413
|
|
|
44064
43414
|
// ../../../node_modules/three/examples/jsm/postprocessing/RenderPixelatedPass.js
|
|
44065
43415
|
init_console_gjs();
|
|
44066
|
-
|
|
43416
|
+
init_auto_globals_97a682e619();
|
|
44067
43417
|
var RenderPixelatedPass = class extends Pass {
|
|
44068
43418
|
/**
|
|
44069
43419
|
* Constructs a new render pixelated pass.
|
|
@@ -44285,11 +43635,11 @@ var RenderPixelatedPass = class extends Pass {
|
|
|
44285
43635
|
|
|
44286
43636
|
// ../../../node_modules/three/examples/jsm/postprocessing/OutputPass.js
|
|
44287
43637
|
init_console_gjs();
|
|
44288
|
-
|
|
43638
|
+
init_auto_globals_97a682e619();
|
|
44289
43639
|
|
|
44290
43640
|
// ../../../node_modules/three/examples/jsm/shaders/OutputShader.js
|
|
44291
43641
|
init_console_gjs();
|
|
44292
|
-
|
|
43642
|
+
init_auto_globals_97a682e619();
|
|
44293
43643
|
var OutputShader = {
|
|
44294
43644
|
name: "OutputShader",
|
|
44295
43645
|
uniforms: {
|
|
@@ -45898,7 +45248,7 @@ start.__type = [() => __\u03A9HTMLCanvasElement, "canvas", () => __\u03A9StartOp
|
|
|
45898
45248
|
|
|
45899
45249
|
// blueprint:./pixel-window.blp
|
|
45900
45250
|
init_console_gjs();
|
|
45901
|
-
|
|
45251
|
+
init_auto_globals_97a682e619();
|
|
45902
45252
|
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
45253
|
|
|
45904
45254
|
// src/gjs/pixel-window.ts
|