<commit_before>(function (window, document) {
  'use strict';

  let _rotating = {
    ROTATE_X: false,
    ROTATE_Y: false,
    ROTATE_Z: false
  };
  let _rotations = {
    ROTATE_X: 0.0,
    ROTATE_Y: 0.0,
    ROTATE_Z: 0.0
  };
  let _looping = false;
  let _pressed = null;
  let _smoothShading = true;

  const ObjParser = window.ObjParser;
  const ELEMS = {
    canvas: document.querySelector('canvas'),

    fileinput: document.querySelector('.fileupload input'),
    filebtn: document.querySelector('.fileupload button'),
    filename: document.querySelector('.fileupload p'),

    vshader: document.getElementById('vshader'),
    fshader: document.getElementById('fshader'),

    rotateX: document.querySelector('.command-rotateX'),
    rotateY: document.querySelector('.command-rotateY'),
    rotateZ: document.querySelector('.command-rotateZ'),
    toggleProjection: document.querySelector('.command-toggleProjection'),
    toggleRotation: document.querySelector('.command-toggleRotation'),
    toggleMeshgrid: document.querySelector('.command-toggleMeshgrid'),
    toggleShading: document.querySelector('.command-toggleShading'),
  };

  function triggerRotation (which, flag) {
    _rotating[which] = flag;
  }

  function incRotation (which) {
    _rotations[which] += 2;
  }

  ELEMS.toggleRotation.addEventListener('click', (ev) => {
    triggerRotation('ROTATE_X', true);
    triggerRotation('ROTATE_Y', true);
    triggerRotation('ROTATE_Z', true);
  });

  ELEMS.rotateX.addEventListener('mousedown', triggerRotation.bind(null, 'ROTATE_X', true));
  ELEMS.rotateY.addEventListener('mousedown', triggerRotation.bind(null, 'ROTATE_Y', true));
  ELEMS.rotateZ.addEventListener('mousedown', triggerRotation.bind(null, 'ROTATE_Z', true));

  ELEMS.rotateX.addEventListener('mouseup', triggerRotation.bind(null, 'ROTATE_X', false));
  ELEMS.rotateY.addEventListener('mouseup', triggerRotation.bind(null, 'ROTATE_Y', false));
  ELEMS.rotateZ.addEventListener('mouseup', triggerRotation.bind(null, 'ROTATE_Z', false));

  let current_file, obj;
  let VERTICES, INDICES, NORMALS;
  const gl = WebGLUtils.setupWebGL(ELEMS.canvas);

  let modelMatrix = new Matrix4();
  let normalMatrix = new Matrix4();
  let mvpMatrix = new Matrix4();
  var viewProjMatrix = new Matrix4();

  const resize = WebGLUtils.genResizeFun(ELEMS.canvas, gl, (w, h, shouldDraw) => {
    viewProjMatrix.setPerspective(30.0, w/h, 0.1, 50.0);
    shouldDraw && draw();
  });

  Shaders.initFromElems(gl, ELEMS.vshader, ELEMS.fshader);<commit_msg>adds trigger for shading toggling<commit_after>(function (window, document) {
  'use strict';

  let _rotating = {
    ROTATE_X: false,
    ROTATE_Y: false,
    ROTATE_Z: false
  };
  let _rotations = {
    ROTATE_X: 0.0,
    ROTATE_Y: 0.0,
    ROTATE_Z: 0.0
  };
  let _looping = false;
  let _pressed = null;
  let _smoothShading = true;

  const ObjParser = window.ObjParser;
  const ELEMS = {
    canvas: document.querySelector('canvas'),

    fileinput: document.querySelector('.fileupload input'),
    filebtn: document.querySelector('.fileupload button'),
    filename: document.querySelector('.fileupload p'),

    vshader: document.getElementById('vshader'),
    fshader: document.getElementById('fshader'),

    rotateX: document.querySelector('.command-rotateX'),
    rotateY: document.querySelector('.command-rotateY'),
    rotateZ: document.querySelector('.command-rotateZ'),
    toggleProjection: document.querySelector('.command-toggleProjection'),
    toggleRotation: document.querySelector('.command-toggleRotation'),
    toggleMeshgrid: document.querySelector('.command-toggleMeshgrid'),
    toggleShading: document.querySelector('.command-toggleShading'),
  };

  function triggerRotation (which, flag) {
    _rotating[which] = flag;
  }

  function incRotation (which) {
    _rotations[which] += 2;
  }

  ELEMS.toggleShading.addEventListener('click', (ev) => {
    _smoothShading = !_smoothShading;
    obj && (obj.new = true);
  });

  ELEMS.toggleRotation.addEventListener('click', (ev) => {
    triggerRotation('ROTATE_X', true);
    triggerRotation('ROTATE_Y', true);
    triggerRotation('ROTATE_Z', true);
  });

  ELEMS.rotateX.addEventListener('mousedown', triggerRotation.bind(null, 'ROTATE_X', true));
  ELEMS.rotateY.addEventListener('mousedown', triggerRotation.bind(null, 'ROTATE_Y', true));
  ELEMS.rotateZ.addEventListener('mousedown', triggerRotation.bind(null, 'ROTATE_Z', true));

  ELEMS.rotateX.addEventListener('mouseup', triggerRotation.bind(null, 'ROTATE_X', false));
  ELEMS.rotateY.addEventListener('mouseup', triggerRotation.bind(null, 'ROTATE_Y', false));
  ELEMS.rotateZ.addEventListener('mouseup', triggerRotation.bind(null, 'ROTATE_Z', false));

  let current_file, obj;
  let VERTICES, INDICES, NORMALS;
  const gl = WebGLUtils.setupWebGL(ELEMS.canvas);

  let modelMatrix = new Matrix4();
  let normalMatrix = new Matrix4();
  let mvpMatrix = new Matrix4();
  var viewProjMatrix = new Matrix4();

  const resize = WebGLUtils.genResizeFun(ELEMS.canvas, gl, (w, h, shouldDraw) => {
    viewProjMatrix.setPerspective(30.0, w/h, 0.1, 50.0);
    shouldDraw && draw();
  });

  Shaders.initFromElems(gl, ELEMS.vshader, ELEMS.fshader);
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.007296466973886329, 'mean_word_length': 4.813616071428571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '895221', 'n_tokens_mistral': 1727, 'n_tokens_neox': 1677, 'n_words': 308}