自定义网格UV,从平面几何学习

时间:2014-03-16 00:07:06

标签: three.js uv-mapping

您好,并提前感谢,

我正在尝试理解UV - 我创建了PlaneGeometry,但我无法使UV工作。
链接到我的尝试:
https://student.sps-prosek.cz/~eisead11it/web/WebGL/4th%20project/
在我的页面上,我创建了一个按钮并测试纹理,因此您可以自己查看错误 为简单起见,我尝试制作的几何图形命名为,平面名为平面

var Empty = new THREE.Geometry();
    Empty.vertices.push(
        new THREE.Vector3(-0.5,-0.5,-0.5),new THREE.Vector3(0.5,-0.5,-0.5),
        new THREE.Vector3(-0.5,-0.5,0.5),new THREE.Vector3(0.5,-0.5,0.5)
    );

    Empty.faces.push(new THREE.Face3(0,2,1));
    Empty.faces.push(new THREE.Face3(3,1,2));

    Empty.computeFaceNormals();
    Empty.faceVertexUvs[0]=[];
    Empty.faceVertexUvs[0].push([
        new THREE.Vector2( 0, 1 ),
        new THREE.Vector2( 0, 0 ),
        new THREE.Vector2( 1, 1 ),
    ]);
    Empty.faces[0].materialIndex = 0;
    Empty.faceVertexUvs[0].push([
        new THREE.Vector2( 0, 0 ),
        new THREE.Vector2( 1, 0 ),
        new THREE.Vector2( 1, 1 ),
    ]);
    Empty.faces[1].materialIndex = 0;
    Empty.name="Empty";

0 个答案:

没有答案