# PolygonalInterface

> Class

Inheritance

* [object](https://learn.microsoft.com/dotnet/api/system.object)
* [Interface](./api_interface)
* PolygonalInterface

***

Inherited Members

* [Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\))

* [Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\))

* [GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

* [GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)

* [MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

* [ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

* [ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

***

Namespace: UnityEngine.Pixyz.Polygonal

```csharp
public class PolygonalInterface : Interface
```

## Methods

### GetLastError

```csharp
public static string GetLastError()
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### ConfigureFunctionLogger

```csharp
[HandleProcessCorruptedStateExceptions]
public void ConfigureFunctionLogger(string functionName, bool enableFunction, bool enableParameters, bool enableExecutionTime)
```

Parameters

| Type                                                           | Name                | Description |
| -------------------------------------------------------------- | ------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | functionName        |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableFunction      |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableParameters    |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableExecutionTime |             |

### GetPolygonCount

Returns the number of polygon of a mesh.

```csharp
[HandleProcessCorruptedStateExceptions]
public ulong GetPolygonCount(uint mesh, bool asTriangleCount = false)
```

Parameters

| Type                                                          | Name            | Description                                                 |
| ------------------------------------------------------------- | --------------- | ----------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | mesh            | The mesh.                                                   |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | asTriangleCount | If true count the equivalent of triangles for each polygon. |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [ulong](https://learn.microsoft.com/dotnet/api/system.uint64) |             |

### ComputeMeshTopoChecksum

Compute a checksum of the mesh topology, connectivity.

```csharp
[HandleProcessCorruptedStateExceptions]
public string ComputeMeshTopoChecksum(uint mesh)
```

Parameters

| Type                                                         | Name | Description |
| ------------------------------------------------------------ | ---- | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh | The mesh.   |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### ComputeMeshVertexPositionsChecksum

Compute a checksum of the mesh vertices positions.

```csharp
[HandleProcessCorruptedStateExceptions]
public string ComputeMeshVertexPositionsChecksum(uint mesh, int precisionFloat = -1)
```

Parameters

| Type                                                         | Name           | Description                                                                                                 |
| ------------------------------------------------------------ | -------------- | ----------------------------------------------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh           | The mesh.                                                                                                   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | precisionFloat | Floating point precision \[1..24], number of significant numbers kept. -1 means no rounded will be applied. |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### ComputeUVTopoChecksum

Compute a checksum of the uvs topology, connectivity.

```csharp
[HandleProcessCorruptedStateExceptions]
public string ComputeUVTopoChecksum(uint mesh, int uvChannel)
```

Parameters

| Type                                                         | Name      | Description     |
| ------------------------------------------------------------ | --------- | --------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh      | The mesh.       |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | uvChannel | The uv channel. |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### ComputeUVVertexPositionsChecksum

Compute a checksum of the vertices positions in uv space.

```csharp
[HandleProcessCorruptedStateExceptions]
public string ComputeUVVertexPositionsChecksum(uint mesh, int uvChannel, int precisionFloat = -1)
```

Parameters

| Type                                                         | Name           | Description                                                                                                 |
| ------------------------------------------------------------ | -------------- | ----------------------------------------------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh           | The mesh.                                                                                                   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | uvChannel      | The uv channel.                                                                                             |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | precisionFloat | Floating point precision \[1..24], number of significant numbers kept. -1 means no rounded will be applied. |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### DracoDecode

Decode a mesh using draco.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint DracoDecode(ByteList buffer, int jointIndicesId = -1, int jointWeightsId = -1)
```

Parameters

| Type                                                       | Name           | Description                                            |
| ---------------------------------------------------------- | -------------- | ------------------------------------------------------ |
| [ByteList](./core_bytelist)                                | buffer         |                                                        |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | jointIndicesId | Unique ID of Generic attribute encoding joint indices. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | jointWeightsId | Unique ID of Generic attribute encoding joint weights. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### DracoEncode

Encode a mesh using draco.

```csharp
[HandleProcessCorruptedStateExceptions]
public DracoEncodeReturn DracoEncode(uint mesh, int compressionLevel = 7, int quantizationPosition = -1, int quantizationNormal = -1, int quantizationTexCoord = -1)
```

Parameters

| Type                                                         | Name                 | Description                                                             |
| ------------------------------------------------------------ | -------------------- | ----------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh                 |                                                                         |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | compressionLevel     | 0=faster but the worst compression, 10=slower but the best compression. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | quantizationPosition | Number of quantization bits used for position attributes.               |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | quantizationNormal   | Number of quantization bits used for normal attributes.                 |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | quantizationTexCoord | Number of quantization bits used for texture coordinates attributes.    |

Returns

| Type                                               | Description |
| -------------------------------------------------- | ----------- |
| [DracoEncodeReturn](./polygonal_dracoencodereturn) |             |

### CreateJointPlaceholders

Create fake joint to store in mesh definitions. Thus we can retrieve stored data from getJointPlaceholders.

```csharp
[HandleProcessCorruptedStateExceptions]
public PlaceholderJointList CreateJointPlaceholders(ULongList data, Matrix4List worldMatrices)
```

Parameters

| Type                              | Name          | Description                                                         |
| --------------------------------- | ------------- | ------------------------------------------------------------------- |
| [ULongList](./core_ulonglist)     | data          | Create as much joints as there are data, each joint store one data. |
| [Matrix4List](./geom_matrix4list) | worldMatrices | World matrix for each joints.                                       |

Returns

| Type                                                     | Description |
| -------------------------------------------------------- | ----------- |
| [PlaceholderJointList](./polygonal_placeholderjointlist) |             |

### CreateMeshFromDefinition

Create a new mesh with the given MeshDefinition.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateMeshFromDefinition(MeshDefinition meshDefinition)
```

Parameters

| Type                                         | Name           | Description      |
| -------------------------------------------- | -------------- | ---------------- |
| [MeshDefinition](./polygonal_meshdefinition) | meshDefinition | Mesh definition. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateMeshFromDefinitions

Create a new mesh from multiple MeshDefinition.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateMeshFromDefinitions(MeshDefinitionList meshDefinition)
```

Parameters

| Type                                                 | Name           | Description          |
| ---------------------------------------------------- | -------------- | -------------------- |
| [MeshDefinitionList](./polygonal_meshdefinitionlist) | meshDefinition | The MeshDefinitions. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateMeshFromText

Creates an occurrence from string.

```csharp
[HandleProcessCorruptedStateExceptions]
public CreateMeshFromTextReturn CreateMeshFromText(string text, Matrix4 matrix, string font = "ChicFont", int fontSize = 64, ColorAlpha? color = null, double heigth3D = 40)
```

Parameters

| Type                                                           | Name     | Description                |
| -------------------------------------------------------------- | -------- | -------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | text     | Text to create.            |
| [Matrix4](./geom_matrix4)                                      | matrix   | A matrix to apply on mesh. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | font     | The font to use.           |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)     | fontSize | The font size.             |
| [ColorAlpha](./core_coloralpha)                                | color    | The occurrence color.      |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | heigth3D | 3D height of text.         |

Returns

| Type                                                             | Description |
| ---------------------------------------------------------------- | ----------- |
| [CreateMeshFromTextReturn](./polygonal_createmeshfromtextreturn) |             |

### CreateMeshesFromDefinitions

Create new meshes with the given MeshDefinitions.

```csharp
[HandleProcessCorruptedStateExceptions]
public MeshList CreateMeshesFromDefinitions(MeshDefinitionList meshDefinitions)
```

Parameters

| Type                                                 | Name            | Description          |
| ---------------------------------------------------- | --------------- | -------------------- |
| [MeshDefinitionList](./polygonal_meshdefinitionlist) | meshDefinitions | The MeshDefinitions. |

Returns

| Type                             | Description |
| -------------------------------- | ----------- |
| [MeshList](./polygonal_meshlist) |             |

### GetJointPlaceholders

Get data stored in joint placeholders.

```csharp
[HandleProcessCorruptedStateExceptions]
public ULongList GetJointPlaceholders(PlaceholderJointList joints)
```

Parameters

| Type                                                     | Name   | Description                          |
| -------------------------------------------------------- | ------ | ------------------------------------ |
| [PlaceholderJointList](./polygonal_placeholderjointlist) | joints | Placeholder joints to get data from. |

Returns

| Type                          | Description |
| ----------------------------- | ----------- |
| [ULongList](./core_ulonglist) |             |

### GetMeshDefinition

Returns the mesh definition.

```csharp
[HandleProcessCorruptedStateExceptions]
public MeshDefinition GetMeshDefinition(uint mesh)
```

Parameters

| Type                                                         | Name | Description                 |
| ------------------------------------------------------------ | ---- | --------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh | The mesh to get definition. |

Returns

| Type                                         | Description |
| -------------------------------------------- | ----------- |
| [MeshDefinition](./polygonal_meshdefinition) |             |

### GetMeshDefinitions

Returns the meshes definitions.

```csharp
[HandleProcessCorruptedStateExceptions]
public MeshDefinitionList GetMeshDefinitions(MeshList meshes)
```

Parameters

| Type                             | Name   | Description                    |
| -------------------------------- | ------ | ------------------------------ |
| [MeshList](./polygonal_meshlist) | meshes | The meshes to get definitions. |

Returns

| Type                                                 | Description |
| ---------------------------------------------------- | ----------- |
| [MeshDefinitionList](./polygonal_meshdefinitionlist) |             |

### GetMeshSkinning

Returns the joints/IBMs list of a given mesh (those referenced by jointIndices).

```csharp
[HandleProcessCorruptedStateExceptions]
public GetMeshSkinningReturn GetMeshSkinning(uint mesh)
```

Parameters

| Type                                                         | Name | Description |
| ------------------------------------------------------------ | ---- | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh |             |

Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [GetMeshSkinningReturn](./polygonal_getmeshskinningreturn) |             |

### HasMeshJoints

Check if the mesh has joints.

```csharp
[HandleProcessCorruptedStateExceptions]
public bool HasMeshJoints(uint mesh)
```

Parameters

| Type                                                         | Name | Description |
| ------------------------------------------------------------ | ---- | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh | The Mesh.   |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### HasNormalizedUVs

Check if the provided mesh UV channel contains normalized texture coordinates.

```csharp
[HandleProcessCorruptedStateExceptions]
public bool HasNormalizedUVs(uint mesh, int channel)
```

Parameters

| Type                                                         | Name    | Description                                                    |
| ------------------------------------------------------------ | ------- | -------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh    | The mesh that needs to be checked.                             |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | channel | The channel to verity. If set to -1, all channels are checked. |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### HasUVs

Check if one or some UV channels are defined in the mesh.

```csharp
[HandleProcessCorruptedStateExceptions]
public bool HasUVs(uint mesh, int channel = -1)
```

Parameters

| Type                                                         | Name    | Description                             |
| ------------------------------------------------------------ | ------- | --------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh    | The mesh to check.                      |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | channel | The UV channel to check, or -1 for any. |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### SetMeshSkinning

Set/Replace the list of joints/IBMs of a given mesh (those referenced by jointIndices).

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetMeshSkinning(uint mesh, JointList joints, Matrix4List IBMs)
```

Parameters

| Type                                                         | Name   | Description            |
| ------------------------------------------------------------ | ------ | ---------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | mesh   |                        |
| [JointList](./polygonal_jointlist)                           | joints |                        |
| [Matrix4List](./geom_matrix4list)                            | IBMs   | Inverse Bind Matrices. |

### UsePointGapFillerNormal

This triangulates a set of points and normals.

```csharp
[HandleProcessCorruptedStateExceptions]
public IntList UsePointGapFillerNormal(Point3List points, Vector3List normals)
```

Parameters

| Type                              | Name    | Description                                                             |
| --------------------------------- | ------- | ----------------------------------------------------------------------- |
| [Point3List](./geom_point3list)   | points  | The set of points to triangulate.                                       |
| [Vector3List](./geom_vector3list) | normals | The normals associated to the points to triangulate. This can be empty. |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [IntList](./core_intlist) |             |
