<commit_before>import THREE from 'three';

import Group from './group';
import Material from '../material';
import M2 from '../m2';
import WorkerPool from '../worker/pool';

class WMO extends THREE.Group {

  static cache = {};

  constructor(path, data) {
    super();

    this.path = path;
    this.data = data;

    const textures = this.data.MOTX.filenames;
    const mats = this.data.MOMT.materials.map(function(materialData) {
      const material = new Material();
      material.texture = textures[materialData.textures[0].offset];
      return material;
    });

    this.materials = new THREE.MeshFaceMaterial(mats);

    for (let i = 0; i < data.MOHD.groupCount; ++i) {
      Group.loadWithID(path, i).then((group) => {
        group.material = this.materials;
        this.add(group);
      });
    }
  }

  set doodadSet(doodadSet) {
    const set = this.data.MODS.sets[doodadSet];
    const { startIndex: start, doodadCount: count  } = set;

    const doodads = this.data.MODD.doodads.slice(start, start + count);
    this.renderDoodads(doodads);
  }
<commit_msg>Added transparent blending to materials in WMOs.<commit_after>import THREE from 'three';

import Group from './group';
import Material from '../material';
import M2 from '../m2';
import WorkerPool from '../worker/pool';

class WMO extends THREE.Group {

  static cache = {};

  constructor(path, data) {
    super();

    this.path = path;
    this.data = data;

    const textures = this.data.MOTX.filenames;
    const mats = this.data.MOMT.materials.map(function(materialData) {
      const material = new Material();

      material.texture = textures[materialData.textures[0].offset];

      // Transparent blending
      if (materialData.blendMode === 1) {
        material.transparent = true;
        material.alphaTest = 0.5;
        material.side = THREE.DoubleSide;
      }

      return material;
    });

    this.materials = new THREE.MeshFaceMaterial(mats);

    for (let i = 0; i < data.MOHD.groupCount; ++i) {
      Group.loadWithID(path, i).then((group) => {
        group.material = this.materials;
        this.add(group);
      });
    }
  }

  set doodadSet(doodadSet) {
    const set = this.data.MODS.sets[doodadSet];
    const { startIndex: start, doodadCount: count  } = set;

    const doodads = this.data.MODD.doodads.slice(start, start + count);
    this.renderDoodads(doodads);
  }

{'fraction_non_alphanumeric': 0.13741097612065353, 'fraction_numerical': 0.004608294930875576, 'mean_word_length': 2.8578352180936997, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1659054', 'n_tokens_mistral': 801, 'n_tokens_neox': 760, 'n_words': 175}