@gjsify/example-dom-three-geometry-teapot 0.1.15 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +404 -157
- package/dist/gjs.js +1292 -478
- package/package.json +12 -12
package/dist/gjs.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
if(typeof globalThis.process==="undefined"){const _s=imports.system,_G=imports.gi.GLib;globalThis.process={platform:"linux",arch:"x64",version:"v20.0.0",env:new Proxy({},{get(_,p){return typeof p==="string"?(_G.getenv(p)??undefined):undefined},set(_,p,v){if(typeof p==="string")_G.setenv(p,String(v),true);return true},has(_,p){return typeof p==="string"&&_G.getenv(p)!==null},deleteProperty(_,p){if(typeof p==="string")_G.unsetenv(p);return true},ownKeys(){return _G.listenv()??[]},getOwnPropertyDescriptor(_,p){const v=_G.getenv(p);return v!==null?{value:v,writable:true,enumerable:true,configurable:true}:undefined}}),argv:_s?.programArgs?["gjs",_s.programInvocationName||"",..._s.programArgs]:["gjs"],versions:{},config:{},cwd(){return _G.get_current_dir()||"/"},exit(c){_s.exit(c??0)},stderr:{write(s){printerr(s)}},stdout:{write(s){print(s)}},stdin:null,exitCode:undefined,nextTick(fn,...a){Promise.resolve().then(()=>fn(...a))},hrtime(t){return t?[0,0]:[0,0]},};}
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -10,10 +11,6 @@ var __esm = (fn, res) => function __init() {
|
|
|
10
11
|
var __commonJS = (cb, mod) => function __require() {
|
|
11
12
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
13
|
};
|
|
13
|
-
var __export = (target, all) => {
|
|
14
|
-
for (var name2 in all)
|
|
15
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
16
|
-
};
|
|
17
14
|
var __copyProps = (to, from, except, desc) => {
|
|
18
15
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
16
|
for (let key of __getOwnPropNames(from))
|
|
@@ -30,14 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
28
|
mod
|
|
32
29
|
));
|
|
33
|
-
var __toCommonJS = (mod) => {
|
|
34
|
-
var ns = __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
if (typeof ns.default !== "undefined") {
|
|
36
|
-
var keys = Object.keys(ns);
|
|
37
|
-
if (keys.length === 1 || (keys.length === 2 && keys.includes("__esModule"))) return ns.default;
|
|
38
|
-
}
|
|
39
|
-
return ns;
|
|
40
|
-
};
|
|
41
30
|
|
|
42
31
|
// ../../../packages/infra/esbuild-plugin-gjsify/dist/shims/console-gjs.js
|
|
43
32
|
function _formatArgs(...args) {
|
|
@@ -280,7 +269,7 @@ function makeCallable(Cls) {
|
|
|
280
269
|
var init_callable = __esm({
|
|
281
270
|
"../../../packages/gjs/utils/lib/esm/callable.js"() {
|
|
282
271
|
init_console_gjs();
|
|
283
|
-
|
|
272
|
+
init_auto_globals_53fe98c6e6();
|
|
284
273
|
}
|
|
285
274
|
});
|
|
286
275
|
|
|
@@ -322,7 +311,7 @@ var B64_CHARS, B64_LOOKUP;
|
|
|
322
311
|
var init_base64 = __esm({
|
|
323
312
|
"../../../packages/gjs/utils/lib/esm/base64.js"() {
|
|
324
313
|
init_console_gjs();
|
|
325
|
-
|
|
314
|
+
init_auto_globals_53fe98c6e6();
|
|
326
315
|
B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
327
316
|
B64_LOOKUP = new Uint8Array(256);
|
|
328
317
|
for (let i = 0; i < B64_CHARS.length; i++) B64_LOOKUP[B64_CHARS.charCodeAt(i)] = i;
|
|
@@ -333,7 +322,7 @@ var init_base64 = __esm({
|
|
|
333
322
|
var init_byte_array = __esm({
|
|
334
323
|
"../../../packages/gjs/utils/lib/esm/byte-array.js"() {
|
|
335
324
|
init_console_gjs();
|
|
336
|
-
|
|
325
|
+
init_auto_globals_53fe98c6e6();
|
|
337
326
|
}
|
|
338
327
|
});
|
|
339
328
|
|
|
@@ -343,7 +332,7 @@ var glib_2_0_default;
|
|
|
343
332
|
var init_glib_2_0 = __esm({
|
|
344
333
|
"../../../node_modules/@girs/glib-2.0/glib-2.0.js"() {
|
|
345
334
|
init_console_gjs();
|
|
346
|
-
|
|
335
|
+
init_auto_globals_53fe98c6e6();
|
|
347
336
|
glib_2_0_default = GLib;
|
|
348
337
|
}
|
|
349
338
|
});
|
|
@@ -353,7 +342,7 @@ var glib_2_default;
|
|
|
353
342
|
var init_glib_2 = __esm({
|
|
354
343
|
"../../../node_modules/@girs/glib-2.0/index.js"() {
|
|
355
344
|
init_console_gjs();
|
|
356
|
-
|
|
345
|
+
init_auto_globals_53fe98c6e6();
|
|
357
346
|
init_glib_2_0();
|
|
358
347
|
glib_2_default = glib_2_0_default;
|
|
359
348
|
}
|
|
@@ -364,7 +353,7 @@ var byteArray;
|
|
|
364
353
|
var init_cli = __esm({
|
|
365
354
|
"../../../packages/gjs/utils/lib/esm/cli.js"() {
|
|
366
355
|
init_console_gjs();
|
|
367
|
-
|
|
356
|
+
init_auto_globals_53fe98c6e6();
|
|
368
357
|
init_glib_2();
|
|
369
358
|
byteArray = imports.byteArray;
|
|
370
359
|
}
|
|
@@ -374,7 +363,7 @@ var init_cli = __esm({
|
|
|
374
363
|
var init_defer = __esm({
|
|
375
364
|
"../../../packages/gjs/utils/lib/esm/defer.js"() {
|
|
376
365
|
init_console_gjs();
|
|
377
|
-
|
|
366
|
+
init_auto_globals_53fe98c6e6();
|
|
378
367
|
}
|
|
379
368
|
});
|
|
380
369
|
|
|
@@ -413,7 +402,7 @@ var VALID_ENCODINGS;
|
|
|
413
402
|
var init_encoding = __esm({
|
|
414
403
|
"../../../packages/gjs/utils/lib/esm/encoding.js"() {
|
|
415
404
|
init_console_gjs();
|
|
416
|
-
|
|
405
|
+
init_auto_globals_53fe98c6e6();
|
|
417
406
|
VALID_ENCODINGS = ["utf8", "ascii", "latin1", "binary", "base64", "base64url", "hex", "ucs2", "utf16le"];
|
|
418
407
|
}
|
|
419
408
|
});
|
|
@@ -427,7 +416,7 @@ function registerGlobal(name2, value2) {
|
|
|
427
416
|
var init_globals = __esm({
|
|
428
417
|
"../../../packages/gjs/utils/lib/esm/globals.js"() {
|
|
429
418
|
init_console_gjs();
|
|
430
|
-
|
|
419
|
+
init_auto_globals_53fe98c6e6();
|
|
431
420
|
}
|
|
432
421
|
});
|
|
433
422
|
|
|
@@ -436,7 +425,7 @@ var initErrorV8Methods;
|
|
|
436
425
|
var init_error = __esm({
|
|
437
426
|
"../../../packages/gjs/utils/lib/esm/error.js"() {
|
|
438
427
|
init_console_gjs();
|
|
439
|
-
|
|
428
|
+
init_auto_globals_53fe98c6e6();
|
|
440
429
|
initErrorV8Methods = (ErrorConstructor) => {
|
|
441
430
|
if (!Error.captureStackTrace) {
|
|
442
431
|
Error.captureStackTrace = function(targetObject, constructorOpt) {
|
|
@@ -463,7 +452,7 @@ var byteArray2;
|
|
|
463
452
|
var init_file = __esm({
|
|
464
453
|
"../../../packages/gjs/utils/lib/esm/file.js"() {
|
|
465
454
|
init_console_gjs();
|
|
466
|
-
|
|
455
|
+
init_auto_globals_53fe98c6e6();
|
|
467
456
|
init_glib_2();
|
|
468
457
|
byteArray2 = imports.byteArray;
|
|
469
458
|
}
|
|
@@ -475,7 +464,7 @@ var gio_2_0_default;
|
|
|
475
464
|
var init_gio_2_0 = __esm({
|
|
476
465
|
"../../../node_modules/@girs/gio-2.0/gio-2.0.js"() {
|
|
477
466
|
init_console_gjs();
|
|
478
|
-
|
|
467
|
+
init_auto_globals_53fe98c6e6();
|
|
479
468
|
gio_2_0_default = Gio;
|
|
480
469
|
}
|
|
481
470
|
});
|
|
@@ -485,7 +474,7 @@ var gio_2_default;
|
|
|
485
474
|
var init_gio_2 = __esm({
|
|
486
475
|
"../../../node_modules/@girs/gio-2.0/index.js"() {
|
|
487
476
|
init_console_gjs();
|
|
488
|
-
|
|
477
|
+
init_auto_globals_53fe98c6e6();
|
|
489
478
|
init_gio_2_0();
|
|
490
479
|
gio_2_default = gio_2_0_default;
|
|
491
480
|
}
|
|
@@ -496,7 +485,7 @@ import GioUnix from "gi://GioUnix?version=2.0";
|
|
|
496
485
|
var init_giounix_2_0 = __esm({
|
|
497
486
|
"../../../node_modules/@girs/giounix-2.0/giounix-2.0.js"() {
|
|
498
487
|
init_console_gjs();
|
|
499
|
-
|
|
488
|
+
init_auto_globals_53fe98c6e6();
|
|
500
489
|
}
|
|
501
490
|
});
|
|
502
491
|
|
|
@@ -504,7 +493,7 @@ var init_giounix_2_0 = __esm({
|
|
|
504
493
|
var init_giounix_2 = __esm({
|
|
505
494
|
"../../../node_modules/@girs/giounix-2.0/index.js"() {
|
|
506
495
|
init_console_gjs();
|
|
507
|
-
|
|
496
|
+
init_auto_globals_53fe98c6e6();
|
|
508
497
|
init_giounix_2_0();
|
|
509
498
|
}
|
|
510
499
|
});
|
|
@@ -513,7 +502,7 @@ var init_giounix_2 = __esm({
|
|
|
513
502
|
var init_fs = __esm({
|
|
514
503
|
"../../../packages/gjs/utils/lib/esm/fs.js"() {
|
|
515
504
|
init_console_gjs();
|
|
516
|
-
|
|
505
|
+
init_auto_globals_53fe98c6e6();
|
|
517
506
|
init_gio_2();
|
|
518
507
|
init_giounix_2();
|
|
519
508
|
}
|
|
@@ -524,7 +513,7 @@ var byteArray3;
|
|
|
524
513
|
var init_gio = __esm({
|
|
525
514
|
"../../../packages/gjs/utils/lib/esm/gio.js"() {
|
|
526
515
|
init_console_gjs();
|
|
527
|
-
|
|
516
|
+
init_auto_globals_53fe98c6e6();
|
|
528
517
|
init_glib_2();
|
|
529
518
|
byteArray3 = imports.byteArray;
|
|
530
519
|
}
|
|
@@ -534,7 +523,7 @@ var init_gio = __esm({
|
|
|
534
523
|
var init_gio_errors = __esm({
|
|
535
524
|
"../../../packages/gjs/utils/lib/esm/gio-errors.js"() {
|
|
536
525
|
init_console_gjs();
|
|
537
|
-
|
|
526
|
+
init_auto_globals_53fe98c6e6();
|
|
538
527
|
}
|
|
539
528
|
});
|
|
540
529
|
|
|
@@ -543,7 +532,7 @@ var warnNotImplemented;
|
|
|
543
532
|
var init_message = __esm({
|
|
544
533
|
"../../../packages/gjs/utils/lib/esm/message.js"() {
|
|
545
534
|
init_console_gjs();
|
|
546
|
-
|
|
535
|
+
init_auto_globals_53fe98c6e6();
|
|
547
536
|
warnNotImplemented = (msg) => {
|
|
548
537
|
const message = msg ? `Not implemented: ${msg}` : "Not implemented";
|
|
549
538
|
console.warn(message);
|
|
@@ -552,15 +541,23 @@ var init_message = __esm({
|
|
|
552
541
|
}
|
|
553
542
|
});
|
|
554
543
|
|
|
544
|
+
// ../../../packages/gjs/utils/lib/esm/microtask.js
|
|
545
|
+
var queueMicrotask2;
|
|
546
|
+
var init_microtask = __esm({
|
|
547
|
+
"../../../packages/gjs/utils/lib/esm/microtask.js"() {
|
|
548
|
+
init_console_gjs();
|
|
549
|
+
init_auto_globals_53fe98c6e6();
|
|
550
|
+
queueMicrotask2 = (fn) => {
|
|
551
|
+
Promise.resolve().then(fn);
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
|
|
555
556
|
// ../../../packages/gjs/utils/lib/esm/next-tick.js
|
|
556
|
-
var nextTick;
|
|
557
557
|
var init_next_tick = __esm({
|
|
558
558
|
"../../../packages/gjs/utils/lib/esm/next-tick.js"() {
|
|
559
559
|
init_console_gjs();
|
|
560
|
-
|
|
561
|
-
nextTick = typeof globalThis.process?.nextTick === "function" ? globalThis.process.nextTick : typeof globalThis.queueMicrotask === "function" ? (fn, ...args) => queueMicrotask(() => fn(...args)) : (fn, ...args) => {
|
|
562
|
-
Promise.resolve().then(() => fn(...args));
|
|
563
|
-
};
|
|
560
|
+
init_auto_globals_53fe98c6e6();
|
|
564
561
|
}
|
|
565
562
|
});
|
|
566
563
|
|
|
@@ -569,7 +566,7 @@ var File;
|
|
|
569
566
|
var init_path = __esm({
|
|
570
567
|
"../../../packages/gjs/utils/lib/esm/path.js"() {
|
|
571
568
|
init_console_gjs();
|
|
572
|
-
|
|
569
|
+
init_auto_globals_53fe98c6e6();
|
|
573
570
|
init_gio_2();
|
|
574
571
|
init_glib_2();
|
|
575
572
|
({ File } = gio_2_default);
|
|
@@ -581,16 +578,41 @@ var toString;
|
|
|
581
578
|
var init_structured_clone = __esm({
|
|
582
579
|
"../../../packages/gjs/utils/lib/esm/structured-clone.js"() {
|
|
583
580
|
init_console_gjs();
|
|
584
|
-
|
|
581
|
+
init_auto_globals_53fe98c6e6();
|
|
585
582
|
({ toString } = Object.prototype);
|
|
586
583
|
}
|
|
587
584
|
});
|
|
588
585
|
|
|
589
586
|
// ../../../packages/gjs/utils/lib/esm/main-loop.js
|
|
587
|
+
function ensureMainLoop() {
|
|
588
|
+
const gjsImports = globalThis.imports;
|
|
589
|
+
if (!gjsImports) return void 0;
|
|
590
|
+
if (_started) return _loop;
|
|
591
|
+
const GLibModule = gjsImports.gi.GLib;
|
|
592
|
+
_loop = new GLibModule.MainLoop(null, false);
|
|
593
|
+
_started = true;
|
|
594
|
+
if (GLibModule.main_depth() === 0) {
|
|
595
|
+
try {
|
|
596
|
+
_loop.runAsync();
|
|
597
|
+
} catch {
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return _loop;
|
|
601
|
+
}
|
|
602
|
+
function quitMainLoop() {
|
|
603
|
+
if (_loop) {
|
|
604
|
+
_loop.quit();
|
|
605
|
+
_started = false;
|
|
606
|
+
_loop = null;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
var _started, _loop;
|
|
590
610
|
var init_main_loop = __esm({
|
|
591
611
|
"../../../packages/gjs/utils/lib/esm/main-loop.js"() {
|
|
592
612
|
init_console_gjs();
|
|
593
|
-
|
|
613
|
+
init_auto_globals_53fe98c6e6();
|
|
614
|
+
_started = false;
|
|
615
|
+
_loop = null;
|
|
594
616
|
}
|
|
595
617
|
});
|
|
596
618
|
|
|
@@ -598,7 +620,7 @@ var init_main_loop = __esm({
|
|
|
598
620
|
var init_esm = __esm({
|
|
599
621
|
"../../../packages/gjs/utils/lib/esm/index.js"() {
|
|
600
622
|
init_console_gjs();
|
|
601
|
-
|
|
623
|
+
init_auto_globals_53fe98c6e6();
|
|
602
624
|
init_callable();
|
|
603
625
|
init_base64();
|
|
604
626
|
init_byte_array();
|
|
@@ -612,6 +634,7 @@ var init_esm = __esm({
|
|
|
612
634
|
init_gio();
|
|
613
635
|
init_gio_errors();
|
|
614
636
|
init_message();
|
|
637
|
+
init_microtask();
|
|
615
638
|
init_next_tick();
|
|
616
639
|
init_path();
|
|
617
640
|
init_structured_clone();
|
|
@@ -624,7 +647,7 @@ var _encoder, BlobPolyfill, FilePolyfill, Blob2, File2;
|
|
|
624
647
|
var init_blob = __esm({
|
|
625
648
|
"../../../packages/node/buffer/lib/esm/blob.js"() {
|
|
626
649
|
init_console_gjs();
|
|
627
|
-
|
|
650
|
+
init_auto_globals_53fe98c6e6();
|
|
628
651
|
_encoder = new TextEncoder();
|
|
629
652
|
BlobPolyfill = class _BlobPolyfill {
|
|
630
653
|
_parts;
|
|
@@ -694,7 +717,7 @@ var init_blob = __esm({
|
|
|
694
717
|
var init_register = __esm({
|
|
695
718
|
"../../../packages/node/buffer/lib/esm/register.js"() {
|
|
696
719
|
init_console_gjs();
|
|
697
|
-
|
|
720
|
+
init_auto_globals_53fe98c6e6();
|
|
698
721
|
init_esm();
|
|
699
722
|
init_blob();
|
|
700
723
|
registerGlobal("Blob", Blob2);
|
|
@@ -796,7 +819,7 @@ var NAMED_COLORS, BLACK;
|
|
|
796
819
|
var init_color = __esm({
|
|
797
820
|
"../../../packages/dom/canvas2d-core/lib/esm/color.js"() {
|
|
798
821
|
init_console_gjs();
|
|
799
|
-
|
|
822
|
+
init_auto_globals_53fe98c6e6();
|
|
800
823
|
NAMED_COLORS = {
|
|
801
824
|
aliceblue: "#f0f8ff",
|
|
802
825
|
antiquewhite: "#faebd7",
|
|
@@ -1055,7 +1078,7 @@ var COMPOSITE_OP_MAP, LINE_CAP_MAP, LINE_JOIN_MAP;
|
|
|
1055
1078
|
var init_cairo_utils = __esm({
|
|
1056
1079
|
"../../../packages/dom/canvas2d-core/lib/esm/cairo-utils.js"() {
|
|
1057
1080
|
init_console_gjs();
|
|
1058
|
-
|
|
1081
|
+
init_auto_globals_53fe98c6e6();
|
|
1059
1082
|
COMPOSITE_OP_MAP = {
|
|
1060
1083
|
"source-over": 2,
|
|
1061
1084
|
// OVER
|
|
@@ -1161,7 +1184,7 @@ function cloneState(state) {
|
|
|
1161
1184
|
var init_canvas_state = __esm({
|
|
1162
1185
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-state.js"() {
|
|
1163
1186
|
init_console_gjs();
|
|
1164
|
-
|
|
1187
|
+
init_auto_globals_53fe98c6e6();
|
|
1165
1188
|
init_color();
|
|
1166
1189
|
}
|
|
1167
1190
|
});
|
|
@@ -1171,7 +1194,7 @@ var OurImageData;
|
|
|
1171
1194
|
var init_image_data = __esm({
|
|
1172
1195
|
"../../../packages/dom/canvas2d-core/lib/esm/image-data.js"() {
|
|
1173
1196
|
init_console_gjs();
|
|
1174
|
-
|
|
1197
|
+
init_auto_globals_53fe98c6e6();
|
|
1175
1198
|
OurImageData = class {
|
|
1176
1199
|
constructor(swOrData, sh, maybeHeight) {
|
|
1177
1200
|
this.colorSpace = "srgb";
|
|
@@ -1200,7 +1223,7 @@ var CanvasGradient;
|
|
|
1200
1223
|
var init_canvas_gradient = __esm({
|
|
1201
1224
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-gradient.js"() {
|
|
1202
1225
|
init_console_gjs();
|
|
1203
|
-
|
|
1226
|
+
init_auto_globals_53fe98c6e6();
|
|
1204
1227
|
init_color();
|
|
1205
1228
|
CanvasGradient = class {
|
|
1206
1229
|
constructor(type, x0, y0, x1, y1, r0, r1) {
|
|
@@ -1230,7 +1253,7 @@ var CanvasPattern;
|
|
|
1230
1253
|
var init_canvas_pattern = __esm({
|
|
1231
1254
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-pattern.js"() {
|
|
1232
1255
|
init_console_gjs();
|
|
1233
|
-
|
|
1256
|
+
init_auto_globals_53fe98c6e6();
|
|
1234
1257
|
CanvasPattern = class _CanvasPattern {
|
|
1235
1258
|
constructor(surface, repetition) {
|
|
1236
1259
|
this._pattern = new Cairo2.SurfacePattern(surface);
|
|
@@ -1292,7 +1315,7 @@ var Path2D;
|
|
|
1292
1315
|
var init_canvas_path = __esm({
|
|
1293
1316
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-path.js"() {
|
|
1294
1317
|
init_console_gjs();
|
|
1295
|
-
|
|
1318
|
+
init_auto_globals_53fe98c6e6();
|
|
1296
1319
|
init_cairo_utils();
|
|
1297
1320
|
Path2D = class _Path2D {
|
|
1298
1321
|
constructor(pathOrSvg) {
|
|
@@ -1406,7 +1429,7 @@ var CanvasRenderingContext2D;
|
|
|
1406
1429
|
var init_canvas_rendering_context_2d = __esm({
|
|
1407
1430
|
"../../../packages/dom/canvas2d-core/lib/esm/canvas-rendering-context-2d.js"() {
|
|
1408
1431
|
init_console_gjs();
|
|
1409
|
-
|
|
1432
|
+
init_auto_globals_53fe98c6e6();
|
|
1410
1433
|
init_color();
|
|
1411
1434
|
init_cairo_utils();
|
|
1412
1435
|
init_canvas_state();
|
|
@@ -2393,7 +2416,7 @@ var init_canvas_rendering_context_2d = __esm({
|
|
|
2393
2416
|
var init_esm2 = __esm({
|
|
2394
2417
|
"../../../packages/dom/canvas2d-core/lib/esm/index.js"() {
|
|
2395
2418
|
init_console_gjs();
|
|
2396
|
-
|
|
2419
|
+
init_auto_globals_53fe98c6e6();
|
|
2397
2420
|
init_canvas_rendering_context_2d();
|
|
2398
2421
|
init_canvas_gradient();
|
|
2399
2422
|
init_canvas_pattern();
|
|
@@ -2408,7 +2431,7 @@ var DOMExceptionCodes, _DOMExceptionPolyfill, DOMException2;
|
|
|
2408
2431
|
var init_esm3 = __esm({
|
|
2409
2432
|
"../../../packages/web/dom-exception/lib/esm/index.js"() {
|
|
2410
2433
|
init_console_gjs();
|
|
2411
|
-
|
|
2434
|
+
init_auto_globals_53fe98c6e6();
|
|
2412
2435
|
DOMExceptionCodes = {
|
|
2413
2436
|
IndexSizeError: 1,
|
|
2414
2437
|
HierarchyRequestError: 3,
|
|
@@ -2450,7 +2473,7 @@ var kType, kBubbles, kCancelable, kComposed, kTarget, kCurrentTarget, kEventPhas
|
|
|
2450
2473
|
var init_esm4 = __esm({
|
|
2451
2474
|
"../../../packages/web/dom-events/lib/esm/index.js"() {
|
|
2452
2475
|
init_console_gjs();
|
|
2453
|
-
|
|
2476
|
+
init_auto_globals_53fe98c6e6();
|
|
2454
2477
|
init_esm3();
|
|
2455
2478
|
kType = /* @__PURE__ */ Symbol("type");
|
|
2456
2479
|
kBubbles = /* @__PURE__ */ Symbol("bubbles");
|
|
@@ -2914,7 +2937,7 @@ var NodeType;
|
|
|
2914
2937
|
var init_node_type = __esm({
|
|
2915
2938
|
"../../../packages/dom/dom-elements/lib/esm/node-type.js"() {
|
|
2916
2939
|
init_console_gjs();
|
|
2917
|
-
|
|
2940
|
+
init_auto_globals_53fe98c6e6();
|
|
2918
2941
|
NodeType = {
|
|
2919
2942
|
ELEMENT_NODE: 1,
|
|
2920
2943
|
ATTRIBUTE_NODE: 2,
|
|
@@ -2934,7 +2957,7 @@ var NodeList;
|
|
|
2934
2957
|
var init_node_list = __esm({
|
|
2935
2958
|
"../../../packages/dom/dom-elements/lib/esm/node-list.js"() {
|
|
2936
2959
|
init_console_gjs();
|
|
2937
|
-
|
|
2960
|
+
init_auto_globals_53fe98c6e6();
|
|
2938
2961
|
NodeList = class {
|
|
2939
2962
|
constructor(items) {
|
|
2940
2963
|
this._items = items;
|
|
@@ -2974,7 +2997,7 @@ var nodeType, parentNode, childNodesList, elementChildren, isConnected, tagName,
|
|
|
2974
2997
|
var init_property_symbol = __esm({
|
|
2975
2998
|
"../../../packages/dom/dom-elements/lib/esm/property-symbol.js"() {
|
|
2976
2999
|
init_console_gjs();
|
|
2977
|
-
|
|
3000
|
+
init_auto_globals_53fe98c6e6();
|
|
2978
3001
|
nodeType = /* @__PURE__ */ Symbol("nodeType");
|
|
2979
3002
|
parentNode = /* @__PURE__ */ Symbol("parentNode");
|
|
2980
3003
|
childNodesList = /* @__PURE__ */ Symbol("childNodesList");
|
|
@@ -2997,7 +3020,7 @@ var _a, _b, _c, _d, _e, Node;
|
|
|
2997
3020
|
var init_node = __esm({
|
|
2998
3021
|
"../../../packages/dom/dom-elements/lib/esm/node.js"() {
|
|
2999
3022
|
init_console_gjs();
|
|
3000
|
-
|
|
3023
|
+
init_auto_globals_53fe98c6e6();
|
|
3001
3024
|
init_esm4();
|
|
3002
3025
|
init_node_type();
|
|
3003
3026
|
init_node_list();
|
|
@@ -3247,7 +3270,7 @@ var Attr;
|
|
|
3247
3270
|
var init_attr = __esm({
|
|
3248
3271
|
"../../../packages/dom/dom-elements/lib/esm/attr.js"() {
|
|
3249
3272
|
init_console_gjs();
|
|
3250
|
-
|
|
3273
|
+
init_auto_globals_53fe98c6e6();
|
|
3251
3274
|
init_property_symbol();
|
|
3252
3275
|
Attr = class {
|
|
3253
3276
|
constructor(name2, value2, namespaceURI2 = null, prefix2 = null, ownerElement2 = null) {
|
|
@@ -3284,7 +3307,7 @@ var NamespaceURI;
|
|
|
3284
3307
|
var init_namespace_uri = __esm({
|
|
3285
3308
|
"../../../packages/dom/dom-elements/lib/esm/namespace-uri.js"() {
|
|
3286
3309
|
init_console_gjs();
|
|
3287
|
-
|
|
3310
|
+
init_auto_globals_53fe98c6e6();
|
|
3288
3311
|
NamespaceURI = {
|
|
3289
3312
|
html: "http://www.w3.org/1999/xhtml",
|
|
3290
3313
|
svg: "http://www.w3.org/2000/svg",
|
|
@@ -3300,7 +3323,7 @@ var NamedNodeMap;
|
|
|
3300
3323
|
var init_named_node_map = __esm({
|
|
3301
3324
|
"../../../packages/dom/dom-elements/lib/esm/named-node-map.js"() {
|
|
3302
3325
|
init_console_gjs();
|
|
3303
|
-
|
|
3326
|
+
init_auto_globals_53fe98c6e6();
|
|
3304
3327
|
init_attr();
|
|
3305
3328
|
init_namespace_uri();
|
|
3306
3329
|
NamedNodeMap = class {
|
|
@@ -3430,7 +3453,7 @@ var _a2, _b2, _c2, _d2, _e2, _f, Element;
|
|
|
3430
3453
|
var init_element = __esm({
|
|
3431
3454
|
"../../../packages/dom/dom-elements/lib/esm/element.js"() {
|
|
3432
3455
|
init_console_gjs();
|
|
3433
|
-
|
|
3456
|
+
init_auto_globals_53fe98c6e6();
|
|
3434
3457
|
init_node();
|
|
3435
3458
|
init_node_type();
|
|
3436
3459
|
init_named_node_map();
|
|
@@ -3682,7 +3705,7 @@ var CSSStyleDeclaration, HTMLElement;
|
|
|
3682
3705
|
var init_html_element = __esm({
|
|
3683
3706
|
"../../../packages/dom/dom-elements/lib/esm/html-element.js"() {
|
|
3684
3707
|
init_console_gjs();
|
|
3685
|
-
|
|
3708
|
+
init_auto_globals_53fe98c6e6();
|
|
3686
3709
|
init_esm4();
|
|
3687
3710
|
init_element();
|
|
3688
3711
|
init_property_symbol();
|
|
@@ -4112,7 +4135,7 @@ var HTMLCanvasElement2;
|
|
|
4112
4135
|
var init_html_canvas_element = __esm({
|
|
4113
4136
|
"../../../packages/dom/dom-elements/lib/esm/html-canvas-element.js"() {
|
|
4114
4137
|
init_console_gjs();
|
|
4115
|
-
|
|
4138
|
+
init_auto_globals_53fe98c6e6();
|
|
4116
4139
|
init_html_element();
|
|
4117
4140
|
HTMLCanvasElement2 = class _HTMLCanvasElement extends HTMLElement {
|
|
4118
4141
|
constructor() {
|
|
@@ -4192,7 +4215,7 @@ var DOMMatrix, DOMMatrixReadOnly;
|
|
|
4192
4215
|
var init_dom_matrix = __esm({
|
|
4193
4216
|
"../../../packages/dom/dom-elements/lib/esm/dom-matrix.js"() {
|
|
4194
4217
|
init_console_gjs();
|
|
4195
|
-
|
|
4218
|
+
init_auto_globals_53fe98c6e6();
|
|
4196
4219
|
DOMMatrix = class _DOMMatrix {
|
|
4197
4220
|
constructor(init) {
|
|
4198
4221
|
this.a = 1;
|
|
@@ -4330,7 +4353,7 @@ function defineGlobalIfMissing(name2, value2) {
|
|
|
4330
4353
|
var init_helpers = __esm({
|
|
4331
4354
|
"../../../packages/dom/dom-elements/lib/esm/register/helpers.js"() {
|
|
4332
4355
|
init_console_gjs();
|
|
4333
|
-
|
|
4356
|
+
init_auto_globals_53fe98c6e6();
|
|
4334
4357
|
}
|
|
4335
4358
|
});
|
|
4336
4359
|
|
|
@@ -4339,7 +4362,7 @@ var CANVAS2D_KEY;
|
|
|
4339
4362
|
var init_canvas = __esm({
|
|
4340
4363
|
"../../../packages/dom/dom-elements/lib/esm/register/canvas.js"() {
|
|
4341
4364
|
init_console_gjs();
|
|
4342
|
-
|
|
4365
|
+
init_auto_globals_53fe98c6e6();
|
|
4343
4366
|
init_esm2();
|
|
4344
4367
|
init_html_canvas_element();
|
|
4345
4368
|
init_dom_matrix();
|
|
@@ -4364,7 +4387,7 @@ var CharacterData;
|
|
|
4364
4387
|
var init_character_data = __esm({
|
|
4365
4388
|
"../../../packages/dom/dom-elements/lib/esm/character-data.js"() {
|
|
4366
4389
|
init_console_gjs();
|
|
4367
|
-
|
|
4390
|
+
init_auto_globals_53fe98c6e6();
|
|
4368
4391
|
init_node();
|
|
4369
4392
|
init_node_type();
|
|
4370
4393
|
init_property_symbol();
|
|
@@ -4426,7 +4449,7 @@ var Comment;
|
|
|
4426
4449
|
var init_comment = __esm({
|
|
4427
4450
|
"../../../packages/dom/dom-elements/lib/esm/comment.js"() {
|
|
4428
4451
|
init_console_gjs();
|
|
4429
|
-
|
|
4452
|
+
init_auto_globals_53fe98c6e6();
|
|
4430
4453
|
init_character_data();
|
|
4431
4454
|
init_node_type();
|
|
4432
4455
|
init_property_symbol();
|
|
@@ -4454,7 +4477,7 @@ var gdkpixbuf_2_0_default;
|
|
|
4454
4477
|
var init_gdkpixbuf_2_0 = __esm({
|
|
4455
4478
|
"../../../node_modules/@girs/gdkpixbuf-2.0/gdkpixbuf-2.0.js"() {
|
|
4456
4479
|
init_console_gjs();
|
|
4457
|
-
|
|
4480
|
+
init_auto_globals_53fe98c6e6();
|
|
4458
4481
|
gdkpixbuf_2_0_default = GdkPixbuf2;
|
|
4459
4482
|
}
|
|
4460
4483
|
});
|
|
@@ -4464,7 +4487,7 @@ var gdkpixbuf_2_default;
|
|
|
4464
4487
|
var init_gdkpixbuf_2 = __esm({
|
|
4465
4488
|
"../../../node_modules/@girs/gdkpixbuf-2.0/index.js"() {
|
|
4466
4489
|
init_console_gjs();
|
|
4467
|
-
|
|
4490
|
+
init_auto_globals_53fe98c6e6();
|
|
4468
4491
|
init_gdkpixbuf_2_0();
|
|
4469
4492
|
gdkpixbuf_2_default = gdkpixbuf_2_0_default;
|
|
4470
4493
|
}
|
|
@@ -4476,7 +4499,7 @@ var HTMLImageElement2;
|
|
|
4476
4499
|
var init_html_image_element = __esm({
|
|
4477
4500
|
"../../../packages/dom/dom-elements/lib/esm/html-image-element.js"() {
|
|
4478
4501
|
init_console_gjs();
|
|
4479
|
-
|
|
4502
|
+
init_auto_globals_53fe98c6e6();
|
|
4480
4503
|
init_glib_2();
|
|
4481
4504
|
init_gio_2();
|
|
4482
4505
|
init_gdkpixbuf_2();
|
|
@@ -4711,7 +4734,7 @@ var HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUG
|
|
|
4711
4734
|
var init_html_media_element = __esm({
|
|
4712
4735
|
"../../../packages/dom/dom-elements/lib/esm/html-media-element.js"() {
|
|
4713
4736
|
init_console_gjs();
|
|
4714
|
-
|
|
4737
|
+
init_auto_globals_53fe98c6e6();
|
|
4715
4738
|
init_esm4();
|
|
4716
4739
|
init_html_element();
|
|
4717
4740
|
HAVE_NOTHING = 0;
|
|
@@ -4824,33 +4847,129 @@ var init_html_media_element = __esm({
|
|
|
4824
4847
|
}
|
|
4825
4848
|
});
|
|
4826
4849
|
|
|
4850
|
+
// ../../../packages/dom/dom-elements/lib/esm/gst-time.js
|
|
4851
|
+
function secondsToGstTime(seconds) {
|
|
4852
|
+
return BigInt(Math.round(seconds * NS_PER_SECOND));
|
|
4853
|
+
}
|
|
4854
|
+
function gstTimeToSeconds(nanoseconds) {
|
|
4855
|
+
return Number(nanoseconds) / NS_PER_SECOND;
|
|
4856
|
+
}
|
|
4857
|
+
var NS_PER_SECOND;
|
|
4858
|
+
var init_gst_time = __esm({
|
|
4859
|
+
"../../../packages/dom/dom-elements/lib/esm/gst-time.js"() {
|
|
4860
|
+
init_console_gjs();
|
|
4861
|
+
init_auto_globals_53fe98c6e6();
|
|
4862
|
+
NS_PER_SECOND = 1e9;
|
|
4863
|
+
}
|
|
4864
|
+
});
|
|
4865
|
+
|
|
4827
4866
|
// ../../../packages/dom/dom-elements/lib/esm/html-video-element.js
|
|
4828
|
-
var HTMLVideoElement2;
|
|
4867
|
+
var GST_STATE_PLAYING, GST_STATE_PAUSED, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_TYPE_SET, GST_SEEK_TYPE_NONE, HTMLVideoElement2;
|
|
4829
4868
|
var init_html_video_element = __esm({
|
|
4830
4869
|
"../../../packages/dom/dom-elements/lib/esm/html-video-element.js"() {
|
|
4831
4870
|
init_console_gjs();
|
|
4832
|
-
|
|
4871
|
+
init_auto_globals_53fe98c6e6();
|
|
4833
4872
|
init_html_media_element();
|
|
4873
|
+
init_esm4();
|
|
4834
4874
|
init_property_symbol();
|
|
4835
4875
|
init_namespace_uri();
|
|
4876
|
+
init_gst_time();
|
|
4877
|
+
GST_STATE_PLAYING = 4;
|
|
4878
|
+
GST_STATE_PAUSED = 3;
|
|
4879
|
+
GST_FORMAT_TIME = 3;
|
|
4880
|
+
GST_SEEK_FLAG_FLUSH = 1;
|
|
4881
|
+
GST_SEEK_FLAG_KEY_UNIT = 4;
|
|
4882
|
+
GST_SEEK_TYPE_SET = 1;
|
|
4883
|
+
GST_SEEK_TYPE_NONE = 0;
|
|
4836
4884
|
HTMLVideoElement2 = class extends HTMLMediaElement {
|
|
4837
4885
|
constructor() {
|
|
4838
4886
|
super();
|
|
4887
|
+
this._pipeline = null;
|
|
4839
4888
|
this._videoWidth = 0;
|
|
4840
4889
|
this._videoHeight = 0;
|
|
4841
4890
|
this.poster = "";
|
|
4842
4891
|
this[tagName] = "VIDEO";
|
|
4843
4892
|
this[localName] = "video";
|
|
4844
4893
|
this[namespaceURI] = NamespaceURI.html;
|
|
4894
|
+
const self2 = this;
|
|
4895
|
+
Object.defineProperty(this, "paused", {
|
|
4896
|
+
get() {
|
|
4897
|
+
if (!self2._pipeline) return true;
|
|
4898
|
+
const [, state] = self2._pipeline.get_state(0n);
|
|
4899
|
+
return state !== GST_STATE_PLAYING;
|
|
4900
|
+
},
|
|
4901
|
+
configurable: true,
|
|
4902
|
+
enumerable: true
|
|
4903
|
+
});
|
|
4904
|
+
Object.defineProperty(this, "currentTime", {
|
|
4905
|
+
get() {
|
|
4906
|
+
if (!self2._pipeline) return 0;
|
|
4907
|
+
const [ok, pos] = self2._pipeline.query_position(GST_FORMAT_TIME);
|
|
4908
|
+
return ok ? gstTimeToSeconds(pos) : 0;
|
|
4909
|
+
},
|
|
4910
|
+
set(seconds) {
|
|
4911
|
+
self2._pipeline?.seek(
|
|
4912
|
+
1,
|
|
4913
|
+
GST_FORMAT_TIME,
|
|
4914
|
+
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
|
|
4915
|
+
GST_SEEK_TYPE_SET,
|
|
4916
|
+
secondsToGstTime(seconds),
|
|
4917
|
+
GST_SEEK_TYPE_NONE,
|
|
4918
|
+
-1n
|
|
4919
|
+
);
|
|
4920
|
+
},
|
|
4921
|
+
configurable: true,
|
|
4922
|
+
enumerable: true
|
|
4923
|
+
});
|
|
4924
|
+
Object.defineProperty(this, "duration", {
|
|
4925
|
+
get() {
|
|
4926
|
+
if (!self2._pipeline) return NaN;
|
|
4927
|
+
const [ok, dur] = self2._pipeline.query_duration(GST_FORMAT_TIME);
|
|
4928
|
+
return ok && Number(dur) > 0 ? gstTimeToSeconds(dur) : NaN;
|
|
4929
|
+
},
|
|
4930
|
+
configurable: true,
|
|
4931
|
+
enumerable: true
|
|
4932
|
+
});
|
|
4933
|
+
Object.defineProperty(this, "volume", {
|
|
4934
|
+
get() {
|
|
4935
|
+
return self2._playbin()?.volume ?? 1;
|
|
4936
|
+
},
|
|
4937
|
+
set(v) {
|
|
4938
|
+
const pb = self2._playbin();
|
|
4939
|
+
if (pb) pb.volume = Math.max(0, Math.min(1, v));
|
|
4940
|
+
},
|
|
4941
|
+
configurable: true,
|
|
4942
|
+
enumerable: true
|
|
4943
|
+
});
|
|
4944
|
+
Object.defineProperty(this, "muted", {
|
|
4945
|
+
get() {
|
|
4946
|
+
return self2._playbin()?.mute ?? false;
|
|
4947
|
+
},
|
|
4948
|
+
set(v) {
|
|
4949
|
+
const pb = self2._playbin();
|
|
4950
|
+
if (pb) pb.mute = v;
|
|
4951
|
+
},
|
|
4952
|
+
configurable: true,
|
|
4953
|
+
enumerable: true
|
|
4954
|
+
});
|
|
4955
|
+
}
|
|
4956
|
+
async play() {
|
|
4957
|
+
this._pipeline?.set_state(GST_STATE_PLAYING);
|
|
4958
|
+
this.dispatchEvent(new Event("play"));
|
|
4959
|
+
this.dispatchEvent(new Event("playing"));
|
|
4960
|
+
}
|
|
4961
|
+
pause() {
|
|
4962
|
+
this._pipeline?.set_state(GST_STATE_PAUSED);
|
|
4963
|
+
this.dispatchEvent(new Event("pause"));
|
|
4845
4964
|
}
|
|
4846
|
-
/** Intrinsic width of the video (set by
|
|
4965
|
+
/** Intrinsic width of the video (set by bridge when media metadata loads). */
|
|
4847
4966
|
get videoWidth() {
|
|
4848
4967
|
return this._videoWidth;
|
|
4849
4968
|
}
|
|
4850
4969
|
set videoWidth(value2) {
|
|
4851
4970
|
this._videoWidth = value2;
|
|
4852
4971
|
}
|
|
4853
|
-
/** Intrinsic height of the video (set by
|
|
4972
|
+
/** Intrinsic height of the video (set by bridge when media metadata loads). */
|
|
4854
4973
|
get videoHeight() {
|
|
4855
4974
|
return this._videoHeight;
|
|
4856
4975
|
}
|
|
@@ -4860,6 +4979,9 @@ var init_html_video_element = __esm({
|
|
|
4860
4979
|
get [Symbol.toStringTag]() {
|
|
4861
4980
|
return "HTMLVideoElement";
|
|
4862
4981
|
}
|
|
4982
|
+
_playbin() {
|
|
4983
|
+
return this._pipeline?.get_by_name("playbin") ?? null;
|
|
4984
|
+
}
|
|
4863
4985
|
};
|
|
4864
4986
|
}
|
|
4865
4987
|
});
|
|
@@ -4869,7 +4991,7 @@ var Text;
|
|
|
4869
4991
|
var init_text = __esm({
|
|
4870
4992
|
"../../../packages/dom/dom-elements/lib/esm/text.js"() {
|
|
4871
4993
|
init_console_gjs();
|
|
4872
|
-
|
|
4994
|
+
init_auto_globals_53fe98c6e6();
|
|
4873
4995
|
init_character_data();
|
|
4874
4996
|
init_node_type();
|
|
4875
4997
|
init_property_symbol();
|
|
@@ -4926,7 +5048,7 @@ var DocumentFragment;
|
|
|
4926
5048
|
var init_document_fragment = __esm({
|
|
4927
5049
|
"../../../packages/dom/dom-elements/lib/esm/document-fragment.js"() {
|
|
4928
5050
|
init_console_gjs();
|
|
4929
|
-
|
|
5051
|
+
init_auto_globals_53fe98c6e6();
|
|
4930
5052
|
init_node();
|
|
4931
5053
|
init_text();
|
|
4932
5054
|
init_node_type();
|
|
@@ -5044,7 +5166,7 @@ var Document, document2;
|
|
|
5044
5166
|
var init_document = __esm({
|
|
5045
5167
|
"../../../packages/dom/dom-elements/lib/esm/document.js"() {
|
|
5046
5168
|
init_console_gjs();
|
|
5047
|
-
|
|
5169
|
+
init_auto_globals_53fe98c6e6();
|
|
5048
5170
|
init_node();
|
|
5049
5171
|
init_html_element();
|
|
5050
5172
|
init_html_image_element();
|
|
@@ -5133,7 +5255,7 @@ var DOMTokenList;
|
|
|
5133
5255
|
var init_dom_token_list = __esm({
|
|
5134
5256
|
"../../../packages/dom/dom-elements/lib/esm/dom-token-list.js"() {
|
|
5135
5257
|
init_console_gjs();
|
|
5136
|
-
|
|
5258
|
+
init_auto_globals_53fe98c6e6();
|
|
5137
5259
|
DOMTokenList = class {
|
|
5138
5260
|
constructor(ownerElement2, attributeName) {
|
|
5139
5261
|
this._ownerElement = ownerElement2;
|
|
@@ -5248,7 +5370,7 @@ var Window;
|
|
|
5248
5370
|
var init_document2 = __esm({
|
|
5249
5371
|
"../../../packages/dom/dom-elements/lib/esm/register/document.js"() {
|
|
5250
5372
|
init_console_gjs();
|
|
5251
|
-
|
|
5373
|
+
init_auto_globals_53fe98c6e6();
|
|
5252
5374
|
init_esm4();
|
|
5253
5375
|
init_comment();
|
|
5254
5376
|
init_document();
|
|
@@ -5297,7 +5419,7 @@ var Image;
|
|
|
5297
5419
|
var init_image = __esm({
|
|
5298
5420
|
"../../../packages/dom/dom-elements/lib/esm/image.js"() {
|
|
5299
5421
|
init_console_gjs();
|
|
5300
|
-
|
|
5422
|
+
init_auto_globals_53fe98c6e6();
|
|
5301
5423
|
init_html_image_element();
|
|
5302
5424
|
Image = class extends HTMLImageElement2 {
|
|
5303
5425
|
/**
|
|
@@ -5323,7 +5445,7 @@ var init_image = __esm({
|
|
|
5323
5445
|
var init_image2 = __esm({
|
|
5324
5446
|
"../../../packages/dom/dom-elements/lib/esm/register/image.js"() {
|
|
5325
5447
|
init_console_gjs();
|
|
5326
|
-
|
|
5448
|
+
init_auto_globals_53fe98c6e6();
|
|
5327
5449
|
init_html_image_element();
|
|
5328
5450
|
init_image();
|
|
5329
5451
|
init_helpers();
|
|
@@ -5336,7 +5458,7 @@ var init_image2 = __esm({
|
|
|
5336
5458
|
var init_navigator = __esm({
|
|
5337
5459
|
"../../../packages/dom/dom-elements/lib/esm/register/navigator.js"() {
|
|
5338
5460
|
init_console_gjs();
|
|
5339
|
-
|
|
5461
|
+
init_auto_globals_53fe98c6e6();
|
|
5340
5462
|
if (typeof globalThis.navigator === "undefined") {
|
|
5341
5463
|
globalThis.navigator = {};
|
|
5342
5464
|
}
|
|
@@ -5451,7 +5573,7 @@ var textEncoder, textDecoder, hasSharedArrayBuffer, Buffer2, kMaxLength, kString
|
|
|
5451
5573
|
var init_buffer = __esm({
|
|
5452
5574
|
"../../../packages/node/buffer/lib/esm/buffer.js"() {
|
|
5453
5575
|
init_console_gjs();
|
|
5454
|
-
|
|
5576
|
+
init_auto_globals_53fe98c6e6();
|
|
5455
5577
|
init_esm();
|
|
5456
5578
|
textEncoder = new TextEncoder();
|
|
5457
5579
|
textDecoder = new TextDecoder();
|
|
@@ -6004,7 +6126,7 @@ var atob2, btoa;
|
|
|
6004
6126
|
var init_esm5 = __esm({
|
|
6005
6127
|
"../../../packages/node/buffer/lib/esm/index.js"() {
|
|
6006
6128
|
init_console_gjs();
|
|
6007
|
-
|
|
6129
|
+
init_auto_globals_53fe98c6e6();
|
|
6008
6130
|
init_buffer();
|
|
6009
6131
|
atob2 = globalThis.atob;
|
|
6010
6132
|
btoa = globalThis.btoa;
|
|
@@ -6015,7 +6137,7 @@ var init_esm5 = __esm({
|
|
|
6015
6137
|
var init_buffer2 = __esm({
|
|
6016
6138
|
"../../../packages/node/globals/lib/esm/register/buffer.js"() {
|
|
6017
6139
|
init_console_gjs();
|
|
6018
|
-
|
|
6140
|
+
init_auto_globals_53fe98c6e6();
|
|
6019
6141
|
init_esm5();
|
|
6020
6142
|
init_register();
|
|
6021
6143
|
if (!("Buffer" in globalThis)) {
|
|
@@ -6033,7 +6155,7 @@ var init_buffer2 = __esm({
|
|
|
6033
6155
|
var init_encoding2 = __esm({
|
|
6034
6156
|
"../../../packages/node/globals/lib/esm/register/encoding.js"() {
|
|
6035
6157
|
init_console_gjs();
|
|
6036
|
-
|
|
6158
|
+
init_auto_globals_53fe98c6e6();
|
|
6037
6159
|
init_glib_2();
|
|
6038
6160
|
if (typeof globalThis.btoa !== "function") {
|
|
6039
6161
|
Object.defineProperty(globalThis, "btoa", {
|
|
@@ -6068,19 +6190,14 @@ var init_encoding2 = __esm({
|
|
|
6068
6190
|
});
|
|
6069
6191
|
|
|
6070
6192
|
// ../../../packages/node/globals/lib/esm/register/microtask.js
|
|
6071
|
-
var
|
|
6193
|
+
var init_microtask2 = __esm({
|
|
6072
6194
|
"../../../packages/node/globals/lib/esm/register/microtask.js"() {
|
|
6073
6195
|
init_console_gjs();
|
|
6074
|
-
|
|
6196
|
+
init_auto_globals_53fe98c6e6();
|
|
6197
|
+
init_esm();
|
|
6075
6198
|
if (typeof queueMicrotask !== "function") {
|
|
6076
6199
|
Object.defineProperty(globalThis, "queueMicrotask", {
|
|
6077
|
-
value:
|
|
6078
|
-
Promise.resolve().then(callback).catch((err) => {
|
|
6079
|
-
setTimeout(() => {
|
|
6080
|
-
throw err;
|
|
6081
|
-
}, 0);
|
|
6082
|
-
});
|
|
6083
|
-
},
|
|
6200
|
+
value: queueMicrotask2,
|
|
6084
6201
|
enumerable: true,
|
|
6085
6202
|
writable: true,
|
|
6086
6203
|
configurable: true
|
|
@@ -6153,7 +6270,7 @@ var kCapture, kRejection, EventEmitter;
|
|
|
6153
6270
|
var init_event_emitter = __esm({
|
|
6154
6271
|
"../../../packages/node/events/lib/esm/event-emitter.js"() {
|
|
6155
6272
|
init_console_gjs();
|
|
6156
|
-
|
|
6273
|
+
init_auto_globals_53fe98c6e6();
|
|
6157
6274
|
kCapture = /* @__PURE__ */ Symbol("kCapture");
|
|
6158
6275
|
kRejection = /* @__PURE__ */ Symbol.for("nodejs.rejection");
|
|
6159
6276
|
EventEmitter = class _EventEmitter {
|
|
@@ -6683,30 +6800,48 @@ var init_event_emitter = __esm({
|
|
|
6683
6800
|
}
|
|
6684
6801
|
};
|
|
6685
6802
|
EventEmitter.EventEmitter = EventEmitter;
|
|
6803
|
+
{
|
|
6804
|
+
const methods = [
|
|
6805
|
+
"setMaxListeners",
|
|
6806
|
+
"getMaxListeners",
|
|
6807
|
+
"emit",
|
|
6808
|
+
"addListener",
|
|
6809
|
+
"on",
|
|
6810
|
+
"prependListener",
|
|
6811
|
+
"once",
|
|
6812
|
+
"prependOnceListener",
|
|
6813
|
+
"removeListener",
|
|
6814
|
+
"off",
|
|
6815
|
+
"removeAllListeners",
|
|
6816
|
+
"listeners",
|
|
6817
|
+
"rawListeners",
|
|
6818
|
+
"listenerCount",
|
|
6819
|
+
"eventNames"
|
|
6820
|
+
];
|
|
6821
|
+
for (const m of methods) {
|
|
6822
|
+
const fn = EventEmitter.prototype[m];
|
|
6823
|
+
if (typeof fn === "function") {
|
|
6824
|
+
Object.defineProperty(EventEmitter.prototype, m, {
|
|
6825
|
+
enumerable: true,
|
|
6826
|
+
configurable: true,
|
|
6827
|
+
writable: true,
|
|
6828
|
+
value: fn
|
|
6829
|
+
});
|
|
6830
|
+
}
|
|
6831
|
+
}
|
|
6832
|
+
Object.defineProperty(EventEmitter.prototype, "_events", { enumerable: true, configurable: true, writable: true, value: void 0 });
|
|
6833
|
+
Object.defineProperty(EventEmitter.prototype, "_eventsCount", { enumerable: true, configurable: true, writable: true, value: 0 });
|
|
6834
|
+
Object.defineProperty(EventEmitter.prototype, "_maxListeners", { enumerable: true, configurable: true, writable: true, value: void 0 });
|
|
6835
|
+
}
|
|
6686
6836
|
}
|
|
6687
6837
|
});
|
|
6688
6838
|
|
|
6689
6839
|
// ../../../packages/node/events/lib/esm/index.js
|
|
6690
|
-
var
|
|
6691
|
-
__export(esm_exports, {
|
|
6692
|
-
EventEmitter: () => EventEmitter2,
|
|
6693
|
-
addAbortListener: () => addAbortListener,
|
|
6694
|
-
captureRejectionSymbol: () => captureRejectionSymbol,
|
|
6695
|
-
default: () => index_default,
|
|
6696
|
-
defaultMaxListeners: () => defaultMaxListeners,
|
|
6697
|
-
errorMonitor: () => errorMonitor,
|
|
6698
|
-
getEventListeners: () => getEventListeners,
|
|
6699
|
-
getMaxListeners: () => getMaxListeners,
|
|
6700
|
-
listenerCount: () => listenerCount,
|
|
6701
|
-
on: () => on,
|
|
6702
|
-
once: () => once,
|
|
6703
|
-
setMaxListeners: () => setMaxListeners
|
|
6704
|
-
});
|
|
6705
|
-
var EventEmitter2, captureRejectionSymbol, errorMonitor, defaultMaxListeners, setMaxListeners, getMaxListeners, once, on, getEventListeners, listenerCount, addAbortListener, index_default;
|
|
6840
|
+
var EventEmitter2, captureRejectionSymbol, errorMonitor, defaultMaxListeners, setMaxListeners, getMaxListeners, once, on, getEventListeners, listenerCount, addAbortListener;
|
|
6706
6841
|
var init_esm6 = __esm({
|
|
6707
6842
|
"../../../packages/node/events/lib/esm/index.js"() {
|
|
6708
6843
|
init_console_gjs();
|
|
6709
|
-
|
|
6844
|
+
init_auto_globals_53fe98c6e6();
|
|
6710
6845
|
init_esm();
|
|
6711
6846
|
init_event_emitter();
|
|
6712
6847
|
EventEmitter2 = makeCallable(EventEmitter);
|
|
@@ -6721,17 +6856,24 @@ var init_esm6 = __esm({
|
|
|
6721
6856
|
getEventListeners = EventEmitter2.getEventListeners;
|
|
6722
6857
|
listenerCount = EventEmitter2.listenerCount;
|
|
6723
6858
|
addAbortListener = EventEmitter2.addAbortListener;
|
|
6724
|
-
index_default = EventEmitter2;
|
|
6725
6859
|
}
|
|
6726
6860
|
});
|
|
6727
6861
|
|
|
6728
|
-
// ../../../packages/node/
|
|
6729
|
-
var
|
|
6730
|
-
|
|
6862
|
+
// ../../../packages/node/terminal-native/lib/esm/index.js
|
|
6863
|
+
var _mod, _gi, nativeTerminal;
|
|
6864
|
+
var init_esm7 = __esm({
|
|
6865
|
+
"../../../packages/node/terminal-native/lib/esm/index.js"() {
|
|
6731
6866
|
init_console_gjs();
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6867
|
+
init_auto_globals_53fe98c6e6();
|
|
6868
|
+
_mod = null;
|
|
6869
|
+
_gi = globalThis.imports?.gi;
|
|
6870
|
+
if (_gi) {
|
|
6871
|
+
try {
|
|
6872
|
+
_mod = _gi["GjsifyTerminal"];
|
|
6873
|
+
} catch {
|
|
6874
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
nativeTerminal = _mod;
|
|
6735
6877
|
}
|
|
6736
6878
|
});
|
|
6737
6879
|
|
|
@@ -6820,12 +6962,6 @@ function detectArch() {
|
|
|
6820
6962
|
if (typeof globalThis.process?.arch === "string") {
|
|
6821
6963
|
return globalThis.process.arch;
|
|
6822
6964
|
}
|
|
6823
|
-
try {
|
|
6824
|
-
const system = getGjsGlobal().imports?.system;
|
|
6825
|
-
if (system?.programInvocationName) {
|
|
6826
|
-
}
|
|
6827
|
-
} catch {
|
|
6828
|
-
}
|
|
6829
6965
|
return "x64";
|
|
6830
6966
|
}
|
|
6831
6967
|
function getCwd() {
|
|
@@ -6920,6 +7056,22 @@ function getPid() {
|
|
|
6920
7056
|
}
|
|
6921
7057
|
return 0;
|
|
6922
7058
|
}
|
|
7059
|
+
function getGioNamespace() {
|
|
7060
|
+
const _gi2 = globalThis.imports?.gi;
|
|
7061
|
+
if (!_gi2) return null;
|
|
7062
|
+
let gio = null;
|
|
7063
|
+
try {
|
|
7064
|
+
gio = _gi2["GioUnix"];
|
|
7065
|
+
} catch {
|
|
7066
|
+
}
|
|
7067
|
+
if (!gio) {
|
|
7068
|
+
try {
|
|
7069
|
+
gio = _gi2["Gio"];
|
|
7070
|
+
} catch {
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
return gio;
|
|
7074
|
+
}
|
|
6923
7075
|
function getMonotonicTime() {
|
|
6924
7076
|
try {
|
|
6925
7077
|
const GLib3 = getGjsGlobal().imports?.gi?.GLib;
|
|
@@ -6933,15 +7085,248 @@ function getMonotonicTime() {
|
|
|
6933
7085
|
}
|
|
6934
7086
|
return BigInt(Date.now()) * 1000000n;
|
|
6935
7087
|
}
|
|
6936
|
-
var
|
|
6937
|
-
var
|
|
7088
|
+
var _encoder2, startTime, ProcessWriteStream, ProcessReadStream, hrtimeBase, Process, process, platform, arch, env, argv, argv0, execPath, pid, ppid, version, versions, cwd, chdir, exit, nextTick, hrtime, uptime, memoryUsage, cpuUsage, kill, abort, umask, emitWarning, execArgv, config, stdout, stderr, stdin, index_default;
|
|
7089
|
+
var init_esm8 = __esm({
|
|
6938
7090
|
"../../../packages/node/process/lib/esm/index.js"() {
|
|
6939
7091
|
init_console_gjs();
|
|
6940
|
-
|
|
6941
|
-
|
|
7092
|
+
init_auto_globals_53fe98c6e6();
|
|
7093
|
+
init_esm6();
|
|
7094
|
+
init_esm();
|
|
7095
|
+
init_esm7();
|
|
7096
|
+
_encoder2 = new TextEncoder();
|
|
6942
7097
|
startTime = Date.now();
|
|
7098
|
+
ProcessWriteStream = class extends EventEmitter2 {
|
|
7099
|
+
fd;
|
|
7100
|
+
// Required by Stream.pipe(): without this, pipe skips dest.write() entirely.
|
|
7101
|
+
writable = true;
|
|
7102
|
+
_outGio = null;
|
|
7103
|
+
constructor(fd) {
|
|
7104
|
+
super();
|
|
7105
|
+
this.fd = fd;
|
|
7106
|
+
const gio = getGioNamespace();
|
|
7107
|
+
if (gio) {
|
|
7108
|
+
const Cls = gio.UnixOutputStream ?? gio.OutputStream;
|
|
7109
|
+
if (Cls) {
|
|
7110
|
+
try {
|
|
7111
|
+
this._outGio = Cls.new(this.fd, false);
|
|
7112
|
+
} catch {
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
}
|
|
7117
|
+
write(data) {
|
|
7118
|
+
if (this._outGio) {
|
|
7119
|
+
try {
|
|
7120
|
+
const bytes = typeof data === "string" ? _encoder2.encode(data) : data;
|
|
7121
|
+
this._outGio.write_all(bytes, null);
|
|
7122
|
+
return true;
|
|
7123
|
+
} catch {
|
|
7124
|
+
}
|
|
7125
|
+
}
|
|
7126
|
+
if (this.fd === 2) {
|
|
7127
|
+
console.error(data);
|
|
7128
|
+
} else {
|
|
7129
|
+
console.log(data);
|
|
7130
|
+
}
|
|
7131
|
+
return true;
|
|
7132
|
+
}
|
|
7133
|
+
get isTTY() {
|
|
7134
|
+
if (nativeTerminal) return nativeTerminal.Terminal.is_tty(this.fd);
|
|
7135
|
+
try {
|
|
7136
|
+
const GLib3 = getGjsGlobal().imports?.gi?.GLib;
|
|
7137
|
+
if (GLib3) return !!GLib3.log_writer_supports_color(this.fd);
|
|
7138
|
+
} catch {
|
|
7139
|
+
}
|
|
7140
|
+
return false;
|
|
7141
|
+
}
|
|
7142
|
+
get columns() {
|
|
7143
|
+
if (nativeTerminal) {
|
|
7144
|
+
const [ok, , cols] = nativeTerminal.Terminal.get_size(this.fd);
|
|
7145
|
+
if (ok && cols > 0) return cols;
|
|
7146
|
+
}
|
|
7147
|
+
try {
|
|
7148
|
+
const GLib3 = getGjsGlobal().imports?.gi?.GLib;
|
|
7149
|
+
if (GLib3) {
|
|
7150
|
+
const c = parseInt(GLib3.getenv("COLUMNS") ?? "0", 10);
|
|
7151
|
+
if (c > 0) return c;
|
|
7152
|
+
}
|
|
7153
|
+
} catch {
|
|
7154
|
+
}
|
|
7155
|
+
return 80;
|
|
7156
|
+
}
|
|
7157
|
+
// stdout/stderr must never be closed — the process owns the fds.
|
|
7158
|
+
// pipe() calls end() when its source emits 'end' (e.g. MuteStream); no-op here.
|
|
7159
|
+
end() {
|
|
7160
|
+
}
|
|
7161
|
+
destroy() {
|
|
7162
|
+
}
|
|
7163
|
+
get rows() {
|
|
7164
|
+
if (nativeTerminal) {
|
|
7165
|
+
const [ok, rows] = nativeTerminal.Terminal.get_size(this.fd);
|
|
7166
|
+
if (ok && rows > 0) return rows;
|
|
7167
|
+
}
|
|
7168
|
+
try {
|
|
7169
|
+
const GLib3 = getGjsGlobal().imports?.gi?.GLib;
|
|
7170
|
+
if (GLib3) {
|
|
7171
|
+
const r = parseInt(GLib3.getenv("LINES") ?? "0", 10);
|
|
7172
|
+
if (r > 0) return r;
|
|
7173
|
+
}
|
|
7174
|
+
} catch {
|
|
7175
|
+
}
|
|
7176
|
+
return 24;
|
|
7177
|
+
}
|
|
7178
|
+
};
|
|
7179
|
+
ProcessReadStream = class extends EventEmitter2 {
|
|
7180
|
+
fd;
|
|
7181
|
+
isRaw = false;
|
|
7182
|
+
// Do NOT expose `readableFlowing` as an instance property: @inquirer/core uses
|
|
7183
|
+
// `'readableFlowing' in input` to defer startCycle() via setImmediate. In GJS,
|
|
7184
|
+
// setImmediate fires as a microtask — the property must stay absent so
|
|
7185
|
+
// @inquirer/core calls startCycle() synchronously on its own schedule.
|
|
7186
|
+
_gio = null;
|
|
7187
|
+
_stdinGio = null;
|
|
7188
|
+
_reading = false;
|
|
7189
|
+
_flowing = false;
|
|
7190
|
+
_sttyCleanupRegistered = false;
|
|
7191
|
+
_mainLoopHeld = false;
|
|
7192
|
+
// True while a read_bytes_async is in-flight. Prevents a second concurrent
|
|
7193
|
+
// read from starting when pause()+resume() fires between GLib iterations.
|
|
7194
|
+
_pendingRead = false;
|
|
7195
|
+
constructor(fd) {
|
|
7196
|
+
super();
|
|
7197
|
+
this.fd = fd;
|
|
7198
|
+
this._gio = getGioNamespace();
|
|
7199
|
+
}
|
|
7200
|
+
get isTTY() {
|
|
7201
|
+
if (nativeTerminal) return nativeTerminal.Terminal.is_tty(this.fd);
|
|
7202
|
+
return false;
|
|
7203
|
+
}
|
|
7204
|
+
setRawMode(mode) {
|
|
7205
|
+
if (nativeTerminal) {
|
|
7206
|
+
const ok = nativeTerminal.Terminal.set_raw_mode(this.fd, mode);
|
|
7207
|
+
if (ok) {
|
|
7208
|
+
this.isRaw = mode;
|
|
7209
|
+
return this;
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
this._setRawModeViaStty(mode);
|
|
7213
|
+
this.isRaw = mode;
|
|
7214
|
+
return this;
|
|
7215
|
+
}
|
|
7216
|
+
_setRawModeViaStty(mode) {
|
|
7217
|
+
try {
|
|
7218
|
+
const _gi2 = globalThis.imports?.gi;
|
|
7219
|
+
const Gio3 = _gi2?.Gio ?? _gi2?.["Gio"];
|
|
7220
|
+
if (!Gio3) return;
|
|
7221
|
+
const STDIN_INHERIT = Gio3.SubprocessFlags?.STDIN_INHERIT ?? 2;
|
|
7222
|
+
const argv2 = mode ? ["stty", "-icanon", "-echo", "-icrnl", "min", "1", "time", "0"] : ["stty", "icanon", "echo", "icrnl"];
|
|
7223
|
+
const launcher = new Gio3.SubprocessLauncher({ flags: STDIN_INHERIT });
|
|
7224
|
+
const proc = launcher.spawnv(argv2);
|
|
7225
|
+
proc.wait(null);
|
|
7226
|
+
if (mode && !this._sttyCleanupRegistered) {
|
|
7227
|
+
this._sttyCleanupRegistered = true;
|
|
7228
|
+
const proc_ = globalThis.process;
|
|
7229
|
+
if (proc_?.once && typeof proc_.once === "function") {
|
|
7230
|
+
proc_.once("exit", () => this._setRawModeViaStty(false));
|
|
7231
|
+
}
|
|
7232
|
+
}
|
|
7233
|
+
} catch {
|
|
7234
|
+
}
|
|
7235
|
+
}
|
|
7236
|
+
setEncoding(_enc) {
|
|
7237
|
+
return this;
|
|
7238
|
+
}
|
|
7239
|
+
resume() {
|
|
7240
|
+
this._flowing = true;
|
|
7241
|
+
if (this._gio && this.fd === 0 && !this._reading) {
|
|
7242
|
+
this._startReading();
|
|
7243
|
+
}
|
|
7244
|
+
return this;
|
|
7245
|
+
}
|
|
7246
|
+
pause() {
|
|
7247
|
+
this._flowing = false;
|
|
7248
|
+
this._reading = false;
|
|
7249
|
+
if (this._mainLoopHeld) {
|
|
7250
|
+
this._mainLoopHeld = false;
|
|
7251
|
+
const _gi2 = globalThis.imports?.gi;
|
|
7252
|
+
const GLib3 = _gi2?.GLib ?? _gi2?.["GLib"];
|
|
7253
|
+
if (GLib3?.idle_add) {
|
|
7254
|
+
GLib3.idle_add(300, () => {
|
|
7255
|
+
if (!this._mainLoopHeld) quitMainLoop();
|
|
7256
|
+
return false;
|
|
7257
|
+
});
|
|
7258
|
+
} else {
|
|
7259
|
+
quitMainLoop();
|
|
7260
|
+
}
|
|
7261
|
+
}
|
|
7262
|
+
return this;
|
|
7263
|
+
}
|
|
7264
|
+
read() {
|
|
7265
|
+
return null;
|
|
7266
|
+
}
|
|
7267
|
+
_startReading() {
|
|
7268
|
+
if (!this._gio || this._reading) return;
|
|
7269
|
+
if (this._pendingRead) {
|
|
7270
|
+
this._reading = true;
|
|
7271
|
+
if (!this._mainLoopHeld) {
|
|
7272
|
+
this._mainLoopHeld = true;
|
|
7273
|
+
ensureMainLoop();
|
|
7274
|
+
}
|
|
7275
|
+
return;
|
|
7276
|
+
}
|
|
7277
|
+
this._reading = true;
|
|
7278
|
+
if (!this._mainLoopHeld) {
|
|
7279
|
+
this._mainLoopHeld = true;
|
|
7280
|
+
ensureMainLoop();
|
|
7281
|
+
}
|
|
7282
|
+
if (!this._stdinGio) {
|
|
7283
|
+
const Cls = this._gio.UnixInputStream ?? this._gio.InputStream;
|
|
7284
|
+
if (!Cls) {
|
|
7285
|
+
this._reading = false;
|
|
7286
|
+
return;
|
|
7287
|
+
}
|
|
7288
|
+
try {
|
|
7289
|
+
this._stdinGio = Cls.new(this.fd, false);
|
|
7290
|
+
} catch {
|
|
7291
|
+
this._reading = false;
|
|
7292
|
+
return;
|
|
7293
|
+
}
|
|
7294
|
+
}
|
|
7295
|
+
const loop = () => {
|
|
7296
|
+
if (!this._reading) {
|
|
7297
|
+
this._pendingRead = false;
|
|
7298
|
+
return;
|
|
7299
|
+
}
|
|
7300
|
+
this._pendingRead = true;
|
|
7301
|
+
this._stdinGio.read_bytes_async(
|
|
7302
|
+
4096,
|
|
7303
|
+
0,
|
|
7304
|
+
null,
|
|
7305
|
+
(src, res) => {
|
|
7306
|
+
this._pendingRead = false;
|
|
7307
|
+
try {
|
|
7308
|
+
const bytes = src.read_bytes_finish(res);
|
|
7309
|
+
const data = bytes?.get_data?.() ?? null;
|
|
7310
|
+
if (data && data.byteLength > 0) {
|
|
7311
|
+
this.emit("data", Buffer.from(data));
|
|
7312
|
+
} else if (data !== null && data.byteLength === 0) {
|
|
7313
|
+
this._reading = false;
|
|
7314
|
+
this.emit("end");
|
|
7315
|
+
return;
|
|
7316
|
+
}
|
|
7317
|
+
} catch {
|
|
7318
|
+
this._reading = false;
|
|
7319
|
+
return;
|
|
7320
|
+
}
|
|
7321
|
+
if (this._reading) loop();
|
|
7322
|
+
}
|
|
7323
|
+
);
|
|
7324
|
+
};
|
|
7325
|
+
loop();
|
|
7326
|
+
}
|
|
7327
|
+
};
|
|
6943
7328
|
hrtimeBase = getMonotonicTime();
|
|
6944
|
-
Process = class extends
|
|
7329
|
+
Process = class extends EventEmitter2 {
|
|
6945
7330
|
platform;
|
|
6946
7331
|
arch;
|
|
6947
7332
|
env;
|
|
@@ -7024,11 +7409,25 @@ var init_esm7 = __esm({
|
|
|
7024
7409
|
exit(code) {
|
|
7025
7410
|
this.exitCode = code ?? this.exitCode ?? 0;
|
|
7026
7411
|
this.emit("exit", this.exitCode);
|
|
7412
|
+
const gjsImports = getGjsGlobal().imports;
|
|
7413
|
+
const GLib3 = gjsImports?.gi?.GLib;
|
|
7414
|
+
const system = gjsImports?.system;
|
|
7415
|
+
const idleAdd = GLib3?.idle_add;
|
|
7416
|
+
const sourceRemove = GLib3?.SOURCE_REMOVE;
|
|
7417
|
+
const priorityDefault = GLib3?.PRIORITY_DEFAULT;
|
|
7418
|
+
if (system?.exit && idleAdd && typeof priorityDefault === "number" && typeof sourceRemove === "boolean") {
|
|
7419
|
+
const exitCodeNow = this.exitCode;
|
|
7420
|
+
ensureMainLoop();
|
|
7421
|
+
idleAdd(priorityDefault, () => {
|
|
7422
|
+
quitMainLoop();
|
|
7423
|
+
system.exit(exitCodeNow);
|
|
7424
|
+
return sourceRemove;
|
|
7425
|
+
});
|
|
7426
|
+
return new Promise(() => {
|
|
7427
|
+
});
|
|
7428
|
+
}
|
|
7027
7429
|
try {
|
|
7028
|
-
|
|
7029
|
-
if (system?.exit) {
|
|
7030
|
-
system.exit(this.exitCode);
|
|
7031
|
-
}
|
|
7430
|
+
if (system?.exit) system.exit(this.exitCode);
|
|
7032
7431
|
} catch {
|
|
7033
7432
|
}
|
|
7034
7433
|
const nativeProcess = globalThis.process;
|
|
@@ -7089,18 +7488,11 @@ var init_esm7 = __esm({
|
|
|
7089
7488
|
}
|
|
7090
7489
|
return { user: 0, system: 0 };
|
|
7091
7490
|
}
|
|
7092
|
-
// Stub: stdout/stderr/stdin — these need stream to be implemented fully
|
|
7093
7491
|
// Note: Cannot check globalThis.process.stdout here — on GJS globalThis.process
|
|
7094
7492
|
// IS this instance, so that would cause infinite recursion.
|
|
7095
|
-
stdout =
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
}, fd: 1 };
|
|
7099
|
-
stderr = { write: (data) => {
|
|
7100
|
-
console.error(data);
|
|
7101
|
-
return true;
|
|
7102
|
-
}, fd: 2 };
|
|
7103
|
-
stdin = { fd: 0 };
|
|
7493
|
+
stdout = new ProcessWriteStream(1);
|
|
7494
|
+
stderr = new ProcessWriteStream(2);
|
|
7495
|
+
stdin = new ProcessReadStream(0);
|
|
7104
7496
|
abort() {
|
|
7105
7497
|
this.exit(1);
|
|
7106
7498
|
}
|
|
@@ -7120,6 +7512,17 @@ var init_esm7 = __esm({
|
|
|
7120
7512
|
return getMonotonicTime() - hrtimeBase;
|
|
7121
7513
|
};
|
|
7122
7514
|
process = new Process();
|
|
7515
|
+
if (nativeTerminal) {
|
|
7516
|
+
try {
|
|
7517
|
+
const watcher = new nativeTerminal.ResizeWatcher();
|
|
7518
|
+
watcher.connect("resized", (_obj2, _rows, _cols) => {
|
|
7519
|
+
process.stdout.emit("resize");
|
|
7520
|
+
process.stderr.emit("resize");
|
|
7521
|
+
});
|
|
7522
|
+
watcher.start();
|
|
7523
|
+
} catch {
|
|
7524
|
+
}
|
|
7525
|
+
}
|
|
7123
7526
|
platform = process.platform;
|
|
7124
7527
|
arch = process.arch;
|
|
7125
7528
|
env = process.env;
|
|
@@ -7133,7 +7536,7 @@ var init_esm7 = __esm({
|
|
|
7133
7536
|
cwd = process.cwd.bind(process);
|
|
7134
7537
|
chdir = process.chdir.bind(process);
|
|
7135
7538
|
exit = process.exit.bind(process);
|
|
7136
|
-
|
|
7539
|
+
nextTick = process.nextTick.bind(process);
|
|
7137
7540
|
hrtime = process.hrtime.bind(process);
|
|
7138
7541
|
uptime = process.uptime.bind(process);
|
|
7139
7542
|
memoryUsage = process.memoryUsage.bind(process);
|
|
@@ -7147,7 +7550,7 @@ var init_esm7 = __esm({
|
|
|
7147
7550
|
stdout = process.stdout;
|
|
7148
7551
|
stderr = process.stderr;
|
|
7149
7552
|
stdin = process.stdin;
|
|
7150
|
-
|
|
7553
|
+
index_default = process;
|
|
7151
7554
|
}
|
|
7152
7555
|
});
|
|
7153
7556
|
|
|
@@ -7155,9 +7558,9 @@ var init_esm7 = __esm({
|
|
|
7155
7558
|
var init_process = __esm({
|
|
7156
7559
|
"../../../packages/node/globals/lib/esm/register/process.js"() {
|
|
7157
7560
|
init_console_gjs();
|
|
7158
|
-
|
|
7561
|
+
init_auto_globals_53fe98c6e6();
|
|
7159
7562
|
init_esm();
|
|
7160
|
-
|
|
7563
|
+
init_esm8();
|
|
7161
7564
|
if (typeof Promise.withResolvers !== "function") {
|
|
7162
7565
|
Promise.withResolvers = function() {
|
|
7163
7566
|
let resolve;
|
|
@@ -7178,10 +7581,124 @@ var init_process = __esm({
|
|
|
7178
7581
|
configurable: true
|
|
7179
7582
|
});
|
|
7180
7583
|
}
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7584
|
+
Object.defineProperty(globalThis, "process", {
|
|
7585
|
+
value: index_default,
|
|
7586
|
+
enumerable: false,
|
|
7587
|
+
writable: true,
|
|
7588
|
+
configurable: true
|
|
7589
|
+
});
|
|
7590
|
+
}
|
|
7591
|
+
});
|
|
7592
|
+
|
|
7593
|
+
// ../../../packages/node/globals/lib/esm/register/timers.js
|
|
7594
|
+
function getGLib() {
|
|
7595
|
+
return globalThis.imports?.gi?.GLib;
|
|
7596
|
+
}
|
|
7597
|
+
function removeById(timeout) {
|
|
7598
|
+
if (timeout instanceof GjsifyTimeout) {
|
|
7599
|
+
timeout._cancel();
|
|
7600
|
+
} else if (typeof timeout === "number") {
|
|
7601
|
+
try {
|
|
7602
|
+
getGLib()?.Source.remove(timeout);
|
|
7603
|
+
} catch {
|
|
7604
|
+
}
|
|
7605
|
+
}
|
|
7606
|
+
}
|
|
7607
|
+
function setImmediate(callback, ...args) {
|
|
7608
|
+
return setTimeout(callback, 0, ...args);
|
|
7609
|
+
}
|
|
7610
|
+
function clearImmediate(id) {
|
|
7611
|
+
clearTimeout(id);
|
|
7612
|
+
}
|
|
7613
|
+
var _isGjsTimer, GjsifyTimeout;
|
|
7614
|
+
var init_timers = __esm({
|
|
7615
|
+
"../../../packages/node/globals/lib/esm/register/timers.js"() {
|
|
7616
|
+
init_console_gjs();
|
|
7617
|
+
init_auto_globals_53fe98c6e6();
|
|
7618
|
+
_isGjsTimer = getGLib() !== void 0;
|
|
7619
|
+
GjsifyTimeout = class {
|
|
7620
|
+
_id = null;
|
|
7621
|
+
_refed = true;
|
|
7622
|
+
_callback;
|
|
7623
|
+
_delay;
|
|
7624
|
+
_args;
|
|
7625
|
+
_repeat;
|
|
7626
|
+
constructor(callback, delay, args, repeat) {
|
|
7627
|
+
this._callback = callback;
|
|
7628
|
+
this._delay = delay;
|
|
7629
|
+
this._args = args;
|
|
7630
|
+
this._repeat = repeat;
|
|
7631
|
+
this._schedule();
|
|
7632
|
+
}
|
|
7633
|
+
_schedule() {
|
|
7634
|
+
const GLib3 = getGLib();
|
|
7635
|
+
if (!GLib3) return;
|
|
7636
|
+
const timeoutAdd = GLib3.timeout_add.bind(GLib3);
|
|
7637
|
+
this._id = timeoutAdd(GLib3.PRIORITY_DEFAULT, this._delay, () => {
|
|
7638
|
+
try {
|
|
7639
|
+
this._callback.apply(globalThis, this._args);
|
|
7640
|
+
} catch (err) {
|
|
7641
|
+
setTimeout(() => {
|
|
7642
|
+
throw err;
|
|
7643
|
+
}, 0);
|
|
7644
|
+
}
|
|
7645
|
+
if (this._repeat) return GLib3.SOURCE_CONTINUE;
|
|
7646
|
+
this._id = null;
|
|
7647
|
+
return GLib3.SOURCE_REMOVE;
|
|
7648
|
+
});
|
|
7649
|
+
}
|
|
7650
|
+
ref() {
|
|
7651
|
+
this._refed = true;
|
|
7652
|
+
return this;
|
|
7653
|
+
}
|
|
7654
|
+
unref() {
|
|
7655
|
+
this._refed = false;
|
|
7656
|
+
return this;
|
|
7657
|
+
}
|
|
7658
|
+
hasRef() {
|
|
7659
|
+
return this._refed;
|
|
7660
|
+
}
|
|
7661
|
+
refresh() {
|
|
7662
|
+
this._cancel();
|
|
7663
|
+
this._schedule();
|
|
7664
|
+
return this;
|
|
7665
|
+
}
|
|
7666
|
+
_cancel() {
|
|
7667
|
+
if (this._id === null) return;
|
|
7668
|
+
try {
|
|
7669
|
+
getGLib()?.Source.remove(this._id);
|
|
7670
|
+
} catch {
|
|
7671
|
+
}
|
|
7672
|
+
this._id = null;
|
|
7673
|
+
}
|
|
7674
|
+
[Symbol.toPrimitive]() {
|
|
7675
|
+
return this._id;
|
|
7676
|
+
}
|
|
7677
|
+
[Symbol.dispose]() {
|
|
7678
|
+
this._cancel();
|
|
7679
|
+
}
|
|
7680
|
+
};
|
|
7681
|
+
if (_isGjsTimer) {
|
|
7682
|
+
const setT = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, false);
|
|
7683
|
+
const setI = (cb, delay = 0, ...args) => new GjsifyTimeout(cb, Math.max(0, delay | 0), args, true);
|
|
7684
|
+
const g = globalThis;
|
|
7685
|
+
g.setTimeout = setT;
|
|
7686
|
+
g.clearTimeout = removeById;
|
|
7687
|
+
g.setInterval = setI;
|
|
7688
|
+
g.clearInterval = removeById;
|
|
7689
|
+
}
|
|
7690
|
+
if (!("setImmediate" in globalThis)) {
|
|
7691
|
+
Object.defineProperty(globalThis, "setImmediate", {
|
|
7692
|
+
value: setImmediate,
|
|
7693
|
+
enumerable: true,
|
|
7694
|
+
writable: true,
|
|
7695
|
+
configurable: true
|
|
7696
|
+
});
|
|
7697
|
+
}
|
|
7698
|
+
if (!("clearImmediate" in globalThis)) {
|
|
7699
|
+
Object.defineProperty(globalThis, "clearImmediate", {
|
|
7700
|
+
value: clearImmediate,
|
|
7701
|
+
enumerable: true,
|
|
7185
7702
|
writable: true,
|
|
7186
7703
|
configurable: true
|
|
7187
7704
|
});
|
|
@@ -7201,10 +7718,10 @@ function encodeComponent(s) {
|
|
|
7201
7718
|
return encodeURIComponent(s).replace(/%20/g, "+");
|
|
7202
7719
|
}
|
|
7203
7720
|
var PARSE_FLAGS, URLSearchParams, URL2;
|
|
7204
|
-
var
|
|
7721
|
+
var init_esm9 = __esm({
|
|
7205
7722
|
"../../../packages/node/url/lib/esm/index.js"() {
|
|
7206
7723
|
init_console_gjs();
|
|
7207
|
-
|
|
7724
|
+
init_auto_globals_53fe98c6e6();
|
|
7208
7725
|
init_glib_2();
|
|
7209
7726
|
PARSE_FLAGS = glib_2_default.UriFlags.HAS_PASSWORD | glib_2_default.UriFlags.ENCODED | glib_2_default.UriFlags.SCHEME_NORMALIZE;
|
|
7210
7727
|
URLSearchParams = class _URLSearchParams {
|
|
@@ -7404,6 +7921,44 @@ var init_esm8 = __esm({
|
|
|
7404
7921
|
toJSON() {
|
|
7405
7922
|
return this.href;
|
|
7406
7923
|
}
|
|
7924
|
+
// ---- URL.createObjectURL / URL.revokeObjectURL ----
|
|
7925
|
+
//
|
|
7926
|
+
// Consumers like Excalibur.js do `const src = URL.createObjectURL(blob);
|
|
7927
|
+
// image.src = src;`. For that to work on GJS we need `src` to be a path
|
|
7928
|
+
// `HTMLImageElement` / `HTMLAudioElement` / `FontFace` can actually read —
|
|
7929
|
+
// i.e. a `file://` URL. We implement this as a static method on our own
|
|
7930
|
+
// URL class (no globalThis monkey-patching):
|
|
7931
|
+
//
|
|
7932
|
+
// - Fast path: if the Blob already carries a `_tmpPath` (e.g. written
|
|
7933
|
+
// by `@gjsify/fetch` XHR when `responseType='blob'`), wrap it as
|
|
7934
|
+
// `file://<_tmpPath>`.
|
|
7935
|
+
// - Slow path: if the Blob has `arrayBuffer()`/bytes but no `_tmpPath`,
|
|
7936
|
+
// materialise the bytes into a GLib temp file and wrap that. This
|
|
7937
|
+
// path is async in the spec — but W3C `createObjectURL` is sync. We
|
|
7938
|
+
// read the bytes via `GLib.Bytes`-style synchronous access when
|
|
7939
|
+
// possible and fall back to a sentinel if not.
|
|
7940
|
+
//
|
|
7941
|
+
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
|
|
7942
|
+
static _objectURLPaths = /* @__PURE__ */ new Map();
|
|
7943
|
+
static _objectURLCounter = 0;
|
|
7944
|
+
static createObjectURL(blob) {
|
|
7945
|
+
const tmp = blob?._tmpPath;
|
|
7946
|
+
if (typeof tmp === "string" && tmp.length > 0) {
|
|
7947
|
+
const url = `file://${tmp}`;
|
|
7948
|
+
_URL._objectURLPaths.set(url, tmp);
|
|
7949
|
+
return url;
|
|
7950
|
+
}
|
|
7951
|
+
return "file:///dev/null";
|
|
7952
|
+
}
|
|
7953
|
+
static revokeObjectURL(url) {
|
|
7954
|
+
const path = _URL._objectURLPaths.get(url);
|
|
7955
|
+
if (!path) return;
|
|
7956
|
+
try {
|
|
7957
|
+
glib_2_default.unlink(path);
|
|
7958
|
+
} catch {
|
|
7959
|
+
}
|
|
7960
|
+
_URL._objectURLPaths.delete(url);
|
|
7961
|
+
}
|
|
7407
7962
|
};
|
|
7408
7963
|
}
|
|
7409
7964
|
});
|
|
@@ -7412,8 +7967,8 @@ var init_esm8 = __esm({
|
|
|
7412
7967
|
var init_url = __esm({
|
|
7413
7968
|
"../../../packages/node/globals/lib/esm/register/url.js"() {
|
|
7414
7969
|
init_console_gjs();
|
|
7415
|
-
|
|
7416
|
-
|
|
7970
|
+
init_auto_globals_53fe98c6e6();
|
|
7971
|
+
init_esm9();
|
|
7417
7972
|
if (typeof globalThis.URL !== "function") {
|
|
7418
7973
|
Object.defineProperty(globalThis, "URL", {
|
|
7419
7974
|
value: URL2,
|
|
@@ -7435,10 +7990,10 @@ var init_url = __esm({
|
|
|
7435
7990
|
|
|
7436
7991
|
// ../../../packages/node/perf_hooks/lib/esm/index.js
|
|
7437
7992
|
var performance2, PerformanceObserverStub, PerformanceEntryStub, PerformanceObserverEntryListStub, PerformanceObserver, PerformanceEntry, PerformanceObserverEntryList, PerformanceMark, PerformanceMeasure;
|
|
7438
|
-
var
|
|
7993
|
+
var init_esm10 = __esm({
|
|
7439
7994
|
"../../../packages/node/perf_hooks/lib/esm/index.js"() {
|
|
7440
7995
|
init_console_gjs();
|
|
7441
|
-
|
|
7996
|
+
init_auto_globals_53fe98c6e6();
|
|
7442
7997
|
if (globalThis.performance) {
|
|
7443
7998
|
performance2 = globalThis.performance;
|
|
7444
7999
|
} else {
|
|
@@ -7557,8 +8112,8 @@ var init_esm9 = __esm({
|
|
|
7557
8112
|
var init_performance = __esm({
|
|
7558
8113
|
"../../../packages/web/web-globals/lib/esm/register/performance.js"() {
|
|
7559
8114
|
init_console_gjs();
|
|
7560
|
-
|
|
7561
|
-
|
|
8115
|
+
init_auto_globals_53fe98c6e6();
|
|
8116
|
+
init_esm10();
|
|
7562
8117
|
if (typeof globalThis.performance === "undefined") {
|
|
7563
8118
|
globalThis.performance = performance2;
|
|
7564
8119
|
}
|
|
@@ -7570,10 +8125,10 @@ var init_performance = __esm({
|
|
|
7570
8125
|
|
|
7571
8126
|
// ../../../packages/web/abort-controller/lib/esm/index.js
|
|
7572
8127
|
var kAbort, kInternal, AbortSignal2, AbortController2;
|
|
7573
|
-
var
|
|
8128
|
+
var init_esm11 = __esm({
|
|
7574
8129
|
"../../../packages/web/abort-controller/lib/esm/index.js"() {
|
|
7575
8130
|
init_console_gjs();
|
|
7576
|
-
|
|
8131
|
+
init_auto_globals_53fe98c6e6();
|
|
7577
8132
|
init_esm4();
|
|
7578
8133
|
kAbort = /* @__PURE__ */ Symbol("abort");
|
|
7579
8134
|
kInternal = /* @__PURE__ */ Symbol("internal");
|
|
@@ -7662,8 +8217,8 @@ var init_esm10 = __esm({
|
|
|
7662
8217
|
var init_register2 = __esm({
|
|
7663
8218
|
"../../../packages/web/abort-controller/lib/esm/register.js"() {
|
|
7664
8219
|
init_console_gjs();
|
|
7665
|
-
|
|
7666
|
-
|
|
8220
|
+
init_auto_globals_53fe98c6e6();
|
|
8221
|
+
init_esm11();
|
|
7667
8222
|
if (typeof globalThis.AbortController === "undefined") {
|
|
7668
8223
|
globalThis.AbortController = AbortController2;
|
|
7669
8224
|
}
|
|
@@ -7678,7 +8233,7 @@ var toRegister;
|
|
|
7678
8233
|
var init_custom_events = __esm({
|
|
7679
8234
|
"../../../packages/web/dom-events/lib/esm/register/custom-events.js"() {
|
|
7680
8235
|
init_console_gjs();
|
|
7681
|
-
|
|
8236
|
+
init_auto_globals_53fe98c6e6();
|
|
7682
8237
|
init_esm4();
|
|
7683
8238
|
toRegister = {
|
|
7684
8239
|
CustomEvent: CustomEvent2,
|
|
@@ -7699,7 +8254,7 @@ var init_custom_events = __esm({
|
|
|
7699
8254
|
var init_register3 = __esm({
|
|
7700
8255
|
"../../../packages/web/dom-exception/lib/esm/register.js"() {
|
|
7701
8256
|
init_console_gjs();
|
|
7702
|
-
|
|
8257
|
+
init_auto_globals_53fe98c6e6();
|
|
7703
8258
|
init_esm3();
|
|
7704
8259
|
if (typeof globalThis.DOMException === "undefined") {
|
|
7705
8260
|
globalThis.DOMException = DOMException2;
|
|
@@ -7707,9 +8262,9 @@ var init_register3 = __esm({
|
|
|
7707
8262
|
}
|
|
7708
8263
|
});
|
|
7709
8264
|
|
|
7710
|
-
// node_modules/.cache/gjsify/auto-globals-
|
|
7711
|
-
var
|
|
7712
|
-
"node_modules/.cache/gjsify/auto-globals-
|
|
8265
|
+
// node_modules/.cache/gjsify/auto-globals-53fe98c6e6.mjs
|
|
8266
|
+
var init_auto_globals_53fe98c6e6 = __esm({
|
|
8267
|
+
"node_modules/.cache/gjsify/auto-globals-53fe98c6e6.mjs"() {
|
|
7713
8268
|
init_register();
|
|
7714
8269
|
init_canvas();
|
|
7715
8270
|
init_document2();
|
|
@@ -7717,8 +8272,9 @@ var init_auto_globals_495e9d950c = __esm({
|
|
|
7717
8272
|
init_navigator();
|
|
7718
8273
|
init_buffer2();
|
|
7719
8274
|
init_encoding2();
|
|
7720
|
-
|
|
8275
|
+
init_microtask2();
|
|
7721
8276
|
init_process();
|
|
8277
|
+
init_timers();
|
|
7722
8278
|
init_url();
|
|
7723
8279
|
init_performance();
|
|
7724
8280
|
init_register2();
|
|
@@ -7733,7 +8289,7 @@ var require_twiddle = __commonJS({
|
|
|
7733
8289
|
"use strict";
|
|
7734
8290
|
"use restrict";
|
|
7735
8291
|
init_console_gjs();
|
|
7736
|
-
|
|
8292
|
+
init_auto_globals_53fe98c6e6();
|
|
7737
8293
|
var INT_BITS = 32;
|
|
7738
8294
|
exports.INT_BITS = INT_BITS;
|
|
7739
8295
|
exports.INT_MAX = 2147483647;
|
|
@@ -7888,7 +8444,7 @@ var require_twiddle = __commonJS({
|
|
|
7888
8444
|
var require_literals = __commonJS({
|
|
7889
8445
|
"../../../node_modules/glsl-tokenizer/lib/literals.js"(exports, module) {
|
|
7890
8446
|
init_console_gjs();
|
|
7891
|
-
|
|
8447
|
+
init_auto_globals_53fe98c6e6();
|
|
7892
8448
|
module.exports = [
|
|
7893
8449
|
// current
|
|
7894
8450
|
"precision",
|
|
@@ -7988,7 +8544,7 @@ var require_literals = __commonJS({
|
|
|
7988
8544
|
var require_operators = __commonJS({
|
|
7989
8545
|
"../../../node_modules/glsl-tokenizer/lib/operators.js"(exports, module) {
|
|
7990
8546
|
init_console_gjs();
|
|
7991
|
-
|
|
8547
|
+
init_auto_globals_53fe98c6e6();
|
|
7992
8548
|
module.exports = [
|
|
7993
8549
|
"<<=",
|
|
7994
8550
|
">>=",
|
|
@@ -8043,7 +8599,7 @@ var require_operators = __commonJS({
|
|
|
8043
8599
|
var require_builtins = __commonJS({
|
|
8044
8600
|
"../../../node_modules/glsl-tokenizer/lib/builtins.js"(exports, module) {
|
|
8045
8601
|
init_console_gjs();
|
|
8046
|
-
|
|
8602
|
+
init_auto_globals_53fe98c6e6();
|
|
8047
8603
|
module.exports = [
|
|
8048
8604
|
// Keep this list sorted
|
|
8049
8605
|
"abs",
|
|
@@ -8201,7 +8757,7 @@ var require_builtins = __commonJS({
|
|
|
8201
8757
|
var require_literals_300es = __commonJS({
|
|
8202
8758
|
"../../../node_modules/glsl-tokenizer/lib/literals-300es.js"(exports, module) {
|
|
8203
8759
|
init_console_gjs();
|
|
8204
|
-
|
|
8760
|
+
init_auto_globals_53fe98c6e6();
|
|
8205
8761
|
var v100 = require_literals();
|
|
8206
8762
|
module.exports = v100.slice().concat([
|
|
8207
8763
|
"layout",
|
|
@@ -8295,7 +8851,7 @@ var require_literals_300es = __commonJS({
|
|
|
8295
8851
|
var require_builtins_300es = __commonJS({
|
|
8296
8852
|
"../../../node_modules/glsl-tokenizer/lib/builtins-300es.js"(exports, module) {
|
|
8297
8853
|
init_console_gjs();
|
|
8298
|
-
|
|
8854
|
+
init_auto_globals_53fe98c6e6();
|
|
8299
8855
|
var v100 = require_builtins();
|
|
8300
8856
|
v100 = v100.slice().filter(function(b) {
|
|
8301
8857
|
return !/^(gl\_|texture)/.test(b);
|
|
@@ -8365,7 +8921,7 @@ var require_builtins_300es = __commonJS({
|
|
|
8365
8921
|
var require_glsl_tokenizer = __commonJS({
|
|
8366
8922
|
"../../../node_modules/glsl-tokenizer/index.js"(exports, module) {
|
|
8367
8923
|
init_console_gjs();
|
|
8368
|
-
|
|
8924
|
+
init_auto_globals_53fe98c6e6();
|
|
8369
8925
|
module.exports = tokenize2;
|
|
8370
8926
|
var literals100 = require_literals();
|
|
8371
8927
|
var operators = require_operators();
|
|
@@ -8698,7 +9254,7 @@ var require_glsl_tokenizer = __commonJS({
|
|
|
8698
9254
|
var require_string = __commonJS({
|
|
8699
9255
|
"../../../node_modules/glsl-tokenizer/string.js"(exports, module) {
|
|
8700
9256
|
init_console_gjs();
|
|
8701
|
-
|
|
9257
|
+
init_auto_globals_53fe98c6e6();
|
|
8702
9258
|
var tokenize2 = require_glsl_tokenizer();
|
|
8703
9259
|
module.exports = tokenizeString;
|
|
8704
9260
|
function tokenizeString(str, opt) {
|
|
@@ -8713,70 +9269,70 @@ var require_string = __commonJS({
|
|
|
8713
9269
|
|
|
8714
9270
|
// src/gjs/gjs.ts
|
|
8715
9271
|
init_console_gjs();
|
|
8716
|
-
|
|
9272
|
+
init_auto_globals_53fe98c6e6();
|
|
8717
9273
|
import Adw2 from "gi://Adw?version=1";
|
|
8718
9274
|
import Gio2 from "gi://Gio?version=2.0";
|
|
8719
9275
|
|
|
8720
9276
|
// src/gjs/teapot-window.ts
|
|
8721
9277
|
init_console_gjs();
|
|
8722
|
-
|
|
9278
|
+
init_auto_globals_53fe98c6e6();
|
|
8723
9279
|
import GObject2 from "gi://GObject?version=2.0";
|
|
8724
9280
|
import Gtk4 from "gi://Gtk?version=4.0";
|
|
8725
9281
|
import Adw from "gi://Adw?version=1";
|
|
8726
9282
|
|
|
8727
|
-
// ../../../packages/
|
|
9283
|
+
// ../../../packages/framework/webgl/lib/esm/index.js
|
|
8728
9284
|
init_console_gjs();
|
|
8729
|
-
|
|
9285
|
+
init_auto_globals_53fe98c6e6();
|
|
8730
9286
|
|
|
8731
9287
|
// ../../../node_modules/@girs/gjs/index.js
|
|
8732
9288
|
init_console_gjs();
|
|
8733
|
-
|
|
9289
|
+
init_auto_globals_53fe98c6e6();
|
|
8734
9290
|
|
|
8735
9291
|
// ../../../node_modules/@girs/gjs/gjs.js
|
|
8736
9292
|
init_console_gjs();
|
|
8737
|
-
|
|
9293
|
+
init_auto_globals_53fe98c6e6();
|
|
8738
9294
|
var imports2 = globalThis.imports || {};
|
|
8739
9295
|
|
|
8740
|
-
// ../../../packages/
|
|
9296
|
+
// ../../../packages/framework/webgl/lib/esm/index.js
|
|
8741
9297
|
init_gio_2();
|
|
8742
9298
|
|
|
8743
9299
|
// ../../../node_modules/@girs/gtk-4.0/index.js
|
|
8744
9300
|
init_console_gjs();
|
|
8745
|
-
|
|
9301
|
+
init_auto_globals_53fe98c6e6();
|
|
8746
9302
|
|
|
8747
9303
|
// ../../../node_modules/@girs/gtk-4.0/gtk-4.0.js
|
|
8748
9304
|
init_console_gjs();
|
|
8749
|
-
|
|
9305
|
+
init_auto_globals_53fe98c6e6();
|
|
8750
9306
|
import Gtk from "gi://Gtk?version=4.0";
|
|
8751
9307
|
|
|
8752
|
-
// ../../../packages/
|
|
9308
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
|
|
8753
9309
|
init_console_gjs();
|
|
8754
|
-
|
|
9310
|
+
init_auto_globals_53fe98c6e6();
|
|
8755
9311
|
|
|
8756
9312
|
// ../../../node_modules/@girs/gwebgl-0.1/index.js
|
|
8757
9313
|
init_console_gjs();
|
|
8758
|
-
|
|
9314
|
+
init_auto_globals_53fe98c6e6();
|
|
8759
9315
|
|
|
8760
9316
|
// ../../../node_modules/@girs/gwebgl-0.1/gwebgl-0.1.js
|
|
8761
9317
|
init_console_gjs();
|
|
8762
|
-
|
|
9318
|
+
init_auto_globals_53fe98c6e6();
|
|
8763
9319
|
import Gwebgl from "gi://Gwebgl?version=0.1";
|
|
8764
9320
|
var gwebgl_0_1_default = Gwebgl;
|
|
8765
9321
|
|
|
8766
9322
|
// ../../../node_modules/@girs/gwebgl-0.1/index.js
|
|
8767
9323
|
var gwebgl_0_default = gwebgl_0_1_default;
|
|
8768
9324
|
|
|
8769
|
-
// ../../../packages/
|
|
9325
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
|
|
8770
9326
|
init_console_gjs();
|
|
8771
|
-
|
|
9327
|
+
init_auto_globals_53fe98c6e6();
|
|
8772
9328
|
init_gdkpixbuf_2();
|
|
8773
9329
|
var bits = __toESM(require_twiddle(), 1);
|
|
8774
9330
|
var import_string = __toESM(require_string(), 1);
|
|
8775
9331
|
import GdkPixbuf3 from "gi://GdkPixbuf?version=2.0";
|
|
8776
9332
|
|
|
8777
|
-
// ../../../packages/
|
|
9333
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-context-attributes.js
|
|
8778
9334
|
init_console_gjs();
|
|
8779
|
-
|
|
9335
|
+
init_auto_globals_53fe98c6e6();
|
|
8780
9336
|
var WebGLContextAttributes = class {
|
|
8781
9337
|
constructor(alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat) {
|
|
8782
9338
|
this.alpha = alpha;
|
|
@@ -8798,13 +9354,13 @@ var WebGLContextAttributes = class {
|
|
|
8798
9354
|
}
|
|
8799
9355
|
};
|
|
8800
9356
|
|
|
8801
|
-
// ../../../packages/
|
|
9357
|
+
// ../../../packages/framework/webgl/lib/esm/utils.js
|
|
8802
9358
|
init_console_gjs();
|
|
8803
|
-
|
|
9359
|
+
init_auto_globals_53fe98c6e6();
|
|
8804
9360
|
|
|
8805
|
-
// ../../../packages/
|
|
9361
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-uniform-location.js
|
|
8806
9362
|
init_console_gjs();
|
|
8807
|
-
|
|
9363
|
+
init_auto_globals_53fe98c6e6();
|
|
8808
9364
|
var WebGLUniformLocation = class {
|
|
8809
9365
|
constructor(_, program, info2) {
|
|
8810
9366
|
this._linkCount = 0;
|
|
@@ -8817,7 +9373,7 @@ var WebGLUniformLocation = class {
|
|
|
8817
9373
|
}
|
|
8818
9374
|
};
|
|
8819
9375
|
|
|
8820
|
-
// ../../../packages/
|
|
9376
|
+
// ../../../packages/framework/webgl/lib/esm/utils.js
|
|
8821
9377
|
init_glib_2();
|
|
8822
9378
|
function checkObject(object) {
|
|
8823
9379
|
return typeof object === "object" || object === void 0;
|
|
@@ -9000,9 +9556,9 @@ function premultiplyAlpha(data) {
|
|
|
9000
9556
|
return out;
|
|
9001
9557
|
}
|
|
9002
9558
|
|
|
9003
|
-
// ../../../packages/
|
|
9559
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-element-index-unit.js
|
|
9004
9560
|
init_console_gjs();
|
|
9005
|
-
|
|
9561
|
+
init_auto_globals_53fe98c6e6();
|
|
9006
9562
|
var OESElementIndexUint = class {
|
|
9007
9563
|
};
|
|
9008
9564
|
function getOESElementIndexUint(context) {
|
|
@@ -9014,9 +9570,9 @@ function getOESElementIndexUint(context) {
|
|
|
9014
9570
|
return result;
|
|
9015
9571
|
}
|
|
9016
9572
|
|
|
9017
|
-
// ../../../packages/
|
|
9573
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-standard-derivatives.js
|
|
9018
9574
|
init_console_gjs();
|
|
9019
|
-
|
|
9575
|
+
init_auto_globals_53fe98c6e6();
|
|
9020
9576
|
var OESStandardDerivatives = class {
|
|
9021
9577
|
constructor() {
|
|
9022
9578
|
this.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 35723;
|
|
@@ -9031,9 +9587,9 @@ function getOESStandardDerivatives(context) {
|
|
|
9031
9587
|
return result;
|
|
9032
9588
|
}
|
|
9033
9589
|
|
|
9034
|
-
// ../../../packages/
|
|
9590
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float.js
|
|
9035
9591
|
init_console_gjs();
|
|
9036
|
-
|
|
9592
|
+
init_auto_globals_53fe98c6e6();
|
|
9037
9593
|
var OESTextureFloat = class {
|
|
9038
9594
|
};
|
|
9039
9595
|
function getOESTextureFloat(context) {
|
|
@@ -9045,9 +9601,9 @@ function getOESTextureFloat(context) {
|
|
|
9045
9601
|
return result;
|
|
9046
9602
|
}
|
|
9047
9603
|
|
|
9048
|
-
// ../../../packages/
|
|
9604
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-float-linear.js
|
|
9049
9605
|
init_console_gjs();
|
|
9050
|
-
|
|
9606
|
+
init_auto_globals_53fe98c6e6();
|
|
9051
9607
|
var OESTextureFloatLinear = class {
|
|
9052
9608
|
};
|
|
9053
9609
|
function getOESTextureFloatLinear(context) {
|
|
@@ -9059,9 +9615,9 @@ function getOESTextureFloatLinear(context) {
|
|
|
9059
9615
|
return result;
|
|
9060
9616
|
}
|
|
9061
9617
|
|
|
9062
|
-
// ../../../packages/
|
|
9618
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/stackgl-destroy-context.js
|
|
9063
9619
|
init_console_gjs();
|
|
9064
|
-
|
|
9620
|
+
init_auto_globals_53fe98c6e6();
|
|
9065
9621
|
var STACKGLDestroyContext = class {
|
|
9066
9622
|
constructor(ctx) {
|
|
9067
9623
|
this.destroy = ctx.destroy.bind(ctx);
|
|
@@ -9071,9 +9627,9 @@ function getSTACKGLDestroyContext(ctx) {
|
|
|
9071
9627
|
return new STACKGLDestroyContext(ctx);
|
|
9072
9628
|
}
|
|
9073
9629
|
|
|
9074
|
-
// ../../../packages/
|
|
9630
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/stackgl-resize-drawing-buffer.js
|
|
9075
9631
|
init_console_gjs();
|
|
9076
|
-
|
|
9632
|
+
init_auto_globals_53fe98c6e6();
|
|
9077
9633
|
var STACKGLResizeDrawingBuffer = class {
|
|
9078
9634
|
constructor(ctx) {
|
|
9079
9635
|
this.resize = ctx.resize.bind(ctx);
|
|
@@ -9083,9 +9639,9 @@ function getSTACKGLResizeDrawingBuffer(ctx) {
|
|
|
9083
9639
|
return new STACKGLResizeDrawingBuffer(ctx);
|
|
9084
9640
|
}
|
|
9085
9641
|
|
|
9086
|
-
// ../../../packages/
|
|
9642
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-blend-minmax.js
|
|
9087
9643
|
init_console_gjs();
|
|
9088
|
-
|
|
9644
|
+
init_auto_globals_53fe98c6e6();
|
|
9089
9645
|
var EXTBlendMinMax = class {
|
|
9090
9646
|
constructor() {
|
|
9091
9647
|
this.MIN_EXT = 32775;
|
|
@@ -9101,9 +9657,9 @@ function getEXTBlendMinMax(context) {
|
|
|
9101
9657
|
return result;
|
|
9102
9658
|
}
|
|
9103
9659
|
|
|
9104
|
-
// ../../../packages/
|
|
9660
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-float.js
|
|
9105
9661
|
init_console_gjs();
|
|
9106
|
-
|
|
9662
|
+
init_auto_globals_53fe98c6e6();
|
|
9107
9663
|
var EXTColorBufferFloat = class {
|
|
9108
9664
|
};
|
|
9109
9665
|
function getEXTColorBufferFloat(context) {
|
|
@@ -9114,9 +9670,9 @@ function getEXTColorBufferFloat(context) {
|
|
|
9114
9670
|
return null;
|
|
9115
9671
|
}
|
|
9116
9672
|
|
|
9117
|
-
// ../../../packages/
|
|
9673
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-color-buffer-half-float.js
|
|
9118
9674
|
init_console_gjs();
|
|
9119
|
-
|
|
9675
|
+
init_auto_globals_53fe98c6e6();
|
|
9120
9676
|
var EXTColorBufferHalfFloat = class {
|
|
9121
9677
|
};
|
|
9122
9678
|
function getEXTColorBufferHalfFloat(context) {
|
|
@@ -9127,9 +9683,9 @@ function getEXTColorBufferHalfFloat(context) {
|
|
|
9127
9683
|
return null;
|
|
9128
9684
|
}
|
|
9129
9685
|
|
|
9130
|
-
// ../../../packages/
|
|
9686
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/ext-texture-filter-anisotropic.js
|
|
9131
9687
|
init_console_gjs();
|
|
9132
|
-
|
|
9688
|
+
init_auto_globals_53fe98c6e6();
|
|
9133
9689
|
var EXTTextureFilterAnisotropic = class {
|
|
9134
9690
|
constructor() {
|
|
9135
9691
|
this.TEXTURE_MAX_ANISOTROPY_EXT = 34046;
|
|
@@ -9145,9 +9701,9 @@ function getEXTTextureFilterAnisotropic(context) {
|
|
|
9145
9701
|
return result;
|
|
9146
9702
|
}
|
|
9147
9703
|
|
|
9148
|
-
// ../../../packages/
|
|
9704
|
+
// ../../../packages/framework/webgl/lib/esm/extensions/oes-texture-half-float.js
|
|
9149
9705
|
init_console_gjs();
|
|
9150
|
-
|
|
9706
|
+
init_auto_globals_53fe98c6e6();
|
|
9151
9707
|
var OESTextureHalfFloat = class {
|
|
9152
9708
|
constructor() {
|
|
9153
9709
|
this.HALF_FLOAT_OES = 36193;
|
|
@@ -9164,9 +9720,9 @@ function getOESTextureHalfFloat(context) {
|
|
|
9164
9720
|
return null;
|
|
9165
9721
|
}
|
|
9166
9722
|
|
|
9167
|
-
// ../../../packages/
|
|
9723
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-active-info.js
|
|
9168
9724
|
init_console_gjs();
|
|
9169
|
-
|
|
9725
|
+
init_auto_globals_53fe98c6e6();
|
|
9170
9726
|
var WebGLActiveInfo = class {
|
|
9171
9727
|
constructor(_) {
|
|
9172
9728
|
this.size = _.size;
|
|
@@ -9175,13 +9731,13 @@ var WebGLActiveInfo = class {
|
|
|
9175
9731
|
}
|
|
9176
9732
|
};
|
|
9177
9733
|
|
|
9178
|
-
// ../../../packages/
|
|
9734
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
|
|
9179
9735
|
init_console_gjs();
|
|
9180
|
-
|
|
9736
|
+
init_auto_globals_53fe98c6e6();
|
|
9181
9737
|
|
|
9182
|
-
// ../../../packages/
|
|
9738
|
+
// ../../../packages/framework/webgl/lib/esm/linkable.js
|
|
9183
9739
|
init_console_gjs();
|
|
9184
|
-
|
|
9740
|
+
init_auto_globals_53fe98c6e6();
|
|
9185
9741
|
var Linkable = class {
|
|
9186
9742
|
constructor(_) {
|
|
9187
9743
|
this._ = 0;
|
|
@@ -9230,7 +9786,7 @@ var Linkable = class {
|
|
|
9230
9786
|
}
|
|
9231
9787
|
};
|
|
9232
9788
|
|
|
9233
|
-
// ../../../packages/
|
|
9789
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-framebuffer.js
|
|
9234
9790
|
var WebGLFramebuffer = class extends Linkable {
|
|
9235
9791
|
constructor(_, ctx) {
|
|
9236
9792
|
super(_);
|
|
@@ -9336,9 +9892,9 @@ var WebGLFramebuffer = class extends Linkable {
|
|
|
9336
9892
|
}
|
|
9337
9893
|
};
|
|
9338
9894
|
|
|
9339
|
-
// ../../../packages/
|
|
9895
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-buffer.js
|
|
9340
9896
|
init_console_gjs();
|
|
9341
|
-
|
|
9897
|
+
init_auto_globals_53fe98c6e6();
|
|
9342
9898
|
var WebGLBuffer = class extends Linkable {
|
|
9343
9899
|
constructor(_, ctx) {
|
|
9344
9900
|
super(_);
|
|
@@ -9353,9 +9909,9 @@ var WebGLBuffer = class extends Linkable {
|
|
|
9353
9909
|
}
|
|
9354
9910
|
};
|
|
9355
9911
|
|
|
9356
|
-
// ../../../packages/
|
|
9912
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-drawing-buffer-wrapper.js
|
|
9357
9913
|
init_console_gjs();
|
|
9358
|
-
|
|
9914
|
+
init_auto_globals_53fe98c6e6();
|
|
9359
9915
|
var WebGLDrawingBufferWrapper = class {
|
|
9360
9916
|
constructor(framebuffer, color, depthStencil) {
|
|
9361
9917
|
this._framebuffer = framebuffer;
|
|
@@ -9364,9 +9920,9 @@ var WebGLDrawingBufferWrapper = class {
|
|
|
9364
9920
|
}
|
|
9365
9921
|
};
|
|
9366
9922
|
|
|
9367
|
-
// ../../../packages/
|
|
9923
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-program.js
|
|
9368
9924
|
init_console_gjs();
|
|
9369
|
-
|
|
9925
|
+
init_auto_globals_53fe98c6e6();
|
|
9370
9926
|
var WebGLProgram = class extends Linkable {
|
|
9371
9927
|
constructor(_, ctx) {
|
|
9372
9928
|
super(_);
|
|
@@ -9389,9 +9945,9 @@ var WebGLProgram = class extends Linkable {
|
|
|
9389
9945
|
}
|
|
9390
9946
|
};
|
|
9391
9947
|
|
|
9392
|
-
// ../../../packages/
|
|
9948
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-renderbuffer.js
|
|
9393
9949
|
init_console_gjs();
|
|
9394
|
-
|
|
9950
|
+
init_auto_globals_53fe98c6e6();
|
|
9395
9951
|
var WebGLRenderbuffer = class extends Linkable {
|
|
9396
9952
|
constructor(_, ctx) {
|
|
9397
9953
|
super(_);
|
|
@@ -9412,9 +9968,9 @@ var WebGLRenderbuffer = class extends Linkable {
|
|
|
9412
9968
|
}
|
|
9413
9969
|
};
|
|
9414
9970
|
|
|
9415
|
-
// ../../../packages/
|
|
9971
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-shader.js
|
|
9416
9972
|
init_console_gjs();
|
|
9417
|
-
|
|
9973
|
+
init_auto_globals_53fe98c6e6();
|
|
9418
9974
|
var WebGLShader = class extends Linkable {
|
|
9419
9975
|
constructor(_, ctx, type) {
|
|
9420
9976
|
super(_);
|
|
@@ -9435,9 +9991,9 @@ var WebGLShader = class extends Linkable {
|
|
|
9435
9991
|
}
|
|
9436
9992
|
};
|
|
9437
9993
|
|
|
9438
|
-
// ../../../packages/
|
|
9994
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-shader-precision-format.js
|
|
9439
9995
|
init_console_gjs();
|
|
9440
|
-
|
|
9996
|
+
init_auto_globals_53fe98c6e6();
|
|
9441
9997
|
var WebGLShaderPrecisionFormat = class {
|
|
9442
9998
|
constructor(_) {
|
|
9443
9999
|
this.rangeMin = _.rangeMin;
|
|
@@ -9446,9 +10002,9 @@ var WebGLShaderPrecisionFormat = class {
|
|
|
9446
10002
|
}
|
|
9447
10003
|
};
|
|
9448
10004
|
|
|
9449
|
-
// ../../../packages/
|
|
10005
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-texture-unit.js
|
|
9450
10006
|
init_console_gjs();
|
|
9451
|
-
|
|
10007
|
+
init_auto_globals_53fe98c6e6();
|
|
9452
10008
|
var WebGLTextureUnit = class {
|
|
9453
10009
|
constructor(ctx, idx) {
|
|
9454
10010
|
this._mode = 0;
|
|
@@ -9459,9 +10015,9 @@ var WebGLTextureUnit = class {
|
|
|
9459
10015
|
}
|
|
9460
10016
|
};
|
|
9461
10017
|
|
|
9462
|
-
// ../../../packages/
|
|
10018
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-texture.js
|
|
9463
10019
|
init_console_gjs();
|
|
9464
|
-
|
|
10020
|
+
init_auto_globals_53fe98c6e6();
|
|
9465
10021
|
var WebGLTexture = class extends Linkable {
|
|
9466
10022
|
constructor(_, ctx) {
|
|
9467
10023
|
super(_);
|
|
@@ -9480,9 +10036,9 @@ var WebGLTexture = class extends Linkable {
|
|
|
9480
10036
|
}
|
|
9481
10037
|
};
|
|
9482
10038
|
|
|
9483
|
-
// ../../../packages/
|
|
10039
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-vertex-attribute.js
|
|
9484
10040
|
init_console_gjs();
|
|
9485
|
-
|
|
10041
|
+
init_auto_globals_53fe98c6e6();
|
|
9486
10042
|
var WebGLVertexArrayObjectAttribute = class {
|
|
9487
10043
|
constructor(ctx, idx) {
|
|
9488
10044
|
this._isPointer = false;
|
|
@@ -9624,7 +10180,7 @@ var WebGLVertexArrayGlobalState = class {
|
|
|
9624
10180
|
}
|
|
9625
10181
|
};
|
|
9626
10182
|
|
|
9627
|
-
// ../../../packages/
|
|
10183
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-context-base.js
|
|
9628
10184
|
init_esm();
|
|
9629
10185
|
var VERSION = "0.0.1";
|
|
9630
10186
|
var CONTEXT_COUNTER = 0;
|
|
@@ -12949,7 +13505,7 @@ var WebGLContextBase = class {
|
|
|
12949
13505
|
}
|
|
12950
13506
|
};
|
|
12951
13507
|
|
|
12952
|
-
// ../../../packages/
|
|
13508
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-rendering-context.js
|
|
12953
13509
|
var WebGLRenderingContext2 = class extends WebGLContextBase {
|
|
12954
13510
|
constructor(canvas, options = {}) {
|
|
12955
13511
|
super(canvas, options);
|
|
@@ -13132,14 +13688,14 @@ var WebGLRenderingContext2 = class extends WebGLContextBase {
|
|
|
13132
13688
|
}
|
|
13133
13689
|
};
|
|
13134
13690
|
|
|
13135
|
-
// ../../../packages/
|
|
13691
|
+
// ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
|
|
13136
13692
|
init_console_gjs();
|
|
13137
|
-
|
|
13693
|
+
init_auto_globals_53fe98c6e6();
|
|
13138
13694
|
import GdkPixbuf4 from "gi://GdkPixbuf?version=2.0";
|
|
13139
13695
|
|
|
13140
|
-
// ../../../packages/
|
|
13696
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-query.js
|
|
13141
13697
|
init_console_gjs();
|
|
13142
|
-
|
|
13698
|
+
init_auto_globals_53fe98c6e6();
|
|
13143
13699
|
var WebGLQuery = class extends Linkable {
|
|
13144
13700
|
constructor(_, ctx) {
|
|
13145
13701
|
super(_);
|
|
@@ -13152,9 +13708,9 @@ var WebGLQuery = class extends Linkable {
|
|
|
13152
13708
|
}
|
|
13153
13709
|
};
|
|
13154
13710
|
|
|
13155
|
-
// ../../../packages/
|
|
13711
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-sampler.js
|
|
13156
13712
|
init_console_gjs();
|
|
13157
|
-
|
|
13713
|
+
init_auto_globals_53fe98c6e6();
|
|
13158
13714
|
var WebGLSampler = class extends Linkable {
|
|
13159
13715
|
constructor(_, ctx) {
|
|
13160
13716
|
super(_);
|
|
@@ -13167,9 +13723,9 @@ var WebGLSampler = class extends Linkable {
|
|
|
13167
13723
|
}
|
|
13168
13724
|
};
|
|
13169
13725
|
|
|
13170
|
-
// ../../../packages/
|
|
13726
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-sync.js
|
|
13171
13727
|
init_console_gjs();
|
|
13172
|
-
|
|
13728
|
+
init_auto_globals_53fe98c6e6();
|
|
13173
13729
|
var WebGLSync = class extends Linkable {
|
|
13174
13730
|
constructor(_, ctx) {
|
|
13175
13731
|
super(_);
|
|
@@ -13182,9 +13738,9 @@ var WebGLSync = class extends Linkable {
|
|
|
13182
13738
|
}
|
|
13183
13739
|
};
|
|
13184
13740
|
|
|
13185
|
-
// ../../../packages/
|
|
13741
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-transform-feedback.js
|
|
13186
13742
|
init_console_gjs();
|
|
13187
|
-
|
|
13743
|
+
init_auto_globals_53fe98c6e6();
|
|
13188
13744
|
var WebGLTransformFeedback = class extends Linkable {
|
|
13189
13745
|
constructor(_, ctx) {
|
|
13190
13746
|
super(_);
|
|
@@ -13197,9 +13753,9 @@ var WebGLTransformFeedback = class extends Linkable {
|
|
|
13197
13753
|
}
|
|
13198
13754
|
};
|
|
13199
13755
|
|
|
13200
|
-
// ../../../packages/
|
|
13756
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-vertex-array-object.js
|
|
13201
13757
|
init_console_gjs();
|
|
13202
|
-
|
|
13758
|
+
init_auto_globals_53fe98c6e6();
|
|
13203
13759
|
var WebGLVertexArrayObject = class extends Linkable {
|
|
13204
13760
|
constructor(_, ctx) {
|
|
13205
13761
|
super(_);
|
|
@@ -13217,7 +13773,7 @@ var WebGLVertexArrayObject = class extends Linkable {
|
|
|
13217
13773
|
}
|
|
13218
13774
|
};
|
|
13219
13775
|
|
|
13220
|
-
// ../../../packages/
|
|
13776
|
+
// ../../../packages/framework/webgl/lib/esm/webgl2-rendering-context.js
|
|
13221
13777
|
init_esm();
|
|
13222
13778
|
var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextBase {
|
|
13223
13779
|
constructor(canvas, options = {}) {
|
|
@@ -14027,8 +14583,18 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14027
14583
|
this._native2.vertexAttribIPointer(index, size, type, stride, offset);
|
|
14028
14584
|
}
|
|
14029
14585
|
drawBuffers(buffers) {
|
|
14030
|
-
|
|
14031
|
-
|
|
14586
|
+
let hasBack = false;
|
|
14587
|
+
for (let i = 0; i < buffers.length; i++) {
|
|
14588
|
+
if (buffers[i] === 1029) {
|
|
14589
|
+
hasBack = true;
|
|
14590
|
+
break;
|
|
14591
|
+
}
|
|
14592
|
+
}
|
|
14593
|
+
if (!hasBack) {
|
|
14594
|
+
this._native2.drawBuffers(buffers);
|
|
14595
|
+
return;
|
|
14596
|
+
}
|
|
14597
|
+
this._native2.drawBuffers(buffers.map((b) => b === 1029 ? this.COLOR_ATTACHMENT0 : b));
|
|
14032
14598
|
}
|
|
14033
14599
|
drawRangeElements(mode, start2, end, count2, type, offset) {
|
|
14034
14600
|
if (count2 < 0 || offset < 0) {
|
|
@@ -14125,10 +14691,10 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14125
14691
|
void drawbuffer;
|
|
14126
14692
|
}
|
|
14127
14693
|
invalidateFramebuffer(target, attachments) {
|
|
14128
|
-
this._native2.invalidateFramebuffer(target,
|
|
14694
|
+
this._native2.invalidateFramebuffer(target, attachments);
|
|
14129
14695
|
}
|
|
14130
14696
|
invalidateSubFramebuffer(target, attachments, x, y, width, height) {
|
|
14131
|
-
this._native2.invalidateSubFramebuffer(target,
|
|
14697
|
+
this._native2.invalidateSubFramebuffer(target, attachments, x, y, width, height);
|
|
14132
14698
|
}
|
|
14133
14699
|
readBuffer(src) {
|
|
14134
14700
|
this._native2.readBuffer(src);
|
|
@@ -14172,53 +14738,53 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14172
14738
|
uniform1uiv(location, data, _srcOffset, _srcLength) {
|
|
14173
14739
|
if (!location) return;
|
|
14174
14740
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14175
|
-
this._native2.uniform1uiv(location._, arr.length,
|
|
14741
|
+
this._native2.uniform1uiv(location._, arr.length, arr);
|
|
14176
14742
|
}
|
|
14177
14743
|
uniform2uiv(location, data, _srcOffset, _srcLength) {
|
|
14178
14744
|
if (!location) return;
|
|
14179
14745
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14180
|
-
this._native2.uniform2uiv(location._, arr.length / 2,
|
|
14746
|
+
this._native2.uniform2uiv(location._, arr.length / 2, arr);
|
|
14181
14747
|
}
|
|
14182
14748
|
uniform3uiv(location, data, _srcOffset, _srcLength) {
|
|
14183
14749
|
if (!location) return;
|
|
14184
14750
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14185
|
-
this._native2.uniform3uiv(location._, arr.length / 3,
|
|
14751
|
+
this._native2.uniform3uiv(location._, arr.length / 3, arr);
|
|
14186
14752
|
}
|
|
14187
14753
|
uniform4uiv(location, data, _srcOffset, _srcLength) {
|
|
14188
14754
|
if (!location) return;
|
|
14189
14755
|
const arr = data instanceof Uint32Array ? data : new Uint32Array(data);
|
|
14190
|
-
this._native2.uniform4uiv(location._, arr.length / 4,
|
|
14756
|
+
this._native2.uniform4uiv(location._, arr.length / 4, arr);
|
|
14191
14757
|
}
|
|
14192
14758
|
// ─── Non-square Matrix Uniforms ───────────────────────────────────────
|
|
14193
14759
|
uniformMatrix2x3fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14194
14760
|
if (!location) return;
|
|
14195
14761
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14196
|
-
this._native2.uniformMatrix2x3fv(location._, transpose,
|
|
14762
|
+
this._native2.uniformMatrix2x3fv(location._, transpose, arr);
|
|
14197
14763
|
}
|
|
14198
14764
|
uniformMatrix3x2fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14199
14765
|
if (!location) return;
|
|
14200
14766
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14201
|
-
this._native2.uniformMatrix3x2fv(location._, transpose,
|
|
14767
|
+
this._native2.uniformMatrix3x2fv(location._, transpose, arr);
|
|
14202
14768
|
}
|
|
14203
14769
|
uniformMatrix2x4fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14204
14770
|
if (!location) return;
|
|
14205
14771
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14206
|
-
this._native2.uniformMatrix2x4fv(location._, transpose,
|
|
14772
|
+
this._native2.uniformMatrix2x4fv(location._, transpose, arr);
|
|
14207
14773
|
}
|
|
14208
14774
|
uniformMatrix4x2fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14209
14775
|
if (!location) return;
|
|
14210
14776
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14211
|
-
this._native2.uniformMatrix4x2fv(location._, transpose,
|
|
14777
|
+
this._native2.uniformMatrix4x2fv(location._, transpose, arr);
|
|
14212
14778
|
}
|
|
14213
14779
|
uniformMatrix3x4fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14214
14780
|
if (!location) return;
|
|
14215
14781
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14216
|
-
this._native2.uniformMatrix3x4fv(location._, transpose,
|
|
14782
|
+
this._native2.uniformMatrix3x4fv(location._, transpose, arr);
|
|
14217
14783
|
}
|
|
14218
14784
|
uniformMatrix4x3fv(location, transpose, data, _srcOffset, _srcLength) {
|
|
14219
14785
|
if (!location) return;
|
|
14220
14786
|
const arr = data instanceof Float32Array ? data : new Float32Array(data);
|
|
14221
|
-
this._native2.uniformMatrix4x3fv(location._, transpose,
|
|
14787
|
+
this._native2.uniformMatrix4x3fv(location._, transpose, arr);
|
|
14222
14788
|
}
|
|
14223
14789
|
// ─── getUniform — WebGL2 uint type support ────────────────────────────
|
|
14224
14790
|
/** WebGL1 getUniform falls to default:null for UNSIGNED_INT types. Handle them here. */
|
|
@@ -14473,16 +15039,16 @@ var WebGL2RenderingContext = class _WebGL2RenderingContext extends WebGLContextB
|
|
|
14473
15039
|
}
|
|
14474
15040
|
};
|
|
14475
15041
|
|
|
14476
|
-
// ../../../packages/
|
|
15042
|
+
// ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
|
|
14477
15043
|
init_console_gjs();
|
|
14478
|
-
|
|
15044
|
+
init_auto_globals_53fe98c6e6();
|
|
14479
15045
|
|
|
14480
15046
|
// ../../../packages/dom/dom-elements/lib/esm/index.js
|
|
14481
15047
|
init_console_gjs();
|
|
14482
|
-
|
|
15048
|
+
init_auto_globals_53fe98c6e6();
|
|
14483
15049
|
init_html_canvas_element();
|
|
14484
15050
|
|
|
14485
|
-
// ../../../packages/
|
|
15051
|
+
// ../../../packages/framework/webgl/lib/esm/html-canvas-element.js
|
|
14486
15052
|
var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
|
|
14487
15053
|
constructor(gtkGlArea) {
|
|
14488
15054
|
super();
|
|
@@ -14543,27 +15109,27 @@ var HTMLCanvasElement3 = class extends HTMLCanvasElement2 {
|
|
|
14543
15109
|
}
|
|
14544
15110
|
};
|
|
14545
15111
|
|
|
14546
|
-
// ../../../packages/
|
|
15112
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
|
|
14547
15113
|
init_console_gjs();
|
|
14548
|
-
|
|
15114
|
+
init_auto_globals_53fe98c6e6();
|
|
14549
15115
|
import GObject from "gi://GObject";
|
|
14550
15116
|
import GLib2 from "gi://GLib?version=2.0";
|
|
14551
15117
|
import Gtk3 from "gi://Gtk?version=4.0";
|
|
14552
15118
|
|
|
14553
|
-
// ../../../packages/
|
|
15119
|
+
// ../../../packages/framework/event-bridge/lib/esm/index.js
|
|
14554
15120
|
init_console_gjs();
|
|
14555
|
-
|
|
15121
|
+
init_auto_globals_53fe98c6e6();
|
|
14556
15122
|
|
|
14557
|
-
// ../../../packages/
|
|
15123
|
+
// ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
|
|
14558
15124
|
init_console_gjs();
|
|
14559
|
-
|
|
15125
|
+
init_auto_globals_53fe98c6e6();
|
|
14560
15126
|
init_esm4();
|
|
14561
15127
|
import Gtk2 from "gi://Gtk?version=4.0";
|
|
14562
15128
|
import Gdk4 from "gi://Gdk?version=4.0";
|
|
14563
15129
|
|
|
14564
|
-
// ../../../packages/
|
|
15130
|
+
// ../../../packages/framework/event-bridge/lib/esm/key-map.js
|
|
14565
15131
|
init_console_gjs();
|
|
14566
|
-
|
|
15132
|
+
init_auto_globals_53fe98c6e6();
|
|
14567
15133
|
import Gdk3 from "gi://Gdk?version=4.0";
|
|
14568
15134
|
var SPECIAL_KEYS = {
|
|
14569
15135
|
Return: "Enter",
|
|
@@ -14752,7 +15318,7 @@ function gdkKeyvalToLocation(keyval) {
|
|
|
14752
15318
|
return 0;
|
|
14753
15319
|
}
|
|
14754
15320
|
|
|
14755
|
-
// ../../../packages/
|
|
15321
|
+
// ../../../packages/framework/event-bridge/lib/esm/event-bridge.js
|
|
14756
15322
|
function extractModifiers(controller) {
|
|
14757
15323
|
const mods = controller.get_current_event_state();
|
|
14758
15324
|
return {
|
|
@@ -14938,7 +15504,7 @@ function attachEventControllers(widget, getElement, options) {
|
|
|
14938
15504
|
widget.add_controller(focusCtrl);
|
|
14939
15505
|
}
|
|
14940
15506
|
|
|
14941
|
-
// ../../../packages/
|
|
15507
|
+
// ../../../packages/framework/webgl/lib/esm/webgl-bridge.js
|
|
14942
15508
|
init_esm4();
|
|
14943
15509
|
var WebGLBridge = GObject.registerClass(
|
|
14944
15510
|
{ GTypeName: "GjsifyWebGLBridge" },
|
|
@@ -14957,6 +15523,12 @@ var WebGLBridge = GObject.registerClass(
|
|
|
14957
15523
|
this.set_has_depth_buffer(true);
|
|
14958
15524
|
this.set_has_stencil_buffer(true);
|
|
14959
15525
|
attachEventControllers(this, () => this._canvas, { captureKeys: true });
|
|
15526
|
+
this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
|
|
15527
|
+
if (this._frameCallback !== null) {
|
|
15528
|
+
this.queue_render();
|
|
15529
|
+
}
|
|
15530
|
+
return GLib2.SOURCE_CONTINUE;
|
|
15531
|
+
});
|
|
14960
15532
|
const initId = this.connect("render", () => {
|
|
14961
15533
|
this.disconnect(initId);
|
|
14962
15534
|
this.make_current();
|
|
@@ -14972,6 +15544,18 @@ var WebGLBridge = GObject.registerClass(
|
|
|
14972
15544
|
}
|
|
14973
15545
|
this._readyCallbacks = [];
|
|
14974
15546
|
}
|
|
15547
|
+
this._renderTag = this.connect("render", (_widget) => {
|
|
15548
|
+
if (this._frameCallback !== null) {
|
|
15549
|
+
const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
|
|
15550
|
+
if (globalThis.__GJSIFY_DEBUG_RAF === true) {
|
|
15551
|
+
console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
|
|
15552
|
+
}
|
|
15553
|
+
const cb = this._frameCallback;
|
|
15554
|
+
this._frameCallback = null;
|
|
15555
|
+
cb(time2);
|
|
15556
|
+
}
|
|
15557
|
+
return true;
|
|
15558
|
+
});
|
|
14975
15559
|
return true;
|
|
14976
15560
|
});
|
|
14977
15561
|
this.connect("resize", () => {
|
|
@@ -15035,30 +15619,13 @@ var WebGLBridge = GObject.registerClass(
|
|
|
15035
15619
|
}
|
|
15036
15620
|
/**
|
|
15037
15621
|
* Schedules a single animation frame callback, matching the browser `requestAnimationFrame` API.
|
|
15038
|
-
* Backed by GTK frame clock (vsync-synced) +
|
|
15039
|
-
*
|
|
15622
|
+
* Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
|
|
15623
|
+
* render signal handler. Both are installed once at construction / first render respectively,
|
|
15624
|
+
* eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
|
|
15625
|
+
* Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
|
|
15040
15626
|
*/
|
|
15041
15627
|
requestAnimationFrame(cb) {
|
|
15042
15628
|
this._frameCallback = cb;
|
|
15043
|
-
if (this._tickCallbackId === null) {
|
|
15044
|
-
this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
|
|
15045
|
-
this._tickCallbackId = null;
|
|
15046
|
-
if (this._renderTag === null) {
|
|
15047
|
-
this._renderTag = this.connect("render", (_widget2) => {
|
|
15048
|
-
this.disconnect(this._renderTag);
|
|
15049
|
-
this._renderTag = null;
|
|
15050
|
-
const time2 = (GLib2.get_monotonic_time() - this._timeOrigin) / 1e3;
|
|
15051
|
-
if (globalThis.__GJSIFY_DEBUG_RAF === true) {
|
|
15052
|
-
console.log(`[rAF] frame callback fires t=${time2.toFixed(1)}`);
|
|
15053
|
-
}
|
|
15054
|
-
this._frameCallback?.(time2);
|
|
15055
|
-
return true;
|
|
15056
|
-
});
|
|
15057
|
-
}
|
|
15058
|
-
this.queue_render();
|
|
15059
|
-
return GLib2.SOURCE_REMOVE;
|
|
15060
|
-
});
|
|
15061
|
-
}
|
|
15062
15629
|
this.queue_render();
|
|
15063
15630
|
return 0;
|
|
15064
15631
|
}
|
|
@@ -15080,22 +15647,22 @@ var WebGLBridge = GObject.registerClass(
|
|
|
15080
15647
|
}
|
|
15081
15648
|
);
|
|
15082
15649
|
|
|
15083
|
-
// ../../../packages/
|
|
15650
|
+
// ../../../packages/framework/webgl/lib/esm/index.js
|
|
15084
15651
|
globalThis.WebGLRenderingContext = WebGLRenderingContext2;
|
|
15085
15652
|
globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
15086
15653
|
|
|
15087
15654
|
// src/three-demo.ts
|
|
15088
15655
|
init_console_gjs();
|
|
15089
|
-
|
|
15656
|
+
init_auto_globals_53fe98c6e6();
|
|
15090
15657
|
|
|
15091
15658
|
// ../../../node_modules/three/build/three.module.js
|
|
15092
15659
|
init_console_gjs();
|
|
15093
|
-
|
|
15660
|
+
init_auto_globals_53fe98c6e6();
|
|
15094
15661
|
|
|
15095
15662
|
// ../../../node_modules/three/build/three.core.js
|
|
15096
15663
|
init_console_gjs();
|
|
15097
|
-
|
|
15098
|
-
var REVISION = "
|
|
15664
|
+
init_auto_globals_53fe98c6e6();
|
|
15665
|
+
var REVISION = "184";
|
|
15099
15666
|
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
15100
15667
|
var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
15101
15668
|
var CullFaceNone = 0;
|
|
@@ -15819,6 +16386,9 @@ var MathUtils = {
|
|
|
15819
16386
|
denormalize
|
|
15820
16387
|
};
|
|
15821
16388
|
var Vector2 = class _Vector2 {
|
|
16389
|
+
static {
|
|
16390
|
+
_Vector2.prototype.isVector2 = true;
|
|
16391
|
+
}
|
|
15822
16392
|
/**
|
|
15823
16393
|
* Constructs a new 2D vector.
|
|
15824
16394
|
*
|
|
@@ -15826,7 +16396,6 @@ var Vector2 = class _Vector2 {
|
|
|
15826
16396
|
* @param {number} [y=0] - The y value of this vector.
|
|
15827
16397
|
*/
|
|
15828
16398
|
constructor(x = 0, y = 0) {
|
|
15829
|
-
_Vector2.prototype.isVector2 = true;
|
|
15830
16399
|
this.x = x;
|
|
15831
16400
|
this.y = y;
|
|
15832
16401
|
}
|
|
@@ -17044,6 +17613,9 @@ var Quaternion = class {
|
|
|
17044
17613
|
}
|
|
17045
17614
|
};
|
|
17046
17615
|
var Vector3 = class _Vector3 {
|
|
17616
|
+
static {
|
|
17617
|
+
_Vector3.prototype.isVector3 = true;
|
|
17618
|
+
}
|
|
17047
17619
|
/**
|
|
17048
17620
|
* Constructs a new 3D vector.
|
|
17049
17621
|
*
|
|
@@ -17052,7 +17624,6 @@ var Vector3 = class _Vector3 {
|
|
|
17052
17624
|
* @param {number} [z=0] - The z value of this vector.
|
|
17053
17625
|
*/
|
|
17054
17626
|
constructor(x = 0, y = 0, z = 0) {
|
|
17055
|
-
_Vector3.prototype.isVector3 = true;
|
|
17056
17627
|
this.x = x;
|
|
17057
17628
|
this.y = y;
|
|
17058
17629
|
this.z = z;
|
|
@@ -17950,6 +18521,9 @@ var Vector3 = class _Vector3 {
|
|
|
17950
18521
|
var _vector$c = /* @__PURE__ */ new Vector3();
|
|
17951
18522
|
var _quaternion$5 = /* @__PURE__ */ new Quaternion();
|
|
17952
18523
|
var Matrix3 = class _Matrix3 {
|
|
18524
|
+
static {
|
|
18525
|
+
_Matrix3.prototype.isMatrix3 = true;
|
|
18526
|
+
}
|
|
17953
18527
|
/**
|
|
17954
18528
|
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
17955
18529
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -17966,7 +18540,6 @@ var Matrix3 = class _Matrix3 {
|
|
|
17966
18540
|
* @param {number} [n33] - 3-3 matrix element.
|
|
17967
18541
|
*/
|
|
17968
18542
|
constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
|
|
17969
|
-
_Matrix3.prototype.isMatrix3 = true;
|
|
17970
18543
|
this.elements = [
|
|
17971
18544
|
1,
|
|
17972
18545
|
0,
|
|
@@ -18666,7 +19239,7 @@ var Source = class {
|
|
|
18666
19239
|
if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
|
|
18667
19240
|
target.set(data.videoWidth, data.videoHeight, 0);
|
|
18668
19241
|
} else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
|
|
18669
|
-
target.set(data.
|
|
19242
|
+
target.set(data.displayWidth, data.displayHeight, 0);
|
|
18670
19243
|
} else if (data !== null) {
|
|
18671
19244
|
target.set(data.width, data.height, data.depth || 0);
|
|
18672
19245
|
} else {
|
|
@@ -18796,6 +19369,7 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18796
19369
|
this.isRenderTargetTexture = false;
|
|
18797
19370
|
this.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;
|
|
18798
19371
|
this.pmremVersion = 0;
|
|
19372
|
+
this.normalized = false;
|
|
18799
19373
|
}
|
|
18800
19374
|
/**
|
|
18801
19375
|
* The width of the texture in pixels.
|
|
@@ -18823,11 +19397,11 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18823
19397
|
get image() {
|
|
18824
19398
|
return this.source.data;
|
|
18825
19399
|
}
|
|
18826
|
-
set image(value2
|
|
19400
|
+
set image(value2) {
|
|
18827
19401
|
this.source.data = value2;
|
|
18828
19402
|
}
|
|
18829
19403
|
/**
|
|
18830
|
-
* Updates the texture transformation matrix from the
|
|
19404
|
+
* Updates the texture transformation matrix from the properties {@link Texture#offset},
|
|
18831
19405
|
* {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.
|
|
18832
19406
|
*/
|
|
18833
19407
|
updateMatrix() {
|
|
@@ -18876,6 +19450,7 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18876
19450
|
this.format = source.format;
|
|
18877
19451
|
this.internalFormat = source.internalFormat;
|
|
18878
19452
|
this.type = source.type;
|
|
19453
|
+
this.normalized = source.normalized;
|
|
18879
19454
|
this.offset.copy(source.offset);
|
|
18880
19455
|
this.repeat.copy(source.repeat);
|
|
18881
19456
|
this.center.copy(source.center);
|
|
@@ -18952,6 +19527,7 @@ var Texture = class _Texture extends EventDispatcher {
|
|
|
18952
19527
|
format: this.format,
|
|
18953
19528
|
internalFormat: this.internalFormat,
|
|
18954
19529
|
type: this.type,
|
|
19530
|
+
normalized: this.normalized,
|
|
18955
19531
|
colorSpace: this.colorSpace,
|
|
18956
19532
|
minFilter: this.minFilter,
|
|
18957
19533
|
magFilter: this.magFilter,
|
|
@@ -19057,6 +19633,9 @@ Texture.DEFAULT_IMAGE = null;
|
|
|
19057
19633
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
19058
19634
|
Texture.DEFAULT_ANISOTROPY = 1;
|
|
19059
19635
|
var Vector4 = class _Vector4 {
|
|
19636
|
+
static {
|
|
19637
|
+
_Vector4.prototype.isVector4 = true;
|
|
19638
|
+
}
|
|
19060
19639
|
/**
|
|
19061
19640
|
* Constructs a new 4D vector.
|
|
19062
19641
|
*
|
|
@@ -19066,7 +19645,6 @@ var Vector4 = class _Vector4 {
|
|
|
19066
19645
|
* @param {number} [w=1] - The w value of this vector.
|
|
19067
19646
|
*/
|
|
19068
19647
|
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
19069
|
-
_Vector4.prototype.isVector4 = true;
|
|
19070
19648
|
this.x = x;
|
|
19071
19649
|
this.y = y;
|
|
19072
19650
|
this.z = z;
|
|
@@ -19974,6 +20552,7 @@ var RenderTarget = class extends EventDispatcher {
|
|
|
19974
20552
|
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
19975
20553
|
if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
|
|
19976
20554
|
this.samples = source.samples;
|
|
20555
|
+
this.multiview = source.multiview;
|
|
19977
20556
|
return this;
|
|
19978
20557
|
}
|
|
19979
20558
|
/**
|
|
@@ -20061,6 +20640,9 @@ var Data3DTexture = class extends Texture {
|
|
|
20061
20640
|
}
|
|
20062
20641
|
};
|
|
20063
20642
|
var Matrix4 = class _Matrix4 {
|
|
20643
|
+
static {
|
|
20644
|
+
_Matrix4.prototype.isMatrix4 = true;
|
|
20645
|
+
}
|
|
20064
20646
|
/**
|
|
20065
20647
|
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
20066
20648
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -20084,7 +20666,6 @@ var Matrix4 = class _Matrix4 {
|
|
|
20084
20666
|
* @param {number} [n44] - 4-4 matrix element.
|
|
20085
20667
|
*/
|
|
20086
20668
|
constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
|
|
20087
|
-
_Matrix4.prototype.isMatrix4 = true;
|
|
20088
20669
|
this.elements = [
|
|
20089
20670
|
1,
|
|
20090
20671
|
0,
|
|
@@ -22447,9 +23028,7 @@ var Object3D = class _Object3D extends EventDispatcher {
|
|
|
22447
23028
|
this.rotation.order = source.rotation.order;
|
|
22448
23029
|
this.quaternion.copy(source.quaternion);
|
|
22449
23030
|
this.scale.copy(source.scale);
|
|
22450
|
-
|
|
22451
|
-
this.pivot = source.pivot.clone();
|
|
22452
|
-
}
|
|
23031
|
+
this.pivot = source.pivot !== null ? source.pivot.clone() : null;
|
|
22453
23032
|
this.matrix.copy(source.matrix);
|
|
22454
23033
|
this.matrixWorld.copy(source.matrixWorld);
|
|
22455
23034
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
@@ -22539,6 +23118,7 @@ var WebXRController = class {
|
|
|
22539
23118
|
this._grip.linearVelocity = new Vector3();
|
|
22540
23119
|
this._grip.hasAngularVelocity = false;
|
|
22541
23120
|
this._grip.angularVelocity = new Vector3();
|
|
23121
|
+
this._grip.eventsEnabled = false;
|
|
22542
23122
|
}
|
|
22543
23123
|
return this._grip;
|
|
22544
23124
|
}
|
|
@@ -22668,6 +23248,13 @@ var WebXRController = class {
|
|
|
22668
23248
|
} else {
|
|
22669
23249
|
grip.hasAngularVelocity = false;
|
|
22670
23250
|
}
|
|
23251
|
+
if (grip.eventsEnabled) {
|
|
23252
|
+
grip.dispatchEvent({
|
|
23253
|
+
type: "gripUpdated",
|
|
23254
|
+
data: inputSource,
|
|
23255
|
+
target: this
|
|
23256
|
+
});
|
|
23257
|
+
}
|
|
22671
23258
|
}
|
|
22672
23259
|
}
|
|
22673
23260
|
}
|
|
@@ -23680,7 +24267,7 @@ var Triangle = class _Triangle {
|
|
|
23680
24267
|
static isFrontFacing(a, b, c, direction) {
|
|
23681
24268
|
_v0$2.subVectors(c, b);
|
|
23682
24269
|
_v1$5.subVectors(a, b);
|
|
23683
|
-
return _v0$2.cross(_v1$5).dot(direction) < 0
|
|
24270
|
+
return _v0$2.cross(_v1$5).dot(direction) < 0;
|
|
23684
24271
|
}
|
|
23685
24272
|
/**
|
|
23686
24273
|
* Sets the triangle's vertices by copying the given values.
|
|
@@ -24441,7 +25028,7 @@ function satForAxes(axes, v0, v1, v2, extents) {
|
|
|
24441
25028
|
var _vector$a = /* @__PURE__ */ new Vector3();
|
|
24442
25029
|
var _vector2$1 = /* @__PURE__ */ new Vector2();
|
|
24443
25030
|
var _id$2 = 0;
|
|
24444
|
-
var BufferAttribute = class {
|
|
25031
|
+
var BufferAttribute = class extends EventDispatcher {
|
|
24445
25032
|
/**
|
|
24446
25033
|
* Constructs a new buffer attribute.
|
|
24447
25034
|
*
|
|
@@ -24450,6 +25037,7 @@ var BufferAttribute = class {
|
|
|
24450
25037
|
* @param {boolean} [normalized=false] - Whether the data are normalized or not.
|
|
24451
25038
|
*/
|
|
24452
25039
|
constructor(array, itemSize, normalized = false) {
|
|
25040
|
+
super();
|
|
24453
25041
|
if (Array.isArray(array)) {
|
|
24454
25042
|
throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
|
|
24455
25043
|
}
|
|
@@ -24846,6 +25434,12 @@ var BufferAttribute = class {
|
|
|
24846
25434
|
if (this.usage !== StaticDrawUsage) data.usage = this.usage;
|
|
24847
25435
|
return data;
|
|
24848
25436
|
}
|
|
25437
|
+
/**
|
|
25438
|
+
* Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
|
|
25439
|
+
*/
|
|
25440
|
+
dispose() {
|
|
25441
|
+
this.dispatchEvent({ type: "dispose" });
|
|
25442
|
+
}
|
|
24849
25443
|
};
|
|
24850
25444
|
var Uint16BufferAttribute = class extends BufferAttribute {
|
|
24851
25445
|
/**
|
|
@@ -27200,9 +27794,10 @@ var Plane = class {
|
|
|
27200
27794
|
*
|
|
27201
27795
|
* @param {Line3} line - The line to compute the intersection for.
|
|
27202
27796
|
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
27203
|
-
* @
|
|
27797
|
+
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
27798
|
+
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
27204
27799
|
*/
|
|
27205
|
-
intersectLine(line, target) {
|
|
27800
|
+
intersectLine(line, target, clampToLine = true) {
|
|
27206
27801
|
const direction = line.delta(_vector1);
|
|
27207
27802
|
const denominator = this.normal.dot(direction);
|
|
27208
27803
|
if (denominator === 0) {
|
|
@@ -27212,7 +27807,7 @@ var Plane = class {
|
|
|
27212
27807
|
return null;
|
|
27213
27808
|
}
|
|
27214
27809
|
const t = -(line.start.dot(this.normal) + this.constant) / denominator;
|
|
27215
|
-
if (t < 0 || t > 1) {
|
|
27810
|
+
if (clampToLine === true && (t < 0 || t > 1)) {
|
|
27216
27811
|
return null;
|
|
27217
27812
|
}
|
|
27218
27813
|
return target.copy(line.start).addScaledVector(direction, t);
|
|
@@ -27783,7 +28378,7 @@ function cloneUniforms(src) {
|
|
|
27783
28378
|
dst[u] = {};
|
|
27784
28379
|
for (const p in src[u]) {
|
|
27785
28380
|
const property = src[u][p];
|
|
27786
|
-
if (
|
|
28381
|
+
if (isThreeObject(property)) {
|
|
27787
28382
|
if (property.isRenderTargetTexture) {
|
|
27788
28383
|
warn2("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
|
|
27789
28384
|
dst[u][p] = null;
|
|
@@ -27791,7 +28386,15 @@ function cloneUniforms(src) {
|
|
|
27791
28386
|
dst[u][p] = property.clone();
|
|
27792
28387
|
}
|
|
27793
28388
|
} else if (Array.isArray(property)) {
|
|
27794
|
-
|
|
28389
|
+
if (isThreeObject(property[0])) {
|
|
28390
|
+
const clonedProperty = [];
|
|
28391
|
+
for (let i = 0, l = property.length; i < l; i++) {
|
|
28392
|
+
clonedProperty[i] = property[i].clone();
|
|
28393
|
+
}
|
|
28394
|
+
dst[u][p] = clonedProperty;
|
|
28395
|
+
} else {
|
|
28396
|
+
dst[u][p] = property.slice();
|
|
28397
|
+
}
|
|
27795
28398
|
} else {
|
|
27796
28399
|
dst[u][p] = property;
|
|
27797
28400
|
}
|
|
@@ -27809,6 +28412,9 @@ function mergeUniforms(uniforms) {
|
|
|
27809
28412
|
}
|
|
27810
28413
|
return merged;
|
|
27811
28414
|
}
|
|
28415
|
+
function isThreeObject(property) {
|
|
28416
|
+
return property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion);
|
|
28417
|
+
}
|
|
27812
28418
|
function cloneUniformsGroups(src) {
|
|
27813
28419
|
const dst = [];
|
|
27814
28420
|
for (let u = 0; u < src.length; u++) {
|
|
@@ -30760,6 +31366,77 @@ var Spherical = class {
|
|
|
30760
31366
|
return new this.constructor().copy(this);
|
|
30761
31367
|
}
|
|
30762
31368
|
};
|
|
31369
|
+
var Matrix2 = class _Matrix2 {
|
|
31370
|
+
static {
|
|
31371
|
+
_Matrix2.prototype.isMatrix2 = true;
|
|
31372
|
+
}
|
|
31373
|
+
/**
|
|
31374
|
+
* Constructs a new 2x2 matrix. The arguments are supposed to be
|
|
31375
|
+
* in row-major order. If no arguments are provided, the constructor
|
|
31376
|
+
* initializes the matrix as an identity matrix.
|
|
31377
|
+
*
|
|
31378
|
+
* @param {number} [n11] - 1-1 matrix element.
|
|
31379
|
+
* @param {number} [n12] - 1-2 matrix element.
|
|
31380
|
+
* @param {number} [n21] - 2-1 matrix element.
|
|
31381
|
+
* @param {number} [n22] - 2-2 matrix element.
|
|
31382
|
+
*/
|
|
31383
|
+
constructor(n11, n12, n21, n22) {
|
|
31384
|
+
this.elements = [
|
|
31385
|
+
1,
|
|
31386
|
+
0,
|
|
31387
|
+
0,
|
|
31388
|
+
1
|
|
31389
|
+
];
|
|
31390
|
+
if (n11 !== void 0) {
|
|
31391
|
+
this.set(n11, n12, n21, n22);
|
|
31392
|
+
}
|
|
31393
|
+
}
|
|
31394
|
+
/**
|
|
31395
|
+
* Sets this matrix to the 2x2 identity matrix.
|
|
31396
|
+
*
|
|
31397
|
+
* @return {Matrix2} A reference to this matrix.
|
|
31398
|
+
*/
|
|
31399
|
+
identity() {
|
|
31400
|
+
this.set(
|
|
31401
|
+
1,
|
|
31402
|
+
0,
|
|
31403
|
+
0,
|
|
31404
|
+
1
|
|
31405
|
+
);
|
|
31406
|
+
return this;
|
|
31407
|
+
}
|
|
31408
|
+
/**
|
|
31409
|
+
* Sets the elements of the matrix from the given array.
|
|
31410
|
+
*
|
|
31411
|
+
* @param {Array<number>} array - The matrix elements in column-major order.
|
|
31412
|
+
* @param {number} [offset=0] - Index of the first element in the array.
|
|
31413
|
+
* @return {Matrix2} A reference to this matrix.
|
|
31414
|
+
*/
|
|
31415
|
+
fromArray(array, offset = 0) {
|
|
31416
|
+
for (let i = 0; i < 4; i++) {
|
|
31417
|
+
this.elements[i] = array[i + offset];
|
|
31418
|
+
}
|
|
31419
|
+
return this;
|
|
31420
|
+
}
|
|
31421
|
+
/**
|
|
31422
|
+
* Sets the elements of the matrix.The arguments are supposed to be
|
|
31423
|
+
* in row-major order.
|
|
31424
|
+
*
|
|
31425
|
+
* @param {number} n11 - 1-1 matrix element.
|
|
31426
|
+
* @param {number} n12 - 1-2 matrix element.
|
|
31427
|
+
* @param {number} n21 - 2-1 matrix element.
|
|
31428
|
+
* @param {number} n22 - 2-2 matrix element.
|
|
31429
|
+
* @return {Matrix2} A reference to this matrix.
|
|
31430
|
+
*/
|
|
31431
|
+
set(n11, n12, n21, n22) {
|
|
31432
|
+
const te = this.elements;
|
|
31433
|
+
te[0] = n11;
|
|
31434
|
+
te[2] = n12;
|
|
31435
|
+
te[1] = n21;
|
|
31436
|
+
te[3] = n22;
|
|
31437
|
+
return this;
|
|
31438
|
+
}
|
|
31439
|
+
};
|
|
30763
31440
|
var Controls = class extends EventDispatcher {
|
|
30764
31441
|
/**
|
|
30765
31442
|
* Constructs a new controls instance.
|
|
@@ -30950,11 +31627,12 @@ function WebGLAnimation() {
|
|
|
30950
31627
|
start: function() {
|
|
30951
31628
|
if (isAnimating === true) return;
|
|
30952
31629
|
if (animationLoop === null) return;
|
|
31630
|
+
if (context === null) return;
|
|
30953
31631
|
requestId = context.requestAnimationFrame(onAnimationFrame);
|
|
30954
31632
|
isAnimating = true;
|
|
30955
31633
|
},
|
|
30956
31634
|
stop: function() {
|
|
30957
|
-
context.cancelAnimationFrame(requestId);
|
|
31635
|
+
if (context !== null) context.cancelAnimationFrame(requestId);
|
|
30958
31636
|
isAnimating = false;
|
|
30959
31637
|
},
|
|
30960
31638
|
setAnimationLoop: function(callback) {
|
|
@@ -31121,8 +31799,8 @@ var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = textur
|
|
|
31121
31799
|
var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif";
|
|
31122
31800
|
var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
31123
31801
|
var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
|
|
31124
|
-
var envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation *
|
|
31125
|
-
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform
|
|
31802
|
+
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";
|
|
31803
|
+
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif";
|
|
31126
31804
|
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif";
|
|
31127
31805
|
var envmap_pars_vertex = "#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif";
|
|
31128
31806
|
var envmap_vertex = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif";
|
|
@@ -31134,17 +31812,18 @@ var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D grad
|
|
|
31134
31812
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
|
|
31135
31813
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
31136
31814
|
var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert";
|
|
31137
|
-
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif";
|
|
31815
|
+
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif\n#include <lightprobes_pars_fragment>";
|
|
31138
31816
|
var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif";
|
|
31139
31817
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
31140
31818
|
var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon";
|
|
31141
31819
|
var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
|
|
31142
31820
|
var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong";
|
|
31143
31821
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
31144
|
-
var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
31145
|
-
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
31822
|
+
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}";
|
|
31823
|
+
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n #ifdef USE_LIGHT_PROBES_GRID\n vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );\n irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
31146
31824
|
var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif";
|
|
31147
31825
|
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";
|
|
31826
|
+
var lightprobes_pars_fragment = "#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n vec3 res = probesResolution;\n vec3 gridRange = probesMax - probesMin;\n vec3 resMinusOne = res - 1.0;\n vec3 probeSpacing = gridRange / resMinusOne;\n vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n uvw = uvw * resMinusOne / res + 0.5 / res;\n float nz = res.z;\n float paddedSlices = nz + 2.0;\n float atlasDepth = 7.0 * paddedSlices;\n float uvZBase = uvw.z * nz + 1.0;\n vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n vec3 c0 = s0.xyz;\n vec3 c1 = vec3( s0.w, s1.xy );\n vec3 c2 = vec3( s1.zw, s2.x );\n vec3 c3 = s2.yzw;\n vec3 c4 = s3.xyz;\n vec3 c5 = vec3( s3.w, s4.xy );\n vec3 c6 = vec3( s4.zw, s5.x );\n vec3 c7 = s5.yzw;\n vec3 c8 = s6.xyz;\n float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n vec3 result = c0 * 0.886227;\n result += c1 * 2.0 * 0.511664 * y;\n result += c2 * 2.0 * 0.511664 * z;\n result += c3 * 2.0 * 0.511664 * x;\n result += c4 * 2.0 * 0.429043 * x * y;\n result += c5 * 2.0 * 0.429043 * y * z;\n result += c6 * ( 0.743125 * z * z - 0.247708 );\n result += c7 * 2.0 * 0.429043 * x * z;\n result += c8 * 0.429043 * ( x * x - y * y );\n return max( result, vec3( 0.0 ) );\n}\n#endif";
|
|
31148
31827
|
var logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
31149
31828
|
var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
31150
31829
|
var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
@@ -31161,7 +31840,7 @@ var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetB
|
|
|
31161
31840
|
var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif";
|
|
31162
31841
|
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif";
|
|
31163
31842
|
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;";
|
|
31164
|
-
var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
|
|
31843
|
+
var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #if defined( USE_PACKED_NORMALMAP )\n mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n #endif\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
|
|
31165
31844
|
var normal_pars_fragment = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif";
|
|
31166
31845
|
var normal_pars_vertex = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif";
|
|
31167
31846
|
var normal_vertex = "#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif";
|
|
@@ -31180,7 +31859,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
31180
31859
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
|
|
31181
31860
|
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif";
|
|
31182
31861
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif";
|
|
31183
|
-
var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
|
|
31862
|
+
var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n #ifdef HAS_NORMAL\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #else\n vec3 shadowWorldNormal = vec3( 0.0 );\n #endif\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
|
|
31184
31863
|
var shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}";
|
|
31185
31864
|
var skinbase_vertex = "#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
|
|
31186
31865
|
var skinning_pars_vertex = "#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif";
|
|
@@ -31199,7 +31878,7 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defin
|
|
|
31199
31878
|
var vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
31200
31879
|
var fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
|
|
31201
31880
|
var vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}";
|
|
31202
|
-
var fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float
|
|
31881
|
+
var fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
|
|
31203
31882
|
var vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}";
|
|
31204
31883
|
var fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
|
|
31205
31884
|
var vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}";
|
|
@@ -31287,6 +31966,7 @@ var ShaderChunk = {
|
|
|
31287
31966
|
lights_fragment_begin,
|
|
31288
31967
|
lights_fragment_maps,
|
|
31289
31968
|
lights_fragment_end,
|
|
31969
|
+
lightprobes_pars_fragment,
|
|
31290
31970
|
logdepthbuf_fragment,
|
|
31291
31971
|
logdepthbuf_pars_fragment,
|
|
31292
31972
|
logdepthbuf_pars_vertex,
|
|
@@ -31390,7 +32070,6 @@ var UniformsLib = {
|
|
|
31390
32070
|
envmap: {
|
|
31391
32071
|
envMap: { value: null },
|
|
31392
32072
|
envMapRotation: { value: /* @__PURE__ */ new Matrix3() },
|
|
31393
|
-
flipEnvMap: { value: -1 },
|
|
31394
32073
|
reflectivity: { value: 1 },
|
|
31395
32074
|
// basic, lambert, phong
|
|
31396
32075
|
ior: { value: 1.5 },
|
|
@@ -31509,7 +32188,11 @@ var UniformsLib = {
|
|
|
31509
32188
|
height: {}
|
|
31510
32189
|
} },
|
|
31511
32190
|
ltc_1: { value: null },
|
|
31512
|
-
ltc_2: { value: null }
|
|
32191
|
+
ltc_2: { value: null },
|
|
32192
|
+
probesSH: { value: null },
|
|
32193
|
+
probesMin: { value: /* @__PURE__ */ new Vector3() },
|
|
32194
|
+
probesMax: { value: /* @__PURE__ */ new Vector3() },
|
|
32195
|
+
probesResolution: { value: /* @__PURE__ */ new Vector3() }
|
|
31513
32196
|
},
|
|
31514
32197
|
points: {
|
|
31515
32198
|
diffuse: { value: /* @__PURE__ */ new Color(16777215) },
|
|
@@ -31710,7 +32393,6 @@ var ShaderLib = {
|
|
|
31710
32393
|
backgroundCube: {
|
|
31711
32394
|
uniforms: {
|
|
31712
32395
|
envMap: { value: null },
|
|
31713
|
-
flipEnvMap: { value: -1 },
|
|
31714
32396
|
backgroundBlurriness: { value: 0 },
|
|
31715
32397
|
backgroundIntensity: { value: 1 },
|
|
31716
32398
|
backgroundRotation: { value: /* @__PURE__ */ new Matrix3() }
|
|
@@ -31814,8 +32496,9 @@ ShaderLib.physical = {
|
|
|
31814
32496
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
31815
32497
|
};
|
|
31816
32498
|
var _rgb = { r: 0, b: 0, g: 0 };
|
|
31817
|
-
var _e1$1 = /* @__PURE__ */ new Euler();
|
|
31818
32499
|
var _m1$12 = /* @__PURE__ */ new Matrix4();
|
|
32500
|
+
var _m$1 = /* @__PURE__ */ new Matrix3();
|
|
32501
|
+
_m$1.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
31819
32502
|
function WebGLBackground(renderer, environments, state, objects, alpha, premultipliedAlpha) {
|
|
31820
32503
|
const clearColor = new Color(0);
|
|
31821
32504
|
let clearAlpha = alpha === true ? 0 : 1;
|
|
@@ -31884,19 +32567,13 @@ function WebGLBackground(renderer, environments, state, objects, alpha, premulti
|
|
|
31884
32567
|
});
|
|
31885
32568
|
objects.update(boxMesh);
|
|
31886
32569
|
}
|
|
31887
|
-
_e1$1.copy(scene.backgroundRotation);
|
|
31888
|
-
_e1$1.x *= -1;
|
|
31889
|
-
_e1$1.y *= -1;
|
|
31890
|
-
_e1$1.z *= -1;
|
|
31891
|
-
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
31892
|
-
_e1$1.y *= -1;
|
|
31893
|
-
_e1$1.z *= -1;
|
|
31894
|
-
}
|
|
31895
32570
|
boxMesh.material.uniforms.envMap.value = background;
|
|
31896
|
-
boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
|
|
31897
32571
|
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
31898
32572
|
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
31899
|
-
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(
|
|
32573
|
+
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(scene.backgroundRotation)).transpose();
|
|
32574
|
+
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
32575
|
+
boxMesh.material.uniforms.backgroundRotation.value.premultiply(_m$1);
|
|
32576
|
+
}
|
|
31900
32577
|
boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer;
|
|
31901
32578
|
if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
|
|
31902
32579
|
boxMesh.material.needsUpdate = true;
|
|
@@ -32372,27 +33049,10 @@ function WebGLBufferRenderer(gl, extensions, info2) {
|
|
|
32372
33049
|
}
|
|
32373
33050
|
info2.update(elementCount, mode, 1);
|
|
32374
33051
|
}
|
|
32375
|
-
function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
|
|
32376
|
-
if (drawCount === 0) return;
|
|
32377
|
-
const extension = extensions.get("WEBGL_multi_draw");
|
|
32378
|
-
if (extension === null) {
|
|
32379
|
-
for (let i = 0; i < starts.length; i++) {
|
|
32380
|
-
renderInstances(starts[i], counts[i], primcount[i]);
|
|
32381
|
-
}
|
|
32382
|
-
} else {
|
|
32383
|
-
extension.multiDrawArraysInstancedWEBGL(mode, starts, 0, counts, 0, primcount, 0, drawCount);
|
|
32384
|
-
let elementCount = 0;
|
|
32385
|
-
for (let i = 0; i < drawCount; i++) {
|
|
32386
|
-
elementCount += counts[i] * primcount[i];
|
|
32387
|
-
}
|
|
32388
|
-
info2.update(elementCount, mode, 1);
|
|
32389
|
-
}
|
|
32390
|
-
}
|
|
32391
33052
|
this.setMode = setMode;
|
|
32392
33053
|
this.render = render;
|
|
32393
33054
|
this.renderInstances = renderInstances;
|
|
32394
33055
|
this.renderMultiDraw = renderMultiDraw;
|
|
32395
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
32396
33056
|
}
|
|
32397
33057
|
function WebGLCapabilities(gl, extensions, parameters, utils) {
|
|
32398
33058
|
let maxAnisotropy;
|
|
@@ -32442,6 +33102,9 @@ function WebGLCapabilities(gl, extensions, parameters, utils) {
|
|
|
32442
33102
|
}
|
|
32443
33103
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
32444
33104
|
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has("EXT_clip_control");
|
|
33105
|
+
if (parameters.reversedDepthBuffer === true && reversedDepthBuffer === false) {
|
|
33106
|
+
warn2("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");
|
|
33107
|
+
}
|
|
32445
33108
|
const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
|
|
32446
33109
|
const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
32447
33110
|
const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
@@ -33783,28 +34446,11 @@ function WebGLIndexedBufferRenderer(gl, extensions, info2) {
|
|
|
33783
34446
|
}
|
|
33784
34447
|
info2.update(elementCount, mode, 1);
|
|
33785
34448
|
}
|
|
33786
|
-
function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
|
|
33787
|
-
if (drawCount === 0) return;
|
|
33788
|
-
const extension = extensions.get("WEBGL_multi_draw");
|
|
33789
|
-
if (extension === null) {
|
|
33790
|
-
for (let i = 0; i < starts.length; i++) {
|
|
33791
|
-
renderInstances(starts[i] / bytesPerElement, counts[i], primcount[i]);
|
|
33792
|
-
}
|
|
33793
|
-
} else {
|
|
33794
|
-
extension.multiDrawElementsInstancedWEBGL(mode, counts, 0, type, starts, 0, primcount, 0, drawCount);
|
|
33795
|
-
let elementCount = 0;
|
|
33796
|
-
for (let i = 0; i < drawCount; i++) {
|
|
33797
|
-
elementCount += counts[i] * primcount[i];
|
|
33798
|
-
}
|
|
33799
|
-
info2.update(elementCount, mode, 1);
|
|
33800
|
-
}
|
|
33801
|
-
}
|
|
33802
34449
|
this.setMode = setMode;
|
|
33803
34450
|
this.setIndex = setIndex;
|
|
33804
34451
|
this.render = render;
|
|
33805
34452
|
this.renderInstances = renderInstances;
|
|
33806
34453
|
this.renderMultiDraw = renderMultiDraw;
|
|
33807
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
33808
34454
|
}
|
|
33809
34455
|
function WebGLInfo(gl) {
|
|
33810
34456
|
const memory = {
|
|
@@ -34007,7 +34653,8 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
34007
34653
|
const targetA = new WebGLRenderTarget(width, height, {
|
|
34008
34654
|
type,
|
|
34009
34655
|
depthBuffer: depth,
|
|
34010
|
-
stencilBuffer: stencil
|
|
34656
|
+
stencilBuffer: stencil,
|
|
34657
|
+
depthTexture: depth ? new DepthTexture(width, height) : void 0
|
|
34011
34658
|
});
|
|
34012
34659
|
const targetB = new WebGLRenderTarget(width, height, {
|
|
34013
34660
|
type: HalfFloatType,
|
|
@@ -34160,6 +34807,7 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
34160
34807
|
return _isCompositing;
|
|
34161
34808
|
};
|
|
34162
34809
|
this.dispose = function() {
|
|
34810
|
+
if (targetA.depthTexture) targetA.depthTexture.dispose();
|
|
34163
34811
|
targetA.dispose();
|
|
34164
34812
|
targetB.dispose();
|
|
34165
34813
|
geometry.dispose();
|
|
@@ -35171,6 +35819,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35171
35819
|
parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "",
|
|
35172
35820
|
//
|
|
35173
35821
|
parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "",
|
|
35822
|
+
parameters.vertexNormals ? "#define HAS_NORMAL" : "",
|
|
35174
35823
|
parameters.vertexColors ? "#define USE_COLOR" : "",
|
|
35175
35824
|
parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
|
|
35176
35825
|
parameters.vertexUv1s ? "#define USE_UV1" : "",
|
|
@@ -35257,6 +35906,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35257
35906
|
parameters.normalMap ? "#define USE_NORMALMAP" : "",
|
|
35258
35907
|
parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "",
|
|
35259
35908
|
parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "",
|
|
35909
|
+
parameters.packedNormalMap ? "#define USE_PACKED_NORMALMAP" : "",
|
|
35260
35910
|
parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
|
|
35261
35911
|
parameters.anisotropy ? "#define USE_ANISOTROPY" : "",
|
|
35262
35912
|
parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "",
|
|
@@ -35297,6 +35947,7 @@ function WebGLProgram2(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35297
35947
|
parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "",
|
|
35298
35948
|
parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
|
|
35299
35949
|
parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "",
|
|
35950
|
+
parameters.numLightProbeGrids > 0 ? "#define USE_LIGHT_PROBES_GRID" : "",
|
|
35300
35951
|
parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "",
|
|
35301
35952
|
parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "",
|
|
35302
35953
|
parameters.logarithmicDepthBuffer ? "#define USE_LOGARITHMIC_DEPTH_BUFFER" : "",
|
|
@@ -35511,6 +36162,9 @@ var WebGLShaderStage = class {
|
|
|
35511
36162
|
this.usedTimes = 0;
|
|
35512
36163
|
}
|
|
35513
36164
|
};
|
|
36165
|
+
function isPackedRGFormat(format) {
|
|
36166
|
+
return format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;
|
|
36167
|
+
}
|
|
35514
36168
|
function WebGLPrograms(renderer, environments, extensions, capabilities, bindingStates, clipping) {
|
|
35515
36169
|
const _programLayers = new Layers();
|
|
35516
36170
|
const _customShaders = new WebGLShaderCache();
|
|
@@ -35541,7 +36195,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35541
36195
|
if (value2 === 0) return "uv";
|
|
35542
36196
|
return `uv${value2}`;
|
|
35543
36197
|
}
|
|
35544
|
-
function getParameters(material, lights, shadows, scene, object) {
|
|
36198
|
+
function getParameters(material, lights, shadows, scene, object, lightProbeGrids) {
|
|
35545
36199
|
const fog = scene.fog;
|
|
35546
36200
|
const geometry = object.geometry;
|
|
35547
36201
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -35636,7 +36290,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35636
36290
|
instancing: IS_INSTANCEDMESH,
|
|
35637
36291
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
35638
36292
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
35639
|
-
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace :
|
|
36293
|
+
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace,
|
|
35640
36294
|
alphaToCoverage: !!material.alphaToCoverage,
|
|
35641
36295
|
map: HAS_MAP,
|
|
35642
36296
|
matcap: HAS_MATCAP,
|
|
@@ -35651,6 +36305,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35651
36305
|
emissiveMap: HAS_EMISSIVEMAP,
|
|
35652
36306
|
normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
|
|
35653
36307
|
normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
|
|
36308
|
+
packedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat(material.normalMap.format),
|
|
35654
36309
|
metalnessMap: HAS_METALNESSMAP,
|
|
35655
36310
|
roughnessMap: HAS_ROUGHNESSMAP,
|
|
35656
36311
|
anisotropy: HAS_ANISOTROPY,
|
|
@@ -35704,6 +36359,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35704
36359
|
alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),
|
|
35705
36360
|
//
|
|
35706
36361
|
vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),
|
|
36362
|
+
vertexNormals: !!geometry.attributes.normal,
|
|
35707
36363
|
vertexColors: material.vertexColors,
|
|
35708
36364
|
vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
35709
36365
|
pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),
|
|
@@ -35731,6 +36387,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35731
36387
|
numSpotLightShadows: lights.spotShadowMap.length,
|
|
35732
36388
|
numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
|
|
35733
36389
|
numLightProbes: lights.numLightProbes,
|
|
36390
|
+
numLightProbeGrids: lightProbeGrids.length,
|
|
35734
36391
|
numClippingPlanes: clipping.numPlanes,
|
|
35735
36392
|
numClipIntersection: clipping.numIntersection,
|
|
35736
36393
|
dithering: material.dithering,
|
|
@@ -35874,6 +36531,10 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35874
36531
|
_programLayers.enable(20);
|
|
35875
36532
|
if (parameters.gradientMap)
|
|
35876
36533
|
_programLayers.enable(21);
|
|
36534
|
+
if (parameters.packedNormalMap)
|
|
36535
|
+
_programLayers.enable(22);
|
|
36536
|
+
if (parameters.vertexNormals)
|
|
36537
|
+
_programLayers.enable(23);
|
|
35877
36538
|
array.push(_programLayers.mask);
|
|
35878
36539
|
_programLayers.disableAll();
|
|
35879
36540
|
if (parameters.fog)
|
|
@@ -35920,6 +36581,8 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
|
|
|
35920
36581
|
_programLayers.enable(20);
|
|
35921
36582
|
if (parameters.alphaToCoverage)
|
|
35922
36583
|
_programLayers.enable(21);
|
|
36584
|
+
if (parameters.numLightProbeGrids > 0)
|
|
36585
|
+
_programLayers.enable(22);
|
|
35923
36586
|
array.push(_programLayers.mask);
|
|
35924
36587
|
}
|
|
35925
36588
|
function getUniforms(material) {
|
|
@@ -36519,10 +37182,12 @@ function WebGLRenderState(extensions) {
|
|
|
36519
37182
|
const lights = new WebGLLights(extensions);
|
|
36520
37183
|
const lightsArray = [];
|
|
36521
37184
|
const shadowsArray = [];
|
|
37185
|
+
const lightProbeGridArray = [];
|
|
36522
37186
|
function init(camera) {
|
|
36523
37187
|
state.camera = camera;
|
|
36524
37188
|
lightsArray.length = 0;
|
|
36525
37189
|
shadowsArray.length = 0;
|
|
37190
|
+
lightProbeGridArray.length = 0;
|
|
36526
37191
|
}
|
|
36527
37192
|
function pushLight(light) {
|
|
36528
37193
|
lightsArray.push(light);
|
|
@@ -36530,6 +37195,9 @@ function WebGLRenderState(extensions) {
|
|
|
36530
37195
|
function pushShadow(shadowLight) {
|
|
36531
37196
|
shadowsArray.push(shadowLight);
|
|
36532
37197
|
}
|
|
37198
|
+
function pushLightProbeGrid(volume) {
|
|
37199
|
+
lightProbeGridArray.push(volume);
|
|
37200
|
+
}
|
|
36533
37201
|
function setupLights() {
|
|
36534
37202
|
lights.setup(lightsArray);
|
|
36535
37203
|
}
|
|
@@ -36539,9 +37207,11 @@ function WebGLRenderState(extensions) {
|
|
|
36539
37207
|
const state = {
|
|
36540
37208
|
lightsArray,
|
|
36541
37209
|
shadowsArray,
|
|
37210
|
+
lightProbeGridArray,
|
|
36542
37211
|
camera: null,
|
|
36543
37212
|
lights,
|
|
36544
|
-
transmissionRenderTarget: {}
|
|
37213
|
+
transmissionRenderTarget: {},
|
|
37214
|
+
textureUnits: 0
|
|
36545
37215
|
};
|
|
36546
37216
|
return {
|
|
36547
37217
|
init,
|
|
@@ -36549,7 +37219,8 @@ function WebGLRenderState(extensions) {
|
|
|
36549
37219
|
setupLights,
|
|
36550
37220
|
setupLightsView,
|
|
36551
37221
|
pushLight,
|
|
36552
|
-
pushShadow
|
|
37222
|
+
pushShadow,
|
|
37223
|
+
pushLightProbeGrid
|
|
36553
37224
|
};
|
|
36554
37225
|
}
|
|
36555
37226
|
function WebGLRenderStates(extensions) {
|
|
@@ -37109,6 +37780,7 @@ function WebGLState(gl, extensions) {
|
|
|
37109
37780
|
const uboBindings = /* @__PURE__ */ new WeakMap();
|
|
37110
37781
|
const uboProgramMap = /* @__PURE__ */ new WeakMap();
|
|
37111
37782
|
let enabledCapabilities = {};
|
|
37783
|
+
let parameters = {};
|
|
37112
37784
|
let currentBoundFramebuffers = {};
|
|
37113
37785
|
let currentDrawbuffers = /* @__PURE__ */ new WeakMap();
|
|
37114
37786
|
let defaultDrawbuffers = [];
|
|
@@ -37533,6 +38205,19 @@ function WebGLState(gl, extensions) {
|
|
|
37533
38205
|
error2("WebGLState:", e);
|
|
37534
38206
|
}
|
|
37535
38207
|
}
|
|
38208
|
+
function getParameter(name2) {
|
|
38209
|
+
if (parameters[name2] !== void 0) {
|
|
38210
|
+
return parameters[name2];
|
|
38211
|
+
} else {
|
|
38212
|
+
return gl.getParameter(name2);
|
|
38213
|
+
}
|
|
38214
|
+
}
|
|
38215
|
+
function pixelStorei(name2, value2) {
|
|
38216
|
+
if (parameters[name2] !== value2) {
|
|
38217
|
+
gl.pixelStorei(name2, value2);
|
|
38218
|
+
parameters[name2] = value2;
|
|
38219
|
+
}
|
|
38220
|
+
}
|
|
37536
38221
|
function scissor(scissor2) {
|
|
37537
38222
|
if (currentScissor.equals(scissor2) === false) {
|
|
37538
38223
|
gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w);
|
|
@@ -37598,7 +38283,21 @@ function WebGLState(gl, extensions) {
|
|
|
37598
38283
|
gl.lineWidth(1);
|
|
37599
38284
|
gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
|
|
37600
38285
|
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
|
|
38286
|
+
gl.pixelStorei(gl.PACK_ALIGNMENT, 4);
|
|
38287
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
38288
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
38289
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
38290
|
+
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL);
|
|
38291
|
+
gl.pixelStorei(gl.PACK_ROW_LENGTH, 0);
|
|
38292
|
+
gl.pixelStorei(gl.PACK_SKIP_PIXELS, 0);
|
|
38293
|
+
gl.pixelStorei(gl.PACK_SKIP_ROWS, 0);
|
|
38294
|
+
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
|
|
38295
|
+
gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
|
|
38296
|
+
gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
|
|
38297
|
+
gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
|
|
38298
|
+
gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
|
|
37601
38299
|
enabledCapabilities = {};
|
|
38300
|
+
parameters = {};
|
|
37602
38301
|
currentTextureSlot = null;
|
|
37603
38302
|
currentBoundTextures = {};
|
|
37604
38303
|
currentBoundFramebuffers = {};
|
|
@@ -37652,6 +38351,8 @@ function WebGLState(gl, extensions) {
|
|
|
37652
38351
|
compressedTexImage3D,
|
|
37653
38352
|
texImage2D,
|
|
37654
38353
|
texImage3D,
|
|
38354
|
+
pixelStorei,
|
|
38355
|
+
getParameter,
|
|
37655
38356
|
updateUBOMapping,
|
|
37656
38357
|
uniformBlockBinding,
|
|
37657
38358
|
texStorage2D,
|
|
@@ -37670,6 +38371,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37670
38371
|
const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent);
|
|
37671
38372
|
const _imageDimensions = new Vector2();
|
|
37672
38373
|
const _videoTextures = /* @__PURE__ */ new WeakMap();
|
|
38374
|
+
const _htmlTextures = /* @__PURE__ */ new Set();
|
|
37673
38375
|
let _canvas2;
|
|
37674
38376
|
const _sources = /* @__PURE__ */ new WeakMap();
|
|
37675
38377
|
let useOffscreenCanvas = false;
|
|
@@ -37719,16 +38421,25 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37719
38421
|
if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY;
|
|
37720
38422
|
return _gl.TEXTURE_2D;
|
|
37721
38423
|
}
|
|
37722
|
-
function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) {
|
|
38424
|
+
function getInternalFormat(internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false) {
|
|
37723
38425
|
if (internalFormatName !== null) {
|
|
37724
38426
|
if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName];
|
|
37725
38427
|
warn2("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'");
|
|
37726
38428
|
}
|
|
38429
|
+
let ext_texture_norm16;
|
|
38430
|
+
if (normalized) {
|
|
38431
|
+
ext_texture_norm16 = extensions.get("EXT_texture_norm16");
|
|
38432
|
+
if (!ext_texture_norm16) {
|
|
38433
|
+
warn2("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension");
|
|
38434
|
+
}
|
|
38435
|
+
}
|
|
37727
38436
|
let internalFormat = glFormat;
|
|
37728
38437
|
if (glFormat === _gl.RED) {
|
|
37729
38438
|
if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
|
|
37730
38439
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
|
|
37731
38440
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
|
|
38441
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_EXT;
|
|
38442
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
|
|
37732
38443
|
}
|
|
37733
38444
|
if (glFormat === _gl.RED_INTEGER) {
|
|
37734
38445
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;
|
|
@@ -37742,6 +38453,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37742
38453
|
if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
|
|
37743
38454
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
|
|
37744
38455
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
|
|
38456
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_EXT;
|
|
38457
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
|
|
37745
38458
|
}
|
|
37746
38459
|
if (glFormat === _gl.RG_INTEGER) {
|
|
37747
38460
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI;
|
|
@@ -37768,6 +38481,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37768
38481
|
if (glType === _gl.INT) internalFormat = _gl.RGBA32I;
|
|
37769
38482
|
}
|
|
37770
38483
|
if (glFormat === _gl.RGB) {
|
|
38484
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_EXT;
|
|
38485
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
|
|
37771
38486
|
if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5;
|
|
37772
38487
|
if (glType === _gl.UNSIGNED_INT_10F_11F_11F_REV) internalFormat = _gl.R11F_G11F_B10F;
|
|
37773
38488
|
}
|
|
@@ -37776,6 +38491,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37776
38491
|
if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
|
|
37777
38492
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
|
|
37778
38493
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
38494
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_EXT;
|
|
38495
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
|
|
37779
38496
|
if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
|
|
37780
38497
|
if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
|
|
37781
38498
|
}
|
|
@@ -37824,6 +38541,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37824
38541
|
if (texture.isVideoTexture) {
|
|
37825
38542
|
_videoTextures.delete(texture);
|
|
37826
38543
|
}
|
|
38544
|
+
if (texture.isHTMLTexture) {
|
|
38545
|
+
_htmlTextures.delete(texture);
|
|
38546
|
+
}
|
|
37827
38547
|
}
|
|
37828
38548
|
function onRenderTargetDispose(event) {
|
|
37829
38549
|
const renderTarget = event.target;
|
|
@@ -37900,6 +38620,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
37900
38620
|
function resetTextureUnits() {
|
|
37901
38621
|
textureUnits = 0;
|
|
37902
38622
|
}
|
|
38623
|
+
function getTextureUnits() {
|
|
38624
|
+
return textureUnits;
|
|
38625
|
+
}
|
|
38626
|
+
function setTextureUnits(value2) {
|
|
38627
|
+
textureUnits = value2;
|
|
38628
|
+
}
|
|
37903
38629
|
function allocateTextureUnit() {
|
|
37904
38630
|
const textureUnit = textureUnits;
|
|
37905
38631
|
if (textureUnit >= capabilities.maxTextures) {
|
|
@@ -38082,10 +38808,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38082
38808
|
}
|
|
38083
38809
|
}
|
|
38084
38810
|
updateRanges.length = mergeIndex + 1;
|
|
38085
|
-
const currentUnpackRowLen =
|
|
38086
|
-
const currentUnpackSkipPixels =
|
|
38087
|
-
const currentUnpackSkipRows =
|
|
38088
|
-
|
|
38811
|
+
const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
38812
|
+
const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
38813
|
+
const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
38814
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
38089
38815
|
for (let i = 0, l = updateRanges.length; i < l; i++) {
|
|
38090
38816
|
const range = updateRanges[i];
|
|
38091
38817
|
const pixelStart = Math.floor(range.start / componentStride);
|
|
@@ -38094,14 +38820,14 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38094
38820
|
const y = Math.floor(pixelStart / image.width);
|
|
38095
38821
|
const width = pixelCount;
|
|
38096
38822
|
const height = 1;
|
|
38097
|
-
|
|
38098
|
-
|
|
38823
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x);
|
|
38824
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
|
|
38099
38825
|
state.texSubImage2D(_gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data);
|
|
38100
38826
|
}
|
|
38101
38827
|
texture.clearUpdateRanges();
|
|
38102
|
-
|
|
38103
|
-
|
|
38104
|
-
|
|
38828
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
38829
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
38830
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
38105
38831
|
}
|
|
38106
38832
|
}
|
|
38107
38833
|
function uploadTexture(textureProperties, texture, slot) {
|
|
@@ -38114,18 +38840,21 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38114
38840
|
const sourceProperties = properties.get(source);
|
|
38115
38841
|
if (source.version !== sourceProperties.__version || forceUpload === true) {
|
|
38116
38842
|
state.activeTexture(_gl.TEXTURE0 + slot);
|
|
38117
|
-
const
|
|
38118
|
-
|
|
38119
|
-
|
|
38120
|
-
|
|
38121
|
-
|
|
38122
|
-
|
|
38123
|
-
|
|
38843
|
+
const isImageBitmap = typeof ImageBitmap !== "undefined" && texture.image instanceof ImageBitmap;
|
|
38844
|
+
if (isImageBitmap === false) {
|
|
38845
|
+
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
38846
|
+
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
38847
|
+
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
38848
|
+
state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
38849
|
+
state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
38850
|
+
state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
38851
|
+
}
|
|
38852
|
+
state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
38124
38853
|
let image = resizeImage(texture.image, false, capabilities.maxTextureSize);
|
|
38125
38854
|
image = verifyColorSpace(texture, image);
|
|
38126
38855
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38127
38856
|
const glType = utils.convert(texture.type);
|
|
38128
|
-
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture);
|
|
38857
|
+
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture);
|
|
38129
38858
|
setTextureParameters(textureType, texture);
|
|
38130
38859
|
let mipmap;
|
|
38131
38860
|
const mipmaps = texture.mipmaps;
|
|
@@ -38287,6 +39016,35 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38287
39016
|
}
|
|
38288
39017
|
}
|
|
38289
39018
|
}
|
|
39019
|
+
} else if (texture.isHTMLTexture) {
|
|
39020
|
+
if ("texElementImage2D" in _gl) {
|
|
39021
|
+
const canvas = _gl.canvas;
|
|
39022
|
+
if (!canvas.hasAttribute("layoutsubtree")) {
|
|
39023
|
+
canvas.setAttribute("layoutsubtree", "true");
|
|
39024
|
+
}
|
|
39025
|
+
if (image.parentNode !== canvas) {
|
|
39026
|
+
canvas.appendChild(image);
|
|
39027
|
+
_htmlTextures.add(texture);
|
|
39028
|
+
canvas.onpaint = (event) => {
|
|
39029
|
+
const changed = event.changedElements;
|
|
39030
|
+
for (const t of _htmlTextures) {
|
|
39031
|
+
if (changed.includes(t.image)) {
|
|
39032
|
+
t.needsUpdate = true;
|
|
39033
|
+
}
|
|
39034
|
+
}
|
|
39035
|
+
};
|
|
39036
|
+
canvas.requestPaint();
|
|
39037
|
+
return;
|
|
39038
|
+
}
|
|
39039
|
+
const level = 0;
|
|
39040
|
+
const internalFormat = _gl.RGBA;
|
|
39041
|
+
const srcFormat = _gl.RGBA;
|
|
39042
|
+
const srcType = _gl.UNSIGNED_BYTE;
|
|
39043
|
+
_gl.texElementImage2D(_gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image);
|
|
39044
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR);
|
|
39045
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
|
|
39046
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
|
|
39047
|
+
}
|
|
38290
39048
|
} else {
|
|
38291
39049
|
if (mipmaps.length > 0) {
|
|
38292
39050
|
if (useTexStorage && allocateMemory) {
|
|
@@ -38337,10 +39095,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38337
39095
|
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
38338
39096
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
38339
39097
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
38340
|
-
|
|
38341
|
-
|
|
38342
|
-
|
|
38343
|
-
|
|
39098
|
+
state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
39099
|
+
state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
39100
|
+
state.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
39101
|
+
state.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
38344
39102
|
const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;
|
|
38345
39103
|
const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
|
|
38346
39104
|
const cubeImage = [];
|
|
@@ -38352,7 +39110,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38352
39110
|
}
|
|
38353
39111
|
cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);
|
|
38354
39112
|
}
|
|
38355
|
-
const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
39113
|
+
const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38356
39114
|
const useTexStorage = texture.isVideoTexture !== true;
|
|
38357
39115
|
const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true;
|
|
38358
39116
|
const dataReady = source.dataReady;
|
|
@@ -38449,7 +39207,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38449
39207
|
function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) {
|
|
38450
39208
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38451
39209
|
const glType = utils.convert(texture.type);
|
|
38452
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
39210
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38453
39211
|
const renderTargetProperties = properties.get(renderTarget);
|
|
38454
39212
|
const textureProperties = properties.get(texture);
|
|
38455
39213
|
textureProperties.__renderTarget = renderTarget;
|
|
@@ -38491,7 +39249,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38491
39249
|
const texture = textures[i];
|
|
38492
39250
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38493
39251
|
const glType = utils.convert(texture.type);
|
|
38494
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
39252
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38495
39253
|
if (useMultisampledRTT(renderTarget)) {
|
|
38496
39254
|
multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, getRenderTargetSamples(renderTarget), glInternalFormat, renderTarget.width, renderTarget.height);
|
|
38497
39255
|
} else if (useMultisample) {
|
|
@@ -38691,7 +39449,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38691
39449
|
_gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
|
|
38692
39450
|
const glFormat = utils.convert(texture2.format, texture2.colorSpace);
|
|
38693
39451
|
const glType = utils.convert(texture2.type);
|
|
38694
|
-
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
|
|
39452
|
+
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.normalized, texture2.colorSpace, renderTarget.isXRRenderTarget === true);
|
|
38695
39453
|
const samples = getRenderTargetSamples(renderTarget);
|
|
38696
39454
|
_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
|
|
38697
39455
|
_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]);
|
|
@@ -38887,6 +39645,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
38887
39645
|
}
|
|
38888
39646
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
38889
39647
|
this.resetTextureUnits = resetTextureUnits;
|
|
39648
|
+
this.getTextureUnits = getTextureUnits;
|
|
39649
|
+
this.setTextureUnits = setTextureUnits;
|
|
38890
39650
|
this.setTexture2D = setTexture2D;
|
|
38891
39651
|
this.setTexture2DArray = setTexture2DArray;
|
|
38892
39652
|
this.setTexture3D = setTexture3D;
|
|
@@ -39607,8 +40367,9 @@ var WebXRManager = class extends EventDispatcher {
|
|
|
39607
40367
|
};
|
|
39608
40368
|
}
|
|
39609
40369
|
};
|
|
39610
|
-
var _e1 = /* @__PURE__ */ new Euler();
|
|
39611
40370
|
var _m12 = /* @__PURE__ */ new Matrix4();
|
|
40371
|
+
var _m = /* @__PURE__ */ new Matrix3();
|
|
40372
|
+
_m.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
39612
40373
|
function WebGLMaterials(renderer, properties) {
|
|
39613
40374
|
function refreshTransformUniform(map, uniform) {
|
|
39614
40375
|
if (map.matrixAutoUpdate === true) {
|
|
@@ -39626,7 +40387,9 @@ function WebGLMaterials(renderer, properties) {
|
|
|
39626
40387
|
}
|
|
39627
40388
|
}
|
|
39628
40389
|
function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
|
|
39629
|
-
if (material.
|
|
40390
|
+
if (material.isNodeMaterial) {
|
|
40391
|
+
material.uniformsNeedUpdate = false;
|
|
40392
|
+
} else if (material.isMeshBasicMaterial) {
|
|
39630
40393
|
refreshUniformsCommon(uniforms, material);
|
|
39631
40394
|
} else if (material.isMeshLambertMaterial) {
|
|
39632
40395
|
refreshUniformsCommon(uniforms, material);
|
|
@@ -39728,16 +40491,10 @@ function WebGLMaterials(renderer, properties) {
|
|
|
39728
40491
|
const envMapRotation = materialProperties.envMapRotation;
|
|
39729
40492
|
if (envMap) {
|
|
39730
40493
|
uniforms.envMap.value = envMap;
|
|
39731
|
-
|
|
39732
|
-
_e1.x *= -1;
|
|
39733
|
-
_e1.y *= -1;
|
|
39734
|
-
_e1.z *= -1;
|
|
40494
|
+
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(envMapRotation)).transpose();
|
|
39735
40495
|
if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) {
|
|
39736
|
-
|
|
39737
|
-
_e1.z *= -1;
|
|
40496
|
+
uniforms.envMapRotation.value.premultiply(_m);
|
|
39738
40497
|
}
|
|
39739
|
-
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(_e1));
|
|
39740
|
-
uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
|
|
39741
40498
|
uniforms.reflectivity.value = material.reflectivity;
|
|
39742
40499
|
uniforms.ior.value = material.ior;
|
|
39743
40500
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
@@ -40003,6 +40760,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40003
40760
|
uniform.__data[9] = value2.elements[7];
|
|
40004
40761
|
uniform.__data[10] = value2.elements[8];
|
|
40005
40762
|
uniform.__data[11] = 0;
|
|
40763
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
40764
|
+
uniform.__data.set(new value2.constructor(value2.buffer, value2.byteOffset, uniform.__data.length));
|
|
40006
40765
|
} else {
|
|
40007
40766
|
value2.toArray(uniform.__data, arrayOffset);
|
|
40008
40767
|
arrayOffset += info3.storage / Float32Array.BYTES_PER_ELEMENT;
|
|
@@ -40020,6 +40779,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40020
40779
|
if (cache[indexString] === void 0) {
|
|
40021
40780
|
if (typeof value2 === "number" || typeof value2 === "boolean") {
|
|
40022
40781
|
cache[indexString] = value2;
|
|
40782
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
40783
|
+
cache[indexString] = value2.slice();
|
|
40023
40784
|
} else {
|
|
40024
40785
|
cache[indexString] = value2.clone();
|
|
40025
40786
|
}
|
|
@@ -40031,6 +40792,8 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40031
40792
|
cache[indexString] = value2;
|
|
40032
40793
|
return true;
|
|
40033
40794
|
}
|
|
40795
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
40796
|
+
return true;
|
|
40034
40797
|
} else {
|
|
40035
40798
|
if (cachedObject.equals(value2) === false) {
|
|
40036
40799
|
cachedObject.copy(value2);
|
|
@@ -40098,6 +40861,9 @@ function WebGLUniformsGroups(gl, info2, capabilities, state) {
|
|
|
40098
40861
|
info3.storage = 64;
|
|
40099
40862
|
} else if (value2.isTexture) {
|
|
40100
40863
|
warn2("WebGLRenderer: Texture samplers can not be part of an uniforms group.");
|
|
40864
|
+
} else if (ArrayBuffer.isView(value2)) {
|
|
40865
|
+
info3.boundary = 16;
|
|
40866
|
+
info3.storage = value2.byteLength;
|
|
40101
40867
|
} else {
|
|
40102
40868
|
warn2("WebGLRenderer: Unsupported uniform value type.", value2);
|
|
40103
40869
|
}
|
|
@@ -40701,6 +41467,7 @@ var WebGLRenderer = class {
|
|
|
40701
41467
|
]);
|
|
40702
41468
|
const uintClearColor = new Uint32Array(4);
|
|
40703
41469
|
const intClearColor = new Int32Array(4);
|
|
41470
|
+
const objectPosition = new Vector3();
|
|
40704
41471
|
let currentRenderList = null;
|
|
40705
41472
|
let currentRenderState = null;
|
|
40706
41473
|
const renderListStack = [];
|
|
@@ -40731,6 +41498,7 @@ var WebGLRenderer = class {
|
|
|
40731
41498
|
this.transmissionResolutionScale = 1;
|
|
40732
41499
|
const _this = this;
|
|
40733
41500
|
let _isContextLost = false;
|
|
41501
|
+
let _nodesHandler = null;
|
|
40734
41502
|
this._outputColorSpace = SRGBColorSpace;
|
|
40735
41503
|
let _currentActiveCubeFace = 0;
|
|
40736
41504
|
let _currentActiveMipmapLevel = 0;
|
|
@@ -40899,13 +41667,13 @@ var WebGLRenderer = class {
|
|
|
40899
41667
|
};
|
|
40900
41668
|
this.setEffects = function(effects) {
|
|
40901
41669
|
if (_outputBufferType === UnsignedByteType) {
|
|
40902
|
-
|
|
41670
|
+
error2("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
|
|
40903
41671
|
return;
|
|
40904
41672
|
}
|
|
40905
41673
|
if (effects) {
|
|
40906
41674
|
for (let i = 0; i < effects.length; i++) {
|
|
40907
41675
|
if (effects[i].isOutputPass === true) {
|
|
40908
|
-
|
|
41676
|
+
warn2("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
|
|
40909
41677
|
break;
|
|
40910
41678
|
}
|
|
40911
41679
|
}
|
|
@@ -40996,6 +41764,7 @@ var WebGLRenderer = class {
|
|
|
40996
41764
|
}
|
|
40997
41765
|
if (depth2) {
|
|
40998
41766
|
bits2 |= _gl.DEPTH_BUFFER_BIT;
|
|
41767
|
+
this.state.buffers.depth.setMask(true);
|
|
40999
41768
|
}
|
|
41000
41769
|
if (stencil2) {
|
|
41001
41770
|
bits2 |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -41014,6 +41783,10 @@ var WebGLRenderer = class {
|
|
|
41014
41783
|
this.clearStencil = function() {
|
|
41015
41784
|
this.clear(false, false, true);
|
|
41016
41785
|
};
|
|
41786
|
+
this.setNodesHandler = function(nodesHandler) {
|
|
41787
|
+
nodesHandler.setRenderer(this);
|
|
41788
|
+
_nodesHandler = nodesHandler;
|
|
41789
|
+
};
|
|
41017
41790
|
this.dispose = function() {
|
|
41018
41791
|
canvas.removeEventListener("webglcontextlost", onContextLost, false);
|
|
41019
41792
|
canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
|
|
@@ -41136,23 +41909,18 @@ var WebGLRenderer = class {
|
|
|
41136
41909
|
renderer.setMode(_gl.TRIANGLES);
|
|
41137
41910
|
}
|
|
41138
41911
|
if (object.isBatchedMesh) {
|
|
41139
|
-
if (
|
|
41140
|
-
|
|
41141
|
-
|
|
41142
|
-
|
|
41143
|
-
|
|
41144
|
-
|
|
41145
|
-
|
|
41146
|
-
|
|
41147
|
-
|
|
41148
|
-
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
41149
|
-
for (let i = 0; i < drawCount2; i++) {
|
|
41150
|
-
uniforms.setValue(_gl, "_gl_DrawID", i);
|
|
41151
|
-
renderer.render(starts[i] / bytesPerElement, counts[i]);
|
|
41152
|
-
}
|
|
41153
|
-
} else {
|
|
41154
|
-
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
41912
|
+
if (!extensions.get("WEBGL_multi_draw")) {
|
|
41913
|
+
const starts = object._multiDrawStarts;
|
|
41914
|
+
const counts = object._multiDrawCounts;
|
|
41915
|
+
const drawCount2 = object._multiDrawCount;
|
|
41916
|
+
const bytesPerElement = index ? attributes2.get(index).bytesPerElement : 1;
|
|
41917
|
+
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
41918
|
+
for (let i = 0; i < drawCount2; i++) {
|
|
41919
|
+
uniforms.setValue(_gl, "_gl_DrawID", i);
|
|
41920
|
+
renderer.render(starts[i] / bytesPerElement, counts[i]);
|
|
41155
41921
|
}
|
|
41922
|
+
} else {
|
|
41923
|
+
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
41156
41924
|
}
|
|
41157
41925
|
} else if (object.isInstancedMesh) {
|
|
41158
41926
|
renderer.renderInstances(drawStart, drawCount, object.count);
|
|
@@ -41273,6 +42041,9 @@ var WebGLRenderer = class {
|
|
|
41273
42041
|
return;
|
|
41274
42042
|
}
|
|
41275
42043
|
if (_isContextLost === true) return;
|
|
42044
|
+
if (_nodesHandler !== null) {
|
|
42045
|
+
_nodesHandler.renderStart(scene, camera);
|
|
42046
|
+
}
|
|
41276
42047
|
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
41277
42048
|
const useOutput = output !== null && (_currentRenderTarget === null || isXRPresenting) && output.begin(_this, _currentRenderTarget);
|
|
41278
42049
|
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
@@ -41284,6 +42055,7 @@ var WebGLRenderer = class {
|
|
|
41284
42055
|
if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
|
|
41285
42056
|
currentRenderState = renderStates.get(scene, renderStateStack.length);
|
|
41286
42057
|
currentRenderState.init(camera);
|
|
42058
|
+
currentRenderState.state.textureUnits = textures.getTextureUnits();
|
|
41287
42059
|
renderStateStack.push(currentRenderState);
|
|
41288
42060
|
_projScreenMatrix3.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
41289
42061
|
_frustum.setFromProjectionMatrix(_projScreenMatrix3, WebGLCoordinateSystem, camera.reversedDepth);
|
|
@@ -41351,6 +42123,7 @@ var WebGLRenderer = class {
|
|
|
41351
42123
|
renderStateStack.pop();
|
|
41352
42124
|
if (renderStateStack.length > 0) {
|
|
41353
42125
|
currentRenderState = renderStateStack[renderStateStack.length - 1];
|
|
42126
|
+
textures.setTextureUnits(currentRenderState.state.textureUnits);
|
|
41354
42127
|
if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera);
|
|
41355
42128
|
} else {
|
|
41356
42129
|
currentRenderState = null;
|
|
@@ -41361,6 +42134,9 @@ var WebGLRenderer = class {
|
|
|
41361
42134
|
} else {
|
|
41362
42135
|
currentRenderList = null;
|
|
41363
42136
|
}
|
|
42137
|
+
if (_nodesHandler !== null) {
|
|
42138
|
+
_nodesHandler.renderEnd();
|
|
42139
|
+
}
|
|
41364
42140
|
};
|
|
41365
42141
|
function projectObject(object, camera, groupOrder, sortObjects) {
|
|
41366
42142
|
if (object.visible === false) return;
|
|
@@ -41370,6 +42146,8 @@ var WebGLRenderer = class {
|
|
|
41370
42146
|
groupOrder = object.renderOrder;
|
|
41371
42147
|
} else if (object.isLOD) {
|
|
41372
42148
|
if (object.autoUpdate === true) object.update(camera);
|
|
42149
|
+
} else if (object.isLightProbeGrid) {
|
|
42150
|
+
currentRenderState.pushLightProbeGrid(object);
|
|
41373
42151
|
} else if (object.isLight) {
|
|
41374
42152
|
currentRenderState.pushLight(object);
|
|
41375
42153
|
if (object.castShadow) {
|
|
@@ -41536,7 +42314,7 @@ var WebGLRenderer = class {
|
|
|
41536
42314
|
const lights = currentRenderState.state.lights;
|
|
41537
42315
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
41538
42316
|
const lightsStateVersion = lights.state.version;
|
|
41539
|
-
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
|
|
42317
|
+
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray);
|
|
41540
42318
|
const programCacheKey = programCache.getProgramCacheKey(parameters2);
|
|
41541
42319
|
let programs = materialProperties.programs;
|
|
41542
42320
|
materialProperties.environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -41557,6 +42335,9 @@ var WebGLRenderer = class {
|
|
|
41557
42335
|
}
|
|
41558
42336
|
} else {
|
|
41559
42337
|
parameters2.uniforms = programCache.getUniforms(material);
|
|
42338
|
+
if (_nodesHandler !== null && material.isNodeMaterial) {
|
|
42339
|
+
_nodesHandler.build(material, object, parameters2);
|
|
42340
|
+
}
|
|
41560
42341
|
material.onBeforeCompile(parameters2, _this);
|
|
41561
42342
|
program = programCache.acquireProgram(parameters2, programCacheKey);
|
|
41562
42343
|
programs.set(programCacheKey, program);
|
|
@@ -41587,6 +42368,7 @@ var WebGLRenderer = class {
|
|
|
41587
42368
|
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
41588
42369
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
|
|
41589
42370
|
}
|
|
42371
|
+
materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
|
|
41590
42372
|
materialProperties.currentProgram = program;
|
|
41591
42373
|
materialProperties.uniformsList = null;
|
|
41592
42374
|
return program;
|
|
@@ -41617,12 +42399,24 @@ var WebGLRenderer = class {
|
|
|
41617
42399
|
materialProperties.vertexTangents = parameters2.vertexTangents;
|
|
41618
42400
|
materialProperties.toneMapping = parameters2.toneMapping;
|
|
41619
42401
|
}
|
|
42402
|
+
function findLightProbeGrid(volumes, object) {
|
|
42403
|
+
if (volumes.length === 0) return null;
|
|
42404
|
+
if (volumes.length === 1) {
|
|
42405
|
+
return volumes[0].texture !== null ? volumes[0] : null;
|
|
42406
|
+
}
|
|
42407
|
+
objectPosition.setFromMatrixPosition(object.matrixWorld);
|
|
42408
|
+
for (let i = 0, l = volumes.length; i < l; i++) {
|
|
42409
|
+
const v = volumes[i];
|
|
42410
|
+
if (v.texture !== null && v.boundingBox.containsPoint(objectPosition)) return v;
|
|
42411
|
+
}
|
|
42412
|
+
return null;
|
|
42413
|
+
}
|
|
41620
42414
|
function setProgram(camera, scene, geometry, material, object) {
|
|
41621
42415
|
if (scene.isScene !== true) scene = _emptyScene;
|
|
41622
42416
|
textures.resetTextureUnits();
|
|
41623
42417
|
const fog = scene.fog;
|
|
41624
42418
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
41625
|
-
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace :
|
|
42419
|
+
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace;
|
|
41626
42420
|
const usePMREM = material.isMeshStandardMaterial || material.isMeshLambertMaterial && !material.envMap || material.isMeshPhongMaterial && !material.envMap;
|
|
41627
42421
|
const envMap = environments.get(material.envMap || environment, usePMREM);
|
|
41628
42422
|
const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
@@ -41696,6 +42490,8 @@ var WebGLRenderer = class {
|
|
|
41696
42490
|
needsProgramChange = true;
|
|
41697
42491
|
} else if (materialProperties.morphTargetsCount !== morphTargetsCount) {
|
|
41698
42492
|
needsProgramChange = true;
|
|
42493
|
+
} else if (!!materialProperties.lightProbeGrid !== currentRenderState.state.lightProbeGridArray.length > 0) {
|
|
42494
|
+
needsProgramChange = true;
|
|
41699
42495
|
}
|
|
41700
42496
|
} else {
|
|
41701
42497
|
needsProgramChange = true;
|
|
@@ -41704,6 +42500,9 @@ var WebGLRenderer = class {
|
|
|
41704
42500
|
let program = materialProperties.currentProgram;
|
|
41705
42501
|
if (needsProgramChange === true) {
|
|
41706
42502
|
program = getProgram(material, scene, object);
|
|
42503
|
+
if (_nodesHandler && material.isNodeMaterial) {
|
|
42504
|
+
_nodesHandler.onUpdateProgram(material, program, materialProperties);
|
|
42505
|
+
}
|
|
41707
42506
|
}
|
|
41708
42507
|
let refreshProgram = false;
|
|
41709
42508
|
let refreshMaterial = false;
|
|
@@ -41718,6 +42517,13 @@ var WebGLRenderer = class {
|
|
|
41718
42517
|
_currentMaterialId = material.id;
|
|
41719
42518
|
refreshMaterial = true;
|
|
41720
42519
|
}
|
|
42520
|
+
if (materialProperties.needsLights) {
|
|
42521
|
+
const objectVolume = findLightProbeGrid(currentRenderState.state.lightProbeGridArray, object);
|
|
42522
|
+
if (materialProperties.lightProbeGrid !== objectVolume) {
|
|
42523
|
+
materialProperties.lightProbeGrid = objectVolume;
|
|
42524
|
+
refreshMaterial = true;
|
|
42525
|
+
}
|
|
42526
|
+
}
|
|
41721
42527
|
if (refreshProgram || _currentCamera !== camera) {
|
|
41722
42528
|
const reversedDepthBuffer2 = state.buffers.depth.getReversed();
|
|
41723
42529
|
if (reversedDepthBuffer2 && camera.reversedDepth !== true) {
|
|
@@ -41799,6 +42605,13 @@ var WebGLRenderer = class {
|
|
|
41799
42605
|
materials.refreshFogUniforms(m_uniforms, fog);
|
|
41800
42606
|
}
|
|
41801
42607
|
materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]);
|
|
42608
|
+
if (materialProperties.needsLights && materialProperties.lightProbeGrid) {
|
|
42609
|
+
const volume = materialProperties.lightProbeGrid;
|
|
42610
|
+
m_uniforms.probesSH.value = volume.texture;
|
|
42611
|
+
m_uniforms.probesMin.value.copy(volume.boundingBox.min);
|
|
42612
|
+
m_uniforms.probesMax.value.copy(volume.boundingBox.max);
|
|
42613
|
+
m_uniforms.probesResolution.value.copy(volume.resolution);
|
|
42614
|
+
}
|
|
41802
42615
|
WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures);
|
|
41803
42616
|
}
|
|
41804
42617
|
if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
|
|
@@ -41811,7 +42624,7 @@ var WebGLRenderer = class {
|
|
|
41811
42624
|
p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix);
|
|
41812
42625
|
p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix);
|
|
41813
42626
|
p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld);
|
|
41814
|
-
if (material.
|
|
42627
|
+
if (material.uniformsGroups !== void 0) {
|
|
41815
42628
|
const groups = material.uniformsGroups;
|
|
41816
42629
|
for (let i = 0, l = groups.length; i < l; i++) {
|
|
41817
42630
|
const group2 = groups[i];
|
|
@@ -42080,19 +42893,20 @@ var WebGLRenderer = class {
|
|
|
42080
42893
|
textures.setTexture2D(dstTexture, 0);
|
|
42081
42894
|
glTarget = _gl.TEXTURE_2D;
|
|
42082
42895
|
}
|
|
42083
|
-
|
|
42084
|
-
|
|
42085
|
-
|
|
42086
|
-
|
|
42087
|
-
const
|
|
42088
|
-
const
|
|
42089
|
-
const
|
|
42090
|
-
const
|
|
42091
|
-
|
|
42092
|
-
|
|
42093
|
-
|
|
42094
|
-
|
|
42095
|
-
|
|
42896
|
+
state.activeTexture(_gl.TEXTURE0);
|
|
42897
|
+
state.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
|
|
42898
|
+
state.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
|
|
42899
|
+
state.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
|
|
42900
|
+
const currentUnpackRowLen = state.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
42901
|
+
const currentUnpackImageHeight = state.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
|
|
42902
|
+
const currentUnpackSkipPixels = state.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
42903
|
+
const currentUnpackSkipRows = state.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
42904
|
+
const currentUnpackSkipImages = state.getParameter(_gl.UNPACK_SKIP_IMAGES);
|
|
42905
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
42906
|
+
state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
|
|
42907
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
|
|
42908
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
|
|
42909
|
+
state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
|
|
42096
42910
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
42097
42911
|
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
|
|
42098
42912
|
if (srcTexture.isDepthTexture) {
|
|
@@ -42156,11 +42970,11 @@ var WebGLRenderer = class {
|
|
|
42156
42970
|
}
|
|
42157
42971
|
}
|
|
42158
42972
|
}
|
|
42159
|
-
|
|
42160
|
-
|
|
42161
|
-
|
|
42162
|
-
|
|
42163
|
-
|
|
42973
|
+
state.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
42974
|
+
state.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
|
|
42975
|
+
state.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
42976
|
+
state.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
42977
|
+
state.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
|
|
42164
42978
|
if (dstLevel === 0 && dstTexture.generateMipmaps) {
|
|
42165
42979
|
_gl.generateMipmap(glTarget);
|
|
42166
42980
|
}
|
|
@@ -42225,7 +43039,7 @@ var WebGLRenderer = class {
|
|
|
42225
43039
|
|
|
42226
43040
|
// ../../../node_modules/three/examples/jsm/controls/OrbitControls.js
|
|
42227
43041
|
init_console_gjs();
|
|
42228
|
-
|
|
43042
|
+
init_auto_globals_53fe98c6e6();
|
|
42229
43043
|
var _changeEvent = { type: "change" };
|
|
42230
43044
|
var _startEvent = { type: "start" };
|
|
42231
43045
|
var _endEvent = { type: "end" };
|
|
@@ -42367,7 +43181,7 @@ var OrbitControls = class extends Controls {
|
|
|
42367
43181
|
this.stopListenToKeyEvents();
|
|
42368
43182
|
const document3 = this.domElement.getRootNode();
|
|
42369
43183
|
document3.removeEventListener("keydown", this._interceptControlDown, { capture: true });
|
|
42370
|
-
this.domElement.style.touchAction = "
|
|
43184
|
+
this.domElement.style.touchAction = "";
|
|
42371
43185
|
}
|
|
42372
43186
|
dispose() {
|
|
42373
43187
|
this.disconnect();
|
|
@@ -43137,7 +43951,7 @@ function interceptControlUp(event) {
|
|
|
43137
43951
|
|
|
43138
43952
|
// ../../../node_modules/three/examples/jsm/geometries/TeapotGeometry.js
|
|
43139
43953
|
init_console_gjs();
|
|
43140
|
-
|
|
43954
|
+
init_auto_globals_53fe98c6e6();
|
|
43141
43955
|
var TeapotGeometry = class extends BufferGeometry {
|
|
43142
43956
|
/**
|
|
43143
43957
|
* Constructs a new teapot geometry.
|
|
@@ -46097,7 +46911,7 @@ start.__type = [() => __\u03A9HTMLCanvasElement, "canvas", () => __\u03A9StartOp
|
|
|
46097
46911
|
|
|
46098
46912
|
// blueprint:./teapot-window.blp
|
|
46099
46913
|
init_console_gjs();
|
|
46100
|
-
|
|
46914
|
+
init_auto_globals_53fe98c6e6();
|
|
46101
46915
|
var teapot_window_default = '<?xml version="1.0" encoding="UTF-8"?>\n<!--\nDO NOT EDIT!\nThis file was @generated by blueprint-compiler. Instead, edit the\ncorresponding .blp file and regenerate this file with blueprint-compiler.\n-->\n<interface>\n <requires lib="gtk" version="4.0"/>\n <template class="TeapotWindow" parent="AdwApplicationWindow">\n <property name="default-width">1100</property>\n <property name="default-height">700</property>\n <property name="title">Three.js Teapot</property>\n <child type="breakpoint">\n <object class="AdwBreakpoint">\n <condition>max-width: 799sp</condition>\n <setter object="splitView" property="collapsed">true</setter>\n <setter object="splitView" property="show-sidebar">false</setter>\n </object>\n </child>\n <child type="breakpoint">\n <object class="AdwBreakpoint">\n <condition>min-width: 800sp</condition>\n <setter object="splitView" property="collapsed">false</setter>\n <setter object="splitView" property="show-sidebar">true</setter>\n </object>\n </child>\n <property name="content">\n <object class="GtkBox">\n <property name="orientation">1</property>\n <child>\n <object class="AdwHeaderBar">\n <child type="start">\n <object class="GtkToggleButton" id="sidebarToggleButton">\n <property name="icon-name">sidebar-show-symbolic</property>\n <property name="tooltip-text">Toggle Sidebar</property>\n <property name="active" bind-source="splitView" bind-property="show-sidebar" bind-flags="sync-create"/>\n </object>\n </child>\n <child type="end">\n <object class="GtkButton" id="pauseButton">\n <property name="icon-name">media-playback-pause-symbolic</property>\n <property name="tooltip-text">Pause Rendering</property>\n </object>\n </child>\n </object>\n </child>\n <child>\n <object class="AdwOverlaySplitView" id="splitView">\n <property name="sidebar-width-fraction">0.3</property>\n <property name="min-sidebar-width">280</property>\n <property name="max-sidebar-width">400</property>\n <property name="show-sidebar" bind-source="sidebarToggleButton" bind-property="active" bind-flags="sync-create"/>\n <property name="sidebar">\n <object class="GtkScrolledWindow">\n <property name="hscrollbar-policy">2</property>\n <child>\n <object class="GtkBox">\n <property name="orientation">1</property>\n <property name="spacing">12</property>\n <property name="margin-top">12</property>\n <property name="margin-bottom">12</property>\n <property name="margin-start">12</property>\n <property name="margin-end">12</property>\n <child>\n <object class="AdwPreferencesGroup">\n <property name="title">Geometry</property>\n <child>\n <object class="AdwComboRow" id="tessRow">\n <property name="title">Tessellation Level</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="lidRow">\n <property name="title">Display Lid</property>\n <property name="active">true</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="bodyRow">\n <property name="title">Display Body</property>\n <property name="active">true</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="bottomRow">\n <property name="title">Display Bottom</property>\n <property name="active">true</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="fitLidRow">\n <property name="title">Snug Lid</property>\n <property name="active">false</property>\n </object>\n </child>\n <child>\n <object class="AdwSwitchRow" id="nonblinnRow">\n <property name="title">Original Scale</property>\n <property name="active">false</property>\n </object>\n </child>\n </object>\n </child>\n <child>\n <object class="AdwPreferencesGroup">\n <property name="title">Material</property>\n <child>\n <object class="AdwComboRow" id="shadingRow">\n <property name="title">Shading</property>\n </object>\n </child>\n </object>\n </child>\n </object>\n </child>\n </object>\n </property>\n <property name="content">\n <object class="GtkBox" id="glAreaContainer">\n <property name="hexpand">true</property>\n <property name="vexpand">true</property>\n </object>\n </property>\n </object>\n </child>\n </object>\n </property>\n </template>\n</interface>';
|
|
46102
46916
|
|
|
46103
46917
|
// src/gjs/teapot-window.ts
|