wwobjloader2
Version:
[](https://github.com/kaisalmen/WWOBJLoader/blob/dev/LICENSE) [](https://github.com/kaisalm
67 lines • 2.63 kB
TypeScript
import { Loader, Object3D } from 'three';
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader.js';
import { AssociatedArrayType } from 'wtd-core';
import { ResourceDescriptor } from './utils/ResourceDescriptor.js';
export type CallbackCompleteType = ((description: string, extra?: Object3D) => void) | null;
export type ParserType = AssociatedArrayType<unknown> & {
parse: (data: ArrayBufferLike | string) => Object3D;
};
export type LinkType = {
link: (data: AssociatedArrayType<unknown>, nextTask: AssociatedArrayType<unknown>) => Object3D | undefined;
};
declare class AssetPipelineLoader {
private name;
private assetPipeline;
private baseObject3d;
private onComplete;
constructor(name: string, assetPipeline: AssetPipeline);
getName(): string;
setBaseObject3d(baseObject3d: Object3D): this;
setOnComplete(onComplete: CallbackCompleteType): void;
run(): this;
}
/**
* The AssetPipeline defines a set of {@link AssetTask} that need to be executed one after the other and return a {@link Object3D}.
* @constructor
*/
declare class AssetPipeline {
private name;
private onComplete;
private assetTasks;
addAssetTask(assetTask: AssetTask): this;
/**
* Init all {@link AssetTask}
*
* @param {string} name Name of the pipeline
* @param {CallbackCompleteType} onComplete set callback function
* @return {AssetPipeline}
*/
initPipeline(name: string, onComplete: CallbackCompleteType): this;
/**
* Run the pipeline: First load resources and then execute the parsing functions
* @param {Object3D} baseObject3d
* @return {AssetPipeline}
*/
runPipeline(baseObject3d: Object3D): Promise<void>;
}
declare class AssetTask {
private name;
private resourceDescriptor;
private assetLoader;
private relations;
private processResult;
constructor(name: string);
getName(): string;
setResourceDescriptor(resourceDescriptor: ResourceDescriptor): this;
getResourceDescriptor(): ResourceDescriptor | undefined;
setTaskBefore(assetTask: AssetTask): void;
setTaskAfter(assetTask: AssetTask): void;
getProcessResult(): Object3D<import("three").Object3DEventMap> | undefined;
setLinker(linker: LinkType): void;
setLoader(loader: Loader<Object3D, string> | Loader<MTLLoader.MaterialCreator>, loaderConfig?: AssociatedArrayType<string | object | boolean>): this;
init(): void;
loadResource(): Promise<ResourceDescriptor>;
process(): void;
}
export { AssetPipelineLoader, AssetPipeline, AssetTask };
//# sourceMappingURL=AssetPipelineLoader.d.ts.map