我正在使用libGDX开发3D,并且遇到了UV贴图进行纹理化。我有一个三角形正在绘制并对其应用纹理:
MeshPartBuilder.VertexInfo test1 = new MeshPartBuilder.VertexInfo();
MeshPartBuilder.VertexInfo test2 = new MeshPartBuilder.VertexInfo();
MeshPartBuilder.VertexInfo test3 = new MeshPartBuilder.VertexInfo();
Vector2 uv1 = new Vector2(1, 1);
Vector2 uv2 = new Vector2(1, 0);
Vector2 uv3 = new Vector2(0, 1);
meshBuilder.triangle(
test1.set(corner00.set(12, 30, 0), new Vector3(1, 0, 0), null, uv1),
test2.set(corner01.set(12, 30, 8), new Vector3(1, 0, 0), null, uv2),
test3.set(corner10.set(8, 30, 0), new Vector3(1, 0, 0), null, uv3));
一切正常。
但是现在我将左顶点稍微向下:
meshBuilder.triangle(
test1.set(corner00.set(12, 30, 0), new Vector3(1, 0, 0), null, uv1),
test2.set(corner01.set(12, 30, 8), new Vector3(1, 0, 0), null, uv2),
test3.set(corner10.set(8, 30, -2), new Vector3(1, 0, 0), null, uv3));
我不明白为什么纹理被拉伸了,为什么呢?为什么纹理不能保持相同的状态?有没有一种方法可以使顶点保持运动,但纹理保持相同的姿势?
谢谢