2

我有矩形几何(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
    });

但它不起作用,偏移量保持不变。

4

1 回答 1

4

你试过这个: https ://github.com/mrdoob/three.js/wiki/Updates

即: geometry.uvsNeedUpdate = true;

希望这会有所帮助,但无论在您的源代码中可能不起作用,我认为您肯定需要在更改 UV 坐标后设置此更新标志。

于 2013-07-19T08:25:05.657 回答