我有矩形几何(W x H尺寸)和纹理(2 * W x H),我只需要显示它的一半:
...
var pageGeometry = new THREE.PlaneGeometry(pageWidth, pageHeight, 1, 1);
var texture = someTexture;
pageGeometry.faceVertexUvs[0] = [];
pageGeometry.faceVertexUvs[0].push([
new THREE.Vector2(0.5, 1),
new THREE.Vector2(0.5, 0),
new THREE.Vector2(1, 0),
new THREE.Vector2(1, 1)]);
var page = new THREE.Mesh(
pageGeometry,
new THREE.MeshLambertMaterial({
color: options.background,
map: texture
})
);
它可以工作,但是一些旋转(90度)我需要改变纹理偏移:
page.geometry.faceVertexUvs[0] = [];
page.geometry.faceVertexUvs[0].push([
new THREE.Vector2(0, 1),
new THREE.Vector2(0, 0),
new THREE.Vector2(0.5, 0),
new THREE.Vector2(0.5, 1)]);
page.material = new THREE.MeshLambertMaterial({
color: options.background,
map: textureNext
});
但它不起作用,遗骸的偏移量相同。
答案 0 :(得分:4)
你试过这个: https://github.com/mrdoob/three.js/wiki/Updates
即:
geometry.uvsNeedUpdate = true;
希望这会有所帮助,但无论你的源代码中有什么可能不起作用,我认为你肯定需要在更改UV坐标后设置此更新标志。