Hi, Babylon Professors! I'm changing textures of my objects by dragging and dropping some stuff inside my html document. And when I'm calling this line: scene.materials[x].diffuseTexture = new BABYLON.Texture(givenFilePath, scene); Babylon makes a GET request to the server in order to get an image. But I need to add some headers to this request and some times even try to take this picture locally. Is it any predefined functions or ways to change GET request, or to upload this picture for example
I would simply start by replacing LoadImage with this:
BABYLON.Tools.LoadImage = function(url, onload, onerror, database) {
var img = new Image();
var xhr = new XMLHttpRequest();
//replace this with the headers you want to set
//xhr.setRequestHeader("[KEY]", "[VALUE]");
xhr.open("GET", url);
xhr.responseType = "blob";
xhr.onload = function() {
img.src = window.URL.createObjectURL(xhr.response);
}
xhr.send();