.. role:: ts-api-decorator

########
MeshData
########

.. container:: ts-api-section

   .. js: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).



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~MeshData.constructor`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~MeshData.addFaces`
   * :js:meth:`~MeshData.addPoints`
   * :js:meth:`~MeshData.addPolyline`
   * :js:meth:`~MeshData.clear`
   * :js:meth:`~MeshData.getBackfacesEnabled`
   * :js:meth:`~MeshData.getFaceWinding`
   * :js:meth:`~MeshData.isManifold`
   * :js:meth:`~MeshData.setBackfacesEnabled`
   * :js:meth:`~MeshData.setFaceWinding`
   * :js:meth:`~MeshData.setManifold`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: MeshData.constructor()



      :rtype: MeshData



Methods
=======

.. rst-class:: ts-api-section

addFaces
--------

.. js:method:: MeshData.addFaces( vertexData[, normalData[, rgba32data[, uvs, bits]]])

   :param vertexData: floating point data describing the points in space for the faces to be added to the mesh
   :type vertexData: Float32Array | [number]
   :param normalData: :ts-api-decorator:`optional` normals for the corresponding vertex data points.
   :type normalData: Float32Array | [number]
   :param rgba32data: :ts-api-decorator:`optional` colors for the corresponding vertex data points (four bytes per rbga).
   :type rgba32data: [number] | Uint8Array
   :param uvs: :ts-api-decorator:`optional` texture parameters for the corresponding vertex data points.
   :type uvs: Float32Array | [number]
   :param bits: bitmask associated with the face.
   :type bits: number


   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.


   :rtype: void

.. rst-class:: ts-api-section

addPoints
---------

.. js:method:: MeshData.addPoints( pointData[, rgba32data, bits])

   :param pointData: floating point data describing the points to be added to the mesh
   :type pointData: Float32Array | [number]
   :param rgba32data: :ts-api-decorator:`optional` colors for the corresponding vertex data points (four bytes per rbga).
   :type rgba32data: [number] | Uint8Array
   :param bits: bitmask associated with the point.
   :type bits: number


   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.


   :rtype: void

.. rst-class:: ts-api-section

addPolyline
-----------

.. js:method:: MeshData.addPolyline( polylineData[, rgba32data, bits])

   :param polylineData: floating point data describing the polyline to be added to the mesh
   :type polylineData: Float32Array | [number]
   :param rgba32data: :ts-api-decorator:`optional` colors for the corresponding vertex data points (four bytes per rbga).
   :type rgba32data: [number] | Uint8Array
   :param bits: bitmask associated with the line.
   :type bits: number


   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.


   :rtype: void

.. rst-class:: ts-api-section

clear
-----

.. js:method:: MeshData.clear()



   Removes all data from the object.


   :rtype: void

.. rst-class:: ts-api-section

getBackfacesEnabled
-------------------

.. js:method:: MeshData.getBackfacesEnabled()



   Gets whether backfaces are enabled for this geometry

   :returns: value indicting whether backfaces are enabled for this geometry.


   :rtype: boolean

.. rst-class:: ts-api-section

getFaceWinding
--------------

.. js:method:: MeshData.getFaceWinding()



   Gets the face winding used for this mesh.


   :rtype: FaceWinding

.. rst-class:: ts-api-section

isManifold
----------

.. js:method:: MeshData.isManifold()



   Gets if the mesh is set as manifold.

   :returns: value indicating whether or not it's a manifold mesh.


   :rtype: boolean

.. rst-class:: ts-api-section

setBackfacesEnabled
-------------------

.. js:method:: MeshData.setBackfacesEnabled( backfacesEnabled)

   :param backfacesEnabled: indicated whether backfaces should be enabled for this geometry.
   :type backfacesEnabled: boolean


   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.


   :rtype: void

.. rst-class:: ts-api-section

setFaceWinding
--------------

.. js:method:: MeshData.setFaceWinding( faceWinding)

   :param faceWinding: the face winding to use for mesh geometry.
   :type faceWinding: FaceWinding


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


   :rtype: void

.. rst-class:: ts-api-section

setManifold
-----------

.. js:method:: MeshData.setManifold( isManifold)

   :param isManifold: indicated whether or not it's a manifold mesh.
   :type isManifold: boolean


   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).


   :rtype: void

