r3f-managed-glb
Version:
Wrapper around the gbl/gltf loader that allows handling and customizing only selected nodes in JSX instead of generating the full JSX file.
20 lines (19 loc) • 542 B
TypeScript
import { FC, ReactElement } from 'react';
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
import * as THREE from 'three';
export interface ManagedGLBProps {
path: string;
custom?: Custom;
onInit?: () => void;
castShadow?: boolean;
receiveShadow?: boolean;
debug?: boolean;
[key: string]: any;
}
export type Custom = {
[key: string]: (Node: FC, node: THREE.Object3D) => ReactElement | null;
};
export type GLTFResult = GLTF & {
scene: THREE.Object3D;
animations: THREE.AnimationClip[];
};