import { Object3D, Scene } from "three"; import type { ComponentInit, Constructor, ConstructorConcrete, IComponent } from "./engine_types.js"; export declare function removeComponent(go: Object3D, componentInstance: T): T; export declare function getOrAddComponent(go: Object3D, typeName: ConstructorConcrete, init?: ComponentInit): T; export declare function addNewComponent(obj: Object3D, componentInstance: T, callAwake?: boolean): T; export declare function addComponent(obj: Object3D, componentInstance: T | ConstructorConcrete, init?: ComponentInit, opts?: { callAwake: boolean; }): T; export declare function destroyComponentInstance(componentInstance: IComponent): void; /** * Searches for a given component type in the given object. * @param obj The object to search in. * @param componentType The type of the component to search for. * @returns The first component of the given type found in the given object. * @example * ```typescript * const myComponent = getComponent(myObject, MyComponent); * ``` */ export declare function getComponent(obj: Object3D, componentType: Constructor): T | null; /** * Searches for a given component type in the children of the given object. * @param obj The object to start the search from - this object is also included in the search. * @param componentType The type of the component to search for. * @param arr An optional array to store the found components in. If not provided, a new array is created. * @param clearArray If true, the array is cleared before storing the found components. Default is true. * @returns An array of components of the given type found in the children of the given object. * @example * ```typescript * const myComponents = getComponents(myObject, MyComponent); * ``` */ export declare function getComponents(obj: Object3D, componentType: Constructor, arr?: T[] | null, clearArray?: boolean): T[]; /** * Searches for a given component type in the children of the given object. * @param obj The object to start the search from - this object is also included in the search. * @param componentType The type of the component to search for. * @param includeInactive If true, also inactive components are returned. Default is true. * @returns The first component of the given type found in the children of the given object. * @example * ```typescript * const myComponent = getComponentInChildren(myObject, MyComponent); * ``` */ export declare function getComponentInChildren(obj: Object3D, componentType: Constructor, includeInactive?: boolean): T | null; /** * Searches for a given component type in the children of the given object. * @param obj The object to start the search from - this object is also included in the search. * @param componentType The type of the component to search for. * @param arr An optional array to store the found components in. If not provided, a new array is created. * @param clearArray If true, the array is cleared before storing the found components. Default is true. * @returns An array of components of the given type found in the children of the given object. * @example * ```typescript * const myComponents = getComponentsInChildren(myObject, MyComponent); * ``` */ export declare function getComponentsInChildren(obj: Object3D, componentType: Constructor, arr?: T[], clearArray?: boolean): T[]; /** * Searches for a given component type in the parent hierarchy of the given object. * @param obj The object to start the search from - this object is also included in the search. * @param componentType The type of the component to search for. * @param includeInactive If true, also inactive components are returned. Default is false. * @returns The first component of the given type found in the parent hierarchy of the given object. * @example * ```typescript * const myComponent = getComponentInParent(myObject, MyComponent); * ``` */ export declare function getComponentInParent(obj: Object3D, componentType: Constructor, includeInactive?: boolean): T | null; /** * Searches for a given component type in the parent hierarchy of the given object. * @param obj The object to start the search from - this object is also included in the search. * @param componentType The type of the component to search for. * @param arr An optional array to store the found components in. If not provided, a new array is created. * @param clearArray If true, the array is cleared before storing the found components. Default is true. * @returns An array of components of the given type found in the parent hierarchy of the given object. * @example * ```typescript * const myComponents = getComponentsInParent(myObject, MyComponent); * ``` */ export declare function getComponentsInParent(obj: Object3D, componentType: Constructor, arr?: T[] | null, clearArray?: boolean): T[]; /** * Searches the the scene for a component of the given type. * If the contextOrScene is not provided, the current context is used. * @param type The type of the component to search for. * @param contextOrScene The context or scene to search in. If not provided, the current context is used. * @param includeInactive If true, also inactive components are returned. Default is true. * @returns The first component of the given type found in the scene or null if none was found. * @example * ```typescript * const myComponent = findObjectOfType(MyComponent); * ``` */ export declare function findObjectOfType(type: Constructor, contextOrScene?: undefined | Object3D | { scene: Scene; }, includeInactive?: boolean): T | null; /** * Searches the the scene for all components of the given type. * If the contextOrScene is not provided, the current context is used. * @param type The type of the component to search for. * @param contextOrScene The context or scene to search in. If not provided, the current context is used. * @example * ```typescript * const myComponents = findObjectsOfType(MyComponent); * ``` */ export declare function findObjectsOfType(type: Constructor, array?: T[], contextOrScene?: undefined | Object3D | { scene: Scene; }): T[];