* Reset. * @param {object} [texturesOptions] - The textures options. * @param {object} [framebufferOptions] - The framebuffer options.
(texturesOptions = [], framebufferOptions = {})
| 70 | * @param {object} [framebufferOptions] - The framebuffer options. |
| 71 | */ |
| 72 | reset(texturesOptions = [], framebufferOptions = {}) { |
| 73 | this.framebufferOptions = framebufferOptions = Object.assign(this.framebufferOptions ?? { |
| 74 | multisample: PIXI.MSAA_QUALITY.NONE, |
| 75 | depth: false, |
| 76 | stencil: false, |
| 77 | clearDepth: 1, |
| 78 | clearStencil: 0 |
| 79 | }, framebufferOptions); |
| 80 | |
| 81 | this.texturesOptions = this.texturesOptions ?? []; |
| 82 | |
| 83 | for (let i = 0, n = texturesOptions.length; i < n; i++) { |
| 84 | this.texturesOptions[i] = Object.assign(this.texturesOptions[i] ?? { |
| 85 | wrapMode: PIXI.WRAP_MODES.CLAMP, |
| 86 | scaleMode: PIXI.SCALE_MODES.NEAREST, |
| 87 | format: PIXI.FORMATS.RED, |
| 88 | type: PIXI.TYPES.UNSIGNED_BYTE, |
| 89 | target: PIXI.TARGETS.TEXTURE_2D, |
| 90 | alphaMode: PIXI.ALPHA_MODES.PMA, |
| 91 | multisample: framebufferOptions.multisample, |
| 92 | clearColor: [0, 0, 0, 0], |
| 93 | }, texturesOptions[i] ?? {}); |
| 94 | |
| 95 | const options = this.texturesOptions[i]; |
| 96 | |
| 97 | options.mipmap = PIXI.MIPMAP_MODES.OFF; |
| 98 | options.anisotropicLevel = 0; |
| 99 | |
| 100 | const clearColor = options.clearColor; |
| 101 | |
| 102 | if (clearColor) { |
| 103 | options.clearColor = new Float32Array(4); |
| 104 | |
| 105 | if (clearColor) { |
| 106 | for (let j = 0; j < Math.min(clearColor.length, 4); j++) { |
| 107 | options.clearColor[j] = clearColor[j]; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | texturesOptions = this.texturesOptions; |
| 114 | |
| 115 | if (!this.textures) { |
| 116 | this.textures = []; |
| 117 | this.sprites = []; |
| 118 | |
| 119 | for (let i = 0; i < texturesOptions.length; i++) { |
| 120 | const options = { |
| 121 | ...texturesOptions[i], |
| 122 | width: 1, |
| 123 | height: 1, |
| 124 | resolution: 1, |
| 125 | multisample: framebufferOptions.multisample |
| 126 | }; |
| 127 | |
| 128 | const texture = PIXI.RenderTexture.create(options); |
| 129 | const baseTexture = texture.baseTexture; |