我有矩形几何(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
});
但它不起作用,偏移量保持不变。