
################
A3DRiComputeMesh
################

.. c:function:: A3DStatus A3DRiComputeMesh(const A3DRiRepresentationItem *pRi, const A3DMiscCascadedAttributes *pParentAttributes, A3DMeshData *pMesh, const A3DRiComputeMeshParametersData *psMeshOptionsData)

   .. rst-class:: sig-pretty-signature
   
      | :c:enum:`~A3DStatus` A3DRiComputeMesh(*const* :c:type:`~A3DRiRepresentationItem`\ * **pRi**\ , *const* :c:type:`~A3DMiscCascadedAttributes`\ * **pParentAttributes**\ , :c:struct:`~A3DMeshData`\ * **pMesh**\ , *const* :c:struct:`~A3DRiComputeMeshParametersData`\ * **psMeshOptionsData**\ )
   
   Populate an :c:struct:`~A3DMeshData` structure with mesh information extracted from the provided :c:type:`~A3DRiRepresentationItem` entity. 
   
   
      24.0
   
   
   
   This function computes the underlying mesh structure contained within the given representation item and fills in an instance of :c:struct:`~A3DMeshData`\ . If normals are missing from the representation item, they are computed using ``A3DRiComputeMesh``\ .
   
   
   Memory Management:
   ==================
   
   If successful, the ``pMesh`` structure contains heap-allocated memory for which you are responsible. To free the memory in ``pMesh``\ , call ``A3DRiComputeMesh`` with ``pRi`` set to *0*\ :
   
   
   ::
   
      A3DRiComputeMesh(0,0,&pMesh,0);
   
   
   
   Limitations:
   ============
   
   ``A3DRiComputeMesh`` computes the mesh for :c:enumerator:`~kA3DTypeRiBrepModel` and :c:enumerator:`~kA3DTypeRiPolyBrepModel` representation items only.
   
   
   
   Example:
   ========
   
   Before calling the function, ensure that the representation item contains tessellation. Use :c:func:`~A3DRiRepresentationItemComputeTessellation` to generate tessellation data if needed: 
   
   
   ::
   
      A3DMeshDatameshData;
      A3D_INITIALIZE_DATA(A3DMeshData,meshData);
      
      A3DStatusstatus=A3DRiComputeMesh(pRi,parentGraphicalContext,&meshData,0);
      
      if(status!=A3D_SUCCESS)
      {
      A3DRWParamsTessellationDatatess_params;
      A3D_INITIALIZE_DATA(A3DRWParamsTessellationData,tess_params);
      tess_params.m_eTessellationLevelOfDetail=kA3DTessLODMedium;
      A3DRiRepresentationItemComputeTessellation(pRi,&tess_params);
      
      status=A3DRiComputeMesh(pRi,parentGraphicalContext,&meshData,0);
      assert(status==A3D_SUCCESS);
      }
   
   
   **Parameters**
   
   
      **pRi**\ : The :c:type:`~A3DRiRepresentationItem` from which to compute the mesh. If nullptr, memory of the mesh is released. 
   
      **pParentAttributes**\ : The :c:type:`~A3DMiscCascadedAttributes` of the representation item's parent. 
   
      **pMesh**\ : The :c:struct:`~A3DMeshData` to store the computed mesh or release memory if pRi = nullptr. 
   
      **psMeshOptionsData**\ : Options used to compute Mesh. 0 for now, options structure for future use. 
   
   
   **Returns**
   
   
      A3D_SUCCESS if successful, otherwise an error code.
   
   




