# MeshData

class MeshData()

  Object which represents geometry data which will be inserted into the scene at run time. For performance reasons, it is not recommended to create meshes with large amounts of data on the client side as certain optimizations are not available to geometry inserted this way.

  More information can be found [here](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/geometry/meshes.html).

Constructors

- `constructor()`

Methods

- `addFaces()`

- `addPoints()`

- `addPolyline()`

- `clear()`

- `getBackfacesEnabled()`

- `getFaceWinding()`

- `isManifold()`

- `setBackfacesEnabled()`

- `setFaceWinding()`

- `setManifold()`

## Constructors

MeshData.constructor()
  Return type

    MeshData

## Methods

### addFaces

MeshData.addFaces(vertexData[, normalData[, rgba32data[, uvs, bits]]])
  Arguments

    - vertexData (`Float32Array | [number]()`) – floating point data describing the points in space for the faces to be added to the mesh

    - normalData (`Float32Array | [number]()`) – optional normals for the corresponding vertex data points.

    - rgba32data (`[number] | Uint8Array()`) – optional colors for the corresponding vertex data points (four bytes per rbga).

    - uvs (`Float32Array | [number]()`) – optional texture parameters for the corresponding vertex data points.

    - bits (`number()`) – bitmask associated with the face.

  Adds face data to the mesh. Note that the arrays passed into this function are not copied and should remain unchanged until the mesh has been created. When adding vertex data into the mesh using this method, it is important to note that the data is interpreted as triangles in which each vertex must be explicitly enumerated.

  Return type

    void

### addPoints

MeshData.addPoints(pointData[, rgba32data, bits])
  Arguments

    - pointData (`Float32Array | [number]()`) – floating point data describing the points to be added to the mesh

    - rgba32data (`[number] | Uint8Array()`) – optional colors for the corresponding vertex data points (four bytes per rbga).

    - bits (`number()`) – bitmask associated with the point.

  Adds point data to the mesh. Note that the arrays passed into this function are not copied and should remain unchanged until the mesh has been created.

  Return type

    void

### addPolyline

MeshData.addPolyline(polylineData[, rgba32data, bits])
  Arguments

    - polylineData (`Float32Array | [number]()`) – floating point data describing the polyline to be added to the mesh

    - rgba32data (`[number] | Uint8Array()`) – optional colors for the corresponding vertex data points (four bytes per rbga).

    - bits (`number()`) – bitmask associated with the line.

  Adds polyline data to the mesh.Note that the arrays passed into this function are not copied and should remain unchanged until the mesh has been created.

  Return type

    void

### clear

MeshData.clear()

  Removes all data from the object.

  Return type

    void

### getBackfacesEnabled

MeshData.getBackfacesEnabled()

  Gets whether backfaces are enabled for this geometry

  Returns

    value indicting whether backfaces are enabled for this geometry.

  Return type

    boolean

### getFaceWinding

MeshData.getFaceWinding()

  Gets the face winding used for this mesh.

  Return type

    FaceWinding

### isManifold

MeshData.isManifold()

  Gets if the mesh is set as manifold.

  Returns

    value indicating whether or not it’s a manifold mesh.

  Return type

    boolean

### setBackfacesEnabled

MeshData.setBackfacesEnabled(backfacesEnabled)
  Arguments

    - backfacesEnabled (`boolean()`) – indicated whether backfaces should be enabled for this geometry.

  Sets whether backfaces should be enabled for this geometry. The default value is false. Setting this to true for geometry with a large amount of faces may affect performance.

  Return type

    void

### setFaceWinding

MeshData.setFaceWinding(faceWinding)
  Arguments

    - faceWinding (`FaceWinding()`) – the face winding to use for mesh geometry.

  Sets the face winding to be used for this mesh. The default value is CounterClockwise.

  Return type

    void

### setManifold

MeshData.setManifold(isManifold)
  Arguments

    - isManifold (`boolean()`) – indicated whether or not it’s a manifold mesh.

  Sets whether the mesh is a manifold one or not (if the mesh is not set as manifold, then capping won’t happen while cutting).

  Return type

    void