# ArMesh

Represents a polygon mesh describing geometry.

Obtained by `https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_acquiremesh`.

## Summary

| ### Typedefs ||
|---|---|
| `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh` | typedef `struct ArMesh_` A triangulated mesh representing a surface reconstruction of the scene. |

| ### Functions ||
|---|---|
| `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlist(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-mesh#armesh *mesh, const uint32_t **out_indices)` | `void` Retrieves the triangle data for this mesh in an array of length `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlistsize`. |
| `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlistsize(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-mesh#armesh *mesh, int32_t *out_num_indices)` | `void` Retrieves the number of triangle indices (represented by `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlist`) in this mesh. |
| `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getvertexlist(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-mesh#armesh *mesh, const float **out_vertex_positions_xyz)` | `void` Retrieves the vertex coordinate data for this mesh. |
| `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getvertexlistsize(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-mesh#armesh *mesh, int32_t *out_num_vertices)` | `void` Retrieves the number of vertices in this mesh. |
| `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_release(https://developers.google.com/ar/reference/c/group/ar-mesh#armesh *mesh)` | `void` Releases a reference to the Mesh. |

## Typedefs

### ArMesh

```
struct ArMesh_ ArMesh
```
A triangulated mesh representing a surface reconstruction of the scene.

([reference type, large data](https://developers.google.com/ar/reference/c/group/concepts#object-ownership)).


- Release with: `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_release`

<br />

## Functions

### ArMesh_getIndexList

```
void ArMesh_getIndexList(
  const ArSession *session,
  const ArMesh *mesh,
  const uint32_t **out_indices
)
```
Retrieves the triangle data for this mesh in an array of length `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlistsize`.

Each face is a triplet of indices into the vertices array. The indices should always be used as a triangle list, with three indices per triangle. The result can be passed as the "indices" parameter to `glDrawElements` or copied into a buffer bound via `vkCmdBindIndexBuffer`.


Details Parameters `session` The ARCore session. `mesh` The mesh object to query. `out_indices` Where to store the concatenated indices of mesh vertices that correspond to each face. This length is `out_num_indices` from `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlistsize`.

### ArMesh_getIndexListSize

```
void ArMesh_getIndexListSize(
  const ArSession *session,
  const ArMesh *mesh,
  int32_t *out_num_indices
)
```
Retrieves the number of triangle indices (represented by `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getindexlist`) in this mesh.

The indices should always be used as a triangle list, with three indices per triangle. The result can be passed as the `indices` parameter to [`glDrawElements`](https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glDrawElements.xhtml) or copied into a buffer bound via [`vkCmdDrawIndexed`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawIndexed.html).


Details Parameters `session` The ARCore session. `mesh` The mesh object to query. `out_num_indices` The number of indices in this mesh. This will always be a multiple of 3.

### ArMesh_getVertexList

```
void ArMesh_getVertexList(
  const ArSession *session,
  const ArMesh *mesh,
  const float **out_vertex_positions_xyz
)
```
Retrieves the vertex coordinate data for this mesh.

Each vertex is three `float` values, stored in XYZ order. The total number of `float` values in `out_vertex_positions_xyz` is 3 \* `https://developers.google.com/ar/reference/c/group/ar-mesh#armesh_getvertexlistsize`.

The array returned in `out_vertex_positions_xyz` will only remain valid as long as `mesh` is valid.


Details Parameters `session` The ARCore session. `mesh` The mesh object to query. `out_vertex_positions_xyz` Where to store the vertex positions positions.

### ArMesh_getVertexListSize

```
void ArMesh_getVertexListSize(
  const ArSession *session,
  const ArMesh *mesh,
  int32_t *out_num_vertices
)
```
Retrieves the number of vertices in this mesh.


Details Parameters `session` The ARCore session. `mesh` The mesh object to query. `out_num_vertices` The number of vertices in this mesh.

### ArMesh_release

```
void ArMesh_release(
  ArMesh *mesh
)
```
Releases a reference to the Mesh.

This must match a call to `https://developers.google.com/ar/reference/c/group/ar-streetscape-geometry#arstreetscapegeometry_acquiremesh`.

This function may safely be called with `NULL` - it will do nothing.