import { TextureOptions, TexturePreset } from "../loaders/texturePresets.js"; import { TileAnimationFrame, TileDefinition, TilesetData } from "./types.js"; import { Texture } from "three"; //#region src/tilemap/Tileset.d.ts /** * Represents a tileset with tile definitions and texture atlas. * * Handles UV coordinate calculation and animated tile management. * * @example * ```typescript * const tileset = new Tileset({ * name: 'dungeon', * firstGid: 1, * tileWidth: 16, * tileHeight: 16, * imageWidth: 256, * imageHeight: 256, * columns: 16, * tileCount: 256, * tiles: new Map(), * texture: myTexture, * }) * * const uv = tileset.getUV(5) // Get UV for tile GID 5 * ``` */ declare class Tileset { /** Tileset name */ readonly name: string; /** First GID */ readonly firstGid: number; /** Tile dimensions */ readonly tileWidth: number; readonly tileHeight: number; /** Atlas dimensions */ readonly imageWidth: number; readonly imageHeight: number; /** Grid info */ readonly columns: number; readonly tileCount: number; readonly spacing: number; readonly margin: number; /** Texture atlas */ private _texture; /** Texture options for this tileset */ private _textureOptions; /** Tile definitions (keyed by local ID, not GID) */ private tiles; /** Animated tiles (keyed by local ID) */ private animatedTiles; constructor(data: TilesetData); /** * Get the texture atlas. */ get texture(): Texture | null; /** * Set the texture atlas. * Applies texture options from textureOptions property or TextureConfig.options. */ set texture(value: Texture | null); /** * Get the texture options for this tileset. */ get textureOptions(): TexturePreset | TextureOptions | undefined; /** * Set the texture options for this tileset. * If a texture is already set, it will be updated with the new options. */ set textureOptions(value: TexturePreset | TextureOptions | undefined); /** * Check if a GID belongs to this tileset. */ containsGid(gid: number): boolean; /** * Get local ID from GID. */ getLocalId(gid: number): number; /** * Get UV coordinates for a tile. * Returns normalized UV coordinates (0-1) for the tile in the atlas. * Note: Y is NOT flipped here - the material handles coordinate space conversion. */ getUV(gid: number): { x: number; y: number; width: number; height: number; }; /** * Get tile definition. */ getTile(gid: number): TileDefinition | undefined; /** * Check if a tile is animated. */ isAnimated(gid: number): boolean; /** * Get animation frames for a tile. */ getAnimation(gid: number): TileAnimationFrame[] | undefined; /** * Get all animated tile IDs (as GIDs). */ getAnimatedTileIds(): number[]; /** * Dispose of resources. */ dispose(): void; } //#endregion export { Tileset }; //# sourceMappingURL=Tileset.d.ts.map