问题描述
目前我正在创建一个像这样的立方体网格:
//bottom vertices of cube
positions.push([ 0.0,0.0,0.0 ]);
uvs.push([ 0.0,0.0 ]);
positions.push([ 1.0,1.0 ]);
positions.push([ 1.0,1.0 ]);
uvs.push([ 1.0,1.0 ]);
positions.push([ 0.0,0.0 ]);
//upper vertices of cube
positions.push([ 0.0,1.0,0.0 ]);
uvs.push([ 1.0,0.0 ]);
positions.push([ 0.0,1.0 ]);
(我使用 16x16 像素大的纹理)
但我很难映射这些 uv 位置,因为工作的最大边数是 4。 如果每边有 4 个顶点(总共 24 个),我会知道该怎么做,但由于性能原因,我不想这样做。
有没有办法在每个立方体只有 8 个顶点的情况下做到这一点?
解决方法
-
最小的立方体有六个面
-
每边有两个三角形
-
一个最小立方体将有十二个三角
-
不要,重复不要费心尝试分享顶点。如果出于某种原因您想这样做,请稍后再做。
-
只需确保每对 tris(一个正方形)具有正确的 UV