2015-05-11 127 views
2

顯示下一張全景圖片的最佳做法是什麼? (更改圖片) 是否這樣?Three.js canvas:卸載/加載紋理下一張全景圖片

事件點擊按鈕 - >

var materials = [ 

       loadTexture('PANO_NEXT0001.jpg'), // right 
       loadTexture('PANO_NEXT0003.jpg'), // left 
       loadTexture('PANO_NEXT0004.jpg'), // top 
       loadTexture('PANO_NEXT0005.jpg'), // bottom 
       loadTexture('PANO_NEXT0000.jpg'), // back 
       loadTexture('PANO_NEXT0002.jpg') // front 

      ]; 
scene.remove(scene.children[0]); 
mesh = new THREE.Mesh(new THREE.BoxGeometry(300, 300, 300, 7, 7, 7), new THREE.MeshFaceMaterial(materials)); 
mesh.scale.x = - 1; 
scene.add(mesh); 

回答

0

嘛,T認爲這將是改變盒體幾何形狀的material.Like:

var z=new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture('...jpg',THREE.UVMaping,function(){ 
      mesh.material.materials[i]=z; 
     }) 

i是6 materials.Have爲一個循環的索引6面的材料。