@spearwolf/twopoint5d
Version:
Create 2.5D realtime graphics and pixelart with WebGL and three.js
53 lines • 2.66 kB
TypeScript
import { type EventizedObject } from '@spearwolf/eventize';
import type { Texture, WebGPURenderer } from 'three/webgpu';
import type { FrameBasedAnimations } from './FrameBasedAnimations.js';
import type { TextureAtlas } from './TextureAtlas.js';
import type { TextureCoords } from './TextureCoords.js';
import { TextureFactory, type TextureOptionClasses } from './TextureFactory.js';
import { TextureResource, type TextureResourceSubType } from './TextureResource.js';
import type { TileSet } from './TileSet.js';
import type { TextureStoreData } from './types.js';
type TextureResourceSubTypeMap = {
imageCoords: TextureCoords;
atlas: TextureAtlas;
tileSet: TileSet;
texture: Texture;
frameBasedAnimations: FrameBasedAnimations;
};
type MapTuple<T extends readonly TextureResourceSubType[]> = T extends readonly [
infer First extends TextureResourceSubType,
...infer Rest extends TextureResourceSubType[]
] ? [TextureResourceSubTypeMap[First], ...MapTuple<Rest>] : [];
type MapSubTypes<T extends keyof TextureResourceSubTypeMap | readonly (keyof TextureResourceSubTypeMap)[]> = T extends keyof TextureResourceSubTypeMap ? TextureResourceSubTypeMap[T] : T extends readonly TextureResourceSubType[] ? MapTuple<T> : never;
export declare const TextureStoreEvents: {
readonly Ready: "ready";
readonly RendererChanged: "rendererChanged";
readonly Resource: "resource";
readonly Dispose: "dispose";
readonly Error: "error";
};
export interface TextureStore extends EventizedObject {
}
export declare class TextureStore {
#private;
static load(url: string | URL): Promise<TextureStore>;
get defaultTextureClasses(): TextureOptionClasses[];
set defaultTextureClasses(value: TextureOptionClasses[]);
get renderer(): WebGPURenderer | undefined;
set renderer(value: WebGPURenderer | undefined);
get textureFactory(): TextureFactory | undefined;
constructor(renderer?: WebGPURenderer);
onResource(id: string, callback: (resource: TextureResource) => void): () => void;
whenReady(): Promise<TextureStore>;
whenResource(id: string): Promise<TextureResource>;
load(url: string | URL): this;
parse(data: TextureStoreData): void;
on<const T extends TextureResourceSubType | readonly TextureResourceSubType[]>(id: string, type: T, callback: (val: MapSubTypes<T>) => void): () => void;
get<const T extends TextureResourceSubType | readonly TextureResourceSubType[]>(id: string, type: T, options?: {
signal?: AbortSignal;
}): Promise<MapSubTypes<T>>;
clearUnused(): number;
dispose(): void;
}
export {};
//# sourceMappingURL=TextureStore.d.ts.map