2
我有矩形幾何形狀(寬×高尺寸)和質地(2×寬×高),我需要顯示只有一半的是:如何隨時更改紋理UVMapping?
...
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
});
但它不起作用,偏移量保持不變。
謝謝你,它的工作原理! –