A utility for loading texture in ThreeJS. Will upload to GPU as soon as the texture is loaded, ensuring that it won't cause jank later in your application.
Example:
const loadTexture = require('./loadTexture');
// Returns a THREE.Texture object
const texture = loadTexture('foo.jpg', {
renderer: threeJSRenderer,
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
generateMipmaps: false
}, (err, tex) => {
if (err) console.error('Could not load texture...');
else console.log('Loaded texture!', tex.image.width, tex.image.height);
});