UNPKG

@playcanvas/react

Version:

A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.

52 lines (51 loc) 1.24 kB
import React, { ReactNode } from 'react'; import { Asset } from 'playcanvas'; export interface GltfProps { /** * The GLTF asset loaded via useModel */ asset: Asset; /** * Whether to render the GLTF scene visuals * @default true */ render?: boolean; /** * Children should contain <Modify.Node> components */ children?: ReactNode; } /** * Root component for GLTF scene modification system * * Provides: * - Lazy instantiation of GLTF assets * - Hierarchy cache for entity lookups * - Rule collection and conflict resolution * - Batched modification application * - Optional rendering of GLTF visuals * * @example * ```tsx * const { asset } = useModel('model.glb'); * * return ( * <Gltf asset={asset} key={asset.id}> * <Modify.Node path="head.*[light]"> * <Modify.Component type="light" remove /> * </Modify.Node> * </Gltf> * ); * ``` * * @example * ```tsx * // Don't render visuals, only process modifications * <Gltf asset={asset} key={asset.id} render={false}> * <Modify.Node path="**[light]"> * <Modify.Component type="light" remove /> * </Modify.Node> * </Gltf> * ``` */ export declare const Gltf: React.FC<GltfProps>;