<commit_before>'use strict';

var ParticleEmitter = function(name)
{
  this.rootObj = new THREE.Object3D();

  this.events = [];
  this.particles = [];

  this.newParticleCounter = 0;
  this.totalParticleLives = 0;
};

ParticleEmitter.Particle = function()
{
  this.rootObj = new THREE.Object3D();

  this.sprite = 0;

  this.age = 0;
  this.lifetime = 1;
  this.eventIndex = 0;
  this.eventTimer = 0;

  this.position = new THREE.Vector3();
  this.gravity = new THREE.Vector3();

  this.size = new THREE.Vector2(10, 10);
  this.sizeStep = new THREE.Vector2();
  this.textureIndex = 0;
  this.textureIndexStep = 0;
  this.textureColumns = 1;
  this.textureRows = 1;
  this.color = new Color4(1, 1, 1, 1);
  this.colorStep = new Color4();
  this.velocity = new THREE.Vector3();
  this.velocityStep = new THREE.Vector3();
  this.rotation = 0;
  this.rotationStep = 0;
};

ParticleEmitter.Particle.prototype.update = function(_dt)
{
  var dt = _dt * (ZZ_TICK_PER_SEC / 1000);

  this.age += dt;
  this.eventTimer += dt;

  if (this.age >= this.lifetime) {
    return false;
  }

  this.position.add(this.velocity.clone().multiplyScalar(dt));
  this.velocity.add(this.gravity.clone().multiplyScalar(dt));
  this.color.add(this.colorStep.clone().multiplyScalar(dt));
  this.velocity.add(this.velocityStep.clone().multiplyScalar(dt));
  this.size.add(this.sizeStep.clone().multiplyScalar(dt));
  this.textureIndex += this.textureIndexStep * dt;
  this.rotation += this.rotationStep * dt;

  while (this.rotation >= 360) {
    this.rotation -= 360;
  }

  while (this.rotation < 0) {
    this.rotation += 360;
  }

  this.rootObj.position.copy(this.position);

  this.mesh.scale.x = this.size.x;
  this.mesh.scale.y = this.size.y;
  this.mesh.rotation.z = this.rotation * (Math.PI / 180);
  this.mesh.material.uniforms.vColor.value.setRGB(this.color.r, this.color.g, this.color.b);
  this.mesh.material.uniforms.vAlpha.value = this.color.a;

  if (this.alignType === ParticleSystemData.ALIGN_TYPE.AXIS_ALIGNED) {
    var euler = new THREE.Euler();<commit_msg>Fix issue with matrix determinant error when rendering particles.<commit_after>'use strict';

var ParticleEmitter = function(name)
{
  this.rootObj = new THREE.Object3D();

  this.events = [];
  this.particles = [];

  this.newParticleCounter = 0;
  this.totalParticleLives = 0;
};

ParticleEmitter.Particle = function()
{
  this.rootObj = new THREE.Object3D();

  this.sprite = 0;

  this.age = 0;
  this.lifetime = 1;
  this.eventIndex = 0;
  this.eventTimer = 0;

  this.position = new THREE.Vector3();
  this.gravity = new THREE.Vector3();

  this.size = new THREE.Vector2(10, 10);
  this.sizeStep = new THREE.Vector2();
  this.textureIndex = 0;
  this.textureIndexStep = 0;
  this.textureColumns = 1;
  this.textureRows = 1;
  this.color = new Color4(1, 1, 1, 1);
  this.colorStep = new Color4();
  this.velocity = new THREE.Vector3();
  this.velocityStep = new THREE.Vector3();
  this.rotation = 0;
  this.rotationStep = 0;
};

ParticleEmitter.Particle.prototype.update = function(_dt)
{
  var dt = _dt * (ZZ_TICK_PER_SEC / 1000);

  this.age += dt;
  this.eventTimer += dt;

  if (this.age >= this.lifetime) {
    return false;
  }

  this.position.add(this.velocity.clone().multiplyScalar(dt));
  this.velocity.add(this.gravity.clone().multiplyScalar(dt));
  this.color.add(this.colorStep.clone().multiplyScalar(dt));
  this.velocity.add(this.velocityStep.clone().multiplyScalar(dt));
  this.size.add(this.sizeStep.clone().multiplyScalar(dt));
  this.textureIndex += this.textureIndexStep * dt;
  this.rotation += this.rotationStep * dt;

  while (this.rotation >= 360) {
    this.rotation -= 360;
  }

  while (this.rotation < 0) {
    this.rotation += 360;
  }

  this.rootObj.position.copy(this.position);

  this.mesh.scale.x = this.size.x;
  this.mesh.scale.y = this.size.y;
  this.mesh.rotation.z = this.rotation * (Math.PI / 180);
  this.mesh.material.uniforms.vColor.value.setRGB(this.color.r, this.color.g, this.color.b);
  this.mesh.material.uniforms.vAlpha.value = this.color.a;

  // Prevent matrix multiplication errors by hiding
  if (this.size.x === 0 || this.size.y === 0) {
    this.mesh.visible = false;
    this.mesh.scale.set(1, 1, 1);
  } else {
    this.mesh.visible = true;
  }

  if (this.alignType === ParticleSystemData.ALIGN_TYPE.AXIS_ALIGNED) {
    var euler = new THREE.Euler();
{'fraction_non_alphanumeric': 0.15731623540187772, 'fraction_numerical': 0.023128005495763684, 'mean_word_length': 3.6027397260273974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2631233', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1548, 'n_words': 280}