MeshAttributeSemanticExtensions

Converts between MeshAttributeSemantic and glTF 2.0 attribute names.

Public Methods

ToGltfName

public static string ToGltfName(MeshAttributeSemantic semantic)

Returns the glTF 2.0 attribute name for semantic.

Parameters:

  • semantic (MeshAttributeSemantic)

Returns: string

TryFromGltfName

public static bool TryFromGltfName(string gltfName, MeshAttributeSemantic semantic)

Resolves a glTF 2.0 attribute name to its MeshAttributeSemantic.

Parameters:

  • gltfName (string): The glTF attribute name, for example TEXCOORD_0.
  • semantic (MeshAttributeSemantic): The resolved semantic when the name is known.

Returns: bool

  • true when the name maps to a semantic; otherwise false.

ToGltfAccessorType

public static string ToGltfAccessorType(uint componentCount)

Returns the glTF 2.0 accessor type string for a component count.

Parameters:

  • componentCount (uint): Number of components per element (1 to 4).

Returns: string