包含有关 Mesh 的单个子网格的信息。
Mesh 脚本 API 的简单用法涉及使用 Mesh.triangles、Mesh.vertices 等函数。
对于需要最大性能的高级用例,可以使用具有 Mesh.SetSubMesh、Mesh.SetIndexBufferParams 和 Mesh.SetIndexBufferData 等函数的高级 API。通过此高级 API 可以访问主要适用于原始索引缓冲区、顶点缓冲区和网格子集数据的基础网格数据结构。
单个子网格表示使用一种材质的网格部分。许多网格只使用一种材质,但有些
网格使用多种材质。子网格中的信息包括:
- indexStart - 子集的面索引数据所在的整个网格索引
缓冲区内的起点。请参阅 Mesh.SetIndexBufferParams 和 Mesh.SetIndexBufferData。
indexCount - 子网格的索引数量。例如,在具有三角形拓扑的网格中,每个三角形需要三个索引。
topology - 子网格的拓扑,通常为 MeshTopology.Triangles。
baseVertex - 为计算最终的顶点索引而向索引缓冲区中的每个值添加的偏移。
bounds - 顶点在局部空间中的包围盒。
firstVertex 和 vertexCount - 子网格的索引缓冲区引用的顶点范围。
bounds、firstVertex 和 vertexCount 值由 Mesh.SetSubMesh 自动计算,除非
传递 MeshUpdateFlags.DontRecalculateBounds 标志。
另请参阅:Mesh.SetSubMesh、Mesh.GetSubMesh、Mesh.SetIndexBufferParams、Mesh.SetIndexBufferData。
baseVertex | 为计算最终的顶点索引而向索引缓冲区中的每个值添加的偏移。 |
bounds | 顶点在局部空间中的包围盒。 |
firstVertex | 用于子网格的索引缓冲区中的第一个顶点。 |
indexCount | 子网格面数据的索引数量。 |
indexStart | 面索引数据所在的整个网格索引缓冲区内的起点。 |
topology | 子网格的面拓扑。 |
vertexCount | 子网格的索引缓冲区所使用的顶点数。 |
SubMeshDescriptor | 创建子网格描述符。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.