import {
  RepeatWrapping,
  UVMapping,
  NearestFilter,
  LinearMipMapLinearFilter,
  TextureLoader,
  Vector2
} from 'three';

const loader = new TextureLoader();

export class TextureModule {
  static load(url) {
    return new TextureModule({url}).texture;
  }

  textures = [];

  constructor(...textures) {
    textures.forEach(({
      url,
      type = 'map',
      offset = new Vector2(0, 0),
      repeat = new Vector2(1, 1),
      wrap = RepeatWrapping,
      mapping = UVMapping
    }) => {
      const texture = loader.load(url);

      if (wrap.length > 0) {
        texture.wrapS = wrap[0];
        texture.wrapT = wrap[1];
      } else
        texture.wrapS = texture.wrapT = wrap;

      texture.mapping = mapping;

      texture.offset.copy(offset);
      texture.repeat.copy(repeat);

      texture.magFilter = NearestFilter;
      texture.minFilter = LinearMipMapLinearFilter;

      this.textures.push([type, texture]);
    });
  }

  bridge = {
    material(material, self) {
      self.textures.forEach(texture => {
        material[texture[0]] = texture[1];
      });

      return material;
    }
  }
}

import {
  RepeatWrapping,
  NearestFilter,
  LinearMipMapLinearFilter,
  TextureLoader,
  Vector2
} from 'three';

const loader = new TextureLoader();

export class TextureModule {
  static load(url) {
    return new TextureModule({url}).texture;
  }

  textures = [];

  constructor(...textures) {
    textures.forEach(({url, type = 'map', offset = new Vector2(0, 0), repeat = new Vector2(1, 1)}) => {
      const texture = loader.load(url);

      texture.wrapS = texture.wrapT = RepeatWrapping;

      texture.offset.copy(offset);
      texture.repeat.copy(repeat);

      texture.magFilter = NearestFilter;
      texture.minFilter = LinearMipMapLinearFilter;

      this.textures.push([type, texture]);
    });
  }

  bridge = {
    material(material, self) {
      self.textures.forEach(texture => {
        material[texture[0]] = texture[1];
      });

      return material;
    }
  }
}

--- 
+++ 
@@ -1,6 +1,5 @@
 import {
   RepeatWrapping,
-  UVMapping,
   NearestFilter,
   LinearMipMapLinearFilter,
   TextureLoader,
@@ -17,23 +16,10 @@
   textures = [];
 
   constructor(...textures) {
-    textures.forEach(({
-      url,
-      type = 'map',
-      offset = new Vector2(0, 0),
-      repeat = new Vector2(1, 1),
-      wrap = RepeatWrapping,
-      mapping = UVMapping
-    }) => {
+    textures.forEach(({url, type = 'map', offset = new Vector2(0, 0), repeat = new Vector2(1, 1)}) => {
       const texture = loader.load(url);
 
-      if (wrap.length > 0) {
-        texture.wrapS = wrap[0];
-        texture.wrapT = wrap[1];
-      } else
-        texture.wrapS = texture.wrapT = wrap;
-
-      texture.mapping = mapping;
+      texture.wrapS = texture.wrapT = RepeatWrapping;
 
       texture.offset.copy(offset);
       texture.repeat.copy(repeat);
Add ability to use wrap and mapping

