{"version":3,"file":"RenderTexture.mjs","sources":["../../../../../src/rendering/renderers/shared/texture/RenderTexture.ts"],"sourcesContent":["import { TextureSource } from './sources/TextureSource';\nimport { Texture, type TextureOptions } from './Texture';\n\nimport type { TextureSourceOptions } from './sources/TextureSource';\n\n/**\n * The options that can be passed to a new RenderTexture\n * @category rendering\n * @advanced\n */\nexport interface RenderTextureOptions extends TextureSourceOptions\n{\n    /** texture options {@link TextureOptions} */\n    textureOptions?: Omit<TextureOptions, 'source' | 'dynamic'>\n}\n\n/**\n * A render texture, extends `Texture`.\n * @see {@link Texture}\n * @category rendering\n * @advanced\n */\nexport class RenderTexture extends Texture\n{\n    /**\n     * Creates a RenderTexture. Pass `dynamic: true` in options to allow resizing after creation.\n     * @param options - Options for the RenderTexture, including width, height, textureOptions, and dynamic.\n     * @returns A new RenderTexture instance.\n     * @example\n     * const textureOptions = { defaultAnchor: { x: 0.5, y: 0.5 } };\n     * const rt = RenderTexture.create({ width: 100, height: 100, dynamic: true, textureOptions });\n     * rt.resize(500, 500);\n     */\n    public static create(options: RenderTextureOptions): RenderTexture\n    {\n        // Pass dynamic to the RenderTexture constructor if present in options\n        const { dynamic, textureOptions, ...rest } = options;\n\n        return new RenderTexture({\n            ...textureOptions,\n            source: new TextureSource(rest),\n            dynamic: dynamic ?? false,\n        });\n    }\n\n    /**\n     * Resizes the render texture.\n     * @param width - The new width of the render texture.\n     * @param height - The new height of the render texture.\n     * @param resolution - The new resolution of the render texture.\n     * @returns This texture.\n     */\n    public resize(width: number, height: number, resolution?: number): this\n    {\n        this.source.resize(width, height, resolution);\n\n        return this;\n    }\n}\n"],"names":[],"mappings":";;;;AAsBO,MAAM,sBAAsB,OAAA,CACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUI,OAAc,OAAO,OAAA,EACrB;AAEI,IAAA,MAAM,EAAE,OAAA,EAAS,cAAA,EAAgB,GAAG,MAAK,GAAI,OAAA;AAE7C,IAAA,OAAO,IAAI,aAAA,CAAc;AAAA,MACrB,GAAG,cAAA;AAAA,MACH,MAAA,EAAQ,IAAI,aAAA,CAAc,IAAI,CAAA;AAAA,MAC9B,SAAS,OAAA,IAAW;AAAA,KACvB,CAAA;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,MAAA,CAAO,KAAA,EAAe,MAAA,EAAgB,UAAA,EAC7C;AACI,IAAA,IAAA,CAAK,MAAA,CAAO,MAAA,CAAO,KAAA,EAAO,MAAA,EAAQ,UAAU,CAAA;AAE5C,IAAA,OAAO,IAAA;AAAA,EACX;AACJ;;;;"}