forked from phenom/healer-man
Release Healer Man 0.1.7
This commit is contained in:
1 parent
b12fb84859
commit
eca6b5db9b
99 files changed
+1931
-150
No files matched your search
@@ -12,8 +12,17 @@ import {
|
||||
import type { ResolvedDungeonAssets } from "../game/dungeonAssets";
|
||||
import type { DungeonDefinition, DungeonMaterialRoles } from "../game/dungeonTypes";
|
||||
import { useGameStore } from "../game/store";
|
||||
import { collisionTrimeshes, prepareCollision } from "./productionDungeonCollision";
|
||||
import {
|
||||
collisionLineOfSightTrimeshes,
|
||||
collisionTrimeshes,
|
||||
prepareCollision,
|
||||
} from "./productionDungeonCollision";
|
||||
import {
|
||||
DUNGEON_PHYSICAL_COLLISION_GROUPS,
|
||||
DUNGEON_SIGHT_BLOCKER_COLLISION_GROUPS,
|
||||
} from "./dungeonLineOfSight";
|
||||
import { disposeObject3DResources } from "./threeResourceDisposal";
|
||||
import { instanceRepeatedStaticMeshes } from "./staticSceneInstancing";
|
||||
import { useGameGLTF } from "./useGameGLTF";
|
||||
import {
|
||||
DUNGEON_COLLISION_LOAD_BATCH_SIZE,
|
||||
@@ -81,6 +90,7 @@ function prepareVisual(root: Object3D, roles: DungeonMaterialRoles): Object3D {
|
||||
instanced.computeBoundingSphere();
|
||||
}
|
||||
});
|
||||
instanceRepeatedStaticMeshes(clone);
|
||||
return clone;
|
||||
}
|
||||
|
||||
@@ -141,6 +151,7 @@ function CollisionChunk({
|
||||
const gltf = useGameGLTF(url);
|
||||
const collision = useMemo(() => prepareCollision(gltf.scene), [gltf.scene]);
|
||||
const trimeshes = useMemo(() => collisionTrimeshes(collision), [collision]);
|
||||
const sightBlockers = useMemo(() => collisionLineOfSightTrimeshes(collision), [collision]);
|
||||
useEffect(() => () => {
|
||||
disposeObject3DResources(collision, {
|
||||
materials: false,
|
||||
@@ -166,6 +177,15 @@ function CollisionChunk({
|
||||
<TrimeshCollider
|
||||
key={trimesh.id}
|
||||
args={[trimesh.vertices, trimesh.indices]}
|
||||
collisionGroups={DUNGEON_PHYSICAL_COLLISION_GROUPS}
|
||||
/>
|
||||
))}
|
||||
{sightBlockers.map((trimesh) => (
|
||||
<TrimeshCollider
|
||||
key={trimesh.id}
|
||||
args={[trimesh.vertices, trimesh.indices]}
|
||||
collisionGroups={DUNGEON_SIGHT_BLOCKER_COLLISION_GROUPS}
|
||||
sensor
|
||||
/>
|
||||
))}
|
||||
<primitive object={collision} />
|
||||
|
||||
Reference in new issue
Block a user