<commit_before>import createFBO from "gl-fbo";

import Texture2D from "./Texture2D.js";

export default class Framebuffer {
  constructor(gl, width, height, {useFloat = false, buffersNumber = 1, depth = true, stencil = false} = {}) {
    let options = {
      float: useFloat,
      color: buffersNumber,
      depth,
      stencil
    };
    this._stackglFramebuffer = createFBO(gl, [width, height], options);

    for (let i = 0; i < this._stackglFramebuffer.color.length; i++) {
      let color = this._stackglFramebuffer.color[i];
      let texture = new Texture2D(gl, color.width, color.height, color.format, color.type);
      texture._stackglTexture2D.handle = color.handle;
      texture.magFilter = color.magFilter;
      texture.minFilter = color.minFilter;
      texture.mipSamples = color.mipSamples;
      this._stackglFramebuffer.color[i] = texture;
    }
  }

  get gl() {
    return this.stackglTexture2D.gl;
  }

  get webGLFramebuffer() {
    return this._stackglFramebuffer.handle;
  }

  get width() {
    return this._stackglFramebuffer.shape[0];
  }

  set width(value) {
    this._stackglFramebuffer.shape = [value, this.height];
    for (let color of this.colors) {
      color.width = value;
    }
    if(this.depth) {
      this.depth = value;
    }
  }

  get height() {
    return this._stackglFramebuffer.shape[1];
  }

  set height(value) {
    this._stackglFramebuffer.shape = [this.width, value];
    for (let color of this.colors) {
      color.width = value;
    }
    if(this.depth) {
      this.depth = value;
    }
  }

  get colors() {
    return this._stackglFramebuffer.color;
  }

  get depth() {
    return this._stackglFramebuffer.depth;
  }

  bind() {
    this._stackglFramebuffer.bind();
  }

  dispose() {
    this._stackglFramebuffer.dispose();
  }
};<commit_msg>fix framebuffer resize<commit_after>import createFBO from "gl-fbo";

import Texture2D from "./Texture2D.js";

export default class Framebuffer {
  constructor(gl, width, height, {useFloat = false, buffersNumber = 1, depth = true, stencil = false} = {}) {
    let options = {
      float: useFloat,
      color: buffersNumber,
      depth,
      stencil
    };
    this._stackglFramebuffer = createFBO(gl, [width, height], options);

    for (let i = 0; i < this._stackglFramebuffer.color.length; i++) {
      let color = this._stackglFramebuffer.color[i];
      let texture = new Texture2D(gl, color.width, color.height, color.format, color.type);
      texture._stackglTexture2D.handle = color.handle;
      texture.magFilter = color.magFilter;
      texture.minFilter = color.minFilter;
      texture.mipSamples = color.mipSamples;
      this._stackglFramebuffer.color[i] = texture;
    }
  }

  get gl() {
    return this.stackglTexture2D.gl;
  }

  get webGLFramebuffer() {
    return this._stackglFramebuffer.handle;
  }

  get width() {
    return this._stackglFramebuffer.width;
  }

  set width(value) {
    for (let color of this.colors) {
      color.width = value;
    }
    if(this.depth) {
      this.depth.width = value;
    }
    this._stackglFramebuffer.shape = [value, this.height];
  }

  get height() {
    return this._stackglFramebuffer.height;
  }

  set height(value) {
    for (let color of this.colors) {
      color.height = value;
    }
    if(this.depth) {
      this.depth.height = value;
    }
    this._stackglFramebuffer.shape = [this.width, value];
  }

  get colors() {
    return this._stackglFramebuffer.color;
  }

  get depth() {
    return this._stackglFramebuffer.depth;
  }

  bind() {
    this._stackglFramebuffer.bind();
  }

  dispose() {
    this._stackglFramebuffer.dispose();
  }
};
{'fraction_non_alphanumeric': 0.12472527472527473, 'fraction_numerical': 0.004395604395604396, 'mean_word_length': 2.820566631689402, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2090501', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1193, 'n_words': 246}