registry / systems / renderer

This commit is contained in:
wass08
2026-01-15 10:43:32 +09:00
parent 7a4d6e397d
commit 0c07c482a5
93 changed files with 440 additions and 75 deletions
@@ -0,0 +1,25 @@
import { ItemNode, useRegistry } from "@pascal-app/core";
import { Clone } from "@react-three/drei/core/Clone";
import { useGLTF } from "@react-three/drei/core/Gltf";
import { useRef } from "react";
import { Group } from "three";
export const ItemRenderer = ({ node }: { node: ItemNode }) => {
const ref = useRef<Group>(null!);
const { scene, nodes } = useGLTF(node.asset.src);
useRegistry(node.id, node.type, ref);
if (nodes.cutout) {
nodes.cutout.visible = false;
}
return (
<Clone
ref={ref}
object={scene}
position={node.position}
rotation={node.rotation}
/>
);
};