Three.js立方体不同的纹理

时间:2016-09-06 07:33:30

标签: three.js

我在立方体上有不同纹理的问题。使用以下代码只需要1个纹理...

var texture = new THREE.TextureLoader();

var texture1 = texture.load('texture1.jpg');
var texture2 = texture.load('texture2.jpg');
var texture3 = texture.load('texture3.jpg');
var texture4 = texture.load('texture4.jpg');
var texture5 = texture.load('texture5.jpg');
var texture6 = texture.load('texture6.jpg');
var geometry = new THREE.BoxBufferGeometry(height,width,length);

var material = new THREE.MeshBasicMaterial( { map: texture1, 
                    map: texture2,map: texture3,map: texture4,map: texture5,
                    map: texture6 } );

mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

1 个答案:

答案 0 :(得分:0)

试试这个:

% Variab
line{1} = 0;
% Open files
fid = fopen(('D:\Dokumente\Studium\8. Semester\BA\Vali mit einzelenne punkten\alle.txt'), 'rt');
% Read Data
for i = 1:80
    j = 1;
    line = fgets(fid);
    line = textscan(line,'%f %f');
    while line{1} ~= '.'
        digNum{i}(j) = line{1};
        gewicht{i}(j) = line{2};
        line = fgets(fid);
        line = textscan(line,'%f %f');
        j = j + 1;
    end
end