Helpers

Types

A3DRiComputeMeshDataParameters

A3DMeshData

Functions

A3DStatus

A3DRiComputeMesh

Detailed Description

group a3d_rihelpers

High-level functions for Representation Items module.

Function Documentation

A3DStatus A3DRiComputeMesh(const A3DRiRepresentationItem *pRi, const A3DMiscCascadedAttributes *pParentAttributes, A3DMeshData *pMesh, const A3DRiComputeMeshDataParameters *psMeshOptionsData)

Populate an A3DMeshData structure with mesh information extracted from the provided A3DRiRepresentationItem entity.

This function computes the underlying mesh structure contained within the given representation item and fills in an instance of A3DMeshData. If normals are missing from the representation item, they are computed using A3DRiComputeMesh.

Version

24.0

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 kA3DTypeRiBrepModel and kA3DTypeRiPolyBrepModel representation items only.

Example:

Before calling the function, ensure that the representation item contains tessellation. Use A3DRiRepresentationItemComputeTessellation to generate tessellation data if needed:

A3DMeshData meshData;
A3D_INITIALIZE_DATA(A3DMeshData, meshData);

A3DStatus status = A3DRiComputeMesh(pRi, parentGraphicalContext, &meshData, 0);

if (status != A3D_SUCCESS)
{
    A3DRWParamsTessellationData tess_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[in] The A3DRiRepresentationItem from which to compute the mesh. If nullptr, memory of the mesh is released.

  • pParentAttributes[in] The A3DMiscCascadedAttributes of the representation item’s parent.

  • pMesh[inout] The A3DMeshData to store the computed mesh or release memory if pRi = nullptr.

  • psMeshOptionsData[in] Options used to compute Mesh. 0 for now, options structure for future use.

Return values:
  • A3D_INITIALIZE_NOT_CALLED – The library is not initialized.

  • A3D_INVALID_DATA_STRUCT_SIZE – Incorrect initialization size for pMesh.

  • A3D_INVALID_DATA_STRUCT_NULL – Null pMesh pointer.

  • A3D_INVALID_ENTITY_NULL – Null pRi pointer.

  • A3D_INVALID_ENTITY_TYPE – Unsupported type for pRi.

  • A3D_MESH_EMPTYpRi contains no coordinate data.

  • A3D_MESH_INCONSISTENT – Inconsistent tessellation information.

  • A3D_ERROR – Mesh data computation failure.

  • A3D_SUCCESS – Success.

Returns:

A3D_SUCCESS if successful, otherwise an error code.