Version: 2019.3
LanguageEnglish
  • C#

SubMeshDescriptor

struct in UnityEngine.Rendering

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Contains information about a single sub-mesh of a Mesh.

Simple usage of Mesh scripting API involves using functions like Mesh.triangles, Mesh.vertices and so on.

For advanced use cases that require maximum performance, you can use the advanced API, which has functions like Mesh.SetSubMesh, Mesh.SetIndexBufferParams, and Mesh.SetIndexBufferData. This advanced API gives access to the underlying mesh data structures that primarily work on raw index buffers, vertex buffers and mesh subset data.

A single sub-mesh represents part of the Mesh that is using one material. Many Meshes use just one material, but some might use more. Information in a sub-mesh is composed of:
- indexStart - starting point inside the whole Mesh index buffer where the face index data of this subset is found. See Mesh.SetIndexBufferParams and Mesh.SetIndexBufferData.
- indexCount - index count for this sub-mesh. For example, in meshes with triangle topology, each triangle needs three indices.
- topology - topology of this sub-mesh, most often MeshTopology.Triangles.
- baseVertex - offset that is added to each value in the index buffer, to compute the final vertex index.
- bounds - bounding box of vertices in local space.
- firstVertex and vertexCount - range of vertices that are referenced by the index buffer of this sub-mesh.

The bounds, firstVertex and vertexCount values are calculated automatically by Mesh.SetSubMesh, unless MeshUpdateFlags.DontRecalculateBounds flag is passed.

See Also: Mesh.SetSubMesh, Mesh.GetSubMesh, Mesh.SetIndexBufferParams, Mesh.SetIndexBufferData.

Properties

baseVertexOffset that is added to each value in the index buffer, to compute the final vertex index.
boundsBounding box of vertices in local space.
firstVertexFirst vertex in the index buffer for this sub-mesh.
indexCountIndex count for this sub-mesh face data.
indexStartStarting point inside the whole Mesh index buffer where the face index data is found.
topologyFace topology of this sub-mesh.
vertexCountNumber of vertices used by the index buffer of this sub-mesh.

Constructors

SubMeshDescriptorCreate a submesh descriptor.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961