UNPKG

@pixi/core

Version:
52 lines (47 loc) 1.58 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var Texture = require('../textures/Texture.js'); var BaseRenderTexture = require('./BaseRenderTexture.js'); class RenderTexture extends Texture.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.BaseRenderTexture(options)); } } exports.RenderTexture = RenderTexture; //# sourceMappingURL=RenderTexture.js.map