@webxr-jp/mtoon-atlas 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
MToonAtlasExporterPlugin: () => MToonAtlasExporterPlugin,
|
|
36
36
|
MToonAtlasLoaderPlugin: () => MToonAtlasLoaderPlugin,
|
|
37
37
|
MToonAtlasMaterial: () => MToonAtlasMaterial,
|
|
38
|
+
applyAtlasTextureColorSpace: () => applyAtlasTextureColorSpace,
|
|
38
39
|
clearKtx2LoaderCache: () => clearKtx2LoaderCache,
|
|
39
40
|
getKtx2TranscoderPath: () => getKtx2TranscoderPath,
|
|
40
41
|
rememberKtx2Source: () => rememberKtx2Source,
|
|
@@ -588,6 +589,13 @@ function clearKtx2LoaderCache() {
|
|
|
588
589
|
var MTOON_ATLAS_EXTENSION_NAME = "XRIFT_mtoon_atlas";
|
|
589
590
|
|
|
590
591
|
// src/extensions/MToonAtlasLoaderPlugin.ts
|
|
592
|
+
var SRGB_ATLAS_SLOTS = ["baseColor", "shade", "emissive", "matcap", "rim"];
|
|
593
|
+
function applyAtlasTextureColorSpace(texture, slot, isKtx2) {
|
|
594
|
+
if (isKtx2) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
texture.colorSpace = SRGB_ATLAS_SLOTS.includes(slot) ? import_three2.SRGBColorSpace : import_three2.NoColorSpace;
|
|
598
|
+
}
|
|
591
599
|
var MToonAtlasLoaderPlugin = class {
|
|
592
600
|
constructor(parser, options = {}) {
|
|
593
601
|
this.name = MTOON_ATLAS_EXTENSION_NAME;
|
|
@@ -812,12 +820,7 @@ var MToonAtlasLoaderPlugin = class {
|
|
|
812
820
|
texture.source = loadedTexture.source;
|
|
813
821
|
}
|
|
814
822
|
texture.flipY = false;
|
|
815
|
-
|
|
816
|
-
if (srgbTextures.includes(key)) {
|
|
817
|
-
texture.colorSpace = import_three2.SRGBColorSpace;
|
|
818
|
-
} else {
|
|
819
|
-
texture.colorSpace = import_three2.NoColorSpace;
|
|
820
|
-
}
|
|
823
|
+
applyAtlasTextureColorSpace(texture, key, isKtx2);
|
|
821
824
|
atlasedTextures[key] = texture;
|
|
822
825
|
} catch (error) {
|
|
823
826
|
console.warn(`MToonAtlasLoaderPlugin: \u30C6\u30AF\u30B9\u30C1\u30E3 ${key} (index: ${textureInfo.index}) \u306E\u8AAD\u307F\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:`, error);
|
|
@@ -1825,6 +1828,7 @@ var MToonAtlasExporterPlugin = class {
|
|
|
1825
1828
|
MToonAtlasExporterPlugin,
|
|
1826
1829
|
MToonAtlasLoaderPlugin,
|
|
1827
1830
|
MToonAtlasMaterial,
|
|
1831
|
+
applyAtlasTextureColorSpace,
|
|
1828
1832
|
clearKtx2LoaderCache,
|
|
1829
1833
|
getKtx2TranscoderPath,
|
|
1830
1834
|
rememberKtx2Source,
|