程序网格: 分解立方体
https://ilkinulas.github.io/development/unity/2016/04/30/cube-mesh-in-unity3d.html
https://www.youtube.com/watch?v=bnmr_At2R0s
给定一个点,围绕点生成一个正方体。
规定顶点顺序
可以按自己喜好来,按视频中则是 北Z/东X/上Y
const FVector BlockVertexData[8] = {
FVector(I100, I100, I100), // UE中1为1cm,unity为1m
FVector(I100,I0,I100),
FVector(I100,I0,I0),
FVector(I100,I100,I0),
FVector(I0,I0,I100),
FVector(I0,I100,I100),
FVector(I0,I100,I0),
FVector(I0,I0,I0)
};
1个四边面=2个三角面
三角面
顺时针绘制+逆时针绘制,面的法向量就一致
UV坐标
优化
- 相邻面不绘制
- 与空气接触时才绘制面

浙公网安备 33010602011771号