# MeshFeatures

class in `3d-tiles-renderer/three/plugins`

```js
import { MeshFeatures } from '3d-tiles-renderer/three/plugins';
```

Provides access to `EXT_mesh_features` feature ID data for a single mesh primitive.
Instances are created by `GLTFMeshFeaturesExtension` and attached to
`mesh.userData.meshFeatures`. Use `getFeatures()` or `getFeaturesAsync()` to read
feature IDs at a point on the mesh surface.

## Constructor

```js
new MeshFeatures( geometry: BufferGeometry, textures: Array<Texture>, data: Object )
```

- `geometry`, `BufferGeometry`: The primitive's buffer geometry.
- `textures`, `Array<Texture>`: All GLTF textures (indexed by feature texture index).
- `data`, `Object`: The raw `EXT_mesh_features` extension object for this primitive.

## Methods

### .getTextures

```js
.getTextures(  ): Array<Texture>
```

Returns an indexed list of all textures used by features in the extension.

### .getFeatureInfo

```js
.getFeatureInfo(  ): Array<FeatureInfo>
```

Returns the feature ID info for each feature set defined on this primitive.

### .getFeaturesAsync

```js
.getFeaturesAsync( triangle: number, barycoord: Vector3 ): Promise<Array<(number|null)>>
```

Performs the same function as `getFeatures` but reads texture data asynchronously.

- `triangle`, `number`: Triangle index from a raycast hit.
- `barycoord`, `Vector3`: Barycentric coordinate of the hit point.

### .getFeatures

```js
.getFeatures( triangle: number, barycoord: Vector3 ): Array<(number|null)>
```

Returns the list of feature IDs at the given point on the mesh. Takes the triangle
index from a raycast result and a barycentric coordinate. Results are indexed in the
same order as the feature info returned by `getFeatureInfo()`.

- `triangle`, `number`: Triangle index from a raycast hit.
- `barycoord`, `Vector3`: Barycentric coordinate of the hit point.

### .dispose

```js
.dispose(  )
```

Disposes all textures used by this instance.
