使用以下代码,我想设置矩形的纹理,但问题是纹理图像不会在整个矩形上重复:
var penGeometry = new THREE.CubeGeometry(length, 15, 120);
var wallTexture = new THREE.ImageUtils.loadTexture('../../3D/brick2.jpg');
wallTexture.wrapS = wallTexture.wrapT = THREE.MirroredRepeatWrapping;
wallTexture.repeat.set(50, 1);
var wallMaterial = new THREE.MeshBasicMaterial({ map: wallTexture });
var line = new THREE.Mesh(penGeometry, wallMaterial);
line.position.x = PenArray.lastPosition.x + (PenArray.currentPosition.x - PenArray.lastPosition.x) / 2;
line.position.y = PenArray.lastPosition.y + (PenArray.currentPosition.y - PenArray.lastPosition.y) / 2;
line.position.z = PenArray.lastPosition.z + 60;
line.rotation.z = angle;
纹理图像为http://wysnan.com/NightClubBooth/brick1.jpg 结果是http://wysnan.com/NightClubBooth/brick2.jpg
只有一块纹理才能正确渲染,但不是所有的矩形,为什么? 以及如何使用此纹理图像渲染所有矩形?
答案 0 :(得分:2)
对于重复包装,纹理的尺寸必须是2的幂(POT)。
例如(512 x 512)或(512 x 256)。
three.js r.58