Image will not refresh in a scene.
Using Javascript, Three and CSS3DRenderer on the client within chrome.
I have an image embedded in a scene via a THREE.Object3D and when the image is updated on the server, the image will not update in the scene. I do use a cache breaking technique and proved to myself that the browser cache was being updated.
In summary:
var camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000);
var scene = new THREE.Scene();
var renderer = new THREE.CSS3DRenderer();
var controls = new THREE.TrackballControls(camera, renderer.domElement);
var element = document.createElement('div');
var img = document.createElement('img');
img.src = images[i].src+'?t='+new Date().getTime(); // cache busting technique
element.appendChild(img);
var object = new THREE.CSS3DObject(element);
scene.add(object);
The image is displayed just fine.
It is then updated on the server with the same cache busting technique and nothing changes in the scene.
I’ve tried to update the scene with a variety of statements like:
scene.remove(x);
scene.add(x);
camera.updateProjectionMatrix(); // didn't do anything I noticed
renderer.render(scene, camera); //
Any clues would be helpful
Thanks
Copyright Notice:Content Author:「Paul」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40901239/image-will-not-refresh-in-a-camera-scene