@threenative/assets 0.3.3 → 0.3.5
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 +22 -0
- package/dist/apply-worker.js +1586 -62
- package/dist/blender-gpl/fixtures/make_world_fixture.py +184 -0
- package/dist/blender-gpl/recipes/_common.py +11 -0
- package/dist/blender-gpl/recipes/decimate.py +11 -5
- package/dist/blender-gpl/recipes/export_world.py +682 -0
- package/dist/index.d.ts +144 -2
- package/dist/index.js +4883 -2602
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,15 @@ interface IAssetRuntimeDecoderCapabilities {
|
|
|
54
54
|
readonly meshopt: boolean;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
interface IModelDedupeSummary {
|
|
58
|
+
/** Distinct cooked outputs among the model sources that took part. */
|
|
59
|
+
readonly cooked: number;
|
|
60
|
+
/** Cooked bytes the duplicates would have written on their own. */
|
|
61
|
+
readonly savedBytes: number;
|
|
62
|
+
/** Model sources that took part, canonicals and duplicates alike. */
|
|
63
|
+
readonly sources: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
type AssetFindingGrade = "fail" | "ok" | "warn";
|
|
58
67
|
interface IAssetFinding {
|
|
59
68
|
readonly asset: string;
|
|
@@ -164,6 +173,7 @@ interface IModelLodRuntimeOptions {
|
|
|
164
173
|
}
|
|
165
174
|
/** A partial override for one asset; nested objects overlay, they never replace. */
|
|
166
175
|
interface IModelLodOverride {
|
|
176
|
+
readonly cutout?: boolean;
|
|
167
177
|
readonly enabled?: boolean;
|
|
168
178
|
readonly generation?: IModelLodGenerationOptions;
|
|
169
179
|
readonly preset?: LodPreset;
|
|
@@ -175,6 +185,12 @@ interface IModelLodOverride {
|
|
|
175
185
|
* re-enable. Resolution is per asset and happens where the asset is known (PRD-377 §3.2, §5).
|
|
176
186
|
*/
|
|
177
187
|
interface IModelLodOptions {
|
|
188
|
+
/**
|
|
189
|
+
* Convert eligible `BLEND` foliage to alpha-tested in the cook (PRD-458 §4). Default `true`,
|
|
190
|
+
* because a needle card exported as `BLEND` is refused a chain by rule and the tree then draws
|
|
191
|
+
* LOD0 forever. `false` keeps the authored blending; per asset, `cutout` in an override entry.
|
|
192
|
+
*/
|
|
193
|
+
readonly cutout?: boolean;
|
|
178
194
|
readonly enabled?: boolean;
|
|
179
195
|
readonly generation?: IModelLodGenerationOptions;
|
|
180
196
|
readonly overrides?: Readonly<Record<string, boolean | IModelLodOverride>>;
|
|
@@ -275,6 +291,74 @@ interface IAudioPassOptions {
|
|
|
275
291
|
/** `"none"` drops the pass; an object configures it; absent means the defaults run. */
|
|
276
292
|
declare function parseAudioConfig(raw: unknown): IAudioPassOptions | undefined;
|
|
277
293
|
|
|
294
|
+
interface IModelCompactInstanceOptions {
|
|
295
|
+
/**
|
|
296
|
+
* Minimum number of nodes that must share one mesh before it is instanced, default 2.
|
|
297
|
+
* gltf-transform's own default is 5; the lower floor is what lets a paired prop instance.
|
|
298
|
+
*/
|
|
299
|
+
readonly min?: number;
|
|
300
|
+
}
|
|
301
|
+
interface IModelCompactOptions {
|
|
302
|
+
readonly flatten?: boolean;
|
|
303
|
+
readonly instance?: boolean | IModelCompactInstanceOptions;
|
|
304
|
+
readonly join?: boolean;
|
|
305
|
+
/** Extra exact node names to protect, on top of the regex and the structural rules. */
|
|
306
|
+
readonly protectedNames?: readonly string[];
|
|
307
|
+
/**
|
|
308
|
+
* Case-insensitive node-name regex source for nodes the game looks up or moves. Defaults to
|
|
309
|
+
* {@link DEFAULT_PROTECTED_PATTERN}; an invalid source throws rather than silently protecting nothing.
|
|
310
|
+
*/
|
|
311
|
+
readonly protectedPattern?: string;
|
|
312
|
+
}
|
|
313
|
+
/** Why a node was kept out of join/instance. */
|
|
314
|
+
type TModelProtectedRule = "allow-list" | "animation-ancestor" | "animation-target" | "regex" | "skin-joint";
|
|
315
|
+
interface IModelProtectedNode {
|
|
316
|
+
readonly name: string;
|
|
317
|
+
readonly rule: TModelProtectedRule;
|
|
318
|
+
}
|
|
319
|
+
interface IModelCompactSummary {
|
|
320
|
+
/** Whether each pass ran and how many primitives/nodes it removed. */
|
|
321
|
+
readonly flatten: {
|
|
322
|
+
readonly enabled: boolean;
|
|
323
|
+
/** Nodes reparented toward the scene root; a node left in place is not counted. */
|
|
324
|
+
readonly reparented: number;
|
|
325
|
+
};
|
|
326
|
+
readonly instance: {
|
|
327
|
+
readonly batches: number;
|
|
328
|
+
readonly enabled: boolean;
|
|
329
|
+
readonly instances: number;
|
|
330
|
+
/** Why no batch was created, when none was. */
|
|
331
|
+
readonly reason?: string;
|
|
332
|
+
};
|
|
333
|
+
readonly join: {
|
|
334
|
+
readonly enabled: boolean;
|
|
335
|
+
readonly primitivesAfter: number;
|
|
336
|
+
readonly primitivesBefore: number;
|
|
337
|
+
};
|
|
338
|
+
readonly nodesAfter: number;
|
|
339
|
+
readonly nodesBefore: number;
|
|
340
|
+
readonly primitivesAfter: number;
|
|
341
|
+
readonly primitivesBefore: number;
|
|
342
|
+
/**
|
|
343
|
+
* Named scene nodes that existed before compaction and are gone after it. Empty is the
|
|
344
|
+
* expected result of a run whose protected set covered every name the game addresses; a
|
|
345
|
+
* non-empty list is the report's warning that a `getObjectByName` can now return undefined.
|
|
346
|
+
*/
|
|
347
|
+
readonly removed: readonly string[];
|
|
348
|
+
/** Every node kept out of compaction, with the rule that protected it, sorted by name. */
|
|
349
|
+
readonly protected: readonly IModelProtectedNode[];
|
|
350
|
+
}
|
|
351
|
+
/** The compaction policy with every default resolved, so it is a stable cache key. */
|
|
352
|
+
interface IResolvedCompactOptions {
|
|
353
|
+
readonly flatten: boolean;
|
|
354
|
+
readonly instance: false | IModelCompactInstanceOptions;
|
|
355
|
+
readonly join: boolean;
|
|
356
|
+
readonly protectedNames: readonly string[];
|
|
357
|
+
readonly protectedPattern: string;
|
|
358
|
+
/** Algorithm identity, so an upgraded pass never re-serves a cache from an older build. */
|
|
359
|
+
readonly version: number;
|
|
360
|
+
}
|
|
361
|
+
|
|
278
362
|
/**
|
|
279
363
|
* Atlas integration follows the mesh → xatlas → remapped-attribute split documented by
|
|
280
364
|
* xatlas-three 0.2.1 (MIT, copyright 2022 Palash Bansal). This implementation uses xatlasjs's
|
|
@@ -350,6 +434,13 @@ interface IModelTextureOverride {
|
|
|
350
434
|
readonly slot: string;
|
|
351
435
|
}
|
|
352
436
|
interface IModelTexturesOptions {
|
|
437
|
+
/**
|
|
438
|
+
* Resolved by the compiler from the target's runtime capabilities, never by a project: the
|
|
439
|
+
* target has no KTX2 decoder, so an over-cap embedded image is box-resampled and re-emitted as
|
|
440
|
+
* a PNG instead of being encoded. Everything else — authored-byte retention under the cap,
|
|
441
|
+
* per-image deduplication, colour space — is unchanged.
|
|
442
|
+
*/
|
|
443
|
+
readonly decoderFree?: boolean;
|
|
353
444
|
/**
|
|
354
445
|
* Longest edge an embedded image may keep, default 2048. Larger images are box-resampled
|
|
355
446
|
* down preserving aspect ratio; smaller ones are never upscaled.
|
|
@@ -470,6 +561,12 @@ interface IModelSimplifyOptions {
|
|
|
470
561
|
}
|
|
471
562
|
interface IModelPassOptions {
|
|
472
563
|
readonly passes?: IModelPassesOptions;
|
|
564
|
+
/**
|
|
565
|
+
* Lossless scene-graph compaction (flatten → instance → join) against one protected-node set.
|
|
566
|
+
* Absent means on with defaults; `false` is the kill switch; an object configures the
|
|
567
|
+
* sub-passes, the protected-name allow-list and the name regex. It never decimates geometry.
|
|
568
|
+
*/
|
|
569
|
+
readonly compact?: boolean | IModelCompactOptions;
|
|
473
570
|
/** Native WebGPU rejects interleaved vertex attributes; mobile output uses separate buffers. */
|
|
474
571
|
readonly vertexLayout?: "interleaved" | "separate";
|
|
475
572
|
/** Preserve generated TEXCOORD_1 data that is consumed by a runtime-attached lightmap. */
|
|
@@ -583,6 +680,17 @@ interface ILodJoinedRow {
|
|
|
583
680
|
interface ILodRow {
|
|
584
681
|
/** Bytes the derived index buffers add, before compression. */
|
|
585
682
|
readonly byteOverhead: number;
|
|
683
|
+
/**
|
|
684
|
+
* The foliage cutout conversion the cook ran before generating (PRD-458 §4): the `BLEND`
|
|
685
|
+
* materials that became alpha-tested, and the ones that kept blending and why.
|
|
686
|
+
*/
|
|
687
|
+
readonly cutout?: {
|
|
688
|
+
readonly converted: readonly string[];
|
|
689
|
+
readonly kept: readonly {
|
|
690
|
+
readonly name: string;
|
|
691
|
+
readonly reason: string;
|
|
692
|
+
}[];
|
|
693
|
+
};
|
|
586
694
|
/** Migration/legacy notes the resolver raised, by code. */
|
|
587
695
|
readonly diagnostics: readonly string[];
|
|
588
696
|
/** The resolved increasing geometric-error targets, as the bake consumed them. */
|
|
@@ -717,6 +825,19 @@ interface IAudioRow {
|
|
|
717
825
|
*/
|
|
718
826
|
declare function formatAudioSizes(rows: readonly IAudioRow[]): readonly string[];
|
|
719
827
|
/** One compiled model plus a total, before against after the optimization pass. */
|
|
828
|
+
/** The cook's material merge (PRD-458 §5): what collapsed, and the counts either side of it. */
|
|
829
|
+
interface IMaterialsRow {
|
|
830
|
+
/** Distinct signatures — the count a draw call is bound by. */
|
|
831
|
+
readonly distinct: {
|
|
832
|
+
readonly after: number;
|
|
833
|
+
readonly before: number;
|
|
834
|
+
};
|
|
835
|
+
readonly materials: {
|
|
836
|
+
readonly after: number;
|
|
837
|
+
readonly before: number;
|
|
838
|
+
};
|
|
839
|
+
readonly merged: readonly string[];
|
|
840
|
+
}
|
|
720
841
|
interface IModelSizeRow {
|
|
721
842
|
readonly after: number;
|
|
722
843
|
readonly before: number;
|
|
@@ -739,8 +860,12 @@ interface IModelSizeRow {
|
|
|
739
860
|
readonly simplify?: ISimplifyRow;
|
|
740
861
|
/** Automatic discrete LOD generation (PRD-377), when the effective policy ran. */
|
|
741
862
|
readonly lod?: ILodRow;
|
|
863
|
+
/** Lossless scene-graph compaction (PRD-443), when it ran. */
|
|
864
|
+
readonly compact?: IModelCompactSummary;
|
|
742
865
|
/** The cluster-DAG bake, when it was configured for this model. */
|
|
743
866
|
readonly virtual?: IVirtualRow;
|
|
867
|
+
/** The material merge the cook ran unconditionally, before any other geometry stage. */
|
|
868
|
+
readonly materials?: IMaterialsRow;
|
|
744
869
|
/** Triangle count of the compiled output, recorded in the manifest. */
|
|
745
870
|
readonly triangles?: number;
|
|
746
871
|
}
|
|
@@ -804,6 +929,13 @@ interface IAssetPass {
|
|
|
804
929
|
/** True when this pass's emitted output requires a runtime decoder unavailable on mobile. */
|
|
805
930
|
readonly needsRuntimeDecoder?: boolean;
|
|
806
931
|
readonly name: string;
|
|
932
|
+
/**
|
|
933
|
+
* Input kinds whose bytes this pass can change. The compile hashes only the passes that can
|
|
934
|
+
* change an asset into that asset's digest, so a model-only option edit does not rename every
|
|
935
|
+
* texture. `undefined` (the default for a caller-supplied pass) means any kind, which stays
|
|
936
|
+
* conservative: an unknown pass can change every asset.
|
|
937
|
+
*/
|
|
938
|
+
readonly appliesTo?: readonly AssetKind[];
|
|
807
939
|
/**
|
|
808
940
|
* JSON-serializable snapshot of every option that changes this pass's output. Part of the
|
|
809
941
|
* compile cache key: without it, editing a config value (texture quality, quantize bits, an
|
|
@@ -825,7 +957,7 @@ interface IAssetSourceConfig {
|
|
|
825
957
|
readonly audio?: IAudioConfig | "none";
|
|
826
958
|
/**
|
|
827
959
|
* The bound on how many workers a bake may use. A direct `concurrency` option overrides it;
|
|
828
|
-
* absent means the driver's default (
|
|
960
|
+
* absent means the driver's default (cores - 1, bounded by ~2 GB of memory a worker, at most 12). CI boxes and laptops differ, and
|
|
829
961
|
* a 6.8 GB pack does not get to decide the machine's fate.
|
|
830
962
|
*/
|
|
831
963
|
readonly concurrency?: number;
|
|
@@ -850,6 +982,11 @@ interface IAssetSourceConfig {
|
|
|
850
982
|
readonly textures?: ITexturesConfig | "none";
|
|
851
983
|
}
|
|
852
984
|
interface IModelsConfig {
|
|
985
|
+
/**
|
|
986
|
+
* Lossless scene-graph compaction (flatten → instance → join) against one protected-node set.
|
|
987
|
+
* Default true ({@link IModelCompactOptions}); `false` ships the scene graph as authored.
|
|
988
|
+
*/
|
|
989
|
+
readonly compact?: boolean | IModelCompactOptions;
|
|
853
990
|
/** Generate standard TEXCOORD_1 lightmap UVs. Absent means no lightmap pass. */
|
|
854
991
|
readonly lightmap?: ILightmapPassOptions;
|
|
855
992
|
readonly passes?: IModelPassesOptions;
|
|
@@ -955,6 +1092,11 @@ interface IAssetCompileResult {
|
|
|
955
1092
|
readonly skippedCompression: readonly ISkippedReportRow[];
|
|
956
1093
|
readonly receipt?: IBakeReceipt;
|
|
957
1094
|
readonly report?: IAssetHealthReport;
|
|
1095
|
+
/**
|
|
1096
|
+
* What the model cook saved by cooking content-identical sources once, when this project has
|
|
1097
|
+
* any model source. `cooked` is the number of distinct outputs those sources produced.
|
|
1098
|
+
*/
|
|
1099
|
+
readonly dedupe?: IModelDedupeSummary;
|
|
958
1100
|
readonly skipped: number;
|
|
959
1101
|
readonly written: number;
|
|
960
1102
|
}
|
|
@@ -1317,4 +1459,4 @@ declare function censusDocument(model: string, document: Document, pageSize?: nu
|
|
|
1317
1459
|
/** Totals across a set of models, so a scene's census is one line rather than twenty-nine. */
|
|
1318
1460
|
declare function totalCensus(entries: readonly IContentCensus[]): Omit<IContentCensus, "model">;
|
|
1319
1461
|
|
|
1320
|
-
export { type AssetFindingGrade, type AssetKind, type AtlasExclusionReason, type AudioBand, type AudioConditioning, type AudioNormalisation, type IAssetCompileOptions, type IAssetCompileResult, type IAssetFinding, type IAssetHealthEntry, type IAssetHealthInput, type IAssetHealthReport, type IAssetPass, type IAssetPassOutput, type IAssetSourceConfig, type IAssetTargets, type IAssetWatchHandle, type IAssetWatchOptions, type IAssetWatchSummary, type IAtlasExclusion, type IAtlasOptions, type IAtlasPage, type IAtlasPlacement, type IAtlasResult, type IAtlasSource, type IAudioConfig, type IAudioLoopOptions, type IAudioOverride, type IAudioPassOptions, type IAudioRow, type IAudioSpectrumExpectation, type IBakeReceipt, type IBakeReceiptOutput, type IBasisTranscoder, type IContentCensus, type IDedupeCensus, type IEmbeddedTextureRow, type IEmbeddedTextureSummary, type ILightmapPassOptions, type IMaterialBucket, type IMaterialState, type IModelPassOptions, type IModelPassesOptions, type IModelQuantizeOptions, type IModelSimplifyOptions, type IModelSimplifySummary, type IModelSizeRow, type IModelStats, type IModelTextureBinding, type IModelTextureBindings, type IModelTextureOverride, type IModelTexturesOptions, type IModelsConfig, type IPassCostAssetRow, type IPassCostRow, type IPngInfo, type ISimplifyRow, type ITextureOverride, type ITexturePassOptions, type ITextureSizeRow, type ITextureStats, type ITexturesConfig, type PassCostStatus, type TextureCodec, WRAP_CLAMP_TO_EDGE, WRAP_MIRRORED_REPEAT, WRAP_REPEAT, atlasManifest, audioPass, censusDocument, compileAssets, dedupeMaterials, formatAudioSizes, formatHealthReport, formatModelSizes, formatPassCosts, formatTextureSizes, lightmapPass, materialSignature, materialStateOf, modelPass, packAtlas, parseAudioConfig, parsePng, resolveBasisTranscoder, resolveSourceTexel, rewriteUvs, runHealthReport, texturePass, totalCensus, uvsTile, watchAssets, withAtlasTextures, wrapTiles };
|
|
1462
|
+
export { type AssetFindingGrade, type AssetKind, type AtlasExclusionReason, type AudioBand, type AudioConditioning, type AudioNormalisation, type IAssetCompileOptions, type IAssetCompileResult, type IAssetFinding, type IAssetHealthEntry, type IAssetHealthInput, type IAssetHealthReport, type IAssetPass, type IAssetPassOutput, type IAssetSourceConfig, type IAssetTargets, type IAssetWatchHandle, type IAssetWatchOptions, type IAssetWatchSummary, type IAtlasExclusion, type IAtlasOptions, type IAtlasPage, type IAtlasPlacement, type IAtlasResult, type IAtlasSource, type IAudioConfig, type IAudioLoopOptions, type IAudioOverride, type IAudioPassOptions, type IAudioRow, type IAudioSpectrumExpectation, type IBakeReceipt, type IBakeReceiptOutput, type IBasisTranscoder, type IContentCensus, type IDedupeCensus, type IEmbeddedTextureRow, type IEmbeddedTextureSummary, type ILightmapPassOptions, type IMaterialBucket, type IMaterialState, type IModelCompactInstanceOptions, type IModelCompactOptions, type IModelCompactSummary, type IModelPassOptions, type IModelPassesOptions, type IModelProtectedNode, type IModelQuantizeOptions, type IModelSimplifyOptions, type IModelSimplifySummary, type IModelSizeRow, type IModelStats, type IModelTextureBinding, type IModelTextureBindings, type IModelTextureOverride, type IModelTexturesOptions, type IModelsConfig, type IPassCostAssetRow, type IPassCostRow, type IPngInfo, type IResolvedCompactOptions, type ISimplifyRow, type ITextureOverride, type ITexturePassOptions, type ITextureSizeRow, type ITextureStats, type ITexturesConfig, type PassCostStatus, type TModelProtectedRule, type TextureCodec, WRAP_CLAMP_TO_EDGE, WRAP_MIRRORED_REPEAT, WRAP_REPEAT, atlasManifest, audioPass, censusDocument, compileAssets, dedupeMaterials, formatAudioSizes, formatHealthReport, formatModelSizes, formatPassCosts, formatTextureSizes, lightmapPass, materialSignature, materialStateOf, modelPass, packAtlas, parseAudioConfig, parsePng, resolveBasisTranscoder, resolveSourceTexel, rewriteUvs, runHealthReport, texturePass, totalCensus, uvsTile, watchAssets, withAtlasTextures, wrapTiles };
|