我试图使用WebGL为Three.js中的多维数据集提供多个面。我确定关键在于
var geometry = new THREE.CubeGeometry( 80, 80, 80, 4, 4, 4, materials, true,true,false,true,true,true);
但我不明白如何使用“sides”变量。 这是我的演示:
答案 0 :(得分:4)
比我想象的要容易!
var materials = [
new THREE.MeshLambertMaterial( { ambient: 0xffffff, map: THREE.ImageUtils.loadTexture( '1.png' ) } ),
new THREE.MeshLambertMaterial( { ambient: 0xffffff, map: THREE.ImageUtils.loadTexture( '2.png' ) } ),
new THREE.MeshLambertMaterial( { ambient: 0xffffff, map: THREE.ImageUtils.loadTexture( '3.png' ) } ),
new THREE.MeshLambertMaterial( { ambient: 0xffffff, map: THREE.ImageUtils.loadTexture( '4.png' ) } ),
new THREE.MeshLambertMaterial( { ambient: 0xffffff, map: THREE.ImageUtils.loadTexture( '5.png' ) } ),
new THREE.MeshLambertMaterial( { ambient: 0xffffff, map: THREE.ImageUtils.loadTexture( '6.png' ) } )
];
var geometry = new THREE.CubeGeometry( 80, 80, 80, 3, 3, 3, materials);
cube = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial());