UNPKG

@pixi/core

Version:
48 lines (45 loc) 1.46 kB
import { Texture } from '../textures/Texture.mjs'; import { BaseRenderTexture } from './BaseRenderTexture.mjs'; class RenderTexture extends Texture { constructor(baseRenderTexture, frame) { super(baseRenderTexture, frame); this.valid = true; this.filterFrame = null; this.filterPoolKey = null; this.updateUvs(); } get framebuffer() { return this.baseTexture.framebuffer; } get multisample() { return this.framebuffer.multisample; } set multisample(value) { this.framebuffer.multisample = value; } resize(desiredWidth, desiredHeight, resizeBaseTexture = true) { const resolution = this.baseTexture.resolution; const width = Math.round(desiredWidth * resolution) / resolution; const height = Math.round(desiredHeight * resolution) / resolution; this.valid = width > 0 && height > 0; this._frame.width = this.orig.width = width; this._frame.height = this.orig.height = height; if (resizeBaseTexture) { this.baseTexture.resize(width, height); } this.updateUvs(); } setResolution(resolution) { const { baseTexture } = this; if (baseTexture.resolution === resolution) { return; } baseTexture.setResolution(resolution); this.resize(baseTexture.width, baseTexture.height, false); } static create(options) { return new RenderTexture(new BaseRenderTexture(options)); } } export { RenderTexture }; //# sourceMappingURL=RenderTexture.mjs.map