forked from phenom/healer-man
Release Healer Man 0.1.22
This commit is contained in:
1 parent
f6f2375145
commit
7f6001723a
144 files changed
+54107
-690
No files matched your search
@@ -14,7 +14,7 @@ import {
|
||||
type ErrorInfo,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { BufferGeometry, Quaternion, type Group, type Mesh } from "three";
|
||||
import { Quaternion, type Group } from "three";
|
||||
import { classById, raceById, type GenderId, type RaceId } from "../app/characterCatalog";
|
||||
import { CharacterModel } from "../avatar/CharacterModel";
|
||||
import { ProceduralAvatar } from "../avatar/ProceduralAvatar";
|
||||
@@ -49,12 +49,11 @@ import {
|
||||
type PartyMovementProfile,
|
||||
} from "../game/partyMovement";
|
||||
import {
|
||||
buildPartyNavigationGraph,
|
||||
findNearestPartyNavigationSurface,
|
||||
type PartyNavigationGraph,
|
||||
} from "../game/partyNavigation";
|
||||
import { preparePartyNavigationGraph } from "../game/partyNavigationAssetCache";
|
||||
import {
|
||||
MAX_SYNCHRONOUS_PARTY_NAVIGATION_TRIANGLES,
|
||||
partyObjectivesForNavigation,
|
||||
shouldLoadPartyNavigation,
|
||||
} from "../game/partyNavigationPolicy";
|
||||
@@ -198,24 +197,6 @@ class NavigationAssetBoundary extends Component<NavigationAssetBoundaryProps, Na
|
||||
}
|
||||
}
|
||||
|
||||
function navigationGeometry(scene: Group): BufferGeometry {
|
||||
scene.updateMatrixWorld(true);
|
||||
let sourceMesh: Mesh | null = null;
|
||||
let largestVertexCount = 0;
|
||||
scene.traverse((node) => {
|
||||
const mesh = node as Mesh;
|
||||
const count = mesh.isMesh ? mesh.geometry.getAttribute("position")?.count ?? 0 : 0;
|
||||
if (count > largestVertexCount) {
|
||||
sourceMesh = mesh;
|
||||
largestVertexCount = count;
|
||||
}
|
||||
});
|
||||
if (!sourceMesh) throw new Error("The party navigation GLB has no triangle geometry.");
|
||||
const geometry = (sourceMesh as Mesh).geometry.clone();
|
||||
geometry.applyMatrix4((sourceMesh as Mesh).matrixWorld);
|
||||
return geometry;
|
||||
}
|
||||
|
||||
function PartyNavigationLoader({
|
||||
url,
|
||||
offMeshLinks,
|
||||
@@ -226,17 +207,10 @@ function PartyNavigationLoader({
|
||||
readonly onReady: (graph: PartyNavigationGraph) => void;
|
||||
}) {
|
||||
const gltf = useGLTF(resolveContentUrl(url));
|
||||
const graph = useMemo(() => {
|
||||
const geometry = navigationGeometry(gltf.scene);
|
||||
try {
|
||||
return buildPartyNavigationGraph(geometry, {
|
||||
maxSourceTriangles: MAX_SYNCHRONOUS_PARTY_NAVIGATION_TRIANGLES,
|
||||
offMeshLinks,
|
||||
});
|
||||
} finally {
|
||||
geometry.dispose();
|
||||
}
|
||||
}, [gltf.scene, offMeshLinks]);
|
||||
const graph = useMemo(
|
||||
() => preparePartyNavigationGraph(url, gltf.scene, offMeshLinks),
|
||||
[gltf.scene, offMeshLinks, url],
|
||||
);
|
||||
|
||||
useEffect(() => onReady(graph), [graph, onReady]);
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user