@webxr-jp/mtoon-atlas 0.3.1 → 0.4.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/README.md +39 -0
- package/dist/index.cjs +112 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +144 -155
- package/dist/index.d.ts +144 -155
- package/dist/index.js +106 -16
- package/dist/index.js.map +1 -1
- package/dist/nodes/index.cjs +421 -0
- package/dist/nodes/index.cjs.map +1 -0
- package/dist/nodes/index.d.cts +175 -0
- package/dist/nodes/index.d.ts +175 -0
- package/dist/nodes/index.js +423 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/types-CLtJAPmH.d.cts +146 -0
- package/dist/types-CLtJAPmH.d.ts +146 -0
- package/package.json +8 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,104 +1,12 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { Texture, BufferAttribute, InterleavedBufferAttribute, BufferGeometry, Material, Object3D } from 'three';
|
|
2
|
+
import { WebGLRenderer, Texture, BufferAttribute, InterleavedBufferAttribute, BufferGeometry, Material, Object3D } from 'three';
|
|
3
|
+
import { M as MToonAtlasOptions, P as ParameterTextureDescriptor, a as MaterialSlotAttributeConfig, b as MToonAtlasMaterialConstructor } from './types-CLtJAPmH.cjs';
|
|
4
|
+
export { A as AtlasedTextureSet, D as DEFAULT_PARAMETER_LAYOUT, e as MToonAtlasMaterialLike, d as ParameterSemantic, c as ParameterSemanticId } from './types-CLtJAPmH.cjs';
|
|
3
5
|
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
4
6
|
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
|
|
7
|
+
import { WebGPURenderer } from 'three/webgpu';
|
|
5
8
|
import { Ktx2CompressionOptions } from '@webxr-jp/texture-compression';
|
|
6
9
|
|
|
7
|
-
/**
|
|
8
|
-
* MToonAtlasMaterial 型定義集約
|
|
9
|
-
*
|
|
10
|
-
* パラメータテクスチャ、アトラステクスチャ、スロット属性の型定義
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* パラメータセマンティクス定義
|
|
15
|
-
*
|
|
16
|
-
* パラメータテクスチャの各テクセル・チャンネルに対応するセマンティック情報
|
|
17
|
-
*/
|
|
18
|
-
type ParameterSemanticId = 'baseColor' | 'opacity' | 'shadeColor' | 'emissiveColor' | 'emissiveIntensity' | 'shadingShift' | 'shadingShiftTextureScale' | 'shadingToony' | 'rimLightingMix' | 'matcapColor' | 'outlineWidth' | 'outlineColor' | 'outlineLightingMix' | 'parametricRimColor' | 'parametricRimLift' | 'parametricRimFresnelPower' | 'uvAnimationScrollX' | 'uvAnimationScrollY' | 'uvAnimationRotation' | 'normalScale';
|
|
19
|
-
/**
|
|
20
|
-
* パラメータセマンティック定義
|
|
21
|
-
*
|
|
22
|
-
* パラメータテクスチャのレイアウト情報
|
|
23
|
-
*/
|
|
24
|
-
interface ParameterSemantic {
|
|
25
|
-
id: ParameterSemanticId;
|
|
26
|
-
texel: number;
|
|
27
|
-
channels: readonly ('r' | 'g' | 'b' | 'a')[];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* パラメータテクスチャディスクリプタ
|
|
31
|
-
*
|
|
32
|
-
* avatar-optimizer で生成されたパラメータテクスチャの情報
|
|
33
|
-
*/
|
|
34
|
-
interface ParameterTextureDescriptor {
|
|
35
|
-
/** パック済みパラメータテクスチャ */
|
|
36
|
-
texture: THREE.Texture;
|
|
37
|
-
/** スロット数(= 元のマテリアル数) */
|
|
38
|
-
slotCount: number;
|
|
39
|
-
/** スロットあたりのテクセル数(通常8) */
|
|
40
|
-
texelsPerSlot: number;
|
|
41
|
-
/** カスタムレイアウト定義(省略時はデフォルト) */
|
|
42
|
-
semantics?: ParameterSemantic[];
|
|
43
|
-
/** アトラス化されたテクスチャセット */
|
|
44
|
-
atlasedTextures?: AtlasedTextureSet;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* アトラス化テクスチャセット
|
|
48
|
-
*
|
|
49
|
-
* avatar-optimizer で生成されたアトラス化テクスチャの集合
|
|
50
|
-
*/
|
|
51
|
-
interface AtlasedTextureSet {
|
|
52
|
-
/** ベースカラーアトラス(MToonMaterial.map) */
|
|
53
|
-
baseColor?: THREE.Texture;
|
|
54
|
-
/** Shade 乗算テクスチャアトラス(shadeMultiplyTexture) */
|
|
55
|
-
shade?: THREE.Texture;
|
|
56
|
-
/** Shading Shift テクスチャアトラス(shadingShiftTexture) */
|
|
57
|
-
shadingShift?: THREE.Texture;
|
|
58
|
-
/** ノーマルマップアトラス(normalMap) */
|
|
59
|
-
normal?: THREE.Texture;
|
|
60
|
-
/** エミッシブマップアトラス(emissiveMap) */
|
|
61
|
-
emissive?: THREE.Texture;
|
|
62
|
-
/** Matcap テクスチャアトラス(matcapTexture) */
|
|
63
|
-
matcap?: THREE.Texture;
|
|
64
|
-
/** Rim 乗算テクスチャアトラス(rimMultiplyTexture) */
|
|
65
|
-
rim?: THREE.Texture;
|
|
66
|
-
/** UV アニメーションマスクテクスチャアトラス(uvAnimationMaskTexture) */
|
|
67
|
-
uvAnimationMask?: THREE.Texture;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* マテリアルスロット属性設定
|
|
71
|
-
*
|
|
72
|
-
* 頂点属性経由でマテリアルスロットを指定するための設定
|
|
73
|
-
*/
|
|
74
|
-
interface MaterialSlotAttributeConfig {
|
|
75
|
-
/** 属性名(デフォルト: 'mtoonMaterialSlot') */
|
|
76
|
-
name: string;
|
|
77
|
-
/** 説明(オプション) */
|
|
78
|
-
description?: string;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* MToonAtlasMaterial オプション
|
|
82
|
-
*
|
|
83
|
-
* THREE.ShaderMaterialParameters を拡張した、インスタンシング対応オプション
|
|
84
|
-
*/
|
|
85
|
-
interface MToonAtlasOptions extends THREE.ShaderMaterialParameters {
|
|
86
|
-
/** ベースカラー */
|
|
87
|
-
color?: THREE.ColorRepresentation;
|
|
88
|
-
/** エミッシブカラー */
|
|
89
|
-
emissive?: THREE.ColorRepresentation;
|
|
90
|
-
/** エミッシブ強度 */
|
|
91
|
-
emissiveIntensity?: number;
|
|
92
|
-
/** 透明度 */
|
|
93
|
-
transparent?: boolean;
|
|
94
|
-
/** 深度書き込み */
|
|
95
|
-
depthWrite?: boolean;
|
|
96
|
-
/** パラメータテクスチャディスクリプタ */
|
|
97
|
-
parameterTexture?: ParameterTextureDescriptor;
|
|
98
|
-
/** スロット属性設定 */
|
|
99
|
-
slotAttribute?: MaterialSlotAttributeConfig;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
10
|
/**
|
|
103
11
|
* MToonAtlasMaterial
|
|
104
12
|
*
|
|
@@ -336,6 +244,113 @@ declare class MToonAtlasMaterial extends THREE.ShaderMaterial {
|
|
|
336
244
|
static getAvailableDebugModes(): DebugMode[];
|
|
337
245
|
}
|
|
338
246
|
|
|
247
|
+
/**
|
|
248
|
+
* KTX2Loader の生成とトランスコーダーパスの設定
|
|
249
|
+
*
|
|
250
|
+
* トランスコーダー(basis_transcoder.wasm / .js)の配信元は、
|
|
251
|
+
* 既定では jsdelivr の CDN だが、以下の理由で差し替えたいことがある。
|
|
252
|
+
*
|
|
253
|
+
* - CDN 障害や CORS 事故の影響を受けたくない(自己ホストしたい)
|
|
254
|
+
* - アプリ側がインストールしている three とバージョンを揃えたい
|
|
255
|
+
*
|
|
256
|
+
* 差し替え方法は 3 通りあり、優先順位は次のとおり。
|
|
257
|
+
*
|
|
258
|
+
* 1. `MToonAtlasLoaderPlugin` に `ktx2Loader` を渡す(設定済みインスタンスを共有)
|
|
259
|
+
* 2. `MToonAtlasLoaderPlugin` に `ktx2TranscoderPath` を渡す(プラグイン単位)
|
|
260
|
+
* 3. `setKtx2TranscoderPath()` でアプリ全体の既定値を変える(起動時に一度呼ぶ)
|
|
261
|
+
*
|
|
262
|
+
* 対応する圧縮形式の判定(detectSupport)は、既定では一時的に作る
|
|
263
|
+
* WebGLRenderer で行う。WebGPURenderer で描画するアプリでは WebGL と WebGPU で
|
|
264
|
+
* 使える形式が異なりうるため、`setKtx2Renderer()` などで描画に使う
|
|
265
|
+
* レンダラーを渡して判定させる。
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* KTX2 の対応形式の判定に使えるレンダラー
|
|
270
|
+
*
|
|
271
|
+
* WebGPURenderer は `await renderer.init()` 済みであること
|
|
272
|
+
*/
|
|
273
|
+
type Ktx2SupportRenderer = WebGLRenderer | WebGPURenderer;
|
|
274
|
+
/**
|
|
275
|
+
* トランスコーダーパスの既定値
|
|
276
|
+
*
|
|
277
|
+
* 明示的に設定されない限り CDN を使う。バージョンは peerDependencies の
|
|
278
|
+
* 下限 (three >= 0.181) に合わせてある。KTX2Loader のワーカーは three 側の
|
|
279
|
+
* コードなので、極端に古いトランスコーダーだと将来の three で
|
|
280
|
+
* 未実装 API を呼んで壊れうる(例: r181 は ktx2File.isHDR() を参照する)。
|
|
281
|
+
*
|
|
282
|
+
* とはいえ URL に固定バージョンを書く以上、利用側の three とのずれは残る。
|
|
283
|
+
* 確実に揃えたい場合は three が同梱するトランスコーダーを
|
|
284
|
+
* node_modules からコピーして自己ホストし、setKtx2TranscoderPath() で
|
|
285
|
+
* そのパスを指定すること(README 参照)。
|
|
286
|
+
*/
|
|
287
|
+
declare const DEFAULT_KTX2_TRANSCODER_PATH = "https://cdn.jsdelivr.net/npm/three@0.181.1/examples/jsm/libs/basis/";
|
|
288
|
+
/**
|
|
289
|
+
* KTX2 トランスコーダーの配信元をアプリ全体で切り替える
|
|
290
|
+
*
|
|
291
|
+
* アプリ起動時に一度呼ぶ想定。`MToonAtlasLoaderPlugin` を複数箇所で
|
|
292
|
+
* 生成している場合に、呼び出しごとにオプションを渡さずに済む。
|
|
293
|
+
* 既に生成済みのローダーには影響しないため、VRM を読み込む前に呼ぶこと。
|
|
294
|
+
*
|
|
295
|
+
* @param path - トランスコーダーを配信するディレクトリ(末尾スラッシュ必須)
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* // public/basis/ に basis_transcoder.js / .wasm を配置して同一オリジンで配信する
|
|
300
|
+
* setKtx2TranscoderPath('/basis/')
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
declare function setKtx2TranscoderPath(path: string): void;
|
|
304
|
+
/**
|
|
305
|
+
* 現在のトランスコーダーパスの既定値を取得する
|
|
306
|
+
*/
|
|
307
|
+
declare function getKtx2TranscoderPath(): string;
|
|
308
|
+
/**
|
|
309
|
+
* KTX2 の対応形式の判定に使うレンダラーをアプリ全体で設定する
|
|
310
|
+
*
|
|
311
|
+
* WebGPURenderer で描画するアプリでは、`await renderer.init()` の後、
|
|
312
|
+
* VRM を読み込む前に一度呼ぶ。null を渡すと既定(一時 WebGLRenderer での判定)に戻す。
|
|
313
|
+
* 既に生成済みのローダーには影響しない。
|
|
314
|
+
*
|
|
315
|
+
* @param renderer - 描画に使うレンダラー
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const renderer = new WebGPURenderer()
|
|
320
|
+
* await renderer.init()
|
|
321
|
+
* setKtx2Renderer(renderer)
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
declare function setKtx2Renderer(renderer: Ktx2SupportRenderer | null): void;
|
|
325
|
+
/**
|
|
326
|
+
* setKtx2Renderer で設定したレンダラーを取得する
|
|
327
|
+
*/
|
|
328
|
+
declare function getKtx2Renderer(): Ktx2SupportRenderer | null;
|
|
329
|
+
/**
|
|
330
|
+
* KTX2Loader を取得または生成する
|
|
331
|
+
* ブラウザ環境でのみ動作する(WebGL コンテキストが必要)
|
|
332
|
+
*
|
|
333
|
+
* 対応形式の判定には、引数 renderer > setKtx2Renderer の既定 >
|
|
334
|
+
* 一時 WebGLRenderer の順で使うレンダラーを決める。
|
|
335
|
+
*
|
|
336
|
+
* @param transcoderPath - 使用するパス。省略時は既定値
|
|
337
|
+
* @param renderer - 対応形式の判定に使うレンダラー。省略時は setKtx2Renderer の値
|
|
338
|
+
* @returns KTX2Loader。ブラウザ環境でない場合や初期化に失敗した場合は null
|
|
339
|
+
*/
|
|
340
|
+
declare function resolveKtx2Loader(transcoderPath?: string, renderer?: Ktx2SupportRenderer | null): KTX2Loader | null;
|
|
341
|
+
/**
|
|
342
|
+
* キャッシュ済みの KTX2Loader を破棄する
|
|
343
|
+
*
|
|
344
|
+
* レンダラー別に作ったローダーも含めて破棄する。
|
|
345
|
+
* パスを変えて作り直したい場合に、古いローダーが抱えるワーカープールと
|
|
346
|
+
* WebGL コンテキストを解放するために使う。
|
|
347
|
+
*
|
|
348
|
+
* 注意: VRM の読み込み中に呼ばないこと。`loadVRM()` は取得したローダーを
|
|
349
|
+
* GLTFLoader に渡したまま非同期に読み込むため、途中で dispose すると
|
|
350
|
+
* ワーカープールが落ちて進行中の parse が分かりにくいエラーで失敗する。
|
|
351
|
+
*/
|
|
352
|
+
declare function clearKtx2LoaderCache(): void;
|
|
353
|
+
|
|
339
354
|
declare const MTOON_ATLAS_EXTENSION_NAME = "XRIFT_mtoon_atlas";
|
|
340
355
|
/**
|
|
341
356
|
* GLTF Extension Schema for XRIFT_mtoon_atlas
|
|
@@ -409,6 +424,9 @@ interface GLTFParser {
|
|
|
409
424
|
}
|
|
410
425
|
interface GLTFWriter {
|
|
411
426
|
json: any;
|
|
427
|
+
extensionsUsed: {
|
|
428
|
+
[name: string]: boolean;
|
|
429
|
+
};
|
|
412
430
|
nodeMap: Map<any, number>;
|
|
413
431
|
pending: Promise<void>[];
|
|
414
432
|
byteOffset: number;
|
|
@@ -416,6 +434,7 @@ interface GLTFWriter {
|
|
|
416
434
|
processAccessor: (attribute: BufferAttribute | InterleavedBufferAttribute, geometry?: BufferGeometry, start?: number, count?: number) => number;
|
|
417
435
|
processBuffer: (buffer: ArrayBuffer) => number;
|
|
418
436
|
processBufferViewImage: (blob: Blob) => Promise<number>;
|
|
437
|
+
processMaterialAsync: (material: Material) => Promise<number | null>;
|
|
419
438
|
cache: {
|
|
420
439
|
meshes: Map<any, any>;
|
|
421
440
|
attributes: Map<number, number>;
|
|
@@ -466,6 +485,18 @@ interface MToonAtlasLoaderPluginOptions {
|
|
|
466
485
|
* `ktx2Loader` を渡した場合は無視される
|
|
467
486
|
*/
|
|
468
487
|
ktx2TranscoderPath?: string;
|
|
488
|
+
/**
|
|
489
|
+
* KTX2 の対応形式の判定に使うレンダラー。`ktx2Loader` を渡した場合は無視される。
|
|
490
|
+
* 省略時は setKtx2Renderer() の値、それも無ければ一時 WebGLRenderer で判定する。
|
|
491
|
+
* WebGPURenderer で描画する場合は init() 済みのものを渡す
|
|
492
|
+
*/
|
|
493
|
+
ktx2Renderer?: Ktx2SupportRenderer;
|
|
494
|
+
/**
|
|
495
|
+
* 生成するマテリアルのクラス。省略時は MToonAtlasMaterial(WebGL 専用)。
|
|
496
|
+
* WebGPURenderer で描画する場合は `@webxr-jp/mtoon-atlas/nodes` の
|
|
497
|
+
* MToonAtlasNodeMaterial を渡す
|
|
498
|
+
*/
|
|
499
|
+
materialType?: MToonAtlasMaterialConstructor;
|
|
469
500
|
}
|
|
470
501
|
declare class MToonAtlasLoaderPlugin {
|
|
471
502
|
readonly name = "XRIFT_mtoon_atlas";
|
|
@@ -473,6 +504,8 @@ declare class MToonAtlasLoaderPlugin {
|
|
|
473
504
|
private ktx2SourceByImageIndex;
|
|
474
505
|
private injectedKtx2Loader?;
|
|
475
506
|
private ktx2TranscoderPath?;
|
|
507
|
+
private materialType;
|
|
508
|
+
private ktx2Renderer?;
|
|
476
509
|
constructor(parser: GLTFParser, options?: MToonAtlasLoaderPluginOptions);
|
|
477
510
|
/**
|
|
478
511
|
* このプラグインが使う KTX2Loader を取得する
|
|
@@ -517,60 +550,6 @@ declare class MToonAtlasLoaderPlugin {
|
|
|
517
550
|
private _loadMaterialAsync;
|
|
518
551
|
}
|
|
519
552
|
|
|
520
|
-
/**
|
|
521
|
-
* トランスコーダーパスの既定値
|
|
522
|
-
*
|
|
523
|
-
* 明示的に設定されない限り CDN を使う。バージョンは peerDependencies の
|
|
524
|
-
* 下限 (three >= 0.181) に合わせてある。KTX2Loader のワーカーは three 側の
|
|
525
|
-
* コードなので、極端に古いトランスコーダーだと将来の three で
|
|
526
|
-
* 未実装 API を呼んで壊れうる(例: r181 は ktx2File.isHDR() を参照する)。
|
|
527
|
-
*
|
|
528
|
-
* とはいえ URL に固定バージョンを書く以上、利用側の three とのずれは残る。
|
|
529
|
-
* 確実に揃えたい場合は three が同梱するトランスコーダーを
|
|
530
|
-
* node_modules からコピーして自己ホストし、setKtx2TranscoderPath() で
|
|
531
|
-
* そのパスを指定すること(README 参照)。
|
|
532
|
-
*/
|
|
533
|
-
declare const DEFAULT_KTX2_TRANSCODER_PATH = "https://cdn.jsdelivr.net/npm/three@0.181.1/examples/jsm/libs/basis/";
|
|
534
|
-
/**
|
|
535
|
-
* KTX2 トランスコーダーの配信元をアプリ全体で切り替える
|
|
536
|
-
*
|
|
537
|
-
* アプリ起動時に一度呼ぶ想定。`MToonAtlasLoaderPlugin` を複数箇所で
|
|
538
|
-
* 生成している場合に、呼び出しごとにオプションを渡さずに済む。
|
|
539
|
-
* 既に生成済みのローダーには影響しないため、VRM を読み込む前に呼ぶこと。
|
|
540
|
-
*
|
|
541
|
-
* @param path - トランスコーダーを配信するディレクトリ(末尾スラッシュ必須)
|
|
542
|
-
*
|
|
543
|
-
* @example
|
|
544
|
-
* ```typescript
|
|
545
|
-
* // public/basis/ に basis_transcoder.js / .wasm を配置して同一オリジンで配信する
|
|
546
|
-
* setKtx2TranscoderPath('/basis/')
|
|
547
|
-
* ```
|
|
548
|
-
*/
|
|
549
|
-
declare function setKtx2TranscoderPath(path: string): void;
|
|
550
|
-
/**
|
|
551
|
-
* 現在のトランスコーダーパスの既定値を取得する
|
|
552
|
-
*/
|
|
553
|
-
declare function getKtx2TranscoderPath(): string;
|
|
554
|
-
/**
|
|
555
|
-
* KTX2Loader を取得または生成する
|
|
556
|
-
* ブラウザ環境でのみ動作する(WebGL コンテキストが必要)
|
|
557
|
-
*
|
|
558
|
-
* @param transcoderPath - 使用するパス。省略時は既定値
|
|
559
|
-
* @returns KTX2Loader。ブラウザ環境でない場合や初期化に失敗した場合は null
|
|
560
|
-
*/
|
|
561
|
-
declare function resolveKtx2Loader(transcoderPath?: string): KTX2Loader | null;
|
|
562
|
-
/**
|
|
563
|
-
* キャッシュ済みの KTX2Loader を破棄する
|
|
564
|
-
*
|
|
565
|
-
* パスを変えて作り直したい場合に、古いローダーが抱えるワーカープールと
|
|
566
|
-
* WebGL コンテキストを解放するために使う。
|
|
567
|
-
*
|
|
568
|
-
* 注意: VRM の読み込み中に呼ばないこと。`loadVRM()` は取得したローダーを
|
|
569
|
-
* GLTFLoader に渡したまま非同期に読み込むため、途中で dispose すると
|
|
570
|
-
* ワーカープールが落ちて進行中の parse が分かりにくいエラーで失敗する。
|
|
571
|
-
*/
|
|
572
|
-
declare function clearKtx2LoaderCache(): void;
|
|
573
|
-
|
|
574
553
|
/**
|
|
575
554
|
* テクスチャ圧縮オプション
|
|
576
555
|
* エクスポート時にアトラステクスチャを KTX2 形式で圧縮する
|
|
@@ -585,8 +564,9 @@ interface TextureCompressionOptions extends Ktx2CompressionOptions {
|
|
|
585
564
|
/**
|
|
586
565
|
* GLTFExporter用のMToonAtlasエクスポートプラグイン
|
|
587
566
|
*
|
|
588
|
-
*
|
|
589
|
-
* beforeParseでテクスチャを処理し、
|
|
567
|
+
* GLSL 版(MToonAtlasMaterial)と TSL 版(MToonAtlasNodeMaterial)の両方を扱う。
|
|
568
|
+
* GLTFExporter 標準のマテリアル変換は通さず、beforeParseでテクスチャを処理し、
|
|
569
|
+
* afterParseでマテリアル定義をJSONに追加します。
|
|
590
570
|
*/
|
|
591
571
|
declare class MToonAtlasExporterPlugin {
|
|
592
572
|
readonly name = "XRIFT_mtoon_atlas";
|
|
@@ -597,6 +577,15 @@ declare class MToonAtlasExporterPlugin {
|
|
|
597
577
|
private textureCache;
|
|
598
578
|
private textureCompressionOptions?;
|
|
599
579
|
constructor(writer: GLTFWriter);
|
|
580
|
+
/**
|
|
581
|
+
* アトラスマテリアルを GLTFExporter 標準のマテリアル変換から外す
|
|
582
|
+
*
|
|
583
|
+
* 標準の変換は MeshStandardMaterial 前提で `material.color` などを読む。
|
|
584
|
+
* GLSL 版は ShaderMaterial として警告付きで null になるだけだが、
|
|
585
|
+
* TSL 版(NodeMaterial)は color を持たないため例外で書き出しが止まる。
|
|
586
|
+
* どちらも afterParse で自前のマテリアル定義に差し替えるので、ここで null を返す
|
|
587
|
+
*/
|
|
588
|
+
private skipStandardMaterialProcessing;
|
|
600
589
|
/**
|
|
601
590
|
* テクスチャ圧縮オプションを設定
|
|
602
591
|
* 設定された場合、アトラステクスチャを KTX2 形式で圧縮してエクスポート
|
|
@@ -770,10 +759,10 @@ declare function getMToonRenderOrder(material: {
|
|
|
770
759
|
* エクスポート時に「再エンコードせず元バイナリをそのまま書き出す」
|
|
771
760
|
* パススルーが可能になります。再エンコードによる画質劣化も避けられます。
|
|
772
761
|
*
|
|
773
|
-
* WeakMap のキーに `texture.source`(three.js の
|
|
762
|
+
* WeakMap のキーに `texture.source`(three.js の TextureSource)を使う理由:
|
|
774
763
|
* - `Texture.clone()` は userData を JSON でディープコピーするため、
|
|
775
764
|
* ArrayBuffer を userData に載せると空オブジェクトに潰れる
|
|
776
|
-
* - `
|
|
765
|
+
* - `TextureSource` はクローン間で共有されるため、clone 後も元バイナリを引ける
|
|
777
766
|
*
|
|
778
767
|
* メモリについて: テクスチャが生きている間、元 KTX2 バイナリを保持し続けます
|
|
779
768
|
* (2048^2 の UASTC アトラス 1 枚でおよそ 1.7MB)。ロスレスな再エクスポートと
|
|
@@ -788,4 +777,4 @@ declare function getMToonRenderOrder(material: {
|
|
|
788
777
|
*/
|
|
789
778
|
declare function rememberKtx2Source(texture: Texture, data: ArrayBuffer | Uint8Array): void;
|
|
790
779
|
|
|
791
|
-
export {
|
|
780
|
+
export { DEFAULT_KTX2_TRANSCODER_PATH, type DebugMode, type Ktx2SupportRenderer, MTOON_ATLAS_EXTENSION_NAME, MTOON_TRANSPARENT_RENDER_ORDER, MTOON_TRANSPARENT_ZWRITE_RENDER_ORDER, MToonAtlasExporterPlugin, type MToonAtlasExtensionSchema, MToonAtlasLoaderPlugin, type MToonAtlasLoaderPluginOptions, MToonAtlasMaterial, MToonAtlasMaterialConstructor, MToonAtlasOptions, MaterialSlotAttributeConfig, ParameterTextureDescriptor, type TextureCompressionOptions, applyAtlasTextureColorSpace, clearKtx2LoaderCache, getKtx2Renderer, getKtx2TranscoderPath, getMToonRenderOrder, rememberKtx2Source, resolveKtx2Loader, setKtx2Renderer, setKtx2TranscoderPath };
|