@deck.gl/geo-layers 9.3.0-alpha.5 → 9.3.0-alpha.6
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 +721 -257
- package/dist/index.cjs +34 -9
- 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 +7 -1
- package/dist/tileset-2d/utils.js.map +1 -1
- package/dist.min.js +299 -91
- package/package.json +15 -15
- 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 +11 -1
package/dist/dist.dev.js
CHANGED
|
@@ -10208,7 +10208,7 @@ var __exports__ = (() => {
|
|
|
10208
10208
|
}
|
|
10209
10209
|
|
|
10210
10210
|
// ../../node_modules/@loaders.gl/xml/dist/xml-loader.js
|
|
10211
|
-
var VERSION = true ? "4.4.
|
|
10211
|
+
var VERSION = true ? "4.4.1" : "latest";
|
|
10212
10212
|
var XMLLoader = {
|
|
10213
10213
|
dataType: null,
|
|
10214
10214
|
batchType: null,
|
|
@@ -10791,7 +10791,7 @@ var __exports__ = (() => {
|
|
|
10791
10791
|
var dist_default = new ProbeLog({ id: "@probe.gl/log" });
|
|
10792
10792
|
|
|
10793
10793
|
// ../../node_modules/@loaders.gl/loader-utils/dist/lib/log-utils/log.js
|
|
10794
|
-
var VERSION3 = true ? "4.4.
|
|
10794
|
+
var VERSION3 = true ? "4.4.1" : "latest";
|
|
10795
10795
|
var version = VERSION3[0] >= "0" && VERSION3[0] <= "9" ? `v${VERSION3}` : "";
|
|
10796
10796
|
function createLog() {
|
|
10797
10797
|
const log8 = new ProbeLog({ id: "loaders.gl" });
|
|
@@ -10846,7 +10846,7 @@ var __exports__ = (() => {
|
|
|
10846
10846
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
10847
10847
|
warningIssued = true;
|
|
10848
10848
|
} else {
|
|
10849
|
-
globalThis._loadersgl_.version = "4.4.
|
|
10849
|
+
globalThis._loadersgl_.version = "4.4.1";
|
|
10850
10850
|
}
|
|
10851
10851
|
}
|
|
10852
10852
|
return globalThis._loadersgl_.version;
|
|
@@ -11616,7 +11616,7 @@ var __exports__ = (() => {
|
|
|
11616
11616
|
}
|
|
11617
11617
|
this.data = data;
|
|
11618
11618
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
11619
|
-
this.loadOptions =
|
|
11619
|
+
this.loadOptions = normalizeDirectLoaderOptions(this.options.core?.loadOptions);
|
|
11620
11620
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
11621
11621
|
}
|
|
11622
11622
|
setProps(options) {
|
|
@@ -11659,6 +11659,23 @@ var __exports__ = (() => {
|
|
|
11659
11659
|
}
|
|
11660
11660
|
return (url) => fetch(url);
|
|
11661
11661
|
}
|
|
11662
|
+
function normalizeDirectLoaderOptions(options) {
|
|
11663
|
+
const loadOptions = { ...options };
|
|
11664
|
+
if (options?.core) {
|
|
11665
|
+
loadOptions.core = { ...options.core };
|
|
11666
|
+
}
|
|
11667
|
+
const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
|
|
11668
|
+
const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
|
|
11669
|
+
if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
|
|
11670
|
+
loadOptions.core ||= {};
|
|
11671
|
+
if (loadOptions.core.baseUrl === void 0) {
|
|
11672
|
+
loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
|
|
11673
|
+
}
|
|
11674
|
+
delete loadOptions.baseUri;
|
|
11675
|
+
delete loadOptions.baseUrl;
|
|
11676
|
+
}
|
|
11677
|
+
return loadOptions;
|
|
11678
|
+
}
|
|
11662
11679
|
|
|
11663
11680
|
// ../../node_modules/@loaders.gl/loader-utils/dist/lib/sources/image-source.js
|
|
11664
11681
|
var ImageSource = class {
|
|
@@ -11675,7 +11692,7 @@ var __exports__ = (() => {
|
|
|
11675
11692
|
}
|
|
11676
11693
|
|
|
11677
11694
|
// ../../node_modules/@loaders.gl/wms/dist/wms-error-loader.js
|
|
11678
|
-
var VERSION5 = true ? "4.4.
|
|
11695
|
+
var VERSION5 = true ? "4.4.1" : "latest";
|
|
11679
11696
|
var WMSErrorLoader = {
|
|
11680
11697
|
dataType: null,
|
|
11681
11698
|
batchType: null,
|
|
@@ -11954,7 +11971,7 @@ var __exports__ = (() => {
|
|
|
11954
11971
|
}
|
|
11955
11972
|
|
|
11956
11973
|
// ../../node_modules/@loaders.gl/wms/dist/wms-capabilities-loader.js
|
|
11957
|
-
var VERSION6 = true ? "4.4.
|
|
11974
|
+
var VERSION6 = true ? "4.4.1" : "latest";
|
|
11958
11975
|
var WMSCapabilitiesLoader = {
|
|
11959
11976
|
dataType: null,
|
|
11960
11977
|
batchType: null,
|
|
@@ -12027,7 +12044,7 @@ var __exports__ = (() => {
|
|
|
12027
12044
|
};
|
|
12028
12045
|
|
|
12029
12046
|
// ../../node_modules/@loaders.gl/images/dist/lib/utils/version.js
|
|
12030
|
-
var VERSION7 = true ? "4.4.
|
|
12047
|
+
var VERSION7 = true ? "4.4.1" : "latest";
|
|
12031
12048
|
|
|
12032
12049
|
// ../../node_modules/@loaders.gl/images/dist/lib/category-api/image-type.js
|
|
12033
12050
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -14482,7 +14499,9 @@ var __exports__ = (() => {
|
|
|
14482
14499
|
tileSize = TILE_SIZE4,
|
|
14483
14500
|
modelMatrix,
|
|
14484
14501
|
modelMatrixInverse,
|
|
14485
|
-
zoomOffset = 0
|
|
14502
|
+
zoomOffset = 0,
|
|
14503
|
+
visibleMinZoom,
|
|
14504
|
+
visibleMaxZoom
|
|
14486
14505
|
}) {
|
|
14487
14506
|
let z = viewport.isGeospatial ? Math.round(viewport.zoom + Math.log2(TILE_SIZE4 / tileSize)) + zoomOffset : Math.ceil(viewport.zoom) + zoomOffset;
|
|
14488
14507
|
if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
|
|
@@ -14494,6 +14513,12 @@ var __exports__ = (() => {
|
|
|
14494
14513
|
if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
|
|
14495
14514
|
z = maxZoom;
|
|
14496
14515
|
}
|
|
14516
|
+
if (visibleMinZoom != null && viewport.zoom < visibleMinZoom) {
|
|
14517
|
+
return [];
|
|
14518
|
+
}
|
|
14519
|
+
if (visibleMaxZoom != null && viewport.zoom > visibleMaxZoom) {
|
|
14520
|
+
return [];
|
|
14521
|
+
}
|
|
14497
14522
|
let transformedExtent = extent;
|
|
14498
14523
|
if (modelMatrix && modelMatrixInverse && extent && !viewport.isGeospatial) {
|
|
14499
14524
|
transformedExtent = transformBox(extent, modelMatrix);
|
|
@@ -14572,6 +14597,8 @@ var __exports__ = (() => {
|
|
|
14572
14597
|
maxRequests: 6,
|
|
14573
14598
|
debounceTime: 0,
|
|
14574
14599
|
zoomOffset: 0,
|
|
14600
|
+
visibleMinZoom: null,
|
|
14601
|
+
visibleMaxZoom: null,
|
|
14575
14602
|
// 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
14603
|
// onViewportLoad: ((tiles: Tile2DHeader<DataT>[]) => void) | null,
|
|
14577
14604
|
onTileLoad: () => {
|
|
@@ -14635,6 +14662,7 @@ var __exports__ = (() => {
|
|
|
14635
14662
|
if (Number.isFinite(opts.minZoom)) {
|
|
14636
14663
|
this._minZoom = Math.ceil(opts.minZoom);
|
|
14637
14664
|
}
|
|
14665
|
+
this._viewport = null;
|
|
14638
14666
|
}
|
|
14639
14667
|
// Clean up any outstanding tile requests.
|
|
14640
14668
|
finalize() {
|
|
@@ -14744,7 +14772,7 @@ var __exports__ = (() => {
|
|
|
14744
14772
|
modelMatrix,
|
|
14745
14773
|
modelMatrixInverse
|
|
14746
14774
|
}) {
|
|
14747
|
-
const { tileSize, extent, zoomOffset } = this.opts;
|
|
14775
|
+
const { tileSize, extent, zoomOffset, visibleMinZoom, visibleMaxZoom } = this.opts;
|
|
14748
14776
|
return getTileIndices({
|
|
14749
14777
|
viewport,
|
|
14750
14778
|
maxZoom,
|
|
@@ -14754,7 +14782,9 @@ var __exports__ = (() => {
|
|
|
14754
14782
|
extent,
|
|
14755
14783
|
modelMatrix,
|
|
14756
14784
|
modelMatrixInverse,
|
|
14757
|
-
zoomOffset
|
|
14785
|
+
zoomOffset,
|
|
14786
|
+
visibleMinZoom,
|
|
14787
|
+
visibleMaxZoom
|
|
14758
14788
|
});
|
|
14759
14789
|
}
|
|
14760
14790
|
/** Returns unique string key for a tile index */
|
|
@@ -14981,7 +15011,9 @@ var __exports__ = (() => {
|
|
|
14981
15011
|
zRange: null,
|
|
14982
15012
|
maxRequests: 6,
|
|
14983
15013
|
debounceTime: 0,
|
|
14984
|
-
zoomOffset: 0
|
|
15014
|
+
zoomOffset: 0,
|
|
15015
|
+
visibleMinZoom: null,
|
|
15016
|
+
visibleMaxZoom: null
|
|
14985
15017
|
};
|
|
14986
15018
|
var TileLayer = class extends import_core16.CompositeLayer {
|
|
14987
15019
|
initializeState() {
|
|
@@ -15038,7 +15070,9 @@ var __exports__ = (() => {
|
|
|
15038
15070
|
minZoom,
|
|
15039
15071
|
maxRequests,
|
|
15040
15072
|
debounceTime,
|
|
15041
|
-
zoomOffset
|
|
15073
|
+
zoomOffset,
|
|
15074
|
+
visibleMinZoom,
|
|
15075
|
+
visibleMaxZoom
|
|
15042
15076
|
} = this.props;
|
|
15043
15077
|
return {
|
|
15044
15078
|
maxCacheSize,
|
|
@@ -15051,6 +15085,8 @@ var __exports__ = (() => {
|
|
|
15051
15085
|
maxRequests,
|
|
15052
15086
|
debounceTime,
|
|
15053
15087
|
zoomOffset,
|
|
15088
|
+
visibleMinZoom,
|
|
15089
|
+
visibleMaxZoom,
|
|
15054
15090
|
getTileData: this.getTileData.bind(this),
|
|
15055
15091
|
onTileLoad: this._onTileLoad.bind(this),
|
|
15056
15092
|
onTileError: this._onTileError.bind(this),
|
|
@@ -15126,6 +15162,15 @@ var __exports__ = (() => {
|
|
|
15126
15162
|
info.sourceTileSubLayer.updateAutoHighlight(info);
|
|
15127
15163
|
}
|
|
15128
15164
|
renderLayers() {
|
|
15165
|
+
const { visibleMinZoom, visibleMaxZoom, minZoom, extent } = this.props;
|
|
15166
|
+
const zoom = this.context.viewport.zoom;
|
|
15167
|
+
const hidden = visibleMinZoom != null && zoom < visibleMinZoom || visibleMaxZoom != null && zoom > visibleMaxZoom || minZoom != null && !extent && zoom < minZoom;
|
|
15168
|
+
if (hidden) {
|
|
15169
|
+
for (const tile of this.state.tileset.tiles) {
|
|
15170
|
+
tile.layers = null;
|
|
15171
|
+
}
|
|
15172
|
+
return [];
|
|
15173
|
+
}
|
|
15129
15174
|
return this.state.tileset.tiles.map((tile) => {
|
|
15130
15175
|
const subLayerProps = this.getSubLayerPropsByTile(tile);
|
|
15131
15176
|
if (!tile.isLoaded && !tile.content) {
|
|
@@ -15513,12 +15558,12 @@ out float vTime;
|
|
|
15513
15558
|
|
|
15514
15559
|
// src/tile-3d-layer/tile-3d-layer.ts
|
|
15515
15560
|
var import_engine2 = __toESM(require_engine(), 1);
|
|
15516
|
-
var
|
|
15561
|
+
var import_core47 = __toESM(require_core(), 1);
|
|
15517
15562
|
var import_layers8 = __toESM(require_layers(), 1);
|
|
15518
15563
|
var import_mesh_layers2 = __toESM(require_mesh_layers(), 1);
|
|
15519
15564
|
|
|
15520
15565
|
// ../../node_modules/@loaders.gl/textures/dist/lib/utils/version.js
|
|
15521
|
-
var VERSION8 = true ? "4.4.
|
|
15566
|
+
var VERSION8 = true ? "4.4.1" : "latest";
|
|
15522
15567
|
|
|
15523
15568
|
// ../../node_modules/@loaders.gl/textures/dist/lib/parsers/basis-module-loader.js
|
|
15524
15569
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -15637,7 +15682,7 @@ out float vTime;
|
|
|
15637
15682
|
"bc7-rgba-unorm",
|
|
15638
15683
|
"bc7-rgba-unorm-srgb"
|
|
15639
15684
|
],
|
|
15640
|
-
WEBGL_compressed_texture_etc1: ["etc1-
|
|
15685
|
+
WEBGL_compressed_texture_etc1: ["etc1-rgb-unorm-webgl"],
|
|
15641
15686
|
WEBGL_compressed_texture_etc: [
|
|
15642
15687
|
"etc2-rgb8unorm",
|
|
15643
15688
|
"etc2-rgb8unorm-srgb",
|
|
@@ -15653,7 +15698,7 @@ out float vTime;
|
|
|
15653
15698
|
WEBGL_compressed_texture_pvrtc: [
|
|
15654
15699
|
"pvrtc-rgb4unorm-webgl",
|
|
15655
15700
|
"pvrtc-rgba4unorm-webgl",
|
|
15656
|
-
"pvrtc-
|
|
15701
|
+
"pvrtc-rgb2unorm-webgl",
|
|
15657
15702
|
"pvrtc-rgba2unorm-webgl"
|
|
15658
15703
|
],
|
|
15659
15704
|
WEBGL_compressed_texture_atc: [
|
|
@@ -15753,12 +15798,13 @@ out float vTime;
|
|
|
15753
15798
|
}
|
|
15754
15799
|
|
|
15755
15800
|
// ../../node_modules/@loaders.gl/textures/dist/lib/parsers/parse-basis.js
|
|
15801
|
+
var basisTranscodingLock = Promise.resolve();
|
|
15756
15802
|
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
15757
15803
|
etc1: {
|
|
15758
15804
|
basisFormat: 0,
|
|
15759
15805
|
compressed: true,
|
|
15760
15806
|
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
15761
|
-
textureFormat: "etc1-
|
|
15807
|
+
textureFormat: "etc1-rgb-unorm-webgl"
|
|
15762
15808
|
},
|
|
15763
15809
|
etc2: {
|
|
15764
15810
|
basisFormat: 1,
|
|
@@ -15858,31 +15904,46 @@ out float vTime;
|
|
|
15858
15904
|
}
|
|
15859
15905
|
};
|
|
15860
15906
|
var BASIS_FORMATS = Object.freeze(Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS));
|
|
15907
|
+
async function withBasisTranscodingLock(transcode) {
|
|
15908
|
+
const previousLock = basisTranscodingLock;
|
|
15909
|
+
let releaseLock;
|
|
15910
|
+
basisTranscodingLock = new Promise((resolve2) => {
|
|
15911
|
+
releaseLock = resolve2;
|
|
15912
|
+
});
|
|
15913
|
+
await previousLock;
|
|
15914
|
+
try {
|
|
15915
|
+
return await transcode();
|
|
15916
|
+
} finally {
|
|
15917
|
+
releaseLock();
|
|
15918
|
+
}
|
|
15919
|
+
}
|
|
15861
15920
|
async function parseBasis(data, options = {}) {
|
|
15862
15921
|
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);
|
|
15922
|
+
return await withBasisTranscodingLock(async () => {
|
|
15923
|
+
if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
|
|
15924
|
+
if (isKTX(data)) {
|
|
15925
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15926
|
+
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15880
15927
|
}
|
|
15881
|
-
case "transcoder":
|
|
15882
|
-
default:
|
|
15883
15928
|
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15884
15929
|
return parseBasisFile(BasisFile, data, options);
|
|
15885
|
-
|
|
15930
|
+
}
|
|
15931
|
+
switch (options.basis.module) {
|
|
15932
|
+
case "encoder":
|
|
15933
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15934
|
+
switch (options.basis.containerFormat) {
|
|
15935
|
+
case "ktx2":
|
|
15936
|
+
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15937
|
+
case "basis":
|
|
15938
|
+
default:
|
|
15939
|
+
return parseBasisFile(fileConstructors.BasisFile, data, options);
|
|
15940
|
+
}
|
|
15941
|
+
case "transcoder":
|
|
15942
|
+
default:
|
|
15943
|
+
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15944
|
+
return parseBasisFile(BasisFile, data, options);
|
|
15945
|
+
}
|
|
15946
|
+
});
|
|
15886
15947
|
}
|
|
15887
15948
|
function parseBasisFile(BasisFile, data, options) {
|
|
15888
15949
|
const basisFile = new BasisFile(new Uint8Array(data));
|
|
@@ -16022,7 +16083,7 @@ out float vTime;
|
|
|
16022
16083
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
16023
16084
|
"pvrtc-rgb4unorm-webgl",
|
|
16024
16085
|
"pvrtc-rgba4unorm-webgl",
|
|
16025
|
-
"pvrtc-
|
|
16086
|
+
"pvrtc-rgb2unorm-webgl",
|
|
16026
16087
|
"pvrtc-rgba2unorm-webgl"
|
|
16027
16088
|
])) {
|
|
16028
16089
|
return {
|
|
@@ -16042,7 +16103,7 @@ out float vTime;
|
|
|
16042
16103
|
"eac-rg11snorm"
|
|
16043
16104
|
])) {
|
|
16044
16105
|
return "etc2";
|
|
16045
|
-
} else if (textureFormats2.has("etc1-
|
|
16106
|
+
} else if (textureFormats2.has("etc1-rgb-unorm-webgl")) {
|
|
16046
16107
|
return "etc1";
|
|
16047
16108
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
16048
16109
|
"atc-rgb-unorm-webgl",
|
|
@@ -16087,7 +16148,7 @@ out float vTime;
|
|
|
16087
16148
|
};
|
|
16088
16149
|
|
|
16089
16150
|
// ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
|
|
16090
|
-
var
|
|
16151
|
+
var import_core21 = __toESM(require_core3(), 1);
|
|
16091
16152
|
|
|
16092
16153
|
// ../../node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/gltf-webgl-constants.js
|
|
16093
16154
|
var GLEnum;
|
|
@@ -16168,6 +16229,75 @@ out float vTime;
|
|
|
16168
16229
|
}
|
|
16169
16230
|
}
|
|
16170
16231
|
|
|
16232
|
+
// ../../node_modules/@luma.gl/gltf/dist/pbr/texture-transform.js
|
|
16233
|
+
var TEXTURE_TRANSFORM_SLOT_DEFINITIONS = [
|
|
16234
|
+
createTextureTransformSlotDefinition("baseColor", "pbr_baseColorSampler", "baseColorTexture", [
|
|
16235
|
+
"pbrMetallicRoughness",
|
|
16236
|
+
"baseColorTexture"
|
|
16237
|
+
]),
|
|
16238
|
+
createTextureTransformSlotDefinition("metallicRoughness", "pbr_metallicRoughnessSampler", "metallicRoughnessTexture", ["pbrMetallicRoughness", "metallicRoughnessTexture"]),
|
|
16239
|
+
createTextureTransformSlotDefinition("normal", "pbr_normalSampler", "normalTexture", [
|
|
16240
|
+
"normalTexture"
|
|
16241
|
+
]),
|
|
16242
|
+
createTextureTransformSlotDefinition("occlusion", "pbr_occlusionSampler", "occlusionTexture", [
|
|
16243
|
+
"occlusionTexture"
|
|
16244
|
+
]),
|
|
16245
|
+
createTextureTransformSlotDefinition("emissive", "pbr_emissiveSampler", "emissiveTexture", [
|
|
16246
|
+
"emissiveTexture"
|
|
16247
|
+
]),
|
|
16248
|
+
createTextureTransformSlotDefinition("specularColor", "pbr_specularColorSampler", "KHR_materials_specular.specularColorTexture", ["extensions", "KHR_materials_specular", "specularColorTexture"]),
|
|
16249
|
+
createTextureTransformSlotDefinition("specularIntensity", "pbr_specularIntensitySampler", "KHR_materials_specular.specularTexture", ["extensions", "KHR_materials_specular", "specularTexture"]),
|
|
16250
|
+
createTextureTransformSlotDefinition("transmission", "pbr_transmissionSampler", "KHR_materials_transmission.transmissionTexture", ["extensions", "KHR_materials_transmission", "transmissionTexture"]),
|
|
16251
|
+
createTextureTransformSlotDefinition("thickness", "pbr_thicknessSampler", "KHR_materials_volume.thicknessTexture", ["extensions", "KHR_materials_volume", "thicknessTexture"]),
|
|
16252
|
+
createTextureTransformSlotDefinition("clearcoat", "pbr_clearcoatSampler", "KHR_materials_clearcoat.clearcoatTexture", ["extensions", "KHR_materials_clearcoat", "clearcoatTexture"]),
|
|
16253
|
+
createTextureTransformSlotDefinition("clearcoatRoughness", "pbr_clearcoatRoughnessSampler", "KHR_materials_clearcoat.clearcoatRoughnessTexture", ["extensions", "KHR_materials_clearcoat", "clearcoatRoughnessTexture"]),
|
|
16254
|
+
createTextureTransformSlotDefinition("clearcoatNormal", "pbr_clearcoatNormalSampler", "KHR_materials_clearcoat.clearcoatNormalTexture", ["extensions", "KHR_materials_clearcoat", "clearcoatNormalTexture"]),
|
|
16255
|
+
createTextureTransformSlotDefinition("sheenColor", "pbr_sheenColorSampler", "KHR_materials_sheen.sheenColorTexture", ["extensions", "KHR_materials_sheen", "sheenColorTexture"]),
|
|
16256
|
+
createTextureTransformSlotDefinition("sheenRoughness", "pbr_sheenRoughnessSampler", "KHR_materials_sheen.sheenRoughnessTexture", ["extensions", "KHR_materials_sheen", "sheenRoughnessTexture"]),
|
|
16257
|
+
createTextureTransformSlotDefinition("iridescence", "pbr_iridescenceSampler", "KHR_materials_iridescence.iridescenceTexture", ["extensions", "KHR_materials_iridescence", "iridescenceTexture"]),
|
|
16258
|
+
createTextureTransformSlotDefinition("iridescenceThickness", "pbr_iridescenceThicknessSampler", "KHR_materials_iridescence.iridescenceThicknessTexture", ["extensions", "KHR_materials_iridescence", "iridescenceThicknessTexture"]),
|
|
16259
|
+
createTextureTransformSlotDefinition("anisotropy", "pbr_anisotropySampler", "KHR_materials_anisotropy.anisotropyTexture", ["extensions", "KHR_materials_anisotropy", "anisotropyTexture"])
|
|
16260
|
+
];
|
|
16261
|
+
var TEXTURE_TRANSFORM_SLOT_DEFINITION_MAP = new Map(TEXTURE_TRANSFORM_SLOT_DEFINITIONS.map((definition) => [definition.slot, definition]));
|
|
16262
|
+
function createTextureTransformSlotDefinition(slot, binding, displayName, pathSegments) {
|
|
16263
|
+
return {
|
|
16264
|
+
slot,
|
|
16265
|
+
binding,
|
|
16266
|
+
displayName,
|
|
16267
|
+
pathSegments,
|
|
16268
|
+
uvSetUniform: `${slot}UVSet`,
|
|
16269
|
+
uvTransformUniform: `${slot}UVTransform`
|
|
16270
|
+
};
|
|
16271
|
+
}
|
|
16272
|
+
function getTextureTransformSlotDefinitions() {
|
|
16273
|
+
return TEXTURE_TRANSFORM_SLOT_DEFINITIONS;
|
|
16274
|
+
}
|
|
16275
|
+
function getTextureTransformSlotDefinition(slot) {
|
|
16276
|
+
const definition = TEXTURE_TRANSFORM_SLOT_DEFINITION_MAP.get(slot);
|
|
16277
|
+
if (!definition) {
|
|
16278
|
+
throw new Error(`Unknown PBR texture transform slot ${slot}`);
|
|
16279
|
+
}
|
|
16280
|
+
return definition;
|
|
16281
|
+
}
|
|
16282
|
+
function resolveTextureTransform(textureInfo) {
|
|
16283
|
+
const extensionTextureTransform = textureInfo?.["extensions"]?.["KHR_texture_transform"];
|
|
16284
|
+
return {
|
|
16285
|
+
offset: extensionTextureTransform?.offset ? [extensionTextureTransform.offset[0], extensionTextureTransform.offset[1]] : [0, 0],
|
|
16286
|
+
rotation: extensionTextureTransform?.rotation ?? 0,
|
|
16287
|
+
scale: extensionTextureTransform?.scale ? [extensionTextureTransform.scale[0], extensionTextureTransform.scale[1]] : [1, 1]
|
|
16288
|
+
};
|
|
16289
|
+
}
|
|
16290
|
+
function resolveTextureCoordinateSet(textureInfo) {
|
|
16291
|
+
const extensionTextureTransform = textureInfo?.["extensions"]?.["KHR_texture_transform"];
|
|
16292
|
+
return extensionTextureTransform?.["texCoord"] ?? textureInfo?.["texCoord"] ?? 0;
|
|
16293
|
+
}
|
|
16294
|
+
function getTextureTransformMatrix(transform2) {
|
|
16295
|
+
const translationMatrix = new Matrix3().set(1, 0, 0, 0, 1, 0, transform2.offset[0], transform2.offset[1], 1);
|
|
16296
|
+
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);
|
|
16297
|
+
const scaleMatrix = new Matrix3().set(transform2.scale[0], 0, 0, 0, transform2.scale[1], 0, 0, 0, 1);
|
|
16298
|
+
return Array.from(translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix));
|
|
16299
|
+
}
|
|
16300
|
+
|
|
16171
16301
|
// ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
|
|
16172
16302
|
function parsePBRMaterial(device, material, attributes, options) {
|
|
16173
16303
|
const parsedMaterial = {
|
|
@@ -16208,6 +16338,8 @@ out float vTime;
|
|
|
16208
16338
|
parsedMaterial.defines["HAS_TANGENTS"] = true;
|
|
16209
16339
|
if (attributes["TEXCOORD_0"])
|
|
16210
16340
|
parsedMaterial.defines["HAS_UV"] = true;
|
|
16341
|
+
if (attributes["TEXCOORD_1"])
|
|
16342
|
+
parsedMaterial.defines["HAS_UV_1"] = true;
|
|
16211
16343
|
if (attributes["JOINTS_0"] && attributes["WEIGHTS_0"])
|
|
16212
16344
|
parsedMaterial.defines["HAS_SKIN"] = true;
|
|
16213
16345
|
if (attributes["COLOR_0"])
|
|
@@ -16220,72 +16352,53 @@ out float vTime;
|
|
|
16220
16352
|
if (options.validateAttributes !== false) {
|
|
16221
16353
|
warnOnMissingExpectedAttributes(material, attributes);
|
|
16222
16354
|
}
|
|
16223
|
-
parseMaterial(device, material, parsedMaterial, options.gltf);
|
|
16355
|
+
parseMaterial(device, material, parsedMaterial, attributes, options.gltf);
|
|
16224
16356
|
}
|
|
16225
16357
|
return parsedMaterial;
|
|
16226
16358
|
}
|
|
16227
16359
|
function warnOnMissingExpectedAttributes(material, attributes) {
|
|
16228
|
-
const uvDependentTextureSlots = getUvDependentTextureSlots(material);
|
|
16360
|
+
const uvDependentTextureSlots = getUvDependentTextureSlots(material, 0);
|
|
16229
16361
|
if (uvDependentTextureSlots.length > 0 && !attributes["TEXCOORD_0"]) {
|
|
16230
|
-
|
|
16362
|
+
import_core21.log.warn(`glTF material uses ${uvDependentTextureSlots.join(", ")} but primitive is missing TEXCOORD_0; textured shading will sample the default UV coordinates`)();
|
|
16363
|
+
}
|
|
16364
|
+
const uv1DependentTextureSlots = getUvDependentTextureSlots(material, 1);
|
|
16365
|
+
if (uv1DependentTextureSlots.length > 0 && !attributes["TEXCOORD_1"]) {
|
|
16366
|
+
import_core21.log.warn(`glTF material uses ${uv1DependentTextureSlots.join(", ")} with TEXCOORD_1 but primitive is missing TEXCOORD_1; those textures will be skipped`)();
|
|
16231
16367
|
}
|
|
16232
16368
|
const isUnlitMaterial = Boolean(material.unlit || material.extensions?.KHR_materials_unlit);
|
|
16233
16369
|
if (isUnlitMaterial || attributes["NORMAL"]) {
|
|
16234
16370
|
return;
|
|
16235
16371
|
}
|
|
16236
16372
|
const missingNormalReason = material.normalTexture ? "lit PBR shading with normalTexture" : "lit PBR shading";
|
|
16237
|
-
|
|
16373
|
+
import_core21.log.warn(`glTF primitive is missing NORMAL while using ${missingNormalReason}; shading will fall back to geometric normals`)();
|
|
16238
16374
|
}
|
|
16239
|
-
function getUvDependentTextureSlots(material) {
|
|
16375
|
+
function getUvDependentTextureSlots(material, textureCoordinateSet) {
|
|
16240
16376
|
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");
|
|
16377
|
+
for (const slotDefinition of getTextureTransformSlotDefinitions()) {
|
|
16378
|
+
const textureInfo = getNestedTextureInfo(material, slotDefinition.pathSegments);
|
|
16379
|
+
if (!textureInfo) {
|
|
16380
|
+
continue;
|
|
16381
|
+
}
|
|
16382
|
+
if (resolveTextureCoordinateSet(textureInfo) === textureCoordinateSet) {
|
|
16383
|
+
uvDependentTextureSlots.push(slotDefinition.displayName);
|
|
16384
|
+
}
|
|
16282
16385
|
}
|
|
16283
16386
|
return uvDependentTextureSlots;
|
|
16284
16387
|
}
|
|
16285
|
-
function
|
|
16388
|
+
function getNestedTextureInfo(material, pathSegments) {
|
|
16389
|
+
let value = material;
|
|
16390
|
+
for (const pathSegment of pathSegments) {
|
|
16391
|
+
value = value?.[pathSegment];
|
|
16392
|
+
if (!value) {
|
|
16393
|
+
return null;
|
|
16394
|
+
}
|
|
16395
|
+
}
|
|
16396
|
+
return value;
|
|
16397
|
+
}
|
|
16398
|
+
function parseMaterial(device, material, parsedMaterial, attributes, gltf) {
|
|
16286
16399
|
parsedMaterial.uniforms.unlit = Boolean(material.unlit || material.extensions?.KHR_materials_unlit);
|
|
16287
16400
|
if (material.pbrMetallicRoughness) {
|
|
16288
|
-
parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial, gltf);
|
|
16401
|
+
parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial, attributes, gltf);
|
|
16289
16402
|
}
|
|
16290
16403
|
if (material.normalTexture) {
|
|
16291
16404
|
addTexture(device, material.normalTexture, "pbr_normalSampler", parsedMaterial, {
|
|
@@ -16293,7 +16406,9 @@ out float vTime;
|
|
|
16293
16406
|
define: "HAS_NORMALMAP",
|
|
16294
16407
|
enabledUniformName: "normalMapEnabled"
|
|
16295
16408
|
},
|
|
16296
|
-
gltf
|
|
16409
|
+
gltf,
|
|
16410
|
+
attributes,
|
|
16411
|
+
textureTransformSlot: "normal"
|
|
16297
16412
|
});
|
|
16298
16413
|
const { scale: scale12 = 1 } = material.normalTexture;
|
|
16299
16414
|
parsedMaterial.uniforms.normalScale = scale12;
|
|
@@ -16304,7 +16419,9 @@ out float vTime;
|
|
|
16304
16419
|
define: "HAS_OCCLUSIONMAP",
|
|
16305
16420
|
enabledUniformName: "occlusionMapEnabled"
|
|
16306
16421
|
},
|
|
16307
|
-
gltf
|
|
16422
|
+
gltf,
|
|
16423
|
+
attributes,
|
|
16424
|
+
textureTransformSlot: "occlusion"
|
|
16308
16425
|
});
|
|
16309
16426
|
const { strength = 1 } = material.occlusionTexture;
|
|
16310
16427
|
parsedMaterial.uniforms.occlusionStrength = strength;
|
|
@@ -16316,10 +16433,12 @@ out float vTime;
|
|
|
16316
16433
|
define: "HAS_EMISSIVEMAP",
|
|
16317
16434
|
enabledUniformName: "emissiveMapEnabled"
|
|
16318
16435
|
},
|
|
16319
|
-
gltf
|
|
16436
|
+
gltf,
|
|
16437
|
+
attributes,
|
|
16438
|
+
textureTransformSlot: "emissive"
|
|
16320
16439
|
});
|
|
16321
16440
|
}
|
|
16322
|
-
parseMaterialExtensions(device, material.extensions, parsedMaterial, gltf);
|
|
16441
|
+
parseMaterialExtensions(device, material.extensions, parsedMaterial, gltf, attributes);
|
|
16323
16442
|
switch (material.alphaMode || "OPAQUE") {
|
|
16324
16443
|
case "OPAQUE":
|
|
16325
16444
|
break;
|
|
@@ -16331,7 +16450,7 @@ out float vTime;
|
|
|
16331
16450
|
break;
|
|
16332
16451
|
}
|
|
16333
16452
|
case "BLEND":
|
|
16334
|
-
|
|
16453
|
+
import_core21.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")();
|
|
16335
16454
|
applyAlphaBlendParameters(parsedMaterial);
|
|
16336
16455
|
break;
|
|
16337
16456
|
}
|
|
@@ -16372,14 +16491,16 @@ out float vTime;
|
|
|
16372
16491
|
GLEnum.ONE_MINUS_SRC_ALPHA
|
|
16373
16492
|
];
|
|
16374
16493
|
}
|
|
16375
|
-
function parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial, gltf) {
|
|
16494
|
+
function parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial, attributes, gltf) {
|
|
16376
16495
|
if (pbrMetallicRoughness.baseColorTexture) {
|
|
16377
16496
|
addTexture(device, pbrMetallicRoughness.baseColorTexture, "pbr_baseColorSampler", parsedMaterial, {
|
|
16378
16497
|
featureOptions: {
|
|
16379
16498
|
define: "HAS_BASECOLORMAP",
|
|
16380
16499
|
enabledUniformName: "baseColorMapEnabled"
|
|
16381
16500
|
},
|
|
16382
|
-
gltf
|
|
16501
|
+
gltf,
|
|
16502
|
+
attributes,
|
|
16503
|
+
textureTransformSlot: "baseColor"
|
|
16383
16504
|
});
|
|
16384
16505
|
}
|
|
16385
16506
|
parsedMaterial.uniforms.baseColorFactor = pbrMetallicRoughness.baseColorFactor || [1, 1, 1, 1];
|
|
@@ -16389,33 +16510,35 @@ out float vTime;
|
|
|
16389
16510
|
define: "HAS_METALROUGHNESSMAP",
|
|
16390
16511
|
enabledUniformName: "metallicRoughnessMapEnabled"
|
|
16391
16512
|
},
|
|
16392
|
-
gltf
|
|
16513
|
+
gltf,
|
|
16514
|
+
attributes,
|
|
16515
|
+
textureTransformSlot: "metallicRoughness"
|
|
16393
16516
|
});
|
|
16394
16517
|
}
|
|
16395
16518
|
const { metallicFactor = 1, roughnessFactor = 1 } = pbrMetallicRoughness;
|
|
16396
16519
|
parsedMaterial.uniforms.metallicRoughnessValues = [metallicFactor, roughnessFactor];
|
|
16397
16520
|
}
|
|
16398
|
-
function parseMaterialExtensions(device, extensions, parsedMaterial, gltf) {
|
|
16521
|
+
function parseMaterialExtensions(device, extensions, parsedMaterial, gltf, attributes = {}) {
|
|
16399
16522
|
if (!extensions) {
|
|
16400
16523
|
return;
|
|
16401
16524
|
}
|
|
16402
16525
|
if (hasMaterialExtensionShading(extensions)) {
|
|
16403
16526
|
parsedMaterial.defines["USE_MATERIAL_EXTENSIONS"] = true;
|
|
16404
16527
|
}
|
|
16405
|
-
parseSpecularExtension(device, extensions.KHR_materials_specular, parsedMaterial, gltf);
|
|
16528
|
+
parseSpecularExtension(device, extensions.KHR_materials_specular, parsedMaterial, gltf, attributes);
|
|
16406
16529
|
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);
|
|
16530
|
+
parseTransmissionExtension(device, extensions.KHR_materials_transmission, parsedMaterial, gltf, attributes);
|
|
16531
|
+
parseVolumeExtension(device, extensions.KHR_materials_volume, parsedMaterial, gltf, attributes);
|
|
16532
|
+
parseClearcoatExtension(device, extensions.KHR_materials_clearcoat, parsedMaterial, gltf, attributes);
|
|
16533
|
+
parseSheenExtension(device, extensions.KHR_materials_sheen, parsedMaterial, gltf, attributes);
|
|
16534
|
+
parseIridescenceExtension(device, extensions.KHR_materials_iridescence, parsedMaterial, gltf, attributes);
|
|
16535
|
+
parseAnisotropyExtension(device, extensions.KHR_materials_anisotropy, parsedMaterial, gltf, attributes);
|
|
16413
16536
|
parseEmissiveStrengthExtension(extensions.KHR_materials_emissive_strength, parsedMaterial);
|
|
16414
16537
|
}
|
|
16415
16538
|
function hasMaterialExtensionShading(extensions) {
|
|
16416
16539
|
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
16540
|
}
|
|
16418
|
-
function parseSpecularExtension(device, extension, parsedMaterial, gltf) {
|
|
16541
|
+
function parseSpecularExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16419
16542
|
if (!extension) {
|
|
16420
16543
|
return;
|
|
16421
16544
|
}
|
|
@@ -16431,7 +16554,9 @@ out float vTime;
|
|
|
16431
16554
|
define: "HAS_SPECULARCOLORMAP",
|
|
16432
16555
|
enabledUniformName: "specularColorMapEnabled"
|
|
16433
16556
|
},
|
|
16434
|
-
gltf
|
|
16557
|
+
gltf,
|
|
16558
|
+
attributes,
|
|
16559
|
+
textureTransformSlot: "specularColor"
|
|
16435
16560
|
});
|
|
16436
16561
|
}
|
|
16437
16562
|
if (extension.specularTexture) {
|
|
@@ -16440,7 +16565,9 @@ out float vTime;
|
|
|
16440
16565
|
define: "HAS_SPECULARINTENSITYMAP",
|
|
16441
16566
|
enabledUniformName: "specularIntensityMapEnabled"
|
|
16442
16567
|
},
|
|
16443
|
-
gltf
|
|
16568
|
+
gltf,
|
|
16569
|
+
attributes,
|
|
16570
|
+
textureTransformSlot: "specularIntensity"
|
|
16444
16571
|
});
|
|
16445
16572
|
}
|
|
16446
16573
|
}
|
|
@@ -16449,7 +16576,7 @@ out float vTime;
|
|
|
16449
16576
|
parsedMaterial.uniforms.ior = extension.ior;
|
|
16450
16577
|
}
|
|
16451
16578
|
}
|
|
16452
|
-
function parseTransmissionExtension(device, extension, parsedMaterial, gltf) {
|
|
16579
|
+
function parseTransmissionExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16453
16580
|
if (!extension) {
|
|
16454
16581
|
return;
|
|
16455
16582
|
}
|
|
@@ -16462,15 +16589,17 @@ out float vTime;
|
|
|
16462
16589
|
define: "HAS_TRANSMISSIONMAP",
|
|
16463
16590
|
enabledUniformName: "transmissionMapEnabled"
|
|
16464
16591
|
},
|
|
16465
|
-
gltf
|
|
16592
|
+
gltf,
|
|
16593
|
+
attributes,
|
|
16594
|
+
textureTransformSlot: "transmission"
|
|
16466
16595
|
});
|
|
16467
16596
|
}
|
|
16468
16597
|
if ((extension.transmissionFactor ?? 0) > 0 || extension.transmissionTexture) {
|
|
16469
|
-
|
|
16598
|
+
import_core21.log.warn("KHR_materials_transmission uses a premultiplied-alpha blending approximation and may require mesh sorting")();
|
|
16470
16599
|
applyTransmissionBlendApproximation(parsedMaterial);
|
|
16471
16600
|
}
|
|
16472
16601
|
}
|
|
16473
|
-
function parseVolumeExtension(device, extension, parsedMaterial, gltf) {
|
|
16602
|
+
function parseVolumeExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16474
16603
|
if (!extension) {
|
|
16475
16604
|
return;
|
|
16476
16605
|
}
|
|
@@ -16482,7 +16611,9 @@ out float vTime;
|
|
|
16482
16611
|
featureOptions: {
|
|
16483
16612
|
define: "HAS_THICKNESSMAP"
|
|
16484
16613
|
},
|
|
16485
|
-
gltf
|
|
16614
|
+
gltf,
|
|
16615
|
+
attributes,
|
|
16616
|
+
textureTransformSlot: "thickness"
|
|
16486
16617
|
});
|
|
16487
16618
|
}
|
|
16488
16619
|
if (extension.attenuationDistance !== void 0) {
|
|
@@ -16492,7 +16623,7 @@ out float vTime;
|
|
|
16492
16623
|
parsedMaterial.uniforms.attenuationColor = extension.attenuationColor;
|
|
16493
16624
|
}
|
|
16494
16625
|
}
|
|
16495
|
-
function parseClearcoatExtension(device, extension, parsedMaterial, gltf) {
|
|
16626
|
+
function parseClearcoatExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16496
16627
|
if (!extension) {
|
|
16497
16628
|
return;
|
|
16498
16629
|
}
|
|
@@ -16508,7 +16639,9 @@ out float vTime;
|
|
|
16508
16639
|
define: "HAS_CLEARCOATMAP",
|
|
16509
16640
|
enabledUniformName: "clearcoatMapEnabled"
|
|
16510
16641
|
},
|
|
16511
|
-
gltf
|
|
16642
|
+
gltf,
|
|
16643
|
+
attributes,
|
|
16644
|
+
textureTransformSlot: "clearcoat"
|
|
16512
16645
|
});
|
|
16513
16646
|
}
|
|
16514
16647
|
if (extension.clearcoatRoughnessTexture) {
|
|
@@ -16517,7 +16650,9 @@ out float vTime;
|
|
|
16517
16650
|
define: "HAS_CLEARCOATROUGHNESSMAP",
|
|
16518
16651
|
enabledUniformName: "clearcoatRoughnessMapEnabled"
|
|
16519
16652
|
},
|
|
16520
|
-
gltf
|
|
16653
|
+
gltf,
|
|
16654
|
+
attributes,
|
|
16655
|
+
textureTransformSlot: "clearcoatRoughness"
|
|
16521
16656
|
});
|
|
16522
16657
|
}
|
|
16523
16658
|
if (extension.clearcoatNormalTexture) {
|
|
@@ -16525,11 +16660,13 @@ out float vTime;
|
|
|
16525
16660
|
featureOptions: {
|
|
16526
16661
|
define: "HAS_CLEARCOATNORMALMAP"
|
|
16527
16662
|
},
|
|
16528
|
-
gltf
|
|
16663
|
+
gltf,
|
|
16664
|
+
attributes,
|
|
16665
|
+
textureTransformSlot: "clearcoatNormal"
|
|
16529
16666
|
});
|
|
16530
16667
|
}
|
|
16531
16668
|
}
|
|
16532
|
-
function parseSheenExtension(device, extension, parsedMaterial, gltf) {
|
|
16669
|
+
function parseSheenExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16533
16670
|
if (!extension) {
|
|
16534
16671
|
return;
|
|
16535
16672
|
}
|
|
@@ -16545,7 +16682,9 @@ out float vTime;
|
|
|
16545
16682
|
define: "HAS_SHEENCOLORMAP",
|
|
16546
16683
|
enabledUniformName: "sheenColorMapEnabled"
|
|
16547
16684
|
},
|
|
16548
|
-
gltf
|
|
16685
|
+
gltf,
|
|
16686
|
+
attributes,
|
|
16687
|
+
textureTransformSlot: "sheenColor"
|
|
16549
16688
|
});
|
|
16550
16689
|
}
|
|
16551
16690
|
if (extension.sheenRoughnessTexture) {
|
|
@@ -16554,11 +16693,13 @@ out float vTime;
|
|
|
16554
16693
|
define: "HAS_SHEENROUGHNESSMAP",
|
|
16555
16694
|
enabledUniformName: "sheenRoughnessMapEnabled"
|
|
16556
16695
|
},
|
|
16557
|
-
gltf
|
|
16696
|
+
gltf,
|
|
16697
|
+
attributes,
|
|
16698
|
+
textureTransformSlot: "sheenRoughness"
|
|
16558
16699
|
});
|
|
16559
16700
|
}
|
|
16560
16701
|
}
|
|
16561
|
-
function parseIridescenceExtension(device, extension, parsedMaterial, gltf) {
|
|
16702
|
+
function parseIridescenceExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16562
16703
|
if (!extension) {
|
|
16563
16704
|
return;
|
|
16564
16705
|
}
|
|
@@ -16580,7 +16721,9 @@ out float vTime;
|
|
|
16580
16721
|
define: "HAS_IRIDESCENCEMAP",
|
|
16581
16722
|
enabledUniformName: "iridescenceMapEnabled"
|
|
16582
16723
|
},
|
|
16583
|
-
gltf
|
|
16724
|
+
gltf,
|
|
16725
|
+
attributes,
|
|
16726
|
+
textureTransformSlot: "iridescence"
|
|
16584
16727
|
});
|
|
16585
16728
|
}
|
|
16586
16729
|
if (extension.iridescenceThicknessTexture) {
|
|
@@ -16588,11 +16731,13 @@ out float vTime;
|
|
|
16588
16731
|
featureOptions: {
|
|
16589
16732
|
define: "HAS_IRIDESCENCETHICKNESSMAP"
|
|
16590
16733
|
},
|
|
16591
|
-
gltf
|
|
16734
|
+
gltf,
|
|
16735
|
+
attributes,
|
|
16736
|
+
textureTransformSlot: "iridescenceThickness"
|
|
16592
16737
|
});
|
|
16593
16738
|
}
|
|
16594
16739
|
}
|
|
16595
|
-
function parseAnisotropyExtension(device, extension, parsedMaterial, gltf) {
|
|
16740
|
+
function parseAnisotropyExtension(device, extension, parsedMaterial, gltf, attributes = {}) {
|
|
16596
16741
|
if (!extension) {
|
|
16597
16742
|
return;
|
|
16598
16743
|
}
|
|
@@ -16608,7 +16753,9 @@ out float vTime;
|
|
|
16608
16753
|
define: "HAS_ANISOTROPYMAP",
|
|
16609
16754
|
enabledUniformName: "anisotropyMapEnabled"
|
|
16610
16755
|
},
|
|
16611
|
-
gltf
|
|
16756
|
+
gltf,
|
|
16757
|
+
attributes,
|
|
16758
|
+
textureTransformSlot: "anisotropy"
|
|
16612
16759
|
});
|
|
16613
16760
|
}
|
|
16614
16761
|
}
|
|
@@ -16618,12 +16765,21 @@ out float vTime;
|
|
|
16618
16765
|
}
|
|
16619
16766
|
}
|
|
16620
16767
|
function addTexture(device, gltfTexture, uniformName, parsedMaterial, textureParseOptions = {}) {
|
|
16621
|
-
const { featureOptions = {}, gltf } = textureParseOptions;
|
|
16768
|
+
const { featureOptions = {}, gltf, attributes = {}, textureTransformSlot } = textureParseOptions;
|
|
16622
16769
|
const { define: define2, enabledUniformName } = featureOptions;
|
|
16770
|
+
const textureCoordinateSet = resolveTextureCoordinateSet(gltfTexture);
|
|
16771
|
+
if (textureCoordinateSet > 1) {
|
|
16772
|
+
import_core21.log.warn(`Skipping ${String(uniformName)} because ${textureCoordinateSet} is not supported; only TEXCOORD_0 and TEXCOORD_1 are currently available`)();
|
|
16773
|
+
return;
|
|
16774
|
+
}
|
|
16775
|
+
if (textureCoordinateSet === 1 && !attributes["TEXCOORD_1"]) {
|
|
16776
|
+
import_core21.log.warn(`Skipping ${String(uniformName)} because it requires TEXCOORD_1 but the primitive does not provide TEXCOORD_1`)();
|
|
16777
|
+
return;
|
|
16778
|
+
}
|
|
16623
16779
|
const resolvedTextureInfo = resolveTextureInfo(gltfTexture, gltf);
|
|
16624
16780
|
const image = resolvedTextureInfo.texture?.source?.image;
|
|
16625
16781
|
if (!image) {
|
|
16626
|
-
|
|
16782
|
+
import_core21.log.warn(`Skipping unresolved glTF texture for ${String(uniformName)}`)();
|
|
16627
16783
|
return;
|
|
16628
16784
|
}
|
|
16629
16785
|
const gltfSampler = {
|
|
@@ -16659,6 +16815,11 @@ out float vTime;
|
|
|
16659
16815
|
if (enabledUniformName) {
|
|
16660
16816
|
parsedMaterial.uniforms[enabledUniformName] = true;
|
|
16661
16817
|
}
|
|
16818
|
+
if (textureTransformSlot) {
|
|
16819
|
+
const textureTransformSlotDefinition = getTextureTransformSlotDefinition(textureTransformSlot);
|
|
16820
|
+
parsedMaterial.uniforms[textureTransformSlotDefinition.uvSetUniform] = textureCoordinateSet;
|
|
16821
|
+
parsedMaterial.uniforms[textureTransformSlotDefinition.uvTransformUniform] = getTextureTransformMatrix(resolveTextureTransform(gltfTexture));
|
|
16822
|
+
}
|
|
16662
16823
|
parsedMaterial.generatedTextures.push(texture);
|
|
16663
16824
|
}
|
|
16664
16825
|
function resolveTextureInfo(gltfTexture, gltf) {
|
|
@@ -16697,7 +16858,7 @@ out float vTime;
|
|
|
16697
16858
|
return level.textureFormat;
|
|
16698
16859
|
}
|
|
16699
16860
|
function getMaxCompressedMipLevels(baseWidth, baseHeight, format) {
|
|
16700
|
-
const { blockWidth = 1, blockHeight = 1 } =
|
|
16861
|
+
const { blockWidth = 1, blockHeight = 1 } = import_core21.textureFormatDecoder.getInfo(format);
|
|
16701
16862
|
let count = 1;
|
|
16702
16863
|
for (let i = 1; ; i++) {
|
|
16703
16864
|
const w2 = Math.max(1, baseWidth >> i);
|
|
@@ -16718,19 +16879,19 @@ out float vTime;
|
|
|
16718
16879
|
levels = [];
|
|
16719
16880
|
}
|
|
16720
16881
|
if (levels.length === 0 || !levels[0]?.data) {
|
|
16721
|
-
|
|
16882
|
+
import_core21.log.warn("createCompressedTexture: compressed image has no valid mip levels, creating fallback")();
|
|
16722
16883
|
return createCompressedTextureFallback(device, baseOptions);
|
|
16723
16884
|
}
|
|
16724
16885
|
const baseLevel = levels[0];
|
|
16725
16886
|
const baseWidth = baseLevel.width ?? image.width ?? 0;
|
|
16726
16887
|
const baseHeight = baseLevel.height ?? image.height ?? 0;
|
|
16727
16888
|
if (baseWidth <= 0 || baseHeight <= 0) {
|
|
16728
|
-
|
|
16889
|
+
import_core21.log.warn("createCompressedTexture: base level has invalid dimensions, creating fallback")();
|
|
16729
16890
|
return createCompressedTextureFallback(device, baseOptions);
|
|
16730
16891
|
}
|
|
16731
16892
|
const format = resolveCompressedTextureFormat(baseLevel);
|
|
16732
16893
|
if (!format) {
|
|
16733
|
-
|
|
16894
|
+
import_core21.log.warn("createCompressedTexture: compressed image has no textureFormat, creating fallback")();
|
|
16734
16895
|
return createCompressedTextureFallback(device, baseOptions);
|
|
16735
16896
|
}
|
|
16736
16897
|
const maxMipLevels = getMaxCompressedMipLevels(baseWidth, baseHeight, format);
|
|
@@ -16739,18 +16900,18 @@ out float vTime;
|
|
|
16739
16900
|
for (let i = 1; i < levelLimit; i++) {
|
|
16740
16901
|
const level = levels[i];
|
|
16741
16902
|
if (!level.data || level.width <= 0 || level.height <= 0) {
|
|
16742
|
-
|
|
16903
|
+
import_core21.log.warn(`createCompressedTexture: mip level ${i} has invalid data/dimensions, truncating`)();
|
|
16743
16904
|
break;
|
|
16744
16905
|
}
|
|
16745
16906
|
const levelFormat = resolveCompressedTextureFormat(level);
|
|
16746
16907
|
if (levelFormat && levelFormat !== format) {
|
|
16747
|
-
|
|
16908
|
+
import_core21.log.warn(`createCompressedTexture: mip level ${i} format '${levelFormat}' differs from base '${format}', truncating`)();
|
|
16748
16909
|
break;
|
|
16749
16910
|
}
|
|
16750
16911
|
const expectedW = Math.max(1, baseWidth >> i);
|
|
16751
16912
|
const expectedH = Math.max(1, baseHeight >> i);
|
|
16752
16913
|
if (level.width !== expectedW || level.height !== expectedH) {
|
|
16753
|
-
|
|
16914
|
+
import_core21.log.warn(`createCompressedTexture: mip level ${i} dimensions ${level.width}x${level.height} don't match expected ${expectedW}x${expectedH}, truncating`)();
|
|
16754
16915
|
break;
|
|
16755
16916
|
}
|
|
16756
16917
|
validLevelCount++;
|
|
@@ -16758,7 +16919,7 @@ out float vTime;
|
|
|
16758
16919
|
const texture = device.createTexture({
|
|
16759
16920
|
...baseOptions,
|
|
16760
16921
|
format,
|
|
16761
|
-
usage:
|
|
16922
|
+
usage: import_core21.Texture.TEXTURE | import_core21.Texture.COPY_DST,
|
|
16762
16923
|
width: baseWidth,
|
|
16763
16924
|
height: baseHeight,
|
|
16764
16925
|
mipLevels: validLevelCount,
|
|
@@ -16774,8 +16935,19 @@ out float vTime;
|
|
|
16774
16935
|
return texture;
|
|
16775
16936
|
}
|
|
16776
16937
|
|
|
16938
|
+
// ../../node_modules/@luma.gl/shadertools/dist/lib/color/normalize-byte-colors.js
|
|
16939
|
+
function resolveUseByteColors(useByteColors, defaultUseByteColors = true) {
|
|
16940
|
+
return useByteColors ?? defaultUseByteColors;
|
|
16941
|
+
}
|
|
16942
|
+
function normalizeByteColor3(color = [0, 0, 0], useByteColors = true) {
|
|
16943
|
+
if (!useByteColors) {
|
|
16944
|
+
return [...color];
|
|
16945
|
+
}
|
|
16946
|
+
return color.map((component) => component / 255);
|
|
16947
|
+
}
|
|
16948
|
+
|
|
16777
16949
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
|
|
16778
|
-
var
|
|
16950
|
+
var import_core22 = __toESM(require_core3(), 1);
|
|
16779
16951
|
|
|
16780
16952
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-glsl.js
|
|
16781
16953
|
var lightingUniformsGLSL = (
|
|
@@ -16950,7 +17122,6 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
16950
17122
|
|
|
16951
17123
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
|
|
16952
17124
|
var MAX_LIGHTS = 5;
|
|
16953
|
-
var COLOR_FACTOR = 255;
|
|
16954
17125
|
var LIGHT_UNIFORM_TYPE = {
|
|
16955
17126
|
color: "vec3<f32>",
|
|
16956
17127
|
position: "vec3<f32>",
|
|
@@ -16989,7 +17160,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
16989
17160
|
if (props.lights) {
|
|
16990
17161
|
props = { ...props, ...extractLightTypes(props.lights), lights: void 0 };
|
|
16991
17162
|
}
|
|
16992
|
-
const { ambientLight, pointLights, spotLights, directionalLights } = props || {};
|
|
17163
|
+
const { useByteColors, ambientLight, pointLights, spotLights, directionalLights } = props || {};
|
|
16993
17164
|
const hasLights = ambientLight || pointLights && pointLights.length > 0 || spotLights && spotLights.length > 0 || directionalLights && directionalLights.length > 0;
|
|
16994
17165
|
if (!hasLights) {
|
|
16995
17166
|
return {
|
|
@@ -16999,14 +17170,20 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
16999
17170
|
}
|
|
17000
17171
|
const uniforms = {
|
|
17001
17172
|
...createDefaultLightingUniforms(),
|
|
17002
|
-
...getLightSourceUniforms({
|
|
17173
|
+
...getLightSourceUniforms({
|
|
17174
|
+
useByteColors,
|
|
17175
|
+
ambientLight,
|
|
17176
|
+
pointLights,
|
|
17177
|
+
spotLights,
|
|
17178
|
+
directionalLights
|
|
17179
|
+
})
|
|
17003
17180
|
};
|
|
17004
17181
|
if (props.enabled !== void 0) {
|
|
17005
17182
|
uniforms.enabled = props.enabled ? 1 : 0;
|
|
17006
17183
|
}
|
|
17007
17184
|
return uniforms;
|
|
17008
17185
|
}
|
|
17009
|
-
function getLightSourceUniforms({ ambientLight, pointLights = [], spotLights = [], directionalLights = [] }) {
|
|
17186
|
+
function getLightSourceUniforms({ useByteColors, ambientLight, pointLights = [], spotLights = [], directionalLights = [] }) {
|
|
17010
17187
|
const lights = createDefaultLightUniforms();
|
|
17011
17188
|
let currentLight = 0;
|
|
17012
17189
|
let pointLightCount = 0;
|
|
@@ -17018,7 +17195,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17018
17195
|
}
|
|
17019
17196
|
lights[currentLight] = {
|
|
17020
17197
|
...lights[currentLight],
|
|
17021
|
-
color: convertColor(pointLight),
|
|
17198
|
+
color: convertColor(pointLight, useByteColors),
|
|
17022
17199
|
position: pointLight.position,
|
|
17023
17200
|
attenuation: pointLight.attenuation || [1, 0, 0]
|
|
17024
17201
|
};
|
|
@@ -17031,7 +17208,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17031
17208
|
}
|
|
17032
17209
|
lights[currentLight] = {
|
|
17033
17210
|
...lights[currentLight],
|
|
17034
|
-
color: convertColor(spotLight),
|
|
17211
|
+
color: convertColor(spotLight, useByteColors),
|
|
17035
17212
|
position: spotLight.position,
|
|
17036
17213
|
direction: spotLight.direction,
|
|
17037
17214
|
attenuation: spotLight.attenuation || [1, 0, 0],
|
|
@@ -17046,17 +17223,17 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17046
17223
|
}
|
|
17047
17224
|
lights[currentLight] = {
|
|
17048
17225
|
...lights[currentLight],
|
|
17049
|
-
color: convertColor(directionalLight),
|
|
17226
|
+
color: convertColor(directionalLight, useByteColors),
|
|
17050
17227
|
direction: directionalLight.direction
|
|
17051
17228
|
};
|
|
17052
17229
|
currentLight++;
|
|
17053
17230
|
directionalLightCount++;
|
|
17054
17231
|
}
|
|
17055
17232
|
if (pointLights.length + spotLights.length + directionalLights.length > MAX_LIGHTS) {
|
|
17056
|
-
|
|
17233
|
+
import_core22.log.warn(`MAX_LIGHTS exceeded, truncating to ${MAX_LIGHTS}`)();
|
|
17057
17234
|
}
|
|
17058
17235
|
return {
|
|
17059
|
-
ambientColor: convertColor(ambientLight),
|
|
17236
|
+
ambientColor: convertColor(ambientLight, useByteColors),
|
|
17060
17237
|
directionalLightCount,
|
|
17061
17238
|
pointLightCount,
|
|
17062
17239
|
spotLightCount,
|
|
@@ -17084,9 +17261,10 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
|
|
|
17084
17261
|
}
|
|
17085
17262
|
return lightSources;
|
|
17086
17263
|
}
|
|
17087
|
-
function convertColor(colorDef = {}) {
|
|
17264
|
+
function convertColor(colorDef = {}, useByteColors) {
|
|
17088
17265
|
const { color = [0, 0, 0], intensity = 1 } = colorDef;
|
|
17089
|
-
|
|
17266
|
+
const normalizedColor = normalizeByteColor3(color, resolveUseByteColors(useByteColors, true));
|
|
17267
|
+
return normalizedColor.map((component) => component * intensity);
|
|
17090
17268
|
}
|
|
17091
17269
|
function createDefaultLightingUniforms() {
|
|
17092
17270
|
return {
|
|
@@ -17155,7 +17333,8 @@ uniform sampler2D pbr_brdfLUT;
|
|
|
17155
17333
|
var vs = (
|
|
17156
17334
|
/* glsl */
|
|
17157
17335
|
`out vec3 pbr_vPosition;
|
|
17158
|
-
out vec2
|
|
17336
|
+
out vec2 pbr_vUV0;
|
|
17337
|
+
out vec2 pbr_vUV1;
|
|
17159
17338
|
|
|
17160
17339
|
#ifdef HAS_NORMALS
|
|
17161
17340
|
# ifdef HAS_TANGENTS
|
|
@@ -17165,7 +17344,13 @@ out vec3 pbr_vNormal;
|
|
|
17165
17344
|
# endif
|
|
17166
17345
|
#endif
|
|
17167
17346
|
|
|
17168
|
-
void pbr_setPositionNormalTangentUV(
|
|
17347
|
+
void pbr_setPositionNormalTangentUV(
|
|
17348
|
+
vec4 position,
|
|
17349
|
+
vec4 normal,
|
|
17350
|
+
vec4 tangent,
|
|
17351
|
+
vec2 uv0,
|
|
17352
|
+
vec2 uv1
|
|
17353
|
+
)
|
|
17169
17354
|
{
|
|
17170
17355
|
vec4 pos = pbrProjection.modelMatrix * position;
|
|
17171
17356
|
pbr_vPosition = vec3(pos.xyz) / pos.w;
|
|
@@ -17182,10 +17367,12 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
|
|
|
17182
17367
|
#endif
|
|
17183
17368
|
|
|
17184
17369
|
#ifdef HAS_UV
|
|
17185
|
-
|
|
17370
|
+
pbr_vUV0 = uv0;
|
|
17186
17371
|
#else
|
|
17187
|
-
|
|
17372
|
+
pbr_vUV0 = vec2(0.,0.);
|
|
17188
17373
|
#endif
|
|
17374
|
+
|
|
17375
|
+
pbr_vUV1 = uv1;
|
|
17189
17376
|
}
|
|
17190
17377
|
`
|
|
17191
17378
|
);
|
|
@@ -17261,6 +17448,41 @@ layout(std140) uniform pbrMaterialUniforms {
|
|
|
17261
17448
|
vec4 scaleDiffBaseMR;
|
|
17262
17449
|
vec4 scaleFGDSpec;
|
|
17263
17450
|
// #endif
|
|
17451
|
+
|
|
17452
|
+
int baseColorUVSet;
|
|
17453
|
+
mat3 baseColorUVTransform;
|
|
17454
|
+
int metallicRoughnessUVSet;
|
|
17455
|
+
mat3 metallicRoughnessUVTransform;
|
|
17456
|
+
int normalUVSet;
|
|
17457
|
+
mat3 normalUVTransform;
|
|
17458
|
+
int occlusionUVSet;
|
|
17459
|
+
mat3 occlusionUVTransform;
|
|
17460
|
+
int emissiveUVSet;
|
|
17461
|
+
mat3 emissiveUVTransform;
|
|
17462
|
+
int specularColorUVSet;
|
|
17463
|
+
mat3 specularColorUVTransform;
|
|
17464
|
+
int specularIntensityUVSet;
|
|
17465
|
+
mat3 specularIntensityUVTransform;
|
|
17466
|
+
int transmissionUVSet;
|
|
17467
|
+
mat3 transmissionUVTransform;
|
|
17468
|
+
int thicknessUVSet;
|
|
17469
|
+
mat3 thicknessUVTransform;
|
|
17470
|
+
int clearcoatUVSet;
|
|
17471
|
+
mat3 clearcoatUVTransform;
|
|
17472
|
+
int clearcoatRoughnessUVSet;
|
|
17473
|
+
mat3 clearcoatRoughnessUVTransform;
|
|
17474
|
+
int clearcoatNormalUVSet;
|
|
17475
|
+
mat3 clearcoatNormalUVTransform;
|
|
17476
|
+
int sheenColorUVSet;
|
|
17477
|
+
mat3 sheenColorUVTransform;
|
|
17478
|
+
int sheenRoughnessUVSet;
|
|
17479
|
+
mat3 sheenRoughnessUVTransform;
|
|
17480
|
+
int iridescenceUVSet;
|
|
17481
|
+
mat3 iridescenceUVTransform;
|
|
17482
|
+
int iridescenceThicknessUVSet;
|
|
17483
|
+
mat3 iridescenceThicknessUVTransform;
|
|
17484
|
+
int anisotropyUVSet;
|
|
17485
|
+
mat3 anisotropyUVTransform;
|
|
17264
17486
|
} pbrMaterial;
|
|
17265
17487
|
|
|
17266
17488
|
// Samplers
|
|
@@ -17318,7 +17540,8 @@ uniform sampler2D pbr_anisotropySampler;
|
|
|
17318
17540
|
// Inputs from vertex shader
|
|
17319
17541
|
|
|
17320
17542
|
in vec3 pbr_vPosition;
|
|
17321
|
-
in vec2
|
|
17543
|
+
in vec2 pbr_vUV0;
|
|
17544
|
+
in vec2 pbr_vUV1;
|
|
17322
17545
|
|
|
17323
17546
|
#ifdef HAS_NORMALS
|
|
17324
17547
|
#ifdef HAS_TANGENTS
|
|
@@ -17368,14 +17591,20 @@ vec4 SRGBtoLINEAR(vec4 srgbIn)
|
|
|
17368
17591
|
#endif //MANUAL_SRGB
|
|
17369
17592
|
}
|
|
17370
17593
|
|
|
17594
|
+
vec2 getMaterialUV(int uvSet, mat3 uvTransform)
|
|
17595
|
+
{
|
|
17596
|
+
vec2 baseUV = uvSet == 1 ? pbr_vUV1 : pbr_vUV0;
|
|
17597
|
+
return (uvTransform * vec3(baseUV, 1.0)).xy;
|
|
17598
|
+
}
|
|
17599
|
+
|
|
17371
17600
|
// Build the tangent basis from interpolated attributes or screen-space derivatives.
|
|
17372
|
-
mat3 getTBN()
|
|
17601
|
+
mat3 getTBN(vec2 uv)
|
|
17373
17602
|
{
|
|
17374
17603
|
#ifndef HAS_TANGENTS
|
|
17375
17604
|
vec3 pos_dx = dFdx(pbr_vPosition);
|
|
17376
17605
|
vec3 pos_dy = dFdy(pbr_vPosition);
|
|
17377
|
-
vec3 tex_dx = dFdx(vec3(
|
|
17378
|
-
vec3 tex_dy = dFdy(vec3(
|
|
17606
|
+
vec3 tex_dx = dFdx(vec3(uv, 0.0));
|
|
17607
|
+
vec3 tex_dy = dFdy(vec3(uv, 0.0));
|
|
17379
17608
|
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
17609
|
|
|
17381
17610
|
#ifdef HAS_NORMALS
|
|
@@ -17396,16 +17625,16 @@ mat3 getTBN()
|
|
|
17396
17625
|
|
|
17397
17626
|
// Find the normal for this fragment, pulling either from a predefined normal map
|
|
17398
17627
|
// or from the interpolated mesh normal and tangent attributes.
|
|
17399
|
-
vec3 getMappedNormal(sampler2D normalSampler, mat3 tbn, float normalScale)
|
|
17628
|
+
vec3 getMappedNormal(sampler2D normalSampler, mat3 tbn, float normalScale, vec2 uv)
|
|
17400
17629
|
{
|
|
17401
|
-
vec3 n = texture(normalSampler,
|
|
17630
|
+
vec3 n = texture(normalSampler, uv).rgb;
|
|
17402
17631
|
return normalize(tbn * ((2.0 * n - 1.0) * vec3(normalScale, normalScale, 1.0)));
|
|
17403
17632
|
}
|
|
17404
17633
|
|
|
17405
|
-
vec3 getNormal(mat3 tbn)
|
|
17634
|
+
vec3 getNormal(mat3 tbn, vec2 uv)
|
|
17406
17635
|
{
|
|
17407
17636
|
#ifdef HAS_NORMALMAP
|
|
17408
|
-
vec3 n = getMappedNormal(pbr_normalSampler, tbn, pbrMaterial.normalScale);
|
|
17637
|
+
vec3 n = getMappedNormal(pbr_normalSampler, tbn, pbrMaterial.normalScale, uv);
|
|
17409
17638
|
#else
|
|
17410
17639
|
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
17411
17640
|
vec3 n = normalize(tbn[2].xyz);
|
|
@@ -17414,10 +17643,10 @@ vec3 getNormal(mat3 tbn)
|
|
|
17414
17643
|
return n;
|
|
17415
17644
|
}
|
|
17416
17645
|
|
|
17417
|
-
vec3 getClearcoatNormal(mat3 tbn, vec3 baseNormal)
|
|
17646
|
+
vec3 getClearcoatNormal(mat3 tbn, vec3 baseNormal, vec2 uv)
|
|
17418
17647
|
{
|
|
17419
17648
|
#ifdef HAS_CLEARCOATNORMALMAP
|
|
17420
|
-
return getMappedNormal(pbr_clearcoatNormalSampler, tbn, 1.0);
|
|
17649
|
+
return getMappedNormal(pbr_clearcoatNormalSampler, tbn, 1.0, uv);
|
|
17421
17650
|
#else
|
|
17422
17651
|
return baseNormal;
|
|
17423
17652
|
#endif
|
|
@@ -17705,9 +17934,61 @@ vec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) {
|
|
|
17705
17934
|
|
|
17706
17935
|
vec4 pbr_filterColor(vec4 colorUnused)
|
|
17707
17936
|
{
|
|
17937
|
+
vec2 baseColorUV = getMaterialUV(pbrMaterial.baseColorUVSet, pbrMaterial.baseColorUVTransform);
|
|
17938
|
+
vec2 metallicRoughnessUV = getMaterialUV(
|
|
17939
|
+
pbrMaterial.metallicRoughnessUVSet,
|
|
17940
|
+
pbrMaterial.metallicRoughnessUVTransform
|
|
17941
|
+
);
|
|
17942
|
+
vec2 normalUV = getMaterialUV(pbrMaterial.normalUVSet, pbrMaterial.normalUVTransform);
|
|
17943
|
+
vec2 occlusionUV = getMaterialUV(pbrMaterial.occlusionUVSet, pbrMaterial.occlusionUVTransform);
|
|
17944
|
+
vec2 emissiveUV = getMaterialUV(pbrMaterial.emissiveUVSet, pbrMaterial.emissiveUVTransform);
|
|
17945
|
+
vec2 specularColorUV = getMaterialUV(
|
|
17946
|
+
pbrMaterial.specularColorUVSet,
|
|
17947
|
+
pbrMaterial.specularColorUVTransform
|
|
17948
|
+
);
|
|
17949
|
+
vec2 specularIntensityUV = getMaterialUV(
|
|
17950
|
+
pbrMaterial.specularIntensityUVSet,
|
|
17951
|
+
pbrMaterial.specularIntensityUVTransform
|
|
17952
|
+
);
|
|
17953
|
+
vec2 transmissionUV = getMaterialUV(
|
|
17954
|
+
pbrMaterial.transmissionUVSet,
|
|
17955
|
+
pbrMaterial.transmissionUVTransform
|
|
17956
|
+
);
|
|
17957
|
+
vec2 thicknessUV = getMaterialUV(pbrMaterial.thicknessUVSet, pbrMaterial.thicknessUVTransform);
|
|
17958
|
+
vec2 clearcoatUV = getMaterialUV(pbrMaterial.clearcoatUVSet, pbrMaterial.clearcoatUVTransform);
|
|
17959
|
+
vec2 clearcoatRoughnessUV = getMaterialUV(
|
|
17960
|
+
pbrMaterial.clearcoatRoughnessUVSet,
|
|
17961
|
+
pbrMaterial.clearcoatRoughnessUVTransform
|
|
17962
|
+
);
|
|
17963
|
+
vec2 clearcoatNormalUV = getMaterialUV(
|
|
17964
|
+
pbrMaterial.clearcoatNormalUVSet,
|
|
17965
|
+
pbrMaterial.clearcoatNormalUVTransform
|
|
17966
|
+
);
|
|
17967
|
+
vec2 sheenColorUV = getMaterialUV(
|
|
17968
|
+
pbrMaterial.sheenColorUVSet,
|
|
17969
|
+
pbrMaterial.sheenColorUVTransform
|
|
17970
|
+
);
|
|
17971
|
+
vec2 sheenRoughnessUV = getMaterialUV(
|
|
17972
|
+
pbrMaterial.sheenRoughnessUVSet,
|
|
17973
|
+
pbrMaterial.sheenRoughnessUVTransform
|
|
17974
|
+
);
|
|
17975
|
+
vec2 iridescenceUV = getMaterialUV(
|
|
17976
|
+
pbrMaterial.iridescenceUVSet,
|
|
17977
|
+
pbrMaterial.iridescenceUVTransform
|
|
17978
|
+
);
|
|
17979
|
+
vec2 iridescenceThicknessUV = getMaterialUV(
|
|
17980
|
+
pbrMaterial.iridescenceThicknessUVSet,
|
|
17981
|
+
pbrMaterial.iridescenceThicknessUVTransform
|
|
17982
|
+
);
|
|
17983
|
+
vec2 anisotropyUV = getMaterialUV(
|
|
17984
|
+
pbrMaterial.anisotropyUVSet,
|
|
17985
|
+
pbrMaterial.anisotropyUVTransform
|
|
17986
|
+
);
|
|
17987
|
+
|
|
17708
17988
|
// The albedo may be defined from a base texture or a flat color
|
|
17709
17989
|
#ifdef HAS_BASECOLORMAP
|
|
17710
|
-
vec4 baseColor =
|
|
17990
|
+
vec4 baseColor =
|
|
17991
|
+
SRGBtoLINEAR(texture(pbr_baseColorSampler, baseColorUV)) * pbrMaterial.baseColorFactor;
|
|
17711
17992
|
#else
|
|
17712
17993
|
vec4 baseColor = pbrMaterial.baseColorFactor;
|
|
17713
17994
|
#endif
|
|
@@ -17734,14 +18015,14 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17734
18015
|
#ifdef HAS_METALROUGHNESSMAP
|
|
17735
18016
|
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
|
|
17736
18017
|
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data
|
|
17737
|
-
vec4 mrSample = texture(pbr_metallicRoughnessSampler,
|
|
18018
|
+
vec4 mrSample = texture(pbr_metallicRoughnessSampler, metallicRoughnessUV);
|
|
17738
18019
|
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
17739
18020
|
metallic = mrSample.b * metallic;
|
|
17740
18021
|
#endif
|
|
17741
18022
|
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
|
|
17742
18023
|
metallic = clamp(metallic, 0.0, 1.0);
|
|
17743
|
-
mat3 tbn = getTBN();
|
|
17744
|
-
vec3 n = getNormal(tbn); // normal at surface point
|
|
18024
|
+
mat3 tbn = getTBN(normalUV);
|
|
18025
|
+
vec3 n = getNormal(tbn, normalUV); // normal at surface point
|
|
17745
18026
|
vec3 v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera
|
|
17746
18027
|
float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
17747
18028
|
#ifdef USE_MATERIAL_EXTENSIONS
|
|
@@ -17842,7 +18123,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17842
18123
|
|
|
17843
18124
|
#ifdef HAS_OCCLUSIONMAP
|
|
17844
18125
|
if (pbrMaterial.occlusionMapEnabled) {
|
|
17845
|
-
float ao = texture(pbr_occlusionSampler,
|
|
18126
|
+
float ao = texture(pbr_occlusionSampler, occlusionUV).r;
|
|
17846
18127
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
17847
18128
|
}
|
|
17848
18129
|
#endif
|
|
@@ -17850,7 +18131,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17850
18131
|
vec3 emissive = pbrMaterial.emissiveFactor;
|
|
17851
18132
|
#ifdef HAS_EMISSIVEMAP
|
|
17852
18133
|
if (pbrMaterial.emissiveMapEnabled) {
|
|
17853
|
-
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler,
|
|
18134
|
+
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler, emissiveUV)).rgb;
|
|
17854
18135
|
}
|
|
17855
18136
|
#endif
|
|
17856
18137
|
color += emissive * pbrMaterial.emissiveStrength;
|
|
@@ -17867,55 +18148,55 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17867
18148
|
float specularIntensity = pbrMaterial.specularIntensityFactor;
|
|
17868
18149
|
#ifdef HAS_SPECULARINTENSITYMAP
|
|
17869
18150
|
if (pbrMaterial.specularIntensityMapEnabled) {
|
|
17870
|
-
specularIntensity *= texture(pbr_specularIntensitySampler,
|
|
18151
|
+
specularIntensity *= texture(pbr_specularIntensitySampler, specularIntensityUV).a;
|
|
17871
18152
|
}
|
|
17872
18153
|
#endif
|
|
17873
18154
|
|
|
17874
18155
|
vec3 specularFactor = pbrMaterial.specularColorFactor;
|
|
17875
18156
|
#ifdef HAS_SPECULARCOLORMAP
|
|
17876
18157
|
if (pbrMaterial.specularColorMapEnabled) {
|
|
17877
|
-
specularFactor *= SRGBtoLINEAR(texture(pbr_specularColorSampler,
|
|
18158
|
+
specularFactor *= SRGBtoLINEAR(texture(pbr_specularColorSampler, specularColorUV)).rgb;
|
|
17878
18159
|
}
|
|
17879
18160
|
#endif
|
|
17880
18161
|
|
|
17881
18162
|
transmission = pbrMaterial.transmissionFactor;
|
|
17882
18163
|
#ifdef HAS_TRANSMISSIONMAP
|
|
17883
18164
|
if (pbrMaterial.transmissionMapEnabled) {
|
|
17884
|
-
transmission *= texture(pbr_transmissionSampler,
|
|
18165
|
+
transmission *= texture(pbr_transmissionSampler, transmissionUV).r;
|
|
17885
18166
|
}
|
|
17886
18167
|
#endif
|
|
17887
18168
|
transmission = clamp(transmission * (1.0 - metallic), 0.0, 1.0);
|
|
17888
18169
|
float thickness = max(pbrMaterial.thicknessFactor, 0.0);
|
|
17889
18170
|
#ifdef HAS_THICKNESSMAP
|
|
17890
|
-
thickness *= texture(pbr_thicknessSampler,
|
|
18171
|
+
thickness *= texture(pbr_thicknessSampler, thicknessUV).g;
|
|
17891
18172
|
#endif
|
|
17892
18173
|
|
|
17893
18174
|
float clearcoatFactor = pbrMaterial.clearcoatFactor;
|
|
17894
18175
|
float clearcoatRoughness = pbrMaterial.clearcoatRoughnessFactor;
|
|
17895
18176
|
#ifdef HAS_CLEARCOATMAP
|
|
17896
18177
|
if (pbrMaterial.clearcoatMapEnabled) {
|
|
17897
|
-
clearcoatFactor *= texture(pbr_clearcoatSampler,
|
|
18178
|
+
clearcoatFactor *= texture(pbr_clearcoatSampler, clearcoatUV).r;
|
|
17898
18179
|
}
|
|
17899
18180
|
#endif
|
|
17900
18181
|
#ifdef HAS_CLEARCOATROUGHNESSMAP
|
|
17901
18182
|
if (pbrMaterial.clearcoatRoughnessMapEnabled) {
|
|
17902
|
-
clearcoatRoughness *= texture(pbr_clearcoatRoughnessSampler,
|
|
18183
|
+
clearcoatRoughness *= texture(pbr_clearcoatRoughnessSampler, clearcoatRoughnessUV).g;
|
|
17903
18184
|
}
|
|
17904
18185
|
#endif
|
|
17905
18186
|
clearcoatFactor = clamp(clearcoatFactor, 0.0, 1.0);
|
|
17906
18187
|
clearcoatRoughness = clamp(clearcoatRoughness, c_MinRoughness, 1.0);
|
|
17907
|
-
vec3 clearcoatNormal = getClearcoatNormal(
|
|
18188
|
+
vec3 clearcoatNormal = getClearcoatNormal(getTBN(clearcoatNormalUV), n, clearcoatNormalUV);
|
|
17908
18189
|
|
|
17909
18190
|
vec3 sheenColor = pbrMaterial.sheenColorFactor;
|
|
17910
18191
|
float sheenRoughness = pbrMaterial.sheenRoughnessFactor;
|
|
17911
18192
|
#ifdef HAS_SHEENCOLORMAP
|
|
17912
18193
|
if (pbrMaterial.sheenColorMapEnabled) {
|
|
17913
|
-
sheenColor *= SRGBtoLINEAR(texture(pbr_sheenColorSampler,
|
|
18194
|
+
sheenColor *= SRGBtoLINEAR(texture(pbr_sheenColorSampler, sheenColorUV)).rgb;
|
|
17914
18195
|
}
|
|
17915
18196
|
#endif
|
|
17916
18197
|
#ifdef HAS_SHEENROUGHNESSMAP
|
|
17917
18198
|
if (pbrMaterial.sheenRoughnessMapEnabled) {
|
|
17918
|
-
sheenRoughness *= texture(pbr_sheenRoughnessSampler,
|
|
18199
|
+
sheenRoughness *= texture(pbr_sheenRoughnessSampler, sheenRoughnessUV).a;
|
|
17919
18200
|
}
|
|
17920
18201
|
#endif
|
|
17921
18202
|
sheenRoughness = clamp(sheenRoughness, c_MinRoughness, 1.0);
|
|
@@ -17923,7 +18204,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17923
18204
|
float iridescence = pbrMaterial.iridescenceFactor;
|
|
17924
18205
|
#ifdef HAS_IRIDESCENCEMAP
|
|
17925
18206
|
if (pbrMaterial.iridescenceMapEnabled) {
|
|
17926
|
-
iridescence *= texture(pbr_iridescenceSampler,
|
|
18207
|
+
iridescence *= texture(pbr_iridescenceSampler, iridescenceUV).r;
|
|
17927
18208
|
}
|
|
17928
18209
|
#endif
|
|
17929
18210
|
iridescence = clamp(iridescence, 0.0, 1.0);
|
|
@@ -17936,7 +18217,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17936
18217
|
iridescenceThickness = mix(
|
|
17937
18218
|
pbrMaterial.iridescenceThicknessRange.x,
|
|
17938
18219
|
pbrMaterial.iridescenceThicknessRange.y,
|
|
17939
|
-
texture(pbr_iridescenceThicknessSampler,
|
|
18220
|
+
texture(pbr_iridescenceThicknessSampler, iridescenceThicknessUV).g
|
|
17940
18221
|
);
|
|
17941
18222
|
#endif
|
|
17942
18223
|
|
|
@@ -17944,7 +18225,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
17944
18225
|
vec2 anisotropyDirection = normalizeDirection(pbrMaterial.anisotropyDirection);
|
|
17945
18226
|
#ifdef HAS_ANISOTROPYMAP
|
|
17946
18227
|
if (pbrMaterial.anisotropyMapEnabled) {
|
|
17947
|
-
vec3 anisotropySample = texture(pbr_anisotropySampler,
|
|
18228
|
+
vec3 anisotropySample = texture(pbr_anisotropySampler, anisotropyUV).rgb;
|
|
17948
18229
|
anisotropyStrength *= anisotropySample.b;
|
|
17949
18230
|
vec2 mappedDirection = anisotropySample.rg * 2.0 - 1.0;
|
|
17950
18231
|
if (length(mappedDirection) > 0.0001) {
|
|
@@ -18107,7 +18388,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
18107
18388
|
// Apply optional PBR terms for additional (optional) shading
|
|
18108
18389
|
#ifdef HAS_OCCLUSIONMAP
|
|
18109
18390
|
if (pbrMaterial.occlusionMapEnabled) {
|
|
18110
|
-
float ao = texture(pbr_occlusionSampler,
|
|
18391
|
+
float ao = texture(pbr_occlusionSampler, occlusionUV).r;
|
|
18111
18392
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
18112
18393
|
}
|
|
18113
18394
|
#endif
|
|
@@ -18115,7 +18396,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
18115
18396
|
vec3 emissive = pbrMaterial.emissiveFactor;
|
|
18116
18397
|
#ifdef HAS_EMISSIVEMAP
|
|
18117
18398
|
if (pbrMaterial.emissiveMapEnabled) {
|
|
18118
|
-
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler,
|
|
18399
|
+
emissive *= SRGBtoLINEAR(texture(pbr_emissiveSampler, emissiveUV)).rgb;
|
|
18119
18400
|
}
|
|
18120
18401
|
#endif
|
|
18121
18402
|
color += emissive * pbrMaterial.emissiveStrength;
|
|
@@ -18153,14 +18434,21 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
18153
18434
|
/* wgsl */
|
|
18154
18435
|
`struct PBRFragmentInputs {
|
|
18155
18436
|
pbr_vPosition: vec3f,
|
|
18156
|
-
|
|
18437
|
+
pbr_vUV0: vec2f,
|
|
18438
|
+
pbr_vUV1: vec2f,
|
|
18157
18439
|
pbr_vTBN: mat3x3f,
|
|
18158
18440
|
pbr_vNormal: vec3f
|
|
18159
18441
|
};
|
|
18160
18442
|
|
|
18161
18443
|
var<private> fragmentInputs: PBRFragmentInputs;
|
|
18162
18444
|
|
|
18163
|
-
fn pbr_setPositionNormalTangentUV(
|
|
18445
|
+
fn pbr_setPositionNormalTangentUV(
|
|
18446
|
+
position: vec4f,
|
|
18447
|
+
normal: vec4f,
|
|
18448
|
+
tangent: vec4f,
|
|
18449
|
+
uv0: vec2f,
|
|
18450
|
+
uv1: vec2f
|
|
18451
|
+
)
|
|
18164
18452
|
{
|
|
18165
18453
|
var pos: vec4f = pbrProjection.modelMatrix * position;
|
|
18166
18454
|
fragmentInputs.pbr_vPosition = pos.xyz / pos.w;
|
|
@@ -18170,7 +18458,8 @@ fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f
|
|
|
18170
18458
|
vec3f(0.0, 1.0, 0.0),
|
|
18171
18459
|
vec3f(0.0, 0.0, 1.0)
|
|
18172
18460
|
);
|
|
18173
|
-
fragmentInputs.
|
|
18461
|
+
fragmentInputs.pbr_vUV0 = vec2f(0.0, 0.0);
|
|
18462
|
+
fragmentInputs.pbr_vUV1 = uv1;
|
|
18174
18463
|
|
|
18175
18464
|
#ifdef HAS_NORMALS
|
|
18176
18465
|
let normalW: vec3f = normalize((pbrProjection.normalMatrix * vec4f(normal.xyz, 0.0)).xyz);
|
|
@@ -18183,7 +18472,7 @@ fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f
|
|
|
18183
18472
|
#endif
|
|
18184
18473
|
|
|
18185
18474
|
#ifdef HAS_UV
|
|
18186
|
-
fragmentInputs.
|
|
18475
|
+
fragmentInputs.pbr_vUV0 = uv0;
|
|
18187
18476
|
#endif
|
|
18188
18477
|
}
|
|
18189
18478
|
|
|
@@ -18255,6 +18544,41 @@ struct pbrMaterialUniforms {
|
|
|
18255
18544
|
scaleDiffBaseMR: vec4f,
|
|
18256
18545
|
scaleFGDSpec: vec4f,
|
|
18257
18546
|
// #endif
|
|
18547
|
+
|
|
18548
|
+
baseColorUVSet: i32,
|
|
18549
|
+
baseColorUVTransform: mat3x3f,
|
|
18550
|
+
metallicRoughnessUVSet: i32,
|
|
18551
|
+
metallicRoughnessUVTransform: mat3x3f,
|
|
18552
|
+
normalUVSet: i32,
|
|
18553
|
+
normalUVTransform: mat3x3f,
|
|
18554
|
+
occlusionUVSet: i32,
|
|
18555
|
+
occlusionUVTransform: mat3x3f,
|
|
18556
|
+
emissiveUVSet: i32,
|
|
18557
|
+
emissiveUVTransform: mat3x3f,
|
|
18558
|
+
specularColorUVSet: i32,
|
|
18559
|
+
specularColorUVTransform: mat3x3f,
|
|
18560
|
+
specularIntensityUVSet: i32,
|
|
18561
|
+
specularIntensityUVTransform: mat3x3f,
|
|
18562
|
+
transmissionUVSet: i32,
|
|
18563
|
+
transmissionUVTransform: mat3x3f,
|
|
18564
|
+
thicknessUVSet: i32,
|
|
18565
|
+
thicknessUVTransform: mat3x3f,
|
|
18566
|
+
clearcoatUVSet: i32,
|
|
18567
|
+
clearcoatUVTransform: mat3x3f,
|
|
18568
|
+
clearcoatRoughnessUVSet: i32,
|
|
18569
|
+
clearcoatRoughnessUVTransform: mat3x3f,
|
|
18570
|
+
clearcoatNormalUVSet: i32,
|
|
18571
|
+
clearcoatNormalUVTransform: mat3x3f,
|
|
18572
|
+
sheenColorUVSet: i32,
|
|
18573
|
+
sheenColorUVTransform: mat3x3f,
|
|
18574
|
+
sheenRoughnessUVSet: i32,
|
|
18575
|
+
sheenRoughnessUVTransform: mat3x3f,
|
|
18576
|
+
iridescenceUVSet: i32,
|
|
18577
|
+
iridescenceUVTransform: mat3x3f,
|
|
18578
|
+
iridescenceThicknessUVSet: i32,
|
|
18579
|
+
iridescenceThicknessUVTransform: mat3x3f,
|
|
18580
|
+
anisotropyUVSet: i32,
|
|
18581
|
+
anisotropyUVTransform: mat3x3f,
|
|
18258
18582
|
}
|
|
18259
18583
|
|
|
18260
18584
|
@group(3) @binding(auto) var<uniform> pbrMaterial : pbrMaterialUniforms;
|
|
@@ -18368,13 +18692,22 @@ fn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f
|
|
|
18368
18692
|
return vec4f(linOut, srgbIn.w);
|
|
18369
18693
|
}
|
|
18370
18694
|
|
|
18695
|
+
fn getMaterialUV(uvSet: i32, uvTransform: mat3x3f) -> vec2f
|
|
18696
|
+
{
|
|
18697
|
+
var baseUV = fragmentInputs.pbr_vUV0;
|
|
18698
|
+
if (uvSet == 1) {
|
|
18699
|
+
baseUV = fragmentInputs.pbr_vUV1;
|
|
18700
|
+
}
|
|
18701
|
+
return (uvTransform * vec3f(baseUV, 1.0)).xy;
|
|
18702
|
+
}
|
|
18703
|
+
|
|
18371
18704
|
// Build the tangent basis from interpolated attributes or screen-space derivatives.
|
|
18372
|
-
fn getTBN() -> mat3x3f
|
|
18705
|
+
fn getTBN(uv: vec2f) -> mat3x3f
|
|
18373
18706
|
{
|
|
18374
18707
|
let pos_dx: vec3f = dpdx(fragmentInputs.pbr_vPosition);
|
|
18375
18708
|
let pos_dy: vec3f = dpdy(fragmentInputs.pbr_vPosition);
|
|
18376
|
-
let tex_dx: vec3f = dpdx(vec3f(
|
|
18377
|
-
let tex_dy: vec3f = dpdy(vec3f(
|
|
18709
|
+
let tex_dx: vec3f = dpdx(vec3f(uv, 0.0));
|
|
18710
|
+
let tex_dy: vec3f = dpdy(vec3f(uv, 0.0));
|
|
18378
18711
|
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
18712
|
|
|
18380
18713
|
var ng: vec3f = cross(pos_dx, pos_dy);
|
|
@@ -18397,14 +18730,15 @@ fn getMappedNormal(
|
|
|
18397
18730
|
normalSampler: texture_2d<f32>,
|
|
18398
18731
|
normalSamplerBinding: sampler,
|
|
18399
18732
|
tbn: mat3x3f,
|
|
18400
|
-
normalScale: f32
|
|
18733
|
+
normalScale: f32,
|
|
18734
|
+
uv: vec2f
|
|
18401
18735
|
) -> vec3f
|
|
18402
18736
|
{
|
|
18403
|
-
let n = textureSample(normalSampler, normalSamplerBinding,
|
|
18737
|
+
let n = textureSample(normalSampler, normalSamplerBinding, uv).rgb;
|
|
18404
18738
|
return normalize(tbn * ((2.0 * n - 1.0) * vec3f(normalScale, normalScale, 1.0)));
|
|
18405
18739
|
}
|
|
18406
18740
|
|
|
18407
|
-
fn getNormal(tbn: mat3x3f) -> vec3f
|
|
18741
|
+
fn getNormal(tbn: mat3x3f, uv: vec2f) -> vec3f
|
|
18408
18742
|
{
|
|
18409
18743
|
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
18410
18744
|
var n: vec3f = normalize(tbn[2].xyz);
|
|
@@ -18413,21 +18747,23 @@ fn getNormal(tbn: mat3x3f) -> vec3f
|
|
|
18413
18747
|
pbr_normalSampler,
|
|
18414
18748
|
pbr_normalSamplerSampler,
|
|
18415
18749
|
tbn,
|
|
18416
|
-
pbrMaterial.normalScale
|
|
18750
|
+
pbrMaterial.normalScale,
|
|
18751
|
+
uv
|
|
18417
18752
|
);
|
|
18418
18753
|
#endif
|
|
18419
18754
|
|
|
18420
18755
|
return n;
|
|
18421
18756
|
}
|
|
18422
18757
|
|
|
18423
|
-
fn getClearcoatNormal(tbn: mat3x3f, baseNormal: vec3f) -> vec3f
|
|
18758
|
+
fn getClearcoatNormal(tbn: mat3x3f, baseNormal: vec3f, uv: vec2f) -> vec3f
|
|
18424
18759
|
{
|
|
18425
18760
|
#ifdef HAS_CLEARCOATNORMALMAP
|
|
18426
18761
|
return getMappedNormal(
|
|
18427
18762
|
pbr_clearcoatNormalSampler,
|
|
18428
18763
|
pbr_clearcoatNormalSamplerSampler,
|
|
18429
18764
|
tbn,
|
|
18430
|
-
1.0
|
|
18765
|
+
1.0,
|
|
18766
|
+
uv
|
|
18431
18767
|
);
|
|
18432
18768
|
#else
|
|
18433
18769
|
return baseNormal;
|
|
@@ -18732,11 +19068,62 @@ fn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {
|
|
|
18732
19068
|
}
|
|
18733
19069
|
|
|
18734
19070
|
fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
19071
|
+
let baseColorUV = getMaterialUV(pbrMaterial.baseColorUVSet, pbrMaterial.baseColorUVTransform);
|
|
19072
|
+
let metallicRoughnessUV = getMaterialUV(
|
|
19073
|
+
pbrMaterial.metallicRoughnessUVSet,
|
|
19074
|
+
pbrMaterial.metallicRoughnessUVTransform
|
|
19075
|
+
);
|
|
19076
|
+
let normalUV = getMaterialUV(pbrMaterial.normalUVSet, pbrMaterial.normalUVTransform);
|
|
19077
|
+
let occlusionUV = getMaterialUV(pbrMaterial.occlusionUVSet, pbrMaterial.occlusionUVTransform);
|
|
19078
|
+
let emissiveUV = getMaterialUV(pbrMaterial.emissiveUVSet, pbrMaterial.emissiveUVTransform);
|
|
19079
|
+
let specularColorUV = getMaterialUV(
|
|
19080
|
+
pbrMaterial.specularColorUVSet,
|
|
19081
|
+
pbrMaterial.specularColorUVTransform
|
|
19082
|
+
);
|
|
19083
|
+
let specularIntensityUV = getMaterialUV(
|
|
19084
|
+
pbrMaterial.specularIntensityUVSet,
|
|
19085
|
+
pbrMaterial.specularIntensityUVTransform
|
|
19086
|
+
);
|
|
19087
|
+
let transmissionUV = getMaterialUV(
|
|
19088
|
+
pbrMaterial.transmissionUVSet,
|
|
19089
|
+
pbrMaterial.transmissionUVTransform
|
|
19090
|
+
);
|
|
19091
|
+
let thicknessUV = getMaterialUV(pbrMaterial.thicknessUVSet, pbrMaterial.thicknessUVTransform);
|
|
19092
|
+
let clearcoatUV = getMaterialUV(pbrMaterial.clearcoatUVSet, pbrMaterial.clearcoatUVTransform);
|
|
19093
|
+
let clearcoatRoughnessUV = getMaterialUV(
|
|
19094
|
+
pbrMaterial.clearcoatRoughnessUVSet,
|
|
19095
|
+
pbrMaterial.clearcoatRoughnessUVTransform
|
|
19096
|
+
);
|
|
19097
|
+
let clearcoatNormalUV = getMaterialUV(
|
|
19098
|
+
pbrMaterial.clearcoatNormalUVSet,
|
|
19099
|
+
pbrMaterial.clearcoatNormalUVTransform
|
|
19100
|
+
);
|
|
19101
|
+
let sheenColorUV = getMaterialUV(
|
|
19102
|
+
pbrMaterial.sheenColorUVSet,
|
|
19103
|
+
pbrMaterial.sheenColorUVTransform
|
|
19104
|
+
);
|
|
19105
|
+
let sheenRoughnessUV = getMaterialUV(
|
|
19106
|
+
pbrMaterial.sheenRoughnessUVSet,
|
|
19107
|
+
pbrMaterial.sheenRoughnessUVTransform
|
|
19108
|
+
);
|
|
19109
|
+
let iridescenceUV = getMaterialUV(
|
|
19110
|
+
pbrMaterial.iridescenceUVSet,
|
|
19111
|
+
pbrMaterial.iridescenceUVTransform
|
|
19112
|
+
);
|
|
19113
|
+
let iridescenceThicknessUV = getMaterialUV(
|
|
19114
|
+
pbrMaterial.iridescenceThicknessUVSet,
|
|
19115
|
+
pbrMaterial.iridescenceThicknessUVTransform
|
|
19116
|
+
);
|
|
19117
|
+
let anisotropyUV = getMaterialUV(
|
|
19118
|
+
pbrMaterial.anisotropyUVSet,
|
|
19119
|
+
pbrMaterial.anisotropyUVTransform
|
|
19120
|
+
);
|
|
19121
|
+
|
|
18735
19122
|
// The albedo may be defined from a base texture or a flat color
|
|
18736
19123
|
var baseColor: vec4<f32> = pbrMaterial.baseColorFactor;
|
|
18737
19124
|
#ifdef HAS_BASECOLORMAP
|
|
18738
19125
|
baseColor = SRGBtoLINEAR(
|
|
18739
|
-
textureSample(pbr_baseColorSampler, pbr_baseColorSamplerSampler,
|
|
19126
|
+
textureSample(pbr_baseColorSampler, pbr_baseColorSamplerSampler, baseColorUV)
|
|
18740
19127
|
) * pbrMaterial.baseColorFactor;
|
|
18741
19128
|
#endif
|
|
18742
19129
|
|
|
@@ -18763,15 +19150,15 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18763
19150
|
let mrSample = textureSample(
|
|
18764
19151
|
pbr_metallicRoughnessSampler,
|
|
18765
19152
|
pbr_metallicRoughnessSamplerSampler,
|
|
18766
|
-
|
|
19153
|
+
metallicRoughnessUV
|
|
18767
19154
|
);
|
|
18768
19155
|
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
18769
19156
|
metallic = mrSample.b * metallic;
|
|
18770
19157
|
#endif
|
|
18771
19158
|
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
|
|
18772
19159
|
metallic = clamp(metallic, 0.0, 1.0);
|
|
18773
|
-
let tbn = getTBN();
|
|
18774
|
-
let n = getNormal(tbn); // normal at surface point
|
|
19160
|
+
let tbn = getTBN(normalUV);
|
|
19161
|
+
let n = getNormal(tbn, normalUV); // normal at surface point
|
|
18775
19162
|
let v = normalize(pbrProjection.camera - fragmentInputs.pbr_vPosition); // Vector from surface point to camera
|
|
18776
19163
|
let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
18777
19164
|
var useExtendedPBR = false;
|
|
@@ -18876,8 +19263,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18876
19263
|
|
|
18877
19264
|
#ifdef HAS_OCCLUSIONMAP
|
|
18878
19265
|
if (pbrMaterial.occlusionMapEnabled != 0) {
|
|
18879
|
-
let ao =
|
|
18880
|
-
textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, fragmentInputs.pbr_vUV).r;
|
|
19266
|
+
let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, occlusionUV).r;
|
|
18881
19267
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
18882
19268
|
}
|
|
18883
19269
|
#endif
|
|
@@ -18886,7 +19272,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18886
19272
|
#ifdef HAS_EMISSIVEMAP
|
|
18887
19273
|
if (pbrMaterial.emissiveMapEnabled != 0u) {
|
|
18888
19274
|
emissive *= SRGBtoLINEAR(
|
|
18889
|
-
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler,
|
|
19275
|
+
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler, emissiveUV)
|
|
18890
19276
|
).rgb;
|
|
18891
19277
|
}
|
|
18892
19278
|
#endif
|
|
@@ -18907,7 +19293,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18907
19293
|
specularIntensity *= textureSample(
|
|
18908
19294
|
pbr_specularIntensitySampler,
|
|
18909
19295
|
pbr_specularIntensitySamplerSampler,
|
|
18910
|
-
|
|
19296
|
+
specularIntensityUV
|
|
18911
19297
|
).a;
|
|
18912
19298
|
}
|
|
18913
19299
|
#endif
|
|
@@ -18919,7 +19305,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18919
19305
|
textureSample(
|
|
18920
19306
|
pbr_specularColorSampler,
|
|
18921
19307
|
pbr_specularColorSamplerSampler,
|
|
18922
|
-
|
|
19308
|
+
specularColorUV
|
|
18923
19309
|
)
|
|
18924
19310
|
).rgb;
|
|
18925
19311
|
}
|
|
@@ -18931,7 +19317,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18931
19317
|
transmission *= textureSample(
|
|
18932
19318
|
pbr_transmissionSampler,
|
|
18933
19319
|
pbr_transmissionSamplerSampler,
|
|
18934
|
-
|
|
19320
|
+
transmissionUV
|
|
18935
19321
|
).r;
|
|
18936
19322
|
}
|
|
18937
19323
|
#endif
|
|
@@ -18941,7 +19327,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18941
19327
|
thickness *= textureSample(
|
|
18942
19328
|
pbr_thicknessSampler,
|
|
18943
19329
|
pbr_thicknessSamplerSampler,
|
|
18944
|
-
|
|
19330
|
+
thicknessUV
|
|
18945
19331
|
).g;
|
|
18946
19332
|
#endif
|
|
18947
19333
|
|
|
@@ -18952,7 +19338,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18952
19338
|
clearcoatFactor *= textureSample(
|
|
18953
19339
|
pbr_clearcoatSampler,
|
|
18954
19340
|
pbr_clearcoatSamplerSampler,
|
|
18955
|
-
|
|
19341
|
+
clearcoatUV
|
|
18956
19342
|
).r;
|
|
18957
19343
|
}
|
|
18958
19344
|
#endif
|
|
@@ -18961,13 +19347,13 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18961
19347
|
clearcoatRoughness *= textureSample(
|
|
18962
19348
|
pbr_clearcoatRoughnessSampler,
|
|
18963
19349
|
pbr_clearcoatRoughnessSamplerSampler,
|
|
18964
|
-
|
|
19350
|
+
clearcoatRoughnessUV
|
|
18965
19351
|
).g;
|
|
18966
19352
|
}
|
|
18967
19353
|
#endif
|
|
18968
19354
|
clearcoatFactor = clamp(clearcoatFactor, 0.0, 1.0);
|
|
18969
19355
|
clearcoatRoughness = clamp(clearcoatRoughness, c_MinRoughness, 1.0);
|
|
18970
|
-
let clearcoatNormal = getClearcoatNormal(
|
|
19356
|
+
let clearcoatNormal = getClearcoatNormal(getTBN(clearcoatNormalUV), n, clearcoatNormalUV);
|
|
18971
19357
|
|
|
18972
19358
|
var sheenColor = pbrMaterial.sheenColorFactor;
|
|
18973
19359
|
var sheenRoughness = pbrMaterial.sheenRoughnessFactor;
|
|
@@ -18977,7 +19363,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18977
19363
|
textureSample(
|
|
18978
19364
|
pbr_sheenColorSampler,
|
|
18979
19365
|
pbr_sheenColorSamplerSampler,
|
|
18980
|
-
|
|
19366
|
+
sheenColorUV
|
|
18981
19367
|
)
|
|
18982
19368
|
).rgb;
|
|
18983
19369
|
}
|
|
@@ -18987,7 +19373,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18987
19373
|
sheenRoughness *= textureSample(
|
|
18988
19374
|
pbr_sheenRoughnessSampler,
|
|
18989
19375
|
pbr_sheenRoughnessSamplerSampler,
|
|
18990
|
-
|
|
19376
|
+
sheenRoughnessUV
|
|
18991
19377
|
).a;
|
|
18992
19378
|
}
|
|
18993
19379
|
#endif
|
|
@@ -18999,7 +19385,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
18999
19385
|
iridescence *= textureSample(
|
|
19000
19386
|
pbr_iridescenceSampler,
|
|
19001
19387
|
pbr_iridescenceSamplerSampler,
|
|
19002
|
-
|
|
19388
|
+
iridescenceUV
|
|
19003
19389
|
).r;
|
|
19004
19390
|
}
|
|
19005
19391
|
#endif
|
|
@@ -19016,7 +19402,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19016
19402
|
textureSample(
|
|
19017
19403
|
pbr_iridescenceThicknessSampler,
|
|
19018
19404
|
pbr_iridescenceThicknessSamplerSampler,
|
|
19019
|
-
|
|
19405
|
+
iridescenceThicknessUV
|
|
19020
19406
|
).g
|
|
19021
19407
|
);
|
|
19022
19408
|
#endif
|
|
@@ -19028,7 +19414,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19028
19414
|
let anisotropySample = textureSample(
|
|
19029
19415
|
pbr_anisotropySampler,
|
|
19030
19416
|
pbr_anisotropySamplerSampler,
|
|
19031
|
-
|
|
19417
|
+
anisotropyUV
|
|
19032
19418
|
).rgb;
|
|
19033
19419
|
anisotropyStrength *= anisotropySample.b;
|
|
19034
19420
|
let mappedDirection = anisotropySample.rg * 2.0 - 1.0;
|
|
@@ -19195,8 +19581,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19195
19581
|
// Apply optional PBR terms for additional (optional) shading
|
|
19196
19582
|
#ifdef HAS_OCCLUSIONMAP
|
|
19197
19583
|
if (pbrMaterial.occlusionMapEnabled != 0) {
|
|
19198
|
-
let ao =
|
|
19199
|
-
textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, fragmentInputs.pbr_vUV).r;
|
|
19584
|
+
let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, occlusionUV).r;
|
|
19200
19585
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
19201
19586
|
}
|
|
19202
19587
|
#endif
|
|
@@ -19205,7 +19590,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19205
19590
|
#ifdef HAS_EMISSIVEMAP
|
|
19206
19591
|
if (pbrMaterial.emissiveMapEnabled != 0u) {
|
|
19207
19592
|
emissive *= SRGBtoLINEAR(
|
|
19208
|
-
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler,
|
|
19593
|
+
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler, emissiveUV)
|
|
19209
19594
|
).rgb;
|
|
19210
19595
|
}
|
|
19211
19596
|
#endif
|
|
@@ -19325,7 +19710,41 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19325
19710
|
anisotropyRotation: 0,
|
|
19326
19711
|
anisotropyDirection: [1, 0],
|
|
19327
19712
|
anisotropyMapEnabled: false,
|
|
19328
|
-
emissiveStrength: 1
|
|
19713
|
+
emissiveStrength: 1,
|
|
19714
|
+
baseColorUVSet: 0,
|
|
19715
|
+
baseColorUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19716
|
+
metallicRoughnessUVSet: 0,
|
|
19717
|
+
metallicRoughnessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19718
|
+
normalUVSet: 0,
|
|
19719
|
+
normalUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19720
|
+
occlusionUVSet: 0,
|
|
19721
|
+
occlusionUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19722
|
+
emissiveUVSet: 0,
|
|
19723
|
+
emissiveUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19724
|
+
specularColorUVSet: 0,
|
|
19725
|
+
specularColorUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19726
|
+
specularIntensityUVSet: 0,
|
|
19727
|
+
specularIntensityUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19728
|
+
transmissionUVSet: 0,
|
|
19729
|
+
transmissionUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19730
|
+
thicknessUVSet: 0,
|
|
19731
|
+
thicknessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19732
|
+
clearcoatUVSet: 0,
|
|
19733
|
+
clearcoatUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19734
|
+
clearcoatRoughnessUVSet: 0,
|
|
19735
|
+
clearcoatRoughnessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19736
|
+
clearcoatNormalUVSet: 0,
|
|
19737
|
+
clearcoatNormalUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19738
|
+
sheenColorUVSet: 0,
|
|
19739
|
+
sheenColorUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19740
|
+
sheenRoughnessUVSet: 0,
|
|
19741
|
+
sheenRoughnessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19742
|
+
iridescenceUVSet: 0,
|
|
19743
|
+
iridescenceUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19744
|
+
iridescenceThicknessUVSet: 0,
|
|
19745
|
+
iridescenceThicknessUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
19746
|
+
anisotropyUVSet: 0,
|
|
19747
|
+
anisotropyUVTransform: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
19329
19748
|
},
|
|
19330
19749
|
name: "pbrMaterial",
|
|
19331
19750
|
firstBindingSlot: 0,
|
|
@@ -19432,7 +19851,41 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
19432
19851
|
// debugging flags used for shader output of intermediate PBR variables
|
|
19433
19852
|
// #ifdef PBR_DEBUG
|
|
19434
19853
|
scaleDiffBaseMR: "vec4<f32>",
|
|
19435
|
-
scaleFGDSpec: "vec4<f32>"
|
|
19854
|
+
scaleFGDSpec: "vec4<f32>",
|
|
19855
|
+
baseColorUVSet: "i32",
|
|
19856
|
+
baseColorUVTransform: "mat3x3<f32>",
|
|
19857
|
+
metallicRoughnessUVSet: "i32",
|
|
19858
|
+
metallicRoughnessUVTransform: "mat3x3<f32>",
|
|
19859
|
+
normalUVSet: "i32",
|
|
19860
|
+
normalUVTransform: "mat3x3<f32>",
|
|
19861
|
+
occlusionUVSet: "i32",
|
|
19862
|
+
occlusionUVTransform: "mat3x3<f32>",
|
|
19863
|
+
emissiveUVSet: "i32",
|
|
19864
|
+
emissiveUVTransform: "mat3x3<f32>",
|
|
19865
|
+
specularColorUVSet: "i32",
|
|
19866
|
+
specularColorUVTransform: "mat3x3<f32>",
|
|
19867
|
+
specularIntensityUVSet: "i32",
|
|
19868
|
+
specularIntensityUVTransform: "mat3x3<f32>",
|
|
19869
|
+
transmissionUVSet: "i32",
|
|
19870
|
+
transmissionUVTransform: "mat3x3<f32>",
|
|
19871
|
+
thicknessUVSet: "i32",
|
|
19872
|
+
thicknessUVTransform: "mat3x3<f32>",
|
|
19873
|
+
clearcoatUVSet: "i32",
|
|
19874
|
+
clearcoatUVTransform: "mat3x3<f32>",
|
|
19875
|
+
clearcoatRoughnessUVSet: "i32",
|
|
19876
|
+
clearcoatRoughnessUVTransform: "mat3x3<f32>",
|
|
19877
|
+
clearcoatNormalUVSet: "i32",
|
|
19878
|
+
clearcoatNormalUVTransform: "mat3x3<f32>",
|
|
19879
|
+
sheenColorUVSet: "i32",
|
|
19880
|
+
sheenColorUVTransform: "mat3x3<f32>",
|
|
19881
|
+
sheenRoughnessUVSet: "i32",
|
|
19882
|
+
sheenRoughnessUVTransform: "mat3x3<f32>",
|
|
19883
|
+
iridescenceUVSet: "i32",
|
|
19884
|
+
iridescenceUVTransform: "mat3x3<f32>",
|
|
19885
|
+
iridescenceThicknessUVSet: "i32",
|
|
19886
|
+
iridescenceThicknessUVTransform: "mat3x3<f32>",
|
|
19887
|
+
anisotropyUVSet: "i32",
|
|
19888
|
+
anisotropyUVTransform: "mat3x3<f32>"
|
|
19436
19889
|
}
|
|
19437
19890
|
};
|
|
19438
19891
|
|
|
@@ -19524,11 +19977,12 @@ void main(void) {
|
|
|
19524
19977
|
#endif
|
|
19525
19978
|
|
|
19526
19979
|
#ifdef HAS_UV
|
|
19527
|
-
|
|
19980
|
+
pbr_vUV0 = uv;
|
|
19528
19981
|
#else
|
|
19529
|
-
|
|
19982
|
+
pbr_vUV0 = vec2(0., 0.);
|
|
19530
19983
|
#endif
|
|
19531
|
-
|
|
19984
|
+
pbr_vUV1 = vec2(0., 0.);
|
|
19985
|
+
geometry.uv = pbr_vUV0;
|
|
19532
19986
|
#endif
|
|
19533
19987
|
|
|
19534
19988
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
@@ -19556,7 +20010,7 @@ void main(void) {
|
|
|
19556
20010
|
#ifdef MODULE_PBRMATERIAL
|
|
19557
20011
|
|
|
19558
20012
|
fragColor = vColor * pbr_filterColor(vec4(0));
|
|
19559
|
-
geometry.uv =
|
|
20013
|
+
geometry.uv = pbr_vUV0;
|
|
19560
20014
|
fragColor.a *= layer.opacity;
|
|
19561
20015
|
|
|
19562
20016
|
#else
|
|
@@ -19723,7 +20177,7 @@ void main(void) {
|
|
|
19723
20177
|
MeshLayer.defaultProps = defaultProps11;
|
|
19724
20178
|
|
|
19725
20179
|
// src/tile-3d-layer/tile-3d-layer.ts
|
|
19726
|
-
var
|
|
20180
|
+
var import_core48 = __toESM(require_core2(), 1);
|
|
19727
20181
|
|
|
19728
20182
|
// ../../node_modules/@math.gl/geospatial/dist/constants.js
|
|
19729
20183
|
var WGS84_RADIUS_X = 6378137;
|
|
@@ -20439,7 +20893,7 @@ void main(void) {
|
|
|
20439
20893
|
}
|
|
20440
20894
|
|
|
20441
20895
|
// ../../node_modules/@loaders.gl/tiles/dist/tileset/tile-3d.js
|
|
20442
|
-
var
|
|
20896
|
+
var import_core34 = __toESM(require_core2(), 1);
|
|
20443
20897
|
|
|
20444
20898
|
// ../../node_modules/@loaders.gl/tiles/dist/constants.js
|
|
20445
20899
|
var TILE_CONTENT_STATE = {
|
|
@@ -21412,7 +21866,7 @@ void main(void) {
|
|
|
21412
21866
|
}
|
|
21413
21867
|
// TODO add typecheck - as const satisfies ...
|
|
21414
21868
|
};
|
|
21415
|
-
this.content = await (0,
|
|
21869
|
+
this.content = await (0, import_core34.load)(contentUrl, loader, options);
|
|
21416
21870
|
if (this.tileset.options.contentLoader) {
|
|
21417
21871
|
await this.tileset.options.contentLoader(this);
|
|
21418
21872
|
}
|
|
@@ -21696,7 +22150,7 @@ void main(void) {
|
|
|
21696
22150
|
};
|
|
21697
22151
|
|
|
21698
22152
|
// ../../node_modules/@loaders.gl/tiles/dist/tileset/format-i3s/i3s-tileset-traverser.js
|
|
21699
|
-
var
|
|
22153
|
+
var import_core35 = __toESM(require_core2(), 1);
|
|
21700
22154
|
|
|
21701
22155
|
// ../../node_modules/@loaders.gl/tiles/dist/tileset/format-i3s/i3s-pending-tiles-register.js
|
|
21702
22156
|
var I3SPendingTilesRegister = class {
|
|
@@ -21860,7 +22314,7 @@ void main(void) {
|
|
|
21860
22314
|
isTileHeader: true
|
|
21861
22315
|
}
|
|
21862
22316
|
};
|
|
21863
|
-
return await (0,
|
|
22317
|
+
return await (0, import_core35.load)(nodeUrl, loader, options);
|
|
21864
22318
|
}
|
|
21865
22319
|
/**
|
|
21866
22320
|
* The callback to init Tile3D instance after loading the tile JSON
|
|
@@ -22587,7 +23041,7 @@ void main(void) {
|
|
|
22587
23041
|
};
|
|
22588
23042
|
|
|
22589
23043
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/utils/version.js
|
|
22590
|
-
var VERSION9 = true ? "4.4.
|
|
23044
|
+
var VERSION9 = true ? "4.4.1" : "latest";
|
|
22591
23045
|
|
|
22592
23046
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/constants.js
|
|
22593
23047
|
var TILE3D_TYPE = {
|
|
@@ -22706,7 +23160,7 @@ void main(void) {
|
|
|
22706
23160
|
}
|
|
22707
23161
|
|
|
22708
23162
|
// ../../node_modules/@loaders.gl/draco/dist/lib/utils/version.js
|
|
22709
|
-
var VERSION10 = true ? "4.4.
|
|
23163
|
+
var VERSION10 = true ? "4.4.1" : "latest";
|
|
22710
23164
|
|
|
22711
23165
|
// ../../node_modules/@loaders.gl/schema-utils/dist/lib/schema/data-type.js
|
|
22712
23166
|
function getDataTypeFromTypedArray(array) {
|
|
@@ -26142,7 +26596,7 @@ void main(void) {
|
|
|
26142
26596
|
}
|
|
26143
26597
|
|
|
26144
26598
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/utils/version.js
|
|
26145
|
-
var VERSION11 = true ? "4.4.
|
|
26599
|
+
var VERSION11 = true ? "4.4.1" : "latest";
|
|
26146
26600
|
|
|
26147
26601
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/parsers/parse-glb.js
|
|
26148
26602
|
var LITTLE_ENDIAN2 = true;
|
|
@@ -26255,16 +26709,26 @@ void main(void) {
|
|
|
26255
26709
|
}
|
|
26256
26710
|
|
|
26257
26711
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/gltf-utils/resolve-url.js
|
|
26258
|
-
function resolveUrl(url, options) {
|
|
26712
|
+
function resolveUrl(url, options, context) {
|
|
26259
26713
|
const absolute = url.startsWith("data:") || url.startsWith("http:") || url.startsWith("https:");
|
|
26260
26714
|
if (absolute) {
|
|
26261
26715
|
return url;
|
|
26262
26716
|
}
|
|
26263
|
-
const baseUrl =
|
|
26717
|
+
const baseUrl = context?.baseUrl || getResolveBaseUrl(options?.core?.baseUrl);
|
|
26264
26718
|
if (!baseUrl) {
|
|
26265
|
-
throw new Error(`'
|
|
26719
|
+
throw new Error(`'baseUrl' must be provided to resolve relative url ${url}`);
|
|
26266
26720
|
}
|
|
26267
|
-
return baseUrl.
|
|
26721
|
+
return baseUrl.endsWith("/") ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
|
|
26722
|
+
}
|
|
26723
|
+
function getResolveBaseUrl(baseUrl) {
|
|
26724
|
+
if (!baseUrl) {
|
|
26725
|
+
return void 0;
|
|
26726
|
+
}
|
|
26727
|
+
if (baseUrl.endsWith("/")) {
|
|
26728
|
+
return baseUrl;
|
|
26729
|
+
}
|
|
26730
|
+
const slashIndex = baseUrl.lastIndexOf("/");
|
|
26731
|
+
return slashIndex >= 0 ? baseUrl.slice(0, slashIndex + 1) : "";
|
|
26268
26732
|
}
|
|
26269
26733
|
|
|
26270
26734
|
// ../../node_modules/@loaders.gl/gltf/dist/lib/extensions/EXT_meshopt_compression.js
|
|
@@ -27301,8 +27765,8 @@ void main(void) {
|
|
|
27301
27765
|
return gltf;
|
|
27302
27766
|
}
|
|
27303
27767
|
function parseGLTFContainerSync(gltf, data, byteOffset, options) {
|
|
27304
|
-
if (options.core?.
|
|
27305
|
-
gltf.baseUri = options.core?.
|
|
27768
|
+
if (options.core?.baseUrl) {
|
|
27769
|
+
gltf.baseUri = options.core?.baseUrl;
|
|
27306
27770
|
}
|
|
27307
27771
|
if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options.glb)) {
|
|
27308
27772
|
const textDecoder = new TextDecoder();
|
|
@@ -27339,7 +27803,7 @@ void main(void) {
|
|
|
27339
27803
|
if (buffer.uri) {
|
|
27340
27804
|
const { fetch: fetch2 } = context;
|
|
27341
27805
|
assert8(fetch2);
|
|
27342
|
-
const uri = resolveUrl(buffer.uri, options);
|
|
27806
|
+
const uri = resolveUrl(buffer.uri, options, context);
|
|
27343
27807
|
const response = await context?.fetch?.(uri);
|
|
27344
27808
|
const arrayBuffer = await response?.arrayBuffer?.();
|
|
27345
27809
|
gltf.buffers[i] = {
|
|
@@ -27379,7 +27843,7 @@ void main(void) {
|
|
|
27379
27843
|
async function loadImage(gltf, image, index, options, context) {
|
|
27380
27844
|
let arrayBuffer;
|
|
27381
27845
|
if (image.uri && !image.hasOwnProperty("bufferView")) {
|
|
27382
|
-
const uri = resolveUrl(image.uri, options);
|
|
27846
|
+
const uri = resolveUrl(image.uri, options, context);
|
|
27383
27847
|
const { fetch: fetch2 } = context;
|
|
27384
27848
|
const response = await fetch2(uri);
|
|
27385
27849
|
arrayBuffer = await response.arrayBuffer();
|
|
@@ -28193,10 +28657,10 @@ void main(void) {
|
|
|
28193
28657
|
};
|
|
28194
28658
|
|
|
28195
28659
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/parsers/parse-3d-tile-header.js
|
|
28196
|
-
var
|
|
28660
|
+
var import_core46 = __toESM(require_core2(), 1);
|
|
28197
28661
|
|
|
28198
28662
|
// ../../node_modules/@loaders.gl/3d-tiles/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
|
|
28199
|
-
var
|
|
28663
|
+
var import_core45 = __toESM(require_core2(), 1);
|
|
28200
28664
|
|
|
28201
28665
|
// ../../node_modules/@loaders.gl/3d-tiles/node_modules/long/index.js
|
|
28202
28666
|
var wasm = null;
|
|
@@ -29474,7 +29938,7 @@ void main(void) {
|
|
|
29474
29938
|
if (isChildSubtreeAvailable) {
|
|
29475
29939
|
const subtreePath = `${basePath}/${subtreesUriTemplate}`;
|
|
29476
29940
|
const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, level, x, y, z);
|
|
29477
|
-
const childSubtree = await (0,
|
|
29941
|
+
const childSubtree = await (0, import_core45.load)(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
|
|
29478
29942
|
nextSubtree = childSubtree;
|
|
29479
29943
|
tileAvailabilityIndex = 0;
|
|
29480
29944
|
nextSubtreeData = { level, x, y, z };
|
|
@@ -29703,7 +30167,7 @@ void main(void) {
|
|
|
29703
30167
|
const { subdivisionScheme, maximumLevel, availableLevels, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;
|
|
29704
30168
|
const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
29705
30169
|
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
29706
|
-
const subtree = await (0,
|
|
30170
|
+
const subtree = await (0, import_core46.load)(subtreeUrl, Tile3DSubtreeLoader, options);
|
|
29707
30171
|
const tileContentUri = tile.content?.uri;
|
|
29708
30172
|
const contentUrlTemplate = tileContentUri ? resolveUri(tileContentUri, basePath) : "";
|
|
29709
30173
|
const refine = tileset?.root?.refine;
|
|
@@ -29847,10 +30311,10 @@ void main(void) {
|
|
|
29847
30311
|
} },
|
|
29848
30312
|
_getMeshColor: { type: "function", value: (tileHeader) => [255, 255, 255] }
|
|
29849
30313
|
};
|
|
29850
|
-
var Tile3DLayer = class extends
|
|
30314
|
+
var Tile3DLayer = class extends import_core47.CompositeLayer {
|
|
29851
30315
|
initializeState() {
|
|
29852
30316
|
if ("onTileLoadFail" in this.props) {
|
|
29853
|
-
|
|
30317
|
+
import_core47.log.removed("onTileLoadFail", "onTileError")();
|
|
29854
30318
|
}
|
|
29855
30319
|
this.state = {
|
|
29856
30320
|
layerMap: {},
|
|
@@ -29960,7 +30424,7 @@ void main(void) {
|
|
|
29960
30424
|
}
|
|
29961
30425
|
Object.assign(options, preloadOptions);
|
|
29962
30426
|
}
|
|
29963
|
-
const tilesetJson = await (0,
|
|
30427
|
+
const tilesetJson = await (0, import_core48.load)(actualTilesetUrl, loader, options.loadOptions);
|
|
29964
30428
|
const tileset3d = new Tileset3D(tilesetJson, {
|
|
29965
30429
|
onTileLoad: this._onTileLoad.bind(this),
|
|
29966
30430
|
onTileUnload: this._onTileUnload.bind(this),
|
|
@@ -30047,7 +30511,7 @@ void main(void) {
|
|
|
30047
30511
|
id: `${this.id}-pointcloud-${tileHeader.id}`,
|
|
30048
30512
|
tile: tileHeader,
|
|
30049
30513
|
data,
|
|
30050
|
-
coordinateSystem:
|
|
30514
|
+
coordinateSystem: import_core47.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
30051
30515
|
coordinateOrigin: cartographicOrigin,
|
|
30052
30516
|
modelMatrix,
|
|
30053
30517
|
getColor: constantRGBA || getPointColor,
|
|
@@ -30070,7 +30534,7 @@ void main(void) {
|
|
|
30070
30534
|
tile: tileHeader,
|
|
30071
30535
|
data: instances || SINGLE_DATA,
|
|
30072
30536
|
scenegraph: gltf,
|
|
30073
|
-
coordinateSystem:
|
|
30537
|
+
coordinateSystem: import_core47.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
30074
30538
|
coordinateOrigin: cartographicOrigin,
|
|
30075
30539
|
modelMatrix,
|
|
30076
30540
|
getTransformMatrix: (instance) => instance.modelMatrix,
|
|
@@ -30089,7 +30553,7 @@ void main(void) {
|
|
|
30089
30553
|
indices,
|
|
30090
30554
|
modelMatrix,
|
|
30091
30555
|
cartographicOrigin,
|
|
30092
|
-
coordinateSystem =
|
|
30556
|
+
coordinateSystem = import_core47.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
30093
30557
|
material,
|
|
30094
30558
|
featureIds
|
|
30095
30559
|
} = content;
|
|
@@ -30164,9 +30628,9 @@ void main(void) {
|
|
|
30164
30628
|
}
|
|
30165
30629
|
|
|
30166
30630
|
// 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
30631
|
var import_core49 = __toESM(require_core(), 1);
|
|
30632
|
+
var import_mesh_layers3 = __toESM(require_mesh_layers(), 1);
|
|
30633
|
+
var import_core50 = __toESM(require_core(), 1);
|
|
30170
30634
|
|
|
30171
30635
|
// ../../node_modules/@loaders.gl/terrain/dist/lib/decode-quantized-mesh.js
|
|
30172
30636
|
var QUANTIZED_MESH_HEADER = /* @__PURE__ */ new Map([
|
|
@@ -31127,7 +31591,7 @@ void main(void) {
|
|
|
31127
31591
|
}
|
|
31128
31592
|
|
|
31129
31593
|
// ../../node_modules/@loaders.gl/terrain/dist/lib/utils/version.js
|
|
31130
|
-
var VERSION12 = true ? "4.4.
|
|
31594
|
+
var VERSION12 = true ? "4.4.1" : "latest";
|
|
31131
31595
|
|
|
31132
31596
|
// ../../node_modules/@loaders.gl/terrain/dist/terrain-loader.js
|
|
31133
31597
|
var TerrainLoader = {
|
|
@@ -31234,7 +31698,7 @@ void main(void) {
|
|
|
31234
31698
|
}
|
|
31235
31699
|
return template || "";
|
|
31236
31700
|
}
|
|
31237
|
-
var TerrainLayer = class extends
|
|
31701
|
+
var TerrainLayer = class extends import_core49.CompositeLayer {
|
|
31238
31702
|
updateState({ props, oldProps }) {
|
|
31239
31703
|
const elevationDataChanged = props.elevationData !== oldProps.elevationData;
|
|
31240
31704
|
if (elevationDataChanged) {
|
|
@@ -31248,7 +31712,7 @@ void main(void) {
|
|
|
31248
31712
|
this.setState({ terrain });
|
|
31249
31713
|
}
|
|
31250
31714
|
if (props.workerUrl) {
|
|
31251
|
-
|
|
31715
|
+
import_core49.log.removed("workerUrl", "loadOptions.terrain.workerUrl")();
|
|
31252
31716
|
}
|
|
31253
31717
|
}
|
|
31254
31718
|
loadTerrain({
|
|
@@ -31319,7 +31783,7 @@ void main(void) {
|
|
|
31319
31783
|
mesh,
|
|
31320
31784
|
texture,
|
|
31321
31785
|
_instanced: false,
|
|
31322
|
-
coordinateSystem:
|
|
31786
|
+
coordinateSystem: import_core50.COORDINATE_SYSTEM.CARTESIAN,
|
|
31323
31787
|
getPosition: (d2) => [0, 0, 0],
|
|
31324
31788
|
getColor: color,
|
|
31325
31789
|
wireframe,
|
|
@@ -31424,7 +31888,7 @@ void main(void) {
|
|
|
31424
31888
|
var isTileSetURL = (url) => url.includes("{x}") && (url.includes("{y}") || url.includes("{-y}"));
|
|
31425
31889
|
|
|
31426
31890
|
// src/mvt-layer/mvt-layer.ts
|
|
31427
|
-
var
|
|
31891
|
+
var import_core52 = __toESM(require_core(), 1);
|
|
31428
31892
|
var import_layers9 = __toESM(require_layers(), 1);
|
|
31429
31893
|
var import_extensions = __toESM(require_extensions(), 1);
|
|
31430
31894
|
|
|
@@ -32999,7 +33463,7 @@ void main(void) {
|
|
|
32999
33463
|
};
|
|
33000
33464
|
|
|
33001
33465
|
// ../../node_modules/@loaders.gl/mvt/dist/mvt-loader.js
|
|
33002
|
-
var VERSION13 = true ? "4.4.
|
|
33466
|
+
var VERSION13 = true ? "4.4.1" : "latest";
|
|
33003
33467
|
var MVTWorkerLoader = {
|
|
33004
33468
|
...MVTFormat,
|
|
33005
33469
|
dataType: null,
|
|
@@ -33280,12 +33744,12 @@ void main(void) {
|
|
|
33280
33744
|
if (!this.context.viewport.resolution) {
|
|
33281
33745
|
props.modelMatrix = modelMatrix;
|
|
33282
33746
|
props.coordinateOrigin = [xOffset, yOffset, 0];
|
|
33283
|
-
props.coordinateSystem =
|
|
33747
|
+
props.coordinateSystem = import_core52.COORDINATE_SYSTEM.CARTESIAN;
|
|
33284
33748
|
props.extensions = [...props.extensions || [], new import_extensions.ClipExtension()];
|
|
33285
33749
|
}
|
|
33286
33750
|
const subLayers = super.renderSubLayers(props);
|
|
33287
33751
|
if (this.state.binary && !(subLayers instanceof import_layers9.GeoJsonLayer)) {
|
|
33288
|
-
|
|
33752
|
+
import_core52.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")();
|
|
33289
33753
|
}
|
|
33290
33754
|
return subLayers;
|
|
33291
33755
|
}
|