UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

149 lines 3.49 kB
export class TextureAtlas extends AbstractTextureAtlas { /** * * @param {number} [size] * @param {BinaryDataType} [data_type] * @param {number} [channel_count] * @constructor */ constructor(size?: number, data_type?: BinaryDataType, channel_count?: number); /** * * @type {IdPool} * @private */ private idPool; /** * @private * @type {AtlasPatch[]} */ private patches; /** * @readonly * @type {Vector2} */ readonly size: Vector2; /** * @private * @readonly * @type {Sampler2D} */ private readonly __sampler; /** * @private * @type {MaxRectanglesPacker} */ private packer; on: { painted: Signal<any, any, any, any, any, any, any, any>; /** * @type {Signal<AtlasPatch, Sampler2D>} */ removed: Signal<AtlasPatch, Sampler2D>; }; /** * * @type {boolean} * @private */ private __needsUpdate; /** * * @return {Sampler2D} */ get sampler(): Sampler2D; /** * * @param {Sampler2D} sampler * @returns {AtlasPatch|undefined} */ getPatch(sampler: Sampler2D): AtlasPatch | undefined; /** * Whether or not current state of atlas requires calling {#update} * @returns {boolean} */ needsUpdate(): boolean; /** * * @param {AtlasPatch} patch * @returns {boolean} */ contains(patch: AtlasPatch): boolean; /** * Clear canvas and update patch flags */ erase(): void; /** * * @param {number} x * @param {number} y * @returns {boolean} true if resizing successful, false otherwise */ resize(x: number, y: number): boolean; /** * * @param {AtlasPatch} patch * @private */ private paintPatch; /** * * @param {AtlasPatch} patch * @private */ private erasePatch; /** * @private * @param {number} x0 * @param {number} y0 * @param {number} x1 * @param {number} y1 */ private eraseArea; /** * * @param {Sampler2D} sampler * @param {number} [padding] * @return {AtlasPatch} */ add(sampler: Sampler2D, padding?: number): AtlasPatch; /** * Whether a patch of certain size could be packed without triggering repack or growing the atlas * @param {number} w * @param {number} h * @returns {boolean} */ can_pack(w: number, h: number): boolean; /** * * @param {AtlasPatch} patch * @return {boolean} */ remove(patch: AtlasPatch): boolean; /** * Re-packs all patches, this is useful for reclaiming fragmented space after extended usage * @returns {boolean} */ repack(): boolean; /** * Pack any patches that are not packed yet * @private * @returns {boolean} */ private pack; /** * @private */ private paint; /** * Drops all the data */ reset(): void; } import { AbstractTextureAtlas } from "./AbstractTextureAtlas.js"; import Vector2 from "../../../../core/geom/Vector2.js"; import Signal from "../../../../core/events/signal/Signal.js"; import { AtlasPatch } from "./AtlasPatch.js"; import { Sampler2D } from "../sampler/Sampler2D.js"; import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js"; //# sourceMappingURL=TextureAtlas.d.ts.map