Three.js canvas:卸载/加载纹理下一张全景图像

时间:2023-01-11 19:36:12

what is the best practice for display next panorama ? (change images) like this ?

显示下一个全景图的最佳做法是什么? (改变图像)像这样?

Event click button ->

事件单击按钮 - >

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

1 个解决方案

#1


Well,t think it would be change box geometry's material.Like :

好吧,我认为这将是改变盒子几何的材料。就像:

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

The i is the index of 6 materials.Have a loop for 6 faces's material.

i是6种材质的指数。有6个面材料的循环。

#1


Well,t think it would be change box geometry's material.Like :

好吧,我认为这将是改变盒子几何的材料。就像:

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

The i is the index of 6 materials.Have a loop for 6 faces's material.

i是6种材质的指数。有6个面材料的循环。