@deck.gl/geo-layers 9.3.0-alpha.5 → 9.3.0-beta.1
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/dist.dev.js +802 -283
- package/dist/index.cjs +35 -10
- package/dist/index.cjs.map +2 -2
- package/dist/mesh-layer/mesh-layer-fragment.glsl.d.ts +1 -1
- package/dist/mesh-layer/mesh-layer-fragment.glsl.js +1 -1
- package/dist/mesh-layer/mesh-layer-vertex.glsl.d.ts +1 -1
- package/dist/mesh-layer/mesh-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/mesh-layer/mesh-layer-vertex.glsl.js +4 -3
- package/dist/mesh-layer/mesh-layer-vertex.glsl.js.map +1 -1
- package/dist/tile-layer/tile-layer.d.ts +14 -0
- package/dist/tile-layer/tile-layer.d.ts.map +1 -1
- package/dist/tile-layer/tile-layer.js +18 -2
- package/dist/tile-layer/tile-layer.js.map +1 -1
- package/dist/tileset-2d/tileset-2d.d.ts +4 -0
- package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
- package/dist/tileset-2d/tileset-2d.js +8 -2
- package/dist/tileset-2d/tileset-2d.js.map +1 -1
- package/dist/tileset-2d/utils.d.ts +3 -1
- package/dist/tileset-2d/utils.d.ts.map +1 -1
- package/dist/tileset-2d/utils.js +11 -3
- package/dist/tileset-2d/utils.js.map +1 -1
- package/dist.min.js +299 -91
- package/package.json +17 -17
- package/src/mesh-layer/mesh-layer-fragment.glsl.ts +1 -1
- package/src/mesh-layer/mesh-layer-vertex.glsl.ts +4 -3
- package/src/tile-layer/tile-layer.ts +37 -2
- package/src/tileset-2d/tileset-2d.ts +12 -3
- package/src/tileset-2d/utils.ts +16 -3
package/dist/dist.dev.js
CHANGED
|
@@ -2878,6 +2878,8 @@ var __exports__ = (() => {
|
|
|
2878
2878
|
var distanceToVertex = 3 - Math.sqrt(5);
|
|
2879
2879
|
var Rmidedge = Math.sqrt(3 - \u03C6);
|
|
2880
2880
|
var Rcircumscribed = Math.sqrt(3) * Rmidedge / \u03C6;
|
|
2881
|
+
var AUTHALIC_RADIUS_EARTH = 63710072e-1;
|
|
2882
|
+
var AUTHALIC_AREA_EARTH = 4 * Math.PI * AUTHALIC_RADIUS_EARTH * AUTHALIC_RADIUS_EARTH;
|
|
2881
2883
|
common_exports.setMatrixArrayType(Float64Array);
|
|
2882
2884
|
var PentagonShape = class _PentagonShape {
|
|
2883
2885
|
constructor(vertices) {
|
|
@@ -3579,12 +3581,13 @@ var __exports__ = (() => {
|
|
|
3579
3581
|
}
|
|
3580
3582
|
}
|
|
3581
3583
|
};
|
|
3582
|
-
common_exports.setMatrixArrayType(Float64Array);
|
|
3583
3584
|
var YES = -1;
|
|
3584
3585
|
var NO = 1;
|
|
3586
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
3585
3587
|
var KJToIJ = ([k, j]) => {
|
|
3586
3588
|
return vec2_exports.fromValues(k - j, j);
|
|
3587
3589
|
};
|
|
3590
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
3588
3591
|
var kPos = vec2_exports.fromValues(1, 0);
|
|
3589
3592
|
var jPos = vec2_exports.fromValues(0, 1);
|
|
3590
3593
|
var kNeg = vec2_exports.negate(vec2_exports.create(), kPos);
|
|
@@ -3622,7 +3625,6 @@ var __exports__ = (() => {
|
|
|
3622
3625
|
var quaternaryToFlips = (n) => {
|
|
3623
3626
|
return [[NO, NO], [NO, YES], [NO, NO], [YES, NO]][n];
|
|
3624
3627
|
};
|
|
3625
|
-
var FLIP_SHIFT = vec2_exports.fromValues(-1, 1);
|
|
3626
3628
|
function reversePattern(pattern) {
|
|
3627
3629
|
return Array.from({ length: pattern.length }, (_, i) => pattern.indexOf(i));
|
|
3628
3630
|
}
|
|
@@ -3630,7 +3632,7 @@ var __exports__ = (() => {
|
|
|
3630
3632
|
var PATTERN_FLIPPED = [0, 1, 2, 7, 3, 4, 5, 6];
|
|
3631
3633
|
var PATTERN_REVERSED = reversePattern(PATTERN);
|
|
3632
3634
|
var PATTERN_FLIPPED_REVERSED = reversePattern(PATTERN_FLIPPED);
|
|
3633
|
-
var
|
|
3635
|
+
var shiftDigits = (digits, i, flips, invertJ, pattern) => {
|
|
3634
3636
|
if (i <= 0)
|
|
3635
3637
|
return;
|
|
3636
3638
|
const parentK = digits[i] || 0;
|
|
@@ -3652,7 +3654,10 @@ var __exports__ = (() => {
|
|
|
3652
3654
|
digits[i - 1] = dst % 4;
|
|
3653
3655
|
digits[i] = (parentK + 4 + Math.floor(dst / 4) - Math.floor(src / 4)) % 4;
|
|
3654
3656
|
};
|
|
3655
|
-
|
|
3657
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
3658
|
+
var FLIP_SHIFT = vec2_exports.fromValues(-1, 1);
|
|
3659
|
+
var SHIFTDIGITS = true;
|
|
3660
|
+
var sToAnchor = (s, resolution, orientation, doShiftDigits = SHIFTDIGITS) => {
|
|
3656
3661
|
let input = BigInt(s);
|
|
3657
3662
|
const reverse = orientation === "vu" || orientation === "wu" || orientation === "vw";
|
|
3658
3663
|
const invertJ = orientation === "wv" || orientation === "vw";
|
|
@@ -3660,7 +3665,7 @@ var __exports__ = (() => {
|
|
|
3660
3665
|
if (reverse) {
|
|
3661
3666
|
input = (1n << BigInt(2 * resolution)) - input - 1n;
|
|
3662
3667
|
}
|
|
3663
|
-
const anchor = _sToAnchor(input, resolution, invertJ, flipIJ);
|
|
3668
|
+
const anchor = _sToAnchor(input, resolution, invertJ, flipIJ, doShiftDigits);
|
|
3664
3669
|
if (flipIJ) {
|
|
3665
3670
|
const { offset: [_i, _j], flips: [flipX, flipY] } = anchor;
|
|
3666
3671
|
anchor.offset = [_j, _i];
|
|
@@ -3678,7 +3683,7 @@ var __exports__ = (() => {
|
|
|
3678
3683
|
}
|
|
3679
3684
|
return anchor;
|
|
3680
3685
|
};
|
|
3681
|
-
var _sToAnchor = (s, resolution, invertJ, flipIJ) => {
|
|
3686
|
+
var _sToAnchor = (s, resolution, invertJ, flipIJ, doShiftDigits = SHIFTDIGITS) => {
|
|
3682
3687
|
const offset = vec2_exports.create();
|
|
3683
3688
|
const flips = [NO, NO];
|
|
3684
3689
|
let input = BigInt(s);
|
|
@@ -3689,7 +3694,9 @@ var __exports__ = (() => {
|
|
|
3689
3694
|
}
|
|
3690
3695
|
const pattern = flipIJ ? PATTERN_FLIPPED : PATTERN;
|
|
3691
3696
|
for (let i = digits.length - 1; i >= 0; i--) {
|
|
3692
|
-
|
|
3697
|
+
if (doShiftDigits) {
|
|
3698
|
+
shiftDigits(digits, i, flips, invertJ, pattern);
|
|
3699
|
+
}
|
|
3693
3700
|
vec2_exports.multiply(flips, flips, quaternaryToFlips(digits[i]));
|
|
3694
3701
|
}
|
|
3695
3702
|
flips[0] = NO;
|
|
@@ -3700,9 +3707,16 @@ var __exports__ = (() => {
|
|
|
3700
3707
|
vec2_exports.add(offset, offset, childOffset);
|
|
3701
3708
|
vec2_exports.multiply(flips, flips, quaternaryToFlips(digits[i]));
|
|
3702
3709
|
}
|
|
3703
|
-
const
|
|
3704
|
-
return {
|
|
3710
|
+
const q = digits[0] || 0;
|
|
3711
|
+
return { q, offset: KJToIJ(offset), flips };
|
|
3705
3712
|
};
|
|
3713
|
+
var PROBE_R = 0.1;
|
|
3714
|
+
var PROBE_OFFSETS = [
|
|
3715
|
+
[PROBE_R * Math.cos(45 * Math.PI / 180), PROBE_R * Math.sin(45 * Math.PI / 180)],
|
|
3716
|
+
[PROBE_R * Math.cos(113 * Math.PI / 180), PROBE_R * Math.sin(113 * Math.PI / 180)],
|
|
3717
|
+
[PROBE_R * Math.cos(293 * Math.PI / 180), PROBE_R * Math.sin(293 * Math.PI / 180)],
|
|
3718
|
+
[PROBE_R * Math.cos(225 * Math.PI / 180), PROBE_R * Math.sin(225 * Math.PI / 180)]
|
|
3719
|
+
];
|
|
3706
3720
|
common_exports.setMatrixArrayType(Float64Array);
|
|
3707
3721
|
var TRIANGLE_MODE = false;
|
|
3708
3722
|
var shiftRight = vec2_exports.clone(w);
|
|
@@ -3719,12 +3733,12 @@ var __exports__ = (() => {
|
|
|
3719
3733
|
if (anchor.flips[0] === NO && anchor.flips[1] === YES) {
|
|
3720
3734
|
pentagon.rotate180();
|
|
3721
3735
|
}
|
|
3722
|
-
const {
|
|
3736
|
+
const { q } = anchor;
|
|
3723
3737
|
const F2 = anchor.flips[0] + anchor.flips[1];
|
|
3724
3738
|
if (
|
|
3725
3739
|
// Orient last two pentagons when both or neither flips are YES
|
|
3726
|
-
(F2 === -2 || F2 === 2) &&
|
|
3727
|
-
F2 === 0 && (
|
|
3740
|
+
(F2 === -2 || F2 === 2) && q > 1 || // Orient first & last pentagons when only one of flips is YES
|
|
3741
|
+
F2 === 0 && (q === 0 || q === 3)
|
|
3728
3742
|
) {
|
|
3729
3743
|
pentagon.reflectY();
|
|
3730
3744
|
}
|
|
@@ -3958,13 +3972,40 @@ var __exports__ = (() => {
|
|
|
3958
3972
|
var FIRST_HILBERT_RESOLUTION = 2;
|
|
3959
3973
|
var MAX_RESOLUTION = 30;
|
|
3960
3974
|
var HILBERT_START_BIT = 58n;
|
|
3961
|
-
var
|
|
3975
|
+
var WORLD_CELL = 0n;
|
|
3962
3976
|
function getResolution(index) {
|
|
3977
|
+
if (index === 0n)
|
|
3978
|
+
return -1;
|
|
3979
|
+
if (index & 1n || (index & 0b111n) === 0b100n || (index & 0b11111n) === 0b10000n)
|
|
3980
|
+
return MAX_RESOLUTION;
|
|
3963
3981
|
let resolution = MAX_RESOLUTION - 1;
|
|
3964
3982
|
let shifted = index >> 1n;
|
|
3965
|
-
|
|
3983
|
+
if (shifted === 0n)
|
|
3984
|
+
return -1;
|
|
3985
|
+
let low32 = Number(shifted & 0xFFFFFFFFn);
|
|
3986
|
+
let remaining;
|
|
3987
|
+
if (low32 === 0) {
|
|
3988
|
+
shifted >>= 32n;
|
|
3989
|
+
resolution -= 16;
|
|
3990
|
+
remaining = Number(shifted);
|
|
3991
|
+
} else {
|
|
3992
|
+
remaining = low32;
|
|
3993
|
+
}
|
|
3994
|
+
if ((remaining & 65535) === 0) {
|
|
3995
|
+
remaining >>= 16;
|
|
3996
|
+
resolution -= 8;
|
|
3997
|
+
}
|
|
3998
|
+
if (resolution >= 6 && (remaining & 255) === 0) {
|
|
3999
|
+
remaining >>= 8;
|
|
4000
|
+
resolution -= 4;
|
|
4001
|
+
}
|
|
4002
|
+
if (resolution >= 4 && (remaining & 15) === 0) {
|
|
4003
|
+
remaining >>= 4;
|
|
4004
|
+
resolution -= 2;
|
|
4005
|
+
}
|
|
4006
|
+
while (resolution > -1 && (remaining & 1) === 0) {
|
|
3966
4007
|
resolution -= 1;
|
|
3967
|
-
|
|
4008
|
+
remaining = remaining >> (resolution < FIRST_HILBERT_RESOLUTION ? 1 : 2);
|
|
3968
4009
|
}
|
|
3969
4010
|
return resolution;
|
|
3970
4011
|
}
|
|
@@ -3973,27 +4014,33 @@ var __exports__ = (() => {
|
|
|
3973
4014
|
if (resolution === -1) {
|
|
3974
4015
|
return { origin: origins[0], segment: 0, S: 0n, resolution };
|
|
3975
4016
|
}
|
|
3976
|
-
|
|
4017
|
+
let quintantShift = HILBERT_START_BIT;
|
|
4018
|
+
let quintantOffset = 0;
|
|
4019
|
+
if (resolution === MAX_RESOLUTION) {
|
|
4020
|
+
const markerBits = index & 1n ? 1n : index & 0b100n ? 3n : 5n;
|
|
4021
|
+
quintantShift = HILBERT_START_BIT + markerBits;
|
|
4022
|
+
quintantOffset = markerBits === 1n ? 0 : markerBits === 3n ? 32 : 40;
|
|
4023
|
+
}
|
|
4024
|
+
const topBits = Number(index >> quintantShift) + quintantOffset;
|
|
3977
4025
|
let origin, segment;
|
|
3978
4026
|
if (resolution === 0) {
|
|
3979
|
-
|
|
3980
|
-
origin = origins[originId2];
|
|
4027
|
+
origin = origins[topBits];
|
|
3981
4028
|
segment = 0;
|
|
3982
4029
|
} else {
|
|
3983
|
-
const originId2 = Math.floor(
|
|
4030
|
+
const originId2 = Math.floor(topBits / 5);
|
|
3984
4031
|
origin = origins[originId2];
|
|
3985
|
-
segment = (
|
|
4032
|
+
segment = (topBits + origin.firstQuintant) % 5;
|
|
3986
4033
|
}
|
|
3987
4034
|
if (!origin) {
|
|
3988
|
-
throw new Error(`Could not parse origin: ${
|
|
4035
|
+
throw new Error(`Could not parse origin: ${topBits}`);
|
|
3989
4036
|
}
|
|
3990
4037
|
if (resolution < FIRST_HILBERT_RESOLUTION) {
|
|
3991
4038
|
return { origin, segment, S: 0n, resolution };
|
|
3992
4039
|
}
|
|
3993
4040
|
const hilbertLevels = resolution - FIRST_HILBERT_RESOLUTION + 1;
|
|
3994
4041
|
const hilbertBits = BigInt(2 * hilbertLevels);
|
|
3995
|
-
const
|
|
3996
|
-
const S = (index &
|
|
4042
|
+
const removalMask = (1n << quintantShift) - 1n;
|
|
4043
|
+
const S = (index & removalMask) >> quintantShift - hilbertBits;
|
|
3997
4044
|
return { origin, segment, S, resolution };
|
|
3998
4045
|
}
|
|
3999
4046
|
common_exports.setMatrixArrayType(Float64Array);
|
|
@@ -4012,6 +4059,9 @@ var __exports__ = (() => {
|
|
|
4012
4059
|
return getPentagonVertices(hilbertResolution, quintant, anchor);
|
|
4013
4060
|
}
|
|
4014
4061
|
function cellToBoundary(cellId, { closedRing = true, segments = "auto" } = { closedRing: true, segments: "auto" }) {
|
|
4062
|
+
if (cellId === WORLD_CELL) {
|
|
4063
|
+
return [];
|
|
4064
|
+
}
|
|
4015
4065
|
const { S, segment, origin, resolution } = deserialize(cellId);
|
|
4016
4066
|
if (segments === "auto") {
|
|
4017
4067
|
segments = Math.max(1, Math.pow(2, 6 - resolution));
|
|
@@ -4031,8 +4081,13 @@ var __exports__ = (() => {
|
|
|
4031
4081
|
function hexToU64(hex) {
|
|
4032
4082
|
return BigInt(`0x${hex}`);
|
|
4033
4083
|
}
|
|
4034
|
-
var
|
|
4035
|
-
var
|
|
4084
|
+
var CELL_RADIUS_SAFETY_FACTOR = 2;
|
|
4085
|
+
var BASE_CELL_RADIUS = CELL_RADIUS_SAFETY_FACTOR * AUTHALIC_RADIUS_EARTH / Math.sqrt(15);
|
|
4086
|
+
var _cellRadius = new Array(31);
|
|
4087
|
+
_cellRadius[0] = CELL_RADIUS_SAFETY_FACTOR * AUTHALIC_RADIUS_EARTH / Math.sqrt(3);
|
|
4088
|
+
for (let r = 1; r <= 30; r++) {
|
|
4089
|
+
_cellRadius[r] = BASE_CELL_RADIUS / (1 << r - 1);
|
|
4090
|
+
}
|
|
4036
4091
|
common_exports.setMatrixArrayType(Float64Array);
|
|
4037
4092
|
|
|
4038
4093
|
// src/h3-layers/h3-utils.ts
|
|
@@ -10208,7 +10263,7 @@ var __exports__ = (() => {
|
|
|
10208
10263
|
}
|
|
10209
10264
|
|
|
10210
10265
|
// ../../node_modules/@loaders.gl/xml/dist/xml-loader.js
|
|
10211
|
-
var VERSION = true ? "4.4.
|
|
10266
|
+
var VERSION = true ? "4.4.1" : "latest";
|
|
10212
10267
|
var XMLLoader = {
|
|
10213
10268
|
dataType: null,
|
|
10214
10269
|
batchType: null,
|
|
@@ -10791,7 +10846,7 @@ var __exports__ = (() => {
|
|
|
10791
10846
|
var dist_default = new ProbeLog({ id: "@probe.gl/log" });
|
|
10792
10847
|
|
|
10793
10848
|
// ../../node_modules/@loaders.gl/loader-utils/dist/lib/log-utils/log.js
|
|
10794
|
-
var VERSION3 = true ? "4.4.
|
|
10849
|
+
var VERSION3 = true ? "4.4.1" : "latest";
|
|
10795
10850
|
var version = VERSION3[0] >= "0" && VERSION3[0] <= "9" ? `v${VERSION3}` : "";
|
|
10796
10851
|
function createLog() {
|
|
10797
10852
|
const log8 = new ProbeLog({ id: "loaders.gl" });
|
|
@@ -10846,7 +10901,7 @@ var __exports__ = (() => {
|
|
|
10846
10901
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
10847
10902
|
warningIssued = true;
|
|
10848
10903
|
} else {
|
|
10849
|
-
globalThis._loadersgl_.version = "4.4.
|
|
10904
|
+
globalThis._loadersgl_.version = "4.4.1";
|
|
10850
10905
|
}
|
|
10851
10906
|
}
|
|
10852
10907
|
return globalThis._loadersgl_.version;
|
|
@@ -11616,7 +11671,7 @@ var __exports__ = (() => {
|
|
|
11616
11671
|
}
|
|
11617
11672
|
this.data = data;
|
|
11618
11673
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
11619
|
-
this.loadOptions =
|
|
11674
|
+
this.loadOptions = normalizeDirectLoaderOptions(this.options.core?.loadOptions);
|
|
11620
11675
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
11621
11676
|
}
|
|
11622
11677
|
setProps(options) {
|
|
@@ -11659,6 +11714,23 @@ var __exports__ = (() => {
|
|
|
11659
11714
|
}
|
|
11660
11715
|
return (url) => fetch(url);
|
|
11661
11716
|
}
|
|
11717
|
+
function normalizeDirectLoaderOptions(options) {
|
|
11718
|
+
const loadOptions = { ...options };
|
|
11719
|
+
if (options?.core) {
|
|
11720
|
+
loadOptions.core = { ...options.core };
|
|
11721
|
+
}
|
|
11722
|
+
const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
|
|
11723
|
+
const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
|
|
11724
|
+
if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
|
|
11725
|
+
loadOptions.core ||= {};
|
|
11726
|
+
if (loadOptions.core.baseUrl === void 0) {
|
|
11727
|
+
loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
|
|
11728
|
+
}
|
|
11729
|
+
delete loadOptions.baseUri;
|
|
11730
|
+
delete loadOptions.baseUrl;
|
|
11731
|
+
}
|
|
11732
|
+
return loadOptions;
|
|
11733
|
+
}
|
|
11662
11734
|
|
|
11663
11735
|
// ../../node_modules/@loaders.gl/loader-utils/dist/lib/sources/image-source.js
|
|
11664
11736
|
var ImageSource = class {
|
|
@@ -11675,7 +11747,7 @@ var __exports__ = (() => {
|
|
|
11675
11747
|
}
|
|
11676
11748
|
|
|
11677
11749
|
// ../../node_modules/@loaders.gl/wms/dist/wms-error-loader.js
|
|
11678
|
-
var VERSION5 = true ? "4.4.
|
|
11750
|
+
var VERSION5 = true ? "4.4.1" : "latest";
|
|
11679
11751
|
var WMSErrorLoader = {
|
|
11680
11752
|
dataType: null,
|
|
11681
11753
|
batchType: null,
|
|
@@ -11954,7 +12026,7 @@ var __exports__ = (() => {
|
|
|
11954
12026
|
}
|
|
11955
12027
|
|
|
11956
12028
|
// ../../node_modules/@loaders.gl/wms/dist/wms-capabilities-loader.js
|
|
11957
|
-
var VERSION6 = true ? "4.4.
|
|
12029
|
+
var VERSION6 = true ? "4.4.1" : "latest";
|
|
11958
12030
|
var WMSCapabilitiesLoader = {
|
|
11959
12031
|
dataType: null,
|
|
11960
12032
|
batchType: null,
|
|
@@ -12027,7 +12099,7 @@ var __exports__ = (() => {
|
|
|
12027
12099
|
};
|
|
12028
12100
|
|
|
12029
12101
|
// ../../node_modules/@loaders.gl/images/dist/lib/utils/version.js
|
|
12030
|
-
var VERSION7 = true ? "4.4.
|
|
12102
|
+
var VERSION7 = true ? "4.4.1" : "latest";
|
|
12031
12103
|
|
|
12032
12104
|
// ../../node_modules/@loaders.gl/images/dist/lib/category-api/image-type.js
|
|
12033
12105
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -14482,9 +14554,11 @@ var __exports__ = (() => {
|
|
|
14482
14554
|
tileSize = TILE_SIZE4,
|
|
14483
14555
|
modelMatrix,
|
|
14484
14556
|
modelMatrixInverse,
|
|
14485
|
-
zoomOffset = 0
|
|
14557
|
+
zoomOffset = 0,
|
|
14558
|
+
visibleMinZoom,
|
|
14559
|
+
visibleMaxZoom
|
|
14486
14560
|
}) {
|
|
14487
|
-
let z = viewport.isGeospatial ? Math.round(viewport.zoom + Math.log2(TILE_SIZE4 / tileSize)
|
|
14561
|
+
let z = viewport.isGeospatial ? Math.round(viewport.zoom + Math.log2(TILE_SIZE4 / tileSize) + zoomOffset) : Math.ceil(viewport.zoom + zoomOffset);
|
|
14488
14562
|
if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
|
|
14489
14563
|
if (!extent) {
|
|
14490
14564
|
return [];
|
|
@@ -14494,6 +14568,12 @@ var __exports__ = (() => {
|
|
|
14494
14568
|
if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
|
|
14495
14569
|
z = maxZoom;
|
|
14496
14570
|
}
|
|
14571
|
+
if (visibleMinZoom != null && viewport.zoom < visibleMinZoom) {
|
|
14572
|
+
return [];
|
|
14573
|
+
}
|
|
14574
|
+
if (visibleMaxZoom != null && viewport.zoom > visibleMaxZoom) {
|
|
14575
|
+
return [];
|
|
14576
|
+
}
|
|
14497
14577
|
let transformedExtent = extent;
|
|
14498
14578
|
if (modelMatrix && modelMatrixInverse && extent && !viewport.isGeospatial) {
|
|
14499
14579
|
transformedExtent = transformBox(extent, modelMatrix);
|
|
@@ -14572,6 +14652,8 @@ var __exports__ = (() => {
|
|
|
14572
14652
|
maxRequests: 6,
|
|
14573
14653
|
debounceTime: 0,
|
|
14574
14654
|
zoomOffset: 0,
|
|
14655
|
+
visibleMinZoom: null,
|
|
14656
|
+
visibleMaxZoom: null,
|
|
14575
14657
|
// onTileLoad: (tile: Tile2DHeader) => void, // onTileUnload: (tile: Tile2DHeader) => void, // onTileError: (error: any, tile: Tile2DHeader) => void, /** Called when all tiles in the current viewport are loaded. */
|
|
14576
14658
|
// onViewportLoad: ((tiles: Tile2DHeader<DataT>[]) => void) | null,
|
|
14577
14659
|
onTileLoad: () => {
|
|
@@ -14635,6 +14717,7 @@ var __exports__ = (() => {
|
|
|
14635
14717
|
if (Number.isFinite(opts.minZoom)) {
|
|
14636
14718
|
this._minZoom = Math.ceil(opts.minZoom);
|
|
14637
14719
|
}
|
|
14720
|
+
this._viewport = null;
|
|
14638
14721
|
}
|
|
14639
14722
|
// Clean up any outstanding tile requests.
|
|
14640
14723
|
finalize() {
|
|
@@ -14744,7 +14827,7 @@ var __exports__ = (() => {
|
|
|
14744
14827
|
modelMatrix,
|
|
14745
14828
|
modelMatrixInverse
|
|
14746
14829
|
}) {
|
|
14747
|
-
const { tileSize, extent, zoomOffset } = this.opts;
|
|
14830
|
+
const { tileSize, extent, zoomOffset, visibleMinZoom, visibleMaxZoom } = this.opts;
|
|
14748
14831
|
return getTileIndices({
|
|
14749
14832
|
viewport,
|
|
14750
14833
|
maxZoom,
|
|
@@ -14754,7 +14837,9 @@ var __exports__ = (() => {
|
|
|
14754
14837
|
extent,
|
|
14755
14838
|
modelMatrix,
|
|
14756
14839
|
modelMatrixInverse,
|
|
14757
|
-
zoomOffset
|
|
14840
|
+
zoomOffset,
|
|
14841
|
+
visibleMinZoom,
|
|
14842
|
+
visibleMaxZoom
|
|
14758
14843
|
});
|
|
14759
14844
|
}
|
|
14760
14845
|
/** Returns unique string key for a tile index */
|
|
@@ -14981,7 +15066,9 @@ var __exports__ = (() => {
|
|
|
14981
15066
|
zRange: null,
|
|
14982
15067
|
maxRequests: 6,
|
|
14983
15068
|
debounceTime: 0,
|
|
14984
|
-
zoomOffset: 0
|
|
15069
|
+
zoomOffset: 0,
|
|
15070
|
+
visibleMinZoom: null,
|
|
15071
|
+
visibleMaxZoom: null
|
|
14985
15072
|
};
|
|
14986
15073
|
var TileLayer = class extends import_core16.CompositeLayer {
|
|
14987
15074
|
initializeState() {
|
|
@@ -15038,7 +15125,9 @@ var __exports__ = (() => {
|
|
|
15038
15125
|
minZoom,
|
|
15039
15126
|
maxRequests,
|
|
15040
15127
|
debounceTime,
|
|
15041
|
-
zoomOffset
|
|
15128
|
+
zoomOffset,
|
|
15129
|
+
visibleMinZoom,
|
|
15130
|
+
visibleMaxZoom
|
|
15042
15131
|
} = this.props;
|
|
15043
15132
|
return {
|
|
15044
15133
|
maxCacheSize,
|
|
@@ -15051,6 +15140,8 @@ var __exports__ = (() => {
|
|
|
15051
15140
|
maxRequests,
|
|
15052
15141
|
debounceTime,
|
|
15053
15142
|
zoomOffset,
|
|
15143
|
+
visibleMinZoom,
|
|
15144
|
+
visibleMaxZoom,
|
|
15054
15145
|
getTileData: this.getTileData.bind(this),
|
|
15055
15146
|
onTileLoad: this._onTileLoad.bind(this),
|
|
15056
15147
|
onTileError: this._onTileError.bind(this),
|
|
@@ -15126,6 +15217,15 @@ var __exports__ = (() => {
|
|
|
15126
15217
|
info.sourceTileSubLayer.updateAutoHighlight(info);
|
|
15127
15218
|
}
|
|
15128
15219
|
renderLayers() {
|
|
15220
|
+
const { visibleMinZoom, visibleMaxZoom, minZoom, extent } = this.props;
|
|
15221
|
+
const zoom = this.context.viewport.zoom;
|
|
15222
|
+
const hidden = visibleMinZoom != null && zoom < visibleMinZoom || visibleMaxZoom != null && zoom > visibleMaxZoom || minZoom != null && !extent && zoom < minZoom;
|
|
15223
|
+
if (hidden) {
|
|
15224
|
+
for (const tile of this.state.tileset.tiles) {
|
|
15225
|
+
tile.layers = null;
|
|
15226
|
+
}
|
|
15227
|
+
return [];
|
|
15228
|
+
}
|
|
15129
15229
|
return this.state.tileset.tiles.map((tile) => {
|
|
15130
15230
|
const subLayerProps = this.getSubLayerPropsByTile(tile);
|
|
15131
15231
|
if (!tile.isLoaded && !tile.content) {
|
|
@@ -15513,12 +15613,12 @@ out float vTime;
|
|
|
15513
15613
|
|
|
15514
15614
|
// src/tile-3d-layer/tile-3d-layer.ts
|
|
15515
15615
|
var import_engine2 = __toESM(require_engine(), 1);
|
|
15516
|
-
var
|
|
15616
|
+
var import_core47 = __toESM(require_core(), 1);
|
|
15517
15617
|
var import_layers8 = __toESM(require_layers(), 1);
|
|
15518
15618
|
var import_mesh_layers2 = __toESM(require_mesh_layers(), 1);
|
|
15519
15619
|
|
|
15520
15620
|
// ../../node_modules/@loaders.gl/textures/dist/lib/utils/version.js
|
|
15521
|
-
var VERSION8 = true ? "4.4.
|
|
15621
|
+
var VERSION8 = true ? "4.4.1" : "latest";
|
|
15522
15622
|
|
|
15523
15623
|
// ../../node_modules/@loaders.gl/textures/dist/lib/parsers/basis-module-loader.js
|
|
15524
15624
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -15637,7 +15737,7 @@ out float vTime;
|
|
|
15637
15737
|
"bc7-rgba-unorm",
|
|
15638
15738
|
"bc7-rgba-unorm-srgb"
|
|
15639
15739
|
],
|
|
15640
|
-
WEBGL_compressed_texture_etc1: ["etc1-
|
|
15740
|
+
WEBGL_compressed_texture_etc1: ["etc1-rgb-unorm-webgl"],
|
|
15641
15741
|
WEBGL_compressed_texture_etc: [
|
|
15642
15742
|
"etc2-rgb8unorm",
|
|
15643
15743
|
"etc2-rgb8unorm-srgb",
|
|
@@ -15653,7 +15753,7 @@ out float vTime;
|
|
|
15653
15753
|
WEBGL_compressed_texture_pvrtc: [
|
|
15654
15754
|
"pvrtc-rgb4unorm-webgl",
|
|
15655
15755
|
"pvrtc-rgba4unorm-webgl",
|
|
15656
|
-
"pvrtc-
|
|
15756
|
+
"pvrtc-rgb2unorm-webgl",
|
|
15657
15757
|
"pvrtc-rgba2unorm-webgl"
|
|
15658
15758
|
],
|
|
15659
15759
|
WEBGL_compressed_texture_atc: [
|
|
@@ -15753,12 +15853,13 @@ out float vTime;
|
|
|
15753
15853
|
}
|
|
15754
15854
|
|
|
15755
15855
|
// ../../node_modules/@loaders.gl/textures/dist/lib/parsers/parse-basis.js
|
|
15856
|
+
var basisTranscodingLock = Promise.resolve();
|
|
15756
15857
|
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
15757
15858
|
etc1: {
|
|
15758
15859
|
basisFormat: 0,
|
|
15759
15860
|
compressed: true,
|
|
15760
15861
|
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
15761
|
-
textureFormat: "etc1-
|
|
15862
|
+
textureFormat: "etc1-rgb-unorm-webgl"
|
|
15762
15863
|
},
|
|
15763
15864
|
etc2: {
|
|
15764
15865
|
basisFormat: 1,
|
|
@@ -15858,31 +15959,46 @@ out float vTime;
|
|
|
15858
15959
|
}
|
|
15859
15960
|
};
|
|
15860
15961
|
var BASIS_FORMATS = Object.freeze(Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS));
|
|
15962
|
+
async function withBasisTranscodingLock(transcode) {
|
|
15963
|
+
const previousLock = basisTranscodingLock;
|
|
15964
|
+
let releaseLock;
|
|
15965
|
+
basisTranscodingLock = new Promise((resolve2) => {
|
|
15966
|
+
releaseLock = resolve2;
|
|
15967
|
+
});
|
|
15968
|
+
await previousLock;
|
|
15969
|
+
try {
|
|
15970
|
+
return await transcode();
|
|
15971
|
+
} finally {
|
|
15972
|
+
releaseLock();
|
|
15973
|
+
}
|
|
15974
|
+
}
|
|
15861
15975
|
async function parseBasis(data, options = {}) {
|
|
15862
15976
|
const loadLibraryOptions = extractLoadLibraryOptions(options);
|
|
15863
|
-
|
|
15864
|
-
if (
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15869
|
-
return parseBasisFile(BasisFile, data, options);
|
|
15870
|
-
}
|
|
15871
|
-
switch (options.basis.module) {
|
|
15872
|
-
case "encoder":
|
|
15873
|
-
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15874
|
-
switch (options.basis.containerFormat) {
|
|
15875
|
-
case "ktx2":
|
|
15876
|
-
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15877
|
-
case "basis":
|
|
15878
|
-
default:
|
|
15879
|
-
return parseBasisFile(fileConstructors.BasisFile, data, options);
|
|
15977
|
+
return await withBasisTranscodingLock(async () => {
|
|
15978
|
+
if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
|
|
15979
|
+
if (isKTX(data)) {
|
|
15980
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15981
|
+
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15880
15982
|
}
|
|
15881
|
-
case "transcoder":
|
|
15882
|
-
default:
|
|
15883
15983
|
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15884
15984
|
return parseBasisFile(BasisFile, data, options);
|
|
15885
|
-
|
|
15985
|
+
}
|
|
15986
|
+
switch (options.basis.module) {
|
|
15987
|
+
case "encoder":
|
|
15988
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15989
|
+
switch (options.basis.containerFormat) {
|
|
15990
|
+
case "ktx2":
|
|
15991
|
+
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15992
|
+
case "basis":
|
|
15993
|
+
default:
|
|
15994
|
+
return parseBasisFile(fileConstructors.BasisFile, data, options);
|
|
15995
|
+
}
|
|
15996
|
+
case "transcoder":
|
|
15997
|
+
default:
|
|
15998
|
+
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15999
|
+
return parseBasisFile(BasisFile, data, options);
|
|
16000
|
+
}
|
|
16001
|
+
});
|
|
15886
16002
|
}
|
|
15887
16003
|
function parseBasisFile(BasisFile, data, options) {
|
|
15888
16004
|
const basisFile = new BasisFile(new Uint8Array(data));
|
|
@@ -16022,7 +16138,7 @@ out float vTime;
|
|
|
16022
16138
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
16023
16139
|
"pvrtc-rgb4unorm-webgl",
|
|
16024
16140
|
"pvrtc-rgba4unorm-webgl",
|
|
16025
|
-
"pvrtc-
|
|
16141
|
+
"pvrtc-rgb2unorm-webgl",
|
|
16026
16142
|
"pvrtc-rgba2unorm-webgl"
|
|
16027
16143
|
])) {
|
|
16028
16144
|
return {
|
|
@@ -16042,7 +16158,7 @@ out float vTime;
|
|
|
16042
16158
|
"eac-rg11snorm"
|
|
16043
16159
|
])) {
|
|
16044
16160
|
return "etc2";
|
|
16045
|
-
} else if (textureFormats2.has("etc1-
|
|
16161
|
+
} else if (textureFormats2.has("etc1-rgb-unorm-webgl")) {
|
|
16046
16162
|
return "etc1";
|
|
16047
16163
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
16048
16164
|
"atc-rgb-unorm-webgl",
|
|
@@ -16087,7 +16203,7 @@ out float vTime;
|
|
|
16087
16203
|
};
|
|
16088
16204
|
|
|
16089
16205
|
// ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
|
|
16090
|
-
var
|
|
16206
|
+
var import_core21 = __toESM(require_core3(), 1);
|
|
16091
16207
|
|
|
16092
16208
|
// ../../node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/gltf-webgl-constants.js
|
|
16093
16209
|
var GLEnum;
|
|
@@ -16168,6 +16284,75 @@ out float vTime;
|
|
|
16168
16284
|
}
|
|
16169
16285
|
}
|
|
16170
16286
|
|
|
16287
|
+
// ../../node_modules/@luma.gl/gltf/dist/pbr/texture-transform.js
|
|
16288
|
+
var TEXTURE_TRANSFORM_SLOT_DEFINITIONS = [
|
|
16289
|
+
createTextureTransformSlotDefinition("baseColor", "pbr_baseColorSampler", "baseColorTexture", [
|
|
16290
|
+
"pbrMetallicRoughness",
|
|
16291
|
+
"baseColorTexture"
|
|
16292
|
+
]),
|
|
16293
|
+
createTextureTransformSlotDefinition("metallicRoughness", "pbr_metallicRoughnessSampler", "metallicRoughnessTexture", ["pbrMetallicRoughness", "metallicRoughnessTexture"]),
|
|
16294
|
+
createTextureTransformSlotDefinition("normal", "pbr_normalSampler", "normalTexture", [
|
|
16295
|
+
"normalTexture"
|
|
16296
|
+
]),
|
|
16297
|
+
createTextureTransformSlotDefinition("occlusion", "pbr_occlusionSampler", "occlusionTexture", [
|
|
16298
|
+
"occlusionTexture"
|
|
16299
|
+
]),
|
|
16300
|
+
createTextureTransformSlotDefinition("emissive", "pbr_emissiveSampler", "emissiveTexture", [
|
|
16301
|
+
"emissiveTexture"
|
|
16302
|
+
]),
|
|
16303
|
+
createTextureTransformSlotDefinition("specularColor", "pbr_specularColorSampler", "KHR_materials_specular.specularColorTexture", ["extensions", "KHR_materials_specular", "specularColorTexture"]),
|
|
16304
|
+
createTextureTransformSlotDefinition("specularIntensity", "pbr_specularIntensitySampler", "KHR_materials_specular.specularTexture", ["extensions", "KHR_materials_specular", "specularTexture"]),
|
|
16305
|
+
createTextureTransformSlotDefinition("transmission", "pbr_transmissionSampler", "KHR_materials_transmission.transmissionTexture", ["extensions", "KHR_materials_transmission", "transmissionTexture"]),
|
|
16306
|
+
createTextureTransformSlotDefinition("thickness", "pbr_thicknessSampler", "KHR_materials_volume.thicknessTexture", ["extensions", "KHR_materials_volume", "thicknessTexture"]),
|
|
16307
|
+
createTextureTransformSlotDefinition("clearcoat", "pbr_clearcoatSampler", "KHR_materials_clearcoat.clearcoatTexture", ["extensions", "KHR_materials_clearcoat", "clearcoatTexture"]),
|
|
16308
|
+
createTextureTransformSlotDefinition("clearcoatRoughness", "pbr_clearcoatRoughnessSampler", "KHR_materials_clearcoat.clearcoatRoughnessTexture", ["extensions", "KHR_materials_clearcoat", "clearcoatRoughnessTexture"]),
|
|
16309
|
+
createTextureTransformSlotDefinition("clearcoatNormal", "pbr_clearcoatNormalSampler", "KHR_materials_clearcoat.clearcoatNormalTexture", ["extensions", "KHR_materials_clearcoat", "clearcoatNormalTexture"]),
|
|
16310
|
+
createTextureTransformSlotDefinition("sheenColor", "pbr_sheenColorSampler", "KHR_materials_sheen.sheenColorTexture", ["extensions", "KHR_materials_sheen", "sheenColorTexture"]),
|
|
16311
|
+
createTextureTransformSlotDefinition("sheenRoughness", "pbr_sheenRoughnessSampler", "KHR_materials_sheen.sheenRoughnessTexture", ["extensions", "KHR_materials_sheen", "sheenRoughnessTexture"]),
|
|
16312
|
+
createTextureTransformSlotDefinition("iridescence", "pbr_iridescenceSampler", "KHR_materials_iridescence.iridescenceTexture", ["extensions", "KHR_materials_iridescence", "iridescenceTexture"]),
|
|
16313
|
+
createTextureTransformSlotDefinition("iridescenceThickness", "pbr_iridescenceThicknessSampler", "KHR_materials_iridescence.iridescenceThicknessTexture", ["extensions", "KHR_materials_iridescence", "iridescenceThicknessTexture"]),
|
|
16314
|
+
createTextureTransformSlotDefinition("anisotropy", "pbr_anisotropySampler", "KHR_materials_anisotropy.anisotropyTexture", ["extensions", "KHR_materials_anisotropy", "anisotropyTexture"])
|
|
16315
|
+
];
|
|
16316
|
+
var TEXTURE_TRANSFORM_SLOT_DEFINITION_MAP = new Map(TEXTURE_TRANSFORM_SLOT_DEFINITIONS.map((definition) => [definition.slot, definition]));
|
|
16317
|
+
function createTextureTransformSlotDefinition(slot, binding, displayName, pathSegments) {
|
|
16318
|
+
return {
|
|
16319
|
+
slot,
|
|
16320
|
+
binding,
|
|
16321
|
+
displayName,
|
|
16322
|
+
pathSegments,
|
|
16323
|
+
uvSetUniform: `${slot}UVSet`,
|
|
16324
|
+
uvTransformUniform: `${slot}UVTransform`
|
|
16325
|
+
};
|
|
16326
|
+
}
|
|
16327
|
+
function getTextureTransformSlotDefinitions() {
|
|
16328
|
+
return TEXTURE_TRANSFORM_SLOT_DEFINITIONS;
|
|
16329
|
+
}
|
|
16330
|
+
function getTextureTransformSlotDefinition(slot) {
|
|
16331
|
+
const definition = TEXTURE_TRANSFORM_SLOT_DEFINITION_MAP.get(slot);
|
|
16332
|
+
if (!definition) {
|
|
16333
|
+
throw new Error(`Unknown PBR texture transform slot ${slot}`);
|
|
16334
|
+
}
|
|
16335
|
+
return definition;
|
|
16336
|
+
}
|
|
16337
|
+
function resolveTextureTransform(textureInfo) {
|
|
16338
|
+
const extensionTextureTransform = textureInfo?.["extensions"]?.["KHR_texture_transform"];
|
|
16339
|
+
return {
|
|
16340
|
+
offset: extensionTextureTransform?.offset ? [extensionTextureTransform.offset[0], extensionTextureTransform.offset[1]] : [0, 0],
|
|
16341
|
+
rotation: extensionTextureTransform?.rotation ?? 0,
|
|
16342
|
+
scale: extensionTextureTransform?.scale ? [extensionTextureTransform.scale[0], extensionTextureTransform.scale[1]] : [1, 1]
|
|
16343
|
+
};
|
|
16344
|
+
}
|
|
16345
|
+
function resolveTextureCoordinateSet(textureInfo) {
|
|
16346
|
+
const extensionTextureTransform = textureInfo?.["extensions"]?.["KHR_texture_transform"];
|
|
16347
|
+
return extensionTextureTransform?.["texCoord"] ?? textureInfo?.["texCoord"] ?? 0;
|
|
16348
|
+
}
|
|
16349
|
+
function getTextureTransformMatrix(transform2) {
|
|
16350
|
+
const translationMatrix = new Matrix3().set(1, 0, 0, 0, 1, 0, transform2.offset[0], transform2.offset[1], 1);
|
|
16351
|
+
const rotationMatrix = new Matrix3().set(Math.cos(transform2.rotation), Math.sin(transform2.rotation), 0, -Math.sin(transform2.rotation), Math.cos(transform2.rotation), 0, 0, 0, 1);
|
|
16352
|
+
const scaleMatrix = new Matrix3().set(transform2.scale[0], 0, 0, 0, transform2.scale[1], 0, 0, 0, 1);
|
|
16353
|
+
return Array.from(translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix));
|
|
16354
|
+
}
|
|
16355
|
+
|
|
16171
16356
|
// ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
|
|
16172
16357
|
function parsePBRMaterial(device, material, attributes, options) {
|
|
16173
16358
|
const parsedMaterial = {
|
|
@@ -16208,6 +16393,8 @@ out float vTime;
|
|
|
16208
16393
|
parsedMaterial.defines["HAS_TANGENTS"] = true;
|
|
16209
16394
|
if (attributes["TEXCOORD_0"])
|
|
16210
16395
|
parsedMaterial.defines["HAS_UV"] = true;
|
|
16396
|
+
if (attributes["TEXCOORD_1"])
|
|
16397
|
+
parsedMaterial.defines["HAS_UV_1"] = true;
|
|
16211
16398
|
if (attributes["JOINTS_0"] && attributes["WEIGHTS_0"])
|
|
16212
16399
|
parsedMaterial.defines["HAS_SKIN"] = true;
|
|
16213
16400
|
if (attributes["COLOR_0"])
|
|
@@ -16220,72 +16407,53 @@ out float vTime;
|
|
|
16220
16407
|
if (options.validateAttributes !== false) {
|
|
16221
16408
|
warnOnMissingExpectedAttributes(material, attributes);
|
|
16222
16409
|
}
|
|
16223
|
-
parseMaterial(device, material, parsedMaterial, options.gltf);
|
|
16410
|
+
parseMaterial(device, material, parsedMaterial, attributes, options.gltf);
|
|
16224
16411
|
}
|
|
16225
16412
|
return parsedMaterial;
|
|
16226
16413
|
}
|
|
16227
16414
|
function warnOnMissingExpectedAttributes(material, attributes) {
|
|
16228
|
-
const uvDependentTextureSlots = getUvDependentTextureSlots(material);
|
|
16415
|
+
const uvDependentTextureSlots = getUvDependentTextureSlots(material, 0);
|
|
16229
16416
|
if (uvDependentTextureSlots.length > 0 && !attributes["TEXCOORD_0"]) {
|
|
16230
|
-
|
|
16417
|
+
import_core21.log.warn(`glTF material uses ${uvDependentTextureSlots.join(", ")} but primitive is missing TEXCOORD_0; textured shading will sample the default UV coordinates`)();
|
|
16418
|
+
}
|
|
16419
|
+
const uv1DependentTextureSlots = getUvDependentTextureSlots(material, 1);
|
|
16420
|
+
if (uv1DependentTextureSlots.length > 0 && !attributes["TEXCOORD_1"]) {
|
|
16421
|
+
import_core21.log.warn(`glTF material uses ${uv1DependentTextureSlots.join(", ")} with TEXCOORD_1 but primitive is missing TEXCOORD_1; those textures will be skipped`)();
|
|
16231
16422
|
}
|
|
16232
16423
|
const isUnlitMaterial = Boolean(material.unlit || material.extensions?.KHR_materials_unlit);
|
|
16233
16424
|
if (isUnlitMaterial || attributes["NORMAL"]) {
|
|
16234
16425
|
return;
|
|
16235
16426
|
}
|
|
16236
16427
|
const missingNormalReason = material.normalTexture ? "lit PBR shading with normalTexture" : "lit PBR shading";
|
|
16237
|
-
|
|
16428
|
+
import_core21.log.warn(`glTF primitive is missing NORMAL while using ${missingNormalReason}; shading will fall back to geometric normals`)();
|
|
16238
16429
|
}
|
|
16239
|
-
function getUvDependentTextureSlots(material) {
|
|
16430
|
+
function getUvDependentTextureSlots(material, textureCoordinateSet) {
|
|
16240
16431
|
const uvDependentTextureSlots = [];
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
}
|
|
16250
|
-
if (material.occlusionTexture) {
|
|
16251
|
-
uvDependentTextureSlots.push("occlusionTexture");
|
|
16252
|
-
}
|
|
16253
|
-
if (material.emissiveTexture) {
|
|
16254
|
-
uvDependentTextureSlots.push("emissiveTexture");
|
|
16255
|
-
}
|
|
16256
|
-
if (material.extensions?.KHR_materials_specular?.specularTexture) {
|
|
16257
|
-
uvDependentTextureSlots.push("KHR_materials_specular.specularTexture");
|
|
16258
|
-
}
|
|
16259
|
-
if (material.extensions?.KHR_materials_specular?.specularColorTexture) {
|
|
16260
|
-
uvDependentTextureSlots.push("KHR_materials_specular.specularColorTexture");
|
|
16261
|
-
}
|
|
16262
|
-
if (material.extensions?.KHR_materials_transmission?.transmissionTexture) {
|
|
16263
|
-
uvDependentTextureSlots.push("KHR_materials_transmission.transmissionTexture");
|
|
16264
|
-
}
|
|
16265
|
-
if (material.extensions?.KHR_materials_clearcoat?.clearcoatTexture) {
|
|
16266
|
-
uvDependentTextureSlots.push("KHR_materials_clearcoat.clearcoatTexture");
|
|
16267
|
-
}
|
|
16268
|
-
if (material.extensions?.KHR_materials_clearcoat?.clearcoatRoughnessTexture) {
|
|
16269
|
-
uvDependentTextureSlots.push("KHR_materials_clearcoat.clearcoatRoughnessTexture");
|
|
16270
|
-
}
|
|
16271
|
-
if (material.extensions?.KHR_materials_sheen?.sheenColorTexture) {
|
|
16272
|
-
uvDependentTextureSlots.push("KHR_materials_sheen.sheenColorTexture");
|
|
16273
|
-
}
|
|
16274
|
-
if (material.extensions?.KHR_materials_sheen?.sheenRoughnessTexture) {
|
|
16275
|
-
uvDependentTextureSlots.push("KHR_materials_sheen.sheenRoughnessTexture");
|
|
16276
|
-
}
|
|
16277
|
-
if (material.extensions?.KHR_materials_iridescence?.iridescenceTexture) {
|
|
16278
|
-
uvDependentTextureSlots.push("KHR_materials_iridescence.iridescenceTexture");
|
|
16279
|
-
}
|
|
16280
|
-
if (material.extensions?.KHR_materials_anisotropy?.anisotropyTexture) {
|
|
16281
|
-
uvDependentTextureSlots.push("KHR_materials_anisotropy.anisotropyTexture");
|
|
16432
|
+
for (const slotDefinition of getTextureTransformSlotDefinitions()) {
|
|
16433
|
+
const textureInfo = getNestedTextureInfo(material, slotDefinition.pathSegments);
|
|
16434
|
+
if (!textureInfo) {
|
|
16435
|
+
continue;
|
|
16436
|
+
}
|
|
16437
|
+
if (resolveTextureCoordinateSet(textureInfo) === textureCoordinateSet) {
|
|
16438
|
+
uvDependentTextureSlots.push(slotDefinition.displayName);
|
|
16439
|
+
}
|
|
16282
16440
|
}
|
|
16283
16441
|
return uvDependentTextureSlots;
|
|
16284
16442
|
}
|
|
16285
|
-
function
|
|
16443
|
+
function getNestedTextureInfo(material, pathSegments) {
|
|
16444
|
+
let value = material;
|
|
16445
|
+
for (const pathSegment of pathSegments) {
|
|
16446
|
+
value = value?.[pathSegment];
|
|
16447
|
+
if (!value) {
|
|
16448
|
+
return null;
|
|
16449
|
+
}
|
|
16450
|
+
}
|
|
16451
|
+
return value;
|
|
16452
|
+
}
|
|
16453
|
+
function parseMaterial(device, material, parsedMaterial, attributes, gltf) {
|
|
16286
16454
|
parsedMaterial.uniforms.unlit = Boolean(material.unlit || material.extensions?.KHR_materials_unlit);
|
|
16287
16455
|
if (material.pbrMetallicRoughness) {
|
|
16288
|
-
parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial, gltf);
|
|
16456
|
+
parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial, attributes, gltf);
|
|
16289
16457
|
}
|
|
16290
16458
|
if (material.normalTexture) {
|
|
16291
16459
|
addTexture(device, material.normalTexture, "pbr_normalSampler", parsedMaterial, {
|
|
@@ -16293,7 +16461,9 @@ out float vTime;
|
|
|
16293
16461
|
define: "HAS_NORMALMAP",
|
|
16294
16462
|
enabledUniformName: "normalMapEnabled"
|
|
16295
16463
|
},
|
|
16296
|
-
gltf
|
|
16464
|
+
gltf,
|
|
16465
|
+
attributes,
|
|
16466
|
+
textureTransformSlot: "normal"
|
|
16297
16467
|
});
|
|
16298
16468
|
const { scale: scale12 = 1 } = material.normalTexture;
|
|
16299
16469
|
parsedMaterial.uniforms.normalScale = scale12;
|
|
@@ -16304,7 +16474,9 @@ out float vTime;
|
|
|
16304
16474
|
define: "HAS_OCCLUSIONMAP",
|
|
16305
16475
|
enabledUniformName: "occlusionMapEnabled"
|
|
16306
16476
|
},
|
|
16307
|
-
gltf
|
|
16477
|
+
gltf,
|
|
16478
|
+
attributes,
|
|
16479
|
+
textureTransformSlot: "occlusion"
|
|
16308
16480
|
});
|
|
16309
16481
|
const { strength = 1 } = material.occlusionTexture;
|
|
16310
16482
|
parsedMaterial.uniforms.occlusionStrength = strength;
|
|
@@ -16316,10 +16488,12 @@ out float vTime;
|
|
|
16316
16488
|
define: "HAS_EMISSIVEMAP",
|
|
16317
16489
|
enabledUniformName: "emissiveMapEnabled"
|
|
16318
16490
|
},
|
|
16319
|
-
gltf
|
|
16491
|
+
gltf,
|
|
16492
|
+
attributes,
|
|
16493
|
+
textureTransformSlot: "emissive"
|
|
16320
16494
|
});
|
|
16321
16495
|
}
|
|
16322
|
-
parseMaterialExtensions(device, material.extensions, parsedMaterial, gltf);
|
|
16496
|
+
parseMaterialExtensions(device, material.extensions, parsedMaterial, gltf, attributes);
|
|
16323
16497
|
switch (material.alphaMode || "OPAQUE") {
|
|
16324
16498
|
case "OPAQUE":
|
|
16325
16499
|
break;
|
|
@@ -16331,7 +16505,7 @@ out float vTime;
|
|
|
16331
16505
|
break;
|
|
16332
16506
|
}
|
|
16333
16507
|
case "BLEND":
|
|
16334
|
-
|
|
16508
|
+
import_core21.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")();
|
|
16335
16509
|
applyAlphaBlendParameters(parsedMaterial);
|
|
16336
16510
|
break;
|
|
16337
16511
|
}
|
|
@@ -16372,14 +16546,16 @@ out float vTime;
|
|
|
16372
16546
|
GLEnum.ONE_MINUS_SRC_ALPHA
|
|
16373
16547
|
];
|
|
16374
16548
|
}
|
|
16375
|
-
function parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial, gltf) {
|
|
16549
|
+
function parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial, attributes, gltf) {
|
|
16376
16550
|
if (pbrMetallicRoughness.baseColorTexture) {
|
|
16377
16551
|
addTexture(device, pbrMetallicRoughness.baseColorTexture, "pbr_baseColorSampler", parsedMaterial, {
|
|
16378
16552
|
featureOptions: {
|
|
16379
16553
|
define: "HAS_BASECOLORMAP",
|
|
16380
16554
|
enabledUniformName: "baseColorMapEnabled"
|
|
16381
16555
|
},
|
|
16382
|
-
gltf
|
|
16556
|
+
gltf,
|
|
16557
|
+
attributes,
|
|
16558
|
+
textureTransformSlot: "baseColor"
|
|
16383
16559
|
});
|
|
16384
16560
|
}
|
|
16385
16561
|
parsedMaterial.uniforms.baseColorFactor = pbrMetallicRoughness.baseColorFactor || [1, 1, 1, 1];
|
|
@@ -16389,33 +16565,35 @@ out float vTime;
|
|
|
16389
16565
|
define: "HAS_METALROUGHNESSMAP",
|
|
16390
16566
|
enabledUniformName: "metallicRoughnessMapEnabled"
|
|
16391
16567
|
},
|
|
16392
|
-
gltf
|
|
16568
|
+
gltf,
|
|
16569
|
+
attributes,
|
|
16570
|
+
textureTransformSlot: "metallicRoughness"
|
|
16393
16571
|
});
|
|
16394
16572
|
}
|
|
16395
16573
|
const { metallicFactor = 1, roughnessFactor = 1 } = pbrMetallicRoughness;
|
|
16396
16574
|
parsedMaterial.uniforms.metallicRoughnessValues = [metallicFactor, roughnessFactor];
|
|
16397
16575
|
}
|
|
16398
|
-
function parseMaterialExtensions(device, extensions, parsedMaterial, gltf) {
|
|
16576
|
+
function parseMaterialExtensions(device, extensions, parsedMaterial, gltf, attributes = {}) {
|
|
16399
16577
|
if (!extensions) {
|
|
16400
16578
|
return;
|
|
16401
16579
|
}
|
|
16402
16580
|
if (hasMaterialExtensionShading(extensions)) {
|
|
16403
16581
|
parsedMaterial.defines["USE_MATERIAL_EXTENSIONS"] = true;
|
|
16404
16582
|
}
|
|
16405
|
-
parseSpecularExtension(device, extensions.KHR_materials_specular, parsedMaterial, gltf);
|
|
16583
|
+
parseSpecularExtension(device, extensions.KHR_materials_specular, parsedMaterial, gltf, attributes);
|
|
16406
16584
|
parseIorExtension(extensions.KHR_materials_ior, parsedMaterial);
|
|
16407
|
-
parseTransmissionExtension(device, extensions.KHR_materials_transmission, parsedMaterial, gltf);
|
|
16408
|
-
parseVolumeExtension(device, extensions.KHR_materials_volume, parsedMaterial, gltf);
|
|
16409
|
-
parseClearcoatExtension(device, extensions.KHR_materials_clearcoat, parsedMaterial, gltf);
|
|
16410
|
-
parseSheenExtension(device, extensions.KHR_materials_sheen, parsedMaterial, gltf);
|
|
16411
|
-
parseIridescenceExtension(device, extensions.KHR_materials_iridescence, parsedMaterial, gltf);
|
|
16412
|
-
parseAnisotropyExtension(device, extensions.KHR_materials_anisotropy, parsedMaterial, gltf);
|
|
16585
|
+
parseTransmissionExtension(device, extensions.KHR_materials_transmission, parsedMaterial, gltf, attributes);
|
|
16586
|
+
parseVolumeExtension(device, extensions.KHR_materials_volume, parsedMaterial, gltf, attributes);
|
|
16587
|
+
parseClearcoatExtension(device, extensions.KHR_materials_clearcoat, parsedMaterial, gltf, attributes);
|
|
16588
|
+
parseSheenExtension(device, extensions.KHR_materials_sheen, parsedMaterial, gltf, attributes);
|
|
16589
|
+
parseIridescenceExtension(device, extensions.KHR_materials_iridescence, parsedMaterial, gltf, attributes);
|
|
16590
|
+
parseAnisotropyExtension(device, extensions.KHR_materials_anisotropy, parsedMaterial, gltf, attributes);
|
|
16413
16591
|
parseEmissiveStrengthExtension(extensions.KHR_materials_emissive_strength, parsedMaterial);
|
|
16414
16592
|
}
|
|
16415
16593
|
function hasMaterialExtensionShading(extensions) {
|
|
16416
16594
|
return Boolean(extensions.KHR_materials_specular || extensions.KHR_materials_ior || extensions.KHR_materials_transmission || extensions.KHR_materials_volume || extensions.KHR_materials_clearcoat || extensions.KHR_materials_sheen || extensions.KHR_materials_iridescence || extensions.KHR_materials_anisotropy);
|
|
16417
16595
|
}
|
|
16418
|
-
function parseSpecularExtension(device, extension, parsedMaterial, gltf) {
|
|
16596
|
+
function parseSpecularExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16419
16597
|
if (!extension) {
|
|
16420
16598
|
return;
|
|
16421
16599
|
}
|
|
@@ -16431,7 +16609,9 @@ out float vTime;
|
|
|
16431
16609
|
define: "HAS_SPECULARCOLORMAP",
|
|
16432
16610
|
enabledUniformName: "specularColorMapEnabled"
|
|
16433
16611
|
},
|
|
16434
|
-
gltf
|
|
16612
|
+
gltf,
|
|
16613
|
+
attributes,
|
|
16614
|
+
textureTransformSlot: "specularColor"
|
|
16435
16615
|
});
|
|
16436
16616
|
}
|
|
16437
16617
|
if (extension.specularTexture) {
|
|
@@ -16440,7 +16620,9 @@ out float vTime;
|
|
|
16440
16620
|
define: "HAS_SPECULARINTENSITYMAP",
|
|
16441
16621
|
enabledUniformName: "specularIntensityMapEnabled"
|
|
16442
16622
|
},
|
|
16443
|
-
gltf
|
|
16623
|
+
gltf,
|
|
16624
|
+
attributes,
|
|
16625
|
+
textureTransformSlot: "specularIntensity"
|
|
16444
16626
|
});
|
|
16445
16627
|
}
|
|
16446
16628
|
}
|
|
@@ -16449,7 +16631,7 @@ out float vTime;
|
|
|
16449
16631
|
parsedMaterial.uniforms.ior = extension.ior;
|
|
16450
16632
|
}
|
|
16451
16633
|
}
|
|
16452
|
-
function parseTransmissionExtension(device, extension, parsedMaterial, gltf) {
|
|
16634
|
+
function parseTransmissionExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16453
16635
|
if (!extension) {
|
|
16454
16636
|
return;
|
|
16455
16637
|
}
|
|
@@ -16462,15 +16644,17 @@ out float vTime;
|
|
|
16462
16644
|
define: "HAS_TRANSMISSIONMAP",
|
|
16463
16645
|
enabledUniformName: "transmissionMapEnabled"
|
|
16464
16646
|
},
|
|
16465
|
-
gltf
|
|
16647
|
+
gltf,
|
|
16648
|
+
attributes,
|
|
16649
|
+
textureTransformSlot: "transmission"
|
|
16466
16650
|
});
|
|
16467
16651
|
}
|
|
16468
16652
|
if ((extension.transmissionFactor ?? 0) > 0 || extension.transmissionTexture) {
|
|
16469
|
-
|
|
16653
|
+
import_core21.log.warn("KHR_materials_transmission uses a premultiplied-alpha blending approximation and may require mesh sorting")();
|
|
16470
16654
|
applyTransmissionBlendApproximation(parsedMaterial);
|
|
16471
16655
|
}
|
|
16472
16656
|
}
|
|
16473
|
-
function parseVolumeExtension(device, extension, parsedMaterial, gltf) {
|
|
16657
|
+
function parseVolumeExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16474
16658
|
if (!extension) {
|
|
16475
16659
|
return;
|
|
16476
16660
|
}
|
|
@@ -16482,7 +16666,9 @@ out float vTime;
|
|
|
16482
16666
|
featureOptions: {
|
|
16483
16667
|
define: "HAS_THICKNESSMAP"
|
|
16484
16668
|
},
|
|
16485
|
-
gltf
|
|
16669
|
+
gltf,
|
|
16670
|
+
attributes,
|
|
16671
|
+
textureTransformSlot: "thickness"
|
|
16486
16672
|
});
|
|
16487
16673
|
}
|
|
16488
16674
|
if (extension.attenuationDistance !== void 0) {
|
|
@@ -16492,7 +16678,7 @@ out float vTime;
|
|
|
16492
16678
|
parsedMaterial.uniforms.attenuationColor = extension.attenuationColor;
|
|
16493
16679
|
}
|
|
16494
16680
|
}
|
|
16495
|
-
function parseClearcoatExtension(device, extension, parsedMaterial, gltf) {
|
|
16681
|
+
function parseClearcoatExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16496
16682
|
if (!extension) {
|
|
16497
16683
|
return;
|
|
16498
16684
|
}
|
|
@@ -16508,7 +16694,9 @@ out float vTime;
|
|
|
16508
16694
|
define: "HAS_CLEARCOATMAP",
|
|
16509
16695
|
enabledUniformName: "clearcoatMapEnabled"
|
|
16510
16696
|
},
|
|
16511
|
-
gltf
|
|
16697
|
+
gltf,
|
|
16698
|
+
attributes,
|
|
16699
|
+
textureTransformSlot: "clearcoat"
|
|
16512
16700
|
});
|
|
16513
16701
|
}
|
|
16514
16702
|
if (extension.clearcoatRoughnessTexture) {
|
|
@@ -16517,7 +16705,9 @@ out float vTime;
|
|
|
16517
16705
|
define: "HAS_CLEARCOATROUGHNESSMAP",
|
|
16518
16706
|
enabledUniformName: "clearcoatRoughnessMapEnabled"
|
|
16519
16707
|
},
|
|
16520
|
-
gltf
|
|
16708
|
+
gltf,
|
|
16709
|
+
attributes,
|
|
16710
|
+
textureTransformSlot: "clearcoatRoughness"
|
|
16521
16711
|
});
|
|
16522
16712
|
}
|
|
16523
16713
|
if (extension.clearcoatNormalTexture) {
|
|
@@ -16525,11 +16715,13 @@ out float vTime;
|
|
|
16525
16715
|
featureOptions: {
|
|
16526
16716
|
define: "HAS_CLEARCOATNORMALMAP"
|
|
16527
16717
|
},
|
|
16528
|
-
gltf
|
|
16718
|
+
gltf,
|
|
16719
|
+
attributes,
|
|
16720
|
+
textureTransformSlot: "clearcoatNormal"
|
|
16529
16721
|
});
|
|
16530
16722
|
}
|
|
16531
16723
|
}
|
|
16532
|
-
function parseSheenExtension(device, extension, parsedMaterial, gltf) {
|
|
16724
|
+
function parseSheenExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16533
16725
|
if (!extension) {
|
|
16534
16726
|
return;
|
|
16535
16727
|
}
|
|
@@ -16545,7 +16737,9 @@ out float vTime;
|
|
|
16545
16737
|
define: "HAS_SHEENCOLORMAP",
|
|
16546
16738
|
enabledUniformName: "sheenColorMapEnabled"
|
|
16547
16739
|
},
|
|
16548
|
-
gltf
|
|
16740
|
+
gltf,
|
|
16741
|
+
attributes,
|
|
16742
|
+
textureTransformSlot: "sheenColor"
|
|
16549
16743
|
});
|
|
16550
16744
|
}
|
|
16551
16745
|
if (extension.sheenRoughnessTexture) {
|
|
@@ -16554,11 +16748,13 @@ out float vTime;
|
|
|
16554
16748
|
define: "HAS_SHEENROUGHNESSMAP",
|
|
16555
16749
|
enabledUniformName: "sheenRoughnessMapEnabled"
|
|
16556
16750
|
},
|
|
16557
|
-
gltf
|
|
16751
|
+
gltf,
|
|
16752
|
+
attributes,
|
|
16753
|
+
textureTransformSlot: "sheenRoughness"
|
|
16558
16754
|
});
|
|
16559
16755
|
}
|
|
16560
16756
|
}
|
|
16561
|
-
function parseIridescenceExtension(device, extension, parsedMaterial, gltf) {
|
|
16757
|
+
function parseIridescenceExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16562
16758
|
if (!extension) {
|
|
16563
16759
|
return;
|
|
16564
16760
|
}
|
|
@@ -16580,7 +16776,9 @@ out float vTime;
|
|
|
16580
16776
|
define: "HAS_IRIDESCENCEMAP",
|
|
16581
16777
|
enabledUniformName: "iridescenceMapEnabled"
|
|
16582
16778
|
},
|
|
16583
|
-
gltf
|
|
16779
|
+
gltf,
|
|
16780
|
+
attributes,
|
|
16781
|
+
textureTransformSlot: "iridescence"
|
|
16584
16782
|
});
|
|
16585
16783
|
}
|
|
16586
16784
|
if (extension.iridescenceThicknessTexture) {
|
|
@@ -16588,11 +16786,13 @@ out float vTime;
|
|
|
16588
16786
|
featureOptions: {
|
|
16589
16787
|
define: "HAS_IRIDESCENCETHICKNESSMAP"
|
|
16590
16788
|
},
|
|
16591
|
-
gltf
|
|
16789
|
+
gltf,
|
|
16790
|
+
attributes,
|
|
16791
|
+
textureTransformSlot: "iridescenceThickness"
|
|
16592
16792
|
});
|
|
16593
16793
|
}
|
|
16594
16794
|
}
|
|
16595
|
-
function parseAnisotropyExtension(device, extension, parsedMaterial, gltf) {
|
|
16795
|
+
function parseAnisotropyExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16596
16796
|
if (!extension) {
|
|
16597
16797
|
return;
|
|
16598
16798
|
}
|
|
@@ -16608,7 +16808,9 @@ out float vTime;
|
|
|
16608
16808
|
define: "HAS_ANISOTROPYMAP",
|
|
16609
16809
|
enabledUniformName: "anisotropyMapEnabled"
|
|
16610
16810
|
},
|
|
16611
|
-
gltf
|
|
16811
|
+
gltf,
|
|
16812
|
+
attributes,
|
|
16813
|
+
textureTransformSlot: "anisotropy"
|
|
16612
16814
|
});
|
|
16613
16815
|
}
|
|
16614
16816
|
}
|
|
@@ -16618,12 +16820,21 @@ out float vTime;
|
|
|
16618
16820
|
}
|
|
16619
16821
|
}
|
|
16620
16822
|
function addTexture(device, gltfTexture, uniformName, parsedMaterial, textureParseOptions = {}) {
|
|
16621
|
-
const { featureOptions = {}, gltf } = textureParseOptions;
|
|
16823
|
+
const { featureOptions = {}, gltf, attributes = {}, textureTransformSlot } = textureParseOptions;
|
|
16622
16824
|
const { define: define2, enabledUniformName } = featureOptions;
|
|
16825
|
+
const textureCoordinateSet = resolveTextureCoordinateSet(gltfTexture);
|
|
16826
|
+
if (textureCoordinateSet > 1) {
|
|
16827
|
+
import_core21.log.warn(`Skipping ${String(uniformName)} because ${textureCoordinateSet} is not supported; only TEXCOORD_0 and TEXCOORD_1 are currently available`)();
|
|
16828
|
+
return;
|
|
16829
|
+
}
|
|
16830
|
+
if (textureCoordinateSet === 1 && !attributes["TEXCOORD_1"]) {
|
|
16831
|
+
import_core21.log.warn(`Skipping ${String(uniformName)} because it requires TEXCOORD_1 but the primitive does not provide TEXCOORD_1`)();
|
|
16832
|
+
return;
|
|
16833
|
+
}
|
|
16623
16834
|
const resolvedTextureInfo = resolveTextureInfo(gltfTexture, gltf);
|
|
16624
16835
|
const image = resolvedTextureInfo.texture?.source?.image;
|
|
16625
16836
|
if (!image) {
|
|
16626
|
-
|
|
16837
|
+
import_core21.log.warn(`Skipping unresolved glTF texture for ${String(uniformName)}`)();
|
|
16627
16838
|
return;
|
|
16628
16839
|
}
|
|
16629
16840
|
const gltfSampler = {
|
|
@@ -16659,6 +16870,11 @@ out float vTime;
|
|
|
16659
16870
|
if (enabledUniformName) {
|
|
16660
16871
|
parsedMaterial.uniforms[enabledUniformName] = true;
|
|
16661
16872
|
}
|
|
16873
|
+
if (textureTransformSlot) {
|
|
16874
|
+
const textureTransformSlotDefinition = getTextureTransformSlotDefinition(textureTransformSlot);
|
|
16875
|
+
parsedMaterial.uniforms[textureTransformSlotDefinition.uvSetUniform] = textureCoordinateSet;
|
|
16876
|
+
parsedMaterial.uniforms[textureTransformSlotDefinition.uvTransformUniform] = getTextureTransformMatrix(resolveTextureTransform(gltfTexture));
|
|
16877
|
+
}
|
|
16662
16878
|
parsedMaterial.generatedTextures.push(texture);
|
|
16663
16879
|
}
|
|
16664
16880
|
function resolveTextureInfo(gltfTexture, gltf) {
|
|
@@ -16697,7 +16913,7 @@ out float vTime;
|
|
|
16697
16913
|
return level.textureFormat;
|
|
16698
16914
|
}
|
|
16699
16915
|
function getMaxCompressedMipLevels(baseWidth, baseHeight, format) {
|
|
16700
|
-
const { blockWidth = 1, blockHeight = 1 } =
|
|
16916
|
+
const { blockWidth = 1, blockHeight = 1 } = import_core21.textureFormatDecoder.getInfo(format);
|
|
16701
16917
|
let count = 1;
|
|
16702
16918
|
for (let i = 1; ; i++) {
|
|
16703
16919
|
const w2 = Math.max(1, baseWidth >> i);
|
|
@@ -16718,19 +16934,19 @@ out float vTime;
|
|
|
16718
16934
|
levels = [];
|
|
16719
16935
|
}
|
|
16720
16936
|
if (levels.length === 0 || !levels[0]?.data) {
|
|
16721
|
-
|
|
16937
|
+
import_core21.log.warn("createCompressedTexture: compressed image has no valid mip levels, creating fallback")();
|
|
16722
16938
|
return createCompressedTextureFallback(device, baseOptions);
|
|
16723
16939
|
}
|
|
16724
16940
|
const baseLevel = levels[0];
|
|
16725
16941
|
const baseWidth = baseLevel.width ?? image.width ?? 0;
|
|
16726
16942
|
const baseHeight = baseLevel.height ?? image.height ?? 0;
|
|
16727
16943
|
if (baseWidth <= 0 || baseHeight <= 0) {
|
|
16728
|
-
|
|
16944
|
+
import_core21.log.warn("createCompressedTexture: base level has invalid dimensions, creating fallback")();
|
|
16729
16945
|
return createCompressedTextureFallback(device, baseOptions);
|
|
16730
16946
|
}
|
|
16731
16947
|
const format = resolveCompressedTextureFormat(baseLevel);
|
|
16732
16948
|
if (!format) {
|
|
16733
|
-
|
|
16949
|
+
import_core21.log.warn("createCompressedTexture: compressed image has no textureFormat, creating fallback")();
|
|
16734
16950
|
return createCompressedTextureFallback(device, baseOptions);
|
|
16735
16951
|
}
|
|
16736
16952
|
const maxMipLevels = getMaxCompressedMipLevels(baseWidth, baseHeight, format);
|
|
@@ -16739,18 +16955,18 @@ out float vTime;
|
|
|
16739
16955
|
for (let i = 1; i < levelLimit; i++) {
|
|
16740
16956
|
const level = levels[i];
|
|
16741
16957
|
if (!level.data || level.width <= 0 || level.height <= 0) {
|
|
16742
|
-
|
|
16958
|
+
import_core21.log.warn(`createCompressedTexture: mip level ${i} has invalid data/dimensions, truncating`)();
|
|
16743
16959
|
break;
|
|
16744
16960
|
}
|
|
16745
16961
|
const levelFormat = resolveCompressedTextureFormat(level);
|
|
16746
16962
|
if (levelFormat && levelFormat !== format) {
|
|
16747
|
-
|
|
16963
|
+
import_core21.log.warn(`createCompressedTexture: mip level ${i} format '${levelFormat}' differs from base '${format}', truncating`)();
|
|
16748
16964
|
break;
|
|
16749
16965
|
}
|
|
16750
16966
|
const expectedW = Math.max(1, baseWidth >> i);
|
|
16751
16967
|
const expectedH = Math.max(1, baseHeight >> i);
|
|
16752
16968
|
if (level.width !== expectedW || level.height !== expectedH) {
|
|
16753
|
-
|
|
16969
|
+
import_core21.log.warn(`createCompressedTexture: mip level ${i} dimensions ${level.width}x${level.height} don't match expected ${expectedW}x${expectedH}, truncating`)();
|
|
16754
16970
|
break;
|
|
16755
16971
|
}
|
|
16756
16972
|
validLevelCount++;
|
|
@@ -16758,7 +16974,7 @@ out float vTime;
|
|
|
16758
16974
|
const texture = device.createTexture({
|
|
16759
16975
|
...baseOptions,
|
|
16760
16976
|
format,
|
|
16761
|
-
usage:
|
|
16977
|
+
usage: import_core21.Texture.TEXTURE | import_core21.Texture.COPY_DST,
|
|
16762
16978
|
width: baseWidth,
|
|
16763
16979
|
height: baseHeight,
|
|
16764
16980
|
mipLevels: validLevelCount,
|
|
@@ -16774,8 +16990,19 @@ out float vTime;
|
|
|
16774
16990
|
return texture;
|
|
16775
16991
|
}
|
|
16776
16992
|
|
|
16993
|
+
// ../../node_modules/@luma.gl/shadertools/dist/lib/color/normalize-byte-colors.js
|
|
16994
|
+
function resolveUseByteColors(useByteColors, defaultUseByteColors = true) {
|
|
16995
|
+
return useByteColors ?? defaultUseByteColors;
|
|
16996
|
+
}
|
|
16997
|
+
function normalizeByteColor3(color = [0, 0, 0], useByteColors = true) {
|
|
16998
|
+
if (!useByteColors) {
|
|
16999
|
+
return [...color];
|
|
17000
|
+
}
|
|
17001
|
+
return color.map((component) => component / 255);
|
|
17002
|
+
}
|
|
17003
|
+
|
|
16777
17004
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
|
|
16778
|
-
var
|
|
17005
|
+
var import_core22 = __toESM(require_core3(), 1);
|
|
16779
17006
|
|
|
16780
17007
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-glsl.js
|
|
16781
17008
|
var lightingUniformsGLSL = (
|
|
@@ -16950,7 +17177,6 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
16950
17177
|
|
|
16951
17178
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
|
|
16952
17179
|
var MAX_LIGHTS = 5;
|
|
16953
|
-
var COLOR_FACTOR = 255;
|
|
16954
17180
|
var LIGHT_UNIFORM_TYPE = {
|
|
16955
17181
|
color: "vec3<f32>",
|
|
16956
17182
|
position: "vec3<f32>",
|
|
@@ -16989,7 +17215,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
16989
17215
|
if (props.lights) {
|
|
16990
17216
|
props = { ...props, ...extractLightTypes(props.lights), lights: void 0 };
|
|
16991
17217
|
}
|
|
16992
|
-
const { ambientLight, pointLights, spotLights, directionalLights } = props || {};
|
|
17218
|
+
const { useByteColors, ambientLight, pointLights, spotLights, directionalLights } = props || {};
|
|
16993
17219
|
const hasLights = ambientLight || pointLights && pointLights.length > 0 || spotLights && spotLights.length > 0 || directionalLights && directionalLights.length > 0;
|
|
16994
17220
|
if (!hasLights) {
|
|
16995
17221
|
return {
|
|
@@ -16999,14 +17225,20 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
16999
17225
|
}
|
|
17000
17226
|
const uniforms = {
|
|
17001
17227
|
...createDefaultLightingUniforms(),
|
|
17002
|
-
...getLightSourceUniforms({
|
|
17228
|
+
...getLightSourceUniforms({
|
|
17229
|
+
useByteColors,
|
|
17230
|
+
ambientLight,
|
|
17231
|
+
pointLights,
|
|
17232
|
+
spotLights,
|
|
17233
|
+
directionalLights
|
|
17234
|
+
})
|
|
17003
17235
|
};
|
|
17004
17236
|
if (props.enabled !== void 0) {
|
|
17005
17237
|
uniforms.enabled = props.enabled ? 1 : 0;
|
|
17006
17238
|
}
|
|
17007
17239
|
return uniforms;
|
|
17008
17240
|
}
|
|
17009
|
-
function getLightSourceUniforms({ ambientLight, pointLights = [], spotLights = [], directionalLights = [] }) {
|
|
17241
|
+
function getLightSourceUniforms({ useByteColors, ambientLight, pointLights = [], spotLights = [], directionalLights = [] }) {
|
|
17010
17242
|
const lights = createDefaultLightUniforms();
|
|
17011
17243
|
let currentLight = 0;
|
|
17012
17244
|
let pointLightCount = 0;
|
|
@@ -17018,7 +17250,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17018
17250
|
}
|
|
17019
17251
|
lights[currentLight] = {
|
|
17020
17252
|
...lights[currentLight],
|
|
17021
|
-
color: convertColor(pointLight),
|
|
17253
|
+
color: convertColor(pointLight, useByteColors),
|
|
17022
17254
|
position: pointLight.position,
|
|
17023
17255
|
attenuation: pointLight.attenuation || [1, 0, 0]
|
|
17024
17256
|
};
|
|
@@ -17031,7 +17263,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17031
17263
|
}
|
|
17032
17264
|
lights[currentLight] = {
|
|
17033
17265
|
...lights[currentLight],
|
|
17034
|
-
color: convertColor(spotLight),
|
|
17266
|
+
color: convertColor(spotLight, useByteColors),
|
|
17035
17267
|
position: spotLight.position,
|
|
17036
17268
|
direction: spotLight.direction,
|
|
17037
17269
|
attenuation: spotLight.attenuation || [1, 0, 0],
|
|
@@ -17046,17 +17278,17 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17046
17278
|
}
|
|
17047
17279
|
lights[currentLight] = {
|
|
17048
17280
|
...lights[currentLight],
|
|
17049
|
-
color: convertColor(directionalLight),
|
|
17281
|
+
color: convertColor(directionalLight, useByteColors),
|
|
17050
17282
|
direction: directionalLight.direction
|
|
17051
17283
|
};
|
|
17052
17284
|
currentLight++;
|
|
17053
17285
|
directionalLightCount++;
|
|
17054
17286
|
}
|
|
17055
17287
|
if (pointLights.length + spotLights.length + directionalLights.length > MAX_LIGHTS) {
|
|
17056
|
-
|
|
17288
|
+
import_core22.log.warn(`MAX_LIGHTS exceeded, truncating to ${MAX_LIGHTS}`)();
|
|
17057
17289
|
}
|
|
17058
17290
|
return {
|
|
17059
|
-
ambientColor: convertColor(ambientLight),
|
|
17291
|
+
ambientColor: convertColor(ambientLight, useByteColors),
|
|
17060
17292
|
directionalLightCount,
|
|
17061
17293
|
pointLightCount,
|
|
17062
17294
|
spotLightCount,
|
|
@@ -17084,9 +17316,10 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17084
17316
|
}
|
|
17085
17317
|
return lightSources;
|
|
17086
17318
|
}
|
|
17087
|
-
function convertColor(colorDef = {}) {
|
|
17319
|
+
function convertColor(colorDef = {}, useByteColors) {
|
|
17088
17320
|
const { color = [0, 0, 0], intensity = 1 } = colorDef;
|
|
17089
|
-
|
|
17321
|
+
const normalizedColor = normalizeByteColor3(color, resolveUseByteColors(useByteColors, true));
|
|
17322
|
+
return normalizedColor.map((component) => component * intensity);
|
|
17090
17323
|
}
|
|
17091
17324
|
function createDefaultLightingUniforms() {
|
|
17092
17325
|
return {
|
|
@@ -17155,7 +17388,8 @@ uniform sampler2D pbr_brdfLUT;
|
|
|
17155
17388
|
var vs = (
|
|
17156
17389
|
/* glsl */
|
|
17157
17390
|
`out vec3 pbr_vPosition;
|
|
17158
|
-
out vec2
|
|
17391
|
+
out vec2 pbr_vUV0;
|
|
17392
|
+
out vec2 pbr_vUV1;
|
|
17159
17393
|
|
|
17160
17394
|
#ifdef HAS_NORMALS
|
|
17161
17395
|
# ifdef HAS_TANGENTS
|
|
@@ -17165,7 +17399,13 @@ out vec3 pbr_vNormal;
|
|
|
17165
17399
|
# endif
|
|
17166
17400
|
#endif
|
|
17167
17401
|
|
|
17168
|
-
void pbr_setPositionNormalTangentUV(
|
|
17402
|
+
void pbr_setPositionNormalTangentUV(
|
|
17403
|
+
vec4 position,
|
|
17404
|
+
vec4 normal,
|
|
17405
|
+
vec4 tangent,
|
|
17406
|
+
vec2 uv0,
|
|
17407
|
+
vec2 uv1
|
|
17408
|
+
)
|
|
17169
17409
|
{
|
|
17170
17410
|
vec4 pos = pbrProjection.modelMatrix * position;
|
|
17171
17411
|
pbr_vPosition = vec3(pos.xyz) / pos.w;
|
|
@@ -17182,10 +17422,12 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
|
|
|
17182
17422
|
#endif
|
|
17183
17423
|
|
|
17184
17424
|
#ifdef HAS_UV
|
|
17185
|
-
|
|
17425
|
+
pbr_vUV0 = uv0;
|
|
17186
17426
|
#else
|
|
17187
|
-
|
|
17427
|
+
pbr_vUV0 = vec2(0.,0.);
|
|
17188
17428
|
#endif
|
|
17429
|
+
|
|
17430
|
+
pbr_vUV1 = uv1;
|
|
17189
17431
|
}
|
|
17190
17432
|
`
|
|
17191
17433
|
);
|
|
@@ -17261,6 +17503,41 @@ layout(std140) uniform pbrMaterialUniforms {
|
|
|
17261
17503
|
vec4 scaleDiffBaseMR;
|
|
17262
17504
|
vec4 scaleFGDSpec;
|
|
17263
17505
|
// #endif
|
|
17506
|
+
|
|
17507
|
+
int baseColorUVSet;
|
|
17508
|
+
mat3 baseColorUVTransform;
|
|
17509
|
+
int metallicRoughnessUVSet;
|
|
17510
|
+
mat3 metallicRoughnessUVTransform;
|
|
17511
|
+
int normalUVSet;
|
|
17512
|
+
mat3 normalUVTransform;
|
|
17513
|
+
int occlusionUVSet;
|
|
17514
|
+
mat3 occlusionUVTransform;
|
|
17515
|
+
int emissiveUVSet;
|
|
17516
|
+
mat3 emissiveUVTransform;
|
|
17517
|
+
int specularColorUVSet;
|
|
17518
|
+
mat3 specularColorUVTransform;
|
|
17519
|
+
int specularIntensityUVSet;
|
|
17520
|
+
mat3 specularIntensityUVTransform;
|
|
17521
|
+
int transmissionUVSet;
|
|
17522
|
+
mat3 transmissionUVTransform;
|
|
17523
|
+
int thicknessUVSet;
|
|
17524
|
+
mat3 thicknessUVTransform;
|
|
17525
|
+
int clearcoatUVSet;
|
|
17526
|
+
mat3 clearcoatUVTransform;
|
|
17527
|
+
int clearcoatRoughnessUVSet;
|
|
17528
|
+
mat3 clearcoatRoughnessUVTransform;
|
|
17529
|
+
int clearcoatNormalUVSet;
|
|
17530
|
+
mat3 clearcoatNormalUVTransform;
|
|
17531
|
+
int sheenColorUVSet;
|
|
17532
|
+
mat3 sheenColorUVTransform;
|
|
17533
|
+
int sheenRoughnessUVSet;
|
|
17534
|
+
mat3 sheenRoughnessUVTransform;
|
|
17535
|
+
int iridescenceUVSet;
|
|
17536
|
+
mat3 iridescenceUVTransform;
|
|
17537
|
+
int iridescenceThicknessUVSet;
|
|
17538
|
+
mat3 iridescenceThicknessUVTransform;
|
|
17539
|
+
int anisotropyUVSet;
|
|
17540
|
+
mat3 anisotropyUVTransform;
|
|
17264
17541
|
} pbrMaterial;
|
|
17265
17542
|
|
|
17266
17543
|
// Samplers
|
|
@@ -17318,7 +17595,8 @@ uniform sampler2D pbr_anisotropySampler;
|
|
|
17318
17595
|
// Inputs from vertex shader
|
|
17319
17596
|
|
|
17320
17597
|
in vec3 pbr_vPosition;
|
|
17321
|
-
in vec2
|
|
17598
|
+
in vec2 pbr_vUV0;
|
|
17599
|
+
in vec2 pbr_vUV1;
|
|
17322
17600
|
|
|
17323
17601
|
#ifdef HAS_NORMALS
|
|
17324
17602
|
#ifdef HAS_TANGENTS
|
|
@@ -17368,14 +17646,20 @@ vec4 SRGBtoLINEAR(vec4 srgbIn)
|
|
|
17368
17646
|
#endif //MANUAL_SRGB
|
|
17369
17647
|
}
|
|
17370
17648
|
|
|
17649
|
+
vec2 getMaterialUV(int uvSet, mat3 uvTransform)
|
|
17650
|
+
{
|
|
17651
|
+
vec2 baseUV = uvSet == 1 ? pbr_vUV1 : pbr_vUV0;
|
|
17652
|
+
return (uvTransform * vec3(baseUV, 1.0)).xy;
|
|
17653
|
+
}
|
|
17654
|
+
|
|
17371
17655
|
// Build the tangent basis from interpolated attributes or screen-space derivatives.
|
|
17372
|
-
mat3 getTBN()
|
|
17656
|
+
mat3 getTBN(vec2 uv)
|
|
17373
17657
|
{
|
|
17374
17658
|
#ifndef HAS_TANGENTS
|
|
17375
17659
|
vec3 pos_dx = dFdx(pbr_vPosition);
|
|
17376
17660
|
vec3 pos_dy = dFdy(pbr_vPosition);
|
|
17377
|
-
vec3 tex_dx = dFdx(vec3(
|
|
17378
|
-
vec3 tex_dy = dFdy(vec3(
|
|
17661
|
+
vec3 tex_dx = dFdx(vec3(uv, 0.0));
|
|
17662
|
+
vec3 tex_dy = dFdy(vec3(uv, 0.0));
|
|
17379
17663
|
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
|
|
17380
17664
|
|
|
17381
17665
|
#ifdef HAS_NORMALS
|
|
@@ -17396,16 +17680,16 @@ mat3 getTBN()
|
|
|
17396
17680
|
|
|
17397
17681
|
// Find the normal for this fragment, pulling either from a predefined normal map
|
|
17398
17682
|
// or from the interpolated mesh normal and tangent attributes.
|
|
17399
|
-
vec3 getMappedNormal(sampler2D normalSampler, mat3 tbn, float normalScale)
|
|
17683
|
+
vec3 getMappedNormal(sampler2D normalSampler, mat3 tbn, float normalScale, vec2 uv)
|
|
17400
17684
|
{
|
|
17401
|
-
vec3 n = texture(normalSampler,
|
|
17685
|
+
vec3 n = texture(normalSampler, uv).rgb;
|
|
17402
17686
|
return normalize(tbn * ((2.0 * n - 1.0) * vec3(normalScale, normalScale, 1.0)));
|
|
17403
17687
|
}
|
|
17404
17688
|
|
|
17405
|
-
vec3 getNormal(mat3 tbn)
|
|
17689
|
+
vec3 getNormal(mat3 tbn, vec2 uv)
|
|
17406
17690
|
{
|
|
17407
17691
|
#ifdef HAS_NORMALMAP
|
|
17408
|
-
vec3 n = getMappedNormal(pbr_normalSampler, tbn, pbrMaterial.normalScale);
|
|
17692
|
+
vec3 n = getMappedNormal(pbr_normalSampler, tbn, pbrMaterial.normalScale, uv);
|
|
17409
17693
|
#else
|
|
17410
17694
|
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
17411
17695
|
vec3 n = normalize(tbn[2].xyz);
|
|
@@ -17414,10 +17698,10 @@ vec3 getNormal(mat3 tbn)
|
|
|
17414
17698
|
return n;
|
|
17415
17699
|
}
|
|
17416
17700
|
|
|
17417
|
-
vec3 getClearcoatNormal(mat3 tbn, vec3 baseNormal)
|
|
17701
|
+
vec3 getClearcoatNormal(mat3 tbn, vec3 baseNormal, vec2 uv)
|
|
17418
17702
|
{
|
|
17419
17703
|
#ifdef HAS_CLEARCOATNORMALMAP
|
|
17420
|
-
return getMappedNormal(pbr_clearcoatNormalSampler, tbn, 1.0);
|
|
17704
|
+
return getMappedNormal(pbr_clearcoatNormalSampler, tbn, 1.0, uv);
|
|
17421
17705
|
#else
|
|
17422
17706
|
return baseNormal;
|
|
17423
17707
|
#endif
|
|
@@ -17705,9 +17989,61 @@ vec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) {
|
|
|
17705
17989
|
|
|
17706
17990
|
vec4 pbr_filterColor(vec4 colorUnused)
|
|
17707
17991
|
{
|
|
17992
|
+
vec2 baseColorUV = getMaterialUV(pbrMaterial.baseColorUVSet, pbrMaterial.baseColorUVTransform);
|
|
17993
|
+
vec2 metallicRoughnessUV = getMaterialUV(
|
|
17994
|
+
pbrMaterial.metallicRoughnessUVSet,
|
|
17995
|
+
pbrMaterial.metallicRoughnessUVTransform
|
|
17996
|
+
);
|
|
17997
|
+
vec2 normalUV = getMaterialUV(pbrMaterial.normalUVSet, pbrMaterial.normalUVTransform);
|
|
17998
|
+
vec2 occlusionUV = getMaterialUV(pbrMaterial.occlusionUVSet, pbrMaterial.occlusionUVTransform);
|
|
17999
|
+
vec2 emissiveUV = getMaterialUV(pbrMaterial.emissiveUVSet, pbrMaterial.emissiveUVTransform);
|
|
18000
|
+
vec2 specularColorUV = getMaterialUV(
|
|
18001
|
+
pbrMaterial.specularColorUVSet,
|
|
18002
|
+
pbrMaterial.specularColorUVTransform
|
|
18003
|
+
);
|
|
18004
|
+
vec2 specularIntensityUV = getMaterialUV(
|
|
18005
|
+
pbrMaterial.specularIntensityUVSet,
|
|
18006
|
+
pbrMaterial.specularIntensityUVTransform
|
|
18007
|
+
);
|
|
18008
|
+
vec2 transmissionUV = getMaterialUV(
|
|
18009
|
+
pbrMaterial.transmissionUVSet,
|
|
18010
|
+
pbrMaterial.transmissionUVTransform
|
|
18011
|
+
);
|
|
18012
|
+
vec2 thicknessUV = getMaterialUV(pbrMaterial.thicknessUVSet, pbrMaterial.thicknessUVTransform);
|
|
18013
|
+
vec2 clearcoatUV = getMaterialUV(pbrMaterial.clearcoatUVSet, pbrMaterial.clearcoatUVTransform);
|
|
18014
|
+
vec2 clearcoatRoughnessUV = getMaterialUV(
|
|
18015
|
+
pbrMaterial.clearcoatRoughnessUVSet,
|
|
18016
|
+
pbrMaterial.clearcoatRoughnessUVTransform
|
|
18017
|
+
);
|
|
18018
|
+
vec2 clearcoatNormalUV = getMaterialUV(
|
|
18019
|
+
pbrMaterial.clearcoatNormalUVSet,
|
|
18020
|
+
pbrMaterial.clearcoatNormalUVTransform
|
|
18021
|
+
);
|
|
18022
|
+
vec2 sheenColorUV = getMaterialUV(
|
|
18023
|
+
pbrMaterial.sheenColorUVSet,
|
|
18024
|
+
pbrMaterial.sheenColorUVTransform
|
|
18025
|
+
);
|
|
18026
|
+
vec2 sheenRoughnessUV = getMaterialUV(
|
|
18027
|
+
pbrMaterial.sheenRoughnessUVSet,
|
|
18028
|
+
pbrMaterial.sheenRoughnessUVTransform
|
|
18029
|
+
);
|
|
18030
|
+
vec2 iridescenceUV = getMaterialUV(
|
|
18031
|
+
pbrMaterial.iridescenceUVSet,
|
|
18032
|
+
pbrMaterial.iridescenceUVTransform
|
|
18033
|
+
);
|
|
18034
|
+
vec2 iridescenceThicknessUV = getMaterialUV(
|
|
18035
|
+
pbrMaterial.iridescenceThicknessUVSet,
|
|
18036
|
+
pbrMaterial.iridescenceThicknessUVTransform
|
|
18037
|
+
);
|
|
18038
|
+
vec2 anisotropyUV = getMaterialUV(
|
|
18039
|
+
pbrMaterial.anisotropyUVSet,
|
|
18040
|
+
pbrMaterial.anisotropyUVTransform
|
|
18041
|
+
);
|
|
18042
|
+
|
|
17708
18043
|
// The albedo may be defined from a base texture or a flat color
|
|
17709
18044
|
#ifdef HAS_BASECOLORMAP
|
|
17710
|
-
vec4 baseColor =
|
|
18045
|
+
vec4 baseColor =
|
|
18046
|
+
SRGBtoLINEAR(texture(pbr_baseColorSampler, baseColorUV)) * pbrMaterial.baseColorFactor;
|
|
17711
18047
|
#else
|
|
17712
18048
|
vec4 baseColor = pbrMaterial.baseColorFactor;
|
|
17713
18049
|
#endif
|
|
@@ -17734,14 +18070,14 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17734
18070
|
#ifdef HAS_METALROUGHNESSMAP
|
|
17735
18071
|
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
|
|
17736
18072
|
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data
|
|
17737
|
-
vec4 mrSample = texture(pbr_metallicRoughnessSampler,
|
|
18073
|
+
vec4 mrSample = texture(pbr_metallicRoughnessSampler, metallicRoughnessUV);
|
|
17738
18074
|
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
17739
18075
|
metallic = mrSample.b * metallic;
|
|
17740
18076
|
#endif
|
|
17741
18077
|
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
|
|
17742
18078
|
metallic = clamp(metallic, 0.0, 1.0);
|
|
17743
|
-
mat3 tbn = getTBN();
|
|
17744
|
-
vec3 n = getNormal(tbn); // normal at surface point
|
|
18079
|
+
mat3 tbn = getTBN(normalUV);
|
|
18080
|
+
vec3 n = getNormal(tbn, normalUV); // normal at surface point
|
|
17745
18081
|
vec3 v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera
|
|
17746
18082
|
float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
17747
18083
|
#ifdef USE_MATERIAL_EXTENSIONS
|
|
@@ -17842,7 +18178,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17842
18178
|
|
|
17843
18179
|
#ifdef HAS_OCCLUSIONMAP
|
|
17844
18180
|
if (pbrMaterial.occlusionMapEnabled) {
|
|
17845
|
-
float ao = texture(pbr_occlusionSampler,
|
|
18181
|
+
float ao = texture(pbr_occlusionSampler, occlusionUV).r;
|
|
17846
18182
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
17847
18183
|
}
|
|
17848
18184
|
#endif
|
|
@@ -17850,7 +18186,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17850
18186
|
vec3 emissive = pbrMaterial.emissiveFactor;
|
|
17851
18187
|
#ifdef HAS_EMISSIVEMAP
|
|
17852
18188
|
if (pbrMaterial.emissiveMapEnabled) {
|
|
17853
|
-
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler,
|
|
18189
|
+
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler, emissiveUV)).rgb;
|
|
17854
18190
|
}
|
|
17855
18191
|
#endif
|
|
17856
18192
|
color += emissive * pbrMaterial.emissiveStrength;
|
|
@@ -17867,55 +18203,55 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17867
18203
|
float specularIntensity = pbrMaterial.specularIntensityFactor;
|
|
17868
18204
|
#ifdef HAS_SPECULARINTENSITYMAP
|
|
17869
18205
|
if (pbrMaterial.specularIntensityMapEnabled) {
|
|
17870
|
-
specularIntensity *= texture(pbr_specularIntensitySampler,
|
|
18206
|
+
specularIntensity *= texture(pbr_specularIntensitySampler, specularIntensityUV).a;
|
|
17871
18207
|
}
|
|
17872
18208
|
#endif
|
|
17873
18209
|
|
|
17874
18210
|
vec3 specularFactor = pbrMaterial.specularColorFactor;
|
|
17875
18211
|
#ifdef HAS_SPECULARCOLORMAP
|
|
17876
18212
|
if (pbrMaterial.specularColorMapEnabled) {
|
|
17877
|
-
specularFactor *= SRGBtoLINEAR(texture(pbr_specularColorSampler,
|
|
18213
|
+
specularFactor *= SRGBtoLINEAR(texture(pbr_specularColorSampler, specularColorUV)).rgb;
|
|
17878
18214
|
}
|
|
17879
18215
|
#endif
|
|
17880
18216
|
|
|
17881
18217
|
transmission = pbrMaterial.transmissionFactor;
|
|
17882
18218
|
#ifdef HAS_TRANSMISSIONMAP
|
|
17883
18219
|
if (pbrMaterial.transmissionMapEnabled) {
|
|
17884
|
-
transmission *= texture(pbr_transmissionSampler,
|
|
18220
|
+
transmission *= texture(pbr_transmissionSampler, transmissionUV).r;
|
|
17885
18221
|
}
|
|
17886
18222
|
#endif
|
|
17887
18223
|
transmission = clamp(transmission * (1.0 - metallic), 0.0, 1.0);
|
|
17888
18224
|
float thickness = max(pbrMaterial.thicknessFactor, 0.0);
|
|
17889
18225
|
#ifdef HAS_THICKNESSMAP
|
|
17890
|
-
thickness *= texture(pbr_thicknessSampler,
|
|
18226
|
+
thickness *= texture(pbr_thicknessSampler, thicknessUV).g;
|
|
17891
18227
|
#endif
|
|
17892
18228
|
|
|
17893
18229
|
float clearcoatFactor = pbrMaterial.clearcoatFactor;
|
|
17894
18230
|
float clearcoatRoughness = pbrMaterial.clearcoatRoughnessFactor;
|
|
17895
18231
|
#ifdef HAS_CLEARCOATMAP
|
|
17896
18232
|
if (pbrMaterial.clearcoatMapEnabled) {
|
|
17897
|
-
clearcoatFactor *= texture(pbr_clearcoatSampler,
|
|
18233
|
+
clearcoatFactor *= texture(pbr_clearcoatSampler, clearcoatUV).r;
|
|
17898
18234
|
}
|
|
17899
18235
|
#endif
|
|
17900
18236
|
#ifdef HAS_CLEARCOATROUGHNESSMAP
|
|
17901
18237
|
if (pbrMaterial.clearcoatRoughnessMapEnabled) {
|
|
17902
|
-
clearcoatRoughness *= texture(pbr_clearcoatRoughnessSampler,
|
|
18238
|
+
clearcoatRoughness *= texture(pbr_clearcoatRoughnessSampler, clearcoatRoughnessUV).g;
|
|
17903
18239
|
}
|
|
17904
18240
|
#endif
|
|
17905
18241
|
clearcoatFactor = clamp(clearcoatFactor, 0.0, 1.0);
|
|
17906
18242
|
clearcoatRoughness = clamp(clearcoatRoughness, c_MinRoughness, 1.0);
|
|
17907
|
-
vec3 clearcoatNormal = getClearcoatNormal(
|
|
18243
|
+
vec3 clearcoatNormal = getClearcoatNormal(getTBN(clearcoatNormalUV), n, clearcoatNormalUV);
|
|
17908
18244
|
|
|
17909
18245
|
vec3 sheenColor = pbrMaterial.sheenColorFactor;
|
|
17910
18246
|
float sheenRoughness = pbrMaterial.sheenRoughnessFactor;
|
|
17911
18247
|
#ifdef HAS_SHEENCOLORMAP
|
|
17912
18248
|
if (pbrMaterial.sheenColorMapEnabled) {
|
|
17913
|
-
sheenColor *= SRGBtoLINEAR(texture(pbr_sheenColorSampler,
|
|
18249
|
+
sheenColor *= SRGBtoLINEAR(texture(pbr_sheenColorSampler, sheenColorUV)).rgb;
|
|
17914
18250
|
}
|
|
17915
18251
|
#endif
|
|
17916
18252
|
#ifdef HAS_SHEENROUGHNESSMAP
|
|
17917
18253
|
if (pbrMaterial.sheenRoughnessMapEnabled) {
|
|
17918
|
-
sheenRoughness *= texture(pbr_sheenRoughnessSampler,
|
|
18254
|
+
sheenRoughness *= texture(pbr_sheenRoughnessSampler, sheenRoughnessUV).a;
|
|
17919
18255
|
}
|
|
17920
18256
|
#endif
|
|
17921
18257
|
sheenRoughness = clamp(sheenRoughness, c_MinRoughness, 1.0);
|
|
@@ -17923,7 +18259,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17923
18259
|
float iridescence = pbrMaterial.iridescenceFactor;
|
|
17924
18260
|
#ifdef HAS_IRIDESCENCEMAP
|
|
17925
18261
|
if (pbrMaterial.iridescenceMapEnabled) {
|
|
17926
|
-
iridescence *= texture(pbr_iridescenceSampler,
|
|
18262
|
+
iridescence *= texture(pbr_iridescenceSampler, iridescenceUV).r;
|
|
17927
18263
|
}
|
|
17928
18264
|
#endif
|
|
17929
18265
|
iridescence = clamp(iridescence, 0.0, 1.0);
|
|
@@ -17936,7 +18272,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17936
18272
|
iridescenceThickness = mix(
|
|
17937
18273
|
pbrMaterial.iridescenceThicknessRange.x,
|
|
17938
18274
|
pbrMaterial.iridescenceThicknessRange.y,
|
|
17939
|
-
texture(pbr_iridescenceThicknessSampler,
|
|
18275
|
+
texture(pbr_iridescenceThicknessSampler, iridescenceThicknessUV).g
|
|
17940
18276
|
);
|
|
17941
18277
|
#endif
|
|
17942
18278
|
|
|
@@ -17944,7 +18280,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17944
18280
|
vec2 anisotropyDirection = normalizeDirection(pbrMaterial.anisotropyDirection);
|
|
17945
18281
|
#ifdef HAS_ANISOTROPYMAP
|
|
17946
18282
|
if (pbrMaterial.anisotropyMapEnabled) {
|
|
17947
|
-
vec3 anisotropySample = texture(pbr_anisotropySampler,
|
|
18283
|
+
vec3 anisotropySample = texture(pbr_anisotropySampler, anisotropyUV).rgb;
|
|
17948
18284
|
anisotropyStrength *= anisotropySample.b;
|
|
17949
18285
|
vec2 mappedDirection = anisotropySample.rg * 2.0 - 1.0;
|
|
17950
18286
|
if (length(mappedDirection) > 0.0001) {
|
|
@@ -18107,7 +18443,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
18107
18443
|
// Apply optional PBR terms for additional (optional) shading
|
|
18108
18444
|
#ifdef HAS_OCCLUSIONMAP
|
|
18109
18445
|
if (pbrMaterial.occlusionMapEnabled) {
|
|
18110
|
-
float ao = texture(pbr_occlusionSampler,
|
|
18446
|
+
float ao = texture(pbr_occlusionSampler, occlusionUV).r;
|
|
18111
18447
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
18112
18448
|
}
|
|
18113
18449
|
#endif
|
|
@@ -18115,7 +18451,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
18115
18451
|
vec3 emissive = pbrMaterial.emissiveFactor;
|
|
18116
18452
|
#ifdef HAS_EMISSIVEMAP
|
|
18117
18453
|
if (pbrMaterial.emissiveMapEnabled) {
|
|
18118
|
-
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler,
|
|
18454
|
+
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler, emissiveUV)).rgb;
|
|
18119
18455
|
}
|
|
18120
18456
|
#endif
|
|
18121
18457
|
color += emissive * pbrMaterial.emissiveStrength;
|
|
@@ -18153,14 +18489,21 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
18153
18489
|
/* wgsl */
|
|
18154
18490
|
`struct PBRFragmentInputs {
|
|
18155
18491
|
pbr_vPosition: vec3f,
|
|
18156
|
-
|
|
18492
|
+
pbr_vUV0: vec2f,
|
|
18493
|
+
pbr_vUV1: vec2f,
|
|
18157
18494
|
pbr_vTBN: mat3x3f,
|
|
18158
18495
|
pbr_vNormal: vec3f
|
|
18159
18496
|
};
|
|
18160
18497
|
|
|
18161
18498
|
var<private> fragmentInputs: PBRFragmentInputs;
|
|
18162
18499
|
|
|
18163
|
-
fn pbr_setPositionNormalTangentUV(
|
|
18500
|
+
fn pbr_setPositionNormalTangentUV(
|
|
18501
|
+
position: vec4f,
|
|
18502
|
+
normal: vec4f,
|
|
18503
|
+
tangent: vec4f,
|
|
18504
|
+
uv0: vec2f,
|
|
18505
|
+
uv1: vec2f
|
|
18506
|
+
)
|
|
18164
18507
|
{
|
|
18165
18508
|
var pos: vec4f = pbrProjection.modelMatrix * position;
|
|
18166
18509
|
fragmentInputs.pbr_vPosition = pos.xyz / pos.w;
|
|
@@ -18170,7 +18513,8 @@ fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f
|
|
|
18170
18513
|
vec3f(0.0, 1.0, 0.0),
|
|
18171
18514
|
vec3f(0.0, 0.0, 1.0)
|
|
18172
18515
|
);
|
|
18173
|
-
fragmentInputs.
|
|
18516
|
+
fragmentInputs.pbr_vUV0 = vec2f(0.0, 0.0);
|
|
18517
|
+
fragmentInputs.pbr_vUV1 = uv1;
|
|
18174
18518
|
|
|
18175
18519
|
#ifdef HAS_NORMALS
|
|
18176
18520
|
let normalW: vec3f = normalize((pbrProjection.normalMatrix * vec4f(normal.xyz, 0.0)).xyz);
|
|
@@ -18183,7 +18527,7 @@ fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f
|
|
|
18183
18527
|
#endif
|
|
18184
18528
|
|
|
18185
18529
|
#ifdef HAS_UV
|
|
18186
|
-
fragmentInputs.
|
|
18530
|
+
fragmentInputs.pbr_vUV0 = uv0;
|
|
18187
18531
|
#endif
|
|
18188
18532
|
}
|
|
18189
18533
|
|
|
@@ -18255,6 +18599,41 @@ struct pbrMaterialUniforms {
|
|
|
18255
18599
|
scaleDiffBaseMR: vec4f,
|
|
18256
18600
|
scaleFGDSpec: vec4f,
|
|
18257
18601
|
// #endif
|
|
18602
|
+
|
|
18603
|
+
baseColorUVSet: i32,
|
|
18604
|
+
baseColorUVTransform: mat3x3f,
|
|
18605
|
+
metallicRoughnessUVSet: i32,
|
|
18606
|
+
metallicRoughnessUVTransform: mat3x3f,
|
|
18607
|
+
normalUVSet: i32,
|
|
18608
|
+
normalUVTransform: mat3x3f,
|
|
18609
|
+
occlusionUVSet: i32,
|
|
18610
|
+
occlusionUVTransform: mat3x3f,
|
|
18611
|
+
emissiveUVSet: i32,
|
|
18612
|
+
emissiveUVTransform: mat3x3f,
|
|
18613
|
+
specularColorUVSet: i32,
|
|
18614
|
+
specularColorUVTransform: mat3x3f,
|
|
18615
|
+
specularIntensityUVSet: i32,
|
|
18616
|
+
specularIntensityUVTransform: mat3x3f,
|
|
18617
|
+
transmissionUVSet: i32,
|
|
18618
|
+
transmissionUVTransform: mat3x3f,
|
|
18619
|
+
thicknessUVSet: i32,
|
|
18620
|
+
thicknessUVTransform: mat3x3f,
|
|
18621
|
+
clearcoatUVSet: i32,
|
|
18622
|
+
clearcoatUVTransform: mat3x3f,
|
|
18623
|
+
clearcoatRoughnessUVSet: i32,
|
|
18624
|
+
clearcoatRoughnessUVTransform: mat3x3f,
|
|
18625
|
+
clearcoatNormalUVSet: i32,
|
|
18626
|
+
clearcoatNormalUVTransform: mat3x3f,
|
|
18627
|
+
sheenColorUVSet: i32,
|
|
18628
|
+
sheenColorUVTransform: mat3x3f,
|
|
18629
|
+
sheenRoughnessUVSet: i32,
|
|
18630
|
+
sheenRoughnessUVTransform: mat3x3f,
|
|
18631
|
+
iridescenceUVSet: i32,
|
|
18632
|
+
iridescenceUVTransform: mat3x3f,
|
|
18633
|
+
iridescenceThicknessUVSet: i32,
|
|
18634
|
+
iridescenceThicknessUVTransform: mat3x3f,
|
|
18635
|
+
anisotropyUVSet: i32,
|
|
18636
|
+
anisotropyUVTransform: mat3x3f,
|
|
18258
18637
|
}
|
|
18259
18638
|
|
|
18260
18639
|
@group(3) @binding(auto) var<uniform> pbrMaterial : pbrMaterialUniforms;
|
|
@@ -18368,13 +18747,22 @@ fn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f
|
|
|
18368
18747
|
return vec4f(linOut, srgbIn.w);
|
|
18369
18748
|
}
|
|
18370
18749
|
|
|
18750
|
+
fn getMaterialUV(uvSet: i32, uvTransform: mat3x3f) -> vec2f
|
|
18751
|
+
{
|
|
18752
|
+
var baseUV = fragmentInputs.pbr_vUV0;
|
|
18753
|
+
if (uvSet == 1) {
|
|
18754
|
+
baseUV = fragmentInputs.pbr_vUV1;
|
|
18755
|
+
}
|
|
18756
|
+
return (uvTransform * vec3f(baseUV, 1.0)).xy;
|
|
18757
|
+
}
|
|
18758
|
+
|
|
18371
18759
|
// Build the tangent basis from interpolated attributes or screen-space derivatives.
|
|
18372
|
-
fn getTBN() -> mat3x3f
|
|
18760
|
+
fn getTBN(uv: vec2f) -> mat3x3f
|
|
18373
18761
|
{
|
|
18374
18762
|
let pos_dx: vec3f = dpdx(fragmentInputs.pbr_vPosition);
|
|
18375
18763
|
let pos_dy: vec3f = dpdy(fragmentInputs.pbr_vPosition);
|
|
18376
|
-
let tex_dx: vec3f = dpdx(vec3f(
|
|
18377
|
-
let tex_dy: vec3f = dpdy(vec3f(
|
|
18764
|
+
let tex_dx: vec3f = dpdx(vec3f(uv, 0.0));
|
|
18765
|
+
let tex_dy: vec3f = dpdy(vec3f(uv, 0.0));
|
|
18378
18766
|
var t: vec3f = (tex_dy.y * pos_dx - tex_dx.y * pos_dy) / (tex_dx.x * tex_dy.y - tex_dy.x * tex_dx.y);
|
|
18379
18767
|
|
|
18380
18768
|
var ng: vec3f = cross(pos_dx, pos_dy);
|
|
@@ -18397,14 +18785,15 @@ fn getMappedNormal(
|
|
|
18397
18785
|
normalSampler: texture_2d<f32>,
|
|
18398
18786
|
normalSamplerBinding: sampler,
|
|
18399
18787
|
tbn: mat3x3f,
|
|
18400
|
-
normalScale: f32
|
|
18788
|
+
normalScale: f32,
|
|
18789
|
+
uv: vec2f
|
|
18401
18790
|
) -> vec3f
|
|
18402
18791
|
{
|
|
18403
|
-
let n = textureSample(normalSampler, normalSamplerBinding,
|
|
18792
|
+
let n = textureSample(normalSampler, normalSamplerBinding, uv).rgb;
|
|
18404
18793
|
return normalize(tbn * ((2.0 * n - 1.0) * vec3f(normalScale, normalScale, 1.0)));
|
|
18405
18794
|
}
|
|
18406
18795
|
|
|
18407
|
-
fn getNormal(tbn: mat3x3f) -> vec3f
|
|
18796
|
+
fn getNormal(tbn: mat3x3f, uv: vec2f) -> vec3f
|
|
18408
18797
|
{
|
|
18409
18798
|
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
18410
18799
|
var n: vec3f = normalize(tbn[2].xyz);
|
|
@@ -18413,21 +18802,23 @@ fn getNormal(tbn: mat3x3f) -> vec3f
|
|
|
18413
18802
|
pbr_normalSampler,
|
|
18414
18803
|
pbr_normalSamplerSampler,
|
|
18415
18804
|
tbn,
|
|
18416
|
-
pbrMaterial.normalScale
|
|
18805
|
+
pbrMaterial.normalScale,
|
|
18806
|
+
uv
|
|
18417
18807
|
);
|
|
18418
18808
|
#endif
|
|
18419
18809
|
|
|
18420
18810
|
return n;
|
|
18421
18811
|
}
|
|
18422
18812
|
|
|
18423
|
-
fn getClearcoatNormal(tbn: mat3x3f, baseNormal: vec3f) -> vec3f
|
|
18813
|
+
fn getClearcoatNormal(tbn: mat3x3f, baseNormal: vec3f, uv: vec2f) -> vec3f
|
|
18424
18814
|
{
|
|
18425
18815
|
#ifdef HAS_CLEARCOATNORMALMAP
|
|
18426
18816
|
return getMappedNormal(
|
|
18427
18817
|
pbr_clearcoatNormalSampler,
|
|
18428
18818
|
pbr_clearcoatNormalSamplerSampler,
|
|
18429
18819
|
tbn,
|
|
18430
|
-
1.0
|
|
18820
|
+
1.0,
|
|
18821
|
+
uv
|
|
18431
18822
|
);
|
|
18432
18823
|
#else
|
|
18433
18824
|
return baseNormal;
|
|
@@ -18732,11 +19123,62 @@ fn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {
|
|
|
18732
19123
|
}
|
|
18733
19124
|
|
|
18734
19125
|
fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
19126
|
+
let baseColorUV = getMaterialUV(pbrMaterial.baseColorUVSet, pbrMaterial.baseColorUVTransform);
|
|
19127
|
+
let metallicRoughnessUV = getMaterialUV(
|
|
19128
|
+
pbrMaterial.metallicRoughnessUVSet,
|
|
19129
|
+
pbrMaterial.metallicRoughnessUVTransform
|
|
19130
|
+
);
|
|
19131
|
+
let normalUV = getMaterialUV(pbrMaterial.normalUVSet, pbrMaterial.normalUVTransform);
|
|
19132
|
+
let occlusionUV = getMaterialUV(pbrMaterial.occlusionUVSet, pbrMaterial.occlusionUVTransform);
|
|
19133
|
+
let emissiveUV = getMaterialUV(pbrMaterial.emissiveUVSet, pbrMaterial.emissiveUVTransform);
|
|
19134
|
+
let specularColorUV = getMaterialUV(
|
|
19135
|
+
pbrMaterial.specularColorUVSet,
|
|
19136
|
+
pbrMaterial.specularColorUVTransform
|
|
19137
|
+
);
|
|
19138
|
+
let specularIntensityUV = getMaterialUV(
|
|
19139
|
+
pbrMaterial.specularIntensityUVSet,
|
|
19140
|
+
pbrMaterial.specularIntensityUVTransform
|
|
19141
|
+
);
|
|
19142
|
+
let transmissionUV = getMaterialUV(
|
|
19143
|
+
pbrMaterial.transmissionUVSet,
|
|
19144
|
+
pbrMaterial.transmissionUVTransform
|
|
19145
|
+
);
|
|
19146
|
+
let thicknessUV = getMaterialUV(pbrMaterial.thicknessUVSet, pbrMaterial.thicknessUVTransform);
|
|
19147
|
+
let clearcoatUV = getMaterialUV(pbrMaterial.clearcoatUVSet, pbrMaterial.clearcoatUVTransform);
|
|
19148
|
+
let clearcoatRoughnessUV = getMaterialUV(
|
|
19149
|
+
pbrMaterial.clearcoatRoughnessUVSet,
|
|
19150
|
+
pbrMaterial.clearcoatRoughnessUVTransform
|
|
19151
|
+
);
|
|
19152
|
+
let clearcoatNormalUV = getMaterialUV(
|
|
19153
|
+
pbrMaterial.clearcoatNormalUVSet,
|
|
19154
|
+
pbrMaterial.clearcoatNormalUVTransform
|
|
19155
|
+
);
|
|
19156
|
+
let sheenColorUV = getMaterialUV(
|
|
19157
|
+
pbrMaterial.sheenColorUVSet,
|
|
19158
|
+
pbrMaterial.sheenColorUVTransform
|
|
19159
|
+
);
|
|
19160
|
+
let sheenRoughnessUV = getMaterialUV(
|
|
19161
|
+
pbrMaterial.sheenRoughnessUVSet,
|
|
19162
|
+
pbrMaterial.sheenRoughnessUVTransform
|
|
19163
|
+
);
|
|
19164
|
+
let iridescenceUV = getMaterialUV(
|
|
19165
|
+
pbrMaterial.iridescenceUVSet,
|
|
19166
|
+
pbrMaterial.iridescenceUVTransform
|
|
19167
|
+
);
|
|
19168
|
+
let iridescenceThicknessUV = getMaterialUV(
|
|
19169
|
+
pbrMaterial.iridescenceThicknessUVSet,
|
|
19170
|
+
pbrMaterial.iridescenceThicknessUVTransform
|
|
19171
|
+
);
|
|
19172
|
+
let anisotropyUV = getMaterialUV(
|
|
19173
|
+
pbrMaterial.anisotropyUVSet,
|
|
19174
|
+
pbrMaterial.anisotropyUVTransform
|
|
19175
|
+
);
|
|
19176
|
+
|
|
18735
19177
|
// The albedo may be defined from a base texture or a flat color
|
|
18736
19178
|
var baseColor: vec4<f32> = pbrMaterial.baseColorFactor;
|
|
18737
19179
|
#ifdef HAS_BASECOLORMAP
|
|
18738
19180
|
baseColor = SRGBtoLINEAR(
|
|
18739
|
-
textureSample(pbr_baseColorSampler, pbr_baseColorSamplerSampler,
|
|
19181
|
+
textureSample(pbr_baseColorSampler, pbr_baseColorSamplerSampler, baseColorUV)
|
|
18740
19182
|
) * pbrMaterial.baseColorFactor;
|
|
18741
19183
|
#endif
|
|
18742
19184
|
|
|
@@ -18763,15 +19205,15 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18763
19205
|
let mrSample = textureSample(
|
|
18764
19206
|
pbr_metallicRoughnessSampler,
|
|
18765
19207
|
pbr_metallicRoughnessSamplerSampler,
|
|
18766
|
-
|
|
19208
|
+
metallicRoughnessUV
|
|
18767
19209
|
);
|
|
18768
19210
|
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
18769
19211
|
metallic = mrSample.b * metallic;
|
|
18770
19212
|
#endif
|
|
18771
19213
|
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
|
|
18772
19214
|
metallic = clamp(metallic, 0.0, 1.0);
|
|
18773
|
-
let tbn = getTBN();
|
|
18774
|
-
let n = getNormal(tbn); // normal at surface point
|
|
19215
|
+
let tbn = getTBN(normalUV);
|
|
19216
|
+
let n = getNormal(tbn, normalUV); // normal at surface point
|
|
18775
19217
|
let v = normalize(pbrProjection.camera - fragmentInputs.pbr_vPosition); // Vector from surface point to camera
|
|
18776
19218
|
let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
18777
19219
|
var useExtendedPBR = false;
|
|
@@ -18876,8 +19318,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18876
19318
|
|
|
18877
19319
|
#ifdef HAS_OCCLUSIONMAP
|
|
18878
19320
|
if (pbrMaterial.occlusionMapEnabled != 0) {
|
|
18879
|
-
let ao =
|
|
18880
|
-
textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, fragmentInputs.pbr_vUV).r;
|
|
19321
|
+
let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, occlusionUV).r;
|
|
18881
19322
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
18882
19323
|
}
|
|
18883
19324
|
#endif
|
|
@@ -18886,7 +19327,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18886
19327
|
#ifdef HAS_EMISSIVEMAP
|
|
18887
19328
|
if (pbrMaterial.emissiveMapEnabled != 0u) {
|
|
18888
19329
|
emissive *= SRGBtoLINEAR(
|
|
18889
|
-
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler,
|
|
19330
|
+
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler, emissiveUV)
|
|
18890
19331
|
).rgb;
|
|
18891
19332
|
}
|
|
18892
19333
|
#endif
|
|
@@ -18907,7 +19348,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18907
19348
|
specularIntensity *= textureSample(
|
|
18908
19349
|
pbr_specularIntensitySampler,
|
|
18909
19350
|
pbr_specularIntensitySamplerSampler,
|
|
18910
|
-
|
|
19351
|
+
specularIntensityUV
|
|
18911
19352
|
).a;
|
|
18912
19353
|
}
|
|
18913
19354
|
#endif
|
|
@@ -18919,7 +19360,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18919
19360
|
textureSample(
|
|
18920
19361
|
pbr_specularColorSampler,
|
|
18921
19362
|
pbr_specularColorSamplerSampler,
|
|
18922
|
-
|
|
19363
|
+
specularColorUV
|
|
18923
19364
|
)
|
|
18924
19365
|
).rgb;
|
|
18925
19366
|
}
|
|
@@ -18931,7 +19372,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18931
19372
|
transmission *= textureSample(
|
|
18932
19373
|
pbr_transmissionSampler,
|
|
18933
19374
|
pbr_transmissionSamplerSampler,
|
|
18934
|
-
|
|
19375
|
+
transmissionUV
|
|
18935
19376
|
).r;
|
|
18936
19377
|
}
|
|
18937
19378
|
#endif
|
|
@@ -18941,7 +19382,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18941
19382
|
thickness *= textureSample(
|
|
18942
19383
|
pbr_thicknessSampler,
|
|
18943
19384
|
pbr_thicknessSamplerSampler,
|
|
18944
|
-
|
|
19385
|
+
thicknessUV
|
|
18945
19386
|
).g;
|
|
18946
19387
|
#endif
|
|
18947
19388
|
|
|
@@ -18952,7 +19393,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18952
19393
|
clearcoatFactor *= textureSample(
|
|
18953
19394
|
pbr_clearcoatSampler,
|
|
18954
19395
|
pbr_clearcoatSamplerSampler,
|
|
18955
|
-
|
|
19396
|
+
clearcoatUV
|
|
18956
19397
|
).r;
|
|
18957
19398
|
}
|
|
18958
19399
|
#endif
|
|
@@ -18961,13 +19402,13 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18961
19402
|
clearcoatRoughness *= textureSample(
|
|
18962
19403
|
pbr_clearcoatRoughnessSampler,
|
|
18963
19404
|
pbr_clearcoatRoughnessSamplerSampler,
|
|
18964
|
-
|
|
19405
|
+
clearcoatRoughnessUV
|
|
18965
19406
|
).g;
|
|
18966
19407
|
}
|
|
18967
19408
|
#endif
|
|
18968
19409
|
clearcoatFactor = clamp(clearcoatFactor, 0.0, 1.0);
|
|
18969
19410
|
clearcoatRoughness = clamp(clearcoatRoughness, c_MinRoughness, 1.0);
|
|
18970
|
-
let clearcoatNormal = getClearcoatNormal(
|
|
19411
|
+
let clearcoatNormal = getClearcoatNormal(getTBN(clearcoatNormalUV), n, clearcoatNormalUV);
|
|
18971
19412
|
|
|
18972
19413
|
var sheenColor = pbrMaterial.sheenColorFactor;
|
|
18973
19414
|
var sheenRoughness = pbrMaterial.sheenRoughnessFactor;
|
|
@@ -18977,7 +19418,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18977
19418
|
textureSample(
|
|
18978
19419
|
pbr_sheenColorSampler,
|
|
18979
19420
|
pbr_sheenColorSamplerSampler,
|
|
18980
|
-
|
|
19421
|
+
sheenColorUV
|
|
18981
19422
|
)
|
|
18982
19423
|
).rgb;
|
|
18983
19424
|
}
|
|
@@ -18987,7 +19428,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18987
19428
|
sheenRoughness *= textureSample(
|
|
18988
19429
|
pbr_sheenRoughnessSampler,
|
|
18989
19430
|
pbr_sheenRoughnessSamplerSampler,
|
|
18990
|
-
|
|
19431
|
+
sheenRoughnessUV
|
|
18991
19432
|
).a;
|
|
18992
19433
|
}
|
|
18993
19434
|
#endif
|
|
@@ -18999,7 +19440,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18999
19440
|
iridescence *= textureSample(
|
|
19000
19441
|
pbr_iridescenceSampler,
|
|
19001
19442
|
pbr_iridescenceSamplerSampler,
|
|
19002
|
-
|
|
19443
|
+
iridescenceUV
|
|
19003
19444
|
).r;
|
|
19004
19445
|
}
|
|
19005
19446
|
#endif
|
|
@@ -19016,7 +19457,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19016
19457
|
textureSample(
|
|
19017
19458
|
pbr_iridescenceThicknessSampler,
|
|
19018
19459
|
pbr_iridescenceThicknessSamplerSampler,
|
|
19019
|
-
|
|
19460
|
+
iridescenceThicknessUV
|
|
19020
19461
|
).g
|
|
19021
19462
|
);
|
|
19022
19463
|
#endif
|
|
@@ -19028,7 +19469,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19028
19469
|
let anisotropySample = textureSample(
|
|
19029
19470
|
pbr_anisotropySampler,
|
|
19030
19471
|
pbr_anisotropySamplerSampler,
|
|
19031
|
-
|
|
19472
|
+
anisotropyUV
|
|
19032
19473
|
).rgb;
|
|
19033
19474
|
anisotropyStrength *= anisotropySample.b;
|
|
19034
19475
|
let mappedDirection = anisotropySample.rg * 2.0 - 1.0;
|
|
@@ -19195,8 +19636,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19195
19636
|
// Apply optional PBR terms for additional (optional) shading
|
|
19196
19637
|
#ifdef HAS_OCCLUSIONMAP
|
|
19197
19638
|
if (pbrMaterial.occlusionMapEnabled != 0) {
|
|
19198
|
-
let ao =
|
|
19199
|
-
textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, fragmentInputs.pbr_vUV).r;
|
|
19639
|
+
let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, occlusionUV).r;
|
|
19200
19640
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
19201
19641
|
}
|
|
19202
19642
|
#endif
|
|
@@ -19205,7 +19645,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19205
19645
|
#ifdef HAS_EMISSIVEMAP
|
|
19206
19646
|
if (pbrMaterial.emissiveMapEnabled != 0u) {
|
|
19207
19647
|
emissive *= SRGBtoLINEAR(
|
|
19208
|
-
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler,
|
|
19648
|
+
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler, emissiveUV)
|
|
19209
19649
|
).rgb;
|
|
19210
19650
|
}
|
|
19211
19651
|
#endif
|
|
@@ -19325,7 +19765,41 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19325
19765
|
anisotropyRotation: 0,
|
|
19326
19766
|
anisotropyDirection: [1, 0],
|
|
19327
19767
|
anisotropyMapEnabled: false,
|
|
19328
|
-
emissiveStrength: 1
|
|
19768
|
+
emissiveStrength: 1,
|
|
19769
|
+
baseColorUVSet: 0,
|
|
19770
|
+
baseColorUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19771
|
+
metallicRoughnessUVSet: 0,
|
|
19772
|
+
metallicRoughnessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19773
|
+
normalUVSet: 0,
|
|
19774
|
+
normalUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19775
|
+
occlusionUVSet: 0,
|
|
19776
|
+
occlusionUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19777
|
+
emissiveUVSet: 0,
|
|
19778
|
+
emissiveUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19779
|
+
specularColorUVSet: 0,
|
|
19780
|
+
specularColorUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19781
|
+
specularIntensityUVSet: 0,
|
|
19782
|
+
specularIntensityUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19783
|
+
transmissionUVSet: 0,
|
|
19784
|
+
transmissionUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19785
|
+
thicknessUVSet: 0,
|
|
19786
|
+
thicknessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19787
|
+
clearcoatUVSet: 0,
|
|
19788
|
+
clearcoatUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19789
|
+
clearcoatRoughnessUVSet: 0,
|
|
19790
|
+
clearcoatRoughnessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19791
|
+
clearcoatNormalUVSet: 0,
|
|
19792
|
+
clearcoatNormalUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19793
|
+
sheenColorUVSet: 0,
|
|
19794
|
+
sheenColorUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19795
|
+
sheenRoughnessUVSet: 0,
|
|
19796
|
+
sheenRoughnessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19797
|
+
iridescenceUVSet: 0,
|
|
19798
|
+
iridescenceUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19799
|
+
iridescenceThicknessUVSet: 0,
|
|
19800
|
+
iridescenceThicknessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19801
|
+
anisotropyUVSet: 0,
|
|
19802
|
+
anisotropyUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
19329
19803
|
},
|
|
19330
19804
|
name: "pbrMaterial",
|
|
19331
19805
|
firstBindingSlot: 0,
|
|
@@ -19432,7 +19906,41 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19432
19906
|
// debugging flags used for shader output of intermediate PBR variables
|
|
19433
19907
|
// #ifdef PBR_DEBUG
|
|
19434
19908
|
scaleDiffBaseMR: "vec4<f32>",
|
|
19435
|
-
scaleFGDSpec: "vec4<f32>"
|
|
19909
|
+
scaleFGDSpec: "vec4<f32>",
|
|
19910
|
+
baseColorUVSet: "i32",
|
|
19911
|
+
baseColorUVTransform: "mat3x3<f32>",
|
|
19912
|
+
metallicRoughnessUVSet: "i32",
|
|
19913
|
+
metallicRoughnessUVTransform: "mat3x3<f32>",
|
|
19914
|
+
normalUVSet: "i32",
|
|
19915
|
+
normalUVTransform: "mat3x3<f32>",
|
|
19916
|
+
occlusionUVSet: "i32",
|
|
19917
|
+
occlusionUVTransform: "mat3x3<f32>",
|
|
19918
|
+
emissiveUVSet: "i32",
|
|
19919
|
+
emissiveUVTransform: "mat3x3<f32>",
|
|
19920
|
+
specularColorUVSet: "i32",
|
|
19921
|
+
specularColorUVTransform: "mat3x3<f32>",
|
|
19922
|
+
specularIntensityUVSet: "i32",
|
|
19923
|
+
specularIntensityUVTransform: "mat3x3<f32>",
|
|
19924
|
+
transmissionUVSet: "i32",
|
|
19925
|
+
transmissionUVTransform: "mat3x3<f32>",
|
|
19926
|
+
thicknessUVSet: "i32",
|
|
19927
|
+
thicknessUVTransform: "mat3x3<f32>",
|
|
19928
|
+
clearcoatUVSet: "i32",
|
|
19929
|
+
clearcoatUVTransform: "mat3x3<f32>",
|
|
19930
|
+
clearcoatRoughnessUVSet: "i32",
|
|
19931
|
+
clearcoatRoughnessUVTransform: "mat3x3<f32>",
|
|
19932
|
+
clearcoatNormalUVSet: "i32",
|
|
19933
|
+
clearcoatNormalUVTransform: "mat3x3<f32>",
|
|
19934
|
+
sheenColorUVSet: "i32",
|
|
19935
|
+
sheenColorUVTransform: "mat3x3<f32>",
|
|
19936
|
+
sheenRoughnessUVSet: "i32",
|
|
19937
|
+
sheenRoughnessUVTransform: "mat3x3<f32>",
|
|
19938
|
+
iridescenceUVSet: "i32",
|
|
19939
|
+
iridescenceUVTransform: "mat3x3<f32>",
|
|
19940
|
+
iridescenceThicknessUVSet: "i32",
|
|
19941
|
+
iridescenceThicknessUVTransform: "mat3x3<f32>",
|
|
19942
|
+
anisotropyUVSet: "i32",
|
|
19943
|
+
anisotropyUVTransform: "mat3x3<f32>"
|
|
19436
19944
|
}
|
|
19437
19945
|
};
|
|
19438
19946
|
|
|
@@ -19524,11 +20032,12 @@ void main(void) {
|
|
|
19524
20032
|
#endif
|
|
19525
20033
|
|
|
19526
20034
|
#ifdef HAS_UV
|
|
19527
|
-
|
|
20035
|
+
pbr_vUV0 = uv;
|
|
19528
20036
|
#else
|
|
19529
|
-
|
|
20037
|
+
pbr_vUV0 = vec2(0., 0.);
|
|
19530
20038
|
#endif
|
|
19531
|
-
|
|
20039
|
+
pbr_vUV1 = vec2(0., 0.);
|
|
20040
|
+
geometry.uv = pbr_vUV0;
|
|
19532
20041
|
#endif
|
|
19533
20042
|
|
|
19534
20043
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
@@ -19556,7 +20065,7 @@ void main(void) {
|
|
|
19556
20065
|
#ifdef MODULE_PBRMATERIAL
|
|
19557
20066
|
|
|
19558
20067
|
fragColor = vColor * pbr_filterColor(vec4(0));
|
|
19559
|
-
geometry.uv =
|
|
20068
|
+
geometry.uv = pbr_vUV0;
|
|
19560
20069
|
fragColor.a *= layer.opacity;
|
|
19561
20070
|
|
|
19562
20071
|
#else
|
|
@@ -19723,7 +20232,7 @@ void main(void) {
|
|
|
19723
20232
|
MeshLayer.defaultProps = defaultProps11;
|
|
19724
20233
|
|
|
19725
20234
|
// src/tile-3d-layer/tile-3d-layer.ts
|
|
19726
|
-
var
|
|
20235
|
+
var import_core48 = __toESM(require_core2(), 1);
|
|
19727
20236
|
|
|
19728
20237
|
// ../../node_modules/@math.gl/geospatial/dist/constants.js
|
|
19729
20238
|
var WGS84_RADIUS_X = 6378137;
|
|
@@ -20439,7 +20948,7 @@ void main(void) {
|
|
|
20439
20948
|
}
|
|
20440
20949
|
|
|
20441
20950
|
// ../../node_modules/@loaders.gl/tiles/dist/tileset/tile-3d.js
|
|
20442
|
-
var
|
|
20951
|
+
var import_core34 = __toESM(require_core2(), 1);
|
|
20443
20952
|
|
|
20444
20953
|
// ../../node_modules/@loaders.gl/tiles/dist/constants.js
|
|
20445
20954
|
var TILE_CONTENT_STATE = {
|
|
@@ -21412,7 +21921,7 @@ void main(void) {
|
|
|
21412
21921
|
}
|
|
21413
21922
|
// TODO add typecheck - as const satisfies ...
|
|
21414
21923
|
};
|
|
21415
|
-
this.content = await (0,
|
|
21924
|
+
this.content = await (0, import_core34.load)(contentUrl, loader, options);
|
|
21416
21925
|
if (this.tileset.options.contentLoader) {
|
|
21417
21926
|
await this.tileset.options.contentLoader(this);
|
|
21418
21927
|
}
|
|
@@ -21696,7 +22205,7 @@ void main(void) {
|
|
|
21696
22205
|
};
|
|
21697
22206
|
|
|
21698
22207
|
// ../../node_modules/@loaders.gl/tiles/dist/tileset/format-i3s/i3s-tileset-traverser.js
|
|
21699
|
-
var
|
|
22208
|
+
var import_core35 = __toESM(require_core2(), 1);
|
|
21700
22209
|
|
|
21701
22210
|
// ../../node_modules/@loaders.gl/tiles/dist/tileset/format-i3s/i3s-pending-tiles-register.js
|
|
21702
22211
|
var I3SPendingTilesRegister = class {
|
|
@@ -21860,7 +22369,7 @@ void main(void) {
|
|
|
21860
22369
|
isTileHeader: true
|
|
21861
22370
|
}
|
|
21862
22371
|
};
|
|
21863
|
-
return await (0,
|
|
22372
|
+
return await (0, import_core35.load)(nodeUrl, loader, options);
|
|
21864
22373
|
}
|
|
21865
22374
|
/**
|
|
21866
22375
|
* The callback to init Tile3D instance after loading the tile JSON
|
|
@@ -22587,7 +23096,7 @@ void main(void) {
|
|
|
22587
23096
|
};
|
|
22588
23097
|
|
|
22589
23098
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/utils/version.js
|
|
22590
|
-
var VERSION9 = true ? "4.4.
|
|
23099
|
+
var VERSION9 = true ? "4.4.1" : "latest";
|
|
22591
23100
|
|
|
22592
23101
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/constants.js
|
|
22593
23102
|
var TILE3D_TYPE = {
|
|
@@ -22706,7 +23215,7 @@ void main(void) {
|
|
|
22706
23215
|
}
|
|
22707
23216
|
|
|
22708
23217
|
// ../../node_modules/@loaders.gl/draco/dist/lib/utils/version.js
|
|
22709
|
-
var VERSION10 = true ? "4.4.
|
|
23218
|
+
var VERSION10 = true ? "4.4.1" : "latest";
|
|
22710
23219
|
|
|
22711
23220
|
// ../../node_modules/@loaders.gl/schema-utils/dist/lib/schema/data-type.js
|
|
22712
23221
|
function getDataTypeFromTypedArray(array) {
|
|
@@ -26142,7 +26651,7 @@ void main(void) {
|
|
|
26142
26651
|
}
|
|
26143
26652
|
|
|
26144
26653
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/utils/version.js
|
|
26145
|
-
var VERSION11 = true ? "4.4.
|
|
26654
|
+
var VERSION11 = true ? "4.4.1" : "latest";
|
|
26146
26655
|
|
|
26147
26656
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/parsers/parse-glb.js
|
|
26148
26657
|
var LITTLE_ENDIAN2 = true;
|
|
@@ -26255,16 +26764,26 @@ void main(void) {
|
|
|
26255
26764
|
}
|
|
26256
26765
|
|
|
26257
26766
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/resolve-url.js
|
|
26258
|
-
function resolveUrl(url, options) {
|
|
26767
|
+
function resolveUrl(url, options, context) {
|
|
26259
26768
|
const absolute = url.startsWith("data:") || url.startsWith("http:") || url.startsWith("https:");
|
|
26260
26769
|
if (absolute) {
|
|
26261
26770
|
return url;
|
|
26262
26771
|
}
|
|
26263
|
-
const baseUrl =
|
|
26772
|
+
const baseUrl = context?.baseUrl || getResolveBaseUrl(options?.core?.baseUrl);
|
|
26264
26773
|
if (!baseUrl) {
|
|
26265
|
-
throw new Error(`'
|
|
26774
|
+
throw new Error(`'baseUrl' must be provided to resolve relative url ${url}`);
|
|
26775
|
+
}
|
|
26776
|
+
return baseUrl.endsWith("/") ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
|
|
26777
|
+
}
|
|
26778
|
+
function getResolveBaseUrl(baseUrl) {
|
|
26779
|
+
if (!baseUrl) {
|
|
26780
|
+
return void 0;
|
|
26266
26781
|
}
|
|
26267
|
-
|
|
26782
|
+
if (baseUrl.endsWith("/")) {
|
|
26783
|
+
return baseUrl;
|
|
26784
|
+
}
|
|
26785
|
+
const slashIndex = baseUrl.lastIndexOf("/");
|
|
26786
|
+
return slashIndex >= 0 ? baseUrl.slice(0, slashIndex + 1) : "";
|
|
26268
26787
|
}
|
|
26269
26788
|
|
|
26270
26789
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/extensions/EXT_meshopt_compression.js
|
|
@@ -27301,8 +27820,8 @@ void main(void) {
|
|
|
27301
27820
|
return gltf;
|
|
27302
27821
|
}
|
|
27303
27822
|
function parseGLTFContainerSync(gltf, data, byteOffset, options) {
|
|
27304
|
-
if (options.core?.
|
|
27305
|
-
gltf.baseUri = options.core?.
|
|
27823
|
+
if (options.core?.baseUrl) {
|
|
27824
|
+
gltf.baseUri = options.core?.baseUrl;
|
|
27306
27825
|
}
|
|
27307
27826
|
if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options.glb)) {
|
|
27308
27827
|
const textDecoder = new TextDecoder();
|
|
@@ -27339,7 +27858,7 @@ void main(void) {
|
|
|
27339
27858
|
if (buffer.uri) {
|
|
27340
27859
|
const { fetch: fetch2 } = context;
|
|
27341
27860
|
assert8(fetch2);
|
|
27342
|
-
const uri = resolveUrl(buffer.uri, options);
|
|
27861
|
+
const uri = resolveUrl(buffer.uri, options, context);
|
|
27343
27862
|
const response = await context?.fetch?.(uri);
|
|
27344
27863
|
const arrayBuffer = await response?.arrayBuffer?.();
|
|
27345
27864
|
gltf.buffers[i] = {
|
|
@@ -27379,7 +27898,7 @@ void main(void) {
|
|
|
27379
27898
|
async function loadImage(gltf, image, index, options, context) {
|
|
27380
27899
|
let arrayBuffer;
|
|
27381
27900
|
if (image.uri && !image.hasOwnProperty("bufferView")) {
|
|
27382
|
-
const uri = resolveUrl(image.uri, options);
|
|
27901
|
+
const uri = resolveUrl(image.uri, options, context);
|
|
27383
27902
|
const { fetch: fetch2 } = context;
|
|
27384
27903
|
const response = await fetch2(uri);
|
|
27385
27904
|
arrayBuffer = await response.arrayBuffer();
|
|
@@ -28193,10 +28712,10 @@ void main(void) {
|
|
|
28193
28712
|
};
|
|
28194
28713
|
|
|
28195
28714
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/parsers/parse-3d-tile-header.js
|
|
28196
|
-
var
|
|
28715
|
+
var import_core46 = __toESM(require_core2(), 1);
|
|
28197
28716
|
|
|
28198
28717
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
|
|
28199
|
-
var
|
|
28718
|
+
var import_core45 = __toESM(require_core2(), 1);
|
|
28200
28719
|
|
|
28201
28720
|
// ../../node_modules/@loaders.gl/3d-tiles/node_modules/long/index.js
|
|
28202
28721
|
var wasm = null;
|
|
@@ -29474,7 +29993,7 @@ void main(void) {
|
|
|
29474
29993
|
if (isChildSubtreeAvailable) {
|
|
29475
29994
|
const subtreePath = `${basePath}/${subtreesUriTemplate}`;
|
|
29476
29995
|
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, level, x, y, z);
|
|
29477
|
-
const childSubtree = await (0,
|
|
29996
|
+
const childSubtree = await (0, import_core45.load)(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
|
|
29478
29997
|
nextSubtree = childSubtree;
|
|
29479
29998
|
tileAvailabilityIndex = 0;
|
|
29480
29999
|
nextSubtreeData = { level, x, y, z };
|
|
@@ -29703,7 +30222,7 @@ void main(void) {
|
|
|
29703
30222
|
const { subdivisionScheme, maximumLevel, availableLevels, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;
|
|
29704
30223
|
const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
29705
30224
|
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
29706
|
-
const subtree = await (0,
|
|
30225
|
+
const subtree = await (0, import_core46.load)(subtreeUrl, Tile3DSubtreeLoader, options);
|
|
29707
30226
|
const tileContentUri = tile.content?.uri;
|
|
29708
30227
|
const contentUrlTemplate = tileContentUri ? resolveUri(tileContentUri, basePath) : "";
|
|
29709
30228
|
const refine = tileset?.root?.refine;
|
|
@@ -29847,10 +30366,10 @@ void main(void) {
|
|
|
29847
30366
|
} },
|
|
29848
30367
|
_getMeshColor: { type: "function", value: (tileHeader) => [255, 255, 255] }
|
|
29849
30368
|
};
|
|
29850
|
-
var Tile3DLayer = class extends
|
|
30369
|
+
var Tile3DLayer = class extends import_core47.CompositeLayer {
|
|
29851
30370
|
initializeState() {
|
|
29852
30371
|
if ("onTileLoadFail" in this.props) {
|
|
29853
|
-
|
|
30372
|
+
import_core47.log.removed("onTileLoadFail", "onTileError")();
|
|
29854
30373
|
}
|
|
29855
30374
|
this.state = {
|
|
29856
30375
|
layerMap: {},
|
|
@@ -29960,7 +30479,7 @@ void main(void) {
|
|
|
29960
30479
|
}
|
|
29961
30480
|
Object.assign(options, preloadOptions);
|
|
29962
30481
|
}
|
|
29963
|
-
const tilesetJson = await (0,
|
|
30482
|
+
const tilesetJson = await (0, import_core48.load)(actualTilesetUrl, loader, options.loadOptions);
|
|
29964
30483
|
const tileset3d = new Tileset3D(tilesetJson, {
|
|
29965
30484
|
onTileLoad: this._onTileLoad.bind(this),
|
|
29966
30485
|
onTileUnload: this._onTileUnload.bind(this),
|
|
@@ -30047,7 +30566,7 @@ void main(void) {
|
|
|
30047
30566
|
id: `${this.id}-pointcloud-${tileHeader.id}`,
|
|
30048
30567
|
tile: tileHeader,
|
|
30049
30568
|
data,
|
|
30050
|
-
coordinateSystem:
|
|
30569
|
+
coordinateSystem: import_core47.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
30051
30570
|
coordinateOrigin: cartographicOrigin,
|
|
30052
30571
|
modelMatrix,
|
|
30053
30572
|
getColor: constantRGBA || getPointColor,
|
|
@@ -30070,7 +30589,7 @@ void main(void) {
|
|
|
30070
30589
|
tile: tileHeader,
|
|
30071
30590
|
data: instances || SINGLE_DATA,
|
|
30072
30591
|
scenegraph: gltf,
|
|
30073
|
-
coordinateSystem:
|
|
30592
|
+
coordinateSystem: import_core47.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
30074
30593
|
coordinateOrigin: cartographicOrigin,
|
|
30075
30594
|
modelMatrix,
|
|
30076
30595
|
getTransformMatrix: (instance) => instance.modelMatrix,
|
|
@@ -30089,7 +30608,7 @@ void main(void) {
|
|
|
30089
30608
|
indices,
|
|
30090
30609
|
modelMatrix,
|
|
30091
30610
|
cartographicOrigin,
|
|
30092
|
-
coordinateSystem =
|
|
30611
|
+
coordinateSystem = import_core47.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
30093
30612
|
material,
|
|
30094
30613
|
featureIds
|
|
30095
30614
|
} = content;
|
|
@@ -30164,9 +30683,9 @@ void main(void) {
|
|
|
30164
30683
|
}
|
|
30165
30684
|
|
|
30166
30685
|
// src/terrain-layer/terrain-layer.ts
|
|
30167
|
-
var import_core48 = __toESM(require_core(), 1);
|
|
30168
|
-
var import_mesh_layers3 = __toESM(require_mesh_layers(), 1);
|
|
30169
30686
|
var import_core49 = __toESM(require_core(), 1);
|
|
30687
|
+
var import_mesh_layers3 = __toESM(require_mesh_layers(), 1);
|
|
30688
|
+
var import_core50 = __toESM(require_core(), 1);
|
|
30170
30689
|
|
|
30171
30690
|
// ../../node_modules/@loaders.gl/terrain/dist/lib/decode-quantized-mesh.js
|
|
30172
30691
|
var QUANTIZED_MESH_HEADER = /* @__PURE__ */ new Map([
|
|
@@ -31127,7 +31646,7 @@ void main(void) {
|
|
|
31127
31646
|
}
|
|
31128
31647
|
|
|
31129
31648
|
// ../../node_modules/@loaders.gl/terrain/dist/lib/utils/version.js
|
|
31130
|
-
var VERSION12 = true ? "4.4.
|
|
31649
|
+
var VERSION12 = true ? "4.4.1" : "latest";
|
|
31131
31650
|
|
|
31132
31651
|
// ../../node_modules/@loaders.gl/terrain/dist/terrain-loader.js
|
|
31133
31652
|
var TerrainLoader = {
|
|
@@ -31234,7 +31753,7 @@ void main(void) {
|
|
|
31234
31753
|
}
|
|
31235
31754
|
return template || "";
|
|
31236
31755
|
}
|
|
31237
|
-
var TerrainLayer = class extends
|
|
31756
|
+
var TerrainLayer = class extends import_core49.CompositeLayer {
|
|
31238
31757
|
updateState({ props, oldProps }) {
|
|
31239
31758
|
const elevationDataChanged = props.elevationData !== oldProps.elevationData;
|
|
31240
31759
|
if (elevationDataChanged) {
|
|
@@ -31248,7 +31767,7 @@ void main(void) {
|
|
|
31248
31767
|
this.setState({ terrain });
|
|
31249
31768
|
}
|
|
31250
31769
|
if (props.workerUrl) {
|
|
31251
|
-
|
|
31770
|
+
import_core49.log.removed("workerUrl", "loadOptions.terrain.workerUrl")();
|
|
31252
31771
|
}
|
|
31253
31772
|
}
|
|
31254
31773
|
loadTerrain({
|
|
@@ -31319,7 +31838,7 @@ void main(void) {
|
|
|
31319
31838
|
mesh,
|
|
31320
31839
|
texture,
|
|
31321
31840
|
_instanced: false,
|
|
31322
|
-
coordinateSystem:
|
|
31841
|
+
coordinateSystem: import_core50.COORDINATE_SYSTEM.CARTESIAN,
|
|
31323
31842
|
getPosition: (d2) => [0, 0, 0],
|
|
31324
31843
|
getColor: color,
|
|
31325
31844
|
wireframe,
|
|
@@ -31424,7 +31943,7 @@ void main(void) {
|
|
|
31424
31943
|
var isTileSetURL = (url) => url.includes("{x}") && (url.includes("{y}") || url.includes("{-y}"));
|
|
31425
31944
|
|
|
31426
31945
|
// src/mvt-layer/mvt-layer.ts
|
|
31427
|
-
var
|
|
31946
|
+
var import_core52 = __toESM(require_core(), 1);
|
|
31428
31947
|
var import_layers9 = __toESM(require_layers(), 1);
|
|
31429
31948
|
var import_extensions = __toESM(require_extensions(), 1);
|
|
31430
31949
|
|
|
@@ -32999,7 +33518,7 @@ void main(void) {
|
|
|
32999
33518
|
};
|
|
33000
33519
|
|
|
33001
33520
|
// ../../node_modules/@loaders.gl/mvt/dist/mvt-loader.js
|
|
33002
|
-
var VERSION13 = true ? "4.4.
|
|
33521
|
+
var VERSION13 = true ? "4.4.1" : "latest";
|
|
33003
33522
|
var MVTWorkerLoader = {
|
|
33004
33523
|
...MVTFormat,
|
|
33005
33524
|
dataType: null,
|
|
@@ -33280,12 +33799,12 @@ void main(void) {
|
|
|
33280
33799
|
if (!this.context.viewport.resolution) {
|
|
33281
33800
|
props.modelMatrix = modelMatrix;
|
|
33282
33801
|
props.coordinateOrigin = [xOffset, yOffset, 0];
|
|
33283
|
-
props.coordinateSystem =
|
|
33802
|
+
props.coordinateSystem = import_core52.COORDINATE_SYSTEM.CARTESIAN;
|
|
33284
33803
|
props.extensions = [...props.extensions || [], new import_extensions.ClipExtension()];
|
|
33285
33804
|
}
|
|
33286
33805
|
const subLayers = super.renderSubLayers(props);
|
|
33287
33806
|
if (this.state.binary && !(subLayers instanceof import_layers9.GeoJsonLayer)) {
|
|
33288
|
-
|
|
33807
|
+
import_core52.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")();
|
|
33289
33808
|
}
|
|
33290
33809
|
return subLayers;
|
|
33291
33810
|
}
|