import { AnimationClip, Object3D } from 'three/webgpu'; import { MeshComponent } from '../MeshComponent.ts'; /** * Geometry loaded from an asset. * * The only mesh component that fetches anything, which is why the asset loader * and {@link setFromGLTF} live here and not on {@link MeshComponent}: a primitive * or a floor has nothing to load, and inheriting `setFromGLTF` gave them a method * that would have overwritten their node's transform. * * @module */ export declare class ModelComponent extends MeshComponent { readonly isModelComponent: true; /** * The clips the asset came with. * * Its own field, not `Object3D.animations`: they belong to the asset, and the * mixer takes a root and its clips separately, so nothing needs them to sit * on a graph object. */ animations: AnimationClip[]; /** What {@link setFromURL} last loaded, so a clone can load it again. */ private _url; constructor(); private _assetLoader; private _getAssetLoader; /** * Loads an asset and takes its content as this component's geometry. * * Reports the load on itself. Whoever wants to hear about an entity being * loaded listens to the component that loads it -- the node has nothing to * do with fetching, and a component with no owner yet had nowhere to report * before, which silently dropped the event. * * @param url - The asset to load. */ setFromURL(url: string): Promise; /** * Replaces the content with a loaded glTF hierarchy. * * @param gltf - What the loader returned: a glTF *scene*, whose children are * the file's root nodes. */ setFromGLTF(gltf: Object3D): this; /** The asset {@link setFromURL} last loaded, if any. */ get url(): string | null; /** * Carries over what identifies the content, not the content itself. * * The one component whose state a copy cannot reproduce on its own: a load is * asynchronous, and `copy` is not. So the clone comes back with the same * {@link url} and clips but no geometry, and the caller finishes it: * * ```ts * const clone = source.clone(); * if (clone.url) await clone.setFromURL(clone.url); * ``` * * Spelled out because the alternative is worse: cloning the loaded hierarchy * would share every geometry and material with the source, and either * component's `dispose` would then free what the other still draws. * * @param source - The component to copy from. */ copy(source: this): this; }