# IRfMeshSet Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | Attach ([in] IRdMesh *pMesh)
HRESULT | Detach (void)
HRESULT | GetMesh ([out, retval] IRdMesh **ppMesh)
HRESULT | GetVertexNormals (IRdVertexNormalsStream **ppStream)
HRESULT | RecalculateNormals (void)
HRESULT | ApplyPlanarUVMapping ([in] IRdMatrixf *pTransf)
HRESULT | ApplyCylindricalUVMapping ([in] IRdMatrixf *pTransf)
HRESULT | ApplySphericalUVMapping ([in] IRdMatrixf *pTransf)
HRESULT | GetFacesUnities ([out, retval] IRdFaceUnityStream **ppOutStream)
HRESULT | GetSuperfacesUnities ([out, retval] IRdSuperfaceUnityStream **ppOutStream)
HRESULT | GetTrianglesNeighbors (IRdTriangleNeighboursStream **ppNeighbors)
HRESULT | CreateTriangleEdgesStream ()
HRESULT | CreateFaceNormals ()
HRESULT | CreateAutofacetFaceNormals (RtFloat angle)
HRESULT | GetVertexTopology (IRdVertexTopologyInfo **ppInfoStream, IRdVertexTopologyData **ppDataStream)
HRESULT | RebuildEdgeStream ()
HRESULT | TopologySortTriangles ()
HRESULT | GetMeshRayIntersection ([in] RtPoint *pPos,[in] RtVector3f *pRay,[out] RtUlong *pdwTriangle,[out] RtPoint *pptBarycentric,[out] RtPoint *pptPosition,[out] RtVector3f *pptNormal)
HRESULT | CreateVertexNormals ()
HRESULT | CreateGeometryLookupStreams ()
HRESULT | CreateGeometryIdentificationTable (IRdGeometryIdentificationTableStream **ppTable)
HRESULT | ContainsMeshObj (IRsNode *pNode)
HRESULT | GetEdgeNeighbors ([out, retval] IRdEdgeNeighborsStream **ppNeighbors)

## Detailed Description

Interface defines helper functions for various operations on meshes.

## Member Function Documentation

HRESULT IRfMeshSet::Attach | ( | [in] IRdMesh * | pMesh | ) |

Attach mesh for changing.

Parameters:

  | pMesh | [in] Mesh to be changed.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::Detach | ( | void |  | ) |

Detach attached mesh.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetMesh | ( | [out, retval] IRdMesh ** | ppMesh | ) |

Return attached mesh.

Returns:
  ppMesh [out,retval] returned mesh.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetVertexNormals | ( | IRdVertexNormalsStream ** | ppStream | ) |

Attach stream with calculated normals for vertices:

Remarks:
  Requires:
  - STREAMID_VERTEXES_COORDINATES stream.
  - STREAMID_TRIANGLES_INDICES stream.

  Creates:

  - Vertex normals stream.

Returns:
  ppStream [out,retval] Returned vertex normals stream.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::RecalculateNormals | ( | void |  | ) |

Attach Recalculate face normals.

- Call after modification of vertex buffers.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::ApplyPlanarUVMapping | ( | [in] IRdMatrixf * | pTransf | ) |

Apply planar mapping to mesh:

Remarks:
  Requires:
  - STREAMID_VERTEXES_COORDINATES stream.
  - STREAMID_TRIANGLES_INDICES stream.

  Creates:

  - STREAMID_UVCOORDS_COORDINATES_1 stream.
  - STREAMID_TRIANGLES_UVS_1 streams.

Parameters:

  | pTransf | [in] Transformation matrix that will be applied to mesh.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::ApplyCylindricalUVMapping | ( | [in] IRdMatrixf * | pTransf | ) |

Apply Cylindrical mapping to mesh:

Remarks:
  Requires:
  - STREAMID_VERTEXES_COORDINATES stream.
  - STREAMID_TRIANGLES_INDICES stream.

  Creates:

  - STREAMID_UVCOORDS_COORDINATES_1 stream.
  - STREAMID_TRIANGLES_UVS_1 stream.

Parameters:

  | pTransf | [in] Transformation matrix that will be applied to mesh.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::ApplySphericalUVMapping | ( | [in] IRdMatrixf * | pTransf | ) |

Apply spherical mapping to mesh:

Remarks:
  Requires:
  - STREAMID_VERTEXES_COORDINATES stream.
  - STREAMID_TRIANGLES_INDICES stream.

  Creates:

  - STREAMID_UVCOORDS_COORDINATES_1 stream.
  - STREAMID_TRIANGLES_UVS_1 stream.

Parameters:

  | pTransf | [in] Transformation matrix that will be applied to mesh.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetFacesUnities | ( | [out, retval] IRdFaceUnityStream ** | ppOutStream | ) |

Create face unities stream that for each triangle specifies face index.

Returns:
  ppOutStream [out,retval] Returned stream.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetSuperfacesUnities | ( | [out, retval] IRdSuperfaceUnityStream ** | ppOutStream | ) |

Create super face unities stream:

Remarks:
  Face boundaries are defined by:
  - Edge transform stream.
  - Edge flags stream.
  - Each triangle is specified as a superface index.

Returns:
  ppOutStream [out,retval] Returned stream.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetTrianglesNeighbors | ( | IRdTriangleNeighboursStream ** | ppNeighbors | ) |

Creates stream containing three neighbours of each triangle:

- Each neighbour is represented as index of triangle.
- Index equal to -1 if there is no neighbour on appropriate edge.

Remarks:
  Requires:
  - STREAMID_VERTEXES_COORDINATES stream.
  - STREAMID_TRIANGLES_INDICES stream.

  Returns:

  - STREAMID_TRIANGLES_TRIANGLENEIGHS stream.

Returns:
  ppNeighbors [out,retval] Returned stream.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::CreateTriangleEdgesStream | ( |  | ) |

Creates triangle edges stream from face unities and triangle neighbors streams.

Remarks:
  Requires:
  - STREAMID_TRIANGLES_INDICES stream.

  Creates:

  - STREAMID_TRIANGLES_FACEUNITIES stream.
  - STREAMID_TRIANGLES_TRIANGLENEIGHS stream.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::CreateFaceNormals | ( |  | ) |

Creates face normals stream.

Remarks:
  Requires:
  - STREAMID_TRIANGLES_FACEEDGES stream.

  Creates:

  - Triangle normal indices stream.
  - Custom normals stream.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::CreateAutofacetFaceNormals | ( | RtFloat | angle | ) |

Creates face normals streams for autofacet smoothing.

Remarks:
  Requires STREAMID_TRIANGLES_FACEEDGES stream.

  Creates:

  - Triangle normal indices stream.
  - Custom normals stream.

Parameters:

  | angle | [in] Smoothing angle in radians.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetVertexTopology | ( | IRdVertexTopologyInfo ** | ppInfoStream,
|  | IRdVertexTopologyData ** | ppDataStream |
| ) |  |  |

Create streams with vertex topology information.

- For each vertex, adjacent triangles are listed.

Parameters:

  | ppInfoStream | [out] Returns read only vertex stream that specified index and count into data stream for each vertex.
  | ppDataStream | [out] Returns read only stream with lists of triangles.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::RebuildEdgeStream | ( |  | ) |

Rebuild edge flags stream from faces streams.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::TopologySortTriangles | ( |  | ) |

Topologicaly sort triangles to optimize caching coherency.

- Sort groups topologicaly near triangles together:
- Improves rendering performance together with using triangle timestamping.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetMeshRayIntersection | ( | [in] RtPoint * | pPos,
|  | [in] RtVector3f * | pRay,
|  | [out] RtUlong * | pdwTriangle,
|  | [out] RtPoint * | pptBarycentric,
|  | [out] RtPoint * | pptPosition,
|  | [out] RtVector3f * | pptNormal |
| ) |  |  |

Get intersection of mesh and ray.

Parameters:

  | pPos | [in] Supplied Ray origin in mesh space.
  | pRay | [in] Supplied Ray direction in mesh space.
  | pdwTriangle | [out] Pointer to be filled with intersected triangle index.
  | pptBarycentric | [out] Quassy-barycentric coordinates of intersected triangle: x,y contain barycentric parts for i,j vertices. z contains intersection depth.
  | pptPosition | [out] Mesh space position of intersected point.
  | pptNormal | [out] Mesh space normal of intersected point.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::CreateVertexNormals | ( |  | ) |

Creates smooth vertex normals streams by creating triangle normal indices and custom normals stream.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::CreateGeometryLookupStreams | ( |  | ) |

Create default geometry identification streams.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::CreateGeometryIdentificationTable | ( | IRdGeometryIdentificationTableStream ** | ppTable | ) |

Calculate geometry retarget table.

Parameters:

  | ppTable | [out] Calculated and cached geometry retargetting table.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::ContainsMeshObj | ( | IRsNode * | pNode | ) |

Verify if Node contains Mesh Object.

Parameters:

  | pNode | [in] Node name.

Returns:
  S_OK, if node contains Mesh Object, otherwise return standard HRESULT processing can be applied to returned value.

HRESULT IRfMeshSet::GetEdgeNeighbors | ( | [out, retval] IRdEdgeNeighborsStream ** | ppNeighbors | ) |

Creates stream containing neighbor triangle-edges of each edge.

- Each neighbor is represented as an index of 3*triangle + edge index.
- -1 value means that edge has no neighboring triangle.

Remarks:
  Requires:
  - STREAMID_VERTEXES_COORDINATES stream.
  - STREAMID_TRIANGLES_INDICES stream.

  Returns:

  - STREAMID_TRIANGLES_TRIANGLENEIGHS stream.

Returns:
  ppNeighbors [out,retval] Stream returned.

  standard HRESULT processing can be applied to returned value.