import { readFile } from "node:fs/promises"; import { NodeIO } from "@gltf-transform/core"; import { ALL_EXTENSIONS } from "@gltf-transform/extensions"; import { applyRunewakerDerivedSupportStyling } from "./rom-derived-support-styling.mjs"; export async function applyRunewakerDerivedSupportStylingToFile(file, options) { if (!options.policyId) return { status: "not-requested", geometryChanged: false }; const sourceDdsBytes = await readFile(options.sourceDdsFile); const io = new NodeIO().registerExtensions(ALL_EXTENSIONS); const document = await io.read(file); const report = applyRunewakerDerivedSupportStyling(document, { ...options, sourceDdsBytes }); if (report.status === "applied") await io.write(file, document); return report; }