forked from phenom/healer-man
Release Healer Man 0.1.21
This commit is contained in:
1 parent
699fc858c9
commit
f6f2375145
210 files changed
+976039
-6247
No files matched your search
@@ -28,6 +28,7 @@ import {
|
||||
import {
|
||||
nextTiledNavMeshSize,
|
||||
planNavigationBuild,
|
||||
shouldRetryFailedTiledBuildWithMonotone,
|
||||
shouldUseMonotonePartition,
|
||||
validateTiledBuild,
|
||||
} from "./recast-policy.mjs";
|
||||
@@ -275,9 +276,11 @@ export async function bakeNavigationFromCollisionAssets({
|
||||
const meshes = scenes.flatMap(meshesIn);
|
||||
if (!meshes.length) throw new Error(`${slug}: collision chunks contain no triangle meshes.`);
|
||||
const input = inspectNavigationInput(meshes);
|
||||
let build = planNavigationBuild(input.bounds, settings.cellSize, {
|
||||
tileSize: settings.tileSize,
|
||||
const navigationPlan = (tileSize) => planNavigationBuild(input.bounds, settings.cellSize, {
|
||||
tileSize,
|
||||
...(settings.forceTiled === true ? { maxSoloAxis: 0, maxSoloCells: 0 } : {}),
|
||||
});
|
||||
let build = navigationPlan(settings.tileSize);
|
||||
const generatorConfig = {
|
||||
cs: settings.cellSize,
|
||||
ch: settings.cellHeight,
|
||||
@@ -325,7 +328,20 @@ export async function bakeNavigationFromCollisionAssets({
|
||||
retainTileIntermediates,
|
||||
);
|
||||
}
|
||||
if (!generated.success) throw new Error(`${slug}: Recast generation failed: ${generated.error}`);
|
||||
if (!generated.success) {
|
||||
buildAttempts.push({
|
||||
partition: tiledPartition,
|
||||
tileSize: build.tileSize,
|
||||
tileCount: build.tileCount,
|
||||
valid: false,
|
||||
failures: [{ x: null, y: null, message: generated.error }],
|
||||
});
|
||||
if (shouldRetryFailedTiledBuildWithMonotone(generated.error, tiledPartition)) {
|
||||
tiledPartition = "monotone";
|
||||
continue;
|
||||
}
|
||||
throw new Error(`${slug}: Recast generation failed: ${generated.error}`);
|
||||
}
|
||||
tiledValidation = validateTiledBuild(generated.intermediates, {
|
||||
errorCategory: Recast.RC_LOG_ERROR,
|
||||
warningCategory: Recast.RC_LOG_WARNING,
|
||||
@@ -351,9 +367,7 @@ export async function bakeNavigationFromCollisionAssets({
|
||||
releaseTiledIntermediates(generated.intermediates);
|
||||
generated.navMesh.destroy();
|
||||
generated = null;
|
||||
build = planNavigationBuild(input.bounds, settings.cellSize, {
|
||||
tileSize: nextTileSize,
|
||||
});
|
||||
build = navigationPlan(nextTileSize);
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
@@ -364,9 +378,7 @@ export async function bakeNavigationFromCollisionAssets({
|
||||
generated.navMesh.destroy();
|
||||
generated = null;
|
||||
tiledPartition = "monotone";
|
||||
build = planNavigationBuild(input.bounds, settings.cellSize, {
|
||||
tileSize: settings.tileSize,
|
||||
});
|
||||
build = navigationPlan(settings.tileSize);
|
||||
continue;
|
||||
}
|
||||
const sample = tiledValidation.failures
|
||||
|
||||
@@ -146,3 +146,8 @@ export function shouldUseMonotonePartition(validation) {
|
||||
(failure) => /^rcBuildRegions: \d+ overlapping regions\.$/.test(failure.message),
|
||||
);
|
||||
}
|
||||
|
||||
export function shouldRetryFailedTiledBuildWithMonotone(error, partition) {
|
||||
return partition === "watershed"
|
||||
&& /failed to triangulate contours/i.test(String(error ?? ""));
|
||||
}
|
||||
Reference in new issue
Block a user