Files
2026-10-06 22:25:34 -04:00

26 lines
1.1 KiB
JavaScript

/**
* Preserve source topology because simplification damages the atlas UV seams
* used by RoM environment meshes. Keep optimization focused on mesh size and
* repeated placements. Texture work is disabled here because the CLI's
* default auto-compressor resizes images to 2048px; a separate KTX2 pass encodes
* the full-size source images without changing their dimensions.
*/
export function environmentOptimizationArguments(sourceFile, outputFile, {
preserveNativeWaterLayers = false,
preserveMaterialVariantCarriers = false,
} = {}) {
return [
"optimize", sourceFile, outputFile,
"--compress", "meshopt", "--meshopt-level", "high",
"--instance", "true", "--instance-min", "3",
"--simplify", "false",
"--texture-compress", "false",
// KHR_materials_variants can carry native water maps or browser-adapted
// surface-detail maps. Joining/pruning sees only the default material and
// can discard a carrier, its UVs, or its mapping before runtime selection.
...((preserveNativeWaterLayers || preserveMaterialVariantCarriers)
? ["--join", "false", "--prune", "false", "--prune-attributes", "false"]
: []),
];
}