forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
69809f7228
commit
ff20ab8779
101 files changed
+16713
-945
No files matched your search
@@ -32,19 +32,25 @@ function compressKtx2(file) {
|
||||
});
|
||||
}
|
||||
|
||||
export function dungeonEnvironmentOptimizationArguments(sourceFile, outputFile) {
|
||||
export function dungeonEnvironmentOptimizationArguments(sourceFile, outputFile, { preserveSpatialBoundaries = false } = {}) {
|
||||
return [
|
||||
"optimize",
|
||||
sourceFile,
|
||||
outputFile,
|
||||
"--compress",
|
||||
"meshopt",
|
||||
"false",
|
||||
"--meshopt-level",
|
||||
"high",
|
||||
"--instance",
|
||||
"true",
|
||||
preserveSpatialBoundaries ? "false" : "true",
|
||||
"--instance-min",
|
||||
"3",
|
||||
"--flatten",
|
||||
preserveSpatialBoundaries ? "false" : "true",
|
||||
"--join",
|
||||
preserveSpatialBoundaries ? "false" : "true",
|
||||
"--weld",
|
||||
preserveSpatialBoundaries ? "false" : "true",
|
||||
"--simplify",
|
||||
"false",
|
||||
"--texture-compress",
|
||||
@@ -53,7 +59,17 @@ export function dungeonEnvironmentOptimizationArguments(sourceFile, outputFile)
|
||||
}
|
||||
|
||||
export function dungeonEnvironmentFinalPackingArguments(sourceFile, outputFile) {
|
||||
return dungeonEnvironmentOptimizationArguments(sourceFile, outputFile);
|
||||
return [
|
||||
"meshopt",
|
||||
sourceFile,
|
||||
outputFile,
|
||||
"--level",
|
||||
"high",
|
||||
"--quantize-position",
|
||||
"16",
|
||||
"--quantize-texcoord",
|
||||
"16",
|
||||
];
|
||||
}
|
||||
|
||||
export async function optimizeDungeonEnvironment(slug) {
|
||||
@@ -71,6 +87,7 @@ export async function optimizeDungeonEnvironment(slug) {
|
||||
if (slug !== "shadowfang-keep" && selectiveProfile) {
|
||||
throw new Error(`The Shadowfang-only selective fallback profile cannot be applied to ${slug}.`);
|
||||
}
|
||||
const preserveSpatialBoundaries = recipe.visualOptimization?.preserveSpatialBoundaries === true;
|
||||
const optimized = path.join(directory, `${slug}-visual.optimized.glb`);
|
||||
const packed = path.join(directory, `${slug}-visual.meshopt-final.glb`);
|
||||
let temporaryDirectory = null;
|
||||
@@ -83,13 +100,13 @@ export async function optimizeDungeonEnvironment(slug) {
|
||||
sourcePreprocessing = await preprocessShadowfangVisual(source, optimizationSource);
|
||||
}
|
||||
|
||||
await runCli(dungeonEnvironmentOptimizationArguments(optimizationSource, optimized));
|
||||
await runCli(dungeonEnvironmentOptimizationArguments(optimizationSource, optimized, { preserveSpatialBoundaries }));
|
||||
await compressKtx2(optimized);
|
||||
await rm(packed, { force: true });
|
||||
await runCli(dungeonEnvironmentFinalPackingArguments(optimized, packed));
|
||||
await copyFile(packed, optimized);
|
||||
await rm(packed, { force: true });
|
||||
const finalPackingCommand = "gltf-transform optimize <optimized.glb> <meshopt-final.glb> --compress meshopt --meshopt-level high --instance true --instance-min 3 --simplify false --texture-compress false";
|
||||
const finalPackingCommand = "gltf-transform meshopt <optimized.glb> <meshopt-final.glb> --level high --quantize-position 16 --quantize-texcoord 16";
|
||||
const report = {
|
||||
schemaVersion: 1,
|
||||
dungeonId: slug,
|
||||
@@ -105,6 +122,8 @@ export async function optimizeDungeonEnvironment(slug) {
|
||||
} : null,
|
||||
optimized: { file: path.basename(optimized), size: (await stat(optimized)).size },
|
||||
compression: "meshopt+ktx2",
|
||||
meshoptQuantization: { positionBits: 16, texcoordBits: 16 },
|
||||
preserveSpatialBoundaries,
|
||||
meshoptPackingRestoredAfterTextureCompression: true,
|
||||
finalPackedStage: {
|
||||
status: "complete",
|
||||
@@ -115,7 +134,7 @@ export async function optimizeDungeonEnvironment(slug) {
|
||||
},
|
||||
commands: [
|
||||
...(sourcePreprocessing ? ["source-pinned Shadowfang fallback preprocessing (see sourcePreprocessing profile)"] : []),
|
||||
"gltf-transform optimize --compress meshopt --meshopt-level high --instance true --instance-min 3 --simplify false --texture-compress false",
|
||||
`gltf-transform optimize --compress false --instance ${preserveSpatialBoundaries ? "false" : "true"} --flatten ${preserveSpatialBoundaries ? "false" : "true"} --join ${preserveSpatialBoundaries ? "false" : "true"} --weld ${preserveSpatialBoundaries ? "false" : "true"} --simplify false --texture-compress false`,
|
||||
"node scripts/asset-pipeline/compress-ktx2.mjs <optimized.glb> --concurrency 1 --jobs 2",
|
||||
finalPackingCommand,
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user