<commit_before>define(['pex/gl/Context', 'pex/geom/Vec3', 'pex/geom/Quat', 'pex/geom/Mat4', 'pex/geom/Face3', 'pex/geom/Face4'],
function(Context, Vec3, Quat, Mat4, Face3, Face4) {
  function Mesh(geometry, material) {
    this.gl = Context.currentContext.gl;
    this.geometry = geometry;
    this.material = material;

    this.gl = Context.currentContext.gl;
    //this.primitiveType = (primitiveType !== undefined) ? primitiveType : this.gl.TRIANGLES;
    this.primitiveType = this.gl.TRIANGLES;
    this.attributes = {};
    this.usage = this.gl.STATIC_DRAW;

    this.addAttrib('position', geometry.attribs.position.data.buf, 3);
    this.addAttrib('normal', geometry.attribs.normal.data.buf, 3);
    this.addAttrib('texCoord', geometry.attribs.texCoord.data.buf, 2);

    this.position = Vec3.fromValues(0, 0, 0);
    this.rotation = Quat.create();
    this.scale = Vec3.fromValues(1, 1, 1);
    this.modelWorldMatrix = Mat4.create();
    this.modelViewMatrix = Mat4.create();
    this.rotationMatrix = Mat4.create();

    this.updateIndices(geometry);
  }

  Mesh.prototype.updateMatrices = function(camera) {
    Mat4.fromQuat(this.rotationMatrix, this.rotation);

    Mat4.identity(this.modelWorldMatrix);
    Mat4.translate(this.modelWorldMatrix, this.modelWorldMatrix, this.position);
    Mat4.mul(this.modelWorldMatrix, this.modelWorldMatrix, this.rotationMatrix);
    Mat4.scale(this.modelWorldMatrix, this.modelWorldMatrix, this.scale);

    Mat4.copy(this.modelViewMatrix, camera.getViewMatrix());
    Mat4.mul(this.modelViewMatrix, this.modelViewMatrix, this.modelWorldMatrix);
  }

  Mesh.prototype.updateIndices = function(geometry) {
    if (this.indices === undefined) {<commit_msg>Add geometry attributes only if the exist<commit_after>define(['pex/gl/Context', 'pex/geom/Vec3', 'pex/geom/Quat', 'pex/geom/Mat4', 'pex/geom/Face3', 'pex/geom/Face4'],
function(Context, Vec3, Quat, Mat4, Face3, Face4) {
  function Mesh(geometry, material) {
    this.gl = Context.currentContext.gl;
    this.geometry = geometry;
    this.material = material;

    this.gl = Context.currentContext.gl;
    //this.primitiveType = (primitiveType !== undefined) ? primitiveType : this.gl.TRIANGLES;
    this.primitiveType = this.gl.TRIANGLES;
    this.attributes = {};
    this.usage = this.gl.STATIC_DRAW;

    this.addAttrib('position', geometry.attribs.position.data.buf, 3);
    if (geometry.attribs.normal) this.addAttrib('normal', geometry.attribs.normal.data.buf, 3);
    if (geometry.attribs.texCoord) this.addAttrib('texCoord', geometry.attribs.texCoord.data.buf, 2);

    this.position = Vec3.fromValues(0, 0, 0);
    this.rotation = Quat.create();
    this.scale = Vec3.fromValues(1, 1, 1);
    this.modelWorldMatrix = Mat4.create();
    this.modelViewMatrix = Mat4.create();
    this.rotationMatrix = Mat4.create();

    this.updateIndices(geometry);
  }

  Mesh.prototype.updateMatrices = function(camera) {
    Mat4.fromQuat(this.rotationMatrix, this.rotation);

    Mat4.identity(this.modelWorldMatrix);
    Mat4.translate(this.modelWorldMatrix, this.modelWorldMatrix, this.position);
    Mat4.mul(this.modelWorldMatrix, this.modelWorldMatrix, this.rotationMatrix);
    Mat4.scale(this.modelWorldMatrix, this.modelWorldMatrix, this.scale);

    Mat4.copy(this.modelViewMatrix, camera.getViewMatrix());
    Mat4.mul(this.modelViewMatrix, this.modelViewMatrix, this.modelWorldMatrix);
  }

  Mesh.prototype.updateIndices = function(geometry) {
    if (this.indices === undefined) {
{'fraction_non_alphanumeric': 0.14596451058958215, 'fraction_numerical': 0.01659988551803091, 'mean_word_length': 4.319634703196347, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1025199', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1155, 'n_words': 176}