簡體   English   中英

圖像不會在相機場景中刷新

[英]Image will not refresh in a camera scene

圖像不會在場景中刷新。 在Chrome瀏覽器中的客戶端上使用Javascript,Three和CSS3DRenderer。 我通過THREE.Object3D將圖像嵌入場景中,並且在服務器上更新圖像時,該圖像不會在場景中更新。 我確實使用了緩存破壞技術,並向我自己證明瀏覽器緩存正在更新。 綜上所述:

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);

圖像顯示良好。 然后,使用相同的緩存清除技術在服務器上對其進行更新,並且場景中沒有任何變化。 我嘗試使用各種語句來更新場景,例如:

scene.remove(x);
scene.add(x);
camera.updateProjectionMatrix(); // didn't do anything I noticed
renderer.render(scene, camera);  // 

任何線索都將有所幫助,謝謝

確實做到了,但是three.js每隔幾毫秒會自動計算對象矩陣一致的對象大小,位置和其他一些參數,然后覆蓋您設置的矩陣。 如果要設置矩陣,則必須將對象矩陣自動計算設置為false。

請參閱此答案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM