I've been experimenting with different solutions but haven't had any luck finding a solution online. The error I'm encountering when running my program is: XMLHttpRequest cannot load file:///C:/Users/winst/Documents/Programming%20Projects/Miner/textures/Dirt.jpg. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
The file in question is a simple picture that resembles dirt.
Below is the portion of my code causing the issue:
// Loading textures
var textureLoader = new THREE.TextureLoader();
var texture0 = textureLoader.load('textures/Dirt.jpg');
var texture1 = textureLoader.load('textures/Dirt.jpg');
var texture2 = textureLoader.load('textures/Dirt.jpg');
var texture3 = textureLoader.load('textures/Dirt.jpg');
var texture4 = textureLoader.load('textures/Dirt.jpg');
var texture5 = textureLoader.load('textures/Dirt.jpg');
var materials = [
new THREE.MeshBasicMaterial({ map: texture0 }),
new THREE.MeshBasicMaterial({ map: texture1 }),
new THREE.MeshBasicMaterial({ map: texture2 }),
new THREE.MeshBasicMaterial({ map: texture3 }),
new THREE.MeshBasicMaterial({ map: texture4 }),
new THREE.MeshBasicMaterial({ map: texture5 })
];
var material = new THREE.MeshFaceMaterial(materials);
// Combining everything together
var mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ material }));
The rest of the code worked fine when using colored cubes instead of images on the sides. I came across similar code on Stack Overflow but mine still doesn't function properly.
I would appreciate any assistance. :)