Is there a way to override TextureLoader's default Texture properties?

Textures by default initiate with wrapS and wrapT set to THREE.ClampToEdgeWrapping. Is there an easy way to override these defaults for all loaded textures so they’re all set to RepeatWrapping without manually updating each one? I’m loading several textures per material with this convenient short-hand where TextureLoader.load() returns the desired texture:

uNormalMap: { value: texLoader.load("denim-normals.png") },
uDiffuseMap: { value: texLoader.load("denim-diffuse.png") },
uAlphaMap: { value: texLoader.load("denim-alpha.png") },

However, if I have to set each wrapping value with
texture.wrapS = texture.wrapT = THREE.RepeatWrapping
… then the shorthand is no longer possible. Is there a way to override these defaults? I know Loader has .setPath() to avoid repetition, so I was wondering if there was something similar like .setDefaults() or something like that.

As an option, write a function for onLoad and pass it as the second parameter in .load(): Edit fiddle - JSFiddle - Code Playground


You could just as easily write a wrapper function for the loader, as well, which is usually how I handle this issue my projects:

function loadTextureWithDefaults( url ) {

  return new TextureLoader().load( texture => {

    // set texture defaults

  } );


const material = new MeshStandardMaterial( {

  map: loadTextureWithDefaults( url );

} );

These are both very good suggestions. Thank you!