import { Buffer } from '../buffer'; import { Context } from '../context'; import { Geometry } from '../geometry'; import { Material } from '../scene'; import { Texture2D } from '../texture2d'; /** * @todo add description */ export declare class ResourceManager { /** * Context, used to get context information and WebGL API access. */ protected _context: Context; /** * Internal storage of 2D textures. */ protected _texture2Ds: Map; /** * Internal storage of material. */ protected _materials: Map; /** * Internal storage of geometries. */ protected _geometries: Map; /** * Internal storage of buffers. */ protected _buffers: Map; /** * Creates a resource manager that can be used to fetch and store resources such as textures, geometries, etc. * @param context - Valid context to created fetched objects for. Note that add external resources are expected to * belong to that same context. */ constructor(context: Context); /** * Creates a Texture2D object and asynchronously loads its image via URL or data URI (@see {@link Texture2D.fetch}). * @param url - Uniform resource locator string referencing the image that should be loaded (data URI supported). * @param crossOrigin - Enable cross origin data loading. * @param identifier - Meaningful name for identification of this instance. * @returns - Promise for handling image load status. Returns undefined if identifier already exists. */ fetchTexture2D(identifier: string, url: string, crossOrigin?: boolean): Promise | undefined; /** * Allows to add a resource that, e.g., was not fetched by this resource manager but was loaded or generated * somewhere else instead. Please note that by adding the resource, the manager assumes 'taking ownership'. * If all given identifiers are already in use, the resource manager does not take ownership of the resource. * @param resource - Resource to add. * @param identifiers - The identifiers by which the resource can be queried from the ResourceManager. * @returns - The array of added indentifiers. If an identifier already exists for another resource it is not added. */ add(resource: Texture2D | Material | Geometry | Buffer, identifiers: Array): Array; /** * Queries a resource based on the given identifier. * @param identifier - Name of a previously added resource */ get(identifier: string): Texture2D | Material | Geometry | Buffer | undefined; uninitialize(): void; }